Skip to content

Commit 28c94de

Browse files
committed
test: refactor group existance function to be more specific for id
1 parent 96ccf6c commit 28c94de

File tree

6 files changed

+14
-15
lines changed

6 files changed

+14
-15
lines changed

tests/e2e-playwright/specs/admin-settings/groups.spec.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { ActorsEnvironment, UsersEnvironment } from '../../../e2e/support/enviro
44
import { setAccessAndRefreshToken } from '../../helpers/setAccessAndRefreshToken'
55
import * as ui from '../../steps/ui/index'
66
import * as api from '../../steps/api/api'
7-
import { objects } from '../../../e2e/support'
87

98
test.describe('groups management', () => {
109
let actorsEnvironment
@@ -46,7 +45,7 @@ test.describe('groups management', () => {
4645
await ui.checkGroupsPresenceById({
4746
actorsEnvironment,
4847
stepUser: 'Admin',
49-
groupIds: ['sales', 'security']
48+
expectedGroupIds: ['sales', 'security']
5049
})
5150
).toBeTruthy()
5251
})
@@ -69,7 +68,7 @@ test.describe('groups management', () => {
6968
await ui.checkGroupsPresenceById({
7069
actorsEnvironment,
7170
stepUser: 'Admin',
72-
groupIds: ['sales']
71+
expectedGroupIds: ['sales']
7372
})
7473
).toBeFalsy()
7574

@@ -84,7 +83,7 @@ test.describe('groups management', () => {
8483
await ui.checkGroupsPresenceById({
8584
actorsEnvironment,
8685
stepUser: 'Admin',
87-
groupIds: ['security', 'finance']
86+
expectedGroupIds: ['security', 'finance']
8887
})
8988
).toBeFalsy()
9089
})

tests/e2e-playwright/steps/api/api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import { ResourceType } from '../../../e2e/support/api/share/share'
99
import { Group, Space, User } from '../../../e2e/support/types'
1010
import fs from 'fs'
1111
import { integer } from 'vscode-languageserver-types'
12-
import { join } from 'path/win32'
13-
import { checkResponseStatus, request } from '../../../e2e/support/api/http.js'
12+
import join from 'join-path'
13+
import { checkResponseStatus, request } from '../../../e2e/support/api/http'
1414

1515
export async function userHasBeenCreated({
1616
usersEnvironment,

tests/e2e-playwright/steps/ui/adminSettings.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,17 @@ export async function createGroups({
7373
export async function checkGroupsPresenceById({
7474
actorsEnvironment,
7575
stepUser,
76-
groupIds
76+
expectedGroupIds
7777
}: {
7878
actorsEnvironment: ActorsEnvironment
7979
stepUser: string
80-
groupIds: string[]
80+
expectedGroupIds: string[]
8181
}): Promise<boolean> {
8282
const { page } = actorsEnvironment.getActor({ key: stepUser })
8383
const groupsObject = new objects.applicationAdminSettings.Groups({ page })
84-
const groups = await groupsObject.getDisplayedGroups()
85-
for (const group of groupIds) {
86-
if (!groups.includes(groupsObject.getUUID({ key: group }))) {
84+
const actualGroupsIds = await groupsObject.getDisplayedGroupsIds()
85+
for (const group of expectedGroupIds) {
86+
if (!actualGroupsIds.includes(groupsObject.getUUID({ key: group }))) {
8787
return false
8888
}
8989
}

tests/e2e/cucumber/steps/ui/adminSettings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ Then(
415415
): Promise<void> {
416416
const { page } = this.actorsEnvironment.getActor({ key: stepUser })
417417
const groupsObject = new objects.applicationAdminSettings.Groups({ page })
418-
const groups = await groupsObject.getDisplayedGroups()
418+
const groups = await groupsObject.getDisplayedGroupsIds()
419419

420420
for (const { group } of stepTable.hashes()) {
421421
switch (action) {

tests/e2e/support/objects/app-admin-settings/groups/actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const createGroup = async (args: { page: Page; key: string }) => {
4646
return await response.json()
4747
}
4848

49-
export const getDisplayedGroups = async (args: { page: Page }): Promise<string[]> => {
49+
export const getDisplayedGroupsIds = async (args: { page: Page }): Promise<string[]> => {
5050
const { page } = args
5151
const groups = []
5252
const result = page.locator(groupTrSelector)

tests/e2e/support/objects/app-admin-settings/groups/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ export class Groups {
2626
})
2727
}
2828

29-
getDisplayedGroups(): Promise<string[]> {
30-
return po.getDisplayedGroups({ page: this.#page })
29+
getDisplayedGroupsIds(): Promise<string[]> {
30+
return po.getDisplayedGroupsIds({ page: this.#page })
3131
}
3232

3333
async getGroupsDisplayName(): Promise<string> {

0 commit comments

Comments
 (0)