aboutsummaryrefslogtreecommitdiffstats
path: root/cypress
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2024-07-31 16:15:12 +0200
committerFerdinand Thiessen <opensource@fthiessen.de>2024-08-01 14:17:48 +0200
commitc8a5758ccde52857ccad2353d3674645ab5b9526 (patch)
tree69bb578abce66a4a03f64ec92623fbf8fd804220 /cypress
parent270ec122e084a7f1d481d70a8bf03fd50032b89f (diff)
downloadnextcloud-server-c8a5758ccde52857ccad2353d3674645ab5b9526.tar.gz
nextcloud-server-c8a5758ccde52857ccad2353d3674645ab5b9526.zip
test: Add test for recent view
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'cypress')
-rw-r--r--cypress/e2e/files/recent-view.cy.ts44
1 files changed, 44 insertions, 0 deletions
diff --git a/cypress/e2e/files/recent-view.cy.ts b/cypress/e2e/files/recent-view.cy.ts
new file mode 100644
index 00000000000..64eeca9a085
--- /dev/null
+++ b/cypress/e2e/files/recent-view.cy.ts
@@ -0,0 +1,44 @@
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+import type { User } from '@nextcloud/cypress'
+import { getRowForFile, triggerActionForFile } from './FilesUtils'
+
+describe('files: Recent view', { testIsolation: true }, () => {
+ let user: User
+
+ beforeEach(() => cy.createRandomUser().then(($user) => {
+ user = $user
+
+ cy.uploadContent(user, new Blob([]), 'text/plain', '/file.txt')
+ cy.login(user)
+ }))
+
+ it('see the recently created file in the recent view', () => {
+ cy.visit('/apps/files/recent')
+ // All are visible by default
+ getRowForFile('file.txt').should('be.visible')
+ })
+
+ /**
+ * Regression test: There was a bug that the files were correctly loaded but with invalid source
+ * so the delete action failed.
+ */
+ it('can delete a file in the recent view', () => {
+ cy.intercept('DELETE', '**/remote.php/dav/files/**').as('deleteFile')
+
+ cy.visit('/apps/files/recent')
+ // See the row
+ getRowForFile('file.txt').should('be.visible')
+ // delete the file
+ triggerActionForFile('file.txt', 'delete')
+ cy.wait('@deleteFile')
+ // See it is not visible anymore
+ getRowForFile('file.txt').should('not.exist')
+ // also not existing in default view after reload
+ cy.visit('/apps/files')
+ getRowForFile('file.txt').should('not.exist')
+ })
+})