aboutsummaryrefslogtreecommitdiffstats
path: root/cypress/pages/NavigationHeader.ts
blob: 5441b75de88dc0f23a1787db866f1fdfd75d4448 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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 })
	}

}