Skip to content

Commit

Permalink
Add step for removing manager
Browse files Browse the repository at this point in the history
  • Loading branch information
SwikritiT committed Sep 13, 2022
1 parent 229f3bb commit 0ea2efb
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,6 @@ Feature: spaces participant management
When "Alice" changes the roles of the following users in the project space
| user | role |
| Carol | manager |
And "Alice" as project manager removes their own access to project the space
Then "Alice" should not be able to see space "team.1"
And "Alice" logs out
12 changes: 12 additions & 0 deletions tests/e2e/cucumber/steps/app-files/page/spaces/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,15 @@ When(
}
}
)

When(
'{string} as project manager removes their own access to the project space',
async function (this: World, stepUser: any): Promise<void> {
const { page } = this.actorsEnvironment.getActor({ key: stepUser })
const spacesObject = new objects.applicationFiles.Spaces({ page })
await spacesObject.removeAccessToMember({
users: [this.usersEnvironment.getUser({ key: stepUser })],
removeOwnSpaceAccess: true
})
}
)
6 changes: 5 additions & 1 deletion tests/e2e/support/objects/app-files/share/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,11 @@ export interface removeShareeArgs {
page: Page
folder?: string
users: User[]
removeOwnSpaceAccess?: boolean
}

export const removeSharee = async (args: removeShareeArgs): Promise<void> => {
const { page, folder, users } = args
const { page, folder, users, removeOwnSpaceAccess } = args
if (folder) {
const folderPaths = folder.split('/')
const folderName = folderPaths.pop()
Expand All @@ -209,5 +210,8 @@ export const removeSharee = async (args: removeShareeArgs): Promise<void> => {
page.locator(util.format(removeShareButton, userColumn)).click(),
page.locator(removeShareConfirmationButton).click()
])
if (removeOwnSpaceAccess) {
await page.waitForNavigation()
}
}
}
5 changes: 3 additions & 2 deletions tests/e2e/support/objects/app-files/spaces/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,13 @@ export const changeSpaceImage = async (args: {
export interface removeAccessMembersArgs {
users: User[]
page: Page
removeOwnSpaceAccess?: boolean
}
export const removeAccessSpaceMembers = async (args: removeAccessMembersArgs): Promise<void> => {
const { page, users } = args
const { page, users, removeOwnSpaceAccess } = args
await sidebar.open({ page: page })
await sidebar.openPanel({ page: page, name: 'space-share' })
await removeSharee({ page, users })
await removeSharee({ page, users, removeOwnSpaceAccess: removeOwnSpaceAccess })
}

export interface changeSpaceRoleArgs {
Expand Down

0 comments on commit 0ea2efb

Please sign in to comment.