Skip to content

Commit

Permalink
[ACS-8058] [E2E] Updated selectMultiItem method (#3874)
Browse files Browse the repository at this point in the history
* [ACS-8058] [E2E] Updated selectMultiItem method

* [ACS-8058] review fixes 1
  • Loading branch information
datguychen authored Jun 7, 2024
1 parent fc05a8b commit 5a87c27
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 52 deletions.
17 changes: 5 additions & 12 deletions e2e/playwright/delete-actions/src/tests/delete-undo-delete.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,9 @@ test.describe('Delete and undo delete', () => {
});

test('[C280502] delete multiple files and check notification', async ({ personalFiles, trashPage }) => {
await personalFiles.page.reload({ waitUntil: 'load' });
let items = await personalFiles.dataTable.getRowsCount();
await personalFiles.dataTable.selectItem(file2);
await personalFiles.page.waitForTimeout(1500);
await personalFiles.dataTable.selectItem(file3);
await personalFiles.dataTable.selectMultiItem(file2, file3);
await personalFiles.acaHeader.clickMoreActions();
await personalFiles.matMenu.clickMenuItem('Delete');
await personalFiles.snackBar.verifySnackBarActionText(`Deleted 2 items`);
Expand Down Expand Up @@ -178,9 +177,7 @@ test.describe('Delete and undo delete', () => {
});

test('[C217129] notification on multiple items deletion - some items fail to delete', async ({ personalFiles }) => {
await personalFiles.dataTable.selectItem(file4);
await personalFiles.page.waitForTimeout(1500);
await personalFiles.dataTable.selectItem(folder3);
await personalFiles.dataTable.selectMultiItem(file4, folder3);
await personalFiles.acaHeader.clickMoreActions();
await personalFiles.matMenu.clickMenuItem('Delete');
await personalFiles.snackBar.verifySnackBarActionText(`Deleted 1 item, 1 couldn't be deleted`);
Expand All @@ -189,9 +186,7 @@ test.describe('Delete and undo delete', () => {
});

test('[C217130] notification on multiple items deletion - all items fail to delete', async ({ personalFiles }) => {
await personalFiles.dataTable.selectItem(folder4);
await personalFiles.page.waitForTimeout(1500);
await personalFiles.dataTable.selectItem(folder5);
await personalFiles.dataTable.selectMultiItem(folder4, folder5);
await personalFiles.acaHeader.clickMoreActions();
await personalFiles.matMenu.clickMenuItem('Delete');
await personalFiles.snackBar.verifySnackBarActionText(`2 items couldn't be deleted`);
Expand Down Expand Up @@ -224,9 +219,7 @@ test.describe('Delete and undo delete', () => {
});

test('[C280504] undo delete of multiple files', async ({ personalFiles }) => {
await personalFiles.dataTable.selectItem(file6);
await personalFiles.page.waitForTimeout(1500);
await personalFiles.dataTable.selectItem(file7);
await personalFiles.dataTable.selectMultiItem(file6, file7);
await personalFiles.acaHeader.clickMoreActions();
await personalFiles.matMenu.clickMenuItem('Delete');
await personalFiles.snackBar.clickSnackBarAction();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@ test.describe('Delete and undo delete', () => {
});

test('[C280417] delete multiple items', async ({ trashPage }) => {
await trashPage.dataTable.selectItem(file2);
await trashPage.page.waitForTimeout(1500);
await trashPage.dataTable.selectItem(folder2);
await trashPage.dataTable.selectMultiItem(file2, folder2);
await trashPage.acaHeader.permanentlyDeleteButton.click();
await trashPage.deleteDialog.deleteButton.click();

Expand Down
14 changes: 3 additions & 11 deletions e2e/playwright/delete-actions/src/tests/restore.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ test.describe('Restore from Trash', () => {
});

test('[C217182] restore multiple items', async ({ trashPage, personalFiles }) => {
await trashPage.dataTable.selectItem(file2);
await trashPage.page.waitForTimeout(1500);
await trashPage.dataTable.selectItem(folder2);
await trashPage.dataTable.selectMultiItem(file2, folder2);
await trashPage.acaHeader.restoreButton.click();
await trashPage.snackBar.verifySnackBarActionText(`Restore successful`);
const action = await trashPage.snackBar.getSnackBarActionText();
Expand Down Expand Up @@ -225,19 +223,13 @@ test.describe('Restore from Trash', () => {
});

test('[C217183] one failure', async ({ trashPage }) => {
await trashPage.dataTable.selectItem(file1);
await trashPage.page.waitForTimeout(1500);
await trashPage.dataTable.selectItem(file2);
await trashPage.dataTable.selectMultiItem(file1, file2);
await trashPage.acaHeader.restoreButton.click();
await trashPage.snackBar.verifySnackBarActionText(`Can't restore ${file1}, the original location no longer exists`);
});

test('[C217184] multiple failures', async ({ trashPage }) => {
await trashPage.dataTable.selectItem(file3);
await trashPage.page.waitForTimeout(1500);
await trashPage.dataTable.selectItem(file4);
await trashPage.page.waitForTimeout(1500);
await trashPage.dataTable.selectItem(file5);
await trashPage.dataTable.selectMultiItem(file3, file4, file5);
await trashPage.acaHeader.restoreButton.click();
await trashPage.snackBar.verifySnackBarActionText('2 items not restored because of issues with the restore location');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ test.describe('Folders - available actions : ', () => {
test('multiple folders - [C280459]', async ({ personalFiles }) => {
await personalFiles.dataTable.selectMultiItem(testData.folderFavFile.name, testData.folderFile.name);
await personalFiles.dataTable.getRowByName(testData.folderFavFile.name).click({ button: 'right' });
await personalFiles.matMenu.verifyActualMoreActions(testData.multipleSelFile.contextMenu);
await personalFiles.navigate({ remoteUrl: `#/personal-files/${parentId}` });
await personalFiles.page.reload({ waitUntil: 'load' });
await personalFiles.dataTable.selectMultiItem(testData.folderFavFile.name, testData.folderFile.name);
await checkMultipleSelActionsAvailable(personalFiles, testData.multipleSelFile.toolbarPrimary, testData.multipleSelFile.toolbarMore);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class DataTableComponent extends BaseComponent {
}

public pagination = new PaginationComponent(this.page);
body = this.getChild('.adf-datatable-body')
body = this.getChild('.adf-datatable-body');
getEmptyFolderLocator = this.getChild('.adf-empty-folder');
getEmptyContentTitleLocator = this.getChild('adf-empty-content .adf-empty-content__title');
getEmptyContentSubTitleLocator = this.getChild('adf-empty-content .adf-empty-content__subtitle');
Expand Down Expand Up @@ -241,19 +241,18 @@ export class DataTableComponent extends BaseComponent {
const isSelected = await this.isRowSelected(name);
if (!isSelected) {
let row = this.getRowByName(name);
await row.locator('[title="Size"]').click({ modifiers: ['Meta'] });
await row.locator('.adf-datatable-checkbox .mat-checkbox-checked').waitFor({ state: 'attached' });
await row.locator('mat-checkbox').click();
await row.locator('.mat-checkbox-checked').waitFor({ state: 'attached' });
}
}

async selectMultiItem(name: string, name2: string): Promise<void> {
await this.page.keyboard.down('Meta');
let row = this.getRowByName(name);
await row.locator('[title="Size"]').click();
await row.locator('.adf-datatable-checkbox .mat-checkbox-checked').waitFor({ state: 'attached' });
row = this.getRowByName(name2);
await row.locator('[title="Size"]').click();
await row.locator('.adf-datatable-checkbox .mat-checkbox-checked').waitFor({ state: 'attached' });
async selectMultiItem(...names: string[]): Promise<void> {
for (const name of names) {
let row = this.getRowByName(name);
await row.locator('mat-checkbox').click();
await row.locator('.mat-checkbox-checked').waitFor({ state: 'attached' });
await this.page.waitForTimeout(1000);
}
}

async isRowSelected(itemName: string): Promise<boolean> {
Expand Down Expand Up @@ -335,23 +334,23 @@ export class DataTableComponent extends BaseComponent {

async setPaginationTo50(): Promise<void> {
await this.paginationButton.click();
await this.paginationOptions.getByText("50").click();
await this.paginationOptions.getByText('50').click();
}

/**
* Method used to create objects from names and visibility of sites from datatable
*
* @returns an object with sites' names and their corresponding visibility values
*/
*/
async getSitesNameAndVisibility(): Promise<{ [siteName: string]: string }> {
const rowsCount = await this.sitesName.count();
let sitesInfo: { [siteName: string]: string } = {};
for (let i = 0; i < rowsCount; i++) {
let siteVisibilityText = await this.sitesVisibility.nth(i).textContent();
let siteNameText = await this.sitesName.nth(i).textContent();
siteVisibilityText = siteVisibilityText.trim().toUpperCase();
siteNameText = siteNameText.trim();
sitesInfo[siteNameText] = siteVisibilityText;
let siteVisibilityText = await this.sitesVisibility.nth(i).textContent();
let siteNameText = await this.sitesName.nth(i).textContent();
siteVisibilityText = siteVisibilityText.trim().toUpperCase();
siteNameText = siteNameText.trim();
sitesInfo[siteNameText] = siteVisibilityText;
}
return sitesInfo;
}
Expand All @@ -360,16 +359,16 @@ export class DataTableComponent extends BaseComponent {
* Method used to create objects from names and roles of sites from datatable
*
* @returns an object with sites' names and their corresponding role values
*/
*/
async getSitesNameAndRole(): Promise<{ [siteName: string]: string }> {
const rowsCount = await this.sitesName.count();
let sitesInfo: { [siteName: string]: string } = {};
for (let i = 0; i < rowsCount; i++) {
let siteNameText = await this.sitesName.nth(i).textContent();
let siteRoleText = await this.sitesRole.nth(i).textContent();
siteNameText = siteNameText.trim();
siteRoleText = siteRoleText.trim();
sitesInfo[siteNameText] = siteRoleText;
let siteNameText = await this.sitesName.nth(i).textContent();
let siteRoleText = await this.sitesRole.nth(i).textContent();
siteNameText = siteNameText.trim();
siteRoleText = siteRoleText.trim();
sitesInfo[siteNameText] = siteRoleText;
}
return sitesInfo;
}
Expand Down

0 comments on commit 5a87c27

Please sign in to comment.