diff --git a/tests/e2e/cucumber/features/integrations/spaces/participantManagement.ocis.feature b/tests/e2e/cucumber/features/integrations/spaces/participantManagement.ocis.feature index 78b44499a5a..25b81689b85 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 the project 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 {