diff --git a/.drone.star b/.drone.star index ea5ef2a0cff..1ea76b9d7f9 100644 --- a/.drone.star +++ b/.drone.star @@ -125,7 +125,6 @@ config = { "webUISharingInternalUsers", "webUISharingInternalUsersBlacklisted", "webUISharingInternalUsersCollaborator", - "webUISharingExpirationDate", ], "oCISSharingInternal3": [ "webUISharingInternalGroupsSharingIndicator", @@ -221,7 +220,6 @@ basicTestSuites = [ "webUIResharing2", "webUISharingAcceptShares", "webUISharingAutocompletion", - "webUISharingExpirationDate", "webUISharingFilePermissionMultipleUsers", "webUISharingFilePermissionsGroups", "webUISharingFolderAdvancedPermissionMultipleUsers", diff --git a/tests/acceptance/expected-failures-with-ocis-server-ocis-storage.md b/tests/acceptance/expected-failures-with-ocis-server-ocis-storage.md index a398b12cbaa..56009112d7e 100644 --- a/tests/acceptance/expected-failures-with-ocis-server-ocis-storage.md +++ b/tests/acceptance/expected-failures-with-ocis-server-ocis-storage.md @@ -26,15 +26,8 @@ Other free text and markdown formatting can be used elsewhere in the document if ### [Share additional info](https://github.com/owncloud/ocis/issues/1253) - [webUISharingInternalUsersShareWithPage/shareWithUsers.feature:126](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingInternalUsersShareWithPage/shareWithUsers.feature#L126) -### [Expiration date set is not implemented in user share](https://github.com/owncloud/ocis/issues/1250) -- [webUISharingInternalGroups/shareWithGroups.feature:228](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingInternalGroups/shareWithGroups.feature#L228) - ### [Different path for shares inside folder](https://github.com/owncloud/ocis/issues/1231) -### [Implement expiration date for shares](https://github.com/owncloud/ocis/issues/1250) -- [webUISharingInternalGroups/shareWithGroups.feature:208](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingInternalGroups/shareWithGroups.feature#L208) -- [webUISharingExpirationDate/shareWithExpirationDate.feature:21](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingExpirationDate/shareWithExpirationDate.feature#L21) - ### [Listing shares via ocs API does not show path for parent folders](https://github.com/owncloud/ocis/issues/1231) - [webUISharingPublicManagement/shareByPublicLink.feature:110](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUISharingPublicManagement/shareByPublicLink.feature#L111) diff --git a/tests/acceptance/features/webUISharingExpirationDate/shareWithExpirationDate.feature b/tests/acceptance/features/webUISharingExpirationDate/shareWithExpirationDate.feature deleted file mode 100644 index dba9330ab31..00000000000 --- a/tests/acceptance/features/webUISharingExpirationDate/shareWithExpirationDate.feature +++ /dev/null @@ -1,26 +0,0 @@ -@smokeTest -Feature: Sharing files and folders with internal users with expiry date - As a user - I want to be able to set an expiry date on my shares - So that I don't have to remember to unshare - - Background: - Given these users have been created with default attributes and without skeleton files in the server: - | username | - | Alice | - | Brian | - - @notToImplementOnOCIS - Scenario: share a file with another internal user which should expire after 2 days - Given user "Alice" has uploaded file "testavatar.jpg" to "testimage.jpg" in the server - And user "Alice" has logged in using the webUI - When the user shares file "testimage.jpg" with user "Brian Murphy" which expires in "+2" days using the webUI - Then user "Brian" should have received a share with target "testimage.jpg" and expiration date in 2 days in the server - - @issue-4169 - Scenario: share a file with another internal user which should expire after 2 days with shares mounted in "Shares" - Given the administrator has set the default folder for received shares to "Shares" in the server - And user "Alice" has uploaded file "testavatar.jpg" to "testimage.jpg" in the server - And user "Alice" has logged in using the webUI - When the user shares file "testimage.jpg" with user "Brian Murphy" which expires in "+2" days using the webUI - Then user "Brian" should have received a share with target "Shares/testimage.jpg" and expiration date in 2 days in the server diff --git a/tests/acceptance/features/webUISharingInternalGroups/shareWithGroups.feature b/tests/acceptance/features/webUISharingInternalGroups/shareWithGroups.feature index 4d651ac3f77..57fa0dca08e 100644 --- a/tests/acceptance/features/webUISharingInternalGroups/shareWithGroups.feature +++ b/tests/acceptance/features/webUISharingInternalGroups/shareWithGroups.feature @@ -203,55 +203,3 @@ Feature: Sharing files and folders with internal groups Then the following resources should have the following collaborators | fileName | expectedCollaborators | | simple-folder | Brian Murphy, grp1 | - - @issue-ocis-1250 - Scenario: change existing expiration date of an existing share with another internal group - Given user "Carol" has created file "lorem.txt" in the server - And user "Carol" has created a new share with following settings in the server - | path | lorem.txt | - | shareTypeString | group | - | shareWith | grp1 | - | expireDate | +14 | - And user "Carol" has logged in using the webUI - When the user edits the collaborator expiry date of "grp1" of file "lorem.txt" to "+7" days using the webUI - Then user "Alice" should have received a share with target "Shares/lorem.txt" and expiration date in 7 days in the server - And user "Brian" should have received a share with target "Shares/lorem.txt" and expiration date in 7 days in the server - And user "Carol" should have a share with these details in the server: - | field | value | - | path | /lorem.txt | - | share_type | group | - | uid_owner | Carol | - | share_with | grp1 | - | expiration | +7 | - - @issue-ocis-1317 @issue-ocis-1250 - Scenario: share a resource with another internal group with default expiration date - Given the setting "shareapi_default_expire_date_group_share" of app "core" has been set to "yes" in the server - And the setting "shareapi_expire_after_n_days_group_share" of app "core" has been set to "42" in the server - And user "Carol" has created file "lorem.txt" in the server - And user "Carol" has logged in using the webUI - When the user shares folder "lorem.txt" with group "grp1" as "Viewer" using the webUI - Then user "Carol" should have a share with these details in the server: - | field | value | - | path | /lorem.txt | - | share_type | group | - | uid_owner | Carol | - | share_with | grp1 | - | expiration | +42 | - And user "Alice" should have received a share with target "Shares/lorem.txt" and expiration date in 42 days in the server - And user "Brian" should have received a share with target "Shares/lorem.txt" and expiration date in 42 days in the server - - @issue-ocis-1250 - Scenario Outline: share a resource with another internal group with expiration date beyond maximum enforced expiration date - Given the setting "shareapi_default_expire_date_group_share" of app "core" has been set to "yes" in the server - And the setting "shareapi_enforce_expire_date_group_share" of app "core" has been set to "yes" in the server - And the setting "shareapi_expire_after_n_days_group_share" of app "core" has been set to "5" in the server - And user "Carol" has created file "lorem.txt" in the server - And user "Carol" has created folder "simple-folder" in the server - And user "Carol" has logged in using the webUI - When the user tries to share resource "" with group "grp1" which expires in "+6" days using the webUI - Then user "Alice" should not have created any shares in the server - Examples: - | shared-resource | - | lorem.txt | - | simple-folder | diff --git a/tests/e2e/cucumber/features/smoke/reshare.feature b/tests/e2e/cucumber/features/smoke/reshare.feature index eb04b7b5e31..429fbeb9dda 100644 --- a/tests/e2e/cucumber/features/smoke/reshare.feature +++ b/tests/e2e/cucumber/features/smoke/reshare.feature @@ -20,13 +20,15 @@ Feature: reshare And "Alice" shares the following resource using API | resource | recipient | type | role | | folder_to_shared | Brian | user | Can edit | - + And "Brian" logs in And "Brian" opens the "files" app And "Brian" navigates to the shared with me page + + # re-share with expiration date And "Brian" reshares the following resource - | resource | recipient | type | role | resourceType | - | folder_to_shared | sales | group | Can view | folder | + | resource | recipient | type | role | resourceType | expirationDate | + | folder_to_shared | sales | group | Can view | folder | +5 days | And "Carol" logs in And "Carol" opens the "files" app diff --git a/tests/e2e/cucumber/features/smoke/share.feature b/tests/e2e/cucumber/features/smoke/share.feature index b681f50e835..7ebe0c1d298 100644 --- a/tests/e2e/cucumber/features/smoke/share.feature +++ b/tests/e2e/cucumber/features/smoke/share.feature @@ -93,7 +93,7 @@ Feature: share | testavatar.jpeg | Brian | user | Can view | file | | simple.pdf | Brian | user | custom_permissions:read,update,share | file | | sharedFile.txt | Brian | user | Can edit | file | - + 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" @@ -133,3 +133,39 @@ Feature: share | shareToBrian.txt | Alice Hansen | | shareToBrian.md | Alice Hansen | And "Brian" logs out + + + Scenario: share with expiration date + Given "Admin" creates following group using API + | id | + | sales | + And "Admin" adds user to the group using API + | user | group | + | Brian | sales | + And "Alice" logs in + And "Alice" creates the following folder in personal space using API + | name | + | myfolder | + | mainFolder | + And "Alice" creates the following files into personal space using API + | pathToFile | content | + | new.txt | some content | + And "Alice" opens the "files" app + When "Alice" shares the following resource using the sidebar panel + | resource | recipient | type | role | resourceType | expirationDate | + | new.txt | Brian | user | Can edit | file | +5 days | + | myfolder | sales | group | Can view | folder | +10 days | + | mainFolder | Brian | user | Can edit | folder | | + + # set expirationDate to existing share + And "Alice" sets the expiration date of share "mainFolder" of user "Brian" to "+5 days" + And "Alice" sets the expiration date of share "myfolder" of group "sales" to "+3 days" + 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 diff --git a/tests/e2e/cucumber/steps/ui/shares.ts b/tests/e2e/cucumber/steps/ui/shares.ts index fba77c10935..afc6663f49b 100644 --- a/tests/e2e/cucumber/steps/ui/shares.ts +++ b/tests/e2e/cucumber/steps/ui/shares.ts @@ -6,7 +6,7 @@ import { ICollaborator } from '../../../support/objects/app-files/share/collabor const parseShareTable = function (stepTable: DataTable, usersEnvironment) { return stepTable.hashes().reduce((acc, stepRow) => { - const { resource, recipient, type, role, resourceType } = stepRow + const { resource, recipient, type, role, resourceType, expirationDate } = stepRow if (!acc[resource]) { acc[resource] = [] @@ -19,7 +19,8 @@ const parseShareTable = function (stepTable: DataTable, usersEnvironment) { : usersEnvironment.getUser({ key: recipient }), role, type, - resourceType + resourceType, + expirationDate }) return acc @@ -279,3 +280,29 @@ When( } } ) + +When( + /^"([^"]*)" sets the expiration date of share "([^"]*)" of (group|user) "([^"]*)" to "([^"]*)"?$/, + async function ( + this: World, + stepUser: string, + resource: string, + collaboratorType: 'user' | 'group', + collaboratorName: string, + expirationDate: string + ): Promise { + const { page } = this.actorsEnvironment.getActor({ key: stepUser }) + const shareObject = new objects.applicationFiles.Share({ page }) + await shareObject.addExpirationDate({ + resource, + collaborator: { + collaborator: + collaboratorType === 'group' + ? this.usersEnvironment.getGroup({ key: collaboratorName }) + : this.usersEnvironment.getUser({ key: collaboratorName }), + type: collaboratorType + } as ICollaborator, + expirationDate + }) + } +) diff --git a/tests/e2e/support/objects/app-files/share/actions.ts b/tests/e2e/support/objects/app-files/share/actions.ts index fde3bb27825..4c2700e1121 100644 --- a/tests/e2e/support/objects/app-files/share/actions.ts +++ b/tests/e2e/support/objects/app-files/share/actions.ts @@ -25,11 +25,14 @@ const pendingShareItem = '//div[@id="files-shared-with-me-pending-section"]//tr[contains(@class,"oc-tbody-tr")]' const passwordInput = '.oc-modal-body input.oc-text-input' const createLinkButton = '.oc-modal-body-actions-confirm' +const showMoreOptionsButton = '#show-more-share-options-btn' +const calendarDatePickerId = 'recipient-datepicker-btn' export interface ShareArgs { page: Page resource: string recipients: ICollaborator[] + expirationDate?: string } export const openSharingPanel = async function ( @@ -67,9 +70,14 @@ export const createShare = async (args: createShareArgs): Promise => { if (via !== 'URL_NAVIGATION') { await openSharingPanel(page, resource, via) } + const expirationDate = recipients[0].expirationDate + if (expirationDate) { + await page.locator(showMoreOptionsButton).click() + await page.getByTestId(calendarDatePickerId).click() + await Collaborator.setExpirationDate(page, expirationDate) + } await Collaborator.inviteCollaborators({ page, collaborators: recipients }) - await sidebar.close({ page }) } @@ -249,3 +257,21 @@ export const setDenyShare = async (args: setDenyShareArgs): Promise => { await openSharingPanel(page, resource) await Collaborator.setDenyShareForCollaborator({ page, deny, collaborator }) } + +export const addExpirationDate = async (args: { + page: Page + resource: string + collaborator: Omit + expirationDate: string +}): Promise => { + const { page, resource, collaborator, expirationDate } = args + await openSharingPanel(page, resource) + + await Promise.all([ + page.waitForResponse( + (resp) => + resp.url().includes('shares') && resp.status() === 200 && resp.request().method() === 'PUT' + ), + Collaborator.setExpirationDateForCollaborator({ page, collaborator, expirationDate }) + ]) +} diff --git a/tests/e2e/support/objects/app-files/share/collaborator.ts b/tests/e2e/support/objects/app-files/share/collaborator.ts index 38fa6aac809..1f90b322cc1 100644 --- a/tests/e2e/support/objects/app-files/share/collaborator.ts +++ b/tests/e2e/support/objects/app-files/share/collaborator.ts @@ -9,6 +9,7 @@ export interface ICollaborator { role?: string type?: CollaboratorType resourceType?: string + expirationDate?: string } export interface InviteCollaboratorsArgs { @@ -311,6 +312,10 @@ export default class Collaborator { .locator(util.format(Collaborator.setExpirationDateCollaboratorButton, collaboratorRow)) .click() + await Collaborator.setExpirationDate(page, expirationDate) + } + + static async setExpirationDate(page: Page, expirationDate: any): Promise { const newExpiryDate = getActualExpiryDate( expirationDate.toLowerCase().match(/[dayrmonthwek]+/)[0], expirationDate diff --git a/tests/e2e/support/objects/app-files/share/index.ts b/tests/e2e/support/objects/app-files/share/index.ts index bd5241f91f3..0e4152dbb0c 100644 --- a/tests/e2e/support/objects/app-files/share/index.ts +++ b/tests/e2e/support/objects/app-files/share/index.ts @@ -2,6 +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' export class Share { #page: Page @@ -71,4 +72,18 @@ export class Share { await po.setDenyShare({ ...args, page: this.#page }) await this.#page.goto(startUrl) } + + async addExpirationDate({ + resource, + collaborator, + expirationDate + }: { + resource: string + collaborator: Omit + expirationDate: string + }): Promise { + const startUrl = this.#page.url() + await po.addExpirationDate({ resource, collaborator, expirationDate, page: this.#page }) + await this.#page.goto(startUrl) + } }