diff options
author | skjnldsv <skjnldsv@protonmail.com> | 2025-02-18 10:53:11 +0100 |
---|---|---|
committer | skjnldsv <skjnldsv@protonmail.com> | 2025-02-18 10:53:23 +0100 |
commit | 4f795e144cbc858c76c41e4e0abf29e8a9955f09 (patch) | |
tree | 139f0eed2614c1bb1f49923be4c89f262e5aa3a0 /cypress | |
parent | 2e50a39265e09ac5e8de6ec53cff1546aafe8629 (diff) | |
download | nextcloud-server-4f795e144cbc858c76c41e4e0abf29e8a9955f09.tar.gz nextcloud-server-4f795e144cbc858c76c41e4e0abf29e8a9955f09.zip |
fix(files): properly show file not found error
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Diffstat (limited to 'cypress')
-rw-r--r-- | cypress/e2e/files/files.cy.ts | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/cypress/e2e/files/files.cy.ts b/cypress/e2e/files/files.cy.ts index 900be849d9b..ac82086360f 100644 --- a/cypress/e2e/files/files.cy.ts +++ b/cypress/e2e/files/files.cy.ts @@ -1,16 +1,57 @@ +import type { User } from "@nextcloud/cypress" + /** * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ describe('Files', { testIsolation: true }, () => { + let currentUser: User + beforeEach(() => { cy.createRandomUser().then((user) => { - cy.login(user) + currentUser = user }) }) it('Login with a user and open the files app', () => { + cy.login(currentUser) cy.visit('/apps/files') cy.get('[data-cy-files-list] [data-cy-files-list-row-name="welcome.txt"]').should('be.visible') }) + + it('Opens a valid file shows it as active', () => { + cy.uploadContent(currentUser, new Blob(), 'text/plain', '/original.txt').then((response) => { + const fileId = Number.parseInt(response.headers['oc-fileid'] ?? '0') + + cy.login(currentUser) + cy.visit('/apps/files/files/' + fileId) + + cy.get(`[data-cy-files-list-row-fileid=${fileId}]`) + .should('be.visible') + cy.get(`[data-cy-files-list-row-fileid=${fileId}]`) + .invoke('attr', 'data-cy-files-list-row-name').should('eq', 'original.txt') + cy.get(`[data-cy-files-list-row-fileid=${fileId}]`) + .invoke('attr', 'class').should('contain', 'active') + cy.contains('The file could not be found').should('not.exist') + }) + }) + + it('Opens a valid folder shows its content', () => { + cy.mkdir(currentUser, '/folder').then(() => { + cy.login(currentUser) + cy.visit('/apps/files/files?dir=/folder') + + cy.get('[data-cy-files-content-breadcrumbs]').contains('folder').should('be.visible') + cy.contains('The file could not be found').should('not.exist') + }) + }) + + it('Opens an unknown file show an error', () => { + cy.intercept('PROPFIND', /\/remote.php\/dav\//).as('propfind') + cy.login(currentUser) + cy.visit('/apps/files/files/123456') + + cy.wait('@propfind') + cy.contains('The file could not be found').should('be.visible') + }) }) |