Skip to content
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

[test-only ]expand Activity test #11772

Merged
merged 2 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 51 additions & 10 deletions tests/e2e/cucumber/features/smoke/activity.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 17 additions & 1 deletion tests/e2e/cucumber/steps/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
}
}
)
7 changes: 6 additions & 1 deletion tests/e2e/support/api/share/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
export { createShare, addMembersToTheProjectSpace, createLinkShare } from './share'
export {
createShare,
addMembersToTheProjectSpace,
createLinkShare,
createSpaceLinkShare
} from './share'
44 changes: 44 additions & 0 deletions tests/e2e/support/api/share/share.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> => {
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')
}