Skip to content

Commit

Permalink
test(cypress): Fix link tests with link bubble
Browse files Browse the repository at this point in the history
Signed-off-by: Jonas <[email protected]>
  • Loading branch information
mejo- committed Jan 18, 2024
1 parent e87bd4d commit 7039eb3
Showing 1 changed file with 26 additions and 11 deletions.
37 changes: 26 additions & 11 deletions cypress/e2e/nodes/Links.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,20 @@ describe('test link marks', function() {
cy.openFile(fileName, { force: true })
})

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

cy.getContent()
.find('a[href*="https://nextcloud.com]')
.click()

cy.get('link-view-bubble')
.find('.widgets--list', { timeout: 10000 })
.find('.widget-default--name')
.contains('Nextcloud')
})

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

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

describe('autolink', function() {
Expand All @@ -56,6 +51,11 @@ describe('test link marks', function() {
.find(`a[href*="${Cypress.env('baseUrl')}"]`)
.click({ force: true })

cy.get('link-view-bubble')
.find('.widget--list', { timeout: 10000 })
.find('.widget-file--details')
.click()

cy.get('@winOpen')
.should('have.been.calledOnce')
.should('have.been.calledWithMatch', new RegExp(`/f/${id}$`))
Expand All @@ -76,6 +76,11 @@ describe('test link marks', function() {
.find(`a[href*="${Cypress.env('baseUrl')}"]`)
.click({ force: true })

cy.get('link-view-bubble')
.find('.widget--list', { timeout: 10000 })
.find('.widget-file--details')
.click()

cy.get('@winOpen')
.should('have.been.calledOnce')
.should('have.been.calledWithMatch', new RegExp(`${Cypress.env('baseUrl')}/file-name\\?fileId=${id}$`))
Expand Down Expand Up @@ -116,6 +121,11 @@ describe('test link marks', function() {
.should('have.text', text) // ensure correct text used
.click({ force: true })

cy.get('link-view-bubble')
.find('.widget--list', { timeout: 10000 })
.find('.widget-default--name')
.click()

cy.get('@winOpen')
.should('have.been.calledOnce')
.should('have.been.calledWith', url)
Expand Down Expand Up @@ -152,6 +162,11 @@ describe('test link marks', function() {
.find(`a[href*="${encodeURIComponent(filename)}"]`)
.should('have.text', text === undefined ? filename : text)
.click({ force: true })

cy.get('link-view-bubble')

Check failure on line 166 in cypress/e2e/nodes/Links.spec.js

View workflow job for this annotation

GitHub Actions / NPM lint

Unreachable code
.find('.widget--list', { timeout: 10000 })
.find('.widget-file--details')
.click()
}

beforeEach(() => cy.clearContent())
Expand Down

0 comments on commit 7039eb3

Please sign in to comment.