Skip to content

Commit

Permalink
fix(cy): test and reset collectives folder via api
Browse files Browse the repository at this point in the history
Signed-off-by: Max <[email protected]>
  • Loading branch information
max-nextcloud committed Dec 30, 2023
1 parent ec8207d commit d7be767
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 21 deletions.
24 changes: 3 additions & 21 deletions cypress/e2e/settings.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ describe('Settings', function() {
cy.get('button').contains('Choose')
.click()
cy.wait('@setCollectivesFolder')
cy.getCollectivesFolder()
.should('be.equal', `/${randomFolder}`)

// Check if collectives are found in new folder in Files app
cy.log('Check if collectives are in configured user folder')
Expand All @@ -73,27 +75,7 @@ describe('Settings', function() {
cy.fileList().should('contain', 'A Collective')

// Change user folder back to default
cy.log('Change user folder back to default')
cy.visit('/apps/collectives')
cy.get('#app-settings')
.click()
cy.get('input[name="userFolder"]')
.click()
cy.wait('@propfindFolder')

// Open home folder
cy.get('[data-dir=""] > a, a[title="Home"]')
.click()
cy.wait('@propfindFolder')

// Open and select default folder
cy.get(filePickerListSelector).contains('Collectives')
.click()
cy.get(filePickerListSelector).contains('Collectives')
.should('not.exist')
cy.get('button').contains('Choose')
.click()
cy.wait('@setCollectivesFolder')
cy.setCollectivesFolder('/Collectives')
})
})
})
7 changes: 7 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,13 @@ Cypress.Commands.add('getCollectives', () => {
.then(response => response.data.data)
})

Cypress.Commands.add('getCollectivesFolder', () => {
return api.getCollectivesFolder()
.then(response => response.data.ocs.data)
})

Cypress.Commands.add('setCollectivesFolder', api.setCollectivesFolder)

/**
* Move a collective into the trash if it exists.
*
Expand Down

0 comments on commit d7be767

Please sign in to comment.