aboutsummaryrefslogtreecommitdiffstats
path: root/cypress/pages
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2024-07-25 19:14:02 +0200
committerFerdinand Thiessen <opensource@fthiessen.de>2024-07-25 19:33:28 +0200
commit2c0e2cc09e09e958770fd89553649646e897fc45 (patch)
tree9576ea89ca6c4b4e8500326bfb22a001c3b0ba2b /cypress/pages
parent1fc6b79f7c6c4dd2a0361abfe5c2632de0e2f131 (diff)
downloadnextcloud-server-2c0e2cc09e09e958770fd89553649646e897fc45.tar.gz
nextcloud-server-2c0e2cc09e09e958770fd89553649646e897fc45.zip
test: Add cypress tests for file list filtering
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'cypress/pages')
-rw-r--r--cypress/pages/FilesFilters.ts34
-rw-r--r--cypress/pages/FilesNavigation.ts35
2 files changed, 69 insertions, 0 deletions
diff --git a/cypress/pages/FilesFilters.ts b/cypress/pages/FilesFilters.ts
new file mode 100644
index 00000000000..036530f1e8a
--- /dev/null
+++ b/cypress/pages/FilesFilters.ts
@@ -0,0 +1,34 @@
+/*!
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+/**
+ * Page object model for the files filters
+ */
+export class FilesFilterPage {
+
+ filterContainter() {
+ return cy.get('[data-cy-files-filters]')
+ }
+
+ activeFiltersList() {
+ return cy.findByRole('list', { name: 'Active filters' })
+ }
+
+ activeFilters() {
+ return this.activeFiltersList().findAllByRole('listitem')
+ }
+
+ removeFilter(name: string | RegExp) {
+ const el = typeof name === 'string'
+ ? this.activeFilters().should('contain.text', name)
+ : this.activeFilters().should('match', name)
+ el.should('exist')
+ // click the button
+ el.findByRole('button', { name: 'Remove filter' })
+ .should('exist')
+ .click({ force: true })
+ }
+
+}
diff --git a/cypress/pages/FilesNavigation.ts b/cypress/pages/FilesNavigation.ts
new file mode 100644
index 00000000000..cb3897afb90
--- /dev/null
+++ b/cypress/pages/FilesNavigation.ts
@@ -0,0 +1,35 @@
+/*!
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+/**
+ * Page object model for the files app navigation
+ */
+export class FilesNavigationPage {
+
+ navigation() {
+ return cy.findByRole('navigation', { name: 'Files' })
+ }
+
+ searchInput() {
+ return this.navigation().findByRole('searchbox', { name: /filter filenames/i })
+ }
+
+ searchClearButton() {
+ return this.navigation().findByRole('button', { name: /clear search/i })
+ }
+
+ settingsToggle() {
+ return this.navigation().findByRole('link', { name: 'Files settings' })
+ }
+
+ views() {
+ return this.navigation().findByRole('list', { name: 'Views' })
+ }
+
+ quota() {
+ return this.navigation().find('[data-cy-files-navigation-settings-quota]')
+ }
+
+}