From 38050d108113610cd09eab14b1bad94c5e559f05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20=C5=9Awiderski?= Date: Fri, 29 Mar 2024 12:44:43 +0100 Subject: [PATCH] [ACS-7303] beforeEach and afterAll updated for share-action tests (#3742) * [ACS-7303] beforeEach and afterAll updated for share-action tests * [ACS-7303] deleted .only --- .../share/unshare-file-search-results.e2e.ts | 25 +++++++++++++------ .../dialogs/share-dialog.component.ts | 2 +- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/e2e/playwright/share-action/src/tests/share/unshare-file-search-results.e2e.ts b/e2e/playwright/share-action/src/tests/share/unshare-file-search-results.e2e.ts index e48086866..57f281bd1 100755 --- a/e2e/playwright/share-action/src/tests/share/unshare-file-search-results.e2e.ts +++ b/e2e/playwright/share-action/src/tests/share/unshare-file-search-results.e2e.ts @@ -23,11 +23,23 @@ */ import { Site } from '@alfresco/js-api'; -import { ApiClientFactory, FileActionsApi, NodesApi, SharedLinksApi, SitesApi, Utils, test, timeouts } from '@alfresco/playwright-shared'; +import { + ApiClientFactory, + FileActionsApi, + NodesApi, + SharedLinksApi, + SitesApi, + Utils, + test, + timeouts, + TrashcanApi +} from '@alfresco/playwright-shared'; import { expect } from '@playwright/test'; test.describe('Unshare a file from Search Results', () => { const random = Utils.random(); + let nodesApi: NodesApi; + let trashcanApi: TrashcanApi; const username = `user-${random}`; const parent = `parent-${random}`; @@ -57,7 +69,8 @@ test.describe('Unshare a file from Search Results', () => { test.setTimeout(timeouts.extendedTest); await apiClientFactory.setUpAcaBackend('admin'); await apiClientFactory.createUser({ username }); - const nodesApi = await NodesApi.initialize(username, username); + nodesApi = await NodesApi.initialize(username, username); + trashcanApi = await TrashcanApi.initialize(username, username); sitesApi = await SitesApi.initialize(username, username); const shareApi = await SharedLinksApi.initialize(username, username); const filesAction = await FileActionsApi.initialize(username, username); @@ -89,14 +102,12 @@ test.describe('Unshare a file from Search Results', () => { }); test.beforeEach(async ({ loginPage, personalFiles }) => { - await loginPage.navigate(); - await loginPage.loginUser({ username: username, password: username }); + await Utils.tryLoginUser(loginPage, username, username, 'beforeEach failed'); await personalFiles.waitForPageLoad(); }); test.afterAll(async () => { - await apiClientFactory.nodes.deleteNode(parentId, { permanent: true }); - await sitesApi.deleteSites([sitePrivate]); + await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed', sitesApi, [sitePrivate]); }); test('[C306995] Unshare dialog UI', async ({ personalFiles, searchPage }) => { @@ -172,7 +183,7 @@ test.describe('Unshare a file from Search Results', () => { await page.goto(url); await personalFiles.viewer.waitForViewerToOpen(); - expect(personalFiles.viewer.fileTitleButtonLocator).not.toEqual(file4); + expect(personalFiles.viewer.fileTitleButtonLocator.textContent()).not.toEqual(file4); expect(await nodesApiAction.isFileShared(file4Id)).toBe(false); }); diff --git a/projects/aca-playwright-shared/src/page-objects/components/dialogs/share-dialog.component.ts b/projects/aca-playwright-shared/src/page-objects/components/dialogs/share-dialog.component.ts index 7b44524cc..fa30159e5 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/dialogs/share-dialog.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/dialogs/share-dialog.component.ts @@ -63,7 +63,7 @@ export class ShareDialogComponent extends BaseComponent { } async getLinkUrl(): Promise { - return await this.url.inputValue(); + return await this.url.first().inputValue(); } async isUrlReadOnly(): Promise {