Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ config = {
"cucumber/features/admin-settings/users.feature:106",
"cucumber/features/admin-settings/users.feature:131",
"cucumber/features/admin-settings/users.feature:185",
"cucumber/features/keycloak",
],
"extraServerEnvironment": {
"PROXY_AUTOPROVISION_ACCOUNTS": "true",
Expand Down Expand Up @@ -220,8 +219,8 @@ config = {
"keycloak": {
"earlyFail": True,
"skip": False,
"features": [
"specs/admin-settings/spaces.spec.ts",
"suites": [
"keycloak",
],
"extraServerEnvironment": {
"PROXY_AUTOPROVISION_ACCOUNTS": "true",
Expand Down
180 changes: 180 additions & 0 deletions tests/e2e-playwright/specs/keycloak/groups.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
import { test } from '../../support/test'
import * as api from '../../steps/api/api.js'
import * as ui from '../../steps/ui/index'

// For synchronization-related details, see https://owncloud.dev/services/proxy/#claim-updates
test.describe('groups management', () => {
test('keycloak group sync with oCIS', async ({ world }) => {
// Given "Admin" creates following user using API
// | id |
// | Alice |
// | Brian |
await api.usersHaveBeenCreated({
world,
stepUser: 'Admin',
users: ['Alice', 'Brian']
})

// And "Alice" creates the following files into personal space using API
// | pathToFile | content |
// | shareToSales.txt | Keycloak group share |
// | shareToSecurity.txt | Keycloak group share |
await api.userHasCreatedFiles({
world,
stepUser: 'Alice',
files: [
{ pathToFile: 'shareToSales.txt', content: 'Keycloak group share' },
{ pathToFile: 'shareToSecurity.txt', content: 'Keycloak group share' }
]
})

// When "Admin" logs in
await ui.userLogsIn({ world, stepUser: 'Admin' })

// And "Admin" opens the "admin-settings" app
await ui.userOpensApplication({ world, stepUser: 'Admin', name: 'admin-settings' })

// And "Admin" navigates to the groups management page
await ui.userNavigatesToGroupsManagementPage({ world, stepUser: 'Admin' })

// When "Admin" creates the following groups
// | id |
// | security |
// | sales |
await ui.userCreatesGroups({
world,
stepUser: 'Admin',
groupIds: ['security', 'sales']
})

// Then "Admin" should see the following group
// | group |
// | security |
// | keycloak sales |
// | keycloak finance |
await ui.userShouldSeeGroupIds({
world,
stepUser: 'Admin',
expectedGroupIds: ['security', 'keycloak sales', 'keycloak finance']
})

Comment thread
nirajacharya2 marked this conversation as resolved.
// When "Admin" navigates to the users management page
await ui.userNavigatesToUserManagementPage({ world, stepUser: 'Admin' })
// And "Admin" adds the user "Brian" to the groups "security,keycloak sales" using the sidebar panel
await ui.userAddsUserToGroup({
world,
stepUser: 'Admin',
action: 'adds',
groups: ['security', 'keycloak sales'],
user: 'Brian'
})

// And "Admin" logs out
await ui.userLogsOut({ world, stepUser: 'Admin' })
// And "Alice" logs in
await ui.userLogsIn({ world, stepUser: 'Alice' })

// And "Alice" shares the following resource using the sidebar panel
// | resource | recipient | type | role | resourceType |
// | shareToSales.txt | keycloak sales | group | Can edit without versions | file |
// | shareToSecurity.txt | security | group | Can edit without versions | file |
await ui.userSharesResources({
world,
stepUser: 'Alice',
actionType: 'SIDEBAR_PANEL',
shares: [
{
resource: 'shareToSales.txt',
recipient: 'keycloak sales',
type: 'group',
role: 'Can edit with trashbin',
resourceType: 'file'
},
{
resource: 'shareToSecurity.txt',
recipient: 'security',
type: 'group',
role: 'Can edit with trashbin',
resourceType: 'file'
}
]
})

// And "Alice" logs out
await ui.userLogsOut({ world, stepUser: 'Alice' })

// And "Brian" logs in
await ui.userLogsIn({ world, stepUser: 'Brian' })
// And "Brian" navigates to the shared with me page
await ui.userNavigatesToSharedWithMePage({ world, stepUser: 'Brian' })

// user should have access to unsynced shares
// When "Brian" opens the following file in texteditor
// | resource |
// | shareToSales.txt |
await ui.userOpensResourceInViewer({
world,
stepUser: 'Brian',
resource: 'shareToSales.txt',
application: 'texteditor'
})
// And "Brian" closes the file viewer
await ui.userClosesFileViewer({ world, stepUser: 'Brian' })
// And "Brian" edits the following resources
// | resource | content |
// | shareToSecurity.txt | new content |
await ui.userEditsResources({
world,
stepUser: 'Brian',
resources: [
{
name: 'shareToSecurity.txt',
content: 'new content'
}
]
})
// And "Brian" logs out
await ui.userLogsOut({ world, stepUser: 'Brian' })

// When "Admin" logs in
await ui.userLogsIn({ world, stepUser: 'Admin' })

// And "Admin" opens the "admin-settings" app
await ui.userOpensApplication({ world, stepUser: 'Admin', name: 'admin-settings' })

// And "Admin" navigates to the groups management page
await ui.userNavigatesToGroupsManagementPage({ world, stepUser: 'Admin' })

// Renaming a Keycloak group results in the creation of a new group on the oCIS server (see https://github.com/owncloud/ocis/issues/10445).
// 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.
// And "Admin" changes displayName to "a renamed group" for group "keycloak finance" using the sidebar panel
await ui.userChangesGroup({
world,
stepUser: 'Admin',
attribute: 'displayName',
key: 'keycloak finance',
value: 'a renamed group',
action: 'context-menu'
})

// When "Admin" deletes the following group using the context menu
// | group |
// | sales |
await ui.userDeletesGroups({
world,
stepUser: 'Admin',
actionType: 'context menu',
groupsToBeDeleted: ['sales']
})
// Then "Admin" should not see the following group
// | group |
// | sales |
await ui.userShouldNotSeeGroupIds({
world,
stepUser: 'Admin',
expectedGroupIds: ['sales']
})
// And "Admin" logs out
await ui.userLogsOut({ world, stepUser: 'Admin' })
})
})
37 changes: 36 additions & 1 deletion tests/e2e-playwright/steps/ui/adminSettings.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from '@playwright/test'
import { objects } from '../../../e2e/support'
import { World } from '../../support/world'
import { expect } from '@playwright/test'

export async function userNavigatesToGeneralManagementPage({
world,
Expand Down Expand Up @@ -202,3 +202,38 @@ export async function userChangesUserQuota({
const usersObject = new objects.applicationAdminSettings.Users({ page })
await usersObject.changeQuota({ key, value, action: 'context-menu' })
}

export async function userAddsUserToGroup({
world,
stepUser,
action,
groups,
user
}: {
world: World
stepUser: string
action: string
groups: string[]
user: string
}): Promise<void> {
const { page } = world.actorsEnvironment.getActor({ key: stepUser })
const usersObject = new objects.applicationAdminSettings.Users({ page })
switch (action) {
case 'adds':
await usersObject.addToGroups({
key: user,
groups,
action: 'context-menu'
})
break
case 'removes':
await usersObject.removeFromGroups({
key: user,
groups,
action: 'context-menu'
})
break
default:
throw new Error(`'${action}' not implemented`)
}
}
5 changes: 3 additions & 2 deletions tests/e2e-playwright/support/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,14 @@ export const test = base.extend<{
globalBeforeHook: [
async ({ world }: { world: World }, use, testInfo) => {
if (!config.basicAuth && !config.predefinedUsers) {
// let user = world.usersEnvironment.getUser({ key: config.keycloakAdminUser })
let user = world.usersEnvironment.getUser({ key: config.adminUsername })
if (config.keycloak) {
const user = world.usersEnvironment.getUser({ key: config.keycloakAdminUser })
user = world.usersEnvironment.getUser({ key: config.keycloakAdminUser })
await api.keycloak.setAccessTokenForKeycloakOcisUser(user)
await api.keycloak.setAccessTokenForKeycloakUser(user)
await storeKeycloakGroups(user, world.usersEnvironment)
} else {
const user = world.usersEnvironment.getUser({ key: config.adminUsername })
await api.token.setAccessAndRefreshToken(user)
if (isOcm(testInfo)) {
config.federatedServer = true
Expand Down
67 changes: 0 additions & 67 deletions tests/e2e/cucumber/features/keycloak/groups.feature

This file was deleted.

2 changes: 2 additions & 0 deletions tests/e2e/support/objects/a11y/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ export const selectors = {
logoWrapper: '.logo-wrapper',
fileAppBar: '#files-app-bar',
pageNotFound: '.page-not-found',
adminSettingsWrapper: '#admin-settings-wrapper',
adminSettingAppBar: '#admin-settings-app-bar',
createGroupInput: '#create-group-input-display-name',
actionConfirmButton: '.oc-modal-body-actions-confirm',
contextMenuContainer: '#oc-files-context-menu',
Expand Down
Loading