[ACS-7369] ng15 migration - fix e2es (#3796)

* [ACS-7369] e2e fixes

* [ACS-7369] cr fix
This commit is contained in:
Mykyta Maliarchuk
2024-04-17 10:28:44 +02:00
committed by GitHub
parent b63e8925d4
commit 01ca830dfc
12 changed files with 70 additions and 64 deletions

View File

@@ -78,12 +78,12 @@ test.describe('Create folders', () => {
});
test('[C216345] Create new folder dialog check', async () => {
await expect(folderDialog.getLabelText('Name')).toBeVisible();
await expect(folderDialog.getLabelText('*')).toBeVisible();
// TODO [ACS-7534] add * after it is added to adf placeholder/label
await expect(folderDialog.getElementByPlaceholder('input', 'Name')).toBeVisible();
await expect(folderDialog.folderNameInputLocator).toBeVisible();
await expect(folderDialog.getLabelText('Title')).toBeVisible();
await expect(folderDialog.getElementByPlaceholder('input', 'Title')).toBeVisible();
await expect(folderDialog.folderTitleInput).toBeVisible();
await expect(folderDialog.getLabelText('Description')).toBeVisible();
await expect(folderDialog.getElementByPlaceholder('textarea', 'Description')).toBeVisible();
await expect(folderDialog.folderDescriptionInput).toBeVisible();
await expect(folderDialog.cancelButton).toBeEnabled();
await expect(folderDialog.createButton).toBeDisabled();

View File

@@ -49,8 +49,10 @@ test.describe('Create Libraries ', () => {
let randomLibraryId: string;
let randomLibraryDescription: string;
const libraryDialogTitle = 'Create Library';
const libraryNameLabel = 'Name *';
const libraryIdLabel = 'Library ID *';
// TODO [ACS-7575] add '*' after it is added to the placeholder/label in ADF
const libraryNameLabel = 'Name';
// TODO [ACS-7575] add '*' after it is added to the placeholder/label in ADF
const libraryIdLabel = 'Library ID';
const libraryDescriptionLabel = 'Description';
const publicVisibility = 'Public';
const moderatedVisibility = 'Moderated';
@@ -95,9 +97,9 @@ test.describe('Create Libraries ', () => {
test('[C280024] Create Library dialog UI', async () => {
await expect(libraryDialog.getDialogTitle(libraryDialogTitle)).toBeVisible();
await expect(libraryDialog.getLabelText(libraryNameLabel)).toBeVisible();
await expect(libraryDialog.getLabelText(libraryIdLabel)).toBeVisible();
await expect(libraryDialog.getLabelText(libraryDescriptionLabel)).toBeVisible();
await expect(libraryDialog.getElementByPlaceholder(libraryNameLabel)).toBeVisible();
await expect(libraryDialog.getElementByPlaceholder(libraryIdLabel)).toBeVisible();
await expect(libraryDialog.getElementByPlaceholder(libraryDescriptionLabel)).toBeVisible();
await expect(libraryDialog.getLabelText(publicVisibility)).toBeVisible();
await expect(libraryDialog.getLabelText(publicVisibility)).toBeChecked();
await expect(libraryDialog.getLabelText(privateVisibility)).toBeVisible();
@@ -113,9 +115,9 @@ test.describe('Create Libraries ', () => {
});
test('[C280025] Create a public library', async ({ myLibrariesPage }) => {
await libraryDialog.getLabelText(libraryNameLabel).fill(randomLibraryName);
await expect(libraryDialog.getLabelText(libraryNameLabel)).toHaveValue(randomLibraryName);
await expect(libraryDialog.getLabelText(libraryIdLabel)).toHaveValue(randomLibraryName);
await libraryDialog.getElementByPlaceholder(libraryNameLabel).fill(randomLibraryName);
await expect(libraryDialog.getElementByPlaceholder(libraryNameLabel)).toHaveValue(randomLibraryName);
await expect(libraryDialog.getElementByPlaceholder(libraryIdLabel)).toHaveValue(randomLibraryName);
await libraryDialog.createButton.click();
await expect(libraryBreadcrumb.getItemByTitle(randomLibraryName)).toBeVisible();
@@ -157,17 +159,17 @@ test.describe('Create Libraries ', () => {
await expect(libraryTable.getCellLinkByName(randomLibraryName).and(myLibrariesPage.page.getByTitle(randomLibraryDescription))).toBeVisible();
await libraryTable.getRowByName(randomLibraryName).click();
await libraryViewDetails.click();
await expect(libraryDetails.getNameField('Name').locator('input')).toHaveValue(randomLibraryName);
await expect(libraryDetails.getIdField('Library ID').locator('input')).toHaveValue(randomLibraryId);
await expect(libraryDetails.getVisibilityField('Visibility').getByText(publicVisibility)).toBeVisible();
await expect(libraryDetails.getDescriptionField).toHaveValue(randomLibraryDescription);
expect(await libraryDetails.getNameField('Name').inputValue()).toBe(randomLibraryName);
expect(await libraryDetails.getIdField('Library ID').inputValue()).toBe(randomLibraryId);
await expect(libraryDetails.getVisibilityField('Visibility').locator('.mat-mdc-select-value').getByText(publicVisibility)).toBeVisible();
expect(await libraryDetails.getDescriptionField.inputValue()).toBe(randomLibraryDescription);
createdLibrariesIds.push(randomLibraryId);
});
test('[C280029] Cancel button', async () => {
await expect(libraryDialog.getDialogTitle(libraryDialogTitle)).toBeVisible();
await libraryDialog.getLabelText(libraryNameLabel).fill(randomLibraryName);
await libraryDialog.getElementByPlaceholder(libraryNameLabel).fill(randomLibraryName);
await libraryDialog.cancelButton.click();
await expect(libraryDialog.getDialogTitle(libraryDialogTitle)).toBeHidden();
@@ -210,33 +212,33 @@ test.describe('Create Libraries ', () => {
'a|a'
];
await libraryDialog.getLabelText(libraryNameLabel).fill(randomLibraryName);
await libraryDialog.getElementByPlaceholder(libraryNameLabel).fill(randomLibraryName);
for (const specialLibraryId of idsWithSpecialChars) {
await libraryDialog.getLabelText(libraryIdLabel).clear();
await libraryDialog.getLabelText(libraryIdLabel).fill(specialLibraryId);
await libraryDialog.getElementByPlaceholder(libraryIdLabel).clear();
await libraryDialog.getElementByPlaceholder(libraryIdLabel).fill(specialLibraryId);
await libraryDialog.page.keyboard.press(tabKeyString);
await expect(libraryDialog.getLabelText(libraryIdLabel)).toHaveValue(specialLibraryId);
await expect(libraryDialog.getElementByPlaceholder(libraryIdLabel)).toHaveValue(specialLibraryId);
expect(await libraryDialog.isErrorMessageDisplayed(libraryErrors.useNumbersAndLettersOnly), errorMessageNotPresent).toBe(true);
await expect(libraryDialog.createButton).toBeDisabled();
}
});
test('[C280027] Duplicate library ID', async () => {
await libraryDialog.getLabelText(libraryNameLabel).fill(randomLibraryName);
await libraryDialog.getLabelText(libraryIdLabel).clear();
await libraryDialog.getLabelText(libraryIdLabel).fill(commonLibraryName);
await libraryDialog.getElementByPlaceholder(libraryNameLabel).fill(randomLibraryName);
await libraryDialog.getElementByPlaceholder(libraryIdLabel).clear();
await libraryDialog.getElementByPlaceholder(libraryIdLabel).fill(commonLibraryName);
await libraryDialog.page.keyboard.press(tabKeyString);
await expect(libraryDialog.getLabelText(libraryIdLabel)).toHaveValue(commonLibraryName);
await expect(libraryDialog.getElementByPlaceholder(libraryIdLabel)).toHaveValue(commonLibraryName);
await expect(libraryDialog.createButton).toBeDisabled();
expect(await libraryDialog.isErrorMessageDisplayed(libraryErrors.libraryIdIsNotAvailable), errorMessageNotPresent).toBe(true);
});
test('[C280028] Create library using the ID of a library from the Trashcan', async () => {
await libraryDialog.getLabelText(libraryNameLabel).fill(randomLibraryName);
await libraryDialog.getLabelText(libraryIdLabel).clear();
await libraryDialog.getLabelText(libraryIdLabel).fill(commonTrashLibraryName);
await libraryDialog.getElementByPlaceholder(libraryNameLabel).fill(randomLibraryName);
await libraryDialog.getElementByPlaceholder(libraryIdLabel).clear();
await libraryDialog.getElementByPlaceholder(libraryIdLabel).fill(commonTrashLibraryName);
await libraryDialog.page.keyboard.press(tabKeyString);
await expect(libraryDialog.createButton).toBeEnabled();

View File

@@ -52,7 +52,7 @@ export enum ActionType {
export class ActionsDropdownComponent extends BaseComponent {
private static rootElement = 'aca-rule-action-list';
private getOptionLocator = (optionName: string): Locator => this.page.locator('.mat-select-panel .mat-option-text', { hasText: optionName }).first();
private getOptionLocator = (optionName: string): Locator => this.page.locator('.mat-mdc-select-panel .mdc-list-item__primary-text', { hasText: optionName }).first();
private ruleActionLocator = this.getChild('aca-rule-action');
private addActionButtonLocator = this.getChild('[data-automation-id="rule-action-list-add-action-button"]');
private actionDropdownLocator = this.getChild('[data-automation-id="rule-action-select"]');
@@ -60,7 +60,7 @@ export class ActionsDropdownComponent extends BaseComponent {
private actionCheckInInputLocator = '[data-automation-id="header-description"] input';
private actionAutoDeclareLocator = '[data-automation-id="header-version"] mat-select';
private actionSimpleWorkflowStepInputLocator = '[data-automation-id="header-approve-step"] input';
private actionSimpleWorkflowApproveFolderLocator = `[data-automation-id="header-approve-folder"] input`;
private actionSimpleWorkflowApproveFolderLocator = `[data-automation-id="header-approve-folder"] mat-icon`;
private actionSimpleWorkflowActionChoiceLocator = '[data-automation-id="content-node-selector-actions-choose"]';
private actionSimpleWorkflowLabelApproveLocator = `[data-automation-id="card-boolean-label-approve-move"]`;
private actionSimpleWorkflowSRejectStepLocator = '[data-automation-id="header-reject-step"] input';

View File

@@ -32,10 +32,10 @@ export class AdfInfoDrawerComponent extends BaseComponent {
super(page, AdfInfoDrawerComponent.rootElement);
}
public getNameField = (labelText: string) => this.getChild('[data-automation-id="library-name-properties-wrapper"]', { hasText: labelText });
public getIdField = (labelText: string) => this.getChild('[data-automation-id="library-id-properties-wrapper"]', { hasText: labelText });
public getNameField = (labelText: string) => this.getChild(`[data-automation-id="library-name-properties-wrapper"] input[placeholder='${labelText}']`);
public getIdField = (labelText: string) => this.getChild(`[data-automation-id="library-id-properties-wrapper"] input[placeholder='${labelText}']`);
public getVisibilityField = (labelText: string) =>
this.getChild('[data-automation-id="library-visibility-properties-wrapper"]', { hasText: labelText });
this.getChild(`[data-automation-id="library-visibility-properties-wrapper"] mat-select[ng-reflect-placeholder='${labelText}']`);
public getDescriptionField = this.getChild('[data-automation-id="library-description-properties-wrapper"] textarea');
public propertiesTab = this.page.getByRole('tab', { name: 'Properties' });
public commentsTab = this.page.getByRole('tab', { name: 'Comments' });
@@ -52,14 +52,14 @@ export class AdfInfoDrawerComponent extends BaseComponent {
public editButton = this.page.getByRole('button', { name: 'Edit' });
public cancelButton = this.page.getByRole('button', { name: 'Cancel' });
public updateButton = this.page.getByRole('button', { name: 'Update' });
public hintMessage = this.page.locator('.mat-hint');
public errorMessage = this.page.locator('.mat-error');
public hintMessage = this.page.locator('mat-hint');
public errorMessage = this.page.locator('mat-error');
public expandDetailsButton = this.getChild(`button[title='Expand panel']`);
public expandedDetailsTabs = this.page.locator('.aca-details-container .mat-tab-label-content');
public expandedDetailsTabs = this.page.locator('.aca-details-container .mdc-tab__text-label');
public expandedDetailsPermissionsTab = this.expandedDetailsTabs.getByText('Permissions');
public nameField = this.page.locator('label', { hasText: 'Name' });
public idField = this.page.locator('label', { hasText: 'Library ID' });
public descriptionField = this.page.locator('label', { hasText: 'Description' });
public nameField = this.page.locator('input[placeholder=Name]');
public idField = this.page.locator(`input[placeholder='Library ID']`);
public descriptionField = this.page.locator('textarea[placeholder=Description]');
public visibilityField = this.infoDrawerPanel.getByRole('combobox');
public selectVisibility = (visibilityOption: string) => this.page.getByRole('listbox').getByRole('option', { name: visibilityOption }).click();

View File

@@ -39,7 +39,7 @@ export enum Comparator {
}
export class ConditionComponent extends ManageRulesDialogComponent {
private getOptionLocator = (optionName: string): Locator => this.page.locator(`.cdk-overlay-pane .mat-option span`, { hasText: optionName });
private getOptionLocator = (optionName: string): Locator => this.page.locator(`.cdk-overlay-pane .mat-mdc-option span`, { hasText: optionName });
private async selectField(fields: Partial<Field>, index: number): Promise<void> {
await this.fieldDropDown.nth(index).click();

View File

@@ -26,7 +26,7 @@ import { Page, expect } from '@playwright/test';
import { BaseComponent } from '../base.component';
export class MatMenuComponent extends BaseComponent {
private static rootElement = '.mat-menu-content';
private static rootElement = '.mat-mdc-menu-content';
constructor(page: Page) {
super(page, MatMenuComponent.rootElement);
@@ -39,8 +39,8 @@ export class MatMenuComponent extends BaseComponent {
public createFileFromTemplate = this.getChild('[id="app.create.fileFromTemplate"]');
public createLibrary = this.getChild('[id="app.create.library"]');
public getButtonByText = (text: string) => this.getChild('button', { hasText: text });
public cancelEditingAction = this.getChild(`.mat-menu-item[title='Cancel Editing']`);
public editOfflineAction = this.getChild(`.mat-menu-item[title='Edit Offline']`);
public cancelEditingAction = this.getChild(`.mat-mdc-menu-item[title='Cancel Editing']`);
public editOfflineAction = this.getChild(`.mat-mdc-menu-item[title='Edit Offline']`);
async clickMenuItem(menuItem: string): Promise<void> {
const menuElement = this.getButtonByText(menuItem);
@@ -56,11 +56,11 @@ export class MatMenuComponent extends BaseComponent {
}
async verifyActualMoreActions(expectedToolbarMore: string[]): Promise<void> {
await this.page.locator('.mat-menu-content').waitFor({ state: 'attached' });
let menus = await this.page.$$('.mat-menu-content .mat-menu-item');
await this.page.locator('.mat-mdc-menu-content').waitFor({ state: 'attached' });
let menus = await this.page.$$('.mat-mdc-menu-content .mat-mdc-menu-item');
let actualMoreActions: string[] = await Promise.all(
menus.map(async (button) => {
const title = await (await button.$('span')).innerText();
const title = await (await button.$('.mdc-list-item__primary-text span')).innerText();
return title || '';
})
);

View File

@@ -39,7 +39,7 @@ export class AdfFolderDialogComponent extends BaseComponent {
super(page, AdfFolderDialogComponent.rootElement);
}
public getLabelText = (text: string) => this.getChild('label', { hasText: text });
public getElementByPlaceholder = (element:string, text: string) => this.getChild(`${element}[placeholder='${text}']`);
/**
* This method is used when we want to fill in Create new Folder Dialog and choose Create button

View File

@@ -37,7 +37,8 @@ export class AdfLibraryDialogComponent extends BaseComponent {
}
public getLabelText = (text: string) => this.getChild('label', { hasText: text });
public getDialogTitle = (text: string) => this.getChild('.mat-dialog-title', { hasText: text });
public getElementByPlaceholder = (text: string) => this.page.getByPlaceholder(text);
public getDialogTitle = (text: string) => this.getChild('.mat-mdc-dialog-title', { hasText: text });
public getErrorByText = (text: string): Locator => this.page.locator('mat-error', {hasText: text});
/**
@@ -49,10 +50,13 @@ export class AdfLibraryDialogComponent extends BaseComponent {
* @param visibility visibility of the library
*/
async createLibraryWithNameAndId(nameInput: string, libraryIdInput: string, descriptionInput?: string, visibility?: string): Promise<void> {
await this.getLabelText('Name *').fill(nameInput);
await this.getLabelText('Library ID *').clear();
await this.getLabelText('Library ID *').fill(libraryIdInput);
if (descriptionInput) { await this.getLabelText('Description').fill(descriptionInput); }
// TODO [ACS-7575] add '*' after it is added to the placeholder/label in ADF
await this.getElementByPlaceholder('Name').fill(nameInput);
// TODO [ACS-7575] add '*' after it is added to the placeholder/label in ADF
await this.getElementByPlaceholder('Library ID').clear();
// TODO [ACS-7575] add '*' after it is added to the placeholder/label in ADF
await this.getElementByPlaceholder('Library ID').fill(libraryIdInput);
if (descriptionInput) { await this.getElementByPlaceholder('Description').fill(descriptionInput); }
if (visibility) { await this.getLabelText(visibility).click(); }
await this.createButton.click();
await this.spinnerWaitForReload();

View File

@@ -34,9 +34,9 @@ export class ContentNodeSelectorDialog extends BaseComponent {
public cancelButton = this.getChild('[data-automation-id="content-node-selector-actions-cancel"]');
public actionButton = this.getChild('[data-automation-id="content-node-selector-actions-choose"]');
public locationDropDown = this.getChild('[id="site-dropdown-container"]');
public locationDropDown = this.getChild('[id="site-dropdown-container"] mat-form-field');
private selectedRow = this.getChild('.adf-is-selected');
getOptionLocator = (optionName: string): Locator => this.page.locator('.mat-select-panel .mat-option-text', { hasText: optionName });
getOptionLocator = (optionName: string): Locator => this.page.locator('.mat-mdc-select-panel .mdc-list-item__primary-text', { hasText: optionName });
private getRowByName = (name: string | number): Locator => this.getChild(`adf-datatable-row`, { hasText: name.toString() });
getDialogTitle = (text: string) => this.getChild('[data-automation-id="content-node-selector-title"]', { hasText: text });
getBreadcrumb = (text: string) => this.getChild('[data-automation-id="current-folder"]', { hasText: text });

View File

@@ -29,7 +29,7 @@ export class ManageRules extends BaseComponent {
private static rootElement = '.aca-manage-rules';
public getGroupsList = (optionName: string): Locator => this.getChild('.aca-rule-list-item__header', { hasText: optionName });
public disableRuleToggle = this.getChild('.aca-manage-rules__container .mat-slide-toggle-bar').first();
public disableRuleToggle = this.getChild('.aca-manage-rules__container .mdc-switch__track').first();
constructor(page: Page) {
super(page, ManageRules.rootElement);

View File

@@ -28,9 +28,9 @@ import { BaseComponent } from '.././base.component';
export class SearchOverlayComponent extends BaseComponent {
private static rootElement = '.cdk-overlay-pane';
public searchFilesOption = this.getChild('label[for="content-input"]');
public searchFoldersOption = this.getChild('label[for="folder-input"]');
public searchLibrariesOption = this.getChild('label[for="libraries-input"]');
public searchFilesOption = this.getChild('input#content-input');
public searchFoldersOption = this.getChild('input#folder-input');
public searchLibrariesOption = this.getChild('input#libraries-input');
public searchInput = this.page.locator('#app-control-input');
public searchButton = this.page.locator('#app-search-button');
public searchInputControl = this.page.locator('.app-search-control');
@@ -42,17 +42,17 @@ export class SearchOverlayComponent extends BaseComponent {
async isFoldersOptionChecked() {
const optClass = await this.searchFoldersOption.getAttribute('class');
return optClass.includes('mat-checkbox-checked');
return optClass.includes('mat-mdc-checkbox-checked');
}
async isFilesOptionChecked() {
const optClass = await this.searchFilesOption.getAttribute('class');
return optClass.includes('mat-checkbox-checked');
return optClass.includes('mat-mdc-checkbox-checked');
}
async isLibrariesOptionChecked() {
const optClass = await this.searchLibrariesOption.getAttribute('class');
return optClass.includes('mat-checkbox-checked');
return optClass.includes('mat-mdc-checkbox-checked');
}
async clearOptions() {

View File

@@ -33,8 +33,8 @@ export class SearchSortingPicker extends BaseComponent {
public actionMenu = this.page.locator('[data-automation-id="auto_header_content_id_$thumbnail"]');
public sortOrderButton = this.page.locator('#aca-button-sorting-menu');
public sortByDropdownExpanded = this.page.locator('.mat-menu-panel').first();
public sortByList = this.page.locator('.mat-menu-panel button');
public sortByDropdownExpanded = this.page.locator('.mat-mdc-menu-panel').first();
public sortByList = this.page.locator('.mat-mdc-menu-panel button');
constructor(page: Page, rootElement = SearchSortingPicker.rootElement) {
super(page, rootElement);
@@ -76,7 +76,7 @@ export class SearchSortingPicker extends BaseComponent {
await this.clickSortByDropdown();
}
const elem = this.sortByList.getByText(option);
const optionId = await elem.getAttribute('id');
const optionId = await elem.locator("..").getAttribute('id');
await elem.click();
const directionSortElement = this.page.locator(`[id="${optionId}-${direction.toLocaleLowerCase()}"]`);
await directionSortElement.click();