From 0ea2efb2dc026ae862566cbd9ccff610e66c3039 Mon Sep 17 00:00:00 2001 From: Swikriti Tripathi Date: Tue, 13 Sep 2022 11:34:45 +0545 Subject: [PATCH] Add step for removing manager --- .../spaces/participantManagement.ocis.feature | 2 ++ .../cucumber/steps/app-files/page/spaces/projects.ts | 12 ++++++++++++ tests/e2e/support/objects/app-files/share/actions.ts | 6 +++++- .../e2e/support/objects/app-files/spaces/actions.ts | 5 +++-- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/tests/e2e/cucumber/features/integrations/spaces/participantManagement.ocis.feature b/tests/e2e/cucumber/features/integrations/spaces/participantManagement.ocis.feature index 78b44499a5a..67ae82c2326 100644 --- a/tests/e2e/cucumber/features/integrations/spaces/participantManagement.ocis.feature +++ b/tests/e2e/cucumber/features/integrations/spaces/participantManagement.ocis.feature @@ -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 diff --git a/tests/e2e/cucumber/steps/app-files/page/spaces/projects.ts b/tests/e2e/cucumber/steps/app-files/page/spaces/projects.ts index 28443c07d23..0eb950c4721 100644 --- a/tests/e2e/cucumber/steps/app-files/page/spaces/projects.ts +++ b/tests/e2e/cucumber/steps/app-files/page/spaces/projects.ts @@ -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 { + 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 + }) + } +) diff --git a/tests/e2e/support/objects/app-files/share/actions.ts b/tests/e2e/support/objects/app-files/share/actions.ts index 41d8846e117..5a90a1ea6da 100644 --- a/tests/e2e/support/objects/app-files/share/actions.ts +++ b/tests/e2e/support/objects/app-files/share/actions.ts @@ -179,10 +179,11 @@ export interface removeShareeArgs { page: Page folder?: string users: User[] + removeOwnSpaceAccess?: boolean } export const removeSharee = async (args: removeShareeArgs): Promise => { - const { page, folder, users } = args + const { page, folder, users, removeOwnSpaceAccess } = args if (folder) { const folderPaths = folder.split('/') const folderName = folderPaths.pop() @@ -209,5 +210,8 @@ export const removeSharee = async (args: removeShareeArgs): Promise => { page.locator(util.format(removeShareButton, userColumn)).click(), page.locator(removeShareConfirmationButton).click() ]) + if (removeOwnSpaceAccess) { + await page.waitForNavigation() + } } } diff --git a/tests/e2e/support/objects/app-files/spaces/actions.ts b/tests/e2e/support/objects/app-files/spaces/actions.ts index 98e1f10f305..857d5abdff3 100644 --- a/tests/e2e/support/objects/app-files/spaces/actions.ts +++ b/tests/e2e/support/objects/app-files/spaces/actions.ts @@ -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 => { - 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 {