Skip to content

Commit 648009b

Browse files
committed
test: fix role names
1 parent 03537ca commit 648009b

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({
@@ -206,59 +203,6 @@ export async function userChangesUserQuota({
206203
await usersObject.changeQuota({ key, value, action: 'context-menu' })
207204
}
208205

209-
export async function userDeletesGroup({
210-
world,
211-
stepUser,
212-
actionType,
213-
group
214-
}: {
215-
world: World
216-
stepUser: string
217-
actionType: 'batch actions' | 'context menu'
218-
group: string
219-
}): Promise<void> {
220-
const { page } = world.actorsEnvironment.getActor({ key: stepUser })
221-
const groupsObject = new objects.applicationAdminSettings.Groups({ page })
222-
const groupIds = []
223-
224-
switch (actionType) {
225-
case 'batch actions':
226-
groupIds.push(groupsObject.getUUID({ key: group }))
227-
await groupsObject.selectGroup({ key: group })
228-
await groupsObject.deleteGroupUsingBatchAction({ groupIds })
229-
break
230-
case 'context menu':
231-
await groupsObject.deleteGroupUsingContextMenu({ key: group })
232-
break
233-
default:
234-
throw new Error(`'${actionType}' not implemented`)
235-
}
236-
}
237-
238-
export async function userRenamesGroup({
239-
world,
240-
stepUser,
241-
attribute,
242-
value,
243-
user
244-
}: {
245-
world: World
246-
stepUser: string
247-
attribute: string
248-
value: string
249-
user: string
250-
}): Promise<void> {
251-
const { page } = world.actorsEnvironment.getActor({ key: stepUser })
252-
const groupsObject = new objects.applicationAdminSettings.Groups({ page })
253-
254-
await groupsObject.changeGroup({
255-
key: user,
256-
attribute: attribute,
257-
value: value,
258-
action: 'context-menu'
259-
})
260-
}
261-
262206
export async function userAddsUserToGroup({
263207
world,
264208
stepUser,

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

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,45 +1371,3 @@ export async function userShouldNotSeeShareIndicatorOnResource({
13711371
})
13721372
await expect(shareIndicator).not.toBeVisible()
13731373
}
1374-
1375-
export async function userOpensFileInViewer({
1376-
world,
1377-
stepUser,
1378-
resource,
1379-
actionType
1380-
}: {
1381-
world: World
1382-
stepUser: string
1383-
resource: string
1384-
actionType: 'mediaviewer' | 'pdfviewer' | 'texteditor' | 'Collabora' | 'OnlyOffice'
1385-
}): Promise<void> {
1386-
const { page } = world.actorsEnvironment.getActor({ key: stepUser })
1387-
const resourceObject = new objects.applicationFiles.Resource({ page })
1388-
await resourceObject.openFileInViewer({
1389-
name: resource,
1390-
actionType: actionType
1391-
})
1392-
}
1393-
1394-
export async function userEditsFile({
1395-
world,
1396-
stepUser,
1397-
resource,
1398-
content,
1399-
type
1400-
}: {
1401-
world: World
1402-
stepUser: string
1403-
resource: string
1404-
content: string
1405-
type?: string
1406-
}): Promise<void> {
1407-
const { page } = world.actorsEnvironment.getActor({ key: stepUser })
1408-
const resourceObject = new objects.applicationFiles.Resource({ page })
1409-
1410-
await resourceObject.editResource({
1411-
name: resource,
1412-
type: type,
1413-
content: content
1414-
})
1415-
}

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

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

0 commit comments

Comments
 (0)