Skip to content

Commit 2a9aaa8

Browse files
Vinicius Reismax-nextcloud
authored andcommitted
✅ test relative link to another files in sub folders
Signed-off-by: Vinicius Reis <vinicius.reis@nextcloud.com>
1 parent 63d8b7c commit 2a9aaa8

1 file changed

Lines changed: 43 additions & 3 deletions

File tree

cypress/e2e/workspace.spec.js

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { randHash } from '../utils/index.js'
2424
const randUser = randHash()
2525

2626
describe('Workspace', function() {
27+
let currentFolder
2728

2829
before(function() {
2930
cy.nextcloudCreateUser(randUser, 'password')
@@ -33,11 +34,12 @@ describe('Workspace', function() {
3334
cy.login(randUser, 'password').then(() => {
3435
// isolate tests - each happens in its own folder
3536
const retry = cy.state('test').currentRetry()
36-
const folderName = retry
37+
38+
currentFolder = retry
3739
? `${Cypress.currentTest.title} (${retry})`
3840
: Cypress.currentTest.title
39-
cy.createFolder(folderName)
40-
cy.visit(`apps/files?dir=/${encodeURIComponent(folderName)}`)
41+
cy.createFolder(currentFolder)
42+
cy.visit(`apps/files?dir=/${encodeURIComponent(currentFolder)}`)
4143
})
4244
})
4345

@@ -169,6 +171,44 @@ describe('Workspace', function() {
169171
.contains('😀')
170172
})
171173

174+
it('relative folder links', () => {
175+
cy.createFolder(`${currentFolder}/sub-folder`)
176+
cy.createFolder(`${currentFolder}/sub-folder/alpha`)
177+
178+
cy.uploadFile('test.md', 'text/markdown', `${currentFolder}/sub-folder/alpha/test.md`)
179+
180+
cy.openWorkspace()
181+
.type('link me')
182+
.type('{selectall}')
183+
184+
menuBubbleButton('add-file')
185+
.click()
186+
187+
cy.get('#picker-filestable tr[data-entryname="sub-folder"]').click()
188+
cy.get('#picker-filestable tr[data-entryname="alpha"]').click()
189+
cy.get('#picker-filestable tr[data-entryname="test.md"]').click()
190+
cy.get('.oc-dialog > .oc-dialog-buttonrow button').click()
191+
192+
cy.getEditor()
193+
.find('a')
194+
.should('have.attr', 'href')
195+
.and('contains', `dir=/${currentFolder}/sub-folder/alpha`)
196+
.and('contains', '#relPath=sub-folder/alpha/test.md')
197+
198+
cy.getEditor()
199+
.find('a').click()
200+
201+
cy.getModal()
202+
.find('.modal-header')
203+
.contains('test.md')
204+
205+
cy.getModal()
206+
.getEditor()
207+
.contains('Hello world')
208+
209+
cy.getModal().find('button.header-close').click()
210+
})
211+
172212
describe('callouts', () => {
173213
const types = ['info', 'warn', 'error', 'success']
174214

0 commit comments

Comments
 (0)