aboutsummaryrefslogtreecommitdiffstats
path: root/cypress/pages
diff options
context:
space:
mode:
Diffstat (limited to 'cypress/pages')
-rw-r--r--cypress/pages/FilesFilters.ts34
-rw-r--r--cypress/pages/FilesNavigation.ts46
-rw-r--r--cypress/pages/NavigationHeader.ts58
3 files changed, 138 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..1be11231bad
--- /dev/null
+++ b/cypress/pages/FilesNavigation.ts
@@ -0,0 +1,46 @@
+/*!
+ * 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')
+ }
+
+ searchScopeTrigger() {
+ return this.navigation().findByRole('button', { name: /search scope options/i })
+ }
+
+ /**
+ * Only available after clicking on the search scope trigger
+ */
+ searchScopeMenu() {
+ return cy.findByRole('menu', { name: /search scope options/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]')
+ }
+
+}
diff --git a/cypress/pages/NavigationHeader.ts b/cypress/pages/NavigationHeader.ts
new file mode 100644
index 00000000000..5441b75de88
--- /dev/null
+++ b/cypress/pages/NavigationHeader.ts
@@ -0,0 +1,58 @@
+/*!
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+/**
+ * Page object model for the Nextcloud navigation header
+ */
+export class NavigationHeader {
+
+ /**
+ * Locator of the header bar wrapper
+ */
+ header() {
+ return cy.get('header#header')
+ }
+
+ /**
+ * Locator for the logo navigation entry (entry redirects to default app)
+ */
+ logo() {
+ return this.header()
+ .find('#nextcloud')
+ }
+
+ /**
+ * Locator of the app navigation bar
+ */
+ navigation() {
+ return this.header()
+ .findByRole('navigation', { name: 'Applications menu' })
+ }
+
+ /**
+ * The toggle for the navigation overflow menu
+ */
+ overflowNavigationToggle() {
+ return this.navigation()
+ }
+
+ /**
+ * Get all navigation entries
+ */
+ getNavigationEntries() {
+ return this.navigation()
+ .findAllByRole('listitem')
+ }
+
+ /**
+ * Get the navigation entry for a given app
+ * @param name The app name
+ */
+ getNavigationEntry(name: string) {
+ return this.navigation()
+ .findByRole('listitem', { name })
+ }
+
+}