Skip to content

Commit

Permalink
test(cypress): adjust selectors and share from details tab
Browse files Browse the repository at this point in the history
There is no direct link to the share tab right now.

Signed-off-by: Max <[email protected]>
  • Loading branch information
max-nextcloud authored and juliusknorr committed Aug 24, 2023
1 parent 3c0d482 commit 3aa3bfc
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
7 changes: 4 additions & 3 deletions cypress/e2e/sharing/download-share-disabled.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ describe(`Download ${fileName} in viewer`, function() {
})

it('See the default files list', function() {
cy.get('.files-fileList tr').should('contain', 'welcome.txt')
cy.get('.files-fileList tr').should('contain', 'Photos')
cy.getFile('welcome.txt').should('contain', 'welcome .txt')
cy.getFile('Photos').should('contain', 'Photos')
})

it('See shared files in the list', function() {
Expand All @@ -58,8 +58,9 @@ describe(`Download ${fileName} in viewer`, function() {
cy.createLinkShare('/Photos').then(token => {
// Open the sidebar
cy.visit('/apps/files')
cy.getFile('Photos').find('.fileactions .action-share', { timeout: 10000 }).click()
cy.getFile('Photos').clickAction('details')
cy.get('aside.app-sidebar').should('be.visible')
cy.get('[data-id="sharing"] label').click()

// Open the share menu
cy.get(`.sharing-link-list > .sharing-entry > .action-item[href*='/s/${token}'] + .sharing-entry__actions .action-item__menutoggle`).click()
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/sharing/download-share.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ describe(`Download ${fileName} from viewer in link share`, function() {
})

it('See the default files list', function() {
cy.get('.files-fileList tr').should('contain', 'welcome.txt')
cy.get('.files-fileList tr').should('contain', 'Photos')
cy.getFile('welcome.txt').should('contain', 'welcome .txt')
cy.getFile('Photos').should('contain', 'Photos')
})

it('See shared files in the list', function() {
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/sharing/files-shares.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ describe('See shared folder with link share', function() {
})

it('See the default files list', function() {
cy.get('.files-fileList tr').should('contain', 'welcome.txt')
cy.get('.files-fileList tr').should('contain', 'Photos')
cy.getFile('welcome.txt').should('contain', 'welcome .txt')
cy.getFile('Photos').should('contain', 'Photos')
})

it('See shared files in the list', function() {
Expand Down
12 changes: 10 additions & 2 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,18 @@ Cypress.Commands.add('getFileId', fileName => {
})

Cypress.Commands.add('deleteFile', fileName => {
cy.getFile(fileName).find('[data-cy-files-list-row-actions] button').click()
cy.get('[data-cy-files-list-row-action="delete"]').click()
cy.getFile(fileName).clickAction('delete')
})

Cypress.Commands.add(
'clickAction',
{ prevSubject: 'element' },
(subject, action) => {
subject.find('[data-cy-files-list-row-actions] button').click()
cy.get(`[data-cy-files-list-row-action="${action}"]`).click()
},
)

/**
* Create a share link and return the share url
*
Expand Down

0 comments on commit 3aa3bfc

Please sign in to comment.