1
0

NavigationHeader.ts 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*!
  2. * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
  3. * SPDX-License-Identifier: AGPL-3.0-or-later
  4. */
  5. /**
  6. * Page object model for the Nextcloud navigation header
  7. */
  8. export class NavigationHeader {
  9. /**
  10. * Locator of the header bar wrapper
  11. */
  12. header() {
  13. return cy.get('header#header')
  14. }
  15. /**
  16. * Locator for the logo navigation entry (entry redirects to default app)
  17. */
  18. logo() {
  19. return this.header()
  20. .find('#nextcloud')
  21. }
  22. /**
  23. * Locator of the app navigation bar
  24. */
  25. navigation() {
  26. return this.header()
  27. .findByRole('navigation', { name: 'Applications menu' })
  28. }
  29. /**
  30. * The toggle for the navigation overflow menu
  31. */
  32. overflowNavigationToggle() {
  33. return this.navigation()
  34. }
  35. /**
  36. * Get all navigation entries
  37. */
  38. getNavigationEntries() {
  39. return this.navigation()
  40. .findAllByRole('listitem')
  41. }
  42. /**
  43. * Get the navigation entry for a given app
  44. * @param name The app name
  45. */
  46. getNavigationEntry(name: string) {
  47. return this.navigation()
  48. .findByRole('listitem', { name })
  49. }
  50. }