Skip to content

Commit 469f4e6

Browse files
fix(tests): Update test to use built-in randomString utility
Replace crypto-random-string import with Nextcloud's built-in randomString utility to match the pattern used in other Cypress tests. Also add missing testIsolation flag and cleanup hook to follow test conventions used throughout the codebase. Signed-off-by: Nikolaus Demmel <[email protected]>
1 parent eb702dc commit 469f4e6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

cypress/e2e/settings/users_groups_display_name.cy.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,20 @@
99
* group names get hashed to create the group ID).
1010
*/
1111

12-
import { User } from '@nextcloud/cypress'
13-
import randomString from 'crypto-random-string'
12+
import { User } from '@nextcloud/e2e-test-server/cypress'
13+
import { randomString } from '../../support/utils/randomString.ts'
1414
import { getUserListRow, handlePasswordConfirmation, toggleEditButton } from './usersUtils.ts'
1515

1616
const admin = new User('admin', 'admin')
1717

18-
describe('Settings: Group names persist after reload (issue #55785)', () => {
18+
describe('Settings: Group names persist after reload (issue #55785)', { testIsolation: false }, () => {
1919
let testUser: User
2020
// Use a very long name to ensure Nextcloud hashes it to create the group ID.
2121
// This creates a test case where group ID !== group display name.
2222
const randomPart = randomString(80)
2323
const groupName = `Test Group with Very Long Name ${randomPart}`
2424

25+
after(() => cy.deleteUser(testUser))
2526
before(() => {
2627
cy.createRandomUser().then((user) => {
2728
testUser = user
@@ -31,8 +32,7 @@ describe('Settings: Group names persist after reload (issue #55785)', () => {
3132
// (this confirms our test case is valid)
3233
cy.runOccCommand('group:list --output=json').then((result) => {
3334
const groups = JSON.parse(result.stdout)
34-
const groupEntry = Object.entries(groups).find(([, displayName]) => (displayName as string).includes(randomPart),
35-
)
35+
const groupEntry = Object.entries(groups).find(([, displayName]) => (displayName as string).includes(randomPart))
3636
if (groupEntry) {
3737
const [groupId, displayName] = groupEntry
3838
cy.log(`Group ID: ${groupId}`)

0 commit comments

Comments
 (0)