[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:
davidcanonieto
2020-04-27 00:09:52 +01:00
committed by GitHub
co-authored by Eugenio Romano
parent ebfeb053ce
commit 8f68899ce0
65 changed files with 1211 additions and 1214 deletions
@@ -4,7 +4,7 @@
<mat-card class="app-card-view"> <mat-card class="app-card-view">
<adf-card-view <adf-card-view
[properties]="properties" [properties]="properties"
[editable]="true" [editable]="isEditable"
[displayClearAction]="showClearDateAction" [displayClearAction]="showClearDateAction"
[displayNoneOption]="showNoneOption"> [displayNoneOption]="showNoneOption">
</adf-card-view> </adf-card-view>
@@ -78,8 +78,43 @@ export class CardViewComponent implements OnInit, OnDestroy {
value: 'Spock', value: 'Spock',
key: 'name', key: 'name',
default: 'default bar', default: 'default bar',
editable: this.isEditable
}),
new CardViewTextItemModel({
label: 'CardView Text Item - Protected value',
value: 'Spock',
key: 'name',
default: 'default bar',
multiline: false, multiline: false,
icon: 'icon', icon: 'icon',
editable: false
}),
new CardViewTextItemModel({
label: 'CardView Text Item - Multiline',
value: 'Spock',
key: 'name',
default: 'default bar',
multiline: true,
icon: 'icon',
editable: this.isEditable
}),
new CardViewTextItemModel({
label: 'CardView Text Item - Default Value',
value: '',
key: 'name',
default: 'default bar',
multiline: false,
icon: 'icon',
editable: this.isEditable
}),
new CardViewTextItemModel({
label: 'CardView Text Item - Multivalue (chips)',
value: [1, 2, 3],
key: 'name',
default: 'default bar',
multiline: true,
multivalued: true,
icon: 'icon',
editable: this.isEditable editable: this.isEditable
}), }),
new CardViewDateItemModel({ new CardViewDateItemModel({
@@ -105,6 +140,13 @@ export class CardViewComponent implements OnInit, OnDestroy {
default: false, default: false,
editable: this.isEditable editable: this.isEditable
}), }),
new CardViewBoolItemModel({
label: 'Agree to all terms and conditions',
value: true,
key: 'boolean',
default: false,
editable: this.isEditable
}),
new CardViewIntItemModel({ new CardViewIntItemModel({
label: 'CardView Int Item', label: 'CardView Int Item',
value: 213, value: 213,
@@ -122,10 +164,16 @@ export class CardViewComponent implements OnInit, OnDestroy {
}), }),
new CardViewKeyValuePairsItemModel({ new CardViewKeyValuePairsItemModel({
label: 'CardView Key-Value Pairs Item', label: 'CardView Key-Value Pairs Item',
value: [], value: [{ name: 'hey', value: 'you' }, { name: 'hey', value: 'you' }],
key: 'key-value-pairs', key: 'key-value-pairs',
editable: this.isEditable editable: this.isEditable
}), }),
new CardViewKeyValuePairsItemModel({
label: 'CardView Key-Value Pairs Item',
value: [{ name: 'hey', value: 'you' }, { name: 'hey', value: 'you' }],
key: 'key-value-pairs',
editable: false
}),
new CardViewSelectItemModel({ new CardViewSelectItemModel({
label: 'CardView Select Item', label: 'CardView Select Item',
value: 'one', value: 'one',
@@ -146,6 +194,7 @@ export class CardViewComponent implements OnInit, OnDestroy {
default: 'click here', default: 'click here',
editable: this.isEditable, editable: this.isEditable,
clickable: true, clickable: true,
icon: 'close',
clickCallBack: () => { clickCallBack: () => {
this.respondToCardClick(); this.respondToCardClick();
} }
@@ -161,7 +210,8 @@ export class CardViewComponent implements OnInit, OnDestroy {
key: 'array', key: 'array',
icon: 'edit', icon: 'edit',
default: 'Empty', default: 'Empty',
noOfItemsToDisplay: 2 noOfItemsToDisplay: 2,
editable: this.isEditable
}) })
]; ];
} }
@@ -49,7 +49,7 @@
[color]="'primary'" [color]="'primary'"
(change)="toggleMulti()" (change)="toggleMulti()"
[checked]="multi"> [checked]="multi">
multi accordion Multi accordion
</mat-slide-toggle> </mat-slide-toggle>
</p> </p>
@@ -59,7 +59,7 @@
[color]="'primary'" [color]="'primary'"
(change)="toggleReadOnly()" (change)="toggleReadOnly()"
[checked]="isReadOnly"> [checked]="isReadOnly">
Editable Read Only
</mat-slide-toggle> </mat-slide-toggle>
</p> </p>
@@ -171,28 +171,18 @@ describe('Metadata component', () => {
await expect(await metadataViewPage.getPropertyIconTooltip('properties.cm:title')).toEqual('Edit'); await expect(await metadataViewPage.getPropertyIconTooltip('properties.cm:title')).toEqual('Edit');
await expect(await metadataViewPage.getPropertyIconTooltip('properties.cm:description')).toEqual('Edit'); await expect(await metadataViewPage.getPropertyIconTooltip('properties.cm:description')).toEqual('Edit');
await metadataViewPage.clickEditPropertyIcons('name');
await metadataViewPage.updatePropertyIconIsDisplayed('name');
await metadataViewPage.clearPropertyIconIsDisplayed('name');
await metadataViewPage.enterPropertyText('name', 'exampleText'); await metadataViewPage.enterPropertyText('name', 'exampleText');
await metadataViewPage.clickClearPropertyIcon('name'); await metadataViewPage.clickResetMetadata();
await expect(await metadataViewPage.getPropertyText('name')).toEqual(browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name); await expect(await metadataViewPage.getPropertyText('name')).toEqual(browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name);
await metadataViewPage.clickEditPropertyIcons('name');
await metadataViewPage.enterPropertyText('name', 'exampleText.png'); await metadataViewPage.enterPropertyText('name', 'exampleText.png');
await metadataViewPage.clickUpdatePropertyIcon('name');
await expect(await metadataViewPage.getPropertyText('name')).toEqual('exampleText.png');
await metadataViewPage.clickEditPropertyIcons('properties.cm:title');
await metadataViewPage.enterPropertyText('properties.cm:title', 'example title'); await metadataViewPage.enterPropertyText('properties.cm:title', 'example title');
await metadataViewPage.clickUpdatePropertyIcon('properties.cm:title');
await expect(await metadataViewPage.getPropertyText('properties.cm:title')).toEqual('example title');
await metadataViewPage.clickEditPropertyIcons('properties.cm:description');
await metadataViewPage.enterDescriptionText('example description'); await metadataViewPage.enterDescriptionText('example description');
await metadataViewPage.clickUpdatePropertyIcon('properties.cm:description');
await expect(await metadataViewPage.getPropertyText('name')).toEqual('exampleText.png');
await expect(await metadataViewPage.getPropertyText('properties.cm:title')).toEqual('example title');
await expect(await metadataViewPage.getPropertyText('properties.cm:description')).toEqual('example description'); await expect(await metadataViewPage.getPropertyText('properties.cm:description')).toEqual('example description');
await metadataViewPage.clickSaveMetadata();
await viewerPage.clickCloseButton(); await viewerPage.clickCloseButton();
await contentServicesPage.waitForTableBody(); await contentServicesPage.waitForTableBody();
@@ -208,10 +198,9 @@ describe('Metadata component', () => {
await expect(await metadataViewPage.getPropertyText('properties.cm:description')).toEqual('example description'); await expect(await metadataViewPage.getPropertyText('properties.cm:description')).toEqual('example description');
await metadataViewPage.editIconClick(); await metadataViewPage.editIconClick();
await metadataViewPage.clickEditPropertyIcons('name');
await metadataViewPage.enterPropertyText('name', browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name); await metadataViewPage.enterPropertyText('name', browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name);
await metadataViewPage.clickUpdatePropertyIcon('name');
await expect(await metadataViewPage.getPropertyText('name')).toEqual(browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name); await expect(await metadataViewPage.getPropertyText('name')).toEqual(browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name);
await metadataViewPage.clickSaveMetadata();
}); });
it('[C260181] Should be possible edit all the metadata aspect', async () => { it('[C260181] Should be possible edit all the metadata aspect', async () => {
@@ -228,19 +217,13 @@ describe('Metadata component', () => {
await metadataViewPage.editIconClick(); await metadataViewPage.editIconClick();
await metadataViewPage.clickEditPropertyIcons('properties.exif:software');
await metadataViewPage.enterPropertyText('properties.exif:software', 'test custom text software'); await metadataViewPage.enterPropertyText('properties.exif:software', 'test custom text software');
await metadataViewPage.clickUpdatePropertyIcon('properties.exif:software');
await expect(await metadataViewPage.getPropertyText('properties.exif:software')).toEqual('test custom text software');
await metadataViewPage.clickEditPropertyIcons('properties.exif:isoSpeedRatings');
await metadataViewPage.enterPropertyText('properties.exif:isoSpeedRatings', 'test custom text isoSpeedRatings'); await metadataViewPage.enterPropertyText('properties.exif:isoSpeedRatings', 'test custom text isoSpeedRatings');
await metadataViewPage.clickUpdatePropertyIcon('properties.exif:isoSpeedRatings');
await expect(await metadataViewPage.getPropertyText('properties.exif:isoSpeedRatings')).toEqual('test custom text isoSpeedRatings');
await metadataViewPage.clickEditPropertyIcons('properties.exif:fNumber');
await metadataViewPage.enterPropertyText('properties.exif:fNumber', 22); await metadataViewPage.enterPropertyText('properties.exif:fNumber', 22);
await metadataViewPage.clickUpdatePropertyIcon('properties.exif:fNumber'); await metadataViewPage.clickSaveMetadata();
await expect(await metadataViewPage.getPropertyText('properties.exif:isoSpeedRatings')).toEqual('test custom text isoSpeedRatings');
await expect(await metadataViewPage.getPropertyText('properties.exif:software')).toEqual('test custom text software');
await expect(await metadataViewPage.getPropertyText('properties.exif:fNumber')).toEqual('22'); await expect(await metadataViewPage.getPropertyText('properties.exif:fNumber')).toEqual('22');
}); });
}); });
@@ -253,7 +236,6 @@ describe('Metadata component', () => {
await loginPage.loginToContentServicesUsingUserModel(acsUser); await loginPage.loginToContentServicesUsingUserModel(acsUser);
await navigationBarPage.clickContentServicesButton(); await navigationBarPage.clickContentServicesButton();
await contentServicesPage.waitForTableBody(); await contentServicesPage.waitForTableBody();
}); });
it('[C261157] Should be possible use the metadata component When the node is a Folder', async () => { it('[C261157] Should be possible use the metadata component When the node is a Folder', async () => {
@@ -269,19 +251,16 @@ describe('Metadata component', () => {
await metadataViewPage.editIconClick(); await metadataViewPage.editIconClick();
await metadataViewPage.clickEditPropertyIcons('name');
await metadataViewPage.enterPropertyText('name', 'newnameFolder'); await metadataViewPage.enterPropertyText('name', 'newnameFolder');
await metadataViewPage.clickClearPropertyIcon('name'); await metadataViewPage.clickResetButton();
await expect(await metadataViewPage.getPropertyText('name')).toEqual(folderName); await expect(await metadataViewPage.getPropertyText('name')).toEqual(folderName);
await metadataViewPage.clickEditPropertyIcons('name');
await metadataViewPage.enterPropertyText('name', 'newnameFolder'); await metadataViewPage.enterPropertyText('name', 'newnameFolder');
await metadataViewPage.clickUpdatePropertyIcon('name'); await metadataViewPage.clickSaveMetadata();
await expect(await metadataViewPage.getPropertyText('name')).toEqual('newnameFolder'); await expect(await metadataViewPage.getPropertyText('name')).toEqual('newnameFolder');
await metadataViewPage.clickEditPropertyIcons('name');
await metadataViewPage.enterPropertyText('name', folderName); await metadataViewPage.enterPropertyText('name', folderName);
await metadataViewPage.clickUpdatePropertyIcon('name'); await metadataViewPage.clickSaveMetadata();
await expect(await metadataViewPage.getPropertyText('name')).toEqual(folderName); await expect(await metadataViewPage.getPropertyText('name')).toEqual(folderName);
}); });
}); });
@@ -300,9 +279,8 @@ describe('Metadata component', () => {
await metadataViewPage.editIconClick(); await metadataViewPage.editIconClick();
await metadataViewPage.clickEditPropertyIcons('properties.cm:description');
await metadataViewPage.enterDescriptionText('check author example description'); await metadataViewPage.enterDescriptionText('check author example description');
await metadataViewPage.clickUpdatePropertyIcon('properties.cm:description'); await metadataViewPage.clickSaveMetadata();
await expect(await metadataViewPage.getPropertyText('properties.cm:description')).toEqual('check author example description'); await expect(await metadataViewPage.getPropertyText('properties.cm:description')).toEqual('check author example description');
await loginPage.loginToContentServicesUsingUserModel(acsUser); await loginPage.loginToContentServicesUsingUserModel(acsUser);
@@ -359,9 +359,7 @@ describe('Permissions Component', () => {
await metadataViewPage.editIconIsDisplayed(); await metadataViewPage.editIconIsDisplayed();
await metadataViewPage.editIconClick(); await metadataViewPage.editIconClick();
await metadataViewPage.editPropertyIconIsDisplayed('properties.cm:title'); await metadataViewPage.editPropertyIconIsDisplayed('properties.cm:title');
await metadataViewPage.clickEditPropertyIcons('properties.cm:title');
await metadataViewPage.enterPropertyText('properties.cm:title', 'newTitle1'); await metadataViewPage.enterPropertyText('properties.cm:title', 'newTitle1');
await metadataViewPage.clickUpdatePropertyIcon('properties.cm:title');
await expect(await metadataViewPage.getPropertyText('properties.cm:title')).toEqual('newTitle1'); await expect(await metadataViewPage.getPropertyText('properties.cm:title')).toEqual('newTitle1');
await metadataViewPage.clickCloseButton(); await metadataViewPage.clickCloseButton();
await contentServicesPage.uploadFile(fileLocation); await contentServicesPage.uploadFile(fileLocation);
@@ -383,9 +381,7 @@ describe('Permissions Component', () => {
await metadataViewPage.editIconIsDisplayed(); await metadataViewPage.editIconIsDisplayed();
await metadataViewPage.editIconClick(); await metadataViewPage.editIconClick();
await metadataViewPage.editPropertyIconIsDisplayed('properties.cm:title'); await metadataViewPage.editPropertyIconIsDisplayed('properties.cm:title');
await metadataViewPage.clickEditPropertyIcons('properties.cm:title');
await metadataViewPage.enterPropertyText('properties.cm:title', 'newTitle2'); await metadataViewPage.enterPropertyText('properties.cm:title', 'newTitle2');
await metadataViewPage.clickUpdatePropertyIcon('properties.cm:title');
await expect(await metadataViewPage.getPropertyText('properties.cm:title')).toEqual('newTitle2'); await expect(await metadataViewPage.getPropertyText('properties.cm:title')).toEqual('newTitle2');
await metadataViewPage.clickCloseButton(); await metadataViewPage.clickCloseButton();
await contentServicesPage.uploadFile(testFileModel.location); await contentServicesPage.uploadFile(testFileModel.location);
@@ -407,9 +403,7 @@ describe('Permissions Component', () => {
await metadataViewPage.editIconIsDisplayed(); await metadataViewPage.editIconIsDisplayed();
await metadataViewPage.editIconClick(); await metadataViewPage.editIconClick();
await metadataViewPage.editPropertyIconIsDisplayed('properties.cm:title'); await metadataViewPage.editPropertyIconIsDisplayed('properties.cm:title');
await metadataViewPage.clickEditPropertyIcons('properties.cm:title');
await metadataViewPage.enterPropertyText('properties.cm:title', 'newTitle3'); await metadataViewPage.enterPropertyText('properties.cm:title', 'newTitle3');
await metadataViewPage.clickUpdatePropertyIcon('properties.cm:title');
await expect(await metadataViewPage.getPropertyText('properties.cm:title')).toEqual('newTitle3'); await expect(await metadataViewPage.getPropertyText('properties.cm:title')).toEqual('newTitle3');
await metadataViewPage.clickCloseButton(); await metadataViewPage.clickCloseButton();
await contentServicesPage.uploadFile(pngFileModel.location); await contentServicesPage.uploadFile(pngFileModel.location);
@@ -287,10 +287,8 @@ describe('Permissions Component', () => {
await metadataViewPage.editIconClick(); await metadataViewPage.editIconClick();
await metadataViewPage.editPropertyIconIsDisplayed('properties.cm:title'); await metadataViewPage.editPropertyIconIsDisplayed('properties.cm:title');
await metadataViewPage.clickEditPropertyIcons('properties.cm:title');
await metadataViewPage.enterPropertyText('properties.cm:title', 'newTitle'); await metadataViewPage.enterPropertyText('properties.cm:title', 'newTitle');
await metadataViewPage.clickUpdatePropertyIcon('properties.cm:title');
await expect(await metadataViewPage.getPropertyText('properties.cm:title')).toEqual('newTitle'); await expect(await metadataViewPage.getPropertyText('properties.cm:title')).toEqual('newTitle');
await metadataViewPage.clickCloseButton(); await metadataViewPage.clickCloseButton();
@@ -321,10 +319,8 @@ describe('Permissions Component', () => {
await metadataViewPage.editIconClick(); await metadataViewPage.editIconClick();
await metadataViewPage.editPropertyIconIsDisplayed('properties.cm:description'); await metadataViewPage.editPropertyIconIsDisplayed('properties.cm:description');
await metadataViewPage.clickEditPropertyIcons('properties.cm:description');
await metadataViewPage.enterDescriptionText('newDescription'); await metadataViewPage.enterDescriptionText('newDescription');
await metadataViewPage.clickSaveMetadata();
await metadataViewPage.clickUpdatePropertyIcon('properties.cm:description');
await expect(await metadataViewPage.getPropertyText('properties.cm:description')).toEqual('newDescription'); await expect(await metadataViewPage.getPropertyText('properties.cm:description')).toEqual('newDescription');
@@ -49,10 +49,6 @@ export class CardViewComponentPage {
return this.nameCardTextItem.getFieldValue(); return this.nameCardTextItem.getFieldValue();
} }
async clickOnNameTextField(): Promise<void> {
await this.nameCardTextItem.clickOnToggleTextField();
}
async enterNameTextField(text: string): Promise<void> { async enterNameTextField(text: string): Promise<void> {
await this.nameCardTextItem.enterTextField(text); await this.nameCardTextItem.enterTextField(text);
} }
+37 -44
View File
@@ -15,7 +15,7 @@
* limitations under the License. * 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'; import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class MetadataViewPage { export class MetadataViewPage {
@@ -23,15 +23,15 @@ export class MetadataViewPage {
title: ElementFinder = element(by.css(`div[info-drawer-title]`)); title: ElementFinder = element(by.css(`div[info-drawer-title]`));
expandedAspect: ElementFinder = element(by.css(`mat-expansion-panel-header[aria-expanded='true']`)); expandedAspect: ElementFinder = element(by.css(`mat-expansion-panel-header[aria-expanded='true']`));
aspectTitle = by.css(`mat-panel-title`); aspectTitle = by.css(`mat-panel-title`);
name: ElementFinder = element(by.css(`span[data-automation-id='card-textitem-value-name'] span`)); name: ElementFinder = element(by.css(`[data-automation-id='card-textitem-value-name']`));
creator: ElementFinder = element(by.css(`span[data-automation-id='card-textitem-value-createdByUser.displayName'] span`)); 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`)); 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`)); 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']`)); mimetypeName: ElementFinder = element(by.css(`[data-automation-id='card-textitem-value-content.mimeTypeName']`));
size: ElementFinder = element(by.css(`span[data-automation-id='card-textitem-value-content.sizeInBytes']`)); 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'] span`)); description: ElementFinder = element(by.css(`span[data-automation-id='card-textitem-value-properties.cm:description']`));
author: ElementFinder = element(by.css(`span[data-automation-id='card-textitem-value-properties.cm:author'] span`)); 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`)); 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']`)); 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']`)); 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')); closeButton: ElementFinder = element(by.cssContainingText('button.mat-button span', 'Close'));
displayAspect: ElementFinder = element(by.css(`input[placeholder='Display Aspect']`)); displayAspect: ElementFinder = element(by.css(`input[placeholder='Display Aspect']`));
applyAspect: ElementFinder = element(by.cssContainingText(`button span.mat-button-wrapper`, 'Apply 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> { async getTitle(): Promise<string> {
return BrowserActions.getText(this.title); return BrowserActions.getText(this.title);
@@ -55,11 +57,11 @@ export class MetadataViewPage {
} }
async getName(): Promise<string> { async getName(): Promise<string> {
return BrowserActions.getText(this.name); return BrowserActions.getInputValue(this.name);
} }
async getCreator(): Promise<string> { async getCreator(): Promise<string> {
return BrowserActions.getText(this.creator); return BrowserActions.getInputValue(this.creator);
} }
async getCreatedDate(): Promise<string> { async getCreatedDate(): Promise<string> {
@@ -67,7 +69,7 @@ export class MetadataViewPage {
} }
async getModifier(): Promise<string> { async getModifier(): Promise<string> {
return BrowserActions.getText(this.modifier); return BrowserActions.getInputValue(this.modifier);
} }
async getModifiedDate(): Promise<string> { async getModifiedDate(): Promise<string> {
@@ -75,19 +77,19 @@ export class MetadataViewPage {
} }
async getMimetypeName(): Promise<string> { async getMimetypeName(): Promise<string> {
return BrowserActions.getText(this.mimetypeName); return BrowserActions.getInputValue(this.mimetypeName);
} }
async getSize(): Promise<string> { async getSize(): Promise<string> {
return BrowserActions.getText(this.size); return BrowserActions.getInputValue(this.size);
} }
async getDescription(): Promise<string> { async getDescription(): Promise<string> {
return BrowserActions.getText(this.description); return BrowserActions.getInputValue(this.description);
} }
async getAuthor(): Promise<string> { async getAuthor(): Promise<string> {
return BrowserActions.getText(this.author); return BrowserActions.getInputValue(this.author);
} }
async getTitleProperty(): Promise<string> { async getTitleProperty(): Promise<string> {
@@ -136,61 +138,44 @@ export class MetadataViewPage {
} }
async editPropertyIconIsDisplayed(propertyName: string) { 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); await BrowserVisibility.waitUntilElementIsPresent(editPropertyIcon);
} }
async updatePropertyIconIsDisplayed(propertyName: string) { async clickResetButton(): Promise<void> {
const updatePropertyIcon: ElementFinder = element(by.css('button[data-automation-id="card-textitem-update-' + propertyName + '"]')); const clearPropertyIcon: ElementFinder = element(by.css('button[data-automation-id="reset-metadata"]'));
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 + '"]'));
await BrowserActions.click(clearPropertyIcon); await BrowserActions.click(clearPropertyIcon);
} }
async enterPropertyText(propertyName: string, text: string | number): Promise<void> { 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 BrowserActions.clearSendKeys(textField, text.toString());
await textField.sendKeys(protractor.Key.ENTER);
} }
async enterPresetText(text: string): Promise<void> { async enterPresetText(text: string): Promise<void> {
const presetField: ElementFinder = element(by.css('input[data-automation-id="adf-text-custom-preset"]')); 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"]')); const applyButton: ElementFinder = element(by.css('button[id="adf-metadata-aplly"]'));
await BrowserActions.click(applyButton); await BrowserActions.click(applyButton);
} }
async enterDescriptionText(text: string): Promise<void> { 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 BrowserActions.clearSendKeys(textField, text);
await textField.sendKeys(Key.TAB);
} }
async getPropertyText(propertyName: string, type?: string): Promise<string> { async getPropertyText(propertyName: string, type?: string): Promise<string> {
const propertyType = type || 'textitem'; 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); return BrowserActions.getInputValue(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);
} }
async getPropertyIconTooltip(propertyName: string): Promise<string> { 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'); return editPropertyIcon.getAttribute('title');
} }
@@ -247,4 +232,12 @@ export class MetadataViewPage {
async clickApplyAspect(): Promise<void> { async clickApplyAspect(): Promise<void> {
await BrowserActions.click(this.applyAspect); await BrowserActions.click(this.applyAspect);
} }
async clickSaveMetadata(): Promise<void> {
await BrowserActions.click(this.saveMetadataButton);
}
async clickResetMetadata(): Promise<void> {
await BrowserActions.click(this.resetMetadataButton);
}
} }
@@ -21,14 +21,14 @@ import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class ProcessDetailsPage { export class ProcessDetailsPage {
processTitle: ElementFinder = element(by.css('mat-card-title[class="mat-card-title"]')); processTitle: ElementFinder = element(by.css('mat-card-title[class="mat-card-title"]'));
processDetailsMessage: ElementFinder = element(by.css('adf-process-instance-details div[class="ng-star-inserted"]')); processDetailsMessage: ElementFinder = element(by.css('adf-process-instance-details div[class="ng-star-inserted"]'));
processStatusField: ElementFinder = element(by.css('span[data-automation-id="card-textitem-value-status"]')); processStatusField: ElementFinder = element(by.css('[data-automation-id="card-textitem-value-status"]'));
processEndDateField: ElementFinder = element(by.css('span[data-automation-id="card-dateitem-ended"]')); processEndDateField: ElementFinder = element(by.css('span[data-automation-id="card-dateitem-ended"]'));
processCategoryField: ElementFinder = element(by.css('span[data-automation-id="card-textitem-value-category"]')); processCategoryField: ElementFinder = element(by.css('[data-automation-id="card-textitem-value-category"]'));
processBusinessKeyField: ElementFinder = element(by.css('span[data-automation-id="card-textitem-value-businessKey"]')); processBusinessKeyField: ElementFinder = element(by.css('[data-automation-id="card-textitem-value-businessKey"]'));
processCreatedByField: ElementFinder = element(by.css('span[data-automation-id="card-textitem-value-assignee"]')); processCreatedByField: ElementFinder = element(by.css('[data-automation-id="card-textitem-value-assignee"]'));
processCreatedField: ElementFinder = element(by.css('span[data-automation-id="card-dateitem-created"]')); processCreatedField: ElementFinder = element(by.css('span[data-automation-id="card-dateitem-created"]'));
processIdField: ElementFinder = element(by.css('span[data-automation-id="card-textitem-value-id"]')); processIdField: ElementFinder = element(by.css('[data-automation-id="card-textitem-value-id"]'));
processDescription: ElementFinder = element(by.css('span[data-automation-id="card-textitem-value-description"]')); processDescription: ElementFinder = element(by.css('[data-automation-id="card-textitem-value-description"]'));
showDiagramButtonDisabled: ElementFinder = element(by.css('button[id="show-diagram-button"][disabled]')); showDiagramButtonDisabled: ElementFinder = element(by.css('button[id="show-diagram-button"][disabled]'));
propertiesList: ElementFinder = element(by.css('div[class="adf-property-list"]')); propertiesList: ElementFinder = element(by.css('div[class="adf-property-list"]'));
showDiagramButton: ElementFinder = element(by.id('show-diagram-button')); showDiagramButton: ElementFinder = element(by.id('show-diagram-button'));
@@ -67,7 +67,7 @@ export class ProcessDetailsPage {
} }
getProcessStatus(): Promise<string> { getProcessStatus(): Promise<string> {
return BrowserActions.getText(this.processStatusField); return BrowserActions.getInputValue(this.processStatusField);
} }
getEndDate(): Promise<string> { getEndDate(): Promise<string> {
@@ -75,15 +75,15 @@ export class ProcessDetailsPage {
} }
getProcessCategory(): Promise<string> { getProcessCategory(): Promise<string> {
return BrowserActions.getText(this.processCategoryField); return BrowserActions.getInputValue(this.processCategoryField);
} }
getBusinessKey(): Promise<string> { getBusinessKey(): Promise<string> {
return BrowserActions.getText(this.processBusinessKeyField); return BrowserActions.getInputValue(this.processBusinessKeyField);
} }
getCreatedBy(): Promise<string> { getCreatedBy(): Promise<string> {
return BrowserActions.getText(this.processCreatedByField); return BrowserActions.getInputValue(this.processCreatedByField);
} }
getCreated(): Promise<string> { getCreated(): Promise<string> {
@@ -91,11 +91,11 @@ export class ProcessDetailsPage {
} }
getId(): Promise<string> { getId(): Promise<string> {
return BrowserActions.getText(this.processIdField); return BrowserActions.getInputValue(this.processIdField);
} }
getProcessDescription(): Promise<string> { getProcessDescription(): Promise<string> {
return BrowserActions.getText(this.processDescription); return BrowserActions.getInputValue(this.processDescription);
} }
async clickShowDiagram(): Promise<void> { async clickShowDiagram(): Promise<void> {
@@ -16,7 +16,7 @@
*/ */
import { BrowserActions, BrowserVisibility, DropdownPage, TabsPage } from '@alfresco/adf-testing'; import { BrowserActions, BrowserVisibility, DropdownPage, TabsPage } from '@alfresco/adf-testing';
import { browser, by, element, ElementFinder } from 'protractor'; import { browser, by, element, ElementFinder, Key } from 'protractor';
import { AppSettingsTogglesPage } from './dialog/app-settings-toggles.page'; import { AppSettingsTogglesPage } from './dialog/app-settings-toggles.page';
export class TaskDetailsPage { export class TaskDetailsPage {
@@ -24,18 +24,20 @@ export class TaskDetailsPage {
appSettingsTogglesClass = new AppSettingsTogglesPage(); appSettingsTogglesClass = new AppSettingsTogglesPage();
formContent: ElementFinder = element(by.css('adf-form')); formContent: ElementFinder = element(by.css('adf-form'));
formNameField: ElementFinder = element(by.css('span[data-automation-id*="formName"] span')); formNameField: ElementFinder = element(by.css('[data-automation-id="card-textitem-value-formName"]'));
assigneeField: ElementFinder = element(by.css('span[data-automation-id*="assignee"] span')); formNameButton: ElementFinder = element(by.css('[data-automation-id="card-textitem-toggle-formName"]'));
statusField: ElementFinder = element(by.css('span[data-automation-id*="status"] span')); assigneeField: ElementFinder = element(by.css('[data-automation-id="card-textitem-value-assignee"]'));
categoryField: ElementFinder = element(by.css('span[data-automation-id*="category"] span')); assigneeButton: ElementFinder = element(by.css('[data-automation-id="card-textitem-toggle-assignee"]'));
statusField: ElementFinder = element(by.css('[data-automation-id="card-textitem-value-status"]'));
categoryField: ElementFinder = element(by.css('[data-automation-id="card-textitem-value-category"] '));
parentNameField: ElementFinder = element(by.css('span[data-automation-id*="parentName"] span')); parentNameField: ElementFinder = element(by.css('span[data-automation-id*="parentName"] span'));
parentTaskIdField: ElementFinder = element(by.css('span[data-automation-id*="parentTaskId"] span')); parentTaskIdField: ElementFinder = element(by.css('[data-automation-id="card-textitem-value-parentTaskId"] '));
durationField: ElementFinder = element(by.css('span[data-automation-id*="duration"] span')); durationField: ElementFinder = element(by.css('[data-automation-id="card-textitem-value-duration"] '));
endDateField: ElementFinder = element.all(by.css('span[data-automation-id*="endDate"] span')).first(); endDateField: ElementFinder = element.all(by.css('span[data-automation-id*="endDate"] span')).first();
createdField: ElementFinder = element(by.css('span[data-automation-id="card-dateitem-created"] span')); createdField: ElementFinder = element(by.css('span[data-automation-id="card-dateitem-created"] span'));
idField: ElementFinder = element.all(by.css('span[data-automation-id*="id"] span')).first(); idField: ElementFinder = element.all(by.css('[data-automation-id="card-textitem-value-id"]')).first();
descriptionField: ElementFinder = element(by.css('span[data-automation-id*="description"] span')); descriptionField: ElementFinder = element(by.css('[data-automation-id="card-textitem-value-description"]'));
dueDateField: ElementFinder = element(by.css('span[data-automation-id*="dueDate"] span')); dueDateField: ElementFinder = element.all(by.css('span[data-automation-id*="dueDate"] span')).first();
activitiesTitle: ElementFinder = element(by.css('div[class*="adf-info-drawer-layout-header-title"] div')); activitiesTitle: ElementFinder = element(by.css('div[class*="adf-info-drawer-layout-header-title"] div'));
commentField: ElementFinder = element(by.id('comment-input')); commentField: ElementFinder = element(by.id('comment-input'));
addCommentButton: ElementFinder = element(by.css('[data-automation-id="comments-input-add"]')); addCommentButton: ElementFinder = element(by.css('[data-automation-id="comments-input-add"]'));
@@ -62,8 +64,8 @@ export class TaskDetailsPage {
removeAttachForm: ElementFinder = element(by.id('adf-attach-form-remove-button')); removeAttachForm: ElementFinder = element(by.id('adf-attach-form-remove-button'));
attachFormName: ElementFinder = element(by.css('span[class="adf-form-title ng-star-inserted"]')); attachFormName: ElementFinder = element(by.css('span[class="adf-form-title ng-star-inserted"]'));
emptyTaskDetails: ElementFinder = element(by.css('adf-task-details > div > div')); emptyTaskDetails: ElementFinder = element(by.css('adf-task-details > div > div'));
priority: ElementFinder = element(by.css('span[data-automation-id*="priority"] span')); priority: ElementFinder = element(by.css('[data-automation-id*="card-textitem-value-priority"]'));
editableAssignee = element(by.css('span[data-automation-id="card-textitem-value-assignee"][class*="clickable"]')); editableAssignee = element(by.css('[data-automation-id="card-textitem-value-assignee"][class*="clickable"]'));
claimElement = element(by.css('[data-automation-id="header-claim-button"]')); claimElement = element(by.css('[data-automation-id="header-claim-button"]'));
releaseElement = element(by.css('[data-automation-id="header-unclaim-button"]')); releaseElement = element(by.css('[data-automation-id="header-unclaim-button"]'));
saveFormButton = element(by.css('button[id="adf-form-save"]')); saveFormButton = element(by.css('button[id="adf-form-save"]'));
@@ -75,20 +77,10 @@ export class TaskDetailsPage {
} }
async checkEditableFormIsNotDisplayed(): Promise<void> { async checkEditableFormIsNotDisplayed(): Promise<void> {
const editableForm = element(by.css('span[data-automation-id="card-textitem-value-formName"][class*="clickable"]')); const editableForm = element(by.css('[data-automation-id="card-textitem-value-formName"][class*="clickable"]'));
await BrowserVisibility.waitUntilElementIsNotVisible(editableForm); await BrowserVisibility.waitUntilElementIsNotVisible(editableForm);
} }
async checkEditDescriptionButtonIsNotDisplayed(): Promise<void> {
const editDescriptionButton = element(by.css('button[data-automation-id="card-textitem-edit-icon-description"]'));
await BrowserVisibility.waitUntilElementIsNotVisible(editDescriptionButton);
}
async checkEditPriorityButtonIsNotDisplayed(): Promise<void> {
const editPriorityButton = element(by.css('button[data-automation-id="card-textitem-edit-icon-priority"]'));
await BrowserVisibility.waitUntilElementIsNotVisible(editPriorityButton);
}
async checkDueDatePickerButtonIsNotDisplayed(): Promise<void> { async checkDueDatePickerButtonIsNotDisplayed(): Promise<void> {
const dueDatePickerButton = element(by.css('mat-datetimepicker-toggle[data-automation-id="datepickertoggle-dueDate"]')); const dueDatePickerButton = element(by.css('mat-datetimepicker-toggle[data-automation-id="datepickertoggle-dueDate"]'));
await BrowserVisibility.waitUntilElementIsNotVisible(dueDatePickerButton); await BrowserVisibility.waitUntilElementIsNotVisible(dueDatePickerButton);
@@ -151,17 +143,17 @@ export class TaskDetailsPage {
} }
async checkFormIsAttached(formName): Promise<void> { async checkFormIsAttached(formName): Promise<void> {
const attachedFormName = await BrowserActions.getText(this.formNameField); const attachedFormName = await BrowserActions.getInputValue(this.formNameField);
await expect(attachedFormName).toEqual(formName); await expect(attachedFormName).toEqual(formName);
} }
getFormName(): Promise<string> { getFormName(): Promise<string> {
return BrowserActions.getText(this.formNameField); return BrowserActions.getInputValue(this.formNameField);
} }
async clickForm(): Promise<void> { async clickForm(): Promise<void> {
await BrowserActions.closeMenuAndDialogs(); await BrowserActions.closeMenuAndDialogs();
await BrowserActions.click(this.formNameField); await BrowserActions.click(this.formNameButton);
} }
async checkStandaloneNoFormMessageIsDisplayed(): Promise<void> { async checkStandaloneNoFormMessageIsDisplayed(): Promise<void> {
@@ -173,7 +165,7 @@ export class TaskDetailsPage {
} }
getAssignee(): Promise<string> { getAssignee(): Promise<string> {
return BrowserActions.getText(this.assigneeField); return BrowserActions.getInputValue(this.assigneeField);
} }
isAssigneeClickable(): Promise<string> { isAssigneeClickable(): Promise<string> {
@@ -181,11 +173,11 @@ export class TaskDetailsPage {
} }
getStatus(): Promise<string> { getStatus(): Promise<string> {
return BrowserActions.getText(this.statusField); return BrowserActions.getInputValue(this.statusField);
} }
getCategory(): Promise<string> { getCategory(): Promise<string> {
return BrowserActions.getText(this.categoryField); return BrowserActions.getInputValue(this.categoryField);
} }
getParentName(): Promise<string> { getParentName(): Promise<string> {
@@ -193,11 +185,11 @@ export class TaskDetailsPage {
} }
getParentTaskId(): Promise<string> { getParentTaskId(): Promise<string> {
return BrowserActions.getText(this.parentTaskIdField); return BrowserActions.getInputValue(this.parentTaskIdField);
} }
getDuration(): Promise<string> { getDuration(): Promise<string> {
return BrowserActions.getText(this.durationField); return BrowserActions.getInputValue(this.durationField);
} }
getEndDate(): Promise<string> { getEndDate(): Promise<string> {
@@ -209,11 +201,16 @@ export class TaskDetailsPage {
} }
getId(): Promise<string> { getId(): Promise<string> {
return BrowserActions.getText(this.idField); return BrowserActions.getInputValue(this.idField);
} }
getDescription(): Promise<string> { getDescription(): Promise<string> {
return BrowserActions.getText(this.descriptionField); return BrowserActions.getInputValue(this.descriptionField);
}
async getDescriptionPlaceholder(): Promise<string> {
await BrowserVisibility.waitUntilElementIsPresent(this.descriptionField);
return this.descriptionField.getAttribute('placeholder');
} }
getDueDate(): Promise<string> { getDueDate(): Promise<string> {
@@ -221,32 +218,30 @@ export class TaskDetailsPage {
} }
getPriority(): Promise<string> { getPriority(): Promise<string> {
return BrowserActions.getText(this.priority); return BrowserActions.getInputValue(this.priority);
} }
async updatePriority(priority?: string): Promise<void> { async updatePriority(priority?: string): Promise<void> {
await BrowserActions.click(this.priority); await BrowserActions.click(this.priority);
await BrowserActions.clearSendKeys(element(by.css('input[data-automation-id="card-textitem-editinput-priority"]')), priority ? priority : ' '); await BrowserActions.clearWithBackSpace(this.priority);
await BrowserActions.click(element(by.css('button[data-automation-id="card-textitem-update-priority"]'))); await BrowserActions.clearSendKeys(element(by.css('input[data-automation-id="card-textitem-value-priority"]')), priority ? priority : ' ');
await this.priority.sendKeys(Key.TAB);
} }
async updateDueDate(): Promise<void> { async updateDueDate(): Promise<void> {
await BrowserActions.click(this.dueDateField); await BrowserActions.click(this.dueDateField);
await BrowserActions.click(element(by.css('.mat-datetimepicker-calendar-body-cell'))); await BrowserActions.click(element.all(by.css('.mat-datetimepicker-calendar-body-cell')).first());
} }
async updateDescription(description?: string): Promise<void> { async updateDescription(description?: string): Promise<void> {
await BrowserActions.click(this.descriptionField); await BrowserActions.click(this.descriptionField);
const input = 'textarea[data-automation-id="card-textitem-edittextarea-description"]'; await BrowserActions.clearWithBackSpace(this.descriptionField);
await BrowserActions.clearSendKeys(element(by.css(input)), description ? description : ''); await BrowserActions.clearSendKeys(element(by.css('[data-automation-id="card-textitem-value-description"]')), description ? description : '');
if (!description) { await this.descriptionField.sendKeys(Key.TAB);
await browser.executeScript(`document.querySelector('${input}').dispatchEvent(new Event('input'))`);
}
await BrowserActions.click(element(by.css('button[data-automation-id="card-textitem-update-description"]')));
} }
async updateAssignee(fullName: string): Promise<void> { async updateAssignee(fullName: string): Promise<void> {
await BrowserActions.click(this.assigneeField); await BrowserActions.click(this.assigneeButton);
await BrowserActions.clearSendKeys(element(by.css('[id="userSearchText"]')), fullName); await BrowserActions.clearSendKeys(element(by.css('[id="userSearchText"]')), fullName);
await BrowserActions.click(element(by.cssContainingText('.adf-people-full-name', fullName))); await BrowserActions.click(element(by.cssContainingText('.adf-people-full-name', fullName)));
await BrowserActions.click(element(by.css('button[id="add-people"]'))); await BrowserActions.click(element(by.css('button[id="add-people"]')));
@@ -74,12 +74,12 @@ describe('Edit task filters cloud', () => {
}); });
afterEach(async () => { afterEach(async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
}); });
it('[C291785] All the filters property should be set up accordingly with the Query Param', async () => { it('[C291785] All the filters property should be set up accordingly with the Query Param', async () => {
await tasksCloudDemoPage.editTaskFilterCloudComponent().openFilter(); await tasksCloudDemoPage.editTaskFilterCloudComponent().openFilter();
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks'); await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await expect(await tasksCloudDemoPage.editTaskFilterCloudComponent().getStatusFilterDropDownValue()).toEqual('ASSIGNED'); await expect(await tasksCloudDemoPage.editTaskFilterCloudComponent().getStatusFilterDropDownValue()).toEqual('ASSIGNED');
await expect(await tasksCloudDemoPage.editTaskFilterCloudComponent().getSortFilterDropDownValue()).toEqual('CreatedDate'); await expect(await tasksCloudDemoPage.editTaskFilterCloudComponent().getSortFilterDropDownValue()).toEqual('CreatedDate');
@@ -87,7 +87,7 @@ describe('Edit task filters cloud', () => {
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(assignedTaskName); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(assignedTaskName);
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(completedTaskName); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(completedTaskName);
await tasksCloudDemoPage.taskFilterCloudComponent.clickCompletedTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('completed-tasks');
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('Completed Tasks'); await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('Completed Tasks');
await expect(await tasksCloudDemoPage.editTaskFilterCloudComponent().getStatusFilterDropDownValue()).toEqual('COMPLETED'); await expect(await tasksCloudDemoPage.editTaskFilterCloudComponent().getStatusFilterDropDownValue()).toEqual('COMPLETED');
await expect(await tasksCloudDemoPage.editTaskFilterCloudComponent().getSortFilterDropDownValue()).toEqual('CreatedDate'); await expect(await tasksCloudDemoPage.editTaskFilterCloudComponent().getSortFilterDropDownValue()).toEqual('CreatedDate');
@@ -98,9 +98,9 @@ describe('Edit task filters cloud', () => {
}); });
it('[C306896] Delete Save and Save as actions should be displayed when clicking on custom filter header', async () => { it('[C306896] Delete Save and Save as actions should be displayed when clicking on custom filter header', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
await tasksCloudDemoPage.editTaskFilterCloudComponent().openFilter(); await tasksCloudDemoPage.editTaskFilterCloudComponent().openFilter();
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks'); await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
const editTaskFilterCloudComponent = tasksCloudDemoPage.editTaskFilterCloudComponent(); const editTaskFilterCloudComponent = tasksCloudDemoPage.editTaskFilterCloudComponent();
@@ -115,13 +115,13 @@ describe('Edit task filters cloud', () => {
}); });
it('[C291795] New filter is added when clicking Save As button', async () => { it('[C291795] New filter is added when clicking Save As button', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
const editTaskFilterCloudComponent = tasksCloudDemoPage.editTaskFilterCloudComponent(); const editTaskFilterCloudComponent = tasksCloudDemoPage.editTaskFilterCloudComponent();
await editTaskFilterCloudComponent.openFilter(); await editTaskFilterCloudComponent.openFilter();
await editTaskFilterCloudComponent.setSortFilterDropDown('Id'); await editTaskFilterCloudComponent.setSortFilterDropDown('Id');
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
await tasksCloudDemoPage.editTaskFilterCloudComponent().clickSaveAsButton(); await tasksCloudDemoPage.editTaskFilterCloudComponent().clickSaveAsButton();
@@ -135,7 +135,7 @@ describe('Edit task filters cloud', () => {
await expect(await tasksCloudDemoPage.editTaskFilterCloudComponent().getSortFilterDropDownValue()).toEqual('Id'); await expect(await tasksCloudDemoPage.editTaskFilterCloudComponent().getSortFilterDropDownValue()).toEqual('Id');
await expect(await tasksCloudDemoPage.editTaskFilterCloudComponent().checkSaveAsButtonIsEnabled()).toEqual(false); await expect(await tasksCloudDemoPage.editTaskFilterCloudComponent().checkSaveAsButtonIsEnabled()).toEqual(false);
await expect(await tasksCloudDemoPage.editTaskFilterCloudComponent().checkDeleteButtonIsEnabled()).toEqual(true); await expect(await tasksCloudDemoPage.editTaskFilterCloudComponent().checkDeleteButtonIsEnabled()).toEqual(true);
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
await expect(await tasksCloudDemoPage.editTaskFilterCloudComponent().getSortFilterDropDownValue()).toEqual('CreatedDate'); await expect(await tasksCloudDemoPage.editTaskFilterCloudComponent().getSortFilterDropDownValue()).toEqual('CreatedDate');
await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('custom-new'); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('custom-new');
await expect(await tasksCloudDemoPage.editTaskFilterCloudComponent().getSortFilterDropDownValue()).toEqual('Id'); await expect(await tasksCloudDemoPage.editTaskFilterCloudComponent().getSortFilterDropDownValue()).toEqual('Id');
@@ -143,13 +143,13 @@ describe('Edit task filters cloud', () => {
}); });
it('[C291796] Two filters with same name can be created when clicking the Save As button', async () => { it('[C291796] Two filters with same name can be created when clicking the Save As button', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
const editTaskFilterCloudComponent = tasksCloudDemoPage.editTaskFilterCloudComponent(); const editTaskFilterCloudComponent = tasksCloudDemoPage.editTaskFilterCloudComponent();
await editTaskFilterCloudComponent.openFilter(); await editTaskFilterCloudComponent.openFilter();
await editTaskFilterCloudComponent.setSortFilterDropDown('Id'); await editTaskFilterCloudComponent.setSortFilterDropDown('Id');
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
await tasksCloudDemoPage.editTaskFilterCloudComponent().clickSaveAsButton(); await tasksCloudDemoPage.editTaskFilterCloudComponent().clickSaveAsButton();
@@ -178,13 +178,13 @@ describe('Edit task filters cloud', () => {
}); });
it('[C291797] A filter is overrided when clicking on save button', async () => { it('[C291797] A filter is overrided when clicking on save button', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
const editTaskFilterCloudComponent = tasksCloudDemoPage.editTaskFilterCloudComponent(); const editTaskFilterCloudComponent = tasksCloudDemoPage.editTaskFilterCloudComponent();
await editTaskFilterCloudComponent.openFilter(); await editTaskFilterCloudComponent.openFilter();
await editTaskFilterCloudComponent.setSortFilterDropDown('Id'); await editTaskFilterCloudComponent.setSortFilterDropDown('Id');
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
await tasksCloudDemoPage.editTaskFilterCloudComponent().clickSaveAsButton(); await tasksCloudDemoPage.editTaskFilterCloudComponent().clickSaveAsButton();
const editTaskFilterDialog = await tasksCloudDemoPage.editTaskFilterCloudComponent().editTaskFilterDialog(); const editTaskFilterDialog = await tasksCloudDemoPage.editTaskFilterCloudComponent().editTaskFilterDialog();
@@ -204,13 +204,13 @@ describe('Edit task filters cloud', () => {
}); });
it('[C291798] A filter is deleted when clicking on delete button', async () => { it('[C291798] A filter is deleted when clicking on delete button', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
const editTaskFilterCloudComponent = tasksCloudDemoPage.editTaskFilterCloudComponent(); const editTaskFilterCloudComponent = tasksCloudDemoPage.editTaskFilterCloudComponent();
await editTaskFilterCloudComponent.openFilter(); await editTaskFilterCloudComponent.openFilter();
await editTaskFilterCloudComponent.setSortFilterDropDown('Id'); await editTaskFilterCloudComponent.setSortFilterDropDown('Id');
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
await tasksCloudDemoPage.editTaskFilterCloudComponent().clickSaveAsButton(); await tasksCloudDemoPage.editTaskFilterCloudComponent().clickSaveAsButton();
const editTaskFilterDialog = await tasksCloudDemoPage.editTaskFilterCloudComponent().editTaskFilterDialog(); const editTaskFilterDialog = await tasksCloudDemoPage.editTaskFilterCloudComponent().editTaskFilterDialog();
@@ -227,7 +227,7 @@ describe('Edit task filters cloud', () => {
}); });
it('[C291800] Task filter should not be created when task filter dialog is closed', async () => { it('[C291800] Task filter should not be created when task filter dialog is closed', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
const editTaskFilterCloudComponent = tasksCloudDemoPage.editTaskFilterCloudComponent(); const editTaskFilterCloudComponent = tasksCloudDemoPage.editTaskFilterCloudComponent();
await editTaskFilterCloudComponent.openFilter(); await editTaskFilterCloudComponent.openFilter();
@@ -241,8 +241,8 @@ describe('Edit task filters cloud', () => {
await tasksCloudDemoPage.editTaskFilterCloudComponent().editTaskFilterDialog().clickOnCancelButton(); await tasksCloudDemoPage.editTaskFilterCloudComponent().editTaskFilterDialog().clickOnCancelButton();
await tasksCloudDemoPage.taskFilterCloudComponent.checkTaskFilterNotDisplayed('Cancel'); await tasksCloudDemoPage.taskFilterCloudComponent.checkTaskFilterNotDisplayed('Cancel');
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toEqual('My Tasks'); await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toEqual('My Tasks');
await tasksCloudDemoPage.taskFilterCloudComponent.clickCompletedTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('completed-tasks');
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
await tasksCloudDemoPage.editTaskFilterCloudComponent().openFilter(); await tasksCloudDemoPage.editTaskFilterCloudComponent().openFilter();
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks'); await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await expect(await tasksCloudDemoPage.editTaskFilterCloudComponent().getSortFilterDropDownValue()).toEqual('CreatedDate'); await expect(await tasksCloudDemoPage.editTaskFilterCloudComponent().getSortFilterDropDownValue()).toEqual('CreatedDate');
@@ -250,7 +250,7 @@ describe('Edit task filters cloud', () => {
}); });
it('[C291801] Save button of task filter dialog should be disabled when task name is empty', async () => { it('[C291801] Save button of task filter dialog should be disabled when task name is empty', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
const editTaskFilterCloudComponent = tasksCloudDemoPage.editTaskFilterCloudComponent(); const editTaskFilterCloudComponent = tasksCloudDemoPage.editTaskFilterCloudComponent();
await editTaskFilterCloudComponent.openFilter(); await editTaskFilterCloudComponent.openFilter();
@@ -272,7 +272,7 @@ describe('Edit task filters cloud', () => {
}); });
it('[C291799] Task filter dialog is displayed when clicking on Save As button', async () => { it('[C291799] Task filter dialog is displayed when clicking on Save As button', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
const tasksCloud = tasksCloudDemoPage.editTaskFilterCloudComponent(); const tasksCloud = tasksCloudDemoPage.editTaskFilterCloudComponent();
await tasksCloud.openFilter(); await tasksCloud.openFilter();
await tasksCloud.setSortFilterDropDown('Id'); await tasksCloud.setSortFilterDropDown('Id');
@@ -91,7 +91,7 @@ describe('Form Field Component - Dropdown Widget', () => {
}); });
it('[C290069] Should be able to read rest service dropdown options, save and complete the task form', async () => { it('[C290069] Should be able to read rest service dropdown options, save and complete the task form', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(task.entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(task.entry.name);
await tasksCloudDemoPage.taskListCloudComponent().selectRow(task.entry.name); await tasksCloudDemoPage.taskListCloudComponent().selectRow(task.entry.name);
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed(); await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
@@ -108,7 +108,7 @@ describe('Form Field Component - Dropdown Widget', () => {
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(task.entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(task.entry.name);
await notificationHistoryPage.checkNotifyContains('Task has been saved successfully'); await notificationHistoryPage.checkNotifyContains('Task has been saved successfully');
await tasksCloudDemoPage.taskFilterCloudComponent.clickCompletedTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('completed-tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(task.entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(task.entry.name);
await tasksCloudDemoPage.taskListCloudComponent().selectRow(task.entry.name); await tasksCloudDemoPage.taskListCloudComponent().selectRow(task.entry.name);
await taskFormCloudComponent.formFields().checkFormIsDisplayed(); await taskFormCloudComponent.formFields().checkFormIsDisplayed();
@@ -127,7 +127,7 @@ describe('Process Task - Attach content file', () => {
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks'); await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(taskName); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(taskName);
await tasksCloudDemoPage.taskFilterCloudComponent.clickCompletedTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('completed-tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(taskName); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(taskName);
await processCloudDemoPage.processFilterCloudComponent.clickOnProcessFilters(); await processCloudDemoPage.processFilterCloudComponent.clickOnProcessFilters();
@@ -300,7 +300,7 @@ describe('Start Task Form', () => {
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks'); await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedById(taskId); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedById(taskId);
await tasksCloudDemoPage.taskFilterCloudComponent.clickCompletedTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('completed-tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedById(taskId); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedById(taskId);
await processCloudDemoPage.processFilterCloudComponent.clickOnProcessFilters(); await processCloudDemoPage.processFilterCloudComponent.clickOnProcessFilters();
@@ -511,7 +511,7 @@ describe('Start Task Form', () => {
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks'); await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedById(taskId); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedById(taskId);
await tasksCloudDemoPage.taskFilterCloudComponent.clickCompletedTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('completed-tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedById(taskId); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedById(taskId);
await tasksCloudDemoPage.taskListCloudComponent().selectRowByTaskId(taskId); await tasksCloudDemoPage.taskListCloudComponent().selectRowByTaskId(taskId);
await contentFileWidget.checkFileIsAttached(testFileModel.name); await contentFileWidget.checkFileIsAttached(testFileModel.name);
@@ -546,7 +546,7 @@ describe('Start Task Form', () => {
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks'); await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedById(taskId); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedById(taskId);
await tasksCloudDemoPage.taskFilterCloudComponent.clickCompletedTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('completed-tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedById(taskId); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedById(taskId);
await tasksCloudDemoPage.taskListCloudComponent().selectRowByTaskId(taskId); await tasksCloudDemoPage.taskListCloudComponent().selectRowByTaskId(taskId);
await contentFileWidget.checkFileIsAttached(testFileModel.name); await contentFileWidget.checkFileIsAttached(testFileModel.name);
@@ -194,7 +194,7 @@ describe('Start Task', () => {
await browser.driver.sleep(1000); await browser.driver.sleep(1000);
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks'); await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
}); });
@@ -69,11 +69,11 @@ describe('Task filters cloud', () => {
const task = await tasksService.createStandaloneTask(newTask, simpleApp); const task = await tasksService.createStandaloneTask(newTask, simpleApp);
await tasksService.claimTask(task.entry.id, simpleApp); await tasksService.claimTask(task.entry.id, simpleApp);
await tasksCloudDemoPage.taskFilterCloudComponent.clickCompletedTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('completed-tasks');
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('Completed Tasks'); await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('Completed Tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(newTask); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(newTask);
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks'); await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(newTask); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(newTask);
@@ -86,11 +86,11 @@ describe('Task filters cloud', () => {
await tasksService.claimTask(toBeCompletedTask.entry.id, simpleApp); await tasksService.claimTask(toBeCompletedTask.entry.id, simpleApp);
await tasksService.completeTask(toBeCompletedTask.entry.id, simpleApp); await tasksService.completeTask(toBeCompletedTask.entry.id, simpleApp);
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks'); await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(completedTask); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(completedTask);
await tasksCloudDemoPage.taskFilterCloudComponent.clickCompletedTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('completed-tasks');
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('Completed Tasks'); await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('Completed Tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(completedTask); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(completedTask);
@@ -158,7 +158,7 @@ describe('Task form cloud component', () => {
describe('Complete task with form - cloud directive', () => { describe('Complete task with form - cloud directive', () => {
it('[C315174] Should be able to complete a standalone task with visible tab with empty value for field', async () => { it('[C315174] Should be able to complete a standalone task with visible tab with empty value for field', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks'); await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(visibilityConditionTasks[0].entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(visibilityConditionTasks[0].entry.name);
@@ -174,13 +174,11 @@ describe('Task form cloud component', () => {
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldValue); await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldValue);
await taskFormCloudComponent.clickCompleteButton(); await taskFormCloudComponent.clickCompleteButton();
await browser.sleep(1000);
await browser.refresh();
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks'); await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(visibilityConditionTasks[0].entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(visibilityConditionTasks[0].entry.name);
await tasksCloudDemoPage.taskFilterCloudComponent.clickCompletedTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('completed-tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(visibilityConditionTasks[0].entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(visibilityConditionTasks[0].entry.name);
await tasksCloudDemoPage.taskListCloudComponent().selectRow(visibilityConditionTasks[0].entry.name); await tasksCloudDemoPage.taskListCloudComponent().selectRow(visibilityConditionTasks[0].entry.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields); await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
@@ -188,7 +186,7 @@ describe('Task form cloud component', () => {
}); });
it('[C315177] Should be able to complete a standalone task with invisible tab with invalid value for field', async () => { it('[C315177] Should be able to complete a standalone task with invisible tab with invalid value for field', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks'); await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(visibilityConditionTasks[1].entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(visibilityConditionTasks[1].entry.name);
@@ -213,13 +211,11 @@ describe('Task form cloud component', () => {
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldField); await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldField);
await taskFormCloudComponent.clickCompleteButton(); await taskFormCloudComponent.clickCompleteButton();
await browser.sleep(1000);
await browser.refresh();
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks'); await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(visibilityConditionTasks[1].entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(visibilityConditionTasks[1].entry.name);
await tasksCloudDemoPage.taskFilterCloudComponent.clickCompletedTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('completed-tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(visibilityConditionTasks[1].entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(visibilityConditionTasks[1].entry.name);
await tasksCloudDemoPage.taskListCloudComponent().selectRow(visibilityConditionTasks[1].entry.name); await tasksCloudDemoPage.taskListCloudComponent().selectRow(visibilityConditionTasks[1].entry.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields); await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
@@ -227,7 +223,7 @@ describe('Task form cloud component', () => {
}); });
it('[C315178] Should be able to complete a standalone task with invisible tab with valid value', async () => { it('[C315178] Should be able to complete a standalone task with invisible tab with valid value', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks'); await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(visibilityConditionTasks[2].entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(visibilityConditionTasks[2].entry.name);
@@ -251,14 +247,12 @@ describe('Task form cloud component', () => {
await widget.textWidget().setValue(widgets.textOneId, value.notDisplayTab); await widget.textWidget().setValue(widgets.textOneId, value.notDisplayTab);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldVar); await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldVar);
await taskFormCloudComponent.clickCompleteButton(); await taskFormCloudComponent.clickCompleteButton();
await browser.sleep(1000);
await browser.refresh();
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks'); await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(visibilityConditionTasks[2].entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(visibilityConditionTasks[2].entry.name);
await tasksCloudDemoPage.taskFilterCloudComponent.clickCompletedTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('completed-tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(visibilityConditionTasks[2].entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(visibilityConditionTasks[2].entry.name);
await tasksCloudDemoPage.taskListCloudComponent().selectRow(visibilityConditionTasks[2].entry.name); await tasksCloudDemoPage.taskListCloudComponent().selectRow(visibilityConditionTasks[2].entry.name);
@@ -267,7 +261,7 @@ describe('Task form cloud component', () => {
}); });
it('[C315175] Should be able to complete a standalone task with invisible tab with empty value for field', async () => { it('[C315175] Should be able to complete a standalone task with invisible tab with empty value for field', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks'); await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(visibilityConditionTasks[3].entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(visibilityConditionTasks[3].entry.name);
@@ -280,13 +274,11 @@ describe('Task form cloud component', () => {
await widget.textWidget().isWidgetNotVisible(widgets.textTwoId); await widget.textWidget().isWidgetNotVisible(widgets.textTwoId);
await taskFormCloudComponent.clickCompleteButton(); await taskFormCloudComponent.clickCompleteButton();
await browser.sleep(1000);
await browser.refresh();
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks'); await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(visibilityConditionTasks[3].entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(visibilityConditionTasks[3].entry.name);
await tasksCloudDemoPage.taskFilterCloudComponent.clickCompletedTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('completed-tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(visibilityConditionTasks[3].entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(visibilityConditionTasks[3].entry.name);
await tasksCloudDemoPage.taskListCloudComponent().selectRow(visibilityConditionTasks[3].entry.name); await tasksCloudDemoPage.taskListCloudComponent().selectRow(visibilityConditionTasks[3].entry.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields); await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
@@ -294,7 +286,7 @@ describe('Task form cloud component', () => {
}); });
it('[C315176] Should not be able to complete a standalone task with visible tab with invalid value for field', async () => { it('[C315176] Should not be able to complete a standalone task with visible tab with invalid value for field', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks'); await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(visibilityConditionTasks[4].entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(visibilityConditionTasks[4].entry.name);
@@ -316,7 +308,7 @@ describe('Task form cloud component', () => {
}); });
it('[C315179] Should be able to complete a standalone task with visible tab with valid value for field', async () => { it('[C315179] Should be able to complete a standalone task with visible tab with valid value for field', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks'); await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(visibilityConditionTasks[5].entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(visibilityConditionTasks[5].entry.name);
@@ -331,13 +323,11 @@ describe('Task form cloud component', () => {
await widget.textWidget().setValue(widgets.textThreeId, value.displayTab); await widget.textWidget().setValue(widgets.textThreeId, value.displayTab);
await taskFormCloudComponent.clickCompleteButton(); await taskFormCloudComponent.clickCompleteButton();
await browser.sleep(1000);
await browser.refresh();
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks'); await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(visibilityConditionTasks[5].entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(visibilityConditionTasks[5].entry.name);
await tasksCloudDemoPage.taskFilterCloudComponent.clickCompletedTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('completed-tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(visibilityConditionTasks[5].entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(visibilityConditionTasks[5].entry.name);
await tasksCloudDemoPage.taskListCloudComponent().selectRow(visibilityConditionTasks[5].entry.name); await tasksCloudDemoPage.taskListCloudComponent().selectRow(visibilityConditionTasks[5].entry.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields); await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
@@ -119,7 +119,7 @@ describe('Task form cloud component', () => {
it('[C310366] Should refresh buttons and form after an action is complete', async () => { it('[C310366] Should refresh buttons and form after an action is complete', async () => {
await appListCloudComponent.goToApp(simpleApp); await appListCloudComponent.goToApp(simpleApp);
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
await expect(tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks'); await expect(tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.editTaskFilterCloudComponent().openFilter(); await tasksCloudDemoPage.editTaskFilterCloudComponent().openFilter();
await tasksCloudDemoPage.editTaskFilterCloudComponent().clearAssignee(); await tasksCloudDemoPage.editTaskFilterCloudComponent().clearAssignee();
@@ -142,7 +142,7 @@ describe('Task form cloud component', () => {
await taskFormCloudComponent.checkReleaseButtonIsDisplayed(); await taskFormCloudComponent.checkReleaseButtonIsDisplayed();
await taskFormCloudComponent.clickCompleteButton(); await taskFormCloudComponent.clickCompleteButton();
await tasksCloudDemoPage.taskFilterCloudComponent.clickCompletedTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('completed-tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedById(formTaskId); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedById(formTaskId);
await tasksCloudDemoPage.taskListCloudComponent().selectRowByTaskId(formTaskId); await tasksCloudDemoPage.taskListCloudComponent().selectRowByTaskId(formTaskId);
@@ -155,7 +155,7 @@ describe('Task form cloud component', () => {
it('[C306872] Should not be able to Release a process task which has only assignee', async () => { it('[C306872] Should not be able to Release a process task which has only assignee', async () => {
await appListCloudComponent.goToApp(simpleApp); await appListCloudComponent.goToApp(simpleApp);
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedById(assigneeTaskId); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedById(assigneeTaskId);
await tasksCloudDemoPage.taskListCloudComponent().selectRowByTaskId(assigneeTaskId); await tasksCloudDemoPage.taskListCloudComponent().selectRowByTaskId(assigneeTaskId);
@@ -171,14 +171,14 @@ describe('Task form cloud component', () => {
}); });
it('[C307032] Should display the appropriate title for the unclaim option of a Task', async () => { it('[C307032] Should display the appropriate title for the unclaim option of a Task', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedById(candidateUsersTask.entry.id); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedById(candidateUsersTask.entry.id);
await tasksCloudDemoPage.taskListCloudComponent().selectRowByTaskId(candidateUsersTask.entry.id); await tasksCloudDemoPage.taskListCloudComponent().selectRowByTaskId(candidateUsersTask.entry.id);
await expect(await taskFormCloudComponent.getReleaseButtonText()).toBe('RELEASE'); await expect(await taskFormCloudComponent.getReleaseButtonText()).toBe('RELEASE');
}); });
it('[C310142] Empty content is displayed when having a task without form', async () => { it('[C310142] Empty content is displayed when having a task without form', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(assigneeTask.entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(assigneeTask.entry.name);
await tasksCloudDemoPage.taskListCloudComponent().selectRow(assigneeTask.entry.name); await tasksCloudDemoPage.taskListCloudComponent().selectRow(assigneeTask.entry.name);
await taskFormCloudComponent.checkFormIsNotDisplayed(); await taskFormCloudComponent.checkFormIsNotDisplayed();
@@ -189,7 +189,7 @@ describe('Task form cloud component', () => {
}); });
it('[C310199] Should not be able to complete a task when required field is empty or invalid data is added to a field', async () => { it('[C310199] Should not be able to complete a task when required field is empty or invalid data is added to a field', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(formValidationsTask.entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(formValidationsTask.entry.name);
await tasksCloudDemoPage.taskListCloudComponent().selectRow(formValidationsTask.entry.name); await tasksCloudDemoPage.taskListCloudComponent().selectRow(formValidationsTask.entry.name);
await taskFormCloudComponent.checkFormIsDisplayed(); await taskFormCloudComponent.checkFormIsDisplayed();
@@ -225,7 +225,7 @@ describe('Task form cloud component', () => {
}); });
it('[C307093] Complete button is not displayed when the task is already completed', async () => { it('[C307093] Complete button is not displayed when the task is already completed', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.clickCompletedTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('completed-tasks');
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('Completed Tasks'); await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('Completed Tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(completedTaskName); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(completedTaskName);
await tasksCloudDemoPage.taskListCloudComponent().selectRow(completedTaskName); await tasksCloudDemoPage.taskListCloudComponent().selectRow(completedTaskName);
@@ -234,7 +234,7 @@ describe('Task form cloud component', () => {
}); });
it('[C307095] Task can not be completed by owner user', async () => { it('[C307095] Task can not be completed by owner user', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks'); await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.editTaskFilterCloudComponent().openFilter(); await tasksCloudDemoPage.editTaskFilterCloudComponent().openFilter();
@@ -250,7 +250,7 @@ describe('Task form cloud component', () => {
}); });
it('[C307110] Task list is displayed after clicking on Cancel button', async () => { it('[C307110] Task list is displayed after clicking on Cancel button', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks'); await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(assigneeTask.entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(assigneeTask.entry.name);
@@ -263,7 +263,7 @@ describe('Task form cloud component', () => {
}); });
it('[C307094] Standalone Task can be completed by a user that is owner and assignee', async () => { it('[C307094] Standalone Task can be completed by a user that is owner and assignee', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks'); await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(toBeCompletedTask.entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(toBeCompletedTask.entry.name);
@@ -273,13 +273,13 @@ describe('Task form cloud component', () => {
await taskFormCloudComponent.clickCompleteButton(); await taskFormCloudComponent.clickCompleteButton();
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(toBeCompletedTask.entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(toBeCompletedTask.entry.name);
await tasksCloudDemoPage.taskFilterCloudComponent.clickCompletedTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('completed-tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(toBeCompletedTask.entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(toBeCompletedTask.entry.name);
await taskFormCloudComponent.checkCompleteButtonIsNotDisplayed(); await taskFormCloudComponent.checkCompleteButtonIsNotDisplayed();
}); });
it('[C307111] Task of a process can be completed by a user that is owner and assignee', async () => { it('[C307111] Task of a process can be completed by a user that is owner and assignee', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks'); await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(completedTask.entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(completedTask.entry.name);
@@ -289,7 +289,7 @@ describe('Task form cloud component', () => {
await taskFormCloudComponent.clickCompleteButton(); await taskFormCloudComponent.clickCompleteButton();
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(completedTask.entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(completedTask.entry.name);
await tasksCloudDemoPage.taskFilterCloudComponent.clickCompletedTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('completed-tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(completedTask.entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(completedTask.entry.name);
await taskFormCloudComponent.checkCompleteButtonIsNotDisplayed(); await taskFormCloudComponent.checkCompleteButtonIsNotDisplayed();
}); });
@@ -138,7 +138,7 @@ describe('Task Header cloud component', () => {
}); });
it('[C291943] Should display task details for assigned task', async () => { it('[C291943] Should display task details for assigned task', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(basicCreatedTaskName); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(basicCreatedTaskName);
await tasksCloudDemoPage.taskListCloudComponent().selectRow(basicCreatedTaskName); await tasksCloudDemoPage.taskListCloudComponent().selectRow(basicCreatedTaskName);
@@ -158,7 +158,7 @@ describe('Task Header cloud component', () => {
}); });
it('[C291944] Should display task details for completed task', async () => { it('[C291944] Should display task details for completed task', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.clickCompletedTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('completed-tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(completedTaskName); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(completedTaskName);
await tasksCloudDemoPage.taskListCloudComponent().selectRow(completedTaskName); await tasksCloudDemoPage.taskListCloudComponent().selectRow(completedTaskName);
@@ -178,7 +178,7 @@ describe('Task Header cloud component', () => {
}); });
it('[C291945] Should Parent Name and Parent Id not be empty in task details for sub task', async () => { it('[C291945] Should Parent Name and Parent Id not be empty in task details for sub task', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(subTask.entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(subTask.entry.name);
await tasksCloudDemoPage.taskListCloudComponent().selectRow(subTask.entry.name); await tasksCloudDemoPage.taskListCloudComponent().selectRow(subTask.entry.name);
@@ -204,19 +204,16 @@ describe('Task Header cloud component', () => {
await startTaskCloudPage.addName(myTaskName); await startTaskCloudPage.addName(myTaskName);
await startTaskCloudPage.typePriorityOf('50'); await startTaskCloudPage.typePriorityOf('50');
await startTaskCloudPage.clickStartButton(); await startTaskCloudPage.clickStartButton();
await tasksCloudDemoPage.taskFilterCloudComponent.clickMyTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('my-tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(myTaskName); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(myTaskName);
await tasksCloudDemoPage.taskListCloudComponent().selectRow(myTaskName); await tasksCloudDemoPage.taskListCloudComponent().selectRow(myTaskName);
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed(); await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await taskHeaderCloudPage.priorityCardTextItem.clickOnEditButton();
await taskHeaderCloudPage.priorityCardTextItem.enterTextField('$$%£W21'); await taskHeaderCloudPage.priorityCardTextItem.enterTextField('$$%£W21');
await taskHeaderCloudPage.priorityCardTextItem.clickOnSaveButton();
const errorMessage = await taskHeaderCloudPage.priorityCardTextItem.getErrorMessage(); const errorMessage = await taskHeaderCloudPage.priorityCardTextItem.getErrorMessage();
await expect(errorMessage).toBe('Enter a different value'); await expect(errorMessage).toBe('Enter a different value');
await taskHeaderCloudPage.priorityCardTextItem.enterTextField('600'); await taskHeaderCloudPage.priorityCardTextItem.enterTextField('600');
await taskHeaderCloudPage.priorityCardTextItem.clickOnSaveButton();
const currentValue = await taskHeaderCloudPage.priorityCardTextItem.getFieldValue(); const currentValue = await taskHeaderCloudPage.priorityCardTextItem.getFieldValue();
await expect(currentValue).toBe('600'); await expect(currentValue).toBe('600');
}); });
@@ -263,7 +260,7 @@ describe('Task Header cloud component', () => {
}); });
it('[C311280] Should pick up the default date format from the app configuration', async () => { it('[C311280] Should pick up the default date format from the app configuration', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.clickCompletedTasksFilter(); await tasksCloudDemoPage.taskFilterCloudComponent.clickTaskFilter('completed-tasks');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(completedTaskName); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(completedTaskName);
await tasksCloudDemoPage.taskListCloudComponent().selectRow(completedTaskName); await tasksCloudDemoPage.taskListCloudComponent().selectRow(completedTaskName);
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed(); await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
@@ -93,7 +93,7 @@ describe('Process list cloud', () => {
await tasksCloudDemoPage.actionAdded('invisibleaction'); await tasksCloudDemoPage.actionAdded('invisibleaction');
await tasksCloudDemoPage.clickAppButton(); await tasksCloudDemoPage.clickAppButton();
await tasksCloudDemoPage.editTaskFilterCloudComponent().openFilter(); await tasksCloudDemoPage.editTaskFilterCloudComponent().openFilter();
await tasksCloudDemoPage.taskFilterCloudComponent.checkMyTasksFilterIsDisplayed(); await tasksCloudDemoPage.taskFilterCloudComponent.checkTaskFilterIsDisplayed('my-tasks');
}); });
it('[C315723] Should be able to see and execute custom action menu', async () => { it('[C315723] Should be able to see and execute custom action menu', async () => {
@@ -128,7 +128,7 @@ describe('Edit task filters and task list properties', () => {
await appListCloudComponent.checkApsContainer(); await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(simpleApp); await appListCloudComponent.goToApp(simpleApp);
await tasksCloudDemoPage.editTaskFilterCloudComponent().openFilter(); await tasksCloudDemoPage.editTaskFilterCloudComponent().openFilter();
await tasksCloudDemoPage.taskFilterCloudComponent.checkMyTasksFilterIsDisplayed(); await tasksCloudDemoPage.taskFilterCloudComponent.checkTaskFilterIsDisplayed('my-tasks');
}); });
it('[C306901] Should display tasks sorted by task name when taskName is selected from sort dropdown', async () => { it('[C306901] Should display tasks sorted by task name when taskName is selected from sort dropdown', async () => {
@@ -111,13 +111,10 @@ describe('Edit task filters and task list properties', () => {
await appListCloudComponent.checkApsContainer(); await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(simpleApp); await appListCloudComponent.goToApp(simpleApp);
await tasksCloudDemoPage.editTaskFilterCloudComponent().openFilter(); await tasksCloudDemoPage.editTaskFilterCloudComponent().openFilter();
await tasksCloudDemoPage.taskFilterCloudComponent.checkMyTasksFilterIsDisplayed(); await tasksCloudDemoPage.taskFilterCloudComponent.checkTaskFilterIsDisplayed('my-tasks');
}); });
it('[C292004] Filter by appName', async () => { it('[C292004] Filter by appName', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.checkMyTasksFilterIsDisplayed();
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await expect(await tasksCloudDemoPage.editTaskFilterCloudComponent().getAppNameDropDownValue()).toEqual(simpleApp); await expect(await tasksCloudDemoPage.editTaskFilterCloudComponent().getAppNameDropDownValue()).toEqual(simpleApp);
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(createdTask.entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(createdTask.entry.name);
@@ -131,9 +128,6 @@ describe('Edit task filters and task list properties', () => {
}); });
it('[C291906] Should be able to see only the task with specific taskId when typing it in the task Id field', async () => { it('[C291906] Should be able to see only the task with specific taskId when typing it in the task Id field', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.checkMyTasksFilterIsDisplayed();
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.editTaskFilterCloudComponent().setId(createdTask.entry.id); await tasksCloudDemoPage.editTaskFilterCloudComponent().setId(createdTask.entry.id);
await expect(await tasksCloudDemoPage.editTaskFilterCloudComponent().getId()).toEqual(createdTask.entry.id); await expect(await tasksCloudDemoPage.editTaskFilterCloudComponent().getId()).toEqual(createdTask.entry.id);
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedById(createdTask.entry.id); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedById(createdTask.entry.id);
@@ -143,9 +137,6 @@ describe('Edit task filters and task list properties', () => {
}); });
it('[C291907] Should be able to see No tasks found when typing an invalid task id', async () => { it('[C291907] Should be able to see No tasks found when typing an invalid task id', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.checkMyTasksFilterIsDisplayed();
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.editTaskFilterCloudComponent().setId('invalidId'); await tasksCloudDemoPage.editTaskFilterCloudComponent().setId('invalidId');
await expect(await tasksCloudDemoPage.editTaskFilterCloudComponent().getId()).toEqual('invalidId'); await expect(await tasksCloudDemoPage.editTaskFilterCloudComponent().getId()).toEqual('invalidId');
@@ -153,9 +144,6 @@ describe('Edit task filters and task list properties', () => {
}); });
it('[C297476] Filter by taskName', async () => { it('[C297476] Filter by taskName', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.checkMyTasksFilterIsDisplayed();
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.editTaskFilterCloudComponent().setTaskName(createdTask.entry.name); await tasksCloudDemoPage.editTaskFilterCloudComponent().setTaskName(createdTask.entry.name);
await expect(await tasksCloudDemoPage.editTaskFilterCloudComponent().getTaskName()).toEqual(createdTask.entry.name); await expect(await tasksCloudDemoPage.editTaskFilterCloudComponent().getTaskName()).toEqual(createdTask.entry.name);
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(createdTask.entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(createdTask.entry.name);
@@ -165,9 +153,6 @@ describe('Edit task filters and task list properties', () => {
}); });
it('[C297613] Should be able to see No tasks found when typing a task name that does not exist', async () => { it('[C297613] Should be able to see No tasks found when typing a task name that does not exist', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.checkMyTasksFilterIsDisplayed();
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.editTaskFilterCloudComponent().setTaskName('invalidName'); await tasksCloudDemoPage.editTaskFilterCloudComponent().setTaskName('invalidName');
await expect(await tasksCloudDemoPage.editTaskFilterCloudComponent().getTaskName()).toEqual('invalidName'); await expect(await tasksCloudDemoPage.editTaskFilterCloudComponent().getTaskName()).toEqual('invalidName');
@@ -175,30 +160,23 @@ describe('Edit task filters and task list properties', () => {
}); });
it('[C297480] Should be able to see only tasks that are part of a specific process when processInstanceId is set', async () => { it('[C297480] Should be able to see only tasks that are part of a specific process when processInstanceId is set', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.checkMyTasksFilterIsDisplayed();
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.editTaskFilterCloudComponent().setProcessInstanceId(processInstance.entry.id); await tasksCloudDemoPage.editTaskFilterCloudComponent().setProcessInstanceId(processInstance.entry.id);
await tasksCloudDemoPage.editTaskFilterCloudComponent().setStatusFilterDropDown('ALL'); await tasksCloudDemoPage.editTaskFilterCloudComponent().setStatusFilterDropDown('ALL');
await tasksCloudDemoPage.editTaskFilterCloudComponent().clearAssignee(); await tasksCloudDemoPage.editTaskFilterCloudComponent().clearAssignee();
await expect(await tasksCloudDemoPage.taskListCloudComponent().getDataTable().getNumberOfRows()).toBe(1); await expect(await tasksCloudDemoPage.taskListCloudComponent().getDataTable().getNumberOfRows()).toBe(1);
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByProcessInstanceId(processInstance.entry.id); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByProcessInstanceId(processInstance.entry.id);
}); });
it('[C297684] Should be able to see No tasks found when typing an invalid processInstanceId', async () => { it('[C297684] Should be able to see No tasks found when typing an invalid processInstanceId', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.checkMyTasksFilterIsDisplayed();
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.editTaskFilterCloudComponent().setProcessInstanceId('invalidTaskId'); await tasksCloudDemoPage.editTaskFilterCloudComponent().setProcessInstanceId('invalidTaskId');
await expect(await tasksCloudDemoPage.taskListCloudComponent().getNoTasksFoundMessage()).toEqual(noTasksFoundMessage); await expect(await tasksCloudDemoPage.taskListCloudComponent().getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
}); });
it('[C297478] Should be able to see only tasks that are assigned to a specific user when assignee is set', async () => { it('[C297478] Should be able to see only tasks that are assigned to a specific user when assignee is set', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.checkMyTasksFilterIsDisplayed();
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.editTaskFilterCloudComponent().setAssignee('admin.adf'); await tasksCloudDemoPage.editTaskFilterCloudComponent().setAssignee('admin.adf');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(createdTask.entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(createdTask.entry.name);
@@ -206,18 +184,12 @@ describe('Edit task filters and task list properties', () => {
}); });
it('[C297686] Should be able to see No tasks found when typing an invalid user to assignee field', async () => { it('[C297686] Should be able to see No tasks found when typing an invalid user to assignee field', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.checkMyTasksFilterIsDisplayed();
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.editTaskFilterCloudComponent().setAssignee('invalid'); await tasksCloudDemoPage.editTaskFilterCloudComponent().setAssignee('invalid');
await expect(await tasksCloudDemoPage.taskListCloudComponent().getNoTasksFoundMessage()).toEqual(noTasksFoundMessage); await expect(await tasksCloudDemoPage.taskListCloudComponent().getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
}); });
it('[C297482] Should be able to see only tasks with specific priority when priority is set', async () => { it('[C297482] Should be able to see only tasks with specific priority when priority is set', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.checkMyTasksFilterIsDisplayed();
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.editTaskFilterCloudComponent().setPriority(priority); await tasksCloudDemoPage.editTaskFilterCloudComponent().setPriority(priority);
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(priorityTask.entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(priorityTask.entry.name);
@@ -225,17 +197,12 @@ describe('Edit task filters and task list properties', () => {
}); });
it('[C297687] Should be able to see No tasks found when typing unused value for priority field', async () => { it('[C297687] Should be able to see No tasks found when typing unused value for priority field', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.checkMyTasksFilterIsDisplayed();
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.editTaskFilterCloudComponent().setPriority('87650'); await tasksCloudDemoPage.editTaskFilterCloudComponent().setPriority('87650');
await expect(await tasksCloudDemoPage.taskListCloudComponent().getNoTasksFoundMessage()).toEqual(noTasksFoundMessage); await expect(await tasksCloudDemoPage.taskListCloudComponent().getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
}); });
it('[C297481] Should be able to see only tasks with specific parentTaskId when parentTaskId is set', async () => { it('[C297481] Should be able to see only tasks with specific parentTaskId when parentTaskId is set', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.checkMyTasksFilterIsDisplayed();
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.editTaskFilterCloudComponent().setParentTaskId(subTask.entry.parentTaskId); await tasksCloudDemoPage.editTaskFilterCloudComponent().setParentTaskId(subTask.entry.parentTaskId);
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(subTask.entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(subTask.entry.name);
@@ -243,9 +210,6 @@ describe('Edit task filters and task list properties', () => {
}); });
it('[C297486] Filter by Owner', async () => { it('[C297486] Filter by Owner', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.checkMyTasksFilterIsDisplayed();
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.editTaskFilterCloudComponent().setStatusFilterDropDown('ALL'); await tasksCloudDemoPage.editTaskFilterCloudComponent().setStatusFilterDropDown('ALL');
await tasksCloudDemoPage.editTaskFilterCloudComponent().clearAssignee(); await tasksCloudDemoPage.editTaskFilterCloudComponent().clearAssignee();
await tasksCloudDemoPage.editTaskFilterCloudComponent().setOwner(testUser.username); await tasksCloudDemoPage.editTaskFilterCloudComponent().setOwner(testUser.username);
@@ -259,9 +223,6 @@ describe('Edit task filters and task list properties', () => {
}); });
it('[C297484] Task is displayed when typing into lastModifiedFrom field a date before the task CreatedDate', async() => { it('[C297484] Task is displayed when typing into lastModifiedFrom field a date before the task CreatedDate', async() => {
await tasksCloudDemoPage.taskFilterCloudComponent.checkMyTasksFilterIsDisplayed();
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.editTaskFilterCloudComponent().setLastModifiedFrom(beforeDate); await tasksCloudDemoPage.editTaskFilterCloudComponent().setLastModifiedFrom(beforeDate);
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(createdTask.entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(createdTask.entry.name);
@@ -270,17 +231,11 @@ describe('Edit task filters and task list properties', () => {
}); });
it('[C297689] Task is not displayed when typing into lastModifiedFrom field the same date as tasks CreatedDate', async () => { it('[C297689] Task is not displayed when typing into lastModifiedFrom field the same date as tasks CreatedDate', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.checkMyTasksFilterIsDisplayed();
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.editTaskFilterCloudComponent().setLastModifiedFrom(currentDate); await tasksCloudDemoPage.editTaskFilterCloudComponent().setLastModifiedFrom(currentDate);
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(createdTask.entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(createdTask.entry.name);
}); });
it('[C297485] Task is displayed when typing into lastModifiedTo field a date after the task CreatedDate', async () => { it('[C297485] Task is displayed when typing into lastModifiedTo field a date after the task CreatedDate', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.checkMyTasksFilterIsDisplayed();
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.editTaskFilterCloudComponent().setLastModifiedFrom(afterDate); await tasksCloudDemoPage.editTaskFilterCloudComponent().setLastModifiedFrom(afterDate);
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(createdTask.entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(createdTask.entry.name);
@@ -289,19 +244,12 @@ describe('Edit task filters and task list properties', () => {
}); });
it('[C297690] Task is not displayed when typing into lastModifiedTo field the same date as tasks CreatedDate', async () => { it('[C297690] Task is not displayed when typing into lastModifiedTo field the same date as tasks CreatedDate', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.checkMyTasksFilterIsDisplayed();
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.editTaskFilterCloudComponent().setLastModifiedTo(currentDate); await tasksCloudDemoPage.editTaskFilterCloudComponent().setLastModifiedTo(currentDate);
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(createdTask.entry.name); await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(createdTask.entry.name);
}); });
it('[C297691] Task is not displayed when typing into lastModifiedFrom field a date before the task due date ' + it('[C297691] Task is not displayed when typing into lastModifiedFrom field a date before the task due date ' +
'and into lastModifiedTo a date before task due date', async () => { 'and into lastModifiedTo a date before task due date', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.checkMyTasksFilterIsDisplayed();
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.editTaskFilterCloudComponent().setLastModifiedFrom(beforeDate); await tasksCloudDemoPage.editTaskFilterCloudComponent().setLastModifiedFrom(beforeDate);
await tasksCloudDemoPage.editTaskFilterCloudComponent().setLastModifiedTo(beforeDate); await tasksCloudDemoPage.editTaskFilterCloudComponent().setLastModifiedTo(beforeDate);
await tasksCloudDemoPage.editTaskFilterCloudComponent().setTaskName(createdTask.entry.name); await tasksCloudDemoPage.editTaskFilterCloudComponent().setTaskName(createdTask.entry.name);
@@ -310,10 +258,6 @@ describe('Edit task filters and task list properties', () => {
it('[C297692] Task is displayed when typing into lastModifiedFrom field a date before the tasks due date ' + it('[C297692] Task is displayed when typing into lastModifiedFrom field a date before the tasks due date ' +
'and into lastModifiedTo a date after', async () => { 'and into lastModifiedTo a date after', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.checkMyTasksFilterIsDisplayed();
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.editTaskFilterCloudComponent().setLastModifiedFrom(beforeDate); await tasksCloudDemoPage.editTaskFilterCloudComponent().setLastModifiedFrom(beforeDate);
await tasksCloudDemoPage.editTaskFilterCloudComponent().setLastModifiedTo(afterDate); await tasksCloudDemoPage.editTaskFilterCloudComponent().setLastModifiedTo(afterDate);
await tasksCloudDemoPage.editTaskFilterCloudComponent().setTaskName(createdTask.entry.name); await tasksCloudDemoPage.editTaskFilterCloudComponent().setTaskName(createdTask.entry.name);
@@ -322,10 +266,6 @@ describe('Edit task filters and task list properties', () => {
it('[C297693] Task is not displayed when typing into lastModifiedFrom field a date after the tasks due date ' + it('[C297693] Task is not displayed when typing into lastModifiedFrom field a date after the tasks due date ' +
'and into lastModifiedTo a date after', async () => { 'and into lastModifiedTo a date after', async () => {
await tasksCloudDemoPage.taskFilterCloudComponent.checkMyTasksFilterIsDisplayed();
await expect(await tasksCloudDemoPage.taskFilterCloudComponent.getActiveFilterName()).toBe('My Tasks');
await tasksCloudDemoPage.editTaskFilterCloudComponent().setLastModifiedFrom(afterDate); await tasksCloudDemoPage.editTaskFilterCloudComponent().setLastModifiedFrom(afterDate);
await tasksCloudDemoPage.editTaskFilterCloudComponent().setLastModifiedTo(afterDate); await tasksCloudDemoPage.editTaskFilterCloudComponent().setLastModifiedTo(afterDate);
await expect(await tasksCloudDemoPage.taskListCloudComponent().getNoTasksFoundMessage()).toEqual(noTasksFoundMessage); await expect(await tasksCloudDemoPage.taskListCloudComponent().getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
@@ -73,7 +73,7 @@ describe('Task list cloud - selection', () => {
await navigationBarPage.navigateToProcessServicesCloudPage(); await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer(); await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(simpleApp); await appListCloudComponent.goToApp(simpleApp);
await tasksCloudDemoPage.taskFilterCloudComponent.checkMyTasksFilterIsDisplayed(); await tasksCloudDemoPage.taskFilterCloudComponent.checkTaskFilterIsDisplayed('my-tasks');
await tasksCloudDemoPage.clickSettingsButton(); await tasksCloudDemoPage.clickSettingsButton();
await tasksCloudDemoPage.disableDisplayTaskDetails(); await tasksCloudDemoPage.disableDisplayTaskDetails();
await tasksCloudDemoPage.clickAppButton(); await tasksCloudDemoPage.clickAppButton();
+15 -15
View File
@@ -45,7 +45,8 @@ describe('Info Drawer', () => {
const date = { const date = {
form: '12/08/2017', form: '12/08/2017',
header: 'Aug 12, 2017' header: 'Aug 12, 2017',
dateFormat: 'll'
}; };
const taskDetails = { const taskDetails = {
@@ -65,19 +66,19 @@ describe('Info Drawer', () => {
beforeAll(async () => { beforeAll(async () => {
const users = new UsersActions(); const users = new UsersActions();
this.alfrescoJsApi = new AlfrescoApi({ this.alfrescoApi = new AlfrescoApi({
provider: 'BPM', provider: 'BPM',
hostBpm: browser.params.testConfig.adf_aps.host hostBpm: browser.params.testConfig.adf_aps.host
}); });
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword); await this.alfrescoApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
newTenant = await this.alfrescoJsApi.activiti.adminTenantsApi.createTenant(new Tenant()); newTenant = await this.alfrescoApi.activiti.adminTenantsApi.createTenant(new Tenant());
const assigneeUserModel = await users.createApsUser(this.alfrescoJsApi, newTenant.id); const assigneeUserModel = await users.createApsUser(this.alfrescoApi, newTenant.id);
assigneeUserModelFullName = assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName; assigneeUserModelFullName = assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName;
const processUserModel = await users.createApsUser(this.alfrescoJsApi, newTenant.id); const processUserModel = await users.createApsUser(this.alfrescoApi, newTenant.id);
processUserModelFullName = processUserModel.firstName + ' ' + processUserModel.lastName; processUserModelFullName = processUserModel.firstName + ' ' + processUserModel.lastName;
await this.alfrescoJsApi.login(processUserModel.email, processUserModel.password); await this.alfrescoApi.login(processUserModel.email, processUserModel.password);
const applicationsService = new ApplicationsUtil(this.alfrescoJsApi); const applicationsService = new ApplicationsUtil(this.alfrescoApi);
appCreated = await applicationsService.importPublishDeployApp(app.file_path); appCreated = await applicationsService.importPublishDeployApp(app.file_path);
await loginPage.loginToProcessServicesUsingUserModel(processUserModel); await loginPage.loginToProcessServicesUsingUserModel(processUserModel);
@@ -85,8 +86,8 @@ describe('Info Drawer', () => {
afterAll(async () => { afterAll(async () => {
await this.alfrescoApi.activiti.modelsApi.deleteModel(appCreated.id); await this.alfrescoApi.activiti.modelsApi.deleteModel(appCreated.id);
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword); await this.alfrescoApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
await this.alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(newTenant.id); await this.alfrescoApi.activiti.adminTenantsApi.deleteTenant(newTenant.id);
}); });
beforeEach(async () => { beforeEach(async () => {
@@ -218,7 +219,7 @@ describe('Info Drawer', () => {
}); });
await expect(await taskPage.taskDetails().isAssigneeClickable()).toBeTruthy(); await expect(await taskPage.taskDetails().isAssigneeClickable()).toBeTruthy();
await BrowserActions.click(taskPage.taskDetails().assigneeField); await BrowserActions.click(taskPage.taskDetails().assigneeButton);
const cancelSearch = element(by.css('button[id="close-people-search"]')); const cancelSearch = element(by.css('button[id="close-people-search"]'));
await BrowserVisibility.waitUntilElementIsPresent(cancelSearch); await BrowserVisibility.waitUntilElementIsPresent(cancelSearch);
await BrowserActions.click(cancelSearch); await BrowserActions.click(cancelSearch);
@@ -231,7 +232,7 @@ describe('Info Drawer', () => {
}); });
await expect(await taskPage.taskDetails().isAssigneeClickable()).toBeTruthy(); await expect(await taskPage.taskDetails().isAssigneeClickable()).toBeTruthy();
await BrowserActions.click(taskPage.taskDetails().assigneeField); await BrowserActions.click(taskPage.taskDetails().assigneeButton);
const addPeople = element(by.css('button[id="add-people"]')); const addPeople = element(by.css('button[id="add-people"]'));
await BrowserVisibility.waitUntilElementIsPresent(addPeople); await BrowserVisibility.waitUntilElementIsPresent(addPeople);
await BrowserActions.click(addPeople); await BrowserActions.click(addPeople);
@@ -305,10 +306,10 @@ describe('Info Drawer', () => {
formName: app.formName formName: app.formName
}); });
await taskPage.taskDetails().updateDescription('');
await expect(await taskPage.taskDetails().getDescriptionPlaceholder()).toEqual('No description');
await taskPage.taskDetails().updateDescription('Good Bye'); await taskPage.taskDetails().updateDescription('Good Bye');
await expect(await taskPage.taskDetails().getDescription()).toEqual('Good Bye'); await expect(await taskPage.taskDetails().getDescription()).toEqual('Good Bye');
await taskPage.taskDetails().updateDescription();
await expect(await taskPage.taskDetails().getDescription()).toEqual('No description');
await taskPage.taskDetails().clickCompleteFormTask(); await taskPage.taskDetails().clickCompleteFormTask();
}); });
@@ -330,7 +331,6 @@ describe('Info Drawer', () => {
await expect(await taskPage.taskDetails().getPriority()).toEqual(taskDetails.priority); await expect(await taskPage.taskDetails().getPriority()).toEqual(taskDetails.priority);
await expect(await taskPage.taskDetails().getParentName()).toEqual(taskDetails.parentName); await expect(await taskPage.taskDetails().getParentName()).toEqual(taskDetails.parentName);
await taskPage.taskDetails().checkDueDatePickerButtonIsNotDisplayed(); await taskPage.taskDetails().checkDueDatePickerButtonIsNotDisplayed();
await taskPage.taskDetails().checkEditDescriptionButtonIsNotDisplayed();
await taskPage.taskDetails().clickCompleteFormTask(); await taskPage.taskDetails().clickCompleteFormTask();
}); });
-2
View File
@@ -323,8 +323,6 @@ describe('Task Details component', () => {
await taskPage.taskDetails().checkEditableAssigneeIsNotDisplayed(); await taskPage.taskDetails().checkEditableAssigneeIsNotDisplayed();
await taskPage.taskDetails().checkEditableFormIsNotDisplayed(); await taskPage.taskDetails().checkEditableFormIsNotDisplayed();
await taskPage.taskDetails().checkEditDescriptionButtonIsNotDisplayed();
await taskPage.taskDetails().checkEditPriorityButtonIsNotDisplayed();
await taskPage.taskDetails().checkDueDatePickerButtonIsNotDisplayed(); await taskPage.taskDetails().checkDueDatePickerButtonIsNotDisplayed();
}); });
}); });
@@ -74,7 +74,8 @@ describe('People and Group widget', () => {
await widget.groupWidget().insertGroup(groupVisibilityForm.FIELD.widget_id, groupVisibilityForm.searchTerm); await widget.groupWidget().insertGroup(groupVisibilityForm.FIELD.widget_id, groupVisibilityForm.searchTerm);
await widget.groupWidget().checkDropDownListIsDisplayed(); await widget.groupWidget().checkDropDownListIsDisplayed();
await expect(await widget.groupWidget().getDropDownList()).toEqual([ 'Heros', 'Users' ]); const suggestions = await widget.groupWidget().getDropDownList();
await expect(suggestions.sort()).toEqual([ 'Heros', 'Users' ]);
await widget.groupWidget().selectGroupFromDropDown('Users'); await widget.groupWidget().selectGroupFromDropDown('Users');
await taskPage.taskDetails().clickCompleteFormTask(); await taskPage.taskDetails().clickCompleteFormTask();
}); });
@@ -1,7 +1,7 @@
<div class="adf-metadata-properties"> <div class="adf-metadata-properties">
<mat-accordion displayMode="flat" [multi]="multi"> <mat-accordion displayMode="flat"
<mat-expansion-panel [multi]="multi">
*ngIf="displayDefaultProperties" <mat-expansion-panel *ngIf="displayDefaultProperties"
[expanded]="canExpandProperties()" [expanded]="canExpandProperties()"
[attr.data-automation-id]="'adf-metadata-group-properties'"> [attr.data-automation-id]="'adf-metadata-group-properties'">
<mat-expansion-panel-header> <mat-expansion-panel-header>
@@ -23,7 +23,8 @@
<ng-container *ngIf="expanded"> <ng-container *ngIf="expanded">
<ng-container *ngIf="groupedProperties$ | async; else loading; let groupedProperties"> <ng-container *ngIf="groupedProperties$ | async; else loading; let groupedProperties">
<div *ngFor="let group of groupedProperties; let first = first;" class="adf-metadata-grouped-properties-container"> <div *ngFor="let group of groupedProperties; let first = first;"
class="adf-metadata-grouped-properties-container">
<mat-expansion-panel *ngIf="showGroup(group) || editable" <mat-expansion-panel *ngIf="showGroup(group) || editable"
[attr.data-automation-id]="'adf-metadata-group-' + group.title" [attr.data-automation-id]="'adf-metadata-group-' + group.title"
[expanded]="canExpandTheCard(group) || !displayDefaultProperties && first"> [expanded]="canExpandTheCard(group) || !displayDefaultProperties && first">
@@ -51,4 +52,18 @@
</ng-template> </ng-template>
</ng-container> </ng-container>
</mat-accordion> </mat-accordion>
<div class="adf-metadata-action-buttons"
*ngIf="editable">
<button mat-button
(click)="cancelChanges()"
data-automation-id="reset-metadata"
[disabled]="!hasMetadataChanged">Cancel</button>
<button mat-raised-button
(click)="saveChanges()"
color="primary"
data-automation-id="save-metadata"
[disabled]="!hasMetadataChanged">Save</button>
</div>
</div> </div>
@@ -13,9 +13,15 @@
height: 64px; height: 64px;
} }
.mat-expansion-panel:not([class*=mat-elevation-z]) { .mat-expansion-panel:not([class*='mat-elevation-z']) {
box-shadow: none; box-shadow: none;
} }
} }
&-metadata-action-buttons {
display: flex;
justify-content: space-evenly;
margin: 10px;
}
} }
} }
@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed, tick, fakeAsync } from '@angular/core/testing';
import { SimpleChange } from '@angular/core'; import { SimpleChange } from '@angular/core';
import { By } from '@angular/platform-browser'; import { By } from '@angular/platform-browser';
import { Node } from '@alfresco/js-api'; import { Node } from '@alfresco/js-api';
@@ -108,49 +108,47 @@ describe('ContentMetadataComponent', () => {
}); });
describe('Saving', () => { describe('Saving', () => {
it('should save the node on itemUpdate', () => { it('itemUpdate', fakeAsync(() => {
const property = <CardViewBaseItemModel> { key: 'property-key', value: 'original-value' }; spyOn(component, 'updateChanges').and.callThrough();
spyOn(nodesApiService, 'updateNode').and.callThrough(); const property = <CardViewBaseItemModel> { key: 'properties.property-key', value: 'original-value' };
updateService.update(property, 'updated-value'); updateService.update(property, 'updated-value');
expect(nodesApiService.updateNode).toHaveBeenCalledWith('node-id', { tick(600);
'property-key': 'updated-value' expect(component.hasMetadataChanged).toEqual(true);
}); expect(component.updateChanges).toHaveBeenCalled();
}); expect(component.changedProperties).toEqual({ properties: { 'property-key': 'updated-value' } });
}));
it('should update the node on successful save', async(() => { it('should save changedProperties on save click', fakeAsync(async () => {
const property = <CardViewBaseItemModel> { key: 'property-key', value: 'original-value' }; component.editable = true;
const property = <CardViewBaseItemModel> { key: 'properties.property-key', value: 'original-value' };
const expectedNode = Object.assign({}, node, { name: 'some-modified-value' }); const expectedNode = Object.assign({}, node, { name: 'some-modified-value' });
spyOn(nodesApiService, 'updateNode').and.callFake(() => { spyOn(nodesApiService, 'updateNode').and.callFake(() => {
return of(expectedNode); return of(expectedNode);
}); });
updateService.update(property, 'updated-value'); updateService.update(property, 'updated-value');
tick(600);
fixture.whenStable().then(() => { fixture.detectChanges();
await fixture.whenStable();
const saveButton = fixture.debugElement.query(By.css('[data-automation-id="save-metadata"]'));
saveButton.nativeElement.click();
await fixture.whenStable();
expect(component.node).toEqual(expectedNode); expect(component.node).toEqual(expectedNode);
}); expect(nodesApiService.updateNode).toHaveBeenCalled();
})); }));
it('should throw error on unsuccessful save', () => { it('should throw error on unsuccessful save', fakeAsync(async (done) => {
const property = <CardViewBaseItemModel> { key: 'property-key', value: 'original-value' };
const logService: LogService = TestBed.get(LogService); const logService: LogService = TestBed.get(LogService);
component.editable = true;
spyOn(nodesApiService, 'updateNode').and.callFake(() => { const property = <CardViewBaseItemModel> { key: 'properties.property-key', value: 'original-value' };
return throwError(new Error('My bad'));
});
updateService.update(property, 'updated-value'); updateService.update(property, 'updated-value');
tick(600);
expect(logService.error).toHaveBeenCalledWith(new Error('My bad'));
});
it('should raise error message', (done) => {
const property = <CardViewBaseItemModel> { key: 'property-key', value: 'original-value' };
const sub = contentMetadataService.error.subscribe((err) => { const sub = contentMetadataService.error.subscribe((err) => {
expect(logService.error).toHaveBeenCalledWith(new Error('My bad'));
expect(err.statusCode).toBe(0); expect(err.statusCode).toBe(0);
expect(err.message).toBe('METADATA.ERRORS.GENERIC'); expect(err.message).toBe('METADATA.ERRORS.GENERIC');
sub.unsubscribe(); sub.unsubscribe();
@@ -161,8 +159,33 @@ describe('ContentMetadataComponent', () => {
return throwError(new Error('My bad')); return throwError(new Error('My bad'));
}); });
updateService.update(property, 'updated-value'); fixture.detectChanges();
await fixture.whenStable();
const saveButton = fixture.debugElement.query(By.css('[data-automation-id="save-metadata"]'));
saveButton.nativeElement.click();
fixture.detectChanges();
}));
}); });
describe('Reseting', () => {
it('should reset changedProperties on reset click', async(async () => {
component.changedProperties = { properties: { 'property-key': 'updated-value' } };
component.hasMetadataChanged = true;
component.editable = true;
const expectedNode = Object.assign({}, node, { name: 'some-modified-value' });
spyOn(nodesApiService, 'updateNode').and.callFake(() => {
return of(expectedNode);
});
fixture.detectChanges();
await fixture.whenStable();
const resetButton = fixture.debugElement.query(By.css('[data-automation-id="reset-metadata"]'));
resetButton.nativeElement.click();
fixture.detectChanges();
expect(component.changedProperties).toEqual({});
expect(nodesApiService.updateNode).not.toHaveBeenCalled();
}));
}); });
describe('Properties loading', () => { describe('Properties loading', () => {
@@ -271,14 +294,16 @@ describe('ContentMetadataComponent', () => {
it('should display card views group when there is at least one property that is not empty', async(() => { it('should display card views group when there is at least one property that is not empty', async(() => {
component.expanded = true; component.expanded = true;
fixture.detectChanges(); fixture.detectChanges();
const cardViewGroup = {title: 'Group 1', properties: [{ const cardViewGroup = {
title: 'Group 1', properties: [{
data: null, data: null,
default: null, default: null,
displayValue: 'DefaultName', displayValue: 'DefaultName',
icon: '', icon: '',
key: 'properties.cm:default', key: 'properties.cm:default',
label: 'To' label: 'To'
}]}; }]
};
spyOn(contentMetadataService, 'getGroupedProperties').and.returnValue(of([{ properties: [cardViewGroup] }])); spyOn(contentMetadataService, 'getGroupedProperties').and.returnValue(of([{ properties: [cardViewGroup] }]));
component.ngOnChanges({ node: new SimpleChange(node, expectedNode, false) }); component.ngOnChanges({ node: new SimpleChange(node, expectedNode, false) });
@@ -25,11 +25,12 @@ import {
CardViewUpdateService, CardViewUpdateService,
AlfrescoApiService, AlfrescoApiService,
TranslationService, TranslationService,
AppConfigService AppConfigService,
CardViewBaseItemModel
} from '@alfresco/adf-core'; } from '@alfresco/adf-core';
import { ContentMetadataService } from '../../services/content-metadata.service'; import { ContentMetadataService } from '../../services/content-metadata.service';
import { CardViewGroup } from '../../interfaces/content-metadata.interfaces'; import { CardViewGroup } from '../../interfaces/content-metadata.interfaces';
import { switchMap, takeUntil, catchError } from 'rxjs/operators'; import { takeUntil, debounceTime, catchError } from 'rxjs/operators';
@Component({ @Component({
selector: 'adf-content-metadata', selector: 'adf-content-metadata',
@@ -90,6 +91,10 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
basicProperties$: Observable<CardViewItem[]>; basicProperties$: Observable<CardViewItem[]>;
groupedProperties$: Observable<CardViewGroup[]>; groupedProperties$: Observable<CardViewGroup[]>;
changedProperties = {};
hasMetadataChanged = false;
private targetProperty: CardViewBaseItemModel;
constructor( constructor(
private contentMetadataService: ContentMetadataService, private contentMetadataService: ContentMetadataService,
private cardViewUpdateService: CardViewUpdateService, private cardViewUpdateService: CardViewUpdateService,
@@ -107,23 +112,13 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
ngOnInit() { ngOnInit() {
this.cardViewUpdateService.itemUpdated$ this.cardViewUpdateService.itemUpdated$
.pipe( .pipe(
switchMap((changes) => debounceTime(500),
this.saveNode(changes).pipe( takeUntil(this.onDestroy$))
catchError((err) => {
this.cardViewUpdateService.updateElement(changes.target);
this.handleUpdateError(err);
return of(null);
})
)
),
takeUntil(this.onDestroy$)
)
.subscribe( .subscribe(
(updatedNode) => { (updatedNode) => {
if (updatedNode) { this.hasMetadataChanged = true;
Object.assign(this.node, updatedNode); this.targetProperty = updatedNode.target;
this.alfrescoApiService.nodeUpdated.next(this.node); this.updateChanges(updatedNode.changed);
}
} }
); );
@@ -165,8 +160,43 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
} }
} }
private saveNode({ changed: nodeBody }): Observable<Node> { updateChanges(updatedNodeChanges) {
return this.nodesApiService.updateNode(this.node.id, nodeBody); Object.keys(updatedNodeChanges).map((propertyGroup: string) => {
if (typeof updatedNodeChanges[propertyGroup] === 'object') {
this.changedProperties[propertyGroup] = {
...this.changedProperties[propertyGroup],
...updatedNodeChanges[propertyGroup]
};
} else {
this.changedProperties[propertyGroup] = updatedNodeChanges[propertyGroup];
}
});
}
saveChanges() {
this.nodesApiService.updateNode(this.node.id, this.changedProperties).pipe(
catchError((err) => {
this.cardViewUpdateService.updateElement(this.targetProperty);
this.handleUpdateError(err);
return of(null);
}))
.subscribe((updatedNode) => {
if (updatedNode) {
this.revertChanges();
Object.assign(this.node, updatedNode);
this.alfrescoApiService.nodeUpdated.next(this.node);
}
});
}
revertChanges() {
this.changedProperties = {};
this.hasMetadataChanged = false;
}
cancelChanges() {
this.revertChanges();
this.loadProperties(this.node);
} }
showGroup(group: CardViewGroup): boolean { showGroup(group: CardViewGroup): boolean {
@@ -195,5 +225,4 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
event.stopPropagation(); event.stopPropagation();
} }
} }
} }
+2
View File
@@ -1,12 +1,14 @@
@import './components/card-view-arrayitem/card-view-arrayitem.component'; @import './components/card-view-arrayitem/card-view-arrayitem.component';
@import './components/card-view-dateitem/card-view-dateitem.component'; @import './components/card-view-dateitem/card-view-dateitem.component';
@import './components/card-view-textitem/card-view-textitem.component'; @import './components/card-view-textitem/card-view-textitem.component';
@import './components/card-view-keyvaluepairsitem/card-view-keyvaluepairsitem.component';
@import './components/card-view/card-view.component'; @import './components/card-view/card-view.component';
@import '~@mat-datetimepicker/core/datetimepicker/datetimepicker-theme.scss'; @import '~@mat-datetimepicker/core/datetimepicker/datetimepicker-theme.scss';
@mixin adf-card-view-module-theme($theme) { @mixin adf-card-view-module-theme($theme) {
@include adf-card-view-dateitem-theme($theme); @include adf-card-view-dateitem-theme($theme);
@include adf-card-view-textitem-theme($theme); @include adf-card-view-textitem-theme($theme);
@include adf-card-view-keyvaluepairsitem-theme($theme);
@include adf-card-view-theme($theme); @include adf-card-view-theme($theme);
@include mat-datetimepicker-theme($theme); @include mat-datetimepicker-theme($theme);
@include adf-card-view-array-item-theme($theme); @include adf-card-view-array-item-theme($theme);
+3 -1
View File
@@ -30,7 +30,8 @@ import {
MatChipsModule, MatChipsModule,
MatMenuModule, MatMenuModule,
MatCardModule, MatCardModule,
MatTooltipModule MatTooltipModule,
MatSlideToggleModule
} from '@angular/material'; } from '@angular/material';
import { MatDatetimepickerModule, MatNativeDatetimeModule } from '@mat-datetimepicker/core'; import { MatDatetimepickerModule, MatNativeDatetimeModule } from '@mat-datetimepicker/core';
import { FlexLayoutModule } from '@angular/flex-layout'; import { FlexLayoutModule } from '@angular/flex-layout';
@@ -66,6 +67,7 @@ import { CardViewArrayItemComponent } from './components/card-view-arrayitem/car
MatCardModule, MatCardModule,
MatDatetimepickerModule, MatDatetimepickerModule,
MatNativeDatetimeModule, MatNativeDatetimeModule,
MatSlideToggleModule,
MatTooltipModule MatTooltipModule
], ],
declarations: [ declarations: [
@@ -41,6 +41,8 @@
&-property-value { &-property-value {
.mat-chip-list { .mat-chip-list {
width: 100%;
padding-top: 6px;
cursor: pointer; cursor: pointer;
} }
.mat-chip { .mat-chip {
@@ -1,12 +1,13 @@
<ng-container *ngIf="!property.isEmpty() || isEditable()"> <ng-container *ngIf="!property.isEmpty() || isEditable()">
<div [attr.data-automation-id]="'card-boolean-label-' + property.key" class="adf-property-label">{{ property.label | translate }}</div>
<div class="adf-property-value"> <div class="adf-property-value">
<mat-checkbox <mat-checkbox [attr.data-automation-id]="'card-boolean-' + property.key"
[attr.data-automation-id]="'card-boolean-' + property.key"
[attr.title]="'CORE.METADATA.ACTIONS.TOGGLE' | translate" [attr.title]="'CORE.METADATA.ACTIONS.TOGGLE' | translate"
[checked]="property.displayValue" [checked]="property.displayValue"
[disabled]="!isEditable()" [disabled]="!isEditable()"
color="primary"
(change)="changed($event)"> (change)="changed($event)">
<div [attr.data-automation-id]="'card-boolean-label-' + property.key"
class="adf-property-label">{{ property.label | translate }}</div>
</mat-checkbox> </mat-checkbox>
</div> </div>
</ng-container> </ng-container>
@@ -1,8 +1,10 @@
<div *ngIf="showProperty() || isEditable()" <div class="adf-property-label"
[attr.data-automation-id]="'card-dateitem-label-' + property.key" [attr.data-automation-id]="'card-dateitem-label-' + property.key"
class="adf-property-label">{{ property.label | translate }}</div> *ngIf="showProperty() || isEditable()">
{{ property.label | translate }}
</div>
<div class="adf-property-value"> <div class="adf-property-value adf-property-value-padding-top">
<span *ngIf="!isEditable()" <span *ngIf="!isEditable()"
[attr.data-automation-id]="'card-' + property.type + '-value-' + property.key"> [attr.data-automation-id]="'card-' + property.type + '-value-' + property.key">
<span [attr.data-automation-id]="'card-dateitem-' + property.key"> <span [attr.data-automation-id]="'card-dateitem-' + property.key">
@@ -1,4 +1,6 @@
@mixin adf-card-view-dateitem-theme($theme) { @mixin adf-card-view-dateitem-theme($theme) {
$foreground: map-get($theme, foreground);
.adf { .adf {
&-invisible-date-input { &-invisible-date-input {
height: 2px; height: 2px;
@@ -13,6 +15,8 @@
&-dateitem-editable { &-dateitem-editable {
cursor: pointer; cursor: pointer;
border-bottom: 1px solid mat-color($foreground, text, 0.42);
padding-bottom: 6px;
&-controls { &-controls {
display: flex; display: flex;
@@ -1,21 +1,20 @@
<div [attr.data-automation-id]="'card-key-value-pairs-label-' + property.key" class="adf-property-label">{{ property.label | translate }}</div> <div [attr.data-automation-id]="'card-key-value-pairs-label-' + property.key"
<div class="adf-property-value"> class="adf-property-label">{{ property.label | translate }}</div>
<div class="adf-property-field">
<div *ngIf="isEditable()"> <div *ngIf="!isEditable()"
{{ 'CORE.CARDVIEW.KEYVALUEPAIRS.ADD' | translate }} class="adf-card-view__key-value-pairs__read-only adf-property-value">
<button (click)="add()" mat-icon-button class="adf-card-view__key-value-pairs__add-btn" [attr.data-automation-id]="'card-key-value-pairs-button-' + property.key"> <mat-table #table
<mat-icon>add</mat-icon> [dataSource]="matTableValues"
</button> class="mat-elevation-z8">
</div>
<div *ngIf="!isEditable()" class="adf-card-view__key-value-pairs__read-only">
<mat-table #table [dataSource]="matTableValues" class="mat-elevation-z8">
<ng-container matColumnDef="name"> <ng-container matColumnDef="name">
<mat-header-cell *matHeaderCellDef>{{ 'CORE.CARDVIEW.KEYVALUEPAIRS.NAME' | translate }}</mat-header-cell> <mat-header-cell *matHeaderCellDef>{{ 'CORE.CARDVIEW.KEYVALUEPAIRS.NAME' | translate }}
</mat-header-cell>
<mat-cell *matCellDef="let item">{{item.name}}</mat-cell> <mat-cell *matCellDef="let item">{{item.name}}</mat-cell>
</ng-container> </ng-container>
<ng-container matColumnDef="value"> <ng-container matColumnDef="value">
<mat-header-cell *matHeaderCellDef>{{ 'CORE.CARDVIEW.KEYVALUEPAIRS.VALUE' | translate }}</mat-header-cell> <mat-header-cell *matHeaderCellDef>{{ 'CORE.CARDVIEW.KEYVALUEPAIRS.VALUE' | translate }}
</mat-header-cell>
<mat-cell *matCellDef="let item">{{item.value}}</mat-cell> <mat-cell *matCellDef="let item">{{item.value}}</mat-cell>
</ng-container> </ng-container>
@@ -25,15 +24,17 @@
</div> </div>
<div class="adf-card-view__key-value-pairs" *ngIf="isEditable() && values && values.length"> <div class="adf-card-view__key-value-pairs adf-property-value"
*ngIf="isEditable() && values && values.length">
<div class="adf-card-view__key-value-pairs__row"> <div class="adf-card-view__key-value-pairs__row">
<div class="adf-card-view__key-value-pairs__col">{{ 'CORE.CARDVIEW.KEYVALUEPAIRS.NAME' | translate }}</div> <div class="adf-card-view__key-value-pairs__col">{{ 'CORE.CARDVIEW.KEYVALUEPAIRS.NAME' | translate }}</div>
<div class="adf-card-view__key-value-pairs__col">{{ 'CORE.CARDVIEW.KEYVALUEPAIRS.VALUE' | translate }}</div> <div class="adf-card-view__key-value-pairs__col">{{ 'CORE.CARDVIEW.KEYVALUEPAIRS.VALUE' | translate }}</div>
</div> </div>
<div class="adf-card-view__key-value-pairs__row" *ngFor="let item of values; let i = index"> <div class="adf-card-view__key-value-pairs__row"
*ngFor="let item of values; let i = index">
<div class="adf-card-view__key-value-pairs__col"> <div class="adf-card-view__key-value-pairs__col">
<mat-form-field class="adf-example-full-width"> <mat-form-field>
<input matInput <input matInput
placeholder="{{ 'CORE.CARDVIEW.KEYVALUEPAIRS.NAME' | translate }}" placeholder="{{ 'CORE.CARDVIEW.KEYVALUEPAIRS.NAME' | translate }}"
(blur)="onBlur(item.value)" (blur)="onBlur(item.value)"
@@ -42,17 +43,30 @@
</mat-form-field> </mat-form-field>
</div> </div>
<div class="adf-card-view__key-value-pairs__col"> <div class="adf-card-view__key-value-pairs__col">
<mat-form-field class="adf-example-full-width"> <mat-form-field>
<input matInput <input matInput
placeholder="{{ 'CORE.CARDVIEW.KEYVALUEPAIRS.VALUE' | translate }}" placeholder="{{ 'CORE.CARDVIEW.KEYVALUEPAIRS.VALUE' | translate }}"
(blur)="onBlur(item.value)" (blur)="onBlur(item.value)"
[attr.data-automation-id]="'card-'+ property.key +'-value-input-' + i" [attr.data-automation-id]="'card-'+ property.key +'-value-input-' + i"
[(ngModel)]="values[i].value"> [(ngModel)]="values[i].value">
<button matSuffix
mat-icon-button
(click)="remove(i)"
class="adf-card-view__key-value-pairs__remove-btn">
<mat-icon>close</mat-icon>
</button>
</mat-form-field> </mat-form-field>
</div> </div>
<button mat-icon-button (click)="remove(i)" class="adf-card-view__key-value-pairs__remove-btn"> </div>
<mat-icon>close</mat-icon> </div>
<div *ngIf="isEditable()"
class="adf-property-value adf-card-view__key-value-pairs__add-btn-container">
<button (click)="add()"
mat-button
class="adf-card-view__key-value-pairs__add-btn"
[attr.data-automation-id]="'card-key-value-pairs-button-' + property.key">
{{ 'CORE.CARDVIEW.KEYVALUEPAIRS.ADD' | translate }}
<mat-icon>add</mat-icon>
</button> </button>
</div> </div>
</div> </div>
</div>
@@ -1,15 +1,38 @@
@mixin adf-card-view-keyvaluepairsitem-theme($theme) {
$foreground: map-get($theme, foreground);
.adf-card-view { .adf-card-view {
&__key-value-pairs { &__key-value-pairs {
&__row {
display: flex;
justify-content: center;
}
&__col { &__col {
display: inline-block; width: 100%;
width: 39%;
.mat-form-field { .mat-form-field {
width: 100%; width: 100%;
font-size: 14px;
}
.mat-form-field-appearance-legacy .mat-form-field-label {
color: mat-color($foreground, text, 0.4) !important;
} }
} }
&__add-btn-container {
display: flex;
justify-content: center;
}
&__add-btn.mat-button {
margin-bottom: 20px;
}
&__read-only { &__read-only {
padding-bottom: 20px;
.mat-table { .mat-table {
box-shadow: none; box-shadow: none;
} }
@@ -20,3 +43,4 @@
} }
} }
} }
}
@@ -1,16 +1,21 @@
<div [attr.data-automation-id]="'card-mapitem-label-' + property.key" class="adf-property-label" *ngIf="showProperty()">{{ property.label | translate }}</div> <div [attr.data-automation-id]="'card-mapitem-label-' + property.key"
<div class="adf-property-value"> class="adf-property-label"
*ngIf="showProperty()">{{ property.label | translate }}</div>
<div class="adf-property-value adf-map-item-padding">
<div> <div>
<span *ngIf="!isClickable(); else elseBlock" [attr.data-automation-id]="'card-mapitem-value-' + property.key"> <span *ngIf="!isClickable(); else clickableTemplate"
[attr.data-automation-id]="'card-mapitem-value-' + property.key">
<span *ngIf="showProperty();">{{ property.displayValue }}</span> <span *ngIf="showProperty();">{{ property.displayValue }}</span>
</span> </span>
<ng-template #elseBlock> </div>
<span class="adf-mapitem-clickable-value" (click)="clicked()" [attr.data-automation-id]="'card-mapitem-value-' + property.key"> <ng-template #clickableTemplate>
<span *ngIf="showProperty(); else elseEmptyValueBlock">{{ property.displayValue }}</span> <span class="adf-mapitem-clickable-value"
(click)="clicked()"
[attr.data-automation-id]="'card-mapitem-value-' + property.key">
<span *ngIf="showProperty(); else emptyValueTemplate">{{ property.displayValue }}</span>
</span> </span>
</ng-template> </ng-template>
</div> <ng-template #emptyValueTemplate>
<ng-template #elseEmptyValueBlock>
{{ property.default | translate }} {{ property.default | translate }}
</ng-template> </ng-template>
</div> </div>
@@ -2,4 +2,8 @@
&-mapitem-clickable-value { &-mapitem-clickable-value {
cursor: pointer !important; cursor: pointer !important;
} }
&-map-item-padding {
padding-top: 6px;
}
} }
@@ -1,11 +1,17 @@
<div [attr.data-automation-id]="'card-select-label-' + property.key" class="adf-property-label">{{ property.label | translate }}</div> <div [attr.data-automation-id]="'card-select-label-' + property.key"
<div class="adf-property-value"> class="adf-property-label">{{ property.label | translate }}</div>
<div *ngIf="!isEditable()" data-automation-class="read-only-value">{{ property.displayValue | async }}</div> <div class="adf-property-field">
<div *ngIf="!isEditable()"
class="adf-select-item-padding adf-property-value"
data-automation-class="read-only-value">{{ property.displayValue | async }}</div>
<div *ngIf="isEditable()"> <div *ngIf="isEditable()">
<mat-form-field> <mat-form-field class="adf-select-item-padding-editable adf-property-value">
<mat-select [(value)]="value" (selectionChange)="onChange($event)" data-automation-class="select-box"> <mat-select [(value)]="value"
(selectionChange)="onChange($event)"
data-automation-class="select-box">
<mat-option *ngIf="showNoneOption()">{{ 'CORE.CARDVIEW.NONE' | translate }}</mat-option> <mat-option *ngIf="showNoneOption()">{{ 'CORE.CARDVIEW.NONE' | translate }}</mat-option>
<mat-option *ngFor="let option of getOptions() | async" [value]="option.key"> <mat-option *ngFor="let option of getOptions() | async"
[value]="option.key">
{{ option.label | translate }} {{ option.label | translate }}
</mat-option> </mat-option>
</mat-select> </mat-select>
@@ -1,3 +1,13 @@
.mat-form-field-type-mat-select { .mat-form-field-type-mat-select {
width: 100%; width: 100%;
} }
.adf-select-item-padding {
padding-top: 6px;
padding-bottom: 20px;
}
.adf-select-item-padding-editable {
padding-top: 6px;
padding-bottom: 6px;
}
@@ -1,151 +1,124 @@
<div [attr.data-automation-id]="'card-textitem-label-' + property.key" <div [ngSwitch]="templateType">
class="adf-property-label" <div class="adf-property-label"
*ngIf="showProperty() || isEditable()">{{ property.label | translate }}</div> [attr.data-automation-id]="'card-textitem-label-' + property.key"
<div class="adf-property-value"> *ngIf="showProperty || isEditable">
<span *ngIf="!isEditable()"> {{ property.label | translate }}
<span *ngIf="!isClickable(); else nonClickableTemplate"
[attr.data-automation-id]="'card-textitem-value-' + property.key">
<span *ngIf="!isChipViewEnabled; else chipListTemplate">
<span *ngIf="showProperty() && !copyToClipboardAction"
[ngClass]="property.multiline?'adf-textitem-multiline':'adf-textitem-scroll'"
class="adf-textitem-value">
{{ property.displayValue }}
</span>
<span *ngIf="showProperty() && copyToClipboardAction"
[ngClass]="property.multiline?'adf-textitem-multiline':'adf-textitem-scroll'"
(dblclick)="copyToClipboard(property.displayValue)"
class="adf-textitem-value"
matTooltipShowDelay="1000"
[matTooltip]="'CORE.METADATA.ACTIONS.COPY_TO_CLIPBOARD' | translate">
{{ property.displayValue }}
</span>
</span>
</span>
<ng-template #nonClickableTemplate>
<div role="button"
class="adf-textitem-clickable"
[attr.data-automation-id]="'card-textitem-toggle-' + property.key"
(click)="clicked()"
fxLayout="row"
fxLayoutAlign="space-between center">
<span class="adf-textitem-clickable-value"
[attr.data-automation-id]="'card-textitem-value-' + property.key">
<span *ngIf="showProperty(); else emptyValueTemplate">{{ property.displayValue }}</span>
</span>
<button mat-icon-button
fxFlex="0 0 auto"
*ngIf="showClickableIcon()"
class="adf-textitem-action"
[attr.title]="'CORE.METADATA.ACTIONS.EDIT' | translate"
[attr.data-automation-id]="'card-textitem-clickable-icon-' + property.key">
<mat-icon class="adf-textitem-icon">{{property?.icon}}</mat-icon>
</button>
</div> </div>
</ng-template>
</span>
<span *ngIf="isEditable()">
<div *ngIf="!inEdit"
role="button"
tabindex="0"
[attr.aria-label]="'CORE.METADATA.ACTIONS.EDIT' | translate"
(click)="setEditMode(true)"
(keydown.enter)="setEditMode(true)"
class="adf-textitem-readonly"
[attr.data-automation-id]="'card-textitem-toggle-' + property.key"
fxLayout="row"
fxLayoutAlign="space-between center">
<span *ngIf="!isChipViewEnabled; else chipListTemplate"
[attr.data-automation-id]="'card-textitem-value-' + property.key">
<span *ngIf="showProperty(); else emptyValueTemplate">{{ property.displayValue }}</span>
</span>
<button mat-icon-button <div *ngSwitchDefault>
fxFlex="0 0 auto" <mat-form-field class="adf-property-field adf-card-textitem-field"
class="adf-textitem-action" [ngClass]="{ 'adf-property-read-only': !isEditable }">
[attr.title]="'CORE.METADATA.ACTIONS.EDIT' | translate" <input matInput
[attr.data-automation-id]="'card-textitem-edit-icon-' + property.key"> *ngIf="!property.multiline"
class="adf-property-value"
<mat-icon class="adf-textitem-icon"> create</mat-icon> [placeholder]="property.default"
</button>
</div>
<div *ngIf="inEdit"
class="adf-textitem-editable">
<div class="adf-textitem-editable-controls">
<mat-form-field floatPlaceholder="never"
class="adf-input-container">
<input *ngIf="!isChipViewEnabled && !property.multiline"
#editorInput
(keydown.escape)="reset($event)"
(keydown.enter)="update($event)"
matInput
class="adf-input"
[placeholder]="property.default | translate"
[(ngModel)]="editedValue" [(ngModel)]="editedValue"
[attr.data-automation-id]="'card-textitem-editinput-' + property.key"> (blur)="update()"
<textarea *ngIf="!isChipViewEnabled && property.multiline" (keydown.enter)="update()"
#editorInput [disabled]="!isEditable"
matInput (dblclick)="copyToClipboard(property.displayValue)"
matTooltipShowDelay="1000"
[matTooltip]="'CORE.METADATA.ACTIONS.COPY_TO_CLIPBOARD' | translate"
[matTooltipDisabled]="isEditable"
[attr.data-automation-id]="'card-textitem-value-' + property.key">
<textarea matInput
*ngIf="property.multiline"
matTextareaAutosize matTextareaAutosize
matAutosizeMaxRows="1" matAutosizeMaxRows="1"
matAutosizeMaxRows="5" matAutosizeMaxRows="5"
class="adf-textarea" class="adf-property-value"
[placeholder]="property.default | translate" [placeholder]="property.default"
[(ngModel)]="editedValue" [(ngModel)]="editedValue"
(input)="onTextAreaInputChange()" (blur)="update()"
[attr.data-automation-id]="'card-textitem-edittextarea-' + property.key"></textarea> (keydown.enter)="update()"
<div *ngIf="isChipViewEnabled"> [disabled]="!isEditable"
<mat-chip-list class="adf-input" [attr.data-automation-id]="'card-textitem-value-' + property.key"></textarea>
#chipList> <button mat-button
matSuffix
class="adf-property-clear-value"
*ngIf="isEditable"
mat-icon-button
aria-label="Clear"
(click)="editedValue=''">
<mat-icon>cancel</mat-icon>
</button>
<mat-icon matSuffix
*ngIf="isEditable"
[attr.title]="'CORE.METADATA.ACTIONS.EDIT' | translate"
class="adf-textitem-edit-icon">mode_edit</mat-icon>
</mat-form-field>
</div>
<mat-error [attr.data-automation-id]="'card-textitem-error-' + property.key"
class="adf-textitem-editable-error"
*ngIf="hasErrors">
<ul>
<li *ngFor="let errorMessage of errorMessages">{{ errorMessage | translate }}</li>
</ul>
</mat-error>
<div *ngSwitchCase="'chipsTemplate'"
class="adf-property-field adf-textitem-chip-list-container">
<mat-chip-list #chipList
class="adf-textitem-chip-list">
<mat-chip *ngFor="let propertyValue of editedValue; let idx = index" <mat-chip *ngFor="let propertyValue of editedValue; let idx = index"
[removable]="true" [removable]="isEditable"
(removed)="removeValueFromList(idx)"> (removed)="removeValueFromList(idx)">
{{ propertyValue }} {{ propertyValue }}
<mat-icon matChipRemove>cancel</mat-icon> <mat-icon *ngIf="isEditable"
matChipRemove>cancel</mat-icon>
</mat-chip> </mat-chip>
<input #editorInput </mat-chip-list>
<mat-form-field *ngIf="isEditable"
class="adf-property-field adf-textitem-chip-list-input"
[ngClass]="{ 'adf-property-read-only': !isEditable }">
<input matInput
class="adf-property-value"
[placeholder]="property.default | translate" [placeholder]="property.default | translate"
[matChipInputFor]="chipList" [matChipInputFor]="chipList"
[matChipInputAddOnBlur]="true" [matChipInputAddOnBlur]="true"
(matChipInputTokenEnd)="addValueToList($event)" (matChipInputTokenEnd)="addValueToList($event)"
[attr.data-automation-id]="'card-textitem-editchipinput-' + property.key"> [attr.data-automation-id]="'card-textitem-editchipinput-' + property.key">
</mat-chip-list> <mat-icon matSuffix
</div> class="adf-textitem-edit-icon">mode_edit</mat-icon>
</mat-form-field> </mat-form-field>
<button mat-icon-button
class="adf-textitem-action"
(click)="update($event)"
[attr.title]="'CORE.METADATA.ACTIONS.SAVE' | translate"
[attr.data-automation-id]="'card-textitem-update-' + property.key">
<mat-icon class="adf-textitem-icon">done</mat-icon>
</button>
<button mat-icon-button
(click)="reset($event)"
class="adf-textitem-action"
[attr.title]="'CORE.METADATA.ACTIONS.CANCEL' | translate"
[attr.data-automation-id]="'card-textitem-reset-' + property.key">
<mat-icon>clear</mat-icon>
</button>
</div> </div>
<mat-error [attr.data-automation-id]="'card-textitem-error-' + property.key"
class="adf-textitem-editable-error" <div *ngSwitchCase="'clickableTemplate'"
*ngIf="hasErrors()"> role="button"
<ul> class="adf-textitem-clickable"
<li *ngFor="let errorMessage of errorMessages">{{ errorMessage | translate }}</li> [ngClass]="{ 'adf-property-read-only': !isEditable }"
</ul> [attr.data-automation-id]="'card-textitem-toggle-' + property.key"
</mat-error> (click)="clicked()"
fxLayout="row"
fxLayoutAlign="space-between center">
<mat-form-field class="adf-property-field adf-card-textitem-field">
<input matInput
[type]=property.inputType
class="adf-property-value"
[ngClass]="{ 'adf-textitem-clickable-value': !isEditable }"
[placeholder]="property.default"
[(ngModel)]="editedValue"
(blur)="update()"
(keydown.enter)="update()"
[disabled]="!isEditable"
[attr.data-automation-id]="'card-textitem-value-' + property.key">
<button mat-icon-button
matSuffix
fxFlex="0 0 auto"
*ngIf="showClickableIcon"
class="adf-textitem-action"
[attr.title]="'CORE.METADATA.ACTIONS.EDIT' | translate"
[attr.data-automation-id]="'card-textitem-clickable-icon-' + property.key">
<mat-icon class="adf-textitem-icon">{{ property?.icon }}</mat-icon>
</button>
</mat-form-field>
</div> </div>
</span>
<ng-template #emptyValueTemplate> <div *ngSwitchCase="'emptyTemplate'">
<span class="adf-textitem-default-value">{{ property.default | translate }}</span> <span class="adf-textitem-default-value">{{ property.default | translate }}</span>
</ng-template> </div>
<ng-template #chipListTemplate>
<mat-chip-list>
<mat-chip *ngFor="let propertyValue of editedValue">
{{ propertyValue }}
</mat-chip>
</mat-chip-list>
</ng-template>
</div> </div>
@@ -5,17 +5,22 @@
$outline: 1px solid mat-color($alfresco-ecm-blue, A200) !default; $outline: 1px solid mat-color($alfresco-ecm-blue, A200) !default;
.adf { .adf {
&-textitem-icon { &-textitem-edit-icon.mat-icon {
font-size: 16px; font-size: 16px;
width: 16px; width: 16px;
height: 16px; height: 16px;
}
&-textitem-action {
color: mat-color($foreground, text, 0.25); color: mat-color($foreground, text, 0.25);
} }
&-textitem-action:hover, &-textitem-action:focus { &-textitem-action.mat-icon-button {
width: 20px;
height: 20px;
line-height: 20px;
color: mat-color($foreground, text, 0.25);
}
&-textitem-action:hover,
&-textitem-action:focus {
color: mat-color($foreground, text); color: mat-color($foreground, text);
} }
@@ -32,8 +37,23 @@
} }
} }
&-textitem-chip-list-container {
margin-bottom: 25px !important;
margin-top: 6px;
.mat-form-field-label {
margin-top: 6px;
}
}
&-textitem-clickable { &-textitem-clickable {
cursor: pointer !important; cursor: pointer !important;
padding-top: 3px;
.adf-textitem-edit-icon.mat-icon {
line-height: 16px;
}
&:hover .adf-textitem-action { &:hover .adf-textitem-action {
color: mat-color($foreground, text); color: mat-color($foreground, text);
} }
@@ -41,11 +61,10 @@
&-textitem-clickable-value { &-textitem-clickable-value {
cursor: pointer !important; cursor: pointer !important;
color: mat-color($primary); color: mat-color($primary) !important;
} }
&-textitem-editable { &-textitem-editable {
&-controls { &-controls {
display: flex; display: flex;
align-items: center; align-items: center;
@@ -148,5 +167,22 @@
&-textitem-multiline { &-textitem-multiline {
display: block; display: block;
} }
&-property-field .adf-property-clear-value {
display: none;
}
&-property-field.adf-card-textitem-field:hover {
.adf-textitem-edit-icon {
display: none;
}
.adf-property-clear-value {
color: mat-color($foreground, text, 0.25);
display: inline;
}
.adf-property-clear-value:hover {
color: mat-color($foreground, text, 1);
}
}
} }
} }
File diff suppressed because it is too large Load Diff
@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { Component, Input, OnChanges, ViewChild } from '@angular/core'; import { Component, Input, OnChanges } from '@angular/core';
import { CardViewTextItemModel } from '../../models/card-view-textitem.model'; import { CardViewTextItemModel } from '../../models/card-view-textitem.model';
import { CardViewUpdateService } from '../../services/card-view-update.service'; import { CardViewUpdateService } from '../../services/card-view-update.service';
import { BaseCardView } from '../base-card-view'; import { BaseCardView } from '../base-card-view';
@@ -24,6 +24,13 @@ import { ClipboardService } from '../../../clipboard/clipboard.service';
import { TranslationService } from '../../../services/translation.service'; import { TranslationService } from '../../../services/translation.service';
export const DEFAULT_SEPARATOR = ', '; export const DEFAULT_SEPARATOR = ', ';
const templateTypes = {
clickableTemplate: 'clickableTemplate',
multilineTemplate: 'multilineTemplate',
chipsTemplate: 'chipsTemplate',
emptyTemplate: 'emptyTemplate',
defaultTemplate: 'defaultTemplate'
};
@Component({ @Component({
selector: 'adf-card-view-textitem', selector: 'adf-card-view-textitem',
@@ -47,12 +54,9 @@ export class CardViewTextItemComponent extends BaseCardView<CardViewTextItemMode
@Input() @Input()
multiValueSeparator: string = DEFAULT_SEPARATOR; multiValueSeparator: string = DEFAULT_SEPARATOR;
@ViewChild('editorInput')
private editorInput: any;
inEdit: boolean = false;
editedValue: string | string[]; editedValue: string | string[];
errorMessages: string[]; errorMessages: string[];
templateType: string;
constructor(cardViewUpdateService: CardViewUpdateService, constructor(cardViewUpdateService: CardViewUpdateService,
private clipboardService: ClipboardService, private clipboardService: ClipboardService,
@@ -62,54 +66,28 @@ export class CardViewTextItemComponent extends BaseCardView<CardViewTextItemMode
ngOnChanges(): void { ngOnChanges(): void {
this.resetValue(); this.resetValue();
this.setTemplateType();
} }
showProperty(): boolean { private setTemplateType() {
return this.displayEmpty || !this.property.isEmpty(); if (this.showProperty || this.isEditable) {
if (this.isClickable) {
this.templateType = templateTypes.clickableTemplate;
} else if (this.isChipViewEnabled) {
this.templateType = templateTypes.chipsTemplate;
} else {
this.templateType = templateTypes.defaultTemplate;
} }
} else {
showClickableIcon(): boolean { this.templateType = templateTypes.emptyTemplate;
return this.hasIcon() && this.editable;
} }
isEditable(): boolean {
return this.editable && this.property.editable;
}
isClickable(): boolean {
return !!this.property.clickable;
}
hasIcon(): boolean {
return !!this.property.icon;
}
hasErrors(): boolean {
return this.errorMessages && this.errorMessages.length > 0;
}
setEditMode(editStatus: boolean): void {
this.inEdit = editStatus;
setTimeout(() => {
if (this.editorInput) {
this.editorInput.nativeElement.click();
}
}, 0);
}
reset(event: Event): void {
event.stopPropagation();
this.resetValue();
this.setEditMode(false);
this.resetErrorMessages();
} }
resetValue() { resetValue() {
if (this.isChipViewEnabled) { if (this.isChipViewEnabled) {
this.editedValue = this.property.value ? Array.from(this.property.value) : []; this.editedValue = this.property.value ? Array.from(this.property.value) : [];
} else { } else {
this.editedValue = this.property.multiline ? this.property.displayValue : this.property.value; this.editedValue = this.property.displayValue;
} }
} }
@@ -117,14 +95,11 @@ export class CardViewTextItemComponent extends BaseCardView<CardViewTextItemMode
this.errorMessages = []; this.errorMessages = [];
} }
update(event: Event): void { update(): void {
event.stopPropagation();
if (this.property.isValid(this.editedValue)) { if (this.property.isValid(this.editedValue)) {
const updatedValue = this.prepareValueForUpload(this.property, this.editedValue); const updatedValue = this.prepareValueForUpload(this.property, this.editedValue);
this.cardViewUpdateService.update(<CardViewTextItemModel> { ...this.property }, updatedValue); this.cardViewUpdateService.update(<CardViewTextItemModel> { ...this.property }, updatedValue);
this.property.value = updatedValue; this.property.value = updatedValue;
this.setEditMode(false);
this.resetErrorMessages(); this.resetErrorMessages();
} else { } else {
this.errorMessages = this.property.getValidationErrors(this.editedValue); this.errorMessages = this.property.getValidationErrors(this.editedValue);
@@ -142,6 +117,7 @@ export class CardViewTextItemComponent extends BaseCardView<CardViewTextItemMode
removeValueFromList(itemIndex: number) { removeValueFromList(itemIndex: number) {
if (typeof this.editedValue !== 'string') { if (typeof this.editedValue !== 'string') {
this.editedValue.splice(itemIndex, 1); this.editedValue.splice(itemIndex, 1);
this.update();
} }
} }
@@ -152,16 +128,12 @@ export class CardViewTextItemComponent extends BaseCardView<CardViewTextItemMode
if (typeof this.editedValue !== 'string') { if (typeof this.editedValue !== 'string') {
if (chipValue) { if (chipValue) {
this.editedValue.push(chipValue); this.editedValue.push(chipValue);
this.update();
} }
if (chipInput) { if (chipInput) {
chipInput.value = ''; chipInput.value = '';
} } }
}
}
onTextAreaInputChange() {
this.errorMessages = this.property.getValidationErrors(this.editedValue);
} }
clicked(): void { clicked(): void {
@@ -172,10 +144,40 @@ export class CardViewTextItemComponent extends BaseCardView<CardViewTextItemMode
} }
} }
clearValue() {
this.editedValue = '';
}
copyToClipboard(valueToCopy: string) { copyToClipboard(valueToCopy: string) {
if (this.copyToClipboard) {
const clipboardMessage = this.translateService.instant('CORE.METADATA.ACCESSIBILITY.COPY_TO_CLIPBOARD_MESSAGE'); const clipboardMessage = this.translateService.instant('CORE.METADATA.ACCESSIBILITY.COPY_TO_CLIPBOARD_MESSAGE');
this.clipboardService.copyContentToClipboard(valueToCopy, clipboardMessage); this.clipboardService.copyContentToClipboard(valueToCopy, clipboardMessage);
} }
}
get showProperty(): boolean {
return this.displayEmpty || !this.property.isEmpty();
}
get showClickableIcon(): boolean {
return this.hasIcon && this.editable;
}
get isEditable(): boolean {
return this.editable && this.property.editable;
}
get isClickable(): boolean {
return this.property.clickable;
}
get hasIcon(): boolean {
return !!this.property.icon;
}
get hasErrors(): boolean {
return this.errorMessages && this.errorMessages.length > 0;
}
get isChipViewEnabled(): boolean { get isChipViewEnabled(): boolean {
return this.property.multivalued && this.useChipsForMultiValueProperty; return this.property.multivalued && this.useChipsForMultiValueProperty;
@@ -8,13 +8,43 @@
.adf-property { .adf-property {
margin-bottom: 20px; margin-bottom: 20px;
.adf-property-value-padding-top {
margin-top: 6px;
}
.adf-property-field {
width: 100%;
margin-bottom: -25px;
.mat-form-field-infix {
border-top-width: 0;
}
.mat-form-field-label {
margin-top: 6px;
}
.adf-property-read-only {
.mat-form-field-underline {
display: none;
}
}
}
.adf-property-read-only {
.mat-form-field-underline {
display: none;
}
}
.adf-property-label { .adf-property-label {
font-size: 12px; font-size: 12px;
color: mat-color($foreground, text, 0.54); color: mat-color($foreground, text, 0.54);
word-wrap: break-word; word-wrap: break-word;
} }
.adf-property-value { .adf-property-value,
.mat-form-field-label {
font-size: 14px; font-size: 14px;
color: mat-color($foreground, text, 0.87); color: mat-color($foreground, text, 0.87);
} }
@@ -53,7 +53,7 @@ describe('CardViewComponent', () => {
const value = fixture.debugElement.query(By.css('.adf-property-value')); const value = fixture.debugElement.query(By.css('.adf-property-value'));
expect(value).not.toBeNull(); expect(value).not.toBeNull();
expect(value.nativeElement.innerText).toBe('My value'); expect(value.nativeElement.value).toBe('My value');
}); });
})); }));
@@ -112,9 +112,9 @@ describe('CardViewComponent', () => {
expect(labelValue).not.toBeNull(); expect(labelValue).not.toBeNull();
expect(labelValue.nativeElement.innerText).toBe('My default label'); expect(labelValue.nativeElement.innerText).toBe('My default label');
const value = fixture.debugElement.query(By.css('.adf-property-value [data-automation-id="card-textitem-value-some-key"]')); const value = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-some-key"]'));
expect(value).not.toBeNull(); expect(value).not.toBeNull();
expect(value.nativeElement.innerText.trim()).toBe('default value'); expect(value.nativeElement.value).toBe('default value');
}); });
})); }));
@@ -137,9 +137,9 @@ describe('CardViewComponent', () => {
expect(labelValue).not.toBeNull(); expect(labelValue).not.toBeNull();
expect(labelValue.nativeElement.innerText).toBe('My default label'); expect(labelValue.nativeElement.innerText).toBe('My default label');
const value = fixture.debugElement.query(By.css('.adf-property-value [data-automation-id="card-textitem-value-some-key"]')); const value = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-some-key"]'));
expect(value).not.toBeNull(); expect(value).not.toBeNull();
expect(value.nativeElement.innerText.trim()).toBe('default value'); expect(value.nativeElement.value).toBe('default value');
}); });
})); }));
}); });
@@ -23,6 +23,7 @@ import { CardViewItemFloatValidator } from '../validators/card-view.validators';
export class CardViewFloatItemModel extends CardViewTextItemModel implements CardViewItem, DynamicComponentModel { export class CardViewFloatItemModel extends CardViewTextItemModel implements CardViewItem, DynamicComponentModel {
type: string = 'float'; type: string = 'float';
inputType: string = 'number';
constructor(cardViewTextItemProperties: CardViewTextItemProperties) { constructor(cardViewTextItemProperties: CardViewTextItemProperties) {
super(cardViewTextItemProperties); super(cardViewTextItemProperties);
@@ -23,6 +23,7 @@ import { CardViewItemIntValidator } from '../validators/card-view.validators';
export class CardViewIntItemModel extends CardViewTextItemModel implements CardViewItem, DynamicComponentModel { export class CardViewIntItemModel extends CardViewTextItemModel implements CardViewItem, DynamicComponentModel {
type: string = 'int'; type: string = 'int';
inputType: string = 'number';
constructor(cardViewTextItemProperties: CardViewTextItemProperties) { constructor(cardViewTextItemProperties: CardViewTextItemProperties) {
super(cardViewTextItemProperties); super(cardViewTextItemProperties);
@@ -22,6 +22,7 @@ import { CardViewTextItemPipeProperty, CardViewTextItemProperties } from '../int
export class CardViewTextItemModel extends CardViewBaseItemModel implements CardViewItem, DynamicComponentModel { export class CardViewTextItemModel extends CardViewBaseItemModel implements CardViewItem, DynamicComponentModel {
type: string = 'text'; type: string = 'text';
inputType: string = 'text';
multiline?: boolean; multiline?: boolean;
multivalued?: boolean; multivalued?: boolean;
pipes?: CardViewTextItemPipeProperty[]; pipes?: CardViewTextItemPipeProperty[];
@@ -75,8 +75,8 @@ describe('ProcessHeaderCloudComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
const formNameEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-id"] span')); const formNameEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-id"]'));
expect(formNameEl.nativeElement.innerText).toBe('00fcc4ab-4290-11e9-b133-0a586460016a'); expect(formNameEl.nativeElement.value).toBe('00fcc4ab-4290-11e9-b133-0a586460016a');
}); });
})); }));
@@ -85,8 +85,8 @@ describe('ProcessHeaderCloudComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
const formNameEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-name"] span')); const formNameEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-name"]'));
expect(formNameEl.nativeElement.innerText).toBe('new name'); expect(formNameEl.nativeElement.value).toBe('new name');
}); });
})); }));
@@ -96,8 +96,8 @@ describe('ProcessHeaderCloudComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
const valueEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-name"] span')); const valueEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-name"]'));
expect(valueEl.nativeElement.innerText).toBe('ADF_CLOUD_PROCESS_HEADER.PROPERTIES.NAME_DEFAULT'); expect(valueEl.nativeElement.value).toBe('ADF_CLOUD_PROCESS_HEADER.PROPERTIES.NAME_DEFAULT');
}); });
})); }));
@@ -107,8 +107,8 @@ describe('ProcessHeaderCloudComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
const formNameEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-status"] span')); const formNameEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-status"]'));
expect(formNameEl.nativeElement.innerText).toBe('RUNNING'); expect(formNameEl.nativeElement.value).toBe('RUNNING');
}); });
})); }));
@@ -117,8 +117,8 @@ describe('ProcessHeaderCloudComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
const formNameEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-initiator"] span')); const formNameEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-initiator"]'));
expect(formNameEl.nativeElement.innerText).toBe('devopsuser'); expect(formNameEl.nativeElement.value).toBe('devopsuser');
}); });
})); }));
@@ -147,8 +147,8 @@ describe('ProcessHeaderCloudComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
const formNameEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-parentId"] span')); const formNameEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-parentId"]'));
expect(formNameEl.nativeElement.innerText).toBe('00fcc4ab-4290-11e9-b133-0a586460016b'); expect(formNameEl.nativeElement.value).toBe('00fcc4ab-4290-11e9-b133-0a586460016b');
}); });
})); }));
@@ -158,8 +158,8 @@ describe('ProcessHeaderCloudComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
const formNameEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-parentId"] span')); const formNameEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-parentId"]'));
expect(formNameEl.nativeElement.innerText).toBe('ADF_CLOUD_PROCESS_HEADER.PROPERTIES.NONE'); expect(formNameEl.nativeElement.value).toBe('ADF_CLOUD_PROCESS_HEADER.PROPERTIES.NONE');
}); });
})); }));
@@ -168,8 +168,8 @@ describe('ProcessHeaderCloudComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
const formNameEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-businessKey"] span')); const formNameEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-businessKey"]'));
expect(formNameEl.nativeElement.innerText).toBe('MyBusinessKey'); expect(formNameEl.nativeElement.value).toBe('MyBusinessKey');
}); });
})); }));
@@ -179,8 +179,8 @@ describe('ProcessHeaderCloudComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
const formNameEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-businessKey"] span')); const formNameEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-businessKey"]'));
expect(formNameEl.nativeElement.innerText).toBe('ADF_CLOUD_PROCESS_HEADER.PROPERTIES.NONE'); expect(formNameEl.nativeElement.value).toBe('ADF_CLOUD_PROCESS_HEADER.PROPERTIES.NONE');
}); });
})); }));
@@ -85,16 +85,16 @@ describe('TaskHeaderCloudComponent', () => {
it('should display assignee', async(() => { it('should display assignee', async(() => {
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
const assigneeEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-assignee"] span')); const assigneeEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-assignee"]'));
expect(assigneeEl.nativeElement.innerText).toBe('AssignedTaskUser'); expect(assigneeEl.nativeElement.value).toBe('AssignedTaskUser');
}); });
})); }));
it('should display status', async(() => { it('should display status', async(() => {
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
const statusEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-status"] span')); const statusEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-status"]'));
expect(statusEl.nativeElement.innerText).toBe('ASSIGNED'); expect(statusEl.nativeElement.value).toBe('ASSIGNED');
}); });
})); }));
@@ -103,7 +103,7 @@ describe('TaskHeaderCloudComponent', () => {
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
const priorityEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-priority"]')); const priorityEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-priority"]'));
expect(priorityEl.nativeElement.innerText).toBe('5'); expect(priorityEl.nativeElement.value).toBe('5');
}); });
})); }));
@@ -111,17 +111,11 @@ describe('TaskHeaderCloudComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
const edit = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-edit-icon-priority"]'));
edit.nativeElement.click();
fixture.detectChanges();
const formPriorityEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-editinput-priority"]')); const formPriorityEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-priority"]'));
formPriorityEl.nativeElement.value = 'stringValue'; formPriorityEl.nativeElement.value = 'stringValue';
formPriorityEl.nativeElement.dispatchEvent(new Event('input')); formPriorityEl.nativeElement.dispatchEvent(new Event('input'));
fixture.detectChanges(); formPriorityEl.nativeElement.dispatchEvent(new Event('blur'));
const submitEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-update-priority"]'));
submitEl.nativeElement.click();
fixture.detectChanges(); fixture.detectChanges();
const errorMessageEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-error-priority"]')); const errorMessageEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-error-priority"]'));
@@ -154,8 +148,8 @@ describe('TaskHeaderCloudComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
const valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-parentName"] .adf-property-value')); const valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-parentName"] input'));
expect(valueEl.nativeElement.innerText.trim()).toEqual('ADF_CLOUD_TASK_HEADER.PROPERTIES.PARENT_NAME_DEFAULT'); expect(valueEl.nativeElement.value).toEqual('ADF_CLOUD_TASK_HEADER.PROPERTIES.PARENT_NAME_DEFAULT');
}); });
})); }));
@@ -163,17 +157,12 @@ describe('TaskHeaderCloudComponent', () => {
spyOn(taskCloudService, 'updateTask').and.returnValue(of(assignedTaskDetailsCloudMock)); spyOn(taskCloudService, 'updateTask').and.returnValue(of(assignedTaskDetailsCloudMock));
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
const descriptionEditIcon = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-edit-icon-description"]'));
descriptionEditIcon.nativeElement.click();
fixture.detectChanges();
const inputEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-edittextarea-description"]')); const inputEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-description"]'));
inputEl.nativeElement.value = 'updated description'; inputEl.nativeElement.value = 'updated description';
inputEl.nativeElement.dispatchEvent(new Event('input')); inputEl.nativeElement.dispatchEvent(new Event('input'));
fixture.detectChanges(); inputEl.nativeElement.dispatchEvent(new Event('blur'));
const submitEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-update-description"]'));
submitEl.nativeElement.click();
fixture.detectChanges(); fixture.detectChanges();
expect(taskCloudService.updateTask).toHaveBeenCalled(); expect(taskCloudService.updateTask).toHaveBeenCalled();
}); });
@@ -185,24 +174,20 @@ describe('TaskHeaderCloudComponent', () => {
await fixture.whenStable(); await fixture.whenStable();
let description = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-description"]')); let description = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-description"]'));
expect(description.nativeElement.innerText.trim()).toEqual('This is the description'); expect(description.nativeElement.value.trim()).toEqual('This is the description');
const descriptionEditIcon = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-edit-icon-description"]')); const inputEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-description"]'));
descriptionEditIcon.nativeElement.click();
fixture.detectChanges();
const inputEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-edittextarea-description"]'));
inputEl.nativeElement.value = 'updated description'; inputEl.nativeElement.value = 'updated description';
inputEl.nativeElement.dispatchEvent(new Event('input')); inputEl.nativeElement.dispatchEvent(new Event('input'));
inputEl.nativeElement.dispatchEvent(new Event('blur'));
const submitEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-update-description"]')); fixture.detectChanges();
submitEl.nativeElement.click();
expect(taskCloudService.updateTask).toHaveBeenCalled(); expect(taskCloudService.updateTask).toHaveBeenCalled();
await fixture.whenStable(); await fixture.whenStable();
fixture.detectChanges(); fixture.detectChanges();
description = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-description"]')); description = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-description"]'));
expect(description.nativeElement.innerText.trim()).toEqual('This is the description'); expect(description.nativeElement.value.trim()).toEqual('This is the description');
}); });
}); });
@@ -223,16 +208,16 @@ describe('TaskHeaderCloudComponent', () => {
it('should display parent task id', async(() => { it('should display parent task id', async(() => {
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
const assigneeEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-parentTaskId"] span')); const assigneeEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-parentTaskId"'));
expect(assigneeEl.nativeElement.innerText).toBe('mock-parent-task-id'); expect(assigneeEl.nativeElement.value).toBe('mock-parent-task-id');
}); });
})); }));
it('should display parent task name', async(() => { it('should display parent task name', async(() => {
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
const statusEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-parentName"] span')); const statusEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-parentName"]'));
expect(statusEl.nativeElement.innerText).toBe('This is a parent task name'); expect(statusEl.nativeElement.value.trim()).toBe('This is a parent task name');
}); });
})); }));
}); });
@@ -247,35 +232,35 @@ describe('TaskHeaderCloudComponent', () => {
it('should display assignee', async(() => { it('should display assignee', async(() => {
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
const assigneeEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-assignee"] span')); const assigneeEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-assignee"]'));
expect(assigneeEl.nativeElement.innerText).toBe('AssignedTaskUser'); expect(assigneeEl.nativeElement.value).toBe('AssignedTaskUser');
}); });
})); }));
it('should display status', async(() => { it('should display status', async(() => {
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
const statusEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-status"] span')); const statusEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-status"]'));
expect(statusEl.nativeElement.innerText).toBe('ASSIGNED'); expect(statusEl.nativeElement.value).toBe('ASSIGNED');
}); });
})); }));
it('should render defined edit icon for assignee property if the task in assigned state and assingee should be current user', () => { it('should render defined edit icon for assignee property if the task in assigned state and assingee should be current user', () => {
fixture.detectChanges(); fixture.detectChanges();
const value = fixture.debugElement.query(By.css(`[data-automation-id="card-textitem-clickable-icon-assignee"]`)); const value = fixture.debugElement.query(By.css(`[data-automation-id="header-assignee"] [data-automation-id="card-textitem-clickable-icon-assignee"]`));
expect(value).not.toBeNull(); expect(value).not.toBeNull();
expect(value.nativeElement.innerText).toBe('create'); expect(value.nativeElement.innerText).toBe('create');
}); });
it('should render edit icon if the task in assigned state and assingee should be current user', () => { it('should render edit icon if the task in assigned state and assingee should be current user', () => {
fixture.detectChanges(); fixture.detectChanges();
const priorityEditIcon = fixture.debugElement.query(By.css(`[data-automation-id="card-textitem-edit-icon-priority"]`)); const priorityEditIcon = fixture.debugElement.query(By.css(`[data-automation-id="header-priority"] [class*="adf-textitem-edit-icon"]`));
const descriptionEditIcon = fixture.debugElement.query(By.css(`[data-automation-id="card-textitem-edit-icon-description"]`)); const descriptionEditIcon = fixture.debugElement.query(By.css(`[data-automation-id="header-description"] [class*="adf-textitem-edit-icon"]`));
const dueDateEditIcon = fixture.debugElement.query(By.css(`[data-automation-id="datepickertoggle-dueDate"]`)); const dueDateEditIcon = fixture.debugElement.query(By.css(`[data-automation-id="datepickertoggle-dueDate"]`));
expect(priorityEditIcon).not.toBeNull('Edit icon should be shown'); expect(priorityEditIcon).not.toBeNull('Priority edit icon should be shown');
expect(descriptionEditIcon).not.toBeNull('Edit icon should be shown'); expect(descriptionEditIcon).not.toBeNull('Description edit icon should be shown');
expect(dueDateEditIcon).not.toBeNull('Edit icon should be shown'); expect(dueDateEditIcon).not.toBeNull('Due date edit icon should be shown');
}); });
it('should not render defined clickable edit icon for assignee property if the task in assigned state and assingned user is different from current logged-in user', () => { it('should not render defined clickable edit icon for assignee property if the task in assigned state and assingned user is different from current logged-in user', () => {
@@ -309,16 +294,16 @@ describe('TaskHeaderCloudComponent', () => {
it('should display status', async(() => { it('should display status', async(() => {
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
const statusEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-status"] span')); const statusEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-status"]'));
expect(statusEl.nativeElement.innerText).toBe('CREATED'); expect(statusEl.nativeElement.value).toBe('CREATED');
}); });
})); }));
it('should display placeholder if no assignee', async(() => { it('should display placeholder if no assignee', async(() => {
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
const assigneeEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-assignee"] span')); const assigneeEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-assignee"]'));
expect(assigneeEl.nativeElement.innerText).toBe('ADF_CLOUD_TASK_HEADER.PROPERTIES.ASSIGNEE_DEFAULT'); expect(assigneeEl.nativeElement.value).toBe('ADF_CLOUD_TASK_HEADER.PROPERTIES.ASSIGNEE_DEFAULT');
}); });
})); }));
@@ -350,8 +335,8 @@ describe('TaskHeaderCloudComponent', () => {
it('should display status', async(() => { it('should display status', async(() => {
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
const statusEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-status"] span')); const statusEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-status"]'));
expect(statusEl.nativeElement.innerText).toBe('COMPLETED'); expect(statusEl.nativeElement.value).toBe('COMPLETED');
}); });
})); }));
@@ -383,8 +368,8 @@ describe('TaskHeaderCloudComponent', () => {
it('should display status', async(() => { it('should display status', async(() => {
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
const statusEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-status"] span')); const statusEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-status"]'));
expect(statusEl.nativeElement.innerText).toBe('SUSPENDED'); expect(statusEl.nativeElement.value).toBe('SUSPENDED');
}); });
})); }));
@@ -50,20 +50,22 @@ describe('ProcessInstanceHeaderComponent', () => {
expect(fixture.debugElement.children.length).toBe(0); expect(fixture.debugElement.children.length).toBe(0);
}); });
it('should display status as running when process is not complete', () => { it('should display status as running when process is not complete', async () => {
component.processInstance.ended = null; component.processInstance.ended = null;
component.ngOnChanges(); component.ngOnChanges();
fixture.detectChanges(); fixture.detectChanges();
await fixture.whenStable();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-status"]'); const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-status"]');
expect(valueEl.innerText).toBe('Running'); expect(valueEl.value).toBe('Running');
}); });
it('should display status as completed when process is complete', () => { it('should display status as completed when process is complete', async () => {
component.processInstance.ended = new Date('2016-11-03'); component.processInstance.ended = new Date('2016-11-03');
component.ngOnChanges(); component.ngOnChanges();
fixture.detectChanges(); fixture.detectChanges();
await fixture.whenStable();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-status"]'); const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-status"]');
expect(valueEl.innerText).toBe('Completed'); expect(valueEl.value).toBe('Completed');
}); });
it('should display due date', () => { it('should display due date', () => {
@@ -82,20 +84,22 @@ describe('ProcessInstanceHeaderComponent', () => {
expect(valueEl.innerText).toBe('ADF_PROCESS_LIST.PROPERTIES.END_DATE_DEFAULT'); expect(valueEl.innerText).toBe('ADF_PROCESS_LIST.PROPERTIES.END_DATE_DEFAULT');
}); });
it('should display process category', () => { it('should display process category', async () => {
component.processInstance.processDefinitionCategory = 'Accounts'; component.processInstance.processDefinitionCategory = 'Accounts';
component.ngOnChanges(); component.ngOnChanges();
fixture.detectChanges(); fixture.detectChanges();
await fixture.whenStable();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-category"]'); const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-category"]');
expect(valueEl.innerText).toBe('Accounts'); expect(valueEl.value).toBe('Accounts');
}); });
it('should display placeholder if no process category', () => { it('should display placeholder if no process category', async () => {
component.processInstance.processDefinitionCategory = null; component.processInstance.processDefinitionCategory = null;
component.ngOnChanges(); component.ngOnChanges();
fixture.detectChanges(); fixture.detectChanges();
await fixture.whenStable();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-category"]'); const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-category"]');
expect(valueEl.innerText).toBe('ADF_PROCESS_LIST.PROPERTIES.CATEGORY_DEFAULT'); expect(valueEl.value).toBe('ADF_PROCESS_LIST.PROPERTIES.CATEGORY_DEFAULT');
}); });
it('should display created date', () => { it('should display created date', () => {
@@ -106,52 +110,58 @@ describe('ProcessInstanceHeaderComponent', () => {
expect(valueEl.innerText).toBe('Nov 3, 2016'); expect(valueEl.innerText).toBe('Nov 3, 2016');
}); });
it('should display started by', () => { it('should display started by', async () => {
component.processInstance.startedBy = {firstName: 'Admin', lastName: 'User'}; component.processInstance.startedBy = {firstName: 'Admin', lastName: 'User'};
component.ngOnChanges(); component.ngOnChanges();
fixture.detectChanges(); fixture.detectChanges();
await fixture.whenStable();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-assignee"]'); const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-assignee"]');
expect(valueEl.innerText).toBe('Admin User'); expect(valueEl.value).toBe('Admin User');
}); });
it('should display process instance id', () => { it('should display process instance id', async () => {
component.processInstance.id = '123'; component.processInstance.id = '123';
component.ngOnChanges(); component.ngOnChanges();
fixture.detectChanges(); fixture.detectChanges();
await fixture.whenStable();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-id"]'); const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-id"]');
expect(valueEl.innerText).toBe('123'); expect(valueEl.value).toBe('123');
}); });
it('should display description', () => { it('should display description', async () => {
component.processInstance.processDefinitionDescription = 'Test process'; component.processInstance.processDefinitionDescription = 'Test process';
component.ngOnChanges(); component.ngOnChanges();
fixture.detectChanges(); fixture.detectChanges();
await fixture.whenStable();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-description"]'); const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-description"]');
expect(valueEl.innerText).toBe('Test process'); expect(valueEl.value).toBe('Test process');
}); });
it('should display placeholder if no description', () => { it('should display placeholder if no description', async () => {
component.processInstance.processDefinitionDescription = null; component.processInstance.processDefinitionDescription = null;
component.ngOnChanges(); component.ngOnChanges();
fixture.detectChanges(); fixture.detectChanges();
await fixture.whenStable();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-description"]'); const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-description"]');
expect(valueEl.innerText).toBe('ADF_PROCESS_LIST.PROPERTIES.DESCRIPTION_DEFAULT'); expect(valueEl.value).toBe('ADF_PROCESS_LIST.PROPERTIES.DESCRIPTION_DEFAULT');
}); });
it('should display businessKey value', () => { it('should display businessKey value', async () => {
component.processInstance.businessKey = 'fakeBusinessKey'; component.processInstance.businessKey = 'fakeBusinessKey';
component.ngOnChanges(); component.ngOnChanges();
fixture.detectChanges(); fixture.detectChanges();
await fixture.whenStable();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-businessKey"]'); const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-businessKey"]');
expect(valueEl.innerText).toBe('fakeBusinessKey'); expect(valueEl.value).toBe('fakeBusinessKey');
}); });
it('should display default key if no businessKey', () => { it('should display default key if no businessKey', async () => {
component.processInstance.businessKey = null; component.processInstance.businessKey = null;
component.ngOnChanges(); component.ngOnChanges();
fixture.detectChanges(); fixture.detectChanges();
await fixture.whenStable();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-businessKey"]'); const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-businessKey"]');
expect(valueEl.innerText).toBe('ADF_PROCESS_LIST.PROPERTIES.BUSINESS_KEY_DEFAULT'); expect(valueEl.value).toBe('ADF_PROCESS_LIST.PROPERTIES.BUSINESS_KEY_DEFAULT');
}); });
describe('Config Filtering', () => { describe('Config Filtering', () => {
@@ -83,7 +83,7 @@ describe('TaskHeaderComponent', () => {
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
const formNameEl = fixture.debugElement.query(By.css('[data-automation-id="header-assignee"] .adf-textitem-clickable-value')); const formNameEl = fixture.debugElement.query(By.css('[data-automation-id="header-assignee"] .adf-textitem-clickable-value'));
expect(formNameEl.nativeElement.innerText).toBe('Wilbur Adams'); expect(formNameEl.nativeElement.value).toBe('Wilbur Adams');
}); });
})); }));
@@ -94,7 +94,7 @@ describe('TaskHeaderComponent', () => {
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
const valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-assignee"] .adf-textitem-clickable-value')); const valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-assignee"] .adf-textitem-clickable-value'));
expect(valueEl.nativeElement.innerText).toBe('ADF_TASK_LIST.PROPERTIES.ASSIGNEE_DEFAULT'); expect(valueEl.nativeElement.value).toBe('ADF_TASK_LIST.PROPERTIES.ASSIGNEE_DEFAULT');
}); });
})); }));
@@ -106,7 +106,7 @@ describe('TaskHeaderComponent', () => {
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
const formNameEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-priority"]')); const formNameEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-priority"]'));
expect(formNameEl.nativeElement.innerText).toBe('27'); expect(formNameEl.nativeElement.value).toBe('27');
}); });
})); }));
@@ -287,7 +287,7 @@ describe('TaskHeaderComponent', () => {
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
const valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-formName"] .adf-textitem-clickable-value')); const valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-formName"] .adf-textitem-clickable-value'));
expect(valueEl.nativeElement.innerText).toBe('test form'); expect(valueEl.nativeElement.value).toBe('test form');
}); });
})); }));
@@ -301,8 +301,8 @@ describe('TaskHeaderComponent', () => {
const clickableForm = fixture.debugElement.query(By.css('[data-automation-id="header-formName"] .adf-textitem-clickable-value')); const clickableForm = fixture.debugElement.query(By.css('[data-automation-id="header-formName"] .adf-textitem-clickable-value'));
expect(clickableForm).toBeNull(); expect(clickableForm).toBeNull();
const readOnlyForm = fixture.debugElement.query(By.css('[data-automation-id="header-formName"] .adf-textitem-scroll')); const readOnlyForm = fixture.debugElement.query(By.css('[data-automation-id="header-formName"] input'));
expect(readOnlyForm.nativeElement.innerText).toBe('test form'); expect(readOnlyForm.nativeElement.value).toBe('test form');
}); });
})); }));
@@ -335,7 +335,7 @@ describe('TaskHeaderComponent', () => {
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
const valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-formName"] .adf-property-value')); const valueEl = fixture.debugElement.query(By.css('[data-automation-id="header-formName"] .adf-property-value'));
expect(valueEl.nativeElement.innerText).toBe('ADF_TASK_LIST.PROPERTIES.FORM_NAME_DEFAULT'); expect(valueEl.nativeElement.value).toBe('ADF_TASK_LIST.PROPERTIES.FORM_NAME_DEFAULT');
}); });
})); }));
@@ -15,20 +15,19 @@
* limitations under the License. * limitations under the License.
*/ */
import { element, by, ElementFinder, Locator } from 'protractor'; import { element, by, ElementFinder, Locator, Key } from 'protractor';
import { BrowserActions, BrowserVisibility } from '../../utils/public-api'; import { BrowserActions, BrowserVisibility } from '../../utils/public-api';
export class CardTextItemPage { export class CardTextItemPage {
rootElement: ElementFinder; rootElement: ElementFinder;
textField: Locator = by.css('input[data-automation-id*="card-textitem-editinput"]'); textField: Locator = by.css('[data-automation-id*="card-textitem-value"]');
saveButton: Locator = by.css('button[data-automation-id*="card-textitem-update"]'); saveButton: Locator = by.css('button[data-automation-id*="card-textitem-update"]');
clearButton: Locator = by.css('button[data-automation-id*="card-textitem-reset"]'); clearButton: Locator = by.css('button[data-automation-id*="card-textitem-reset"]');
field: Locator = by.css('span[data-automation-id*="card-textitem-value"] span'); field: Locator = by.css('[data-automation-id*="card-textitem-value"]');
labelLocator: Locator = by.css('div[data-automation-id*="card-textitem-label"]'); labelLocator: Locator = by.css('div[data-automation-id*="card-textitem-label"]');
toggle: Locator = by.css('div[data-automation-id*="card-textitem-toggle"]');
editButton: Locator = by.css('button.adf-textitem-action[title*=Edit]');
errorMessage: Locator = by.css('.adf-textitem-editable-error'); errorMessage: Locator = by.css('.adf-textitem-editable-error');
clickableElement: Locator = by.css('.adf-textitem-clickable'); clickableElement: Locator = by.css('.adf-textitem-clickable');
readOnlyField: Locator = by.css('.adf-property-read-only');
constructor(label: string = 'assignee') { constructor(label: string = 'assignee') {
this.rootElement = element(by.xpath(`//div[contains(@data-automation-id, "label-${label}")]/ancestor::adf-card-view-textitem`)); this.rootElement = element(by.xpath(`//div[contains(@data-automation-id, "label-${label}")]/ancestor::adf-card-view-textitem`));
@@ -36,7 +35,7 @@ export class CardTextItemPage {
async getFieldValue(): Promise<string> { async getFieldValue(): Promise<string> {
const fieldElement = this.rootElement.all(this.field).first(); const fieldElement = this.rootElement.all(this.field).first();
return BrowserActions.getText(fieldElement); return BrowserActions.getInputValue(fieldElement);
} }
async checkLabelIsPresent(): Promise<void> { async checkLabelIsPresent(): Promise<void> {
@@ -44,14 +43,10 @@ export class CardTextItemPage {
await BrowserVisibility.waitUntilElementIsPresent(labelElement); await BrowserVisibility.waitUntilElementIsPresent(labelElement);
} }
async clickOnToggleTextField(): Promise<void> {
const toggleText: ElementFinder = this.rootElement.element(this.toggle);
await BrowserActions.click(toggleText);
}
async enterTextField(text: string): Promise<void> { async enterTextField(text: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.element(this.textField)); await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.element(this.textField));
await BrowserActions.clearSendKeys(this.rootElement.element(this.textField), text); await BrowserActions.clearSendKeys(this.rootElement.element(this.textField), text);
await this.rootElement.element(this.textField).sendKeys(Key.TAB);
} }
async clickOnSaveButton(): Promise<void> { async clickOnSaveButton(): Promise<void> {
@@ -62,17 +57,12 @@ export class CardTextItemPage {
await BrowserActions.click(this.rootElement.element(this.clearButton)); await BrowserActions.click(this.rootElement.element(this.clearButton));
} }
async clickOnEditButton(): Promise<void> {
await BrowserActions.click(this.rootElement.element(this.editButton));
}
async getErrorMessage(): Promise<string> { async getErrorMessage(): Promise<string> {
const errorField = this.rootElement.element(this.errorMessage); const errorField = this.rootElement.element(this.errorMessage);
return BrowserActions.getText(errorField); return BrowserActions.getText(errorField);
} }
async checkElementIsReadonly(): Promise<void> { async checkElementIsReadonly(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.rootElement.element(this.clickableElement)); await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.element(this.readOnlyField));
await BrowserVisibility.waitUntilElementIsNotVisible(this.rootElement.element(this.editButton));
} }
} }
@@ -65,6 +65,15 @@ export class BrowserActions {
} }
} }
static async getInputValue(elementFinder: ElementFinder): Promise<string> {
const present = await BrowserVisibility.waitUntilElementIsPresent(elementFinder);
if (present) {
return elementFinder.getAttribute('value');
} else {
return '';
}
}
static async getArrayText(elementFinders: ElementArrayFinder): Promise<string> { static async getArrayText(elementFinders: ElementArrayFinder): Promise<string> {
return elementFinders.getText(); return elementFinders.getText();
} }
@@ -75,12 +84,13 @@ export class BrowserActions {
return webElem.getCssValue('color'); return webElem.getCssValue('color');
} }
static async clearWithBackSpace(elementFinder: ElementFinder) { static async clearWithBackSpace(elementFinder: ElementFinder, sleepTime: number = 0) {
await BrowserVisibility.waitUntilElementIsVisible(elementFinder); await BrowserVisibility.waitUntilElementIsVisible(elementFinder);
await elementFinder.click(); await elementFinder.click();
const value = await elementFinder.getAttribute('value'); const value = await elementFinder.getAttribute('value');
for (let i = value.length; i >= 0; i--) { for (let i = value.length; i >= 0; i--) {
await elementFinder.sendKeys(protractor.Key.BACK_SPACE); await elementFinder.sendKeys(protractor.Key.BACK_SPACE);
await browser.sleep(sleepTime);
} }
} }
@@ -183,7 +183,7 @@ export class EditTaskFilterCloudComponentPage {
} }
async clearAssignee(): Promise<void> { async clearAssignee(): Promise<void> {
await BrowserActions.clearWithBackSpace(this.assignee); await BrowserActions.clearWithBackSpace(this.assignee, 200);
await browser.driver.sleep(1000); await browser.driver.sleep(1000);
} }
@@ -20,29 +20,29 @@ import { BrowserActions } from '../../core/utils/browser-actions';
export class ProcessHeaderCloudPage { export class ProcessHeaderCloudPage {
idField: ElementFinder = element.all(by.css('span[data-automation-id*="id"] span span')).first(); idField: ElementFinder = element.all(by.css('[data-automation-id="card-textitem-value-id"]')).first();
nameField: ElementFinder = element.all(by.css('span[data-automation-id*="name"] span span')).first(); nameField: ElementFinder = element.all(by.css('[data-automation-id="card-textitem-value-name"]')).first();
statusField: ElementFinder = element(by.css('span[data-automation-id*="status"] span span')); statusField: ElementFinder = element(by.css('[data-automation-id="card-textitem-value-status"]'));
initiatorField: ElementFinder = element(by.css('span[data-automation-id*="initiator"] span span')); initiatorField: ElementFinder = element(by.css('[data-automation-id="card-textitem-value-initiator"]'));
startDateField: ElementFinder = element.all(by.css('span[data-automation-id*="startDate"] span span')).first(); startDateField: ElementFinder = element.all(by.css('span[data-automation-id*="startDate"] span')).first();
lastModifiedField: ElementFinder = element.all(by.css('span[data-automation-id*="lastModified"] span span')).first(); lastModifiedField: ElementFinder = element.all(by.css('span[data-automation-id*="lastModified"] span')).first();
parentIdField: ElementFinder = element(by.css('span[data-automation-id*="parentId"] span span')); parentIdField: ElementFinder = element(by.css('[data-automation-id="card-textitem-value-parentId"]'));
businessKeyField: ElementFinder = element.all(by.css('span[data-automation-id*="businessKey"] span span')).first(); businessKeyField: ElementFinder = element(by.css('[data-automation-id="card-textitem-value-businessKey"]'));
async getId(): Promise<string> { async getId(): Promise<string> {
return BrowserActions.getText(this.idField); return BrowserActions.getInputValue(this.idField);
} }
async getName(): Promise<string> { async getName(): Promise<string> {
return BrowserActions.getText(this.nameField); return BrowserActions.getInputValue(this.nameField);
} }
async getStatus(): Promise<string> { async getStatus(): Promise<string> {
return BrowserActions.getText(this.statusField); return BrowserActions.getInputValue(this.statusField);
} }
async getInitiator(): Promise<string> { async getInitiator(): Promise<string> {
return BrowserActions.getText(this.initiatorField); return BrowserActions.getInputValue(this.initiatorField);
} }
async getStartDate(): Promise<string> { async getStartDate(): Promise<string> {
@@ -54,11 +54,11 @@ export class ProcessHeaderCloudPage {
} }
async getParentId(): Promise<string> { async getParentId(): Promise<string> {
return BrowserActions.getText(this.parentIdField); return BrowserActions.getInputValue(this.parentIdField);
} }
async getBusinessKey(): Promise<string> { async getBusinessKey(): Promise<string> {
return BrowserActions.getText(this.businessKeyField); return BrowserActions.getInputValue(this.businessKeyField);
} }
} }
@@ -79,10 +79,6 @@ export class StartTasksCloudPage {
await BrowserVisibility.waitUntilElementIsVisible(errorElement); await BrowserVisibility.waitUntilElementIsVisible(errorElement);
} }
async validateAssignee(error: string): Promise<void> {
await this.checkValidationErrorIsDisplayed(error, '.adf-start-task-cloud-error');
}
async validateDate(error: string): Promise<void> { async validateDate(error: string): Promise<void> {
await this.checkValidationErrorIsDisplayed(error, '.adf-error-text'); await this.checkValidationErrorIsDisplayed(error, '.adf-error-text');
} }
@@ -15,63 +15,26 @@
* limitations under the License. * limitations under the License.
*/ */
import { by, element, ElementFinder, Locator } from 'protractor'; import { browser, by, element, ElementFinder } from 'protractor';
import { BrowserVisibility } from '../../core/utils/browser-visibility'; import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions'; import { BrowserActions } from '../../core/utils/browser-actions';
export class TaskFiltersCloudComponentPage { export class TaskFiltersCloudComponentPage {
filter: ElementFinder; filter: ElementFinder;
taskIcon: Locator = by.xpath("ancestor::div[@class='mat-list-item-content']/mat-icon");
taskFilters: ElementFinder = element(by.css(`mat-expansion-panel[data-automation-id='Task Filters']`)); taskFilters: ElementFinder = element(by.css(`mat-expansion-panel[data-automation-id='Task Filters']`));
activeFilter: ElementFinder = element(by.css("mat-list-item[class*='active'] span")); activeFilter: ElementFinder = element(by.css("mat-list-item[class*='active'] span"));
defaultActiveFilter: ElementFinder = element.all(by.css('.adf-filters__entry')).first();
async checkTaskFilterIsDisplayed(filterName: string): Promise<void> { async checkTaskFilterIsDisplayed(filterName: string): Promise<void> {
this.filter = this.getTaskFilterLocatorByFilterName(filterName); this.filter = this.getTaskFilterLocatorByFilterName(filterName);
await BrowserVisibility.waitUntilElementIsVisible(this.filter); await BrowserVisibility.waitUntilElementIsVisible(this.filter);
} }
async getTaskFilterIcon(filterName: string): Promise<string> {
this.filter = this.getTaskFilterLocatorByFilterName(filterName);
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const icon = this.filter.element(this.taskIcon);
return BrowserActions.getText(icon);
}
async checkTaskFilterHasNoIcon(filterName: string): Promise<void> {
this.filter = this.getTaskFilterLocatorByFilterName(filterName);
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.taskIcon));
}
async clickTaskFilter(filterName): Promise<void> { async clickTaskFilter(filterName): Promise<void> {
this.filter = this.getTaskFilterLocatorByFilterName(filterName); this.filter = this.getTaskFilterLocatorByFilterName(filterName);
await BrowserVisibility.waitUntilElementIsClickable(this.filter); await BrowserVisibility.waitUntilElementIsClickable(this.filter);
await BrowserActions.click(this.filter); await BrowserActions.click(this.filter);
} await browser.sleep(1000);
async clickMyTasksFilter(): Promise<void> {
this.filter = this.getTaskFilterLocatorByFilterName('my-tasks');
await BrowserVisibility.waitUntilElementIsClickable(this.filter);
await BrowserActions.click(this.filter);
}
async clickCompletedTasksFilter(): Promise<void> {
this.filter = this.getTaskFilterLocatorByFilterName('completed-tasks');
await BrowserVisibility.waitUntilElementIsClickable(this.filter);
await BrowserActions.click(this.filter);
}
async checkMyTasksFilterIsDisplayed(): Promise<void> {
this.filter = this.getTaskFilterLocatorByFilterName('my-tasks');
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
}
async checkCompletedTasksFilterIsDisplayed(): Promise<void> {
this.filter = this.getTaskFilterLocatorByFilterName('completed-tasks');
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
} }
async checkTaskFilterNotDisplayed(filterName: string): Promise<void> { async checkTaskFilterNotDisplayed(filterName: string): Promise<void> {
@@ -87,11 +50,6 @@ export class TaskFiltersCloudComponentPage {
return BrowserActions.getText(this.activeFilter); return BrowserActions.getText(this.activeFilter);
} }
async firstFilterIsActive(): Promise<boolean> {
const value = await this.defaultActiveFilter.getAttribute('class');
return value.includes('adf-active');
}
getTaskFilterLocatorByFilterName(filterName: string): ElementFinder { getTaskFilterLocatorByFilterName(filterName: string): ElementFinder {
return element(by.css(`span[data-automation-id="${filterName}-filter"]`)); return element(by.css(`span[data-automation-id="${filterName}-filter"]`));
} }
@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { element, by, ElementFinder } from 'protractor'; import { element, by, ElementFinder, browser } from 'protractor';
import { BrowserVisibility } from '../../core/utils/browser-visibility'; import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions'; import { BrowserActions } from '../../core/utils/browser-actions';
import { FormFields } from '../../core/pages/form/form-fields'; import { FormFields } from '../../core/pages/form/form-fields';
@@ -77,6 +77,7 @@ export class TaskFormCloudComponent {
async clickCompleteButton(): Promise<void> { async clickCompleteButton(): Promise<void> {
await BrowserActions.click(this.completeButton); await BrowserActions.click(this.completeButton);
await browser.sleep(500);
} }
async checkFormOutcomeButtonIsDisplayedByName(name: string): Promise<void> { async checkFormOutcomeButtonIsDisplayedByName(name: string): Promise<void> {
@@ -26,10 +26,10 @@ export class TaskHeaderCloudPage {
statusCardTextItem: CardTextItemPage = new CardTextItemPage('status'); statusCardTextItem: CardTextItemPage = new CardTextItemPage('status');
priorityCardTextItem: CardTextItemPage = new CardTextItemPage('priority'); priorityCardTextItem: CardTextItemPage = new CardTextItemPage('priority');
dueDateField: ElementFinder = element.all(by.css('span[data-automation-id*="dueDate"] span')).first(); dueDateField: ElementFinder = element.all(by.css('span[data-automation-id*="dueDate"] span')).first();
categoryField: ElementFinder = element.all(by.css('span[data-automation-id*="category"] span')).first(); categoryCardTextItem: CardTextItemPage = new CardTextItemPage('category');
createdField: ElementFinder = element(by.css('span[data-automation-id="card-dateitem-created"] span')); createdField: ElementFinder = element(by.css('span[data-automation-id="card-dateitem-created"] span'));
parentNameField: ElementFinder = element(by.css('span[data-automation-id*="parentName"] span')); parentNameCardTextItem: CardTextItemPage = new CardTextItemPage('parentName');
parentTaskIdField: ElementFinder = element(by.css('span[data-automation-id*="parentTaskId"] span')); parentTaskIdCardTextItem: CardTextItemPage = new CardTextItemPage('parentTaskId');
endDateField: ElementFinder = element.all(by.css('span[data-automation-id*="endDate"] span')).first(); endDateField: ElementFinder = element.all(by.css('span[data-automation-id*="endDate"] span')).first();
idCardTextItem: CardTextItemPage = new CardTextItemPage('id'); idCardTextItem: CardTextItemPage = new CardTextItemPage('id');
descriptionCardTextItem: CardTextItemPage = new CardTextItemPage('description'); descriptionCardTextItem: CardTextItemPage = new CardTextItemPage('description');
@@ -39,10 +39,6 @@ export class TaskHeaderCloudPage {
return this.assigneeCardTextItem.getFieldValue(); return this.assigneeCardTextItem.getFieldValue();
} }
async clickOnAssignee(): Promise<void> {
await this.assigneeCardTextItem.clickOnToggleTextField();
}
async getStatus(): Promise<string> { async getStatus(): Promise<string> {
return this.statusCardTextItem.getFieldValue(); return this.statusCardTextItem.getFieldValue();
} }
@@ -52,15 +48,15 @@ export class TaskHeaderCloudPage {
} }
async getCategory(): Promise<string> { async getCategory(): Promise<string> {
return BrowserActions.getText(this.categoryField); return this.categoryCardTextItem.getFieldValue();
} }
async getParentName(): Promise<string> { async getParentName(): Promise<string> {
return BrowserActions.getText(this.parentNameField); return this.parentNameCardTextItem.getFieldValue();
} }
async getParentTaskId(): Promise<string> { async getParentTaskId(): Promise<string> {
return BrowserActions.getText(this.parentTaskIdField); return this.parentTaskIdCardTextItem.getFieldValue();
} }
async getEndDate(): Promise<string> { async getEndDate(): Promise<string> {
+1 -1
View File
@@ -242,7 +242,7 @@
}, },
{ {
"path": "./lib/dist/testing/bundles/adf-testing.umd.min.js", "path": "./lib/dist/testing/bundles/adf-testing.umd.min.js",
"maxSize": "40 kb" "maxSize": "50 kb"
} }
], ],
"engines": { "engines": {
@@ -13,7 +13,7 @@ export AUTH_TYPE="OAUTH"
AFFECTED_LIBS="$(./scripts/affected-libs.sh -gnu -b $TRAVIS_BRANCH)"; AFFECTED_LIBS="$(./scripts/affected-libs.sh -gnu -b $TRAVIS_BRANCH)";
AFFECTED_E2E="$(./scripts/git-util/affected-folder.sh -b $TRAVIS_BRANCH -f "e2e/$CONTEXT_ENV")"; AFFECTED_E2E="$(./scripts/git-util/affected-folder.sh -b $TRAVIS_BRANCH -f "e2e/$CONTEXT_ENV")";
RUN_E2E=$(echo ./scripts/test-e2e-lib.sh -host http://localhost:4200 -proxy "$E2E_HOST_BPM" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e "$E2E_EMAIL" -host_sso "$E2E_HOST_SSO" -host_bpm "$E2E_HOST_BPM" -host_identity "$E2E_HOST_IDENTITY" -identity_admin_email "$E2E_ADMIN_EMAIL_IDENTITY" -identity_admin_password "$E2E_ADMIN_PASSWORD_IDENTITY" -prefix $TRAVIS_BUILD_NUMBER --use-dist -m 2 ) RUN_E2E=$(echo ./scripts/test-e2e-lib.sh -host http://localhost:4200 -proxy "$E2E_HOST_BPM" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e "$E2E_EMAIL" -host_sso "$E2E_HOST_SSO" -host_bpm "$E2E_HOST_BPM" -host_identity "$E2E_HOST_IDENTITY" -identity_admin_email "$E2E_ADMIN_EMAIL_IDENTITY" -identity_admin_password "$E2E_ADMIN_PASSWORD_IDENTITY" -prefix $TRAVIS_BUILD_NUMBER --use-dist -m 2 -save )
./node_modules/@alfresco/adf-cli/bin/adf-cli init-aae-env --host "$E2E_HOST_BPM" --oauth "$E2E_HOST_SSO" --modelerUsername "$E2E_MODELER_USERNAME" --modelerPassword "$E2E_MODELER_PASSWORD" --devopsUsername "$E2E_DEVOPS_USERNAME" --devopsPassword "$E2E_DEVOPS_PASSWORD" --clientId 'activiti' || exit 1 ./node_modules/@alfresco/adf-cli/bin/adf-cli init-aae-env --host "$E2E_HOST_BPM" --oauth "$E2E_HOST_SSO" --modelerUsername "$E2E_MODELER_USERNAME" --modelerPassword "$E2E_MODELER_PASSWORD" --devopsUsername "$E2E_DEVOPS_USERNAME" --devopsPassword "$E2E_DEVOPS_PASSWORD" --clientId 'activiti' || exit 1
node ./scripts/check-env/check-cs-env.js --host "$E2E_HOST_BPM" -u "$E2E_ADMIN_EMAIL_IDENTITY" -p "$E2E_ADMIN_PASSWORD_IDENTITY" || exit 1 node ./scripts/check-env/check-cs-env.js --host "$E2E_HOST_BPM" -u "$E2E_ADMIN_EMAIL_IDENTITY" -p "$E2E_ADMIN_PASSWORD_IDENTITY" || exit 1