mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2026-09-09 18:02:54 +00:00
[ACS-11233] Testing week test cases automated in ACA (#5113)
* [ACS-11233] Testing week test cases automated in ACA * [ACS-11233] last test additions from testing week * [ACS-11233] sonar fix 1 * eslint configuration for e2e tests * [ACS-11233] sonar fix 2 * [ACS-11233] sonar fix 3 * [ACS-11233] added viewer actions as a seperate test suite * [ACS-11233] added viewer actions to pr yml * [ACS-11233] deleted autocorrection * [ACS-11233] review fix 1 * [ACS-11233] review fix 2 * [ACS-11233] small test fixes and report portal upload timeout change * [ACS-11233] reportportal fix 2 * [ACS-11233] viewer tests fixes * [ACS-11233] review fix 3 * [ACS-11233] review fix 4 * [ACS-11233] deleted angular inject test 1 * [ACS-11233] viewer tests fix 3
This commit is contained in:
@@ -30,6 +30,10 @@ test.describe('Favorites Files', () => {
|
||||
let nodesApi: NodesApi;
|
||||
let trashcanApi: TrashcanApi;
|
||||
let siteActionsAdmin: SitesApi;
|
||||
let favoritesActions: FavoritesPageApi;
|
||||
let nodesApiAdmin: NodesApi;
|
||||
let apiClientFactory: ApiClientFactory;
|
||||
let parentId: string;
|
||||
const username = `user-${Utils.random()}`;
|
||||
const siteName = `site-${Utils.random()}`;
|
||||
const favFolderName = `favFolder-${Utils.random()}`;
|
||||
@@ -42,36 +46,16 @@ test.describe('Favorites Files', () => {
|
||||
test.beforeAll(async () => {
|
||||
try {
|
||||
test.setTimeout(timeouts.extendedTest);
|
||||
const apiClientFactory = new ApiClientFactory();
|
||||
apiClientFactory = new ApiClientFactory();
|
||||
await apiClientFactory.setUpAcaBackend('admin');
|
||||
await apiClientFactory.createUser({ username });
|
||||
nodesApi = await NodesApi.initialize(username, username);
|
||||
trashcanApi = await TrashcanApi.initialize(username, username);
|
||||
const nodesApiAdmin = await NodesApi.initialize('admin');
|
||||
nodesApiAdmin = await NodesApi.initialize('admin');
|
||||
siteActionsAdmin = await SitesApi.initialize('admin');
|
||||
const favoritesActions = await FavoritesPageApi.initialize(username, username);
|
||||
const consumerFavoritesTotalItems = await favoritesActions.getFavoritesTotalItems(username);
|
||||
const folderFavId = (await nodesApi.createFolder(favFolderName)).entry.id;
|
||||
const parentId = (await nodesApi.createFolder(parentFolder)).entry.id;
|
||||
await siteActionsAdmin.createSite(siteName, Site.VisibilityEnum.PUBLIC);
|
||||
const docLibId = await siteActionsAdmin.getDocLibId(siteName);
|
||||
await siteActionsAdmin.addSiteMember(siteName, username, Site.RoleEnum.SiteManager);
|
||||
await favoritesActions.addFavoritesByIds('folder', [folderFavId]);
|
||||
const file1Id = (await nodesApiAdmin.createFile(fileName1, docLibId)).entry.id;
|
||||
const file2Id = (await nodesApi.createFile(fileName2, parentId)).entry.id;
|
||||
const file3Id = (await nodesApi.createFile(fileName3, parentId)).entry.id;
|
||||
const file4Id = (await nodesApi.createFile(fileName4, parentId)).entry.id;
|
||||
favoritesActions = await FavoritesPageApi.initialize(username, username);
|
||||
|
||||
await favoritesActions.addFavoritesByIds('file', [file1Id]);
|
||||
await favoritesActions.addFavoriteById('file', file2Id);
|
||||
await favoritesActions.addFavoriteById('file', file3Id);
|
||||
await favoritesActions.addFavoriteById('file', file4Id);
|
||||
await nodesApi.deleteNodes([file3Id, file4Id], false);
|
||||
await apiClientFactory.trashCan.restoreDeletedNode(file4Id);
|
||||
await Promise.all([
|
||||
favoritesActions.isFavoriteWithRetry(username, folderFavId, { expect: true }),
|
||||
favoritesActions.waitForApi(username, { expect: consumerFavoritesTotalItems + 4 })
|
||||
]);
|
||||
parentId = (await nodesApi.createFolder(parentFolder)).entry.id;
|
||||
} catch (error) {
|
||||
console.error(`beforeAll failed : ${error}`);
|
||||
}
|
||||
@@ -85,7 +69,47 @@ test.describe('Favorites Files', () => {
|
||||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed', siteActionsAdmin, [siteName]);
|
||||
});
|
||||
|
||||
test.describe(`Deleted favorite files in data list`, () => {
|
||||
test.beforeAll(async () => {
|
||||
const file3Id = (await nodesApi.createFile(fileName3, parentId)).entry.id;
|
||||
const file4Id = (await nodesApi.createFile(fileName4, parentId)).entry.id;
|
||||
await favoritesActions.addFavoriteById('file', file3Id);
|
||||
await favoritesActions.addFavoriteById('file', file4Id);
|
||||
await nodesApi.deleteNodes([file3Id, file4Id], false);
|
||||
await apiClientFactory.trashCan.restoreDeletedNode(file4Id);
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ favoritePage }) => {
|
||||
await favoritePage.navigate();
|
||||
});
|
||||
|
||||
test(`[XAT-4456] Deleted favorite files and folders do not appear in the list`, async ({ favoritePage }) => {
|
||||
expect(await favoritePage.dataTable.getRowByName(fileName3).isHidden(), `${fileName3} is displayed`).toBe(true);
|
||||
});
|
||||
|
||||
test(`[XAT-4457] Favorite files and folders restored from trashcan are displayed in the list`, async ({ favoritePage }) => {
|
||||
expect(await favoritePage.dataTable.isItemPresent(fileName4), `${fileName4} not displayed`).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe(`Regular user's Favorites files`, () => {
|
||||
test.beforeAll(async () => {
|
||||
const consumerFavoritesTotalItems = await favoritesActions.getFavoritesTotalItems(username);
|
||||
const folderFavId = (await nodesApi.createFolder(favFolderName)).entry.id;
|
||||
await siteActionsAdmin.createSite(siteName, Site.VisibilityEnum.PUBLIC);
|
||||
const docLibId = await siteActionsAdmin.getDocLibId(siteName);
|
||||
await siteActionsAdmin.addSiteMember(siteName, username, Site.RoleEnum.SiteManager);
|
||||
await favoritesActions.addFavoritesByIds('folder', [folderFavId]);
|
||||
const file1Id = (await nodesApiAdmin.createFile(fileName1, docLibId)).entry.id;
|
||||
const file2Id = (await nodesApi.createFile(fileName2, parentId)).entry.id;
|
||||
await favoritesActions.addFavoritesByIds('file', [file1Id]);
|
||||
await favoritesActions.addFavoriteById('file', file2Id);
|
||||
await Promise.all([
|
||||
favoritesActions.isFavoriteWithRetry(username, folderFavId, { expect: true }),
|
||||
favoritesActions.waitForApi(username, { expect: consumerFavoritesTotalItems + 4 })
|
||||
]);
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ favoritePage }) => {
|
||||
await favoritePage.navigate();
|
||||
});
|
||||
@@ -96,14 +120,6 @@ test.describe('Favorites Files', () => {
|
||||
expect(actualColumns).toEqual(expectedColumns);
|
||||
});
|
||||
|
||||
test(`[XAT-4456] Deleted favorite files and folders do not appear in the list`, async ({ favoritePage }) => {
|
||||
expect(await favoritePage.dataTable.isItemPresent(fileName3), `${fileName3} is displayed`).not.toBe(true);
|
||||
});
|
||||
|
||||
test(`[XAT-4457] Favorite files and folders restored from trashcan are displayed in the list`, async ({ favoritePage }) => {
|
||||
expect(await favoritePage.dataTable.isItemPresent(fileName4), `${fileName4} not displayed`).toBe(true);
|
||||
});
|
||||
|
||||
test('[XAT-4459] Location column displays the parent folder of the file as link', async ({ favoritePage }) => {
|
||||
expect(await favoritePage.dataTable.getItemLocationText(fileName2)).toEqual(parentFolder);
|
||||
expect(await favoritePage.dataTable.getItemLocationText(favFolderName)).toEqual('Personal Files');
|
||||
|
||||
@@ -23,11 +23,12 @@
|
||||
*/
|
||||
|
||||
import { expect } from '@playwright/test';
|
||||
import { APP_ROUTES, ApiClientFactory, NodesApi, SIDEBAR_LABELS, Utils, test, TrashcanApi } from '@alfresco/aca-playwright-shared';
|
||||
import { APP_ROUTES, ApiClientFactory, NodesApi, SIDEBAR_LABELS, Utils, test, TrashcanApi, SearchApi } from '@alfresco/aca-playwright-shared';
|
||||
|
||||
test.describe('Personal Files', () => {
|
||||
let nodesApi: NodesApi;
|
||||
let trashcanApi: TrashcanApi;
|
||||
let searchApi: SearchApi;
|
||||
const username = `user-${Utils.random()}`;
|
||||
const userFolder = `user-folder-${Utils.random()}`;
|
||||
|
||||
@@ -38,6 +39,7 @@ test.describe('Personal Files', () => {
|
||||
await apiClientFactory.createUser({ username });
|
||||
nodesApi = await NodesApi.initialize(username, username);
|
||||
trashcanApi = await TrashcanApi.initialize(username, username);
|
||||
searchApi = await SearchApi.initialize(username, username);
|
||||
await nodesApi.createFolder(userFolder);
|
||||
} catch (error) {
|
||||
console.error(`beforeAll failed : ${error}`);
|
||||
@@ -76,5 +78,69 @@ test.describe('Personal Files', () => {
|
||||
await personalFiles.reload();
|
||||
expect(personalFiles.page.url()).toContain(APP_ROUTES.PERSONAL_FILES);
|
||||
});
|
||||
|
||||
test('[XAT-4518] Invalid URL', async ({ personalFiles }) => {
|
||||
await personalFiles.navigate({ remoteUrl: `#/personal-files/nonexistentpage-${Utils.random()}` });
|
||||
await expect(personalFiles.dataTable.noPermissionsView).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
test.describe(`Folder name abbreviation`, () => {
|
||||
const abbreviateFolderMain = `XAT-4385-folder-${Utils.random()}`;
|
||||
const abbreviateFolder2 = `XAT-4385-folder-${Utils.random()}-2`;
|
||||
const abbreviateFolder3 = `XAT-4385-folder-${Utils.random()}-3`;
|
||||
const abbreviateFolder4 = `XAT-4385-folder-${Utils.random()}-4`;
|
||||
const abbreviateFolder5 = `XAT-4385-folder-${Utils.random()}-5`;
|
||||
|
||||
let abbreviateFolder5Id: string;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
const abbreviateFolderMainId = (await nodesApi.createFolder(abbreviateFolderMain)).entry.id;
|
||||
const abbreviateFolder2Id = (await nodesApi.createFolder(abbreviateFolder2, abbreviateFolderMainId)).entry.id;
|
||||
const abbreviateFolder3Id = (await nodesApi.createFolder(abbreviateFolder3, abbreviateFolder2Id)).entry.id;
|
||||
const abbreviateFolder4Id = (await nodesApi.createFolder(abbreviateFolder4, abbreviateFolder3Id)).entry.id;
|
||||
abbreviateFolder5Id = (await nodesApi.createFolder(abbreviateFolder5, abbreviateFolder4Id)).entry.id;
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ loginPage }) => {
|
||||
await Utils.tryLoginUser(loginPage, username, username, 'beforeEach failed');
|
||||
});
|
||||
|
||||
test('[XAT-4385] Folder names abbreviate when path is too long to fit the screen', async ({ personalFiles }) => {
|
||||
await personalFiles.navigate({ remoteUrl: `#/personal-files/${abbreviateFolder5Id}` });
|
||||
await personalFiles.breadcrumb.currentItem.waitFor();
|
||||
const hasOverflow = await personalFiles.breadcrumb.currentItem.evaluate(
|
||||
(folderNameElement) => folderNameElement.scrollWidth > folderNameElement.clientWidth
|
||||
);
|
||||
expect(hasOverflow).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe(`Navigate to parent folder after pagination`, () => {
|
||||
const abbreviateFolderMain = `XAT-4527-folder-${Utils.random()}`;
|
||||
const abbreviateFolder2 = `XAT-4527-folder-${Utils.random()}-2`;
|
||||
|
||||
let abbreviateFolder2Id: string;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
const abbreviateFolderMainId = (await nodesApi.createFolder(abbreviateFolderMain)).entry.id;
|
||||
abbreviateFolder2Id = (await nodesApi.createFolder(abbreviateFolder2, abbreviateFolderMainId)).entry.id;
|
||||
await nodesApi.createMultipleFiles(30, abbreviateFolder2Id);
|
||||
await searchApi.waitForFolderPathIndexing(abbreviateFolder2Id, { nodesExpected: 30 });
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ loginPage }) => {
|
||||
await Utils.tryLoginUser(loginPage, username, username, 'beforeEach failed');
|
||||
});
|
||||
|
||||
test('[XAT-4527] Should be able to navigate to the parent folder when pagination is set to 25', async ({ personalFiles }) => {
|
||||
await personalFiles.navigate({ remoteUrl: `#/personal-files/${abbreviateFolder2Id}` });
|
||||
await personalFiles.breadcrumb.currentItem.waitFor();
|
||||
await personalFiles.pagination.clickOnNextPage();
|
||||
expect(await personalFiles.pagination.getCurrentPage()).toBe('Page 2');
|
||||
await personalFiles.breadcrumb.clickItem(abbreviateFolderMain);
|
||||
await personalFiles.spinner.spinnerWaitForReload();
|
||||
expect(await personalFiles.pagination.getRange()).toContain('Showing 1-1');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
import { expect } from '@playwright/test';
|
||||
import { ApiClientFactory, NodesApi, SearchPageApi, SitesApi, TrashcanApi, Utils, test, timeouts } from '@alfresco/aca-playwright-shared';
|
||||
import { ApiClientFactory, NodesApi, SearchApi, SitesApi, TrashcanApi, Utils, test, timeouts } from '@alfresco/aca-playwright-shared';
|
||||
import { Site } from '@alfresco/js-api';
|
||||
|
||||
test.describe('Recent Files', () => {
|
||||
@@ -69,7 +69,7 @@ test.describe('Recent Files', () => {
|
||||
const folderSiteId = (await nodeActionsUser.createFolder(folderSite, docLibId)).entry.id;
|
||||
await nodeActionsUser.createFile(fileSite, folderSiteId);
|
||||
|
||||
const searchApi = await SearchPageApi.initialize(username, username);
|
||||
const searchApi = await SearchApi.initialize(username, username);
|
||||
await searchApi.waitForApi(username, { expect: 3 });
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user