Skip to content

Commit

Permalink
✅ test relative link to another files in sub folders
Browse files Browse the repository at this point in the history
Signed-off-by: Vinicius Reis <vinicius.reis@nextcloud.com>
  • Loading branch information
Vinicius Reis authored and vinicius73 committed Oct 20, 2022
1 parent f8988e1 commit 953aa61
Showing 1 changed file with 42 additions and 3 deletions.
45 changes: 42 additions & 3 deletions cypress/e2e/workspace.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { randHash } from '../utils/index.js'
const randUser = randHash()

describe('Workspace', function() {
let currentFolder

before(function() {
cy.nextcloudCreateUser(randUser, 'password')
Expand All @@ -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)}`)
})
})

Expand Down Expand Up @@ -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']

Expand Down

0 comments on commit 953aa61

Please sign in to comment.