Skip to content

Commit

Permalink
federated user downloads shared resources
Browse files Browse the repository at this point in the history
  • Loading branch information
ScharfViktor committed Oct 25, 2024
1 parent 1d0674f commit bd246de
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 8 deletions.
48 changes: 43 additions & 5 deletions tests/e2e/cucumber/features/ocm/ocm.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@ Feature: federation management
And "Admin" creates following user using API
| id |
| Alice |
And "Alice" creates the following files into personal space using API
| pathToFile | content |
| example1.txt | example text |
And "Alice" creates the following folders in personal space using API
| name |
| folderPublic |
And "Alice" uploads the following local file into personal space using API
| localFile | to |
| filesForUpload/simple.pdf | folderPublic/simple.pdf |
| filesForUpload/testavatar.jpg | testavatar.jpg |
| filesForUpload/sampleGif.gif | sampleGif.gif |
And "Alice" logs in
And "Alice" opens the "open-cloud-mesh" app
When "Alice" generates invitation token for the federation share
And "Alice" logs out
And "Alice" generates invitation token for the federation share

Given using "FEDERATED" server
And "Admin" creates following user using API
| id |
Expand All @@ -26,4 +31,37 @@ Feature: federation management
Then "Brian" should see the following federated connections:
| user | email |
| Alice Hansen | alice@example.org |

Given using "LOCAL" server
When "Alice" reloads the page
Then "Alice" should see the following federated connections:
| user | email |
| Brian Murphy | brian@example.org |
And "Alice" opens the "files" app
And "Alice" shares the following resource using the sidebar panel
| resource | recipient | type | role | resourceType | shareType |
| folderPublic | Brian | user | Can edit | folder | external |
| sampleGif.gif | Brian | user | Can edit | file | external |
| testavatar.jpg | Brian | user | Can view | file | external |
And "Alice" logs out

Given using "FEDERATED" server
And "Brian" opens the "files" app
When "Brian" navigates to the shared with me page

# should be work after fixing https://github.com/owncloud/ocis/issues/10272
# Then "Brian" should see thumbnail and preview for file "testavatar.jpg"
# And "Brian" should see thumbnail and preview for file "sampleGif.gif"
# When "Brian" opens the following file in mediaviewer
# | resource |
# | testavatar.jpg |
# Then "Brian" is in a media-viewer
# And "Brian" navigates to the next media resource
# When "Brian" closes the file viewer

And "Brian" downloads the following resources using the batch action
| resource | type |
| folderPublic | folder |
| sampleGif.gif | file |
| testavatar.jpg | file |
And "Brian" logs out
5 changes: 3 additions & 2 deletions tests/e2e/cucumber/steps/ui/shares.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const parseShareTable = function (
usersEnvironment: environment.UsersEnvironment
) {
return stepTable.hashes().reduce<Record<string, ICollaborator[]>>((acc, stepRow) => {
const { resource, recipient, type, role, resourceType, expirationDate } = stepRow
const { resource, recipient, type, role, resourceType, expirationDate, shareType } = stepRow

if (!acc[resource]) {
acc[resource] = []
Expand All @@ -27,7 +27,8 @@ const parseShareTable = function (
role,
type: type as CollaboratorType,
resourceType,
expirationDate
expirationDate,
shareType
})

return acc
Expand Down
11 changes: 11 additions & 0 deletions tests/e2e/support/objects/app-files/share/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const showMoreOptionsButton = '#show-more-share-options-btn'
const calendarDatePickerId = 'recipient-datepicker-btn'
const informMessage = '//div[contains(@class,"oc-notification-message-title")]'
const showMoreBtn = '.toggle-shares-list-btn:has-text("Show more")'
const userTypeFilter = '.invite-form-share-role-type'
const userTypeSelector = '.invite-form-share-role-type-item'

export interface ShareArgs {
page: Page
Expand Down Expand Up @@ -71,6 +73,7 @@ export const createShare = async (args: createShareArgs): Promise<void> => {
await openSharingPanel(page, resource, via)
}
const expirationDate = recipients[0].expirationDate
await page.pause()

if (expirationDate) {
await page.locator(showMoreOptionsButton).click()
Expand All @@ -80,6 +83,14 @@ export const createShare = async (args: createShareArgs): Promise<void> => {
])
await Collaborator.setExpirationDate(page, expirationDate)
}
const federatedShare = recipients[0].shareType
if (federatedShare) {
await Promise.all([
locatorUtils.waitForEvent(page.locator(invitePanel), 'transitionend'),
page.locator(userTypeFilter).click()
])
await page.locator(userTypeSelector).filter({ hasText: federatedShare }).click()
}
await Collaborator.inviteCollaborators({ page, collaborators: recipients })
await sidebar.close({ page })
}
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/support/objects/app-files/share/collaborator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface ICollaborator {
type?: CollaboratorType
resourceType?: string
expirationDate?: string
shareType?: string
}

export interface InviteCollaboratorsArgs {
Expand Down Expand Up @@ -98,7 +99,7 @@ export default class Collaborator {
const collaboratorInputLocator = page.locator(Collaborator.inviteInput)
await collaboratorInputLocator.click()
await Promise.all([
page.waitForResponse((resp) => resp.url().includes('groups') && resp.status() === 200),
page.waitForResponse((resp) => resp.url().includes('users') && resp.status() === 200),
collaboratorInputLocator.fill(collaborator.id)
])
await collaboratorInputLocator.focus()
Expand Down

0 comments on commit bd246de

Please sign in to comment.