Skip to content

Commit

Permalink
[ACS-5014] Addressed code review findings. Moved objects to beforeAll…
Browse files Browse the repository at this point in the history
…/beforeEach wherever applicable. Added missing await.
  • Loading branch information
swapnil-verma-gl committed Nov 22, 2023
1 parent 39643e4 commit ae3fde2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
7 changes: 3 additions & 4 deletions e2e/playwright/copy-move-actions/src/tests/copy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import { Logger } from '@alfresco/adf-testing';

test.describe('Copy actions', () => {
let nodesApi: NodesApi;
const apiClientFactory = new ApiClientFactory();
const username = `user-${Utils.random()}`;

let sourceFile: string;
Expand All @@ -38,11 +37,11 @@ test.describe('Copy actions', () => {

let sourceFileId: string;
let sourceFileInsideFolderId: string;
let sourceFolderId: string;
let destinationFolderId: string;

test.beforeAll(async () => {
try {
const apiClientFactory = new ApiClientFactory();
await apiClientFactory.setUpAcaBackend('admin');
await apiClientFactory.createUser({ username });
nodesApi = await NodesApi.initialize(username, username);
Expand Down Expand Up @@ -75,7 +74,7 @@ test.describe('Copy actions', () => {
}
);
destinationFolderId = (await nodesApi.createFolder(destinationFolder)).entry.id;
sourceFolderId = (await nodesApi.createFolder(sourceFolder)).entry.id;
const sourceFolderId = (await nodesApi.createFolder(sourceFolder)).entry.id;
sourceFileInsideFolderId = (await nodesApi.createFile(sourceFileInsideFolder, sourceFolderId)).entry.id;
sourceFileId = (await nodesApi.createFile(sourceFile)).entry.id;

Expand All @@ -86,7 +85,7 @@ test.describe('Copy actions', () => {
});

const copyContentInPersonalFiles = async (personalFilesPage: PersonalFilesPage, sourceFileList: string[], destinationName: string) => {
personalFilesPage.copyOrMoveContentInDatatable(sourceFileList, destinationName, 'Copy');
await personalFilesPage.copyOrMoveContentInDatatable(sourceFileList, destinationName, 'Copy');
const msg = await personalFilesPage.snackBar.message.innerText();
if (sourceFileList.length === 1) {
expect.soft(msg).toContain('Copied 1 item');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ import { Logger } from '@alfresco/adf-testing';
test.describe('Copy Move actions', () => {
let nodesApi: NodesApi;
let sitesApi: SitesApi;
const apiClientFactory = new ApiClientFactory();

const username = `user-${Utils.random()}`;
const site = `site-${Utils.random()}`;
const consumerUser = `consumer-${Utils.random()}`;
const contributorUser = `contributor-${Utils.random()}`;
Expand All @@ -45,7 +43,9 @@ test.describe('Copy Move actions', () => {

test.beforeAll(async () => {
try {
const apiClientFactory = new ApiClientFactory();
await apiClientFactory.setUpAcaBackend('admin');
const username = `user-${Utils.random()}`;
await apiClientFactory.createUser({ username });
nodesApi = await NodesApi.initialize(username, username);
sitesApi = await SitesApi.initialize(username, username);
Expand Down
5 changes: 2 additions & 3 deletions e2e/playwright/copy-move-actions/src/tests/move.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import { Logger } from '@alfresco/adf-testing';

test.describe('Move actions', () => {
let nodesApi: NodesApi;
const apiClientFactory = new ApiClientFactory();
const username = `user-${Utils.random()}`;

let sourceFile: string;
Expand All @@ -38,11 +37,11 @@ test.describe('Move actions', () => {

let sourceFileId: string;
let sourceFileInsideFolderId: string;
let sourceFolderId: string;
let destinationFolderId: string;

test.beforeAll(async () => {
try {
const apiClientFactory = new ApiClientFactory();
await apiClientFactory.setUpAcaBackend('admin');
await apiClientFactory.createUser({ username });
nodesApi = await NodesApi.initialize(username, username);
Expand Down Expand Up @@ -75,7 +74,7 @@ test.describe('Move actions', () => {
}
);
destinationFolderId = (await nodesApi.createFolder(destinationFolder)).entry.id;
sourceFolderId = (await nodesApi.createFolder(sourceFolder)).entry.id;
const sourceFolderId = (await nodesApi.createFolder(sourceFolder)).entry.id;
sourceFileInsideFolderId = (await nodesApi.createFile(sourceFileInsideFolder, sourceFolderId)).entry.id;
sourceFileId = (await nodesApi.createFile(sourceFile)).entry.id;

Expand Down

0 comments on commit ae3fde2

Please sign in to comment.