Skip to content

Commit

Permalink
Fix broken Cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rfgamaral committed Aug 21, 2024
1 parent a551d7e commit 1502aeb
Show file tree
Hide file tree
Showing 49 changed files with 358 additions and 348 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ context('/src/Commands/InsertContentApplyingRules/React/', () => {
})

beforeEach(() => {
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.resetEditor()
})

it('should apply list InputRule', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ context('/src/Examples/InteractivityComponentContent/React/', () => {
cy.get('.ProseMirror .react-component .content div')
.invoke('attr', 'contentEditable', true)
.invoke('text', '')
.type('Hello World! This is **bold**.')
.should('have.text', 'Hello World! This is bold.')

cy.realType('Hello World! This is **bold**.')

cy.get('.ProseMirror .react-component .content div')
.should('have.text', 'Hello World! This is bold.')
cy.get('.ProseMirror .react-component .content strong')
.should('exist')
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ context('/src/Examples/InteractivityComponentContent/Vue/', () => {
cy.get('.tiptap .vue-component .content')
.invoke('attr', 'contentEditable', true)
.invoke('text', '')
.type('Hello World! This is **bold**.')
.should('have.text', 'Hello World! This is bold.')

cy.realType('Hello World! This is **bold**.')

cy.get('.tiptap .vue-component .content')
.should('have.text', 'Hello World! This is bold.')
cy.get('.tiptap .vue-component .content strong')
.should('exist')
})
Expand Down
43 changes: 27 additions & 16 deletions demos/src/Examples/MarkdownShortcuts/React/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,98 +4,109 @@ context('/src/Examples/MarkdownShortcuts/React/', () => {
})

beforeEach(() => {
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.resetEditor()
})

it('should make a h1', () => {
cy.get('.tiptap')
.type('# Headline')
.realType('# Headline')
cy.get('.tiptap')
.find('h1')
.should('contain', 'Headline')
})

it('should make a h2', () => {
cy.get('.tiptap')
.type('## Headline')
.realType('## Headline')
cy.get('.tiptap')
.find('h2')
.should('contain', 'Headline')
})

it('should make a h3', () => {
cy.get('.tiptap')
.type('### Headline')
.realType('### Headline')
cy.get('.tiptap')
.find('h3')
.should('contain', 'Headline')
})

it('should make a h4', () => {
cy.get('.tiptap')
.type('#### Headline')
.realType('#### Headline')
cy.get('.tiptap')
.find('h4')
.should('contain', 'Headline')
})

it('should make a h5', () => {
cy.get('.tiptap')
.type('##### Headline')
.realType('##### Headline')
cy.get('.tiptap')
.find('h5')
.should('contain', 'Headline')
})

it('should make a h6', () => {
cy.get('.tiptap')
.type('###### Headline')
.realType('###### Headline')
cy.get('.tiptap')
.find('h6')
.should('contain', 'Headline')
})

it('should create inline code', () => {
cy.get('.tiptap')
.type('`$foobar`')
.realType('`$foobar`')
cy.get('.tiptap')
.find('code')
.should('contain', '$foobar')
})

it('should create a code block without language', () => {
cy.get('.tiptap')
.type('``` {enter}const foo = bar{enter}```')
.realType('``` {enter}const foo = bar{enter}```')
cy.get('.tiptap')
.find('pre')
.should('contain', 'const foo = bar')
})

it('should create a bullet list from asteriks', () => {
cy.get('.tiptap')
.type('* foobar')
.realType('* foobar')
cy.get('.tiptap')
.find('ul')
.should('contain', 'foobar')
})

it('should create a bullet list from dashes', () => {
cy.get('.tiptap')
.type('- foobar')
.realType('- foobar')
cy.get('.tiptap')
.find('ul')
.should('contain', 'foobar')
})

it('should create a bullet list from pluses', () => {
cy.get('.tiptap')
.type('+ foobar')
.realType('+ foobar')
cy.get('.tiptap')
.find('ul')
.should('contain', 'foobar')
})

it('should create a ordered list', () => {
cy.get('.tiptap')
.type('1. foobar')
.realType('1. foobar')
cy.get('.tiptap')
.find('ol')
.should('contain', 'foobar')
})

it('should create a blockquote', () => {
cy.get('.tiptap')
.type('> foobar')
.realType('> foobar')
cy.get('.tiptap')
.find('blockquote')
.should('contain', 'foobar')
})
Expand Down
43 changes: 27 additions & 16 deletions demos/src/Examples/MarkdownShortcuts/Vue/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,98 +4,109 @@ context('/src/Examples/MarkdownShortcuts/Vue/', () => {
})

beforeEach(() => {
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.resetEditor()
})

it('should make a h1', () => {
cy.get('.tiptap')
.type('# Headline')
.realType('# Headline')
cy.get('.tiptap')
.find('h1')
.should('contain', 'Headline')
})

it('should make a h2', () => {
cy.get('.tiptap')
.type('## Headline')
.realType('## Headline')
cy.get('.tiptap')
.find('h2')
.should('contain', 'Headline')
})

it('should make a h3', () => {
cy.get('.tiptap')
.type('### Headline')
.realType('### Headline')
cy.get('.tiptap')
.find('h3')
.should('contain', 'Headline')
})

it('should make a h4', () => {
cy.get('.tiptap')
.type('#### Headline')
.realType('#### Headline')
cy.get('.tiptap')
.find('h4')
.should('contain', 'Headline')
})

it('should make a h5', () => {
cy.get('.tiptap')
.type('##### Headline')
.realType('##### Headline')
cy.get('.tiptap')
.find('h5')
.should('contain', 'Headline')
})

it('should make a h6', () => {
cy.get('.tiptap')
.type('###### Headline')
.realType('###### Headline')
cy.get('.tiptap')
.find('h6')
.should('contain', 'Headline')
})

it('should create inline code', () => {
cy.get('.tiptap')
.type('`$foobar`')
.realType('`$foobar`')
cy.get('.tiptap')
.find('code')
.should('contain', '$foobar')
})

it('should create a code block without language', () => {
cy.get('.tiptap')
.type('``` {enter}const foo = bar{enter}```')
.realType('``` {enter}const foo = bar{enter}```')
cy.get('.tiptap')
.find('pre')
.should('contain', 'const foo = bar')
})

it('should create a bullet list from asteriks', () => {
cy.get('.tiptap')
.type('* foobar')
.realType('* foobar')
cy.get('.tiptap')
.find('ul')
.should('contain', 'foobar')
})

it('should create a bullet list from dashes', () => {
cy.get('.tiptap')
.type('- foobar')
.realType('- foobar')
cy.get('.tiptap')
.find('ul')
.should('contain', 'foobar')
})

it('should create a bullet list from pluses', () => {
cy.get('.tiptap')
.type('+ foobar')
.realType('+ foobar')
cy.get('.tiptap')
.find('ul')
.should('contain', 'foobar')
})

it('should create a ordered list', () => {
cy.get('.tiptap')
.type('1. foobar')
.realType('1. foobar')
cy.get('.tiptap')
.find('ol')
.should('contain', 'foobar')
})

it('should create a blockquote', () => {
cy.get('.tiptap')
.type('> foobar')
.realType('> foobar')
cy.get('.tiptap')
.find('blockquote')
.should('contain', 'foobar')
})
Expand Down
4 changes: 1 addition & 3 deletions demos/src/Examples/Minimal/React/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ context('/src/Examples/Minimal/React/', () => {
})

beforeEach(() => {
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.resetEditor()
})

it('text should be wrapped in a paragraph by default', () => {
Expand Down
4 changes: 1 addition & 3 deletions demos/src/Examples/Minimal/Vue/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ context('/src/Examples/Minimal/Vue/', () => {
})

beforeEach(() => {
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.resetEditor()
})

it('text should be wrapped in a paragraph by default', () => {
Expand Down
7 changes: 3 additions & 4 deletions demos/src/Examples/Savvy/React/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ context('/src/Examples/Savvy/React/', () => {
})

beforeEach(() => {
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.resetEditor()
})

const tests = [
Expand All @@ -24,7 +22,8 @@ context('/src/Examples/Savvy/React/', () => {

tests.forEach(test => {
it(`should parse ${test[0]} correctly`, () => {
cy.get('.tiptap').type(`${test[0]} `).should('contain', test[1])
cy.get('.tiptap').realType(`${test[0]} `)
cy.get('.tiptap').should('contain', test[1])
})
})

Expand Down
7 changes: 3 additions & 4 deletions demos/src/Examples/Savvy/Vue/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ context('/src/Examples/Savvy/Vue/', () => {
})

beforeEach(() => {
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.resetEditor()
})

const tests = [
Expand All @@ -25,7 +23,8 @@ context('/src/Examples/Savvy/Vue/', () => {
tests.forEach(test => {
it(`should parse ${test[0]} correctly`, () => {
cy.get('.tiptap')
.type(`${test[0]} `)
.realType(`${test[0]} `)
cy.get('.tiptap')
.should('contain', test[1])
})
})
Expand Down
4 changes: 1 addition & 3 deletions demos/src/Examples/Tasks/React/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ context('/src/Examples/Tasks/React/', () => {
})

beforeEach(() => {
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.resetEditor()
})

it('should always use task items', () => {
Expand Down
4 changes: 1 addition & 3 deletions demos/src/Examples/Tasks/Vue/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ context('/src/Examples/Tasks/Vue/', () => {
})

beforeEach(() => {
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.resetEditor()
})

it('should always use task items', () => {
Expand Down
4 changes: 1 addition & 3 deletions demos/src/Experiments/Commands/Vue/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ context('/src/Experiments/Commands/Vue/', () => {
})

beforeEach(() => {
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.clearContent()
})
cy.resetEditor()
})

it('should open a popup after typing a slash', () => {
Expand Down
Loading

0 comments on commit 1502aeb

Please sign in to comment.