diff --git a/tests/e2e/support/objects/app-files/page/public.ts b/tests/e2e/support/objects/app-files/page/public.ts index 5024f9659b6..0bf0e9f7b87 100644 --- a/tests/e2e/support/objects/app-files/page/public.ts +++ b/tests/e2e/support/objects/app-files/page/public.ts @@ -25,7 +25,7 @@ export class Public { async upload({ resources }: { resources: File[] }): Promise { const startUrl = this.#page.url() - const resourceSelector = `//tbody/tr/td[contains(@class, "oc-pl-rm") and contains(text(), "%s")]` + const resourceSelector = `[data-test-resource-name="%s"]` await this.#page .locator('//input[@id="fileUploadInput"]') .setInputFiles(resources.map((file) => file.path)) diff --git a/tests/e2e/support/objects/app-files/resource/actions.ts b/tests/e2e/support/objects/app-files/resource/actions.ts index d7b830709a7..80b16c213df 100644 --- a/tests/e2e/support/objects/app-files/resource/actions.ts +++ b/tests/e2e/support/objects/app-files/resource/actions.ts @@ -128,7 +128,7 @@ export const downloadResources = async (args: downloadResourcesArgs): Promise => { - const { page, folder, names } = args +export const selectOrDeselectResources = async (args: selectResourcesArgs): Promise => { + const { page, folder, names, select } = args if (folder) { await clickResource({ page: page, path: folder }) } @@ -164,9 +165,13 @@ export const selectResources = async (args: selectResourcesArgs): Promise }) if (exists) { const resourceCheckbox = page.locator(util.format(checkBox, resource)) - if (!(await resourceCheckbox.isChecked())) { + if (!(await resourceCheckbox.isChecked()) && select) { await resourceCheckbox.check() + } else if (await resourceCheckbox.isChecked()) { + await resourceCheckbox.uncheck() } + } else { + throw new Error(`The resource ${resource} you are trying to select does not exist`) } } }