mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-10-08 14:51:32 +00:00
[ADF-4900] Card View and Metadata Components refactoring (#5592)
* [ADF-4900] Card View and Metadata Components refactoring * CSS linting * Unit test excluded * Rebase branch * Fix unit tests * Fix linting * Fix e2e tests * Fix 2e2 tests * Fix process-services e2e tests * More fixes * Fix more e2e tests * Fix unit test * Improve flaky unit test * Fix process services e2e tests * Update Process Header Cloud Page * Fix linting * Fix timing issue * Lintintg * Fix selectors * Fix e2e tests * Fix timing issue * Fix C260328 * Fix spellcheck * save screenshot * performance issue * Fix unit tests and e2e tests * fix e2e * refactoring * fix lint * fix e2e * Fix C309698 * fix other e2e * fix lint * increase timeout Co-authored-by: Eugenio Romano <eugenio.romano@alfresco.com>
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { by, element, ElementFinder } from 'protractor';
|
||||
import { by, element, ElementFinder, Key, protractor } from 'protractor';
|
||||
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
|
||||
|
||||
export class MetadataViewPage {
|
||||
@@ -23,15 +23,15 @@ export class MetadataViewPage {
|
||||
title: ElementFinder = element(by.css(`div[info-drawer-title]`));
|
||||
expandedAspect: ElementFinder = element(by.css(`mat-expansion-panel-header[aria-expanded='true']`));
|
||||
aspectTitle = by.css(`mat-panel-title`);
|
||||
name: ElementFinder = element(by.css(`span[data-automation-id='card-textitem-value-name'] span`));
|
||||
creator: ElementFinder = element(by.css(`span[data-automation-id='card-textitem-value-createdByUser.displayName'] span`));
|
||||
name: ElementFinder = element(by.css(`[data-automation-id='card-textitem-value-name']`));
|
||||
creator: ElementFinder = element(by.css(`[data-automation-id='card-textitem-value-createdByUser.displayName']`));
|
||||
createdDate: ElementFinder = element(by.css(`span[data-automation-id='card-dateitem-createdAt'] span`));
|
||||
modifier: ElementFinder = element(by.css(`span[data-automation-id='card-textitem-value-modifiedByUser.displayName'] span`));
|
||||
modifier: ElementFinder = element(by.css(`[data-automation-id='card-textitem-value-modifiedByUser.displayName']`));
|
||||
modifiedDate: ElementFinder = element(by.css(`span[data-automation-id='card-dateitem-modifiedAt'] span`));
|
||||
mimetypeName: ElementFinder = element(by.css(`span[data-automation-id='card-textitem-value-content.mimeTypeName']`));
|
||||
size: ElementFinder = element(by.css(`span[data-automation-id='card-textitem-value-content.sizeInBytes']`));
|
||||
description: ElementFinder = element(by.css(`span[data-automation-id='card-textitem-value-properties.cm:description'] span`));
|
||||
author: ElementFinder = element(by.css(`span[data-automation-id='card-textitem-value-properties.cm:author'] span`));
|
||||
mimetypeName: ElementFinder = element(by.css(`[data-automation-id='card-textitem-value-content.mimeTypeName']`));
|
||||
size: ElementFinder = element(by.css(`[data-automation-id='card-textitem-value-content.sizeInBytes']`));
|
||||
description: ElementFinder = element(by.css(`span[data-automation-id='card-textitem-value-properties.cm:description']`));
|
||||
author: ElementFinder = element(by.css(`[data-automation-id='card-textitem-value-properties.cm:author']`));
|
||||
titleProperty: ElementFinder = element(by.css(`span[data-automation-id='card-textitem-value-properties.cm:title'] span`));
|
||||
editIcon: ElementFinder = element(by.css(`button[data-automation-id='meta-data-card-toggle-edit']`));
|
||||
informationButton: ElementFinder = element(by.css(`button[data-automation-id='meta-data-card-toggle-expand']`));
|
||||
@@ -45,6 +45,8 @@ export class MetadataViewPage {
|
||||
closeButton: ElementFinder = element(by.cssContainingText('button.mat-button span', 'Close'));
|
||||
displayAspect: ElementFinder = element(by.css(`input[placeholder='Display Aspect']`));
|
||||
applyAspect: ElementFinder = element(by.cssContainingText(`button span.mat-button-wrapper`, 'Apply Aspect'));
|
||||
saveMetadataButton: ElementFinder = element(by.css(`[data-automation-id='save-metadata']`));
|
||||
resetMetadataButton: ElementFinder = element(by.css(`[data-automation-id='reset-metadata']`));
|
||||
|
||||
async getTitle(): Promise<string> {
|
||||
return BrowserActions.getText(this.title);
|
||||
@@ -55,11 +57,11 @@ export class MetadataViewPage {
|
||||
}
|
||||
|
||||
async getName(): Promise<string> {
|
||||
return BrowserActions.getText(this.name);
|
||||
return BrowserActions.getInputValue(this.name);
|
||||
}
|
||||
|
||||
async getCreator(): Promise<string> {
|
||||
return BrowserActions.getText(this.creator);
|
||||
return BrowserActions.getInputValue(this.creator);
|
||||
}
|
||||
|
||||
async getCreatedDate(): Promise<string> {
|
||||
@@ -67,7 +69,7 @@ export class MetadataViewPage {
|
||||
}
|
||||
|
||||
async getModifier(): Promise<string> {
|
||||
return BrowserActions.getText(this.modifier);
|
||||
return BrowserActions.getInputValue(this.modifier);
|
||||
}
|
||||
|
||||
async getModifiedDate(): Promise<string> {
|
||||
@@ -75,19 +77,19 @@ export class MetadataViewPage {
|
||||
}
|
||||
|
||||
async getMimetypeName(): Promise<string> {
|
||||
return BrowserActions.getText(this.mimetypeName);
|
||||
return BrowserActions.getInputValue(this.mimetypeName);
|
||||
}
|
||||
|
||||
async getSize(): Promise<string> {
|
||||
return BrowserActions.getText(this.size);
|
||||
return BrowserActions.getInputValue(this.size);
|
||||
}
|
||||
|
||||
async getDescription(): Promise<string> {
|
||||
return BrowserActions.getText(this.description);
|
||||
return BrowserActions.getInputValue(this.description);
|
||||
}
|
||||
|
||||
async getAuthor(): Promise<string> {
|
||||
return BrowserActions.getText(this.author);
|
||||
return BrowserActions.getInputValue(this.author);
|
||||
}
|
||||
|
||||
async getTitleProperty(): Promise<string> {
|
||||
@@ -136,61 +138,44 @@ export class MetadataViewPage {
|
||||
}
|
||||
|
||||
async editPropertyIconIsDisplayed(propertyName: string) {
|
||||
const editPropertyIcon: ElementFinder = element(by.css('button[data-automation-id="card-textitem-edit-icon-' + propertyName + '"]'));
|
||||
const editPropertyIcon: ElementFinder = element(by.css('[data-automation-id="header-' + propertyName + '"] .adf-textitem-edit-icon'));
|
||||
await BrowserVisibility.waitUntilElementIsPresent(editPropertyIcon);
|
||||
}
|
||||
|
||||
async updatePropertyIconIsDisplayed(propertyName: string) {
|
||||
const updatePropertyIcon: ElementFinder = element(by.css('button[data-automation-id="card-textitem-update-' + propertyName + '"]'));
|
||||
await BrowserVisibility.waitUntilElementIsVisible(updatePropertyIcon);
|
||||
}
|
||||
|
||||
async clickUpdatePropertyIcon(propertyName: string): Promise<void> {
|
||||
const updatePropertyIcon: ElementFinder = element(by.css('button[data-automation-id="card-textitem-update-' + propertyName + '"]'));
|
||||
await BrowserActions.click(updatePropertyIcon);
|
||||
}
|
||||
|
||||
async clickClearPropertyIcon(propertyName: string): Promise<void> {
|
||||
const clearPropertyIcon: ElementFinder = element(by.css('button[data-automation-id="card-textitem-reset-' + propertyName + '"]'));
|
||||
async clickResetButton(): Promise<void> {
|
||||
const clearPropertyIcon: ElementFinder = element(by.css('button[data-automation-id="reset-metadata"]'));
|
||||
await BrowserActions.click(clearPropertyIcon);
|
||||
}
|
||||
|
||||
async enterPropertyText(propertyName: string, text: string | number): Promise<void> {
|
||||
const textField: ElementFinder = element(by.css('input[data-automation-id="card-textitem-editinput-' + propertyName + '"]'));
|
||||
const textField: ElementFinder = element(by.css('input[data-automation-id="card-textitem-value-' + propertyName + '"]'));
|
||||
await BrowserActions.clearSendKeys(textField, text.toString());
|
||||
await textField.sendKeys(protractor.Key.ENTER);
|
||||
}
|
||||
|
||||
async enterPresetText(text: string): Promise<void> {
|
||||
const presetField: ElementFinder = element(by.css('input[data-automation-id="adf-text-custom-preset"]'));
|
||||
await BrowserActions.clearSendKeys(presetField, text);
|
||||
await BrowserActions.clearSendKeys(presetField, text.toString());
|
||||
await presetField.sendKeys(protractor.Key.ENTER);
|
||||
const applyButton: ElementFinder = element(by.css('button[id="adf-metadata-aplly"]'));
|
||||
await BrowserActions.click(applyButton);
|
||||
}
|
||||
|
||||
async enterDescriptionText(text: string): Promise<void> {
|
||||
const textField: ElementFinder = element(by.css('textarea[data-automation-id="card-textitem-edittextarea-properties.cm:description"]'));
|
||||
const textField: ElementFinder = element(by.css('textarea[data-automation-id="card-textitem-value-properties.cm:description"]'));
|
||||
await BrowserActions.clearSendKeys(textField, text);
|
||||
await textField.sendKeys(Key.TAB);
|
||||
}
|
||||
|
||||
async getPropertyText(propertyName: string, type?: string): Promise<string> {
|
||||
const propertyType = type || 'textitem';
|
||||
const textField: ElementFinder = element(by.css('span[data-automation-id="card-' + propertyType + '-value-' + propertyName + '"]'));
|
||||
const textField: ElementFinder = element(by.css('[data-automation-id="card-' + propertyType + '-value-' + propertyName + '"]'));
|
||||
|
||||
return BrowserActions.getText(textField);
|
||||
}
|
||||
|
||||
async clearPropertyIconIsDisplayed(propertyName: string): Promise<void> {
|
||||
const clearPropertyIcon: ElementFinder = element(by.css('button[data-automation-id="card-textitem-reset-' + propertyName + '"]'));
|
||||
await BrowserVisibility.waitUntilElementIsVisible(clearPropertyIcon);
|
||||
}
|
||||
|
||||
async clickEditPropertyIcons(propertyName: string): Promise<void> {
|
||||
const editPropertyIcon: ElementFinder = element(by.css('button[data-automation-id="card-textitem-edit-icon-' + propertyName + '"]'));
|
||||
await BrowserActions.click(editPropertyIcon);
|
||||
return BrowserActions.getInputValue(textField);
|
||||
}
|
||||
|
||||
async getPropertyIconTooltip(propertyName: string): Promise<string> {
|
||||
const editPropertyIcon: ElementFinder = element(by.css('button[data-automation-id="card-textitem-edit-icon-' + propertyName + '"]'));
|
||||
const editPropertyIcon: ElementFinder = element(by.css('[data-automation-id="header-' + propertyName + '"] .adf-textitem-edit-icon'));
|
||||
return editPropertyIcon.getAttribute('title');
|
||||
}
|
||||
|
||||
@@ -247,4 +232,12 @@ export class MetadataViewPage {
|
||||
async clickApplyAspect(): Promise<void> {
|
||||
await BrowserActions.click(this.applyAspect);
|
||||
}
|
||||
|
||||
async clickSaveMetadata(): Promise<void> {
|
||||
await BrowserActions.click(this.saveMetadataButton);
|
||||
}
|
||||
|
||||
async clickResetMetadata(): Promise<void> {
|
||||
await BrowserActions.click(this.resetMetadataButton);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user