diff --git a/tests/e2e/cucumber/features/integrations/link.ocis.feature b/tests/e2e/cucumber/features/integrations/link.ocis.feature index 824d9f12145..ab03daffbcc 100644 --- a/tests/e2e/cucumber/features/integrations/link.ocis.feature +++ b/tests/e2e/cucumber/features/integrations/link.ocis.feature @@ -31,7 +31,7 @@ Feature: link #Then the public should not see the following files on the files-drop page # | textfile.txt | And "Anonymous" logs out - When "Alice" downloads the following files using the batch action + When "Alice" downloads the following resources using the batch action | resource | from | | lorem.txt | folderPublic | | textfile.txt | folderPublic | diff --git a/tests/e2e/cucumber/features/integrations/share.feature b/tests/e2e/cucumber/features/integrations/share.feature index 74a12aa43ce..487af8f361e 100644 --- a/tests/e2e/cucumber/features/integrations/share.feature +++ b/tests/e2e/cucumber/features/integrations/share.feature @@ -87,7 +87,7 @@ Feature: share And "Brian" copies the following resource | resource | to | | Shares/testavatar.jpeg | Personal | - And "Brian" downloads the following file using the sidebar panel + And "Brian" downloads the following resource using the sidebar panel | resource | from | | testavatar.jpeg | Shares | And "Alice" updates following sharee role diff --git a/tests/e2e/cucumber/features/journeys/kindergarten.feature b/tests/e2e/cucumber/features/journeys/kindergarten.feature index 303b09abcc1..6bb353ca2bb 100644 --- a/tests/e2e/cucumber/features/journeys/kindergarten.feature +++ b/tests/e2e/cucumber/features/journeys/kindergarten.feature @@ -47,7 +47,7 @@ Feature: Kindergarten can use web to organize a day | name | | meal plan | And "Brian" navigates to the personal space page - And "Brian" downloads the following files using the sidebar panel + And "Brian" downloads the following resources using the sidebar panel | resource | from | | data.zip | Shares/meal plan | # Then what do we check for to be confident that the above things done by Brian have worked? @@ -59,7 +59,7 @@ Feature: Kindergarten can use web to organize a day | name | | meal plan | And "Carol" navigates to the personal space page - And "Carol" downloads the following files using the sidebar panel + And "Carol" downloads the following resources using the sidebar panel | resource | from | | data.zip | Shares/meal plan | | lorem.txt | Shares/meal plan | @@ -67,14 +67,14 @@ Feature: Kindergarten can use web to organize a day # Then what do we check for to be confident that the above things done by Carol have worked? # Then the downloaded files should have content "abc..." And "Carol" logs out - When "Brian" downloads the following files using the sidebar panel + When "Brian" downloads the following resources using the sidebar panel | resource | from | | lorem.txt | Shares/meal plan | | lorem-big.txt | Shares/meal plan | # Then what do we check for to be confident that the above things done by Brian have worked? # Then the downloaded files should have content "abc..." And "Brian" logs out - And "Alice" downloads the following files using the sidebar panel + And "Alice" downloads the following resources using the sidebar panel | resource | from | | parent.txt | groups/Kindergarten Koalas/meal plan | | lorem.txt | groups/Kindergarten Koalas/meal plan | diff --git a/tests/e2e/cucumber/steps/app-files/resource.ts b/tests/e2e/cucumber/steps/app-files/resource.ts index 51af28a75f9..41205793693 100644 --- a/tests/e2e/cucumber/steps/app-files/resource.ts +++ b/tests/e2e/cucumber/steps/app-files/resource.ts @@ -35,7 +35,7 @@ When( ) When( - /^"([^"]*)" downloads the following file(s)? using the (sidebar panel|batch action)$/, + /^"([^"]*)" downloads the following resource(s)? using the (sidebar panel|batch action)$/, async function ( this: World, stepUser: string, diff --git a/tests/e2e/support/objects/app-files/resource/actions.ts b/tests/e2e/support/objects/app-files/resource/actions.ts index 9cc6cdab816..be333d559d6 100644 --- a/tests/e2e/support/objects/app-files/resource/actions.ts +++ b/tests/e2e/support/objects/app-files/resource/actions.ts @@ -1,9 +1,15 @@ import { Download, Page } from 'playwright' +import util from 'util' import { resourceExists, waitForResources } from './utils' import path from 'path' import { File } from '../../../types' import { sidebar } from '../utils' +const downloadButtonSideBar = '#oc-files-actions-sidebar .oc-files-actions-download-file-trigger' +const downloadButtonBatchActionSingleFile = '.oc-files-actions-download-file-trigger' +const downloadButtonBatchActionMultiple = '.oc-files-actions-download-archive-trigger' +const checkBox = `//*[@data-test-resource-name="%s"]//ancestor::tr//input` + export const clickResource = async ({ page, path @@ -13,10 +19,8 @@ export const clickResource = async ({ }): Promise => { const paths = path.split('/') for (const name of paths) { - const resourceSelector = `[data-test-resource-name="${name}"]` - await page.waitForSelector(resourceSelector) await Promise.all([ - page.locator(resourceSelector).click(), + page.locator(`[data-test-resource-name="${name}"]`).click(), page.waitForResponse((resp) => resp.url().endsWith(encodeURIComponent(name))) ]) } @@ -114,7 +118,7 @@ export const downloadResources = async (args: downloadResourcesArgs): Promise => { +export const selectResources = async (args: selectResourcesArgs): Promise => { const { page, folder, names } = args if (folder) { await clickResource({ page: page, path: folder }) } - for (const name of names) { - const resourceCheckbox = page.locator( - `//*[@data-test-resource-name="${name}"]//ancestor::tr//input` - ) - - if (!(await resourceCheckbox.isChecked())) { - await resourceCheckbox.check() + for (const resource of names) { + const exists = await resourceExists({ + page: page, + name: resource + }) + if (exists) { + const resourceCheckbox = page.locator(util.format(checkBox, resource)) + if (!(await resourceCheckbox.isChecked())) { + await resourceCheckbox.check() + } } } }