Skip to content

Commit

Permalink
Merge pull request #10535 from owncloud/port/pr-10427
Browse files Browse the repository at this point in the history
[tests-only][full-ci][backport] remove share access details tests and add e2e coverage (#10427)
  • Loading branch information
phil-davis authored Mar 5, 2024
2 parents df1fd7d + ae86617 commit b4bbc69
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 71 deletions.
48 changes: 26 additions & 22 deletions tests/acceptance/expected-failures-with-ocis-server-ocis-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,45 +8,49 @@ Level-3 headings should be used for the references to the relevant issues. Inclu

Other free text and markdown formatting can be used elsewhere in the document if needed. But if you want to explain something about the issue, then please post that in the issue itself.


### [Exit page re-appears in loop when logged in user is deleted](https://github.com/owncloud/web/issues/4677)
- [webUILogin/openidLogin.feature:50](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUILogin/openidLogin.feature#L50)
- [webUILogin/openidLogin.feature:60](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUILogin/openidLogin.feature#L60)

### [Share additional info](https://github.com/owncloud/ocis/issues/1253)
- [webUISharingInternalUsersShareWithPage/shareWithUsers.feature:115](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingInternalUsersShareWithPage/shareWithUsers.feature#L115)

### [Different path for shares inside folder](https://github.com/owncloud/ocis/issues/1231)
- [webUILogin/openidLogin.feature:50](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUILogin/openidLogin.feature#L50)
- [webUILogin/openidLogin.feature:60](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUILogin/openidLogin.feature#L60)

### [restoring a file deleted from a received shared folder is not possible](https://github.com/owncloud/ocis/issues/1124)
- [webUITrashbinRestore/trashbinRestore.feature:176](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUITrashbinRestore/trashbinRestore.feature#L176)

- [webUITrashbinRestore/trashbinRestore.feature:176](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUITrashbinRestore/trashbinRestore.feature#L176)

### [Deletion of a recursive folder from trashbin is not possible](https://github.com/owncloud/product/issues/188)
- [webUITrashbinDelete/trashbinDelete.feature:51](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUITrashbinDelete/trashbinDelete.feature#L51)
- [webUITrashbinDelete/trashbinDelete.feature:65](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUITrashbinDelete/trashbinDelete.feature#L65)

- [webUITrashbinDelete/trashbinDelete.feature:51](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUITrashbinDelete/trashbinDelete.feature#L51)
- [webUITrashbinDelete/trashbinDelete.feature:65](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUITrashbinDelete/trashbinDelete.feature#L65)

### [Saving public share is not possible](https://github.com/owncloud/web/issues/5321)
- [webUISharingPublicManagement/shareByPublicLink.feature:24](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingPublicManagement/shareByPublicLink.feature#L24)

- [webUISharingPublicManagement/shareByPublicLink.feature:24](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingPublicManagement/shareByPublicLink.feature#L24)

### [Uploading folders does not work in files-drop](https://github.com/owncloud/web/issues/2443)
- [webUISharingPublicDifferentRoles/shareByPublicLinkDifferentRoles.feature:263](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingPublicDifferentRoles/shareByPublicLinkDifferentRoles.feature#L263)

- [webUISharingPublicDifferentRoles/shareByPublicLinkDifferentRoles.feature:263](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingPublicDifferentRoles/shareByPublicLinkDifferentRoles.feature#L263)

### [Resources cannot be locked under ocis](https://github.com/owncloud/ocis/issues/1284)
- [webUIWebdavLockProtection/delete.feature:33](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIWebdavLockProtection/delete.feature#L33)
- [webUIWebdavLockProtection/delete.feature:34](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIWebdavLockProtection/delete.feature#L34)
- [webUIWebdavLockProtection/move.feature:36](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIWebdavLockProtection/move.feature#L36)
- [webUIWebdavLockProtection/move.feature:37](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIWebdavLockProtection/move.feature#L37)
- [webUIWebdavLockProtection/upload.feature:32](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIWebdavLockProtection/upload.feature#L32)

- [webUIWebdavLockProtection/delete.feature:33](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIWebdavLockProtection/delete.feature#L33)
- [webUIWebdavLockProtection/delete.feature:34](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIWebdavLockProtection/delete.feature#L34)
- [webUIWebdavLockProtection/move.feature:36](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIWebdavLockProtection/move.feature#L36)
- [webUIWebdavLockProtection/move.feature:37](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIWebdavLockProtection/move.feature#L37)
- [webUIWebdavLockProtection/upload.feature:32](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIWebdavLockProtection/upload.feature#L32)

### [Resources cannot be locked under ocis](https://github.com/owncloud/ocis/issues/1284)
- [webUIWebdavLockProtection/upload.feature:33](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIWebdavLockProtection/upload.feature#L33)

- [webUIWebdavLockProtection/upload.feature:33](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIWebdavLockProtection/upload.feature#L33)

### [Writing to locked files/folders give only a generic error message](https://github.com/owncloud/web/issues/5741)
- [webUIWebdavLockProtection/upload.feature:32](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIWebdavLockProtection/upload.feature#L32)
- [webUIWebdavLockProtection/upload.feature:33](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIWebdavLockProtection/upload.feature#L33)

- [webUIWebdavLockProtection/upload.feature:32](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIWebdavLockProtection/upload.feature#L32)
- [webUIWebdavLockProtection/upload.feature:33](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIWebdavLockProtection/upload.feature#L33)

### [empty subfolder inside a folder to be uploaded is not created on the server](https://github.com/owncloud/web/issues/6348)
- [webUIUpload/upload.feature:43](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIUpload/upload.feature#L43)

- [webUIUpload/upload.feature:43](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUIUpload/upload.feature#L43)

### [PROPFIND to sub-folder of a shared resources with same name gives 404](https://github.com/owncloud/ocis/issues/3859)
- [webUISharingAcceptShares/acceptShares.feature:73](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingAcceptShares/acceptShares.feature#L73)

- [webUISharingAcceptShares/acceptShares.feature:73](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingAcceptShares/acceptShares.feature#L73)
Original file line number Diff line number Diff line change
Expand Up @@ -102,28 +102,6 @@ Feature: Shares in share-with pages
And the user browses to the shared-with-me page in declined shares view
Then the unshared elements should be in declined state on the webUI

@issue-ocis-1328
Scenario Outline: collaborators list contains additional info when enabled
Given the setting "user_additional_info_field" of app "core" has been set to "<additional-info-field>" in the server
And user "Alice" has created folder "simple-folder" in the server
And user "Alice" has shared folder "simple-folder" with user "Brian" in the server
When user "Alice" has logged in using the webUI
And the user opens the share dialog for folder "simple-folder" using the webUI
Then user "Brian Murphy" should be listed with additional info "<additional-info-result>" in the collaborators list on the webUI
Examples:
| additional-info-field | additional-info-result |
| id | Brian |
| email | brian@example.org |

@issue-ocis-1328
Scenario: collaborators list does not contain additional info when disabled
Given the setting "user_additional_info_field" of app "core" has been set to "" in the server
And user "Alice" has created folder "simple-folder" in the server
And user "Alice" has shared folder "simple-folder" with user "Brian" in the server
When user "Alice" has logged in using the webUI
And the user opens the share dialog for folder "simple-folder" using the webUI
Then user "Brian Murphy" should be listed without additional info in the collaborators list on the webUI


Scenario: share a file with another internal user via collaborators quick action
Given user "Alice" has created folder "simple-folder" in the server
Expand Down
31 changes: 10 additions & 21 deletions tests/e2e/cucumber/features/smoke/shares/share.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ Feature: share
| Alice |
| Brian |
And "Brian" logs in
# disabling auto accepting to check accepting share
And "Brian" disables auto-accepting using API

Scenario: folder
Given "Alice" logs in
# disabling auto accepting to check accepting share
Given "Brian" disables auto-accepting using API
And "Alice" logs in
And "Alice" creates the following folder in personal space using API
| name |
| folder_to_shared |
Expand All @@ -37,7 +37,6 @@ Feature: share
When "Brian" accepts the following share from the context menu
| name |
| shared_folder |
And "Brian" creates quick link of the resource "shared_folder" with password "%public%" from the context menu
And "Brian" declines the following share from the context menu
| name |
| shared_folder |
Expand Down Expand Up @@ -96,18 +95,6 @@ Feature: share

And "Brian" opens the "files" app
And "Brian" navigates to the shared with me page
Then "Brian" should not see a sync status for the file "shareToBrian.txt"
When "Brian" accepts the following share
| name |
| shareToBrian.txt |
| shareToBrian.md |
| testavatar.jpeg |
| simple.pdf |
Then "Brian" should not see a sync status for the file "sharedFile.txt"
When "Brian" accepts the following share from the context menu
| name |
| sharedFile.txt |
And "Brian" creates quick link of the resource "sharedFile.txt" with password "%public%" from the context menu
And "Brian" declines the following share from the context menu
| name |
| sharedFile.txt |
Expand Down Expand Up @@ -159,13 +146,15 @@ Feature: share

# set expirationDate to existing share
And "Alice" sets the expiration date of share "mainFolder" of user "Brian" to "+5 days"
And "Alice" checks the following access details of share "mainFolder" for user "Brian"
| Name | Brian Murphy |
| Additional info | brian@example.org |
| Type | User |
And "Alice" sets the expiration date of share "myfolder" of group "sales" to "+3 days"
And "Alice" checks the following access details of share "myfolder" for group "sales"
| Name | sales department |
| Type | Group |
And "Alice" logs out

And "Brian" navigates to the shared with me page
And "Brian" accepts the following share
| name |
| new.txt |
| myfolder |
| mainFolder |
And "Brian" logs out
34 changes: 30 additions & 4 deletions tests/e2e/cucumber/steps/ui/shares.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,11 @@ When(
)

When(
/"([^"]*)" (should|should not) see a sync status for the (folder|file) "([^"]*)"?$/,
/"([^"]*)" (should|should not) see a sync status for the (?:folder|file) "([^"]*)"?$/,
async function (
this: World,
stepUser: string,
condition: string,
_: string,
resource: string
): Promise<void> {
const shouldSee = condition === 'should'
Expand Down Expand Up @@ -261,12 +260,11 @@ Then(
)

When(
/^"([^"]*)" (grants|denies) access to the following resources(s)? for (group|user) "([^"]*)" using the sidebar panel?$/,
/^"([^"]*)" (grants|denies) access to the following resources(?:s)? for (group|user) "([^"]*)" using the sidebar panel?$/,
async function (
this: World,
stepUser: string,
actionType: string,
_: unknown,
collaboratorType: 'user' | 'group',
collaborator: string,
stepTable: DataTable
Expand Down Expand Up @@ -315,3 +313,31 @@ When(
})
}
)

When(
/^"([^"]*)" checks the following access details of share "([^"]*)" for (user|group) "([^"]*)"$/,
async function (
this: World,
stepUser: string,
resource: string,
collaboratorType: string,
collaboratorName: string,
stepTable: DataTable
): Promise<void> {
const { page } = this.actorsEnvironment.getActor({ key: stepUser })
const shareObject = new objects.applicationFiles.Share({ page })
const expectedDetails = stepTable.rowsHash()
const actualDetails = await shareObject.getAccessDetails({
resource,
collaborator: {
collaborator:
collaboratorType === 'group'
? this.usersEnvironment.getGroup({ key: collaboratorName })
: this.usersEnvironment.getUser({ key: collaboratorName }),
type: collaboratorType
} as ICollaborator
})

expect(actualDetails).toMatchObject(expectedDetails)
}
)
13 changes: 12 additions & 1 deletion tests/e2e/support/objects/app-files/share/actions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Page, expect } from '@playwright/test'
import util from 'util'
import Collaborator, { ICollaborator } from './collaborator'
import Collaborator, { ICollaborator, IAccessDetails } from './collaborator'
import { sidebar } from '../utils'
import { clickResource } from '../resource/actions'
import { clearCurrentPopup, createLinkArgs } from '../link/actions'
Expand Down Expand Up @@ -275,3 +275,14 @@ export const addExpirationDate = async (args: {
Collaborator.setExpirationDateForCollaborator({ page, collaborator, expirationDate })
])
}

export const getAccessDetails = async (args: {
page: Page
resource: string
collaborator: Omit<ICollaborator, 'role'>
}): Promise<IAccessDetails> => {
const { page, resource, collaborator } = args
await openSharingPanel(page, resource)

return Collaborator.getAccessDetails(page, collaborator)
}
34 changes: 34 additions & 0 deletions tests/e2e/support/objects/app-files/share/collaborator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ export interface SetDenyShareForCollaboratorArgs extends Omit<CollaboratorArgs,
deny: boolean
}

export interface IAccessDetails {
Name?: string
'Additional info'?: string
Type?: string
'Access expires'?: string
'Shared on'?: string
'Invited by'?: string
}

export type CollaboratorType = 'user' | 'group'
export type CustomPermissionType = 'read' | 'update' | 'create' | 'delete' | 'share'

Expand Down Expand Up @@ -89,6 +98,8 @@ export default class Collaborator {
'%s//ul[contains(@class,"collaborator-edit-dropdown-options-list")]//button[contains(@class,"files-collaborators-expiration-button")]'
private static readonly removeExpirationDateCollaboratorButton =
'%s//ul[contains(@class,"collaborator-edit-dropdown-options-list")]//button[contains(@class,"remove-expiration-date")]'
private static readonly showAccessDetailsButton =
'%s//ul[contains(@class,"collaborator-edit-dropdown-options-list")]//button[contains(@class,"show-access-details")]'
private static readonly removeCollaboratorConfirmationButton = '.oc-modal-body-actions-confirm'
private static readonly customPermissionCheckbox = '//*[@id="files-collaborators-permission-%s"]'
private static readonly customPermissionApplyButton =
Expand Down Expand Up @@ -407,4 +418,27 @@ export default class Collaborator {
.click()
])
}

static async getAccessDetails(
page: Page,
recipient: Omit<ICollaborator, 'role'>
): Promise<IAccessDetails> {
const { collaborator, type } = recipient
const collaboratorRow = Collaborator.getCollaboratorUserOrGroupSelector(collaborator, type)
await page
.locator(util.format(Collaborator.collaboratorEditDropdownButton, collaboratorRow))
.click()
await page.locator(util.format(Collaborator.showAccessDetailsButton, collaboratorRow)).click()

return page.locator('.share-access-details-drop dl').evaluate((el) => {
const nodes = el.childNodes
const details = {}
nodes.forEach((node) => {
if (node.nodeName === 'DT') {
details[node.textContent] = node.nextSibling.textContent
}
})
return details
})
}
}
15 changes: 14 additions & 1 deletion tests/e2e/support/objects/app-files/share/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Page } from '@playwright/test'
import * as po from './actions'
import { resourceIsNotOpenable, isAcceptedSharePresent, resourceIsSynced } from './utils'
import { createLinkArgs } from '../link/actions'
import { ICollaborator } from './collaborator'
import { ICollaborator, IAccessDetails } from './collaborator'
export class Share {
#page: Page

Expand Down Expand Up @@ -86,4 +86,17 @@ export class Share {
await po.addExpirationDate({ resource, collaborator, expirationDate, page: this.#page })
await this.#page.goto(startUrl)
}

async getAccessDetails({
resource,
collaborator
}: {
resource: string
collaborator: Omit<ICollaborator, 'role'>
}): Promise<IAccessDetails> {
const startUrl = this.#page.url()
const accessDetails = await po.getAccessDetails({ resource, collaborator, page: this.#page })
await this.#page.goto(startUrl)
return accessDetails
}
}

0 comments on commit b4bbc69

Please sign in to comment.