aboutsummaryrefslogtreecommitdiffstats
path: root/cypress
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2024-11-13 16:38:38 +0100
committerFerdinand Thiessen <opensource@fthiessen.de>2025-01-17 08:59:17 +0100
commit4a9954f5ef5b60d5d3d2e4926f8555a3a4430947 (patch)
tree49287e4d81567ddf3256eb8efad62ea24a525e43 /cypress
parent326120a7f7713c43084f1eed5f2a1ab1ffd29004 (diff)
downloadnextcloud-server-4a9954f5ef5b60d5d3d2e4926f8555a3a4430947.tar.gz
nextcloud-server-4a9954f5ef5b60d5d3d2e4926f8555a3a4430947.zip
fix(files): File type filter UI sync with filter state
When changing the folder the filter will be re-mounted by the file list, so we need to pass the current state of the filter to the filter UI. Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'cypress')
-rw-r--r--cypress/e2e/files/files-filtering.cy.ts49
1 files changed, 49 insertions, 0 deletions
diff --git a/cypress/e2e/files/files-filtering.cy.ts b/cypress/e2e/files/files-filtering.cy.ts
index c7b147d4a9c..a2fab17fbec 100644
--- a/cypress/e2e/files/files-filtering.cy.ts
+++ b/cypress/e2e/files/files-filtering.cy.ts
@@ -201,6 +201,55 @@ describe('files: Filter in files list', { testIsolation: true }, () => {
getRowForFile('text.txt').should('not.exist')
})
+ /** Regression test of https://github.com/nextcloud/server/issues/47251 */
+ it('keeps filter state when changing the directory', () => {
+ // files are visible
+ getRowForFile('folder').should('be.visible')
+ getRowForFile('file.txt').should('be.visible')
+
+ // enable type filter for folders
+ filesFilters.filterContainter()
+ .findByRole('button', { name: 'Type' })
+ .should('be.visible')
+ .click()
+ cy.findByRole('menuitemcheckbox', { name: 'Folders' })
+ .should('be.visible')
+ .click()
+ // assert the button is checked
+ cy.findByRole('menuitemcheckbox', { name: 'Folders' })
+ .should('have.attr', 'aria-checked', 'true')
+ // close the menu
+ filesFilters.filterContainter()
+ .findByRole('button', { name: 'Type' })
+ .click()
+
+ // See the chips are active
+ filesFilters.activeFilters()
+ .should('have.length', 1)
+ .contains(/Folder/).should('be.visible')
+
+ // See that folder is visible but file not
+ getRowForFile('folder').should('be.visible')
+ getRowForFile('file.txt').should('not.exist')
+
+ // Change the directory
+ navigateToFolder('folder')
+ getRowForFile('folder').should('not.exist')
+
+ // See that the chip is still
+ filesFilters.activeFilters()
+ .should('have.length', 1)
+ .contains(/Folder/).should('be.visible')
+ // And also the button should be active
+ filesFilters.filterContainter()
+ .findByRole('button', { name: 'Type' })
+ .should('be.visible')
+ .click()
+ cy.findByRole('menuitemcheckbox', { name: 'Folders' })
+ .should('be.visible')
+ .and('have.attr', 'aria-checked', 'true')
+ })
+
it('resets filter when changing the view', () => {
// All are visible by default
getRowForFile('folder').should('be.visible')