mirror of
https://github.com/nextcloud/server.git
synced 2026-02-20 00:12:30 -05:00
chore(cypress): Move clearState from user utils to shared common utils
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
parent
bfc8b0bc15
commit
a7c88519f7
5 changed files with 22 additions and 20 deletions
|
|
@ -21,8 +21,7 @@
|
|||
*/
|
||||
|
||||
import { User } from '@nextcloud/cypress'
|
||||
import { clearState } from './usersUtils'
|
||||
import { getNextcloudUserMenu, getNextcloudUserMenuToggle } from '../../support/commonUtils'
|
||||
import { clearState, getNextcloudUserMenu, getNextcloudUserMenuToggle } from '../../support/commonUtils'
|
||||
|
||||
const admin = new User('admin', 'admin')
|
||||
|
||||
|
|
|
|||
|
|
@ -35,22 +35,6 @@ export function assertNotExistOrNotVisible(element: JQuery<HTMLElement>) {
|
|||
expect(doesNotExist || isNotVisible, 'does not exist or is not visible').to.be.true
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function ensure users and groups in this tests have a clean state
|
||||
*/
|
||||
export function clearState() {
|
||||
// cleanup ignoring any failures
|
||||
cy.runOccCommand('group:list --output=json').then(($result) => {
|
||||
const groups = Object.keys(JSON.parse($result.stdout)).filter((name) => name !== 'admin')
|
||||
groups.forEach((groupID) => cy.runOccCommand(`group:delete '${groupID}'`))
|
||||
})
|
||||
|
||||
cy.runOccCommand('user:list --output=json').then(($result) => {
|
||||
const users = Object.keys(JSON.parse($result.stdout)).filter((name) => name !== 'admin')
|
||||
users.forEach((userID) => cy.runOccCommand(`user:delete '${userID}'`))
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the settings users list
|
||||
* @return Cypress chainable object
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@
|
|||
*/
|
||||
|
||||
import { User } from '@nextcloud/cypress'
|
||||
import { clearState, getUserListRow } from './usersUtils'
|
||||
import { getUserListRow } from './usersUtils'
|
||||
import { clearState } from '../../support/commonUtils'
|
||||
|
||||
const admin = new User('admin', 'admin')
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@
|
|||
*/
|
||||
|
||||
import { User } from '@nextcloud/cypress'
|
||||
import { clearState, getUserListRow, handlePasswordConfirmation, toggleEditButton, waitLoading } from './usersUtils'
|
||||
import { getUserListRow, handlePasswordConfirmation, toggleEditButton, waitLoading } from './usersUtils'
|
||||
import { clearState } from '../../support/commonUtils'
|
||||
|
||||
const admin = new User('admin', 'admin')
|
||||
|
||||
|
|
|
|||
|
|
@ -18,3 +18,20 @@ export function getNextcloudUserMenu() {
|
|||
export function getNextcloudUserMenuToggle() {
|
||||
return getNextcloudUserMenu().find('.header-menu__trigger').should('have.length', 1)
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function ensure users and groups in this tests have a clean state
|
||||
* Deletes all users (except admin) and groups
|
||||
*/
|
||||
export function clearState() {
|
||||
// cleanup ignoring any failures
|
||||
cy.runOccCommand('group:list --output=json').then(($result) => {
|
||||
const groups = Object.keys(JSON.parse($result.stdout)).filter((name) => name !== 'admin')
|
||||
groups.forEach((groupID) => cy.runOccCommand(`group:delete '${groupID}'`))
|
||||
})
|
||||
|
||||
cy.runOccCommand('user:list --output=json').then(($result) => {
|
||||
const users = Object.keys(JSON.parse($result.stdout)).filter((name) => name !== 'admin')
|
||||
users.forEach((userID) => cy.runOccCommand(`user:delete '${userID}'`))
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue