From 953aa61eccf22600df801e5de15f3179ac629a5a Mon Sep 17 00:00:00 2001 From: Vinicius Reis Date: Tue, 18 Oct 2022 11:06:15 -0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20test=20relative=20link=20to=20anoth?= =?UTF-8?q?er=20files=20in=20sub=20folders?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Vinicius Reis --- cypress/e2e/workspace.spec.js | 45 ++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/cypress/e2e/workspace.spec.js b/cypress/e2e/workspace.spec.js index 57547f1b455..5d8a76de9c5 100644 --- a/cypress/e2e/workspace.spec.js +++ b/cypress/e2e/workspace.spec.js @@ -24,6 +24,7 @@ import { randHash } from '../utils/index.js' const randUser = randHash() describe('Workspace', function() { + let currentFolder before(function() { cy.nextcloudCreateUser(randUser, 'password') @@ -33,11 +34,12 @@ describe('Workspace', function() { cy.login(randUser, 'password').then(() => { // isolate tests - each happens in its own folder const retry = cy.state('test').currentRetry() - const folderName = retry + + currentFolder = retry ? `${Cypress.currentTest.title} (${retry})` : Cypress.currentTest.title - cy.createFolder(folderName) - cy.visit(`apps/files?dir=/${encodeURIComponent(folderName)}`) + cy.createFolder(currentFolder) + cy.visit(`apps/files?dir=/${encodeURIComponent(currentFolder)}`) }) }) @@ -169,6 +171,43 @@ describe('Workspace', function() { .contains('😀') }) + it('relative folder links', () => { + cy.createFolder(`${currentFolder}/sub-folder`) + cy.createFolder(`${currentFolder}/sub-folder/alpha`) + + cy.uploadFile('test.md', 'text/markdown', `${currentFolder}/sub-folder/alpha/test.md`) + + cy.openWorkspace() + .type('link me') + .type('{selectall}') + + menuBubbleButton('add-file').click() + + cy.get('#picker-filestable tr[data-entryname="sub-folder"]').click() + cy.get('#picker-filestable tr[data-entryname="alpha"]').click() + cy.get('#picker-filestable tr[data-entryname="test.md"]').click() + cy.get('.oc-dialog > .oc-dialog-buttonrow button').click() + + cy.getEditor() + .find('a') + .should('have.attr', 'href') + .and('contains', `dir=/${currentFolder}/sub-folder/alpha`) + .and('contains', '#relPath=sub-folder/alpha/test.md') + + cy.getEditor() + .find('a').click() + + cy.getModal() + .find('.modal-header') + .contains('test.md') + + cy.getModal() + .getEditor() + .contains('Hello world') + + cy.getModal().find('button.header-close').click() + }) + describe('callouts', () => { const types = ['info', 'warn', 'error', 'success']