diff --git a/tests/e2e/cucumber/features/smoke/app-provider/officeSuites.feature b/tests/e2e/cucumber/features/smoke/app-provider/officeSuites.feature index de0658087e1..c9eac15d084 100644 --- a/tests/e2e/cucumber/features/smoke/app-provider/officeSuites.feature +++ b/tests/e2e/cucumber/features/smoke/app-provider/officeSuites.feature @@ -16,8 +16,9 @@ Feature: Integrate with online office suites like Collabora and OnlyOffice When "Alice" creates the following resources | resource | type | content | | OpenDocument.odt | OpenDocument | OpenDocument Content | - And "Alice" creates a public link for the resource "OpenDocument.odt" with password "%public%" using the sidebar panel - And "Alice" edits the public link named "Link" of resource "OpenDocument.odt" changing role to "Can edit" + And "Alice" creates a public link creates a public link of following resource using the sidebar panel + | resource | role | password | + | OpenDocument.odt | Can edit | %public% | And "Alice" logs out And "Anonymous" opens the public link "Link" And "Anonymous" unlocks the public link with password "%public%" @@ -28,8 +29,9 @@ Feature: Integrate with online office suites like Collabora and OnlyOffice When "Alice" creates the following resources | resource | type | content | | MicrosoftWord.docx | Microsoft Word | Microsoft Word Content | - And "Alice" creates a public link for the resource "MicrosoftWord.docx" with password "%public%" using the sidebar panel - And "Alice" edits the public link named "Link" of resource "MicrosoftWord.docx" changing role to "Can edit" + And "Alice" creates a public link creates a public link of following resource using the sidebar panel + | resource | role | password | + | MicrosoftWord.docx | Can edit | %public% | And "Alice" logs out And "Anonymous" opens the public link "Link" And "Anonymous" unlocks the public link with password "%public%" diff --git a/tests/e2e/cucumber/features/smoke/internalLink.feature b/tests/e2e/cucumber/features/smoke/internalLink.feature index 901a191d297..c448bd751f3 100644 --- a/tests/e2e/cucumber/features/smoke/internalLink.feature +++ b/tests/e2e/cucumber/features/smoke/internalLink.feature @@ -14,7 +14,9 @@ Feature: internal link share | resource | recipient | type | role | | myfolder | Brian | user | Can edit | And "Alice" opens the "files" app - And "Alice" creates a public link for the resource "myfolder" with password "%public%" using the sidebar panel + And "Alice" creates a public link creates a public link of following resource using the sidebar panel + | resource | password | + | myfolder | %public% | When "Alice" edits the public link named "Link" of resource "myfolder" changing role to "Invited people" And "Brian" opens the public link "Link" And "Brian" logs in from the internal link diff --git a/tests/e2e/cucumber/features/smoke/languageChange.feature b/tests/e2e/cucumber/features/smoke/languageChange.feature index a47f211dd42..c38dac5f544 100644 --- a/tests/e2e/cucumber/features/smoke/languageChange.feature +++ b/tests/e2e/cucumber/features/smoke/languageChange.feature @@ -13,7 +13,6 @@ Feature: language settings And "Brian" creates the following folder in personal space using API | name | | check_message | - And "Brian" opens the "files" app And "Brian" shares the following resource using API | resource | recipient | type | role | | check_message | Alice | user | Can edit | @@ -29,19 +28,22 @@ Feature: language settings | Brian Murphy hat check_message mit Ihnen geteilt | And "Alice" logs out + Scenario: anonymous user language change When "Alice" logs in + And "Alice" creates the following folder in personal space using API + | name | + | folderPublic | + And "Alice" uploads the following local file into personal space using API + | localFile | to | + | filesForUpload/lorem.txt | lorem.txt | + And "Alice" opens the "files" app - And "Alice" creates the following resources - | resource | type | - | folderPublic | folder | - And "Alice" uploads the following resources - | resource | to | - | lorem.txt | folderPublic | - And "Alice" creates a public link for the resource "folderPublic" with password "%public%" using the sidebar panel - And "Alice" renames the most recently created public link of resource "folderPublic" to "myPublicLink" + And "Alice" creates a public link creates a public link of following resource using the sidebar panel + | resource | password | + | folderPublic | %public% | And "Alice" logs out - When "Anonymous" opens the public link "myPublicLink" + When "Anonymous" opens the public link "Link" And "Anonymous" unlocks the public link with password "%public%" And "Anonymous" opens the user menu And "Anonymous" changes the language to "Deutsch - German" diff --git a/tests/e2e/cucumber/features/smoke/link.feature b/tests/e2e/cucumber/features/smoke/link.feature index c4e7b76f1fd..28cbdd69e08 100644 --- a/tests/e2e/cucumber/features/smoke/link.feature +++ b/tests/e2e/cucumber/features/smoke/link.feature @@ -8,14 +8,17 @@ Feature: link Scenario: public link When "Alice" logs in + And "Alice" creates the following folders in personal space using API + | name | + | folderPublic | + And "Alice" creates the following files into personal space using API + | pathToFile | content | + | folderPublic/lorem.txt | lorem ipsum | + And "Alice" opens the "files" app - And "Alice" creates the following resources - | resource | type | - | folderPublic | folder | - And "Alice" uploads the following resources - | resource | to | - | lorem.txt | folderPublic | - And "Alice" creates a public link for the resource "folderPublic" with password "%public%" using the sidebar panel + And "Alice" creates a public link creates a public link of following resource using the sidebar panel + | resource | role | password | + | folderPublic | Secret File Drop | %public% | And "Alice" renames the most recently created public link of resource "folderPublic" to "myPublicLink" And "Alice" edits the public link named "myPublicLink" of resource "folderPublic" changing role to "Secret File Drop" And "Alice" sets the expiration date of the public link named "myPublicLink" of resource "folderPublic" to "+5 days" @@ -55,6 +58,7 @@ Feature: link And "Alice" creates the following files into personal space using API | pathToFile | content | | folderPublic/lorem.txt | lorem ipsum | + And "Alice" opens the "files" app When "Alice" creates quick link of the resource "folderPublic" with password "%public%" from the context menu And "Anonymous" opens the public link "Link" @@ -70,31 +74,43 @@ Feature: link | id | | Brian | And "Alice" logs in - And "Alice" creates the following resources - | resource | type | - | folderPublic | folder | - And "Alice" creates the following resources - | resource | type | content | - | folderPublic/shareToBrian.txt | txtFile | some text | - | folderPublic/shareToBrian.md | mdFile | readme | - And "Alice" uploads the following resources via drag-n-drop - | resource | - | simple.pdf | - | testavatar.jpg | - And "Alice" shares the following resources using the sidebar panel + And "Alice" creates the following folders in personal space using API + | name | + | folderPublic | + And "Alice" creates the following files into personal space using API + | pathToFile | content | + | folderPublic/shareToBrian.txt | some text | + | folderPublic/shareToBrian.md | readme | + And "Alice" uploads the following local file into personal space using API + | localFile | to | + | filesForUpload/simple.pdf | simple.pdf | + | filesForUpload/testavatar.jpg | testavatar.jpg | + And "Alice" shares the following resource using API | resource | recipient | type | role | | folderPublic | Brian | user | Can edit | | simple.pdf | Brian | user | Can edit | | testavatar.jpg | Brian | user | Can edit | - And "Alice" creates a public link for the resource "folderPublic" with password "%public%" using the sidebar panel + + And "Alice" opens the "files" app + And "Alice" creates a public link creates a public link of following resource using the sidebar panel + | resource | password | + | folderPublic | %public% | And "Alice" renames the most recently created public link of resource "folderPublic" to "folderLink" - And "Alice" creates a public link for the resource "folderPublic/shareToBrian.txt" with password "%public%" using the sidebar panel + And "Alice" creates a public link creates a public link of following resource using the sidebar panel + | resource | password | + | folderPublic/shareToBrian.txt | %public% | And "Alice" renames the most recently created public link of resource "folderPublic/shareToBrian.txt" to "textLink" - And "Alice" creates a public link for the resource "folderPublic/shareToBrian.md" with password "%public%" using the sidebar panel + And "Alice" creates a public link creates a public link of following resource using the sidebar panel + | resource | password | + | folderPublic/shareToBrian.md | %public% | And "Alice" renames the most recently created public link of resource "folderPublic/shareToBrian.md" to "markdownLink" - And "Alice" creates a public link for the resource "simple.pdf" with password "%public%" using the sidebar panel + And "Alice" creates a public link creates a public link of following resource using the sidebar panel + | resource | password | + | simple.pdf | %public% | And "Alice" renames the most recently created public link of resource "simple.pdf" to "pdfLink" - And "Alice" creates a public link for the resource "testavatar.jpg" with password "%public%" using the sidebar panel + And "Alice" creates a public link creates a public link of following resource using the sidebar panel + | resource | password | + | testavatar.jpg | %public% | And "Alice" renames the most recently created public link of resource "testavatar.jpg" to "imageLink" And "Alice" logs out And "Brian" logs in @@ -124,18 +140,21 @@ Feature: link Scenario: add banned password for public link When "Alice" logs in - And "Alice" uploads the following resources - | resource | - | lorem.txt | - And "Alice" creates a public link for the resource "lorem.txt" with password "%public%" using the sidebar panel - And "Alice" renames the most recently created public link of resource "lorem.txt" to "myPublicLink" - When "Alice" tries to sets a new password "ownCloud-1" of the public link named "myPublicLink" of resource "lorem.txt" + And "Alice" creates the following files into personal space using API + | pathToFile | content | + | lorem.txt | some text | + + And "Alice" opens the "files" app + And "Alice" creates a public link creates a public link of following resource using the sidebar panel + | resource | password | + | lorem.txt | %public% | + When "Alice" tries to sets a new password "ownCloud-1" of the public link named "Link" of resource "lorem.txt" Then "Alice" should see an error message """ Unfortunately, your password is commonly used. please pick a harder-to-guess password for your safety """ And "Alice" closes the public link password dialog box - When "Alice" tries to sets a new password "ownCloud-1" of the public link named "myPublicLink" of resource "lorem.txt" + When "Alice" tries to sets a new password "ownCloud-1" of the public link named "Link" of resource "lorem.txt" Then "Alice" should see an error message """ Unfortunately, your password is commonly used. please pick a harder-to-guess password for your safety @@ -145,7 +164,6 @@ Feature: link And "Alice" generates the password for the public link And "Alice" copies the password of the public link And "Alice" sets the password of the public link - And "Anonymous" opens the public link "myPublicLink" + And "Anonymous" opens the public link "Link" And "Anonymous" unlocks the public link with password "%copied_password%" And "Alice" logs out - \ No newline at end of file diff --git a/tests/e2e/cucumber/features/smoke/rename.feature b/tests/e2e/cucumber/features/smoke/rename.feature index 4cab79f2a6b..08df4db8378 100644 --- a/tests/e2e/cucumber/features/smoke/rename.feature +++ b/tests/e2e/cucumber/features/smoke/rename.feature @@ -19,9 +19,9 @@ Feature: rename And "Alice" shares the following resource using API | resource | recipient | type | role | | folder | Brian | user | Can edit | - And "Alice" creates a public link for the resource "folder" with password "%public%" using the sidebar panel - And "Alice" renames the most recently created public link of resource "folder" to "myPublicLink" - And "Alice" edits the public link named "myPublicLink" of resource "folder" changing role to "Can edit" + And "Alice" creates a public link creates a public link of following resource using the sidebar panel + | resource | role | password | + | folder | Can edit | %public% | And "Brian" logs in And "Brian" opens the "files" app And "Brian" navigates to the shared with me page @@ -34,7 +34,7 @@ Feature: rename And "Brian" logs out # rename in the public link - When "Anonymous" opens the public link "myPublicLink" + When "Anonymous" opens the public link "Link" And "Anonymous" unlocks the public link with password "%public%" When "Anonymous" renames the following resource | resource | as | diff --git a/tests/e2e/cucumber/features/smoke/shortcut.feature b/tests/e2e/cucumber/features/smoke/shortcut.feature index d9096c8cd43..aaba56b3da2 100644 --- a/tests/e2e/cucumber/features/smoke/shortcut.feature +++ b/tests/e2e/cucumber/features/smoke/shortcut.feature @@ -21,7 +21,9 @@ Feature: Users can create shortcuts for resources and sites | resource | recipient | type | role | | logo.jpg | Brian | user | Can view | And "Alice" opens the "files" app - And "Alice" creates a public link for the resource "docs/notice.txt" with password "%public%" using the sidebar panel + And "Alice" creates a public link creates a public link of following resource using the sidebar panel + | resource | password | + | docs/notice.txt | %public% | And "Alice" renames the most recently created public link of resource "docs/notice.txt" to "myPublicLink" And "Alice" opens the "files" app diff --git a/tests/e2e/cucumber/features/smoke/spaces/internalLink.feature b/tests/e2e/cucumber/features/smoke/spaces/internalLink.feature index fd87d5ef5f4..9a2aa5f7253 100644 --- a/tests/e2e/cucumber/features/smoke/spaces/internalLink.feature +++ b/tests/e2e/cucumber/features/smoke/spaces/internalLink.feature @@ -31,8 +31,10 @@ Feature: internal link share in project space And "Alice" renames the most recently created public link of space to "spaceLink" And "Alice" edits the public link named "spaceLink" of the space changing role to "Invited people" # internal link to folder - And "Alice" creates a public link for the resource "myfolder" with password "%public%" using the sidebar panel - When "Alice" edits the public link named "Link" of resource "myfolder" changing role to "Invited people" + And "Alice" creates a public link creates a public link of following resource using the sidebar panel + | resource | role | password | + | myfolder | Invited people | %public% | + # When "Alice" edits the public link named "Link" of resource "myfolder" changing role to "Invited people" And "Alice" logs out And "Brian" opens the public link "Link" diff --git a/tests/e2e/cucumber/features/smoke/spaces/participantManagement.feature b/tests/e2e/cucumber/features/smoke/spaces/participantManagement.feature index 5f839e3917a..90d0218e7d0 100644 --- a/tests/e2e/cucumber/features/smoke/spaces/participantManagement.feature +++ b/tests/e2e/cucumber/features/smoke/spaces/participantManagement.feature @@ -62,8 +62,9 @@ Feature: spaces participant management Then "Carol" should see folder "parent" but should not be able to edit # page reload is necessary to fetch all the changes made by user Brian When "Alice" reloads the spaces page - And "Alice" creates a public link for the resource "parent" with password "%public%" using the sidebar panel - And "Alice" edits the public link named "Link" of resource "parent" changing role to "Can edit" + And "Alice" creates a public link creates a public link of following resource using the sidebar panel + | resource | role | password | + | parent | Can edit | %public% | And "Anonymous" opens the public link "Link" And "Anonymous" unlocks the public link with password "%public%" And "Anonymous" uploads the following resources in public link page diff --git a/tests/e2e/cucumber/features/smoke/spaces/project.feature b/tests/e2e/cucumber/features/smoke/spaces/project.feature index b24b4363d74..50f75c66d0b 100644 --- a/tests/e2e/cucumber/features/smoke/spaces/project.feature +++ b/tests/e2e/cucumber/features/smoke/spaces/project.feature @@ -48,9 +48,10 @@ Feature: spaces.personal | lorem.txt | folderPublic | | lorem.txt | folder_to_shared | - And "Alice" creates a public link for the resource "folderPublic" with password "%public%" using the sidebar panel + And "Alice" creates a public link creates a public link of following resource using the sidebar panel + | resource | role | password | + | folderPublic | Secret File Drop | %public% | And "Alice" renames the most recently created public link of resource "folderPublic" to "team.1" - And "Alice" edits the public link named "team.1" of resource "folderPublic" changing role to "Secret File Drop" And "Alice" sets the expiration date of the public link named "team.1" of resource "folderPublic" to "+5 days" # borrowed from share.feature @@ -74,7 +75,9 @@ Feature: spaces.personal | resource | to | | lorem.txt | folderPublic | - And "Alice" creates a public link for the resource "folderPublic" with password "%public%" using the sidebar panel + And "Alice" creates a public link creates a public link of following resource using the sidebar panel + | resource | password | + | folderPublic | %public% | And "Alice" renames the most recently created public link of resource "folderPublic" to "team.2" And "Alice" edits the public link named "team.2" of resource "folderPublic" changing role to "Secret File Drop" And "Alice" sets the expiration date of the public link named "team.2" of resource "folderPublic" to "+5 days" @@ -168,5 +171,5 @@ Feature: spaces.personal | textfile.txt | parent | And "Brian" restores following resources | resource | to | version | openDetailsPanel | - | textfile.txt | parent | 1 |true | + | textfile.txt | parent | 1 | true | And "Brian" logs out diff --git a/tests/e2e/cucumber/features/smoke/spaces/publicLink.feature b/tests/e2e/cucumber/features/smoke/spaces/publicLink.feature index afdedd62138..05ad23bc70a 100644 --- a/tests/e2e/cucumber/features/smoke/spaces/publicLink.feature +++ b/tests/e2e/cucumber/features/smoke/spaces/publicLink.feature @@ -34,15 +34,25 @@ Feature: spaces public link | testavatar.jpg | And "Alice" creates a public link for the space with password "%public%" using the sidebar panel And "Alice" renames the most recently created public link of space to "spaceLink" - And "Alice" creates a public link for the resource "spaceFolder" with password "%public%" using the sidebar panel + And "Alice" creates a public link creates a public link of following resource using the sidebar panel + | resource | password | + | spaceFolder | %public% | And "Alice" renames the most recently created public link of resource "spaceFolder" to "folderLink" - And "Alice" creates a public link for the resource "spaceFolder/shareToBrian.txt" with password "%public%" using the sidebar panel + And "Alice" creates a public link creates a public link of following resource using the sidebar panel + | resource | password | + | spaceFolder/shareToBrian.txt | %public% | And "Alice" renames the most recently created public link of resource "spaceFolder/shareToBrian.txt" to "textLink" - And "Alice" creates a public link for the resource "spaceFolder/subFolder/shareToBrian.md" with password "%public%" using the sidebar panel + And "Alice" creates a public link creates a public link of following resource using the sidebar panel + | resource | password | + | spaceFolder/subFolder/shareToBrian.md | %public% | And "Alice" renames the most recently created public link of resource "spaceFolder/subFolder/shareToBrian.md" to "markdownLink" - And "Alice" creates a public link for the resource "simple.pdf" with password "%public%" using the sidebar panel + And "Alice" creates a public link creates a public link of following resource using the sidebar panel + | resource | password | + | simple.pdf | %public% | And "Alice" renames the most recently created public link of resource "simple.pdf" to "pdfLink" - And "Alice" creates a public link for the resource "testavatar.jpg" with password "%public%" using the sidebar panel + And "Alice" creates a public link creates a public link of following resource using the sidebar panel + | resource | password | + | testavatar.jpg | %public% | And "Alice" renames the most recently created public link of resource "testavatar.jpg" to "imageLink" And "Alice" logs out When "Brian" logs in diff --git a/tests/e2e/cucumber/steps/ui/links.ts b/tests/e2e/cucumber/steps/ui/links.ts index 4691f97c9ca..266443e8ab7 100644 --- a/tests/e2e/cucumber/steps/ui/links.ts +++ b/tests/e2e/cucumber/steps/ui/links.ts @@ -1,19 +1,22 @@ -import { Then, When } from '@cucumber/cucumber' +import { DataTable, Then, When } from '@cucumber/cucumber' import { expect } from '@playwright/test' import { World } from '../../environment' import { objects } from '../../../support' When( - '{string} creates a public link for the resource {string} with password {string} using the sidebar panel', - async function (this: World, stepUser: string, resource: string, password: string) { + '{string} creates a public link creates a public link of following resource using the sidebar panel', + async function (this: World, stepUser: string, stepTable: DataTable) { const { page } = this.actorsEnvironment.getActor({ key: stepUser }) const linkObject = new objects.applicationFiles.Link({ page }) - password = password === '%public%' ? linkObject.securePassword : password - await linkObject.create({ - resource, - name: 'Link', - password - }) + + for (const info of stepTable.hashes()) { + await linkObject.create({ + resource: info.resource, + role: info.role, + password: info.password === '%public%' ? linkObject.securePassword : info.password, + name: 'Link' + }) + } } ) diff --git a/tests/e2e/support/objects/app-files/link/actions.ts b/tests/e2e/support/objects/app-files/link/actions.ts index c1669e1091f..7a6ade90e9b 100644 --- a/tests/e2e/support/objects/app-files/link/actions.ts +++ b/tests/e2e/support/objects/app-files/link/actions.ts @@ -7,6 +7,7 @@ import { shareRoles } from '../share/collaborator' export interface createLinkArgs { page: Page + role?: string resource?: string name?: string space?: boolean @@ -97,6 +98,7 @@ const showOrHidePasswordButton = '.oc-text-input-show-password-toggle' const copyPasswordButton = '.oc-text-input-copy-password-button' const generatePasswordButton = '.oc-text-input-generate-password-button' const expectedRegexForGeneratedPassword = /^[A-Za-z0-9\s\S]{12}$/ +const passwordInputDescription = '.oc-text-input-description .oc-text-input-description' const getRecentLinkUrl = async (page: Page): Promise => { return await page.locator(publicLinkUrlList).first().textContent() @@ -107,7 +109,7 @@ const getRecentLinkName = async (page: Page): Promise => { } export const createLink = async (args: createLinkArgs): Promise => { - const { space, page, resource, password } = args + const { space, page, resource, password, role } = args if (!space) { const resourcePaths = resource.split('/') const resourceName = resourcePaths.pop() @@ -118,8 +120,25 @@ export const createLink = async (args: createLinkArgs): Promise => { await sidebar.openPanel({ page: page, name: 'sharing' }) } await page.locator(addPublicLinkButton).click() - await page.locator(editPublicLinkInput).fill(password) - setPassword(page) + if (role) { + await page.locator(util.format(publicLinkSetRoleButton, shareRoles[role])).click() + } + + role === 'Invited people' + ? await expect(page.locator(passwordInputDescription).first()).toHaveText( + 'Password cannot be set for internal links' + ) + : await page.locator(editPublicLinkInput).fill(password) + + await Promise.all([ + page.waitForResponse( + (res) => + res.url().includes('api/v1/shares') && + res.request().method() === 'POST' && + res.status() === 200 + ), + page.locator(editPublicLinkRenameConfirm).click() + ]) await clearCurrentPopup(page) return await getRecentLinkUrl(page) }