diff --git a/tests/e2e/cucumber/features/smoke/activity.feature b/tests/e2e/cucumber/features/smoke/activity.feature index 43b424453fd..7d6c9e396ec 100644 --- a/tests/e2e/cucumber/features/smoke/activity.feature +++ b/tests/e2e/cucumber/features/smoke/activity.feature @@ -10,31 +10,72 @@ Feature: Users can see all activities of the resources and spaces | Alice | Space Admin | Scenario: activity - When "Alice" creates the following project space using API + Given "Alice" creates the following project space using API | name | id | | team | team.1 | + And "Alice" adds the following members to the space "team" using API + | user | role | shareType | + | Brian | Can view | user | + And "Alice" creates a public link of the space using API + | space | name | password | + | team | space link | %public% | And "Alice" creates the following folder in personal space using API | name | | sharedFolder/subFolder | + And "Alice" uploads the following local file into personal space using API + | localFile | to | + | filesForUpload/textfile.txt | sharedFolder/textfile.txt | And "Alice" shares the following resource using API | resource | recipient | type | role | | sharedFolder | Brian | user | Can edit | + And "Alice" creates a public link of following resource using API + | resource | role | password | + | sharedFolder | Can edit | %public% | + + When "Anonymous" opens the public link "Unnamed link" + And "Anonymous" unlocks the public link with password "%public%" + And "Anonymous" edits the following resources + | resource | content | + | textfile.txt | new content | + Then "Anonymous" should not see any activity of the following resource + | resource | + | textfile.txt | + And "Alice" logs in + And "Alice" renames the following resource + | resource | as | + | sharedFolder/textfile.txt | new.txt | + And "Alice" deletes the following resource using the sidebar panel + | resource | from | + | subFolder | sharedFolder | Then "Alice" should see activity of the following resource - | resource | activity | - | sharedFolder | Alice Hansen shared sharedFolder with brian | + | resource | activity | + | sharedFolder | Alice Hansen deleted subFolder from sharedFolder | + | sharedFolder | Alice Hansen renamed textfile.txt to new.txt | + | sharedFolder | Public updated textfile.txt in sharedFolder | + | sharedFolder | Alice Hansen shared sharedFolder via link | + | sharedFolder | Alice Hansen shared sharedFolder with brian | + | sharedFolder | Alice Hansen added textfile.txt to sharedFolder | + | sharedFolder | Alice Hansen added subFolder to sharedFolder | + | sharedFolder | Alice Hansen added sharedFolder to Alice Hansen | + + | sharedFolder/new.txt | Alice Hansen renamed textfile.txt to new.txt | + | new.txt | Public updated textfile.txt in sharedFolder | + | new.txt | Alice Hansen added textfile.txt to sharedFolder | + And "Alice" logs out # see activity in the project space - And "Alice" navigates to the project space "team.1" - Then "Alice" should see activity of the space + When "Brian" logs in + And "Brian" navigates to the project space "team.1" + Then "Brian" should see activity of the space | activity | + |Alice Hansen shared team via link| + |Alice Hansen added brian as member of team| | Alice Hansen added readme.md to .space | - And "Alice" logs out # see activity in the shared resources - When "Brian" logs in - And "Brian" navigates to the shared with me page + When "Brian" navigates to the shared with me page Then "Brian" should not see any activity of the following resource - | resource | - | sharedFolder/subFolder | + | resource | + | sharedFolder/new.txt | And "Brian" logs out diff --git a/tests/e2e/cucumber/steps/api.ts b/tests/e2e/cucumber/steps/api.ts index 9ce84921583..5e2811a20b5 100644 --- a/tests/e2e/cucumber/steps/api.ts +++ b/tests/e2e/cucumber/steps/api.ts @@ -297,10 +297,26 @@ Given( user, path: info.resource, password: info.password, - name: 'Unnamed link', + name: info.name ? info.name : 'Unnamed link', role: info.role, spaceName: info.space }) } } ) + +Given( + '{string} creates a public link of the space using API', + async function (this: World, stepUser: string, stepTable: DataTable) { + const user = this.usersEnvironment.getUser({ key: stepUser }) + for (const info of stepTable.hashes()) { + await api.share.createSpaceLinkShare({ + user, + spaceName: info.space, + password: info.password, + name: info.name ? info.name : 'Unnamed link', + role: info.role + }) + } + } +) diff --git a/tests/e2e/support/api/share/index.ts b/tests/e2e/support/api/share/index.ts index d0d11a96822..7192e500399 100644 --- a/tests/e2e/support/api/share/index.ts +++ b/tests/e2e/support/api/share/index.ts @@ -1 +1,6 @@ -export { createShare, addMembersToTheProjectSpace, createLinkShare } from './share' +export { + createShare, + addMembersToTheProjectSpace, + createLinkShare, + createSpaceLinkShare +} from './share' diff --git a/tests/e2e/support/api/share/share.ts b/tests/e2e/support/api/share/share.ts index 945c27801fd..ee4c73f594d 100644 --- a/tests/e2e/support/api/share/share.ts +++ b/tests/e2e/support/api/share/share.ts @@ -253,3 +253,47 @@ export const createLinkShare = async ({ checkResponseStatus(response, 'Failed while creating public link share') } + +export const createSpaceLinkShare = async ({ + user, + spaceName, + password, + name, + role = 'Can view' +}: { + user: User + spaceName: string + password: string + name: string + role?: string +}): Promise => { + const driveId: string = await getSpaceIdBySpaceName({ + user, + spaceType: 'project', + spaceName + }) + + const roleType: string = linkShareRoles[role as keyof typeof linkShareRoles] + password = password === '%public%' ? securePassword : password + + const response = await request({ + method: 'POST', + path: join('graph', 'v1beta1', 'drives', driveId, 'root', 'createLink'), + body: JSON.stringify({ + type: roleType, + password, + displayName: name + }), + user + }) + + const responseData = (await response.json()) as { link: { webUrl: string } } + const webUrl = responseData.link.webUrl + const linksEnvironment: LinksEnvironment = new LinksEnvironment() + linksEnvironment.createLink({ + key: name, + link: { name: name, url: webUrl } + }) + + checkResponseStatus(response, 'Failed while creating public link space') +}