Skip to content

Commit

Permalink
fix(cy): adjust selectors for filepicker
Browse files Browse the repository at this point in the history
basename and extension are now split.

Signed-off-by: Max <[email protected]>
  • Loading branch information
max-nextcloud committed Aug 27, 2023
1 parent 51b66dc commit 904ffa8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
13 changes: 7 additions & 6 deletions cypress/e2e/attachments.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ describe('Test all attachment insertion methods', () => {
cy.log('Go to sub folder (a)')
cy.get('.file-picker__main .file-picker__file-name[title="sub"]').click()
cy.get('.file-picker__main .file-picker__file-name[title="a"]').click()
cy.get('.file-picker__main .file-picker__file-name[title="a.png"]').click()
cy.get('.file-picker__main .file-picker__file-name[title="a"]').click()

cy.get('.dialog__actions button.button-vue--vue-primary').click()

Expand All @@ -191,12 +191,13 @@ describe('Test all attachment insertion methods', () => {
const requestAlias = 'insertPathRequest-b'
cy.intercept({ method: 'POST', url: '**/filepath' }).as(requestAlias)

cy.log('Go back to sub folder')
cy.get('#oc-dialog-filepicker-content .dirtree [data-dir="/sub"] a').click()
cy.log('Go back from home to sub folder')
cy.get('.file-picker__breadcrumbs a[title="Home"]').click()
cy.get('.file-picker__main .file-picker__file-name[title="sub"]').click()

cy.log('Go to sub folder (b)')
cy.get('.file-picker__main .file-picker__file-name[title="b"]').click()
cy.get('.file-picker__main .file-picker__file-name[title="b.png"]').click()
cy.get('.file-picker__main .file-picker__file-name[title="b"]').click()

cy.get('.dialog__actions button.button-vue--vue-primary').click()

Expand All @@ -210,10 +211,10 @@ describe('Test all attachment insertion methods', () => {
cy.intercept({ method: 'POST', url: '**/filepath' }).as(requestAlias)

cy.log('Go back to home')
cy.get('#oc-dialog-filepicker-content .dirtree .crumb:first-child').click()
cy.get('.file-picker__breadcrumbs a[title="Home"]').click()

cy.log('Select the file in the filepicker')
cy.get('.file-picker__main .file-picker__file-name[title="github.png"]').click()
cy.get('.file-picker__main .file-picker__file-name[title="github"]').click()
cy.log('Click OK in the filepicker')
cy.get('.dialog__actions button.button-vue--vue-primary').click()

Expand Down
3 changes: 2 additions & 1 deletion cypress/e2e/nodes/Links.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ describe('test link marks', function() {
// Helper to reduce duplicated code, checking inserting with and without selected text
const checkLinkFile = (filename, text) => {
cy.getSubmenuEntry('insert-link', 'insert-link-file').click()
cy.get(`.file-picker__main .file-picker__file-name[title="${filename}"]`).click()
const basename = filename.replace(/(.*)\./, '$1')
cy.get(`.file-picker__main .file-picker__file-name[title="${basename}"]`).click()
cy.get('.dialog__actions button.button-vue--vue-primary').click()

return cy.getContent()
Expand Down

0 comments on commit 904ffa8

Please sign in to comment.