Skip to content

Commit 4a57076

Browse files
committed
test: fix role names
1 parent 326e489 commit 4a57076

5 files changed

Lines changed: 30 additions & 218 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ test.describe('groups management', () => {
1919
stepUser: 'Admin',
2020
groupIds: ['sales', 'security']
2121
})
22-
await ui.checkGroupsPresenceById({
22+
await ui.userShouldSeeGroupIds({
2323
world,
2424
stepUser: 'Admin',
2525
expectedGroupIds: ['sales', 'security']

tests/e2e-playwright/specs/keycloak/groups.spec.ts

Lines changed: 26 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,9 @@
1-
import { expect } from '@playwright/test'
21
import { test } from '../../support/test'
3-
import { config } from '../../../e2e/config.js'
4-
import { ActorsEnvironment, UsersEnvironment } from '../../../e2e/support/environment/index.js'
5-
import { setAccessAndRefreshToken } from '../../helpers/setAccessAndRefreshToken.js'
62
import * as api from '../../steps/api/api.js'
73
import * as ui from '../../steps/ui/index'
84

95
// For synchronization-related details, see https://owncloud.dev/services/proxy/#claim-updates
106
test.describe('groups management', () => {
11-
let actorsEnvironment
12-
const usersEnvironment = new UsersEnvironment()
13-
14-
test.beforeEach(async ({ browser }) => {
15-
actorsEnvironment = new ActorsEnvironment({
16-
context: {
17-
acceptDownloads: config.acceptDownloads,
18-
reportDir: config.reportDir,
19-
tracingReportDir: config.tracingReportDir,
20-
reportHar: config.reportHar,
21-
reportTracing: config.reportTracing,
22-
reportVideo: config.reportVideo,
23-
failOnUncaughtConsoleError: config.failOnUncaughtConsoleError
24-
},
25-
browser: browser
26-
})
27-
28-
await setAccessAndRefreshToken(usersEnvironment)
29-
})
30-
317
test('keycloak group sync with oCIS', async ({ world }) => {
328
// Given "Admin" creates following user using API
339
// | id |
@@ -76,13 +52,11 @@ test.describe('groups management', () => {
7652
// | security |
7753
// | keycloak sales |
7854
// | keycloak finance |
79-
expect(
80-
await ui.checkGroupsPresenceById({
81-
world,
82-
stepUser: 'Admin',
83-
expectedGroupIds: ['security', 'keycloak sales', 'keycloak finance']
84-
})
85-
).toBeTruthy()
55+
await ui.userShouldSeeGroupIds({
56+
world,
57+
stepUser: 'Admin',
58+
expectedGroupIds: ['security', 'keycloak sales', 'keycloak finance']
59+
})
8660

8761
// When "Admin" navigates to the users management page
8862
await ui.userNavigatesToUserManagementPage({ world, stepUser: 'Admin' })
@@ -113,14 +87,14 @@ test.describe('groups management', () => {
11387
resource: 'shareToSales.txt',
11488
recipient: 'keycloak sales',
11589
type: 'group',
116-
role: 'Can edit without versions',
90+
role: 'Can edit with trashbin',
11791
resourceType: 'file'
11892
},
11993
{
12094
resource: 'shareToSecurity.txt',
12195
recipient: 'security',
12296
type: 'group',
123-
role: 'Can edit without versions',
97+
role: 'Can edit with trashbin',
12498
resourceType: 'file'
12599
}
126100
]
@@ -138,22 +112,26 @@ test.describe('groups management', () => {
138112
// When "Brian" opens the following file in texteditor
139113
// | resource |
140114
// | shareToSales.txt |
141-
await ui.userOpensFileInViewer({
115+
await ui.userOpensResourceInViewer({
142116
world,
143117
stepUser: 'Brian',
144118
resource: 'shareToSales.txt',
145-
actionType: 'texteditor'
119+
application: 'texteditor'
146120
})
147121
// And "Brian" closes the file viewer
148122
await ui.userClosesFileViewer({ world, stepUser: 'Brian' })
149123
// And "Brian" edits the following resources
150124
// | resource | content |
151125
// | shareToSecurity.txt | new content |
152-
await ui.userEditsFile({
126+
await ui.userEditsResources({
153127
world,
154128
stepUser: 'Brian',
155-
resource: 'shareToSecurity.txt',
156-
content: 'new content'
129+
resources: [
130+
{
131+
name: 'shareToSecurity.txt',
132+
content: 'new content'
133+
}
134+
]
157135
})
158136
// And "Brian" logs out
159137
await ui.userLogsOut({ world, stepUser: 'Brian' })
@@ -170,33 +148,32 @@ test.describe('groups management', () => {
170148
// Renaming a Keycloak group results in the creation of a new group on the oCIS server (see https://github.com/owncloud/ocis/issues/10445).
171149
// After renaming a group, it may take up to 5 minutes for the changes to sync, so avoid using the renamed group in the subsequent steps.
172150
// And "Admin" changes displayName to "a renamed group" for group "keycloak finance" using the sidebar panel
173-
await ui.userRenamesGroup({
151+
await ui.userChangesGroup({
174152
world,
175153
stepUser: 'Admin',
176154
attribute: 'displayName',
155+
key: 'keycloak finance',
177156
value: 'a renamed group',
178-
user: 'keycloak finance'
157+
action: 'context-menu'
179158
})
180159

181160
// When "Admin" deletes the following group using the context menu
182161
// | group |
183162
// | sales |
184-
await ui.userDeletesGroup({
163+
await ui.userDeletesGroups({
185164
world,
186165
stepUser: 'Admin',
187166
actionType: 'context menu',
188-
group: 'sales'
167+
groupsToBeDeleted: ['sales']
189168
})
190169
// Then "Admin" should not see the following group
191170
// | group |
192171
// | sales |
193-
expect(
194-
await ui.checkGroupsPresenceById({
195-
world,
196-
stepUser: 'Admin',
197-
expectedGroupIds: ['sales']
198-
})
199-
).toBeFalsy()
172+
await ui.userShouldNotSeeGroupIds({
173+
world,
174+
stepUser: 'Admin',
175+
expectedGroupIds: ['sales']
176+
})
200177
// And "Admin" logs out
201178
await ui.userLogsOut({ world, stepUser: 'Admin' })
202179
})

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

Lines changed: 3 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -69,24 +69,21 @@ export async function userCreatesGroups({
6969
}
7070
}
7171

72-
export async function checkGroupsPresenceById({
72+
export async function userShouldSeeGroupIds({
7373
world,
7474
stepUser,
7575
expectedGroupIds
7676
}: {
7777
world: World
7878
stepUser: string
7979
expectedGroupIds: string[]
80-
}): Promise<boolean> {
80+
}): Promise<void> {
8181
const { page } = world.actorsEnvironment.getActor({ key: stepUser })
8282
const groupsObject = new objects.applicationAdminSettings.Groups({ page })
8383
const actualGroupsIds = await groupsObject.getDisplayedGroupsIds()
8484
for (const group of expectedGroupIds) {
85-
if (!actualGroupsIds.includes(groupsObject.getUUID({ key: group }))) {
86-
return false
87-
}
85+
expect(actualGroupsIds).toContain(groupsObject.getUUID({ key: group }))
8886
}
89-
return true
9087
}
9188

9289
export async function userShouldNotSeeGroupIds({
@@ -220,59 +217,6 @@ export async function userAuthenticatesWithOTP({
220217
await generalObject.userAuthenticatesWithOTP({ deviceName })
221218
}
222219

223-
export async function userDeletesGroup({
224-
world,
225-
stepUser,
226-
actionType,
227-
group
228-
}: {
229-
world: World
230-
stepUser: string
231-
actionType: 'batch actions' | 'context menu'
232-
group: string
233-
}): Promise<void> {
234-
const { page } = world.actorsEnvironment.getActor({ key: stepUser })
235-
const groupsObject = new objects.applicationAdminSettings.Groups({ page })
236-
const groupIds = []
237-
238-
switch (actionType) {
239-
case 'batch actions':
240-
groupIds.push(groupsObject.getUUID({ key: group }))
241-
await groupsObject.selectGroup({ key: group })
242-
await groupsObject.deleteGroupUsingBatchAction({ groupIds })
243-
break
244-
case 'context menu':
245-
await groupsObject.deleteGroupUsingContextMenu({ key: group })
246-
break
247-
default:
248-
throw new Error(`'${actionType}' not implemented`)
249-
}
250-
}
251-
252-
export async function userRenamesGroup({
253-
world,
254-
stepUser,
255-
attribute,
256-
value,
257-
user
258-
}: {
259-
world: World
260-
stepUser: string
261-
attribute: string
262-
value: string
263-
user: string
264-
}): Promise<void> {
265-
const { page } = world.actorsEnvironment.getActor({ key: stepUser })
266-
const groupsObject = new objects.applicationAdminSettings.Groups({ page })
267-
268-
await groupsObject.changeGroup({
269-
key: user,
270-
attribute: attribute,
271-
value: value,
272-
action: 'context-menu'
273-
})
274-
}
275-
276220
export async function userAddsUserToGroup({
277221
world,
278222
stepUser,

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

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,45 +1492,3 @@ export async function userClicksTheTagOnResource({
14921492
const resourceObject = new objects.applicationFiles.Resource({ page })
14931493
await resourceObject.clickTag({ resource: resourceName, tag: tagName.trim().toLowerCase() })
14941494
}
1495-
1496-
export async function userOpensFileInViewer({
1497-
world,
1498-
stepUser,
1499-
resource,
1500-
actionType
1501-
}: {
1502-
world: World
1503-
stepUser: string
1504-
resource: string
1505-
actionType: 'mediaviewer' | 'pdfviewer' | 'texteditor' | 'Collabora' | 'OnlyOffice'
1506-
}): Promise<void> {
1507-
const { page } = world.actorsEnvironment.getActor({ key: stepUser })
1508-
const resourceObject = new objects.applicationFiles.Resource({ page })
1509-
await resourceObject.openFileInViewer({
1510-
name: resource,
1511-
actionType: actionType
1512-
})
1513-
}
1514-
1515-
export async function userEditsFile({
1516-
world,
1517-
stepUser,
1518-
resource,
1519-
content,
1520-
type
1521-
}: {
1522-
world: World
1523-
stepUser: string
1524-
resource: string
1525-
content: string
1526-
type?: string
1527-
}): Promise<void> {
1528-
const { page } = world.actorsEnvironment.getActor({ key: stepUser })
1529-
const resourceObject = new objects.applicationFiles.Resource({ page })
1530-
1531-
await resourceObject.editResource({
1532-
name: resource,
1533-
type: type,
1534-
content: content
1535-
})
1536-
}

tests/e2e/cucumber/features/keycloak/groups.feature

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)