Skip to content

Commit

Permalink
fix(tests): add assertion for each valid/invalid link (#3815)
Browse files Browse the repository at this point in the history
* fix(tests): add assertion for each valid/invalid link

* chore(tests): disable video generation
  • Loading branch information
bdbch authored Mar 3, 2023
1 parent b2ec513 commit f5895c6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
10 changes: 5 additions & 5 deletions demos/src/Examples/AutolinkValidation/React/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ context('/src/Examples/AutolinkValidation/React/', () => {
'https://tiptap.dev',
]

it('valid links should get autolinked', () => {
validLinks.forEach(([rawTextInput, textThatShouldBeLinked]) => {
cy.get('.ProseMirror').type(`{selectall}{backspace}${rawTextInput}`)
validLinks.forEach(([rawTextInput, textThatShouldBeLinked]) => {
it(`should autolink ${rawTextInput}`, () => {
cy.get('.ProseMirror').type(rawTextInput)
cy.get('.ProseMirror a').contains(textThatShouldBeLinked)
})
})

it('invalid links should not get autolinked', () => {
invalidLinks.forEach(rawTextInput => {
invalidLinks.forEach(rawTextInput => {
it(`should not autolink ${rawTextInput}`, () => {
cy.get('.ProseMirror').type(`{selectall}{backspace}${rawTextInput}`)
cy.get('.ProseMirror a').should('not.exist')
})
Expand Down
10 changes: 5 additions & 5 deletions demos/src/Examples/AutolinkValidation/Vue/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ context('/src/Examples/AutolinkValidation/Vue/', () => {
'https://tiptap.dev',
]

it('valid links should get autolinked', () => {
validLinks.forEach(([rawTextInput, textThatShouldBeLinked]) => {
cy.get('.ProseMirror').type(`{selectall}{backspace}${rawTextInput}`)
validLinks.forEach(([rawTextInput, textThatShouldBeLinked]) => {
it(`should autolink ${rawTextInput}`, () => {
cy.get('.ProseMirror').type(rawTextInput)
cy.get('.ProseMirror a').contains(textThatShouldBeLinked)
})
})

it('invalid links should not get autolinked', () => {
invalidLinks.forEach(rawTextInput => {
invalidLinks.forEach(rawTextInput => {
it(`should not autolink ${rawTextInput}`, () => {
cy.get('.ProseMirror').type(`{selectall}{backspace}${rawTextInput}`)
cy.get('.ProseMirror a').should('not.exist')
})
Expand Down
1 change: 1 addition & 0 deletions tests/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const { defineConfig } = require('cypress')

module.exports = defineConfig({
defaultCommandTimeout: 12000,
video: false,
e2e: {
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config)
Expand Down

0 comments on commit f5895c6

Please sign in to comment.