aboutsummaryrefslogtreecommitdiffstats
path: root/cypress/pages/NavigationHeader.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cypress/pages/NavigationHeader.ts')
-rw-r--r--cypress/pages/NavigationHeader.ts58
1 files changed, 58 insertions, 0 deletions
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 })
+ }
+
+}