Skip to content

Commit

Permalink
Add cypress tests
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliusknorr committed Oct 11, 2022
1 parent 781fad0 commit 46e853a
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion cypress/e2e/links.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,31 @@ describe('test link marks', function() {
},
})

return cy.openFile(fileName, { force: true })
cy.openFile(fileName, { force: true })
return cy.clearContent()
})

describe('link preview', function() {
it('shows a link preview', () => {
cy.getContent()
.type('https://nextcloud.com')
.type('{enter}')

cy.getContent()
.find('.widgets--list', { timeout: 10000 })
.find('.widget-default--title')
.contains('Nextcloud - Online collaboration platform')
})

it('does not show a link preview for links within a paragraph', () => {
cy.getContent()
.type('Please visit https://nextcloud.com')
.type('{enter}')

cy.getContent()
.find('.widgets--list', { timeout: 10000 })
.should('not.exist')
})
})

describe('autolink', function() {
Expand All @@ -30,6 +54,7 @@ describe('test link marks', function() {

const link = `${Cypress.env('baseUrl')}/file-name?fileId=${id} `
cy.getContent()
.type('{enter}')
.type(link)

cy.getContent()
Expand Down

0 comments on commit 46e853a

Please sign in to comment.