diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2023-06-29 15:33:36 +0200 |
---|---|---|
committer | Christopher Ng <chrng8@gmail.com> | 2023-06-30 11:38:11 -0700 |
commit | 97683a5b6657521d651d9c7e463951c1cf6ff51d (patch) | |
tree | f1046063ae94f5dc4a706ef374a0b13f9c69d55c /cypress/support | |
parent | d76f39889a9cdf04c69d765c4440b53a8a173100 (diff) | |
download | nextcloud-server-97683a5b6657521d651d9c7e463951c1cf6ff51d.tar.gz nextcloud-server-97683a5b6657521d651d9c7e463951c1cf6ff51d.zip |
fix(settings): Migrate away from deprecated `NcPopoverMenu`
* Replace popover menu with `NcActions`
* Deduplicate user actions code between `UserRow` and `UserRowSimple`
* Fix user action to cover whole row heigh to prevent dropdown from shining through the actions
* Fix user action popover to be overlayed by current edited row actions
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'cypress/support')
-rw-r--r-- | cypress/support/commands.ts | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index 31e867a5caf..e48965822fa 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -34,6 +34,11 @@ declare global { namespace Cypress { interface Chainable<Subject = any> { /** + * Enable or disable a given user + */ + enableUser(user: User, enable?: boolean): Cypress.Chainable<Cypress.Response<any>>, + + /** * Upload a file from the fixtures folder to a given user storage. * **Warning**: Using this function will reset the previous session */ @@ -70,6 +75,33 @@ const url = (Cypress.config('baseUrl') || '').replace(/\/index.php\/?$/g, '') Cypress.env('baseUrl', url) /** + * Enable or disable a user + * TODO: standardise in @nextcloud/cypress + * + * @param {User} user the user to dis- / enable + * @param {boolean} enable True if the user should be enable, false to disable + */ +Cypress.Commands.add('enableUser', (user: User, enable = true) => { + const url = `${Cypress.config('baseUrl')}/ocs/v2.php/cloud/users/${user.userId}/${enable ? 'enable' : 'disable'}`.replace('index.php/', '') + return cy.request({ + method: 'PUT', + url, + form: true, + auth: { + user: 'admin', + password: 'admin', + }, + headers: { + 'OCS-ApiRequest': 'true', + 'Content-Type': 'application/x-www-form-urlencoded', + }, + }).then((response) => { + cy.log(`Enabled user ${user}`, response.status) + return cy.wrap(response) + }) +}) + +/** * cy.uploadedFile - uploads a file from the fixtures folder * TODO: standardise in @nextcloud/cypress * |