Skip to content

Commit

Permalink
restoring the getUUID function
Browse files Browse the repository at this point in the history
  • Loading branch information
nabim777 committed Jun 19, 2024
1 parent de57e0b commit 34e272e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 17 deletions.
8 changes: 4 additions & 4 deletions tests/e2e/cucumber/steps/ui/adminSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,10 @@ Then(
for (const { user } of stepTable.hashes()) {
switch (action) {
case 'should':
expect(users).toContain(this.usersEnvironment.getCreatedUser({ key: user }).uuid)
expect(users).toContain(usersObject.getUUID({ key: user }))
break
case 'should not':
expect(users).not.toContain(this.usersEnvironment.getCreatedUser({ key: user }).uuid)
expect(users).not.toContain(usersObject.getUUID({ key: user }))
break
default:
throw new Error(`'${action}' not implemented`)
Expand Down Expand Up @@ -263,7 +263,7 @@ When(
const userIds = []

for (const { user } of stepTable.hashes()) {
userIds.push(this.usersEnvironment.getCreatedUser({ key: user }).uuid)
userIds.push(usersObject.getUUID({ key: user }))
await usersObject.select({ key: user })
}

Expand Down Expand Up @@ -347,7 +347,7 @@ When(
switch (actionType) {
case 'batch actions':
for (const { id: user } of stepTable.hashes()) {
userIds.push(this.usersEnvironment.getCreatedUser({ key: user }).uuid)
userIds.push(usersObject.getUUID({ key: user }))
await usersObject.selectUser({ key: user })
}
await usersObject.deleteUserUsingBatchAction({ userIds })
Expand Down
3 changes: 1 addition & 2 deletions tests/e2e/support/api/keycloak/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ export const createUser = async ({ user, admin }: { user: User; admin: User }):
user: { ...user, uuid: keycloakUUID, role: defaultNewUserRole }
})

// initialize user on Ocis web
// need login to have the user created by keycloak appear on Ocis web
// login to initialize the user in oCIS Web
await initializeUser(user.id)

// store oCIS user information
Expand Down
26 changes: 15 additions & 11 deletions tests/e2e/support/objects/app-admin-settings/users/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@ export class Users {
this.#page = page
}

getUUID({ key }: { key: string }): string {
return this.#usersEnvironment.getCreatedUser({ key }).uuid
}

async allowLogin({ key, action }: { key: string; action: string }): Promise<void> {
const uuid = this.#usersEnvironment.getCreatedUser({ key }).uuid
const uuid = this.getUUID({ key })
await po.openEditPanel({ page: this.#page, uuid, action })
await po.changeAccountEnabled({ uuid, value: true, page: this.#page })
}
async forbidLogin({ key, action }: { key: string; action: string }): Promise<void> {
const uuid = this.#usersEnvironment.getCreatedUser({ key }).uuid
const uuid = this.getUUID({ key })
await po.openEditPanel({ page: this.#page, uuid, action })
await po.changeAccountEnabled({ uuid, value: false, page: this.#page })
}
Expand All @@ -29,13 +33,13 @@ export class Users {
value: string
action: string
}): Promise<void> {
const uuid = this.#usersEnvironment.getCreatedUser({ key }).uuid
const uuid = this.getUUID({ key })
await po.openEditPanel({ page: this.#page, uuid, action })
await po.changeQuota({ uuid, value, page: this.#page })
}

async selectUser({ key }: { key: string }): Promise<void> {
const uuid = this.#usersEnvironment.getCreatedUser({ key }).uuid
const uuid = this.getUUID({ key })
await po.selectUser({ page: this.#page, uuid })
}
async changeQuotaUsingBatchAction({
Expand All @@ -47,7 +51,7 @@ export class Users {
}): Promise<void> {
const userIds = []
for (const user of users) {
userIds.push(this.#usersEnvironment.getCreatedUser({ key: user }).uuid)
userIds.push(this.getUUID({ key: user }))
}
await po.changeQuotaUsingBatchAction({ page: this.#page, value, userIds })
}
Expand All @@ -57,7 +61,7 @@ export class Users {
async select({ key }: { key: string }): Promise<void> {
await po.selectUser({
page: this.#page,
uuid: this.#usersEnvironment.getCreatedUser({ key }).uuid
uuid: this.getUUID({ key })
})
}
async addToGroupsBatchAtion({
Expand Down Expand Up @@ -92,7 +96,7 @@ export class Users {
value: string
action: string
}): Promise<void> {
const uuid = this.#usersEnvironment.getCreatedUser({ key }).uuid
const uuid = this.getUUID({ key })

await po.openEditPanel({ page: this.#page, uuid, action })
await po.changeUser({ uuid, attribute: attribute, value: value, page: this.#page })
Expand All @@ -115,7 +119,7 @@ export class Users {
groups: string[]
action: string
}): Promise<void> {
const uuid = this.#usersEnvironment.getCreatedUser({ key }).uuid
const uuid = this.getUUID({ key })
await po.openEditPanel({ page: this.#page, uuid, action })
await po.addUserToGroups({ page: this.#page, userId: uuid, groups })
}
Expand All @@ -128,14 +132,14 @@ export class Users {
groups: string[]
action: string
}): Promise<void> {
const uuid = this.#usersEnvironment.getCreatedUser({ key }).uuid
const uuid = this.getUUID({ key })
await po.openEditPanel({ page: this.#page, uuid, action })
await po.removeUserFromGroups({ page: this.#page, userId: uuid, groups })
}
async deleteUserUsingContextMenu({ key }: { key: string }): Promise<void> {
await po.deleteUserUsingContextMenu({
page: this.#page,
uuid: this.#usersEnvironment.getCreatedUser({ key }).uuid
uuid: this.getUUID({ key })
})
}
async deleteUserUsingBatchAction({ userIds }: { userIds: string[] }): Promise<void> {
Expand Down Expand Up @@ -169,7 +173,7 @@ export class Users {
async openEditPanel({ key, action }: { key: string; action: string }): Promise<void> {
await po.openEditPanel({
page: this.#page,
uuid: this.#usersEnvironment.getCreatedUser({ key }).uuid,
uuid: this.getUUID({ key }),
action
})
}
Expand Down

0 comments on commit 34e272e

Please sign in to comment.