mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
test(e2e): backport handlePasswordConfirmation helper
Signed-off-by: Peter Ringelmann <peter.ringelmann@nextcloud.com>
This commit is contained in:
parent
cab6c79b3c
commit
199f8bd4f4
1 changed files with 26 additions and 0 deletions
|
|
@ -10,6 +10,32 @@ export function getUnifiedSearchModal() {
|
|||
return cy.get('#unified-search')
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the confirm password dialog (if needed)
|
||||
*
|
||||
* @param adminPassword The admin password for the dialog
|
||||
*/
|
||||
export function handlePasswordConfirmation(adminPassword = 'admin') {
|
||||
const handleModal = (context: Cypress.Chainable) => {
|
||||
return context.contains('.modal-container', 'Authentication required')
|
||||
.if()
|
||||
.within(() => {
|
||||
cy.get('input[type="password"]')
|
||||
.type(adminPassword)
|
||||
cy.findByRole('button', { name: 'Confirm' })
|
||||
.click()
|
||||
})
|
||||
}
|
||||
|
||||
return cy.get('body')
|
||||
.if()
|
||||
.then(() => handleModal(cy.get('body')))
|
||||
.else()
|
||||
// Handle if inside a cy.within
|
||||
.root().closest('body')
|
||||
.then(($body) => handleModal(cy.wrap($body)))
|
||||
}
|
||||
|
||||
/**
|
||||
* Open the unified search modal
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue