[ACS-6666] e2e migration for info drawer file folder properties tests (#3623)

* [ACS-5882] infoDrawer comments tests migrated to Playwright

* [ACS-5882] fixed issues from pull request comments

* [ACS-5882] 2nd part of fixed issues from pull request comments

* [ACS-6666] E2E test migration - infoDrawer - File Folder Properties

* [ACS-6666] Few changes + small test fixes

* [ACS-6666] Deleted unused method

* [ACS-5882] infoDrawer comments tests migrated to Playwright

* [ACS-5882] fixed issues from pull request comments

* [ACS-5882] 2nd part of fixed issues from pull request comments

* [ACS-6666] Sonar fix

* [ACS-6666] Small locators change + timeout increased
This commit is contained in:
Adam Świderski
2024-02-06 11:43:35 +01:00
committed by GitHub
parent bcb7e634d9
commit 382486463b
7 changed files with 155 additions and 36 deletions

View File

@@ -80,7 +80,7 @@ test.describe('Info Drawer - Comments', () => {
test('[C299209] from Favorites - Add a comment on a folder', async ({ favoritePage }) => { test('[C299209] from Favorites - Add a comment on a folder', async ({ favoritePage }) => {
const favoriteFolderName = `favoriteFolder-e2e-${Utils.random()}`; const favoriteFolderName = `favoriteFolder-e2e-${Utils.random()}`;
const folderFavId: string = (await nodesApi.createFolder(favoriteFolderName)).entry.id; const folderFavId = (await nodesApi.createFolder(favoriteFolderName)).entry.id;
await favoritesActions.addFavoritesByIds('folder', [folderFavId]); await favoritesActions.addFavoritesByIds('folder', [folderFavId]);
await fileActionsApi.waitForNodes(favoriteFolderName, { expect: 1 }); await fileActionsApi.waitForNodes(favoriteFolderName, { expect: 1 });
await favoritePage.navigate(); await favoritePage.navigate();
@@ -99,7 +99,7 @@ test.describe('Info Drawer - Comments', () => {
const sharedFileName = `sharedFile-e2e-${Utils.random()}`; const sharedFileName = `sharedFile-e2e-${Utils.random()}`;
const e2eCommentFirst = `e2e-comment-${Utils.random()}`; const e2eCommentFirst = `e2e-comment-${Utils.random()}`;
const e2eCommentSecond = `e2e-comment-${Utils.random()}`; const e2eCommentSecond = `e2e-comment-${Utils.random()}`;
const sharedFileId: string = (await nodesApi.createFile(sharedFileName)).entry.id; const sharedFileId = (await nodesApi.createFile(sharedFileName)).entry.id;
await fileActionsApi.waitForNodes(sharedFileName, { expect: 1 }); await fileActionsApi.waitForNodes(sharedFileName, { expect: 1 });
await apiClientFactory.commentsApi.createComment(sharedFileId, { content: e2eCommentFirst }); await apiClientFactory.commentsApi.createComment(sharedFileId, { content: e2eCommentFirst });
await apiClientFactory.commentsApi.createComment(sharedFileId, { content: e2eCommentSecond }); await apiClientFactory.commentsApi.createComment(sharedFileId, { content: e2eCommentSecond });
@@ -135,7 +135,7 @@ test.describe('Info Drawer - Comments', () => {
test('[C299196] Comment info display - File from Favorites', async ({ favoritePage }) => { test('[C299196] Comment info display - File from Favorites', async ({ favoritePage }) => {
const e2eCommentFirst = `e2e-comment-${Utils.random()}`; const e2eCommentFirst = `e2e-comment-${Utils.random()}`;
const commentInfoFileName = `e2e-commentFile-${Utils.random()}`; const commentInfoFileName = `e2e-commentFile-${Utils.random()}`;
const commentInfoFileId: string = (await nodesApi.createFile(commentInfoFileName)).entry.id; const commentInfoFileId = (await nodesApi.createFile(commentInfoFileName)).entry.id;
await favoritesActions.addFavoritesByIds('file', [commentInfoFileId]); await favoritesActions.addFavoritesByIds('file', [commentInfoFileId]);
await fileActionsApi.waitForNodes(commentInfoFileName, { expect: 1 }); await fileActionsApi.waitForNodes(commentInfoFileName, { expect: 1 });
await apiClientFactory.commentsApi.createComment(commentInfoFileId, { content: e2eCommentFirst }); await apiClientFactory.commentsApi.createComment(commentInfoFileId, { content: e2eCommentFirst });

View File

@@ -0,0 +1,97 @@
/*!
* Copyright © 2005-2023 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 } from '@alfresco/playwright-shared';
test.describe('Info Drawer - File Folder Properties', () => {
let nodesApi: NodesApi;
let trashcanApi: TrashcanApi;
let fileActionsApi: FileActionsApi;
const username = `user-e2e-${Utils.random()}`;
test.beforeAll(async () => {
try {
const apiClientFactory = new ApiClientFactory();
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);
} catch (error) {
console.error(`beforeAll failed : ${error}`);
}
});
test.afterAll(async () => {
try {
await nodesApi.deleteCurrentUserNodes();
await trashcanApi.emptyTrashcan();
} catch (error) {
console.error(`Main afterAll failed: ${error}`);
}
});
test.beforeEach(async ({ loginPage }) => {
try {
await loginPage.loginUser({ username, password: username }, { withNavigation: true, waitForLoading: true });
} catch (error) {
console.error(`Main beforeEach failed: ${error}`);
}
});
test('[C299162] View properties - Default tabs', async ({ personalFiles }) => {
const defaultTabsFolderName = `defaultTabsFolder-e2e-${Utils.random()}`;
await nodesApi.createFolder(defaultTabsFolderName);
await fileActionsApi.waitForNodes(defaultTabsFolderName, { expect: 1 });
await personalFiles.navigate();
await expect(personalFiles.dataTable.getRowByName(defaultTabsFolderName)).toBeVisible();
await personalFiles.dataTable.getRowByName(defaultTabsFolderName).click();
await personalFiles.acaHeader.viewDetails.click();
expect(await personalFiles.infoDrawer.getHeaderTitle()).toEqual(defaultTabsFolderName);
await expect(personalFiles.infoDrawer.propertiesTab).toBeVisible();
await expect(personalFiles.infoDrawer.commentsTab).toBeVisible();
expect(await personalFiles.infoDrawer.getTabsCount()).toEqual(2);
});
test('[C599174] View properties - Should be able to make the files/folders info drawer expandable as for Sites', async ({ personalFiles }) => {
const expandDetailsFolderName = `expandDetailsFolder-e2e-${Utils.random()}`;
await nodesApi.createFolder(expandDetailsFolderName);
await fileActionsApi.waitForNodes(expandDetailsFolderName, { expect: 1 });
await personalFiles.navigate();
await expect(personalFiles.dataTable.getRowByName(expandDetailsFolderName)).toBeVisible();
await personalFiles.dataTable.getRowByName(expandDetailsFolderName).click();
await personalFiles.acaHeader.viewDetails.click();
await personalFiles.infoDrawer.expandDetailsButton.click();
await expect(personalFiles.infoDrawer.expandedDetailsPermissionsTab).toBeVisible();
await personalFiles.navigate();
await expect(personalFiles.dataTable.getRowByName(expandDetailsFolderName)).toBeVisible();
await personalFiles.dataTable.getRowByName(expandDetailsFolderName).click({ button: 'right' });
await personalFiles.pagination.clickMenuItem('Permissions');
await expect(personalFiles.infoDrawer.expandedDetailsPermissionsTab).toBeVisible();
});
});

View File

@@ -18,5 +18,6 @@
"C213666": "https://alfresco.atlassian.net/browse/ACS-6688", "C213666": "https://alfresco.atlassian.net/browse/ACS-6688",
"C280490": "https://alfresco.atlassian.net/browse/ACS-6688", "C280490": "https://alfresco.atlassian.net/browse/ACS-6688",
"C280491": "https://alfresco.atlassian.net/browse/ACS-6688", "C280491": "https://alfresco.atlassian.net/browse/ACS-6688",
"C213217": "https://alfresco.atlassian.net/browse/ACS-6710" "C213217": "https://alfresco.atlassian.net/browse/ACS-6710",
"C213245": "https://alfresco.atlassian.net/browse/ACS-6717"
} }

View File

@@ -68,33 +68,37 @@ test.describe('Remember sorting', () => {
let nodeActionUser1: NodesApi; let nodeActionUser1: NodesApi;
test.beforeAll(async () => { test.beforeAll(async () => {
test.setTimeout(timeouts.extendedTest); try {
const apiClientFactory = new ApiClientFactory(); test.setTimeout(timeouts.extendedTest);
await apiClientFactory.setUpAcaBackend('admin'); const apiClientFactory = new ApiClientFactory();
await apiClientFactory.createUser({ username: user1 }); await apiClientFactory.setUpAcaBackend('admin');
await apiClientFactory.createUser({ username: user2 }); await apiClientFactory.createUser({ username: user1 });
const fileActionUser1 = await FileActionsApi.initialize(user1, user1); await apiClientFactory.createUser({ username: user2 });
const fileActionUser2 = await FileActionsApi.initialize(user2, user2); const fileActionUser1 = await FileActionsApi.initialize(user1, user1);
const favoritesActions = await FavoritesPageApi.initialize(user1, user1); const fileActionUser2 = await FileActionsApi.initialize(user2, user2);
nodeActionUser1 = await NodesApi.initialize(user1, user1); const favoritesActions = await FavoritesPageApi.initialize(user1, user1);
const filesIdsUser1: { [key: string]: string } = {}; nodeActionUser1 = await NodesApi.initialize(user1, user1);
const filesIdsUser2: { [key: string]: string } = {}; const filesIdsUser1: { [key: string]: string } = {};
await Promise.all( const filesIdsUser2: { [key: string]: string } = {};
testData.user1.files.pdf.map( await Promise.all(
async (i) => (filesIdsUser1[i] = (await fileActionUser1.uploadFileWithRename(TEST_FILES.PDF.path, i, '-my-')).entry.id) testData.user1.files.pdf.map(
) async (i) => (filesIdsUser1[i] = (await fileActionUser1.uploadFileWithRename(TEST_FILES.PDF.path, i, '-my-')).entry.id)
); )
await Promise.all( );
testData.user1.files.jpg.map( await Promise.all(
async (i) => (filesIdsUser1[i] = (await fileActionUser1.uploadFileWithRename(TEST_FILES.JPG_FILE.path, i, '-my-')).entry.id) testData.user1.files.jpg.map(
) async (i) => (filesIdsUser1[i] = (await fileActionUser1.uploadFileWithRename(TEST_FILES.JPG_FILE.path, i, '-my-')).entry.id)
); )
await Promise.all( );
testData.user2.files.map( await Promise.all(
async (i) => (filesIdsUser2[i] = (await fileActionUser2.uploadFileWithRename(TEST_FILES.PDF.path, i, '-my-')).entry.id) testData.user2.files.map(
) async (i) => (filesIdsUser2[i] = (await fileActionUser2.uploadFileWithRename(TEST_FILES.PDF.path, i, '-my-')).entry.id)
); )
await favoritesActions.addFavoritesByIds('file', [filesIdsUser1[pdfFileNames[0]], filesIdsUser1[pdfFileNames[1]]]); );
await favoritesActions.addFavoritesByIds('file', [filesIdsUser1[pdfFileNames[0]], filesIdsUser1[pdfFileNames[1]]]);
} catch (error) {
console.error(`beforeAll failed : ${error}`);
}
}); });
test.beforeEach(async ({ loginPage, personalFiles }) => { test.beforeEach(async ({ loginPage, personalFiles }) => {

View File

@@ -66,8 +66,12 @@ test.describe('Trash', () => {
}); });
test.afterAll(async () => { test.afterAll(async () => {
await nodesApi.deleteCurrentUserNodes(); try {
await siteActionsAdmin.deleteSites([siteName]); await nodesApi.deleteCurrentUserNodes();
await siteActionsAdmin.deleteSites([siteName]);
} catch (error) {
console.error(`Main afterAll failed: ${error}`);
}
}); });
test.describe(`Regular user's personal files`, () => { test.describe(`Regular user's personal files`, () => {

View File

@@ -36,8 +36,9 @@ export class AdfInfoDrawerComponent extends BaseComponent {
public getIdField = (labelText: string) => this.getChild('[data-automation-id="library-id-properties-wrapper"]', { hasText: labelText }); public getIdField = (labelText: string) => this.getChild('[data-automation-id="library-id-properties-wrapper"]', { hasText: labelText });
public getVisibilityField = (labelText: string) => this.getChild('[data-automation-id="library-visibility-properties-wrapper"]', { hasText: labelText }); public getVisibilityField = (labelText: string) => this.getChild('[data-automation-id="library-visibility-properties-wrapper"]', { hasText: labelText });
public getDescriptionField = this.getChild('[data-automation-id="library-description-properties-wrapper"] textarea'); public getDescriptionField = this.getChild('[data-automation-id="library-description-properties-wrapper"] textarea');
public propertiesTab = this.getChild('.adf-info-drawer-tab').nth(0); public infoDrawerTabs = this.getChild('.adf-info-drawer-tab');
public commentsTab = this.getChild('.adf-info-drawer-tab').nth(1); public propertiesTab = this.infoDrawerTabs.nth(0);
public commentsTab = this.infoDrawerTabs.nth(1);
public commentInputField = this.getChild('mat-form-field'); public commentInputField = this.getChild('mat-form-field');
public commentsHeader = this.getChild('#comment-header'); public commentsHeader = this.getChild('#comment-header');
public addCommentButton = this.getChild('[data-automation-id="comments-input-add"]'); public addCommentButton = this.getChild('[data-automation-id="comments-input-add"]');
@@ -45,6 +46,10 @@ export class AdfInfoDrawerComponent extends BaseComponent {
public commentUsername = this.getChild('.adf-comment-user-name'); public commentUsername = this.getChild('.adf-comment-user-name');
public commentTextContent = this.getChild('.adf-comment-message'); public commentTextContent = this.getChild('.adf-comment-message');
public commentTimestamp = this.getChild('.adf-comment-message-time'); public commentTimestamp = this.getChild('.adf-comment-message-time');
public headerTitle = this.getChild('.adf-info-drawer-layout-header-title div');
public expandDetailsButton = this.getChild(`button[title='Expand panel']`);
public expandedDetailsTabs = this.page.locator('.aca-details-container .mat-tab-label-content');
public expandedDetailsPermissionsTab = this.expandedDetailsTabs.getByText("Permissions");
async checkCommentsHeaderCount(): Promise<number> { async checkCommentsHeaderCount(): Promise<number> {
@@ -67,4 +72,12 @@ export class AdfInfoDrawerComponent extends BaseComponent {
await this.page.keyboard.type(commentText); await this.page.keyboard.type(commentText);
await this.addCommentButton.click(); await this.addCommentButton.click();
} }
async getHeaderTitle(): Promise<string> {
return this.headerTitle.textContent();
}
async getTabsCount(): Promise<number> {
return this.infoDrawerTabs.count();
}
} }

View File

@@ -31,7 +31,7 @@ export const timeouts = {
big: 7500, big: 7500,
large: 10000, large: 10000,
extraLarge: 20 * 1000, extraLarge: 20 * 1000,
globalTest: 45 * 1000, globalTest: 85 * 1000,
extendedTest: 150 * 1000, extendedTest: 150 * 1000,
extendedLongTest: 200 * 1000, extendedLongTest: 200 * 1000,
webServer: 240 * 1000, webServer: 240 * 1000,