FilesFilters.ts 779 B

12345678910111213141516171819202122232425262728293031323334
  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 files filters
  7. */
  8. export class FilesFilterPage {
  9. filterContainter() {
  10. return cy.get('[data-cy-files-filters]')
  11. }
  12. activeFiltersList() {
  13. return cy.findByRole('list', { name: 'Active filters' })
  14. }
  15. activeFilters() {
  16. return this.activeFiltersList().findAllByRole('listitem')
  17. }
  18. removeFilter(name: string | RegExp) {
  19. const el = typeof name === 'string'
  20. ? this.activeFilters().should('contain.text', name)
  21. : this.activeFilters().should('match', name)
  22. el.should('exist')
  23. // click the button
  24. el.findByRole('button', { name: 'Remove filter' })
  25. .should('exist')
  26. .click({ force: true })
  27. }
  28. }