From 0104bf6b3461ad24665dcc9b2981dd2fc91d2319 Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Fri, 11 Sep 2020 11:27:53 +0200 Subject: [PATCH 01/15] try to fix the tests --- docs/src/demos/Extensions/Blockquote/index.spec.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/src/demos/Extensions/Blockquote/index.spec.js b/docs/src/demos/Extensions/Blockquote/index.spec.js index d7c4d1d2..0e77f053 100644 --- a/docs/src/demos/Extensions/Blockquote/index.spec.js +++ b/docs/src/demos/Extensions/Blockquote/index.spec.js @@ -11,11 +11,13 @@ context('/api/extensions/blockquote', () => { describe('blockquote', () => { it('the button should make the selected line a blockquote', () => { + cy.get('.ProseMirror blockquote').should('not.exist') cy.get('.demo__preview button:first').click({ force: true }) cy.get('.ProseMirror').contains('blockquote', 'Example Text') }) it('the button should toggle the blockquote', () => { + cy.get('.ProseMirror blockquote').should('not.exist') cy.get('.demo__preview button:first').click({ force: true }) cy.get('.ProseMirror').contains('blockquote', 'Example Text') cy.get('.demo__preview button:first').click({ force: true }) @@ -28,6 +30,7 @@ context('/api/extensions/blockquote', () => { }) it('the keyboard shortcut should toggle the blockquote', () => { + cy.get('.ProseMirror blockquote').should('not.exist') cy.get('.ProseMirror').type('{meta}{shift}9', {force: true}) cy.get('.ProseMirror').contains('blockquote', 'Example Text') cy.get('.ProseMirror').type('{meta}{shift}9', {force: true}) From 8707d27ff3092766aa63ac98a57038aa0febfa73 Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Fri, 11 Sep 2020 11:40:35 +0200 Subject: [PATCH 02/15] add slack notifications to CI --- .github/workflows/main.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7e2f5c7c..b945a112 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,6 +6,9 @@ jobs: test: runs-on: ubuntu-latest + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + strategy: matrix: node-version: [14] @@ -20,6 +23,7 @@ jobs: - uses: actions/checkout@v2.3.2 - name: Run tests with Cypress + id: cypress uses: cypress-io/github-action@v2 with: cache-key: node-v${{ matrix.node }}-on-${{ runner.os }}-hash-${{ hashFiles('yarn.lock') }} @@ -42,6 +46,13 @@ jobs: name: cypress-videos path: tests/cypress/videos + - uses: act10ns/slack@v1 + with: + status: ${{ job.status }} + steps: ${{ toJson(steps) }} + channel: '#tiptap-next' + if: failure() + build: runs-on: ubuntu-latest @@ -59,7 +70,16 @@ jobs: - uses: actions/checkout@v2.3.2 - name: Install dependencies + id: install-dependencies run: yarn install - name: Build packages dependencies + id: build-packages run: yarn build:packages + + - uses: act10ns/slack@v1 + with: + status: ${{ job.status }} + steps: ${{ toJson(steps) }} + channel: '#tiptap-next' + if: failure() From 06edddb47931c643a94c8557615cebd231002dc6 Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Fri, 11 Sep 2020 11:49:08 +0200 Subject: [PATCH 03/15] increase the cypress viewport size --- tests/cypress.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/cypress.json b/tests/cypress.json index 0e264d5c..3db2baab 100644 --- a/tests/cypress.json +++ b/tests/cypress.json @@ -1,5 +1,7 @@ { "baseUrl": "http://localhost:3000", "integrationFolder": "../docs/src/", - "testFiles": "**/*.spec.js" + "testFiles": "**/*.spec.js", + "viewportWidth": 1280, + "viewportHeight": 1280 } From 62fa82aa402053fd82286b8c10ca3ed47a36ea46 Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Fri, 11 Sep 2020 11:50:14 +0200 Subject: [PATCH 04/15] try macos for CI --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b945a112..c8625909 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,7 +4,7 @@ on: [push, pull_request] jobs: test: - runs-on: ubuntu-latest + runs-on: macos-latest env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} @@ -54,7 +54,7 @@ jobs: if: failure() build: - runs-on: ubuntu-latest + runs-on: macos-latest strategy: matrix: From add962d8463ac350214af7178aa269bd72c935c8 Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Fri, 11 Sep 2020 11:53:48 +0200 Subject: [PATCH 05/15] give the slack notifications step a name --- .github/workflows/main.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c8625909..a5384afd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -46,7 +46,8 @@ jobs: name: cypress-videos path: tests/cypress/videos - - uses: act10ns/slack@v1 + - name: Send Slack notifications + uses: act10ns/slack@v1 with: status: ${{ job.status }} steps: ${{ toJson(steps) }} @@ -77,7 +78,8 @@ jobs: id: build-packages run: yarn build:packages - - uses: act10ns/slack@v1 + - name: Send Slack notifications + uses: act10ns/slack@v1 with: status: ${{ job.status }} steps: ${{ toJson(steps) }} From d69065640babaf428db4a33c692e30f1e7f0d1cc Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Fri, 11 Sep 2020 12:00:16 +0200 Subject: [PATCH 06/15] switch back to ubuntu --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a5384afd..b61ade0e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,7 +4,7 @@ on: [push, pull_request] jobs: test: - runs-on: macos-latest + runs-on: ubuntu-latest env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} @@ -55,7 +55,7 @@ jobs: if: failure() build: - runs-on: macos-latest + runs-on: ubuntu-latest strategy: matrix: From 4129d13f1910692ea20582ad094d4968dadabc5b Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Fri, 11 Sep 2020 12:12:15 +0200 Subject: [PATCH 07/15] add tests to the paragraph extension --- .../demos/Extensions/Paragraph/index.spec.js | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/docs/src/demos/Extensions/Paragraph/index.spec.js b/docs/src/demos/Extensions/Paragraph/index.spec.js index 682369eb..e10cf685 100644 --- a/docs/src/demos/Extensions/Paragraph/index.spec.js +++ b/docs/src/demos/Extensions/Paragraph/index.spec.js @@ -1,5 +1,32 @@ context('/api/extensions/paragraph', () => { beforeEach(() => { cy.visit('/api/extensions/paragraph') + + cy.get('.ProseMirror').window().then(window => { + const { editor } = window + editor.clearContent() + }) + }) + + describe('paragraph', () => { + it('text should be wrapped in a paragraph by default', () => { + cy.get('.ProseMirror').type('Example Text', {force: true}) + cy.get('.ProseMirror').contains('p', 'Example Text') + cy.get('.ProseMirror').find('p').should('have.length', 1) + }) + + it('enter should make a new paragraph', () => { + cy.get('.ProseMirror').type('First Paragraph{enter}Second Paragraph', {force: true}) + cy.get('.ProseMirror').find('p').should('have.length', 2) + cy.get('.ProseMirror').contains('p:first', 'First Paragraph') + cy.get('.ProseMirror').contains('p:nth-child(2)', 'Second Paragraph') + }) + + it('backspace should remove the second paragraph', () => { + cy.get('.ProseMirror').type('{enter}', {force: true}) + cy.get('.ProseMirror').find('p').should('have.length', 2) + cy.get('.ProseMirror').type('{backspace}', {force: true}) + cy.get('.ProseMirror').find('p').should('have.length', 1) + }) }) }) \ No newline at end of file From c6523228ca7ab60ca9a0d373dc368da705271a20 Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Fri, 11 Sep 2020 12:19:25 +0200 Subject: [PATCH 08/15] fix yaml --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b61ade0e..d377e9b5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -47,7 +47,7 @@ jobs: path: tests/cypress/videos - name: Send Slack notifications - uses: act10ns/slack@v1 + uses: act10ns/slack@v1 with: status: ${{ job.status }} steps: ${{ toJson(steps) }} From 61208efe3f51d1309aaf6d6d4da6c2611718717f Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Fri, 11 Sep 2020 12:56:58 +0200 Subject: [PATCH 09/15] add heading tests --- .../demos/Extensions/Heading/index.spec.js | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/docs/src/demos/Extensions/Heading/index.spec.js b/docs/src/demos/Extensions/Heading/index.spec.js index 065b0c79..51a4d8b1 100644 --- a/docs/src/demos/Extensions/Heading/index.spec.js +++ b/docs/src/demos/Extensions/Heading/index.spec.js @@ -1,5 +1,31 @@ context('/api/extensions/heading', () => { beforeEach(() => { cy.visit('/api/extensions/heading') + + cy.get('.ProseMirror').window().then(window => { + const { editor } = window + editor.setContent('

Example Text

') + editor.focus().selectAll() + }) + }) + + describe('blockquote', () => { + it('the button should make the selected line a h1', () => { + cy.get('.ProseMirror h1').should('not.exist') + cy.get('.demo__preview button:nth-child(1)').click({ force: true }) + cy.get('.ProseMirror').contains('h1', 'Example Text') + }) + + it('the button should make the selected line a h2', () => { + cy.get('.ProseMirror h2').should('not.exist') + cy.get('.demo__preview button:nth-child(2)').click({ force: true }) + cy.get('.ProseMirror').contains('h2', 'Example Text') + }) + + it('the button should make the selected line a h3', () => { + cy.get('.ProseMirror h3').should('not.exist') + cy.get('.demo__preview button:nth-child(3)').click({ force: true }) + cy.get('.ProseMirror').contains('h3', 'Example Text') + }) }) }) \ No newline at end of file From c08b35e3524b8c0d66b03f1d048d2f3270c973b5 Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Fri, 11 Sep 2020 12:57:16 +0200 Subject: [PATCH 10/15] fix tests --- docs/src/demos/Extensions/Blockquote/index.spec.js | 4 ++++ docs/src/demos/Extensions/CodeBlock/index.spec.js | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/docs/src/demos/Extensions/Blockquote/index.spec.js b/docs/src/demos/Extensions/Blockquote/index.spec.js index 0e77f053..af396cb1 100644 --- a/docs/src/demos/Extensions/Blockquote/index.spec.js +++ b/docs/src/demos/Extensions/Blockquote/index.spec.js @@ -20,6 +20,8 @@ context('/api/extensions/blockquote', () => { cy.get('.ProseMirror blockquote').should('not.exist') cy.get('.demo__preview button:first').click({ force: true }) cy.get('.ProseMirror').contains('blockquote', 'Example Text') + + cy.get('.ProseMirror').type('{selectall}', {force: true}) cy.get('.demo__preview button:first').click({ force: true }) cy.get('.ProseMirror blockquote').should('not.exist') }) @@ -33,6 +35,8 @@ context('/api/extensions/blockquote', () => { cy.get('.ProseMirror blockquote').should('not.exist') cy.get('.ProseMirror').type('{meta}{shift}9', {force: true}) cy.get('.ProseMirror').contains('blockquote', 'Example Text') + + cy.get('.ProseMirror').type('{selectall}', {force: true}) cy.get('.ProseMirror').type('{meta}{shift}9', {force: true}) cy.get('.ProseMirror blockquote').should('not.exist') }) diff --git a/docs/src/demos/Extensions/CodeBlock/index.spec.js b/docs/src/demos/Extensions/CodeBlock/index.spec.js index c9cb0245..51c40a31 100644 --- a/docs/src/demos/Extensions/CodeBlock/index.spec.js +++ b/docs/src/demos/Extensions/CodeBlock/index.spec.js @@ -18,6 +18,8 @@ context('/api/extensions/code-block', () => { it('the button should toggle the code block', () => { cy.get('.demo__preview button:first').click({ force: true }) cy.get('.ProseMirror').contains('pre', 'Example Text') + + cy.get('.ProseMirror').type('{selectall}', {force: true}) cy.get('.demo__preview button:first').click({ force: true }) cy.get('.ProseMirror pre').should('not.exist') }) @@ -30,6 +32,8 @@ context('/api/extensions/code-block', () => { it('the keyboard shortcut should toggle the code block', () => { cy.get('.ProseMirror').type('{control}{shift}\\', {force: true}) cy.get('.ProseMirror').contains('pre', 'Example Text') + + cy.get('.ProseMirror').type('{selectall}', {force: true}) cy.get('.ProseMirror').type('{control}{shift}\\', {force: true}) cy.get('.ProseMirror pre').should('not.exist') }) From fe5d2ee0a9db8d82ea109a57d768f4fd42b82106 Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Fri, 11 Sep 2020 14:27:09 +0200 Subject: [PATCH 11/15] add slack webhook url to build stage --- .github/workflows/main.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d377e9b5..e1d27904 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -57,6 +57,9 @@ jobs: build: runs-on: ubuntu-latest + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + strategy: matrix: node-version: [14] From 2e67d64d688026b88fe7978a3df113058793f2cb Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Fri, 11 Sep 2020 14:53:53 +0200 Subject: [PATCH 12/15] add best practices links to the sidebar --- docs/src/links.yaml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/src/links.yaml b/docs/src/links.yaml index 851ff501..73558365 100644 --- a/docs/src/links.yaml +++ b/docs/src/links.yaml @@ -194,4 +194,16 @@ - title: getSchema link: /api/schema/get-schema - title: generateHtml - link: /api/schema/generate-html \ No newline at end of file + link: /api/schema/generate-html + +- title: Best Practices + items: + - title: Overview + link: /best-practices/overview/ + draft: true + - title: Menus + link: /best-practices/menus/ + draft: true + - title: Keyboard Shortcuts + link: /best-practices/keyboard-shortcuts/ + draft: true \ No newline at end of file From 1b414ab33c0b66462f4eb5b1c5fd3c27f88196f7 Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Fri, 11 Sep 2020 15:57:33 +0200 Subject: [PATCH 13/15] really fix tests --- docs/src/demos/Examples/Basic/index.spec.js | 111 +++++++------ .../Examples/ExportHtmlOrJson/index.spec.js | 106 ++++++------- docs/src/demos/Examples/Focus/index.spec.js | 14 +- docs/src/demos/Examples/History/index.spec.js | 40 +++-- .../Examples/MarkdownShortcuts/index.spec.js | 149 ++++++++---------- .../src/demos/Examples/ReadOnly/index.spec.js | 28 ++-- docs/src/demos/Examples/Simple/index.spec.js | 2 +- .../demos/Extensions/Blockquote/index.spec.js | 72 ++++----- docs/src/demos/Extensions/Bold/index.spec.js | 61 +++---- docs/src/demos/Extensions/Code/index.spec.js | 25 +-- .../demos/Extensions/CodeBlock/index.spec.js | 66 ++++---- .../demos/Extensions/Document/index.spec.js | 2 +- .../demos/Extensions/HardBreak/index.spec.js | 34 ++-- .../demos/Extensions/Heading/index.spec.js | 37 ++--- .../demos/Extensions/History/index.spec.js | 50 +++--- .../Extensions/HorizontalRule/index.spec.js | 46 +++--- .../src/demos/Extensions/Italic/index.spec.js | 41 ++--- .../demos/Extensions/Paragraph/index.spec.js | 39 ++--- .../src/demos/Extensions/Strike/index.spec.js | 51 +++--- .../demos/Extensions/Underline/index.spec.js | 41 ++--- 20 files changed, 501 insertions(+), 514 deletions(-) diff --git a/docs/src/demos/Examples/Basic/index.spec.js b/docs/src/demos/Examples/Basic/index.spec.js index 5436ee74..60986ad7 100644 --- a/docs/src/demos/Examples/Basic/index.spec.js +++ b/docs/src/demos/Examples/Basic/index.spec.js @@ -1,85 +1,82 @@ context('/examples/basic', () => { - beforeEach(() => { + before(() => { cy.visit('/examples/basic') + }) + beforeEach(() => { cy.get('.ProseMirror').window().then(window => { const { editor } = window editor.setContent('

foo

') + cy.wait(10) }) }) - describe('export', () => { - it('should return html', () => { - cy.get('.ProseMirror').window().then(window => { - const { editor } = window - const html = editor.html() + it('should return html', () => { + cy.get('.ProseMirror').window().then(window => { + const { editor } = window + const html = editor.html() - expect(html).to.equal('

foo

') - }) + expect(html).to.equal('

foo

') }) + }) - it('should return json', () => { - cy.get('.ProseMirror').window().then(window => { - const { editor } = window - const json = editor.json() + it('should return json', () => { + cy.get('.ProseMirror').window().then(window => { + const { editor } = window + const json = editor.json() - expect(json).to.deep.equal({ - type: 'document', - content: [ - { - type: 'paragraph', - content: [ - { - type: 'text', - text: 'foo' - } - ] - } - ] - }) + expect(json).to.deep.equal({ + type: 'document', + content: [ + { + type: 'paragraph', + content: [ + { + type: 'text', + text: 'foo' + } + ] + } + ] }) }) }) - describe('insertText', () => { - it('should prepend', () => { - cy.get('.ProseMirror').window().then(window => { - const { editor } = window + it('should prepend', () => { + cy.get('.ProseMirror').window().then(window => { + const { editor } = window - editor.focus(1).insertText('bar') - cy.get('.ProseMirror p:first').should('contain', 'barfoo') - }) - }) - - it('should append', () => { - cy.get('.ProseMirror').window().then(window => { - const { editor } = window - - editor.focus('end').insertText('bar') - cy.get('.ProseMirror p:first').should('contain', 'foobar') - }) + editor.focus(1).insertText('bar') + cy.get('.ProseMirror p:first').should('contain', 'barfoo') }) }) - describe('insertHTML', () => { - it('should prepend', () => { - cy.get('.ProseMirror').window().then(window => { - const { editor } = window + it('should append', () => { + cy.get('.ProseMirror').window().then(window => { + const { editor } = window - editor.focus('start').insertHTML('

bar

') - cy.get('.ProseMirror p:first').should('contain', 'bar').should('not.contain', 'foo') - cy.get('.ProseMirror p:last').should('contain', 'foo').should('not.contain', 'bar') - }) + editor.focus('end').insertText('bar') + cy.get('.ProseMirror p:first').should('contain', 'foobar') }) + }) - it('should append', () => { - cy.get('.ProseMirror').window().then(window => { - const { editor } = window + it('should prepend', () => { + cy.get('.ProseMirror').window().then(window => { + const { editor } = window - editor.focus('end').insertHTML('

bar

') - cy.get('.ProseMirror p:first').should('contain', 'foo').should('not.contain', 'bar') - cy.get('.ProseMirror p:last').should('contain', 'bar').should('not.contain', 'foo') - }) + editor.focus('start').insertHTML('

bar

') + cy.get('.ProseMirror p:first').should('contain', 'bar').should('not.contain', 'foo') + cy.get('.ProseMirror p:last').should('contain', 'foo').should('not.contain', 'bar') + }) + }) + + it('should append', () => { + cy.get('.ProseMirror').window().then(window => { + const { editor } = window + + editor.focus('end').insertHTML('

bar

') + cy.get('.ProseMirror p:first').should('contain', 'foo').should('not.contain', 'bar') + cy.get('.ProseMirror p:last').should('contain', 'bar').should('not.contain', 'foo') }) }) }) \ No newline at end of file diff --git a/docs/src/demos/Examples/ExportHtmlOrJson/index.spec.js b/docs/src/demos/Examples/ExportHtmlOrJson/index.spec.js index ad1ef002..4f327eff 100644 --- a/docs/src/demos/Examples/ExportHtmlOrJson/index.spec.js +++ b/docs/src/demos/Examples/ExportHtmlOrJson/index.spec.js @@ -3,62 +3,60 @@ context('/examples/export-html-or-json', () => { cy.visit('/examples/export-html-or-json') }) - describe('export', () => { - it('should return json', () => { - cy.get('.ProseMirror').window().then(window => { - const { editor } = window - const json = editor.json() + it('should return json', () => { + cy.get('.ProseMirror').window().then(window => { + const { editor } = window + const json = editor.json() - expect(json).to.deep.equal({ - 'type': 'document', - 'content': [ - { - 'type': 'paragraph', - 'content': [ - { - 'type': 'text', - 'text': 'You are able to export your data as ' - }, - { - 'type': 'text', - 'marks': [ - { - 'type': 'code' - } - ], - 'text': 'HTML' - }, - { - 'type': 'text', - 'text': ' or ' - }, - { - 'type': 'text', - 'marks': [ - { - 'type': 'code' - } - ], - 'text': 'JSON' - }, - { - 'type': 'text', - 'text': '.' - } - ] - } - ] - }) - }) - }) - - it('should return html', () => { - cy.get('.ProseMirror').window().then(window => { - const { editor } = window - const html = editor.html() - - expect(html).to.equal('

You are able to export your data as HTML or JSON.

') + expect(json).to.deep.equal({ + 'type': 'document', + 'content': [ + { + 'type': 'paragraph', + 'content': [ + { + 'type': 'text', + 'text': 'You are able to export your data as ' + }, + { + 'type': 'text', + 'marks': [ + { + 'type': 'code' + } + ], + 'text': 'HTML' + }, + { + 'type': 'text', + 'text': ' or ' + }, + { + 'type': 'text', + 'marks': [ + { + 'type': 'code' + } + ], + 'text': 'JSON' + }, + { + 'type': 'text', + 'text': '.' + } + ] + } + ] }) }) }) + + it('should return html', () => { + cy.get('.ProseMirror').window().then(window => { + const { editor } = window + const html = editor.html() + + expect(html).to.equal('

You are able to export your data as HTML or JSON.

') + }) + }) }) \ No newline at end of file diff --git a/docs/src/demos/Examples/Focus/index.spec.js b/docs/src/demos/Examples/Focus/index.spec.js index bed13ccd..dc4c2255 100644 --- a/docs/src/demos/Examples/Focus/index.spec.js +++ b/docs/src/demos/Examples/Focus/index.spec.js @@ -1,16 +1,14 @@ context('/examples/focus', () => { - beforeEach(() => { + before(() => { cy.visit('/examples/focus') }) - describe('focus class', () => { - it('should have class', () => { - cy.get('.ProseMirror').window().then(window => { - const { editor } = window - editor.focus('start') + it('should have class', () => { + cy.get('.ProseMirror').window().then(window => { + const { editor } = window + editor.focus('start') - cy.get('.ProseMirror p:first').should('have.class', 'has-focus') - }) + cy.get('.ProseMirror p:first').should('have.class', 'has-focus') }) }) }) \ No newline at end of file diff --git a/docs/src/demos/Examples/History/index.spec.js b/docs/src/demos/Examples/History/index.spec.js index ba2fb305..66261f5e 100644 --- a/docs/src/demos/Examples/History/index.spec.js +++ b/docs/src/demos/Examples/History/index.spec.js @@ -3,34 +3,32 @@ context('/examples/history', () => { cy.visit('/examples/history') }) - describe('undo', () => { - it('should not have a mistake', () => { - cy.get('.ProseMirror').window().then(window => { - const { editor } = window - const html = editor.html() + it('should not have a mistake', () => { + cy.get('.ProseMirror').window().then(window => { + const { editor } = window + const html = editor.html() - cy.get('.ProseMirror h2:first').should('not.contain', 'Mistake') - }) + cy.get('.ProseMirror h2:first').should('not.contain', 'Mistake') }) + }) - it('should have a mistake', () => { - cy.get('.ProseMirror').window().then(window => { - const { editor } = window - const html = editor.html() + it('should have a mistake', () => { + cy.get('.ProseMirror').window().then(window => { + const { editor } = window + const html = editor.html() - editor.insertText('Mistake') - cy.get('.ProseMirror h2:first').should('contain', 'Mistake') - }) + editor.insertText('Mistake') + cy.get('.ProseMirror h2:first').should('contain', 'Mistake') }) + }) - it('the mistake should be removed again', () => { - cy.get('.ProseMirror').window().then(window => { - const { editor } = window - const html = editor.html() + it('the mistake should be removed again', () => { + cy.get('.ProseMirror').window().then(window => { + const { editor } = window + const html = editor.html() - editor.undo() - cy.get('.ProseMirror h2:first').should('not.contain', 'Mistake') - }) + editor.undo() + cy.get('.ProseMirror h2:first').should('not.contain', 'Mistake') }) }) }) \ No newline at end of file diff --git a/docs/src/demos/Examples/MarkdownShortcuts/index.spec.js b/docs/src/demos/Examples/MarkdownShortcuts/index.spec.js index 4502f7bf..c24fdf3a 100644 --- a/docs/src/demos/Examples/MarkdownShortcuts/index.spec.js +++ b/docs/src/demos/Examples/MarkdownShortcuts/index.spec.js @@ -1,100 +1,91 @@ context('/examples/markdown-shortcuts', () => { - beforeEach(() => { + before(() => { cy.visit('/examples/markdown-shortcuts') + }) + beforeEach(() => { cy.get('.ProseMirror').window().then(window => { const { editor } = window editor.clearContent() + cy.wait(10) }) }) - describe('headlines', () => { - it('should make a h1', () => { - cy.get('.ProseMirror') - .type('# Headline', {force: true}) - .contains('h1', 'Headline') - }) - - it('should make a h2', () => { - cy.get('.ProseMirror') - .type('## Headline', {force: true}) - .contains('h2', 'Headline') - }) - - it('should make a h3', () => { - cy.get('.ProseMirror') - .type('### Headline', {force: true}) - .contains('h3', 'Headline') - }) - - it('should make a h4', () => { - cy.get('.ProseMirror') - .type('#### Headline', {force: true}) - .contains('h4', 'Headline') - }) - - it('should make a h5', () => { - cy.get('.ProseMirror') - .type('##### Headline', {force: true}) - .contains('h5', 'Headline') - }) - - it('should make a h6', () => { - cy.get('.ProseMirror') - .type('###### Headline', {force: true}) - .contains('h6', 'Headline') - }) + it('should make a h1', () => { + cy.get('.ProseMirror') + .type('# Headline', { force: true }) + .contains('h1', 'Headline') }) - describe('code', () => { - it('should create inline code', () => { - cy.get('.ProseMirror') - .type('`$foobar`', {force: true}) - .contains('code', '$foobar') - }) + it('should make a h2', () => { + cy.get('.ProseMirror') + .type('## Headline', { force: true }) + .contains('h2', 'Headline') }) - describe('code block', () => { - it.skip('should create a code block without language', () => { - cy.get('.ProseMirror') - .type('``` {enter}const foo = bar{enter}```', {force: true}) - .contains('pre', 'const foo = bar') - }) + it('should make a h3', () => { + cy.get('.ProseMirror') + .type('### Headline', { force: true }) + .contains('h3', 'Headline') }) - describe('bullet list', () => { - it.skip('should create a bullet list from asteriks', () => { - cy.get('.ProseMirror') - .type('* foobar', {force: true}) - .contains('ul', 'foobar') - }) - - it.skip('should create a bullet list from dashes', () => { - cy.get('.ProseMirror') - .type('- foobar', {force: true}) - .contains('ul', 'foobar') - }) - - it.skip('should create a bullet list from pluses', () => { - cy.get('.ProseMirror') - .type('+ foobar', {force: true}) - .contains('ul', 'foobar') - }) + it('should make a h4', () => { + cy.get('.ProseMirror') + .type('#### Headline', { force: true }) + .contains('h4', 'Headline') }) - describe('ordered list', () => { - it.skip('should create a ordered list', () => { - cy.get('.ProseMirror') - .type('1. foobar', {force: true}) - .contains('ol', 'foobar') - }) + it('should make a h5', () => { + cy.get('.ProseMirror') + .type('##### Headline', { force: true }) + .contains('h5', 'Headline') }) - describe('blockquote', () => { - it.skip('should create a blockquote', () => { - cy.get('.ProseMirror') - .type('> foobar', {force: true}) - .contains('blockquote', 'foobar') - }) + it('should make a h6', () => { + cy.get('.ProseMirror') + .type('###### Headline', { force: true }) + .contains('h6', 'Headline') + }) + + it('should create inline code', () => { + cy.get('.ProseMirror') + .type('`$foobar`', { force: true }) + .contains('code', '$foobar') + }) + + it.skip('should create a code block without language', () => { + cy.get('.ProseMirror') + .type('``` {enter}const foo = bar{enter}```', { force: true }) + .contains('pre', 'const foo = bar') + }) + + it.skip('should create a bullet list from asteriks', () => { + cy.get('.ProseMirror') + .type('* foobar', { force: true }) + .contains('ul', 'foobar') + }) + + it.skip('should create a bullet list from dashes', () => { + cy.get('.ProseMirror') + .type('- foobar', { force: true }) + .contains('ul', 'foobar') + }) + + it.skip('should create a bullet list from pluses', () => { + cy.get('.ProseMirror') + .type('+ foobar', { force: true }) + .contains('ul', 'foobar') + }) + + it.skip('should create a ordered list', () => { + cy.get('.ProseMirror') + .type('1. foobar', { force: true }) + .contains('ol', 'foobar') + }) + + it.skip('should create a blockquote', () => { + cy.get('.ProseMirror') + .type('> foobar', { force: true }) + .contains('blockquote', 'foobar') }) }) \ No newline at end of file diff --git a/docs/src/demos/Examples/ReadOnly/index.spec.js b/docs/src/demos/Examples/ReadOnly/index.spec.js index b3f993d8..a47fe212 100644 --- a/docs/src/demos/Examples/ReadOnly/index.spec.js +++ b/docs/src/demos/Examples/ReadOnly/index.spec.js @@ -3,27 +3,25 @@ context('/examples/read-only', () => { cy.visit('/examples/read-only') }) - describe('editable', () => { - it.skip('should be read-only', () => { - cy.get('.ProseMirror').window().then(window => { - cy.get('#editable').uncheck() + it.skip('should be read-only', () => { + cy.get('.ProseMirror').window().then(window => { + cy.get('#editable').uncheck() - const { editor } = window - editor.insertText('Edited: ') + const { editor } = window + editor.insertText('Edited: ') - cy.get('.ProseMirror p:first').should('not.contain', 'Edited: ') - }) + cy.get('.ProseMirror p:first').should('not.contain', 'Edited: ') }) + }) - it.skip('should be editable', () => { - cy.get('.ProseMirror').window().then(window => { - cy.get('#editable').check() + it.skip('should be editable', () => { + cy.get('.ProseMirror').window().then(window => { + cy.get('#editable').check() - const { editor } = window - editor.insertText('Edited: ') + const { editor } = window + editor.insertText('Edited: ') - cy.get('.ProseMirror p:first').should('contain', 'Edited: ') - }) + cy.get('.ProseMirror p:first').should('contain', 'Edited: ') }) }) }) \ No newline at end of file diff --git a/docs/src/demos/Examples/Simple/index.spec.js b/docs/src/demos/Examples/Simple/index.spec.js index e88b3c84..c518a16b 100644 --- a/docs/src/demos/Examples/Simple/index.spec.js +++ b/docs/src/demos/Examples/Simple/index.spec.js @@ -1,5 +1,5 @@ context('/examples/simple', () => { - beforeEach(() => { + before(() => { cy.visit('/examples/simple') }) }) \ No newline at end of file diff --git a/docs/src/demos/Extensions/Blockquote/index.spec.js b/docs/src/demos/Extensions/Blockquote/index.spec.js index af396cb1..a856e065 100644 --- a/docs/src/demos/Extensions/Blockquote/index.spec.js +++ b/docs/src/demos/Extensions/Blockquote/index.spec.js @@ -1,55 +1,51 @@ context('/api/extensions/blockquote', () => { - beforeEach(() => { + before(() => { cy.visit('/api/extensions/blockquote') + }) + beforeEach(() => { cy.get('.ProseMirror').window().then(window => { const { editor } = window editor.setContent('

Example Text

') - editor.focus().selectAll() + editor.selectAll() + cy.wait(10) }) }) - describe('blockquote', () => { - it('the button should make the selected line a blockquote', () => { - cy.get('.ProseMirror blockquote').should('not.exist') - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').contains('blockquote', 'Example Text') - }) + it('the button should make the selected line a blockquote', () => { + cy.get('.ProseMirror blockquote').should('not.exist') + cy.get('.demo__preview button:first').click({ force: true }) + cy.get('.ProseMirror').contains('blockquote', 'Example Text') + }) - it('the button should toggle the blockquote', () => { - cy.get('.ProseMirror blockquote').should('not.exist') - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').contains('blockquote', 'Example Text') + it('the button should toggle the blockquote', () => { + cy.get('.ProseMirror blockquote').should('not.exist') + cy.get('.demo__preview button:first').click({ force: true }) + cy.get('.ProseMirror').contains('blockquote', 'Example Text') - cy.get('.ProseMirror').type('{selectall}', {force: true}) - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror blockquote').should('not.exist') - }) + cy.get('.ProseMirror').type('{selectall}', { force: true }) + cy.get('.demo__preview button:first').click({ force: true }) + cy.get('.ProseMirror blockquote').should('not.exist') + }) - it('the keyboard shortcut should make the selected line a blockquote', () => { - cy.get('.ProseMirror').type('{meta}{shift}9', {force: true}) - cy.get('.ProseMirror').contains('blockquote', 'Example Text') - }) + it('the keyboard shortcut should make the selected line a blockquote', () => { + cy.get('.ProseMirror').type('{meta}{shift}9', { force: true }) + cy.get('.ProseMirror').contains('blockquote', 'Example Text') + }) - it('the keyboard shortcut should toggle the blockquote', () => { - cy.get('.ProseMirror blockquote').should('not.exist') - cy.get('.ProseMirror').type('{meta}{shift}9', {force: true}) - cy.get('.ProseMirror').contains('blockquote', 'Example Text') + it('the keyboard shortcut should toggle the blockquote', () => { + cy.get('.ProseMirror blockquote').should('not.exist') + cy.get('.ProseMirror').type('{meta}{shift}9', { force: true }) + cy.get('.ProseMirror').contains('blockquote', 'Example Text') - cy.get('.ProseMirror').type('{selectall}', {force: true}) - cy.get('.ProseMirror').type('{meta}{shift}9', {force: true}) - cy.get('.ProseMirror blockquote').should('not.exist') - }) + cy.get('.ProseMirror').type('{selectall}', { force: true }) + cy.get('.ProseMirror').type('{meta}{shift}9', { force: true }) + cy.get('.ProseMirror blockquote').should('not.exist') + }) - it('should make a blockquote from markdown shortcuts', () => { - cy.get('.ProseMirror').window().then(window => { - const { editor } = window - editor.clearContent() - - cy.get('.ProseMirror') - .type('> Quote', {force: true}) - .contains('blockquote', 'Quote') - }) - }) + it('should make a blockquote from markdown shortcuts', () => { + cy.get('.ProseMirror') + .type('> Quote', { force: true }) + .contains('blockquote', 'Quote') }) }) \ No newline at end of file diff --git a/docs/src/demos/Extensions/Bold/index.spec.js b/docs/src/demos/Extensions/Bold/index.spec.js index b80b0a33..b32fdf25 100644 --- a/docs/src/demos/Extensions/Bold/index.spec.js +++ b/docs/src/demos/Extensions/Bold/index.spec.js @@ -1,45 +1,48 @@ context('/api/extensions/bold', () => { - beforeEach(() => { + before(() => { cy.visit('/api/extensions/bold') + }) + beforeEach(() => { cy.get('.ProseMirror').window().then(window => { const { editor } = window editor.setContent('

Example Text

') - editor.focus().selectAll() + editor.selectAll() + cy.wait(10) }) }) - describe('bold', () => { - it('the button should make the selected text bold', () => { - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').contains('strong', 'Example Text') - }) + it('the button should make the selected text bold', () => { + cy.get('.demo__preview button:first').click({ force: true }) + cy.get('.ProseMirror').contains('strong', 'Example Text') + }) - it('the button should toggle the selected text bold', () => { - cy.get('.demo__preview button:first').dblclick({ force: true }) - cy.get('.ProseMirror strong').should('not.exist') - }) + it('the button should toggle the selected text bold', () => { + cy.get('.demo__preview button:first').click({ force: true }) + cy.get('.ProseMirror').type('{selectall}', { force: true }) + cy.get('.demo__preview button:first').click({ force: true }) + cy.get('.ProseMirror strong').should('not.exist') + }) - it('the keyboard shortcut should make the selected text bold', () => { - cy.get('.ProseMirror').type('{meta}b', {force: true}) - cy.get('.ProseMirror').contains('strong', 'Example Text') - }) + it('the keyboard shortcut should make the selected text bold', () => { + cy.get('.ProseMirror').type('{meta}b', { force: true }) + cy.get('.ProseMirror').contains('strong', 'Example Text') + }) - it('the keyboard shortcut should toggle the selected text bold', () => { - cy.get('.ProseMirror').type('{meta}b', {force: true}).type('{meta}b', {force: true}) - cy.get('.ProseMirror strong').should('not.exist') - }) + it('the keyboard shortcut should toggle the selected text bold', () => { + cy.get('.ProseMirror').type('{meta}b', { force: true }).type('{meta}b', { force: true }) + cy.get('.ProseMirror strong').should('not.exist') + }) - it('should make a bold text from the default markdown shortcut', () => { - cy.get('.ProseMirror') - .type('**Bold**', {force: true}) - .contains('strong', 'Bold') - }) + it('should make a bold text from the default markdown shortcut', () => { + cy.get('.ProseMirror') + .type('**Bold**', { force: true }) + .contains('strong', 'Bold') + }) - it('should make a bold text from the alternative markdown shortcut', () => { - cy.get('.ProseMirror') - .type('__Bold__', {force: true}) - .contains('strong', 'Bold') - }) + it('should make a bold text from the alternative markdown shortcut', () => { + cy.get('.ProseMirror') + .type('__Bold__', { force: true }) + .contains('strong', 'Bold') }) }) \ No newline at end of file diff --git a/docs/src/demos/Extensions/Code/index.spec.js b/docs/src/demos/Extensions/Code/index.spec.js index 11727f60..54bf6693 100644 --- a/docs/src/demos/Extensions/Code/index.spec.js +++ b/docs/src/demos/Extensions/Code/index.spec.js @@ -1,23 +1,26 @@ context('/api/extensions/code', () => { - beforeEach(() => { + before(() => { cy.visit('/api/extensions/code') + }) + beforeEach(() => { cy.get('.ProseMirror').window().then(window => { const { editor } = window editor.setContent('

Example Text

') - editor.focus().selectAll() + editor.selectAll() + cy.wait(10) }) }) - describe('code', () => { - it('should mark the selected text as inline code', () => { - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').contains('code', 'Example Text') - }) + it('should mark the selected text as inline code', () => { + cy.get('.demo__preview button:first').click({ force: true }) + cy.get('.ProseMirror').contains('code', 'Example Text') + }) - it('should toggle the selected text as inline code', () => { - cy.get('.demo__preview button:first').dblclick({ force: true }) - cy.get('.ProseMirror code').should('not.exist') - }) + it('should toggle the selected text as inline code', () => { + cy.get('.demo__preview button:first').click({ force: true }) + cy.get('.ProseMirror').type('{selectall}', { force: true }) + cy.get('.demo__preview button:first').click({ force: true }) + cy.get('.ProseMirror code').should('not.exist') }) }) \ No newline at end of file diff --git a/docs/src/demos/Extensions/CodeBlock/index.spec.js b/docs/src/demos/Extensions/CodeBlock/index.spec.js index 51c40a31..86a919b1 100644 --- a/docs/src/demos/Extensions/CodeBlock/index.spec.js +++ b/docs/src/demos/Extensions/CodeBlock/index.spec.js @@ -1,52 +1,48 @@ context('/api/extensions/code-block', () => { - beforeEach(() => { + before(() => { cy.visit('/api/extensions/code-block') + }) + beforeEach(() => { cy.get('.ProseMirror').window().then(window => { const { editor } = window editor.setContent('

Example Text

') - editor.focus().selectAll() + editor.selectAll() + cy.wait(10) }) }) - describe('code-block', () => { - it('the button should make the selected line a code block', () => { - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').contains('pre', 'Example Text') - }) + it('the button should make the selected line a code block', () => { + cy.get('.demo__preview button:first').click({ force: true }) + cy.get('.ProseMirror').contains('pre', 'Example Text') + }) - it('the button should toggle the code block', () => { - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').contains('pre', 'Example Text') + it('the button should toggle the code block', () => { + cy.get('.demo__preview button:first').click({ force: true }) + cy.get('.ProseMirror').contains('pre', 'Example Text') - cy.get('.ProseMirror').type('{selectall}', {force: true}) - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror pre').should('not.exist') - }) + cy.get('.ProseMirror').type('{selectall}', { force: true }) + cy.get('.demo__preview button:first').click({ force: true }) + cy.get('.ProseMirror pre').should('not.exist') + }) - it('the keyboard shortcut should make the selected line a code block', () => { - cy.get('.ProseMirror').type('{control}{shift}\\', {force: true}) - cy.get('.ProseMirror').contains('pre', 'Example Text') - }) + it('the keyboard shortcut should make the selected line a code block', () => { + cy.get('.ProseMirror').type('{control}{shift}\\', { force: true }) + cy.get('.ProseMirror').contains('pre', 'Example Text') + }) - it('the keyboard shortcut should toggle the code block', () => { - cy.get('.ProseMirror').type('{control}{shift}\\', {force: true}) - cy.get('.ProseMirror').contains('pre', 'Example Text') + it('the keyboard shortcut should toggle the code block', () => { + cy.get('.ProseMirror').type('{control}{shift}\\', { force: true }) + cy.get('.ProseMirror').contains('pre', 'Example Text') - cy.get('.ProseMirror').type('{selectall}', {force: true}) - cy.get('.ProseMirror').type('{control}{shift}\\', {force: true}) - cy.get('.ProseMirror pre').should('not.exist') - }) + cy.get('.ProseMirror').type('{selectall}', { force: true }) + cy.get('.ProseMirror').type('{control}{shift}\\', { force: true }) + cy.get('.ProseMirror pre').should('not.exist') + }) - it('should make a code block from markdown shortcuts', () => { - cy.get('.ProseMirror').window().then(window => { - const { editor } = window - editor.clearContent() - - cy.get('.ProseMirror') - .type('``` {enter}Code', {force: true}) - .contains('pre', 'Code') - }) - }) + it('should make a code block from markdown shortcuts', () => { + cy.get('.ProseMirror') + .type('``` {enter}Code', { force: true }) + .contains('pre', 'Code') }) }) \ No newline at end of file diff --git a/docs/src/demos/Extensions/Document/index.spec.js b/docs/src/demos/Extensions/Document/index.spec.js index 91a6553e..907f9b74 100644 --- a/docs/src/demos/Extensions/Document/index.spec.js +++ b/docs/src/demos/Extensions/Document/index.spec.js @@ -1,5 +1,5 @@ context('/api/extensions/document', () => { - beforeEach(() => { + before(() => { cy.visit('/api/extensions/document') }) }) \ No newline at end of file diff --git a/docs/src/demos/Extensions/HardBreak/index.spec.js b/docs/src/demos/Extensions/HardBreak/index.spec.js index 6e6aba7a..d68baf3e 100644 --- a/docs/src/demos/Extensions/HardBreak/index.spec.js +++ b/docs/src/demos/Extensions/HardBreak/index.spec.js @@ -1,30 +1,30 @@ context('/api/extensions/hard-break', () => { - beforeEach(() => { + before(() => { cy.visit('/api/extensions/hard-break') + }) + beforeEach(() => { cy.get('.ProseMirror').window().then(window => { const { editor } = window editor.setContent('

Example Text

') }) }) - describe('hard-break', () => { - it('the button should add a line break', () => { - cy.get('.ProseMirror br').should('not.exist') - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror br').should('exist') - }) + it('the button should add a line break', () => { + cy.get('.ProseMirror br').should('not.exist') + cy.get('.demo__preview button:first').click({ force: true }) + cy.get('.ProseMirror br').should('exist') + }) - it('the default keyboard shortcut should add a line break', () => { - cy.get('.ProseMirror br').should('not.exist') - cy.get('.ProseMirror').type('{shift}{enter}', {force: true}) - cy.get('.ProseMirror br').should('exist') - }) + it('the default keyboard shortcut should add a line break', () => { + cy.get('.ProseMirror br').should('not.exist') + cy.get('.ProseMirror').type('{shift}{enter}', { force: true }) + cy.get('.ProseMirror br').should('exist') + }) - it('the alternative keyboard shortcut should add a line break', () => { - cy.get('.ProseMirror br').should('not.exist') - cy.get('.ProseMirror').type('{meta}{enter}', {force: true}) - cy.get('.ProseMirror br').should('exist') - }) + it('the alternative keyboard shortcut should add a line break', () => { + cy.get('.ProseMirror br').should('not.exist') + cy.get('.ProseMirror').type('{meta}{enter}', { force: true }) + cy.get('.ProseMirror br').should('exist') }) }) \ No newline at end of file diff --git a/docs/src/demos/Extensions/Heading/index.spec.js b/docs/src/demos/Extensions/Heading/index.spec.js index 51a4d8b1..5af22d89 100644 --- a/docs/src/demos/Extensions/Heading/index.spec.js +++ b/docs/src/demos/Extensions/Heading/index.spec.js @@ -1,31 +1,32 @@ context('/api/extensions/heading', () => { - beforeEach(() => { + before(() => { cy.visit('/api/extensions/heading') + }) + beforeEach(() => { cy.get('.ProseMirror').window().then(window => { const { editor } = window editor.setContent('

Example Text

') - editor.focus().selectAll() + editor.selectAll() + cy.wait(10) }) }) - describe('blockquote', () => { - it('the button should make the selected line a h1', () => { - cy.get('.ProseMirror h1').should('not.exist') - cy.get('.demo__preview button:nth-child(1)').click({ force: true }) - cy.get('.ProseMirror').contains('h1', 'Example Text') - }) + it('the button should make the selected line a h1', () => { + cy.get('.ProseMirror h1').should('not.exist') + cy.get('.demo__preview button:nth-child(1)').click({ force: true }) + cy.get('.ProseMirror').contains('h1', 'Example Text') + }) - it('the button should make the selected line a h2', () => { - cy.get('.ProseMirror h2').should('not.exist') - cy.get('.demo__preview button:nth-child(2)').click({ force: true }) - cy.get('.ProseMirror').contains('h2', 'Example Text') - }) + it('the button should make the selected line a h2', () => { + cy.get('.ProseMirror h2').should('not.exist') + cy.get('.demo__preview button:nth-child(2)').click({ force: true }) + cy.get('.ProseMirror').contains('h2', 'Example Text') + }) - it('the button should make the selected line a h3', () => { - cy.get('.ProseMirror h3').should('not.exist') - cy.get('.demo__preview button:nth-child(3)').click({ force: true }) - cy.get('.ProseMirror').contains('h3', 'Example Text') - }) + it('the button should make the selected line a h3', () => { + cy.get('.ProseMirror h3').should('not.exist') + cy.get('.demo__preview button:nth-child(3)').click({ force: true }) + cy.get('.ProseMirror').contains('h3', 'Example Text') }) }) \ No newline at end of file diff --git a/docs/src/demos/Extensions/History/index.spec.js b/docs/src/demos/Extensions/History/index.spec.js index d3d571c8..c3aef532 100644 --- a/docs/src/demos/Extensions/History/index.spec.js +++ b/docs/src/demos/Extensions/History/index.spec.js @@ -1,47 +1,45 @@ context('/api/extensions/history', () => { - beforeEach(() => { + before(() => { cy.visit('/api/extensions/history') + }) + beforeEach(() => { cy.get('.ProseMirror').window().then(window => { const { editor } = window editor.setContent('

Mistake

') }) }) - describe('undo', () => { - it('should make the last change undone', () => { - cy.get('.ProseMirror').window().then(window => { - cy.get('.ProseMirror').should('contain', 'Mistake') + it('should make the last change undone', () => { + cy.get('.ProseMirror').window().then(window => { + cy.get('.ProseMirror').should('contain', 'Mistake') - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').should('not.contain', 'Mistake') - }) - }) - - it('the keyboard shortcut should make the last change undone', () => { - cy.get('.ProseMirror').type('{meta}z', {force: true}) + cy.get('.demo__preview button:first').click({ force: true }) cy.get('.ProseMirror').should('not.contain', 'Mistake') }) }) - describe('redo', () => { - it('should apply the last undone change again', () => { - cy.get('.ProseMirror').window().then(window => { - cy.get('.ProseMirror').should('contain', 'Mistake') + it('the keyboard shortcut should make the last change undone', () => { + cy.get('.ProseMirror').type('{meta}z', { force: true }) + cy.get('.ProseMirror').should('not.contain', 'Mistake') + }) - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').should('not.contain', 'Mistake') - cy.get('.demo__preview button:nth-child(2)').click({ force: true }) - cy.get('.ProseMirror').should('contain', 'Mistake') - }) - }) + it('should apply the last undone change again', () => { + cy.get('.ProseMirror').window().then(window => { + cy.get('.ProseMirror').should('contain', 'Mistake') - it.skip('the keyboard shortcut should apply the last undone change again', () => { - cy.get('.ProseMirror').type('{meta}z', {force: true}) + cy.get('.demo__preview button:first').click({ force: true }) cy.get('.ProseMirror').should('not.contain', 'Mistake') - - cy.get('.ProseMirror').type('{meta}{shift}z', {force: true}) + cy.get('.demo__preview button:nth-child(2)').click({ force: true }) cy.get('.ProseMirror').should('contain', 'Mistake') }) }) + + it.skip('the keyboard shortcut should apply the last undone change again', () => { + cy.get('.ProseMirror').type('{meta}z', { force: true }) + cy.get('.ProseMirror').should('not.contain', 'Mistake') + + cy.get('.ProseMirror').type('{meta}{shift}z', { force: true }) + cy.get('.ProseMirror').should('contain', 'Mistake') + }) }) diff --git a/docs/src/demos/Extensions/HorizontalRule/index.spec.js b/docs/src/demos/Extensions/HorizontalRule/index.spec.js index 96c0fdb7..41163de2 100644 --- a/docs/src/demos/Extensions/HorizontalRule/index.spec.js +++ b/docs/src/demos/Extensions/HorizontalRule/index.spec.js @@ -1,40 +1,40 @@ context('/api/extensions/horizontal-rule', () => { - beforeEach(() => { + before(() => { cy.visit('/api/extensions/horizontal-rule') + }) + beforeEach(() => { cy.get('.ProseMirror').window().then(window => { const { editor } = window editor.setContent('

Example Text

') }) }) - describe('horizontal-rule', () => { - it('the button should add a horizontal rule', () => { + it('the button should add a horizontal rule', () => { + cy.get('.ProseMirror hr').should('not.exist') + cy.get('.demo__preview button:first').click({ force: true }) + cy.get('.ProseMirror hr').should('exist') + }) + + it('the default markdown shortcut should add a horizontal rule', () => { + cy.get('.ProseMirror').window().then(window => { + const { editor } = window + editor.clearContent() + cy.get('.ProseMirror hr').should('not.exist') - cy.get('.demo__preview button:first').click({ force: true }) + cy.get('.ProseMirror').type('---', { force: true }) cy.get('.ProseMirror hr').should('exist') }) + }) - it('the default markdown shortcut should add a horizontal rule', () => { - cy.get('.ProseMirror').window().then(window => { - const { editor } = window - editor.clearContent() + it('the alternative markdown shortcut should add a horizontal rule', () => { + cy.get('.ProseMirror').window().then(window => { + const { editor } = window + editor.clearContent() - cy.get('.ProseMirror hr').should('not.exist') - cy.get('.ProseMirror').type('---', {force: true}) - cy.get('.ProseMirror hr').should('exist') - }) - }) - - it('the alternative markdown shortcut should add a horizontal rule', () => { - cy.get('.ProseMirror').window().then(window => { - const { editor } = window - editor.clearContent() - - cy.get('.ProseMirror hr').should('not.exist') - cy.get('.ProseMirror').type('___ ', {force: true}) - cy.get('.ProseMirror hr').should('exist') - }) + cy.get('.ProseMirror hr').should('not.exist') + cy.get('.ProseMirror').type('___ ', { force: true }) + cy.get('.ProseMirror hr').should('exist') }) }) }) \ No newline at end of file diff --git a/docs/src/demos/Extensions/Italic/index.spec.js b/docs/src/demos/Extensions/Italic/index.spec.js index 4abfaac9..a56c6158 100644 --- a/docs/src/demos/Extensions/Italic/index.spec.js +++ b/docs/src/demos/Extensions/Italic/index.spec.js @@ -1,33 +1,36 @@ context('/api/extensions/italic', () => { - beforeEach(() => { + before(() => { cy.visit('/api/extensions/italic') + }) + beforeEach(() => { cy.get('.ProseMirror').window().then(window => { const { editor } = window editor.setContent('

Example Text

') - editor.focus().selectAll() + editor.selectAll() + cy.wait(10) }) }) - describe('italic', () => { - it('the button should make the selected text italic', () => { - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').contains('em', 'Example Text') - }) + it('the button should make the selected text italic', () => { + cy.get('.demo__preview button:first').click({ force: true }) + cy.get('.ProseMirror').contains('em', 'Example Text') + }) - it('the button should toggle the selected text italic', () => { - cy.get('.demo__preview button:first').dblclick({ force: true }) - cy.get('.ProseMirror em').should('not.exist') - }) + it('the button should toggle the selected text italic', () => { + cy.get('.demo__preview button:first').click({ force: true }) + cy.get('.ProseMirror').type('{selectall}', { force: true }) + cy.get('.demo__preview button:first').click({ force: true }) + cy.get('.ProseMirror em').should('not.exist') + }) - it('the keyboard shortcut should make the selected text italic', () => { - cy.get('.ProseMirror').type('{meta}i', {force: true}) - cy.get('.ProseMirror').contains('em', 'Example Text') - }) + it('the keyboard shortcut should make the selected text italic', () => { + cy.get('.ProseMirror').type('{meta}i', { force: true }) + cy.get('.ProseMirror').contains('em', 'Example Text') + }) - it('the keyboard shortcut should toggle the selected text italic', () => { - cy.get('.ProseMirror').type('{meta}i', {force: true}).type('{meta}i', {force: true}) - cy.get('.ProseMirror em').should('not.exist') - }) + it('the keyboard shortcut should toggle the selected text italic', () => { + cy.get('.ProseMirror').type('{meta}i', { force: true }).type('{meta}i', { force: true }) + cy.get('.ProseMirror em').should('not.exist') }) }) \ No newline at end of file diff --git a/docs/src/demos/Extensions/Paragraph/index.spec.js b/docs/src/demos/Extensions/Paragraph/index.spec.js index e10cf685..2a58f81f 100644 --- a/docs/src/demos/Extensions/Paragraph/index.spec.js +++ b/docs/src/demos/Extensions/Paragraph/index.spec.js @@ -1,32 +1,33 @@ context('/api/extensions/paragraph', () => { - beforeEach(() => { + before(() => { cy.visit('/api/extensions/paragraph') + }) + beforeEach(() => { cy.get('.ProseMirror').window().then(window => { const { editor } = window editor.clearContent() + cy.wait(10) }) }) - describe('paragraph', () => { - it('text should be wrapped in a paragraph by default', () => { - cy.get('.ProseMirror').type('Example Text', {force: true}) - cy.get('.ProseMirror').contains('p', 'Example Text') - cy.get('.ProseMirror').find('p').should('have.length', 1) - }) + it('text should be wrapped in a paragraph by default', () => { + cy.get('.ProseMirror').type('Example Text', { force: true }) + cy.get('.ProseMirror').contains('p', 'Example Text') + cy.get('.ProseMirror').find('p').should('have.length', 1) + }) - it('enter should make a new paragraph', () => { - cy.get('.ProseMirror').type('First Paragraph{enter}Second Paragraph', {force: true}) - cy.get('.ProseMirror').find('p').should('have.length', 2) - cy.get('.ProseMirror').contains('p:first', 'First Paragraph') - cy.get('.ProseMirror').contains('p:nth-child(2)', 'Second Paragraph') - }) + it('enter should make a new paragraph', () => { + cy.get('.ProseMirror').type('First Paragraph{enter}Second Paragraph', { force: true }) + cy.get('.ProseMirror').find('p').should('have.length', 2) + cy.get('.ProseMirror').contains('p:first', 'First Paragraph') + cy.get('.ProseMirror').contains('p:nth-child(2)', 'Second Paragraph') + }) - it('backspace should remove the second paragraph', () => { - cy.get('.ProseMirror').type('{enter}', {force: true}) - cy.get('.ProseMirror').find('p').should('have.length', 2) - cy.get('.ProseMirror').type('{backspace}', {force: true}) - cy.get('.ProseMirror').find('p').should('have.length', 1) - }) + it('backspace should remove the second paragraph', () => { + cy.get('.ProseMirror').type('{enter}', { force: true }) + cy.get('.ProseMirror').find('p').should('have.length', 2) + cy.get('.ProseMirror').type('{backspace}', { force: true }) + cy.get('.ProseMirror').find('p').should('have.length', 1) }) }) \ No newline at end of file diff --git a/docs/src/demos/Extensions/Strike/index.spec.js b/docs/src/demos/Extensions/Strike/index.spec.js index 4c931953..6903665f 100644 --- a/docs/src/demos/Extensions/Strike/index.spec.js +++ b/docs/src/demos/Extensions/Strike/index.spec.js @@ -1,39 +1,42 @@ context('/api/extensions/strike', () => { - beforeEach(() => { + before(() => { cy.visit('/api/extensions/strike') + }) + beforeEach(() => { cy.get('.ProseMirror').window().then(window => { const { editor } = window editor.setContent('

Example Text

') - editor.focus().selectAll() + editor.selectAll() + cy.wait(10) }) }) - describe('strike', () => { - it('the button should strike the selected text', () => { - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').contains('s', 'Example Text') - }) + it('the button should strike the selected text', () => { + cy.get('.demo__preview button:first').click({ force: true }) + cy.get('.ProseMirror').contains('s', 'Example Text') + }) - it('the button should toggle the selected text striked', () => { - cy.get('.demo__preview button:first').dblclick({ force: true }) - cy.get('.ProseMirror s').should('not.exist') - }) + it('the button should toggle the selected text striked', () => { + cy.get('.demo__preview button:first').click({ force: true }) + cy.get('.ProseMirror').type('{selectall}', { force: true }) + cy.get('.demo__preview button:first').click({ force: true }) + cy.get('.ProseMirror s').should('not.exist') + }) - it('the keyboard shortcut should strike the selected text', () => { - cy.get('.ProseMirror').type('{meta}d', {force: true}) - cy.get('.ProseMirror').contains('s', 'Example Text') - }) + it('the keyboard shortcut should strike the selected text', () => { + cy.get('.ProseMirror').type('{meta}d', { force: true }) + cy.get('.ProseMirror').contains('s', 'Example Text') + }) - it('the keyboard shortcut should toggle the selected text striked', () => { - cy.get('.ProseMirror').type('{meta}d', {force: true}).type('{meta}d', {force: true}) - cy.get('.ProseMirror s').should('not.exist') - }) + it('the keyboard shortcut should toggle the selected text striked', () => { + cy.get('.ProseMirror').type('{meta}d', { force: true }).type('{meta}d', { force: true }) + cy.get('.ProseMirror s').should('not.exist') + }) - it('should make a striked text from the markdown shortcut', () => { - cy.get('.ProseMirror') - .type('~Strike~', {force: true}) - .contains('s', 'Strike') - }) + it('should make a striked text from the markdown shortcut', () => { + cy.get('.ProseMirror') + .type('~Strike~', { force: true }) + .contains('s', 'Strike') }) }) \ No newline at end of file diff --git a/docs/src/demos/Extensions/Underline/index.spec.js b/docs/src/demos/Extensions/Underline/index.spec.js index c1eb33ce..8fa323a1 100644 --- a/docs/src/demos/Extensions/Underline/index.spec.js +++ b/docs/src/demos/Extensions/Underline/index.spec.js @@ -1,33 +1,36 @@ context('/api/extensions/underline', () => { - beforeEach(() => { + before(() => { cy.visit('/api/extensions/underline') + }) + beforeEach(() => { cy.get('.ProseMirror').window().then(window => { const { editor } = window editor.setContent('

Example Text

') - editor.focus().selectAll() + editor.selectAll() + cy.wait(10) }) }) - describe('bold', () => { - it('the button should underline the selected text', () => { - cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').contains('u', 'Example Text') - }) + it('the button should underline the selected text', () => { + cy.get('.demo__preview button:first').click({ force: true }) + cy.get('.ProseMirror').contains('u', 'Example Text') + }) - it('the button should toggle the selected text underline', () => { - cy.get('.demo__preview button:first').dblclick({ force: true }) - cy.get('.ProseMirror u').should('not.exist') - }) + it('the button should toggle the selected text underline', () => { + cy.get('.demo__preview button:first').click({ force: true }) + cy.get('.ProseMirror').type('{selectall}', { force: true }) + cy.get('.demo__preview button:first').click({ force: true }) + cy.get('.ProseMirror u').should('not.exist') + }) - it('the keyboard shortcut should underline the selected text', () => { - cy.get('.ProseMirror').type('{meta}u', {force: true}) - cy.get('.ProseMirror').contains('u', 'Example Text') - }) + it('the keyboard shortcut should underline the selected text', () => { + cy.get('.ProseMirror').type('{meta}u', { force: true }) + cy.get('.ProseMirror').contains('u', 'Example Text') + }) - it('the keyboard shortcut should toggle the selected text underline', () => { - cy.get('.ProseMirror').type('{meta}u', {force: true}).type('{meta}u', {force: true}) - cy.get('.ProseMirror u').should('not.exist') - }) + it('the keyboard shortcut should toggle the selected text underline', () => { + cy.get('.ProseMirror').type('{meta}u', { force: true }).type('{meta}u', { force: true }) + cy.get('.ProseMirror u').should('not.exist') }) }) \ No newline at end of file From 3e0e3b73e65b6b04461011f96c9b5f6818a8bb28 Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Fri, 11 Sep 2020 15:59:05 +0200 Subject: [PATCH 14/15] build tiptap only when tests succeed --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e1d27904..b42dfa5a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -57,6 +57,8 @@ jobs: build: runs-on: ubuntu-latest + needs: test + env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} From c4d02c291c801ddec3e3c42dece5e26cc7531f09 Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Fri, 11 Sep 2020 16:24:37 +0200 Subject: [PATCH 15/15] async beforeeach --- docs/src/demos/Examples/Basic/index.spec.js | 4 ++-- .../Examples/MarkdownShortcuts/index.spec.js | 4 ++-- .../demos/Extensions/Blockquote/index.spec.js | 4 ++-- docs/src/demos/Extensions/Bold/index.spec.js | 18 ++++++++++++------ docs/src/demos/Extensions/Code/index.spec.js | 4 ++-- .../demos/Extensions/CodeBlock/index.spec.js | 4 ++-- .../src/demos/Extensions/Heading/index.spec.js | 4 ++-- docs/src/demos/Extensions/Italic/index.spec.js | 4 ++-- .../demos/Extensions/Paragraph/index.spec.js | 4 ++-- docs/src/demos/Extensions/Strike/index.spec.js | 4 ++-- .../demos/Extensions/Underline/index.spec.js | 4 ++-- 11 files changed, 32 insertions(+), 26 deletions(-) diff --git a/docs/src/demos/Examples/Basic/index.spec.js b/docs/src/demos/Examples/Basic/index.spec.js index 60986ad7..04581551 100644 --- a/docs/src/demos/Examples/Basic/index.spec.js +++ b/docs/src/demos/Examples/Basic/index.spec.js @@ -3,11 +3,11 @@ context('/examples/basic', () => { cy.visit('/examples/basic') }) - beforeEach(() => { + beforeEach((done) => { cy.get('.ProseMirror').window().then(window => { const { editor } = window editor.setContent('

foo

') - cy.wait(10) + done() }) }) diff --git a/docs/src/demos/Examples/MarkdownShortcuts/index.spec.js b/docs/src/demos/Examples/MarkdownShortcuts/index.spec.js index c24fdf3a..e97f398c 100644 --- a/docs/src/demos/Examples/MarkdownShortcuts/index.spec.js +++ b/docs/src/demos/Examples/MarkdownShortcuts/index.spec.js @@ -3,11 +3,11 @@ context('/examples/markdown-shortcuts', () => { cy.visit('/examples/markdown-shortcuts') }) - beforeEach(() => { + beforeEach((done) => { cy.get('.ProseMirror').window().then(window => { const { editor } = window editor.clearContent() - cy.wait(10) + done() }) }) diff --git a/docs/src/demos/Extensions/Blockquote/index.spec.js b/docs/src/demos/Extensions/Blockquote/index.spec.js index a856e065..4a6f3ee5 100644 --- a/docs/src/demos/Extensions/Blockquote/index.spec.js +++ b/docs/src/demos/Extensions/Blockquote/index.spec.js @@ -3,12 +3,12 @@ context('/api/extensions/blockquote', () => { cy.visit('/api/extensions/blockquote') }) - beforeEach(() => { + beforeEach((done) => { cy.get('.ProseMirror').window().then(window => { const { editor } = window editor.setContent('

Example Text

') editor.selectAll() - cy.wait(10) + done() }) }) diff --git a/docs/src/demos/Extensions/Bold/index.spec.js b/docs/src/demos/Extensions/Bold/index.spec.js index b32fdf25..98ac79a2 100644 --- a/docs/src/demos/Extensions/Bold/index.spec.js +++ b/docs/src/demos/Extensions/Bold/index.spec.js @@ -3,12 +3,12 @@ context('/api/extensions/bold', () => { cy.visit('/api/extensions/bold') }) - beforeEach(() => { + beforeEach((done) => { cy.get('.ProseMirror').window().then(window => { const { editor } = window editor.setContent('

Example Text

') editor.selectAll() - cy.wait(10) + done() }) }) @@ -25,13 +25,19 @@ context('/api/extensions/bold', () => { }) it('the keyboard shortcut should make the selected text bold', () => { - cy.get('.ProseMirror').type('{meta}b', { force: true }) - cy.get('.ProseMirror').contains('strong', 'Example Text') + cy.get('.ProseMirror') + .type('{meta}b', { force: true }) + .contains('strong', 'Example Text') }) it('the keyboard shortcut should toggle the selected text bold', () => { - cy.get('.ProseMirror').type('{meta}b', { force: true }).type('{meta}b', { force: true }) - cy.get('.ProseMirror strong').should('not.exist') + cy.get('.ProseMirror') + .type('{meta}b', { force: true }) + .contains('strong', 'Example Text') + + cy.get('.ProseMirror') + .type('{meta}b', { force: true }) + .should('not.exist') }) it('should make a bold text from the default markdown shortcut', () => { diff --git a/docs/src/demos/Extensions/Code/index.spec.js b/docs/src/demos/Extensions/Code/index.spec.js index 54bf6693..f10f9b02 100644 --- a/docs/src/demos/Extensions/Code/index.spec.js +++ b/docs/src/demos/Extensions/Code/index.spec.js @@ -3,12 +3,12 @@ context('/api/extensions/code', () => { cy.visit('/api/extensions/code') }) - beforeEach(() => { + beforeEach((done) => { cy.get('.ProseMirror').window().then(window => { const { editor } = window editor.setContent('

Example Text

') editor.selectAll() - cy.wait(10) + done() }) }) diff --git a/docs/src/demos/Extensions/CodeBlock/index.spec.js b/docs/src/demos/Extensions/CodeBlock/index.spec.js index 86a919b1..e3321905 100644 --- a/docs/src/demos/Extensions/CodeBlock/index.spec.js +++ b/docs/src/demos/Extensions/CodeBlock/index.spec.js @@ -3,12 +3,12 @@ context('/api/extensions/code-block', () => { cy.visit('/api/extensions/code-block') }) - beforeEach(() => { + beforeEach((done) => { cy.get('.ProseMirror').window().then(window => { const { editor } = window editor.setContent('

Example Text

') editor.selectAll() - cy.wait(10) + done() }) }) diff --git a/docs/src/demos/Extensions/Heading/index.spec.js b/docs/src/demos/Extensions/Heading/index.spec.js index 5af22d89..aa6aeecc 100644 --- a/docs/src/demos/Extensions/Heading/index.spec.js +++ b/docs/src/demos/Extensions/Heading/index.spec.js @@ -3,12 +3,12 @@ context('/api/extensions/heading', () => { cy.visit('/api/extensions/heading') }) - beforeEach(() => { + beforeEach((done) => { cy.get('.ProseMirror').window().then(window => { const { editor } = window editor.setContent('

Example Text

') editor.selectAll() - cy.wait(10) + done() }) }) diff --git a/docs/src/demos/Extensions/Italic/index.spec.js b/docs/src/demos/Extensions/Italic/index.spec.js index a56c6158..c29cb392 100644 --- a/docs/src/demos/Extensions/Italic/index.spec.js +++ b/docs/src/demos/Extensions/Italic/index.spec.js @@ -3,12 +3,12 @@ context('/api/extensions/italic', () => { cy.visit('/api/extensions/italic') }) - beforeEach(() => { + beforeEach((done) => { cy.get('.ProseMirror').window().then(window => { const { editor } = window editor.setContent('

Example Text

') editor.selectAll() - cy.wait(10) + done() }) }) diff --git a/docs/src/demos/Extensions/Paragraph/index.spec.js b/docs/src/demos/Extensions/Paragraph/index.spec.js index 2a58f81f..f1ab8688 100644 --- a/docs/src/demos/Extensions/Paragraph/index.spec.js +++ b/docs/src/demos/Extensions/Paragraph/index.spec.js @@ -3,11 +3,11 @@ context('/api/extensions/paragraph', () => { cy.visit('/api/extensions/paragraph') }) - beforeEach(() => { + beforeEach((done) => { cy.get('.ProseMirror').window().then(window => { const { editor } = window editor.clearContent() - cy.wait(10) + done() }) }) diff --git a/docs/src/demos/Extensions/Strike/index.spec.js b/docs/src/demos/Extensions/Strike/index.spec.js index 6903665f..c1d80daf 100644 --- a/docs/src/demos/Extensions/Strike/index.spec.js +++ b/docs/src/demos/Extensions/Strike/index.spec.js @@ -3,12 +3,12 @@ context('/api/extensions/strike', () => { cy.visit('/api/extensions/strike') }) - beforeEach(() => { + beforeEach((done) => { cy.get('.ProseMirror').window().then(window => { const { editor } = window editor.setContent('

Example Text

') editor.selectAll() - cy.wait(10) + done() }) }) diff --git a/docs/src/demos/Extensions/Underline/index.spec.js b/docs/src/demos/Extensions/Underline/index.spec.js index 8fa323a1..4e26ca91 100644 --- a/docs/src/demos/Extensions/Underline/index.spec.js +++ b/docs/src/demos/Extensions/Underline/index.spec.js @@ -3,12 +3,12 @@ context('/api/extensions/underline', () => { cy.visit('/api/extensions/underline') }) - beforeEach(() => { + beforeEach((done) => { cy.get('.ProseMirror').window().then(window => { const { editor } = window editor.setContent('

Example Text

') editor.selectAll() - cy.wait(10) + done() }) })