mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
[ACS-7305] beforeEach and afterAll updated for viewer tests (#3830)
This commit is contained in:
parent
eeca6b1a83
commit
995305fc13
@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
import { expect } from '@playwright/test';
|
||||
import { ApiClientFactory, FileActionsApi, LoginPage, NodesApi, SitesApi, test, TEST_FILES, Utils } from '@alfresco/playwright-shared';
|
||||
import { ApiClientFactory, FileActionsApi, NodesApi, SitesApi, test, TEST_FILES, Utils, TrashcanApi } from '@alfresco/playwright-shared';
|
||||
import { SiteBodyCreate } from '@alfresco/js-api';
|
||||
|
||||
test.describe('from File Libraries', () => {
|
||||
@ -34,6 +34,7 @@ test.describe('from File Libraries', () => {
|
||||
let destinationId: string;
|
||||
const xlsxLibraries = `xlsxFL-${Utils.random()}`;
|
||||
let nodesApi: NodesApi;
|
||||
let trashcanApi: TrashcanApi;
|
||||
let sitesApi: SitesApi;
|
||||
let fileApi: FileActionsApi;
|
||||
|
||||
@ -41,6 +42,7 @@ test.describe('from File Libraries', () => {
|
||||
await apiClientFactory.setUpAcaBackend('admin');
|
||||
await apiClientFactory.createUser({ username });
|
||||
nodesApi = await NodesApi.initialize(username, username);
|
||||
trashcanApi = await TrashcanApi.initialize(username, username);
|
||||
sitesApi = await SitesApi.initialize(username, username);
|
||||
fileApi = await FileActionsApi.initialize(username, username);
|
||||
try {
|
||||
@ -52,22 +54,12 @@ test.describe('from File Libraries', () => {
|
||||
} catch {}
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
const loginPage = new LoginPage(page);
|
||||
await loginPage.loginUser(
|
||||
{ username: username, password: username },
|
||||
{
|
||||
withNavigation: true,
|
||||
waitForLoading: true
|
||||
}
|
||||
);
|
||||
test.beforeEach(async ({ loginPage }) => {
|
||||
await Utils.tryLoginUser(loginPage, username, username, 'beforeEach failed');
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
try {
|
||||
await sitesApi.deleteSites([siteName]);
|
||||
await nodesApi.deleteNodes([destinationId]);
|
||||
} catch {}
|
||||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed', sitesApi, [siteName]);
|
||||
});
|
||||
|
||||
test('[C286371] Move action from File Libraries', async ({ myLibrariesPage, personalFiles }) => {
|
||||
|
@ -27,14 +27,14 @@ import {
|
||||
ApiClientFactory,
|
||||
FavoritesPageApi,
|
||||
FileActionsApi,
|
||||
LoginPage,
|
||||
NodesApi,
|
||||
SharedLinksApi,
|
||||
SitesApi,
|
||||
test,
|
||||
TEST_FILES,
|
||||
timeouts,
|
||||
Utils
|
||||
Utils,
|
||||
TrashcanApi
|
||||
} from '@alfresco/playwright-shared';
|
||||
import { Site } from '@alfresco/js-api';
|
||||
|
||||
@ -51,6 +51,7 @@ test.describe('viewer file', () => {
|
||||
let folderId: string;
|
||||
let fileDocxId: string;
|
||||
let nodesApi: NodesApi;
|
||||
let trashcanApi: TrashcanApi;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
test.setTimeout(timeouts.extendedTest);
|
||||
@ -60,6 +61,7 @@ test.describe('viewer file', () => {
|
||||
await apiClientFactory.createUser({ username });
|
||||
nodesApi = await NodesApi.initialize(username, username);
|
||||
const fileActionApi = await FileActionsApi.initialize(username, username);
|
||||
trashcanApi = await TrashcanApi.initialize(username, username);
|
||||
const shareActions = await SharedLinksApi.initialize(username, username);
|
||||
const favoritesActions = await FavoritesPageApi.initialize(username, username);
|
||||
const siteActionsUser = await SitesApi.initialize(username, username);
|
||||
@ -89,20 +91,13 @@ test.describe('viewer file', () => {
|
||||
await fileActionApi.waitForNodes(randomDocxName, { expect: 1 });
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ personalFiles, page }) => {
|
||||
const loginPage = new LoginPage(page);
|
||||
await loginPage.loginUser(
|
||||
{ username, password: username },
|
||||
{
|
||||
withNavigation: true,
|
||||
waitForLoading: true
|
||||
}
|
||||
);
|
||||
test.beforeEach(async ({ personalFiles, loginPage }) => {
|
||||
await Utils.tryLoginUser(loginPage, username, username, 'beforeEach failed');
|
||||
await personalFiles.navigate({ remoteUrl: `#/personal-files/${folderId}` });
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
await nodesApi.deleteCurrentUserNodes();
|
||||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed');
|
||||
});
|
||||
|
||||
test('[C279269] Viewer opens on double clicking on a file from Personal Files', async ({ personalFiles }) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user