[ACS-11446] Automated last test cases from ACA test execution & various refactoring (#5134)

* [ACS-11446] Automated last test cases from ACA test execution & various refactoring

* [ACS-11446] sonar cloud fix 1

* [ACS-11446] spinner changes reverted & spinner component added to the base component

* [ACS-11446] sonar fix 2

* [ACS-11446] copilot review fixes 1

* [ACS-11446] copilot review fixes 2

* [ACS-11446] copilot review fixes 3

* [ACS=11446] review fixes 1

* [ACS-11446] excluded upload dialog tests
This commit is contained in:
Adam Świderski
2026-04-07 14:12:45 +02:00
committed by GitHub
parent ae949be1af
commit a2df5d2b0b
37 changed files with 503 additions and 316 deletions
+193
View File
@@ -0,0 +1,193 @@
/*!
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Alfresco Example Content Application
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { expect } from '@playwright/test';
import { ApiClientFactory, Utils, test, TrashcanApi, NodesApi, FileActionsApi, TagsApi, PersonalFilesPage } from '@alfresco/aca-playwright-shared';
async function navigateAndOpenExpandedInfoDrawer(personalFiles: PersonalFilesPage, folderName: string): Promise<void> {
await personalFiles.navigate();
await Utils.reloadPageIfRowNotVisible(personalFiles, folderName);
await expect(personalFiles.dataTable.getRowByName(folderName)).toBeVisible();
await personalFiles.dataTable.getRowByName(folderName).click();
await personalFiles.acaHeader.viewDetails.click();
await personalFiles.infoDrawer.expandDetailsButton.click();
}
async function openTagsEditMode(personalFiles: PersonalFilesPage): Promise<void> {
await personalFiles.nodeInfoEditMode.tagsAccordionPenButton.scrollIntoViewIfNeeded();
await personalFiles.nodeInfoEditMode.tagsAccordionPenButton.click();
}
test.describe('Edit Mode - Tags and Categories', () => {
const apiClientFactory = new ApiClientFactory();
let nodesApi: NodesApi;
let trashcanApi: TrashcanApi;
let fileActionsApi: FileActionsApi;
let tagsApi: TagsApi;
let folder919: string;
let folder938: string;
let folder939: string;
let folder942: string;
const testRunId = Utils.random();
const tag938 = `xat-938-${Utils.random()}`;
const tag939SharedName = `xat-939-${testRunId}`;
const tag939One = `${tag939SharedName}-1-${Utils.random()}`;
const tag939Two = `${tag939SharedName}-2-${Utils.random()}`;
const tag939Three = `${tag939SharedName}-3-${Utils.random()}`;
const tag942 = `xat-942-${Utils.random()}`;
const username = `edit-mode-${Utils.random()}`;
test.beforeAll(async () => {
try {
await apiClientFactory.setUpAcaBackend('admin');
await apiClientFactory.createUser({ username });
nodesApi = await NodesApi.initialize(username, username);
trashcanApi = await TrashcanApi.initialize(username, username);
fileActionsApi = await FileActionsApi.initialize(username, username);
tagsApi = await TagsApi.initialize('admin');
} catch (error) {
console.error(`beforeAll failed : ${error}`);
throw error;
}
});
test.beforeEach(async ({ loginPage }) => {
await Utils.tryLoginUser(loginPage, username, username, 'beforeEach failed');
});
test.afterAll(async () => {
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed');
for (const tag of [tag938, tag939One, tag939Two, tag939Three]) {
await tagsApi.deleteTagByTagName(tag);
}
});
test.describe('Edit Mode - XAT-919', () => {
test.beforeAll(async () => {
try {
folder919 = `folder-919-${Utils.random()}`;
await nodesApi.createFolder(folder919);
await fileActionsApi.waitForNodes(folder919, { expect: 1 });
} catch (error) {
console.error(`beforeAll failed : ${error}`);
throw error;
}
});
test('[XAT-919] Input fields in edit mode', async ({ personalFiles }) => {
await navigateAndOpenExpandedInfoDrawer(personalFiles, folder919);
await personalFiles.nodeInfoEditMode.categoriesAccordionPenButton.scrollIntoViewIfNeeded();
await personalFiles.nodeInfoEditMode.categoriesAccordionPenButton.click();
await expect(personalFiles.nodeInfoEditMode.categoriesInput).toBeEnabled();
await openTagsEditMode(personalFiles);
await expect(personalFiles.nodeInfoEditMode.tagsInput).toBeEnabled();
});
});
test.describe('Edit Mode - XAT-938', () => {
test.beforeAll(async () => {
try {
folder938 = `folder-938-${Utils.random()}`;
await nodesApi.createFolder(folder938);
await tagsApi.createTags(tag938);
await fileActionsApi.waitForNodes(folder938, { expect: 1 });
} catch (error) {
console.error(`beforeAll failed : ${error}`);
throw error;
}
});
test.afterAll(async () => {
await tagsApi.deleteTagByTagName(tag938);
});
test('[XAT-938] Select an existing tag', async ({ personalFiles }) => {
await navigateAndOpenExpandedInfoDrawer(personalFiles, folder938);
await openTagsEditMode(personalFiles);
await personalFiles.nodeInfoEditMode.tagsInput.fill(tag938);
await personalFiles.nodeInfoEditMode.existingTags.getByText(tag938).click();
await personalFiles.nodeInfoEditMode.tagsAccordionConfirmButton.click();
await expect(personalFiles.nodeInfoEditMode.tagsChips.getByText(tag938)).toBeVisible();
});
});
test.describe('Edit Mode - XAT-939', () => {
test.beforeAll(async () => {
try {
folder939 = `folder-939-${Utils.random()}`;
await nodesApi.createFolder(folder939);
await tagsApi.createTags(tag939One, tag939Two, tag939Three);
await fileActionsApi.waitForNodes(folder939, { expect: 1 });
} catch (error) {
console.error(`beforeAll failed : ${error}`);
throw error;
}
});
test.afterAll(async () => {
for (const tag of [tag939One, tag939Two, tag939Three]) {
await tagsApi.deleteTagByTagName(tag);
}
});
test('[XAT-939] List of tags ready to be assigned', async ({ personalFiles }) => {
await navigateAndOpenExpandedInfoDrawer(personalFiles, folder939);
await openTagsEditMode(personalFiles);
await personalFiles.nodeInfoEditMode.tagsInput.fill(tag939SharedName);
await personalFiles.nodeInfoEditMode.existingTags.first().waitFor();
expect(await personalFiles.nodeInfoEditMode.existingTags.count()).toEqual(3);
});
});
test.describe('Edit Mode - XAT-942', () => {
test.beforeAll(async () => {
try {
folder942 = `folder-942-${Utils.random()}`;
await nodesApi.createFolder(folder942);
await fileActionsApi.waitForNodes(folder942, { expect: 1 });
} catch (error) {
console.error(`beforeAll failed : ${error}`);
throw error;
}
});
test.afterAll(async () => {
await tagsApi.deleteTagByTagName(tag942);
});
test('[XAT-942] Creating tags in edit mode', async ({ personalFiles }) => {
await navigateAndOpenExpandedInfoDrawer(personalFiles, folder942);
await openTagsEditMode(personalFiles);
await personalFiles.nodeInfoEditMode.tagsInput.fill(tag942);
await personalFiles.nodeInfoEditMode.createTagButton.click();
await personalFiles.nodeInfoEditMode.tagsChips.getByText(tag942).click();
await personalFiles.nodeInfoEditMode.tagsAccordionConfirmButton.click();
await expect(personalFiles.nodeInfoEditMode.tagsChips.getByText(tag942)).toBeVisible();
});
});
});
@@ -44,7 +44,6 @@ test.describe('Info Drawer - file folder Properties', () => {
let tagsApi: TagsApi;
let categoriesApi: CategoriesApi;
let responseCategoryId: string;
let responseTagsId: string;
let folder17240Id: string;
let folder17242Id: string;
let folder5513Id: string;
@@ -80,19 +79,13 @@ test.describe('Info Drawer - file folder Properties', () => {
if ('entry' in createdCategory) {
return createdCategory.entry.id;
} else {
console.error('Unexpected response format:', createdCategory);
return null;
throw new Error(`Unexpected response format: ${JSON.stringify(createdCategory)}`);
}
}
async function createTagGetId(): Promise<string> {
const createdTag = await tagsApi.createTags([tagBody]);
if ('entry' in createdTag) {
return (createdTag as { entry: { id: string } }).entry.id;
} else {
console.error('Unexpected response format:', createdTag);
return null;
}
const [createdTag] = await tagsApi.createTags(tagBody.tag);
return createdTag.entry.id;
}
async function checkNodeFields(personalFiles: PersonalFilesPage, isFolder?: 'isFolder'): Promise<void> {
@@ -135,11 +128,7 @@ test.describe('Info Drawer - file folder Properties', () => {
tagsApi = await TagsApi.initialize('admin');
categoriesApi = await CategoriesApi.initialize('admin');
responseCategoryId = await createCategoryGetId();
responseTagsId = await createTagGetId();
if (responseCategoryId === null || responseTagsId === null) {
throw new Error('Failed to create category or tag - check API manually');
}
await createTagGetId();
await nodesApi.createFolder(folder5512);
folder5513Id = (await nodesApi.createFolder(folder5513)).entry.id;
@@ -180,7 +169,7 @@ test.describe('Info Drawer - file folder Properties', () => {
test.afterAll(async () => {
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed');
await categoriesApi.deleteCategory(responseCategoryId);
await tagsApi.deleteTagsByTagName(tagsPhraseForDeletion);
await tagsApi.deleteTagByTagName(tagsPhraseForDeletion);
});
test('[XAT-5512] View properties - Default tabs', async ({ personalFiles }) => {
@@ -295,7 +284,7 @@ test.describe('Info Drawer - file folder Properties', () => {
await fileActionsApi.waitForNodes(folder17240, { expect: 1 });
await tagsApi.assignTagToNode(folder17240Id, tagBody);
await expect(async () => {
expect((await tagsApi.listTagsForNode(folder17240Id)).list.entries.length).toEqual(1);
expect((await tagsApi.listTagsForNode(folder17240Id)).list?.entries.length).toEqual(1);
}).toPass({
intervals: [1_000],
timeout: timeouts.large