-
Notifications
You must be signed in to change notification settings - Fork 196
[full-ci][tests-only] test: convert admin-settings-spaces.feature to playwright #13488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
anon-pradip
wants to merge
6
commits into
master
Choose a base branch
from
test/e2e-playwright-admin-settings-spaces.feature
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9b6bb7c
test: convert admin-settings-spaces.feature to playwright
anon-pradip 0a08758
test: begin accessibility test for spaces.spec.ts
anon-pradip 166bd36
test: remove spaces.feature file
anon-pradip 428180b
test: refactor specs
anon-pradip 9c83746
test: use assertions inside functions
anon-pradip 136695f
test: fix naming for user creation function and array structure for u…
anon-pradip File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
334 changes: 334 additions & 0 deletions
334
tests/e2e-playwright/specs/admin-settings/spaces.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,334 @@ | ||
| import { test } from '@playwright/test' | ||
| import { config } from '../../../e2e/config.js' | ||
| import { | ||
| ActorsEnvironment, | ||
| SpacesEnvironment, | ||
| UsersEnvironment | ||
| } from '../../../e2e/support/environment' | ||
| import { createdSpaceStore } from '../../../e2e/support/store' | ||
| import { setAccessAndRefreshToken } from '../../helpers/setAccessAndRefreshToken' | ||
| import * as ui from '../../steps/ui/index' | ||
| import * as api from '../../steps/api/api' | ||
|
|
||
| test.describe('spaces management', () => { | ||
| let actorsEnvironment | ||
| let spacesEnvironment | ||
| const usersEnvironment = new UsersEnvironment() | ||
|
|
||
| test.beforeEach(async ({ browser }) => { | ||
| createdSpaceStore.clear() | ||
| spacesEnvironment = new SpacesEnvironment() | ||
| actorsEnvironment = new ActorsEnvironment({ | ||
| context: { | ||
| acceptDownloads: config.acceptDownloads, | ||
| reportDir: config.reportDir, | ||
| tracingReportDir: config.tracingReportDir, | ||
| reportHar: config.reportHar, | ||
| reportTracing: config.reportTracing, | ||
| reportVideo: config.reportVideo, | ||
| failOnUncaughtConsoleError: config.failOnUncaughtConsoleError | ||
| }, | ||
| browser: browser | ||
| }) | ||
|
|
||
| await setAccessAndRefreshToken(usersEnvironment) | ||
| await api.usersHaveBeenCreated({ usersEnvironment, stepUser: 'Admin', users: ['Alice'] }) | ||
| }) | ||
|
|
||
| test.afterEach(async () => { | ||
| await ui.logOutUser({ actorsEnvironment, stepUser: 'Alice' }) | ||
| await api.deleteUser({ usersEnvironment, stepUser: 'Admin', targetUser: 'Alice' }) | ||
| await api.userHasDeletedProjectSpace({ | ||
| usersEnvironment, | ||
| spacesEnvironment, | ||
| stepUser: 'Admin', | ||
| id: 'team.a', | ||
| name: 'team A' | ||
| }) | ||
| }) | ||
|
|
||
| test('spaces can be created', async () => { | ||
| await api.userHasAssignedRolesToUsers({ | ||
| usersEnvironment, | ||
| stepUser: 'Admin', | ||
| users: [{ id: 'Alice', role: 'Space Admin' }] | ||
| }) | ||
| await api.userHasCreatedProjectSpaces({ | ||
| usersEnvironment, | ||
| spacesEnvironment, | ||
| stepUser: 'Alice', | ||
| spaces: [{ name: 'team A', id: 'team.a' }] | ||
| }) | ||
| await ui.logInUser({ usersEnvironment, actorsEnvironment, stepUser: 'Alice' }) | ||
| await ui.userOpensApplication({ actorsEnvironment, stepUser: 'Alice', name: 'admin-settings' }) | ||
| await ui.userNavigatesToProjectSpaceManagementPage({ actorsEnvironment, stepUser: 'Alice' }) | ||
| await ui.userCreatesProjectSpaces({ | ||
| actorsEnvironment, | ||
| stepUser: 'Alice', | ||
| spaces: [{ name: 'team B', id: 'team.b' }] | ||
| }) | ||
| await ui.userShouldSeeSpaces({ | ||
| actorsEnvironment, | ||
| stepUser: 'Alice', | ||
| expectedSpaceIds: ['team.a', 'team.b'] | ||
| }) | ||
| await api.userHasDeletedProjectSpace({ | ||
| usersEnvironment, | ||
| spacesEnvironment, | ||
| stepUser: 'Admin', | ||
| name: 'team B', | ||
| id: 'team.b' | ||
| }) | ||
| }) | ||
|
|
||
| test('spaces can be managed in the admin settings via the context menu', async () => { | ||
| await api.usersHaveBeenCreated({ usersEnvironment, stepUser: 'Admin', users: ['Brian'] }) | ||
| await api.userHasAssignedRolesToUsers({ | ||
| usersEnvironment, | ||
| stepUser: 'Admin', | ||
| users: [ | ||
| { id: 'Alice', role: 'Space Admin' }, | ||
| { id: 'Brian', role: 'Space Admin' } | ||
| ] | ||
| }) | ||
anon-pradip marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| await api.userHasCreatedProjectSpaces({ | ||
| usersEnvironment, | ||
| spacesEnvironment, | ||
| stepUser: 'Alice', | ||
| spaces: [ | ||
| { name: 'team A', id: 'team.a' }, | ||
| { name: 'team B', id: 'team.b' } | ||
| ] | ||
| }) | ||
| await ui.logInUser({ usersEnvironment, actorsEnvironment, stepUser: 'Alice' }) | ||
| await ui.userOpensApplication({ actorsEnvironment, stepUser: 'Alice', name: 'admin-settings' }) | ||
| await ui.userNavigatesToProjectSpaceManagementPage({ actorsEnvironment, stepUser: 'Alice' }) | ||
| await ui.userUpdatesSpaceUsingContextMenu({ | ||
anon-pradip marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| actorsEnvironment, | ||
| stepUser: 'Alice', | ||
| spaceId: 'team.a', | ||
| updates: [ | ||
| { attribute: 'name', value: 'developer team' }, | ||
| { attribute: 'subtitle', value: 'developer team-subtitle' }, | ||
| { attribute: 'quota', value: '50' } | ||
| ] | ||
| }) | ||
| await ui.userDisablesSpaceUsingContextMenu({ | ||
| actorsEnvironment, | ||
| stepUser: 'Alice', | ||
| spaceId: 'team.a' | ||
| }) | ||
| await ui.userEnablesSpaceUsingContextMenu({ | ||
| actorsEnvironment, | ||
| stepUser: 'Alice', | ||
| spaceId: 'team.a' | ||
| }) | ||
| await ui.userShouldSeeSpaces({ | ||
| actorsEnvironment, | ||
| stepUser: 'Alice', | ||
| expectedSpaceIds: ['team.a'] | ||
| }) | ||
| await ui.logInUser({ usersEnvironment, actorsEnvironment, stepUser: 'Brian' }) | ||
| await ui.userOpensApplication({ actorsEnvironment, stepUser: 'Brian', name: 'admin-settings' }) | ||
| await ui.userNavigatesToProjectSpaceManagementPage({ actorsEnvironment, stepUser: 'Brian' }) | ||
| await ui.userDisablesSpaceUsingContextMenu({ | ||
| actorsEnvironment, | ||
| stepUser: 'Brian', | ||
| spaceId: 'team.b' | ||
| }) | ||
| await ui.userDeletesSpaceUsingContextMenu({ | ||
| actorsEnvironment, | ||
| stepUser: 'Brian', | ||
| spaceId: 'team.b' | ||
| }) | ||
| await ui.userShouldNotSeeSpaces({ | ||
| actorsEnvironment, | ||
| stepUser: 'Brian', | ||
| expectedSpaceIds: ['team.b'] | ||
| }) | ||
| await ui.logOutUser({ actorsEnvironment, stepUser: 'Brian' }) | ||
anon-pradip marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| await api.userHasDeletedProjectSpace({ | ||
| usersEnvironment, | ||
| spacesEnvironment, | ||
| stepUser: 'Admin', | ||
| id: 'team.b', | ||
| name: 'team B' | ||
| }) | ||
| await api.deleteUser({ usersEnvironment, stepUser: 'Admin', targetUser: 'Brian' }) | ||
| }) | ||
|
|
||
| test('multiple spaces can be managed at once in the admin settings via the batch actions', async () => { | ||
| await api.userHasAssignedRolesToUsers({ | ||
| usersEnvironment, | ||
| stepUser: 'Admin', | ||
| users: [{ id: 'Alice', role: 'Space Admin' }] | ||
| }) | ||
| await api.userHasCreatedProjectSpaces({ | ||
| usersEnvironment, | ||
| spacesEnvironment, | ||
| stepUser: 'Alice', | ||
| spaces: [ | ||
| { name: 'team A', id: 'team.a' }, | ||
| { name: 'team B', id: 'team.b' }, | ||
| { name: 'team C', id: 'team.c' }, | ||
| { name: 'team D', id: 'team.d' } | ||
| ] | ||
| }) | ||
| await ui.logInUser({ usersEnvironment, actorsEnvironment, stepUser: 'Alice' }) | ||
| await ui.userOpensApplication({ actorsEnvironment, stepUser: 'Alice', name: 'admin-settings' }) | ||
| await ui.userNavigatesToProjectSpaceManagementPage({ actorsEnvironment, stepUser: 'Alice' }) | ||
| await ui.userDisablesSpacesUsingBatchActions({ | ||
| actorsEnvironment, | ||
| stepUser: 'Alice', | ||
| spaceIds: ['team.a', 'team.b', 'team.c', 'team.d'] | ||
| }) | ||
| await ui.userEnablesSpacesUsingBatchActions({ | ||
| actorsEnvironment, | ||
| stepUser: 'Alice', | ||
| spaceIds: ['team.a', 'team.b', 'team.c', 'team.d'] | ||
| }) | ||
| await ui.userChangesSpaceQuotaUsingBatchActions({ | ||
| actorsEnvironment, | ||
| stepUser: 'Alice', | ||
| spaceIds: ['team.a', 'team.b', 'team.c', 'team.d'], | ||
| value: '50' | ||
| }) | ||
| await ui.userDisablesSpacesUsingBatchActions({ | ||
| actorsEnvironment, | ||
| stepUser: 'Alice', | ||
| spaceIds: ['team.a', 'team.b', 'team.c', 'team.d'] | ||
| }) | ||
| await ui.userDeletesSpacesUsingBatchActions({ | ||
| actorsEnvironment, | ||
| stepUser: 'Alice', | ||
| spaceIds: ['team.a', 'team.b', 'team.c', 'team.d'] | ||
| }) | ||
| await ui.userShouldNotSeeSpaces({ | ||
| actorsEnvironment, | ||
| stepUser: 'Alice', | ||
| expectedSpaceIds: ['team.a', 'team.b', 'team.c', 'team.d'] | ||
| }) | ||
| }) | ||
|
|
||
| test('list members via sidebar', async () => { | ||
| await api.usersHaveBeenCreated({ | ||
| usersEnvironment, | ||
| stepUser: 'Admin', | ||
| users: ['Brian', 'Carol', 'David', 'Edith'] | ||
| }) | ||
| await api.userHasAssignedRolesToUsers({ | ||
| usersEnvironment, | ||
| stepUser: 'Admin', | ||
| users: [{ id: 'Alice', role: 'Space Admin' }] | ||
| }) | ||
| await api.userHasCreatedProjectSpaces({ | ||
| usersEnvironment, | ||
| spacesEnvironment, | ||
| stepUser: 'Admin', | ||
| spaces: [{ name: 'team A', id: 'team.a' }] | ||
| }) | ||
| await api.userHasAddedMembersToSpace({ | ||
| usersEnvironment, | ||
| stepUser: 'Admin', | ||
| space: 'team A', | ||
| sharee: [ | ||
| { user: 'Brian', shareType: 'user', role: 'Can edit with versions and trashbin' }, | ||
| { user: 'Carol', shareType: 'user', role: 'Can view' }, | ||
| { user: 'David', shareType: 'user', role: 'Can view' }, | ||
| { user: 'Edith', shareType: 'user', role: 'Can view' } | ||
| ] | ||
| }) | ||
| await ui.logInUser({ usersEnvironment, actorsEnvironment, stepUser: 'Alice' }) | ||
| await ui.userOpensApplication({ actorsEnvironment, stepUser: 'Alice', name: 'admin-settings' }) | ||
| await ui.userNavigatesToProjectSpaceManagementPage({ actorsEnvironment, stepUser: 'Alice' }) | ||
| await ui.listMembersOfProjectSpaceUsingSidebarPanel({ | ||
| actorsEnvironment, | ||
| stepUser: 'Alice', | ||
| space: 'team.a' | ||
| }) | ||
| await ui.shouldSeeUsersInSidebarPanelOfSpacesAdminSettings({ | ||
| actorsEnvironment, | ||
| stepUser: 'Alice', | ||
| expectedMembers: [ | ||
| { user: 'Admin', role: 'Can manage' }, | ||
| { user: 'Brian', role: 'Can edit with versions and trashbin' }, | ||
| { user: 'Carol', role: 'Can view' }, | ||
| { user: 'David', role: 'Can view' }, | ||
| { user: 'Edith', role: 'Can view' } | ||
| ] | ||
| }) | ||
| await api.deleteUser({ usersEnvironment, stepUser: 'Admin', targetUser: 'Brian' }) | ||
| await api.deleteUser({ usersEnvironment, stepUser: 'Admin', targetUser: 'Carol' }) | ||
| await api.deleteUser({ usersEnvironment, stepUser: 'Admin', targetUser: 'David' }) | ||
| await api.deleteUser({ usersEnvironment, stepUser: 'Admin', targetUser: 'Edith' }) | ||
| }) | ||
|
|
||
| test('admin user can manage the spaces created by other space admin user', async () => { | ||
| await api.usersHaveBeenCreated({ usersEnvironment, stepUser: 'Admin', users: ['Brian'] }) | ||
| await api.usersHaveBeenCreated({ usersEnvironment, stepUser: 'Admin', users: ['Carol'] }) | ||
| await api.userHasAssignedRolesToUsers({ | ||
| usersEnvironment, | ||
| stepUser: 'Admin', | ||
| users: [ | ||
| { id: 'Alice', role: 'Admin' }, | ||
| { id: 'Brian', role: 'Space Admin' }, | ||
| { id: 'Carol', role: 'Space Admin' } | ||
| ] | ||
| }) | ||
| await api.userHasCreatedProjectSpaces({ | ||
| usersEnvironment, | ||
| spacesEnvironment, | ||
| stepUser: 'Brian', | ||
| spaces: [{ name: 'team A', id: 'team.a' }] | ||
| }) | ||
| await api.userHasCreatedProjectSpaces({ | ||
| usersEnvironment, | ||
| spacesEnvironment, | ||
| stepUser: 'Carol', | ||
| spaces: [{ name: 'team B', id: 'team.b' }] | ||
| }) | ||
| await ui.logInUser({ usersEnvironment, actorsEnvironment, stepUser: 'Alice' }) | ||
| await ui.userOpensApplication({ actorsEnvironment, stepUser: 'Alice', name: 'admin-settings' }) | ||
| await ui.userNavigatesToProjectSpaceManagementPage({ actorsEnvironment, stepUser: 'Alice' }) | ||
| await ui.userChangesSpaceQuotaUsingBatchActions({ | ||
| actorsEnvironment, | ||
| stepUser: 'Alice', | ||
| spaceIds: ['team.a', 'team.b'], | ||
| value: '50' | ||
| }) | ||
| await ui.userDisablesSpacesUsingBatchActions({ | ||
| actorsEnvironment, | ||
| stepUser: 'Alice', | ||
| spaceIds: ['team.a', 'team.b'] | ||
| }) | ||
| await ui.userEnablesSpacesUsingBatchActions({ | ||
| actorsEnvironment, | ||
| stepUser: 'Alice', | ||
| spaceIds: ['team.a', 'team.b'] | ||
| }) | ||
| await ui.userDisablesSpacesUsingBatchActions({ | ||
| actorsEnvironment, | ||
| stepUser: 'Alice', | ||
| spaceIds: ['team.a', 'team.b'] | ||
| }) | ||
| await ui.userDeletesSpacesUsingBatchActions({ | ||
| actorsEnvironment, | ||
| stepUser: 'Alice', | ||
| spaceIds: ['team.a', 'team.b'] | ||
| }) | ||
| await ui.userShouldNotSeeSpaces({ | ||
| actorsEnvironment, | ||
| stepUser: 'Alice', | ||
| expectedSpaceIds: ['team.a', 'team.b'] | ||
| }) | ||
| await api.userHasDeletedProjectSpace({ | ||
| usersEnvironment, | ||
| spacesEnvironment, | ||
| stepUser: 'Admin', | ||
| id: 'team.b', | ||
| name: 'team B' | ||
| }) | ||
| await api.deleteUser({ usersEnvironment, stepUser: 'Admin', targetUser: 'Brian' }) | ||
| await api.deleteUser({ usersEnvironment, stepUser: 'Admin', targetUser: 'Carol' }) | ||
| }) | ||
| }) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.