From 46e853aa79c7fe1ee9ab641651efe20706c3b013 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Mon, 3 Oct 2022 11:26:59 +0200 Subject: [PATCH] Add cypress tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- cypress/e2e/links.spec.js | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/cypress/e2e/links.spec.js b/cypress/e2e/links.spec.js index 76d9755334d..a7d5694d510 100644 --- a/cypress/e2e/links.spec.js +++ b/cypress/e2e/links.spec.js @@ -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() { @@ -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()