aboutsummaryrefslogtreecommitdiffstats
path: root/cypress/e2e
diff options
context:
space:
mode:
authorRichard Steinmetz <richard@steinmetz.cloud>2025-01-13 17:09:38 +0100
committerRichard Steinmetz <richard@steinmetz.cloud>2025-01-20 19:30:06 +0100
commitf0dfc9c504d9e49a04556b2dad7d5bf555612507 (patch)
tree6d2e26342fae4490ead9d6068923a153871ba4d0 /cypress/e2e
parent994ffe109fab9beb46df0628968907760fd2b682 (diff)
downloadnextcloud-server-f0dfc9c504d9e49a04556b2dad7d5bf555612507.tar.gz
nextcloud-server-f0dfc9c504d9e49a04556b2dad7d5bf555612507.zip
fix(files): sort not working after changing viewsbackport/50161/stable29
Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
Diffstat (limited to 'cypress/e2e')
-rw-r--r--cypress/e2e/files/files_sorting.cy.ts61
1 files changed, 61 insertions, 0 deletions
diff --git a/cypress/e2e/files/files_sorting.cy.ts b/cypress/e2e/files/files_sorting.cy.ts
index 9cb6fe3fe2f..ef3724a204f 100644
--- a/cypress/e2e/files/files_sorting.cy.ts
+++ b/cypress/e2e/files/files_sorting.cy.ts
@@ -284,4 +284,65 @@ describe('Files: Sorting the file list', { testIsolation: true }, () => {
}
})
})
+
+ it('Sorting works after switching view twice', () => {
+ cy.uploadContent(currentUser, new Blob(), 'text/plain', '/1 tiny.txt')
+ .uploadContent(currentUser, new Blob(['a'.repeat(1024)]), 'text/plain', '/z big.txt')
+ .uploadContent(currentUser, new Blob(['a'.repeat(512)]), 'text/plain', '/a medium.txt')
+ .mkdir(currentUser, '/folder')
+ cy.login(currentUser)
+ cy.visit('/apps/files')
+
+ // click sort button twice
+ cy.get('th').contains('button', 'Size').click()
+ cy.get('th').contains('button', 'Size').click()
+
+ // switch to personal and click sort button twice again
+ cy.get('[data-cy-files-navigation-item="personal"]').click()
+ cy.get('th').contains('button', 'Size').click()
+ cy.get('th').contains('button', 'Size').click()
+
+ // switch back to files view and do actual assertions
+ cy.get('[data-cy-files-navigation-item="files"]').click()
+
+ // click sort button
+ cy.get('th').contains('button', 'Size').click()
+ // sorting is set
+ cy.contains('th', 'Size').should('have.attr', 'aria-sort', 'ascending')
+ // Files are sorted
+ cy.get('[data-cy-files-list-row]').each(($row, index) => {
+ switch (index) {
+ case 0: expect($row.attr('data-cy-files-list-row-name')).to.eq('folder')
+ break
+ case 1: expect($row.attr('data-cy-files-list-row-name')).to.eq('1 tiny.txt')
+ break
+ case 2: expect($row.attr('data-cy-files-list-row-name')).to.eq('welcome.txt')
+ break
+ case 3: expect($row.attr('data-cy-files-list-row-name')).to.eq('a medium.txt')
+ break
+ case 4: expect($row.attr('data-cy-files-list-row-name')).to.eq('z big.txt')
+ break
+ }
+ })
+
+ // click sort button
+ cy.get('th').contains('button', 'Size').click()
+ // sorting is set
+ cy.contains('th', 'Size').should('have.attr', 'aria-sort', 'descending')
+ // Files are sorted
+ cy.get('[data-cy-files-list-row]').each(($row, index) => {
+ switch (index) {
+ case 0: expect($row.attr('data-cy-files-list-row-name')).to.eq('folder')
+ break
+ case 1: expect($row.attr('data-cy-files-list-row-name')).to.eq('z big.txt')
+ break
+ case 2: expect($row.attr('data-cy-files-list-row-name')).to.eq('a medium.txt')
+ break
+ case 3: expect($row.attr('data-cy-files-list-row-name')).to.eq('welcome.txt')
+ break
+ case 4: expect($row.attr('data-cy-files-list-row-name')).to.eq('1 tiny.txt')
+ break
+ }
+ })
+ })
})