diff --git a/tests/e2e/support/api/graph/userManagement.ts b/tests/e2e/support/api/graph/userManagement.ts index b9af1cd5fd6..eda28946976 100644 --- a/tests/e2e/support/api/graph/userManagement.ts +++ b/tests/e2e/support/api/graph/userManagement.ts @@ -85,7 +85,7 @@ export const createGroup = async ({ checkResponseStatus(response, 'Failed while creating group') const usersEnvironment = new UsersEnvironment() - usersEnvironment.storeGroup({ group: { ...group, uuid: (await response.json()).id } }) + usersEnvironment.storeCreatedGroup({ group: { ...group, uuid: (await response.json()).id } }) return group } diff --git a/tests/e2e/support/environment/userManagement.ts b/tests/e2e/support/environment/userManagement.ts index 113a7916b5b..639aa6c75ec 100644 --- a/tests/e2e/support/environment/userManagement.ts +++ b/tests/e2e/support/environment/userManagement.ts @@ -1,6 +1,5 @@ import { Group, User } from '../types' -import { dummyUserStore, dummyGroupStore } from '../store' -import { createdUserStore } from '../store/user' +import { dummyUserStore, dummyGroupStore, createdUserStore, createdGroupStore } from '../store' export class UsersEnvironment { getUser({ key }: { key: string }): User { @@ -65,38 +64,26 @@ export class UsersEnvironment { } getGroup({ key }: { key: string }): Group { - const uniqueKey = key.toLowerCase() + const groupKey = key.toLowerCase() - if (!dummyGroupStore.has(uniqueKey)) { - throw new Error(`group with key '${uniqueKey}' not found`) + if (!dummyGroupStore.has(groupKey)) { + throw new Error(`group with key '${groupKey}' not found`) } - return dummyGroupStore.get(uniqueKey) + return dummyGroupStore.get(groupKey) } getCreatedGroup({ key }: { key: string }): Group { - const uniqueKey = key.toLowerCase() + const groupKey = key.toLowerCase() - if (!createdGroupStore.has(uniqueKey)) { - throw new Error(`group with key '${uniqueKey}' not found`) + if (!createdGroupStore.has(groupKey)) { + throw new Error(`group with key '${groupKey}' not found`) } - console.log(createdGroupStore.get(uniqueKey)) - return createdGroupStore.get(uniqueKey) + console.log(createdGroupStore.get(groupKey)) + return createdGroupStore.get(groupKey) } - createGroup({ key, group }: { key: string; group: Group }): Group { - const uniqueKey = key.toLowerCase() - - if (dummyUserStore.has(uniqueKey)) { - throw new Error(`group with key '${uniqueKey}' already exists`) - } - - dummyGroupStore.set(uniqueKey, group) - - return group - } - - storeGroup({ group }: { group: Group }): Group { + storeCreatedGroup({ group }: { group: Group }): Group { if (createdGroupStore.has(group.id)) { throw new Error(`user with key '${group.id}' already exists`) } diff --git a/tests/e2e/support/objects/app-admin-settings/groups/index.ts b/tests/e2e/support/objects/app-admin-settings/groups/index.ts index 8b25bc1f80d..06aef42ffd7 100644 --- a/tests/e2e/support/objects/app-admin-settings/groups/index.ts +++ b/tests/e2e/support/objects/app-admin-settings/groups/index.ts @@ -25,7 +25,7 @@ export class Groups { async createGroup({ key }: { key: string }): Promise { const group = this.#usersEnvironment.getGroup({ key }) const response = await createGroup({ page: this.#page, key: group.displayName }) - this.#usersEnvironment.storeGroup({ + this.#usersEnvironment.storeCreatedGroup({ group: { id: key, uuid: response['id'], diff --git a/tests/e2e/support/store/index.ts b/tests/e2e/support/store/index.ts index bcb029f0883..bef99b9b139 100644 --- a/tests/e2e/support/store/index.ts +++ b/tests/e2e/support/store/index.ts @@ -1,6 +1,6 @@ export { actorStore } from './actor' export { createdLinkStore } from './link' export { createdSpaceStore } from './space' -export { dummyUserStore } from './user' -export { dummyGroupStore } from './group' +export { dummyUserStore, createdUserStore } from './user' +export { dummyGroupStore, createdGroupStore } from './group' export { userRoleStore } from './role'