123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- export class UnifiedSearchPage {
- toggleButton() {
- return cy.findByRole('button', { name: 'Unified search' })
- }
- globalSearchButton() {
- return cy.findByRole('button', { name: 'Search everywhere' })
- }
- localSearchInput() {
- return cy.findByRole('textbox', { name: 'Search in current app' })
- }
- globalSearchInput() {
- return cy.findByRole('textbox', { name: /Search apps, files/ })
- }
- globalSearchModal() {
-
-
- return cy.get('#unified-search')
- }
-
- openLocalSearch() {
- this.toggleButton()
- .if('visible')
- .click()
- this.localSearchInput().should('exist').and('not.have.css', 'display', 'none')
- }
-
- typeLocalSearch(text: string, options?: Partial<Omit<Cypress.TypeOptions, 'force'>>) {
- return this.localSearchInput()
- .type(text, { ...options, force: true })
- }
- openGlobalSearch() {
- this.toggleButton()
- .if('visible').click()
- this.globalSearchButton()
- .if('visible').click()
- }
- closeGlobalSearch() {
- this.globalSearchModal()
- .findByRole('button', { name: 'Close' })
- .click()
- }
- getResults(category: string | RegExp) {
- return this.globalSearchModal()
- .findByRole('list', { name: category })
- .findAllByRole('listitem')
- }
- }
|