Browse Source
fix: Allow to reset unified search using the `nextcloud:unified-search:reset` event
fix: Allow to reset unified search using the `nextcloud:unified-search:reset` event
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>pull/41609/head
No known key found for this signature in database
GPG Key ID: 45FAE7268762B400
8 changed files with 240 additions and 25 deletions
-
24apps/files/src/views/FilesList.vue
-
6core/src/views/UnifiedSearch.vue
-
34cypress/e2e/files/files-searching.cy.ts
-
75cypress/pages/UnifiedSearch.ts
-
1cypress/support/commands.ts
-
8cypress/tsconfig.json
-
116package-lock.json
-
1package.json
@ -0,0 +1,75 @@ |
|||
/** |
|||
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors |
|||
* SPDX-License-Identifier: AGPL-3.0-or-later |
|||
*/ |
|||
|
|||
/** |
|||
* Page object model for the UnifiedSearch |
|||
*/ |
|||
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() { |
|||
// TODO: Broken in library
|
|||
// return cy.findByRole('dialog', { name: 'Unified search' })
|
|||
return cy.get('#unified-search') |
|||
} |
|||
|
|||
// functions
|
|||
|
|||
openLocalSearch() { |
|||
this.toggleButton() |
|||
.if('visible') |
|||
.click() |
|||
|
|||
this.localSearchInput().should('exist').and('not.have.css', 'display', 'none') |
|||
} |
|||
|
|||
/** |
|||
* Type in the local search (must be open before) |
|||
* Helper because the input field is overlayed by the global-search button -> cypress thinks the input is not visible |
|||
* |
|||
* @param text The text to type |
|||
* @param options Options as for `cy.type()` |
|||
*/ |
|||
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') |
|||
} |
|||
|
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue