mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-865]Create card view text item PO (#5320)
* Create card view text item PO * Changed back the puppeteer version * Fix the rootElement locator * no message * Fix wrong rebase * * Added unique data-automation-id on cardViewTextComponent. * Changed data-automation-id for float
This commit is contained in:
committed by
Eugenio Romano
parent
dead0087f4
commit
5c1f02a1fd
@@ -0,0 +1,63 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2019 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { element, by, ElementFinder, Locator } from 'protractor';
|
||||
import { BrowserActions, BrowserVisibility } from '../../utils/public-api';
|
||||
|
||||
export class CardTextItemPage {
|
||||
|
||||
rootElement: ElementFinder;
|
||||
textField: Locator = by.css('input[data-automation-id*="card-textitem-editinput"]');
|
||||
saveButton: Locator = by.css('button[data-automation-id*="card-textitem-update"]');
|
||||
clearButton: Locator = by.css('button[data-automation-id*="card-textitem-reset"]');
|
||||
field: Locator = by.css('span[data-automation-id*="card-textitem-value"] span');
|
||||
labelLocator: Locator = by.css('div[data-automation-id*="card-textitem-label"]');
|
||||
toggle: Locator = by.css('div[data-automation-id*="card-textitem-toggle"]');
|
||||
|
||||
constructor(label: string = 'assignee') {
|
||||
this.rootElement = element(by.xpath(`//div[contains(@data-automation-id, "label-${label}")]/ancestor::adf-card-view-textitem`));
|
||||
}
|
||||
|
||||
async getFieldValue(): Promise<string> {
|
||||
const fieldElement = this.rootElement.element(this.field);
|
||||
return BrowserActions.getText(fieldElement);
|
||||
}
|
||||
|
||||
async checkLabelIsPresent(): Promise<void> {
|
||||
const labelElement: ElementFinder = this.rootElement.element(this.labelLocator);
|
||||
await BrowserVisibility.waitUntilElementIsPresent(labelElement);
|
||||
}
|
||||
|
||||
async clickOnToggleTextField(): Promise<void> {
|
||||
const toggleText: ElementFinder = this.rootElement.element(this.toggle);
|
||||
await BrowserActions.click(toggleText);
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.element(this.textField));
|
||||
}
|
||||
|
||||
async enterTextField(text: string): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.element(this.textField));
|
||||
await BrowserActions.clearSendKeys(this.rootElement.element(this.textField), text);
|
||||
}
|
||||
|
||||
async clickOnSaveButton(): Promise<void> {
|
||||
await BrowserActions.click(this.rootElement.element(this.saveButton));
|
||||
}
|
||||
|
||||
async clickOnClearButton(): Promise<void> {
|
||||
await BrowserActions.click(this.rootElement.element(this.clearButton));
|
||||
}
|
||||
}
|
18
lib/testing/src/lib/core/pages/card-view/public-api.ts
Normal file
18
lib/testing/src/lib/core/pages/card-view/public-api.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2019 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export * from './card-view-text-item.page';
|
@@ -27,4 +27,5 @@ export * from './error.page';
|
||||
export * from './login.page';
|
||||
export * from './notification-history.page';
|
||||
export * from './form/public-api';
|
||||
export * from './card-view/public-api';
|
||||
export * from './viewerPage';
|
||||
|
@@ -18,32 +18,37 @@
|
||||
import { element, by, ElementFinder } from 'protractor';
|
||||
import { BrowserActions } from '../../core/utils/browser-actions';
|
||||
import { BrowserVisibility } from '../../core/utils/browser-visibility';
|
||||
import { CardTextItemPage } from '../../core/pages/card-view/card-view-text-item.page';
|
||||
|
||||
export class TaskHeaderCloudPage {
|
||||
|
||||
assigneeField: ElementFinder = element(by.css('span[data-automation-id*="assignee"] span'));
|
||||
statusField: ElementFinder = element(by.css('span[data-automation-id*="status"] span'));
|
||||
priorityField: ElementFinder = element(by.css('span[data-automation-id*="priority"] span'));
|
||||
assigneeCardTextItem: CardTextItemPage = new CardTextItemPage('assignee');
|
||||
statusCardTextItem: CardTextItemPage = new CardTextItemPage('status');
|
||||
priorityCardTextItem: CardTextItemPage = new CardTextItemPage('priority');
|
||||
dueDateField: ElementFinder = element.all(by.css('span[data-automation-id*="dueDate"] span')).first();
|
||||
categoryField: ElementFinder = element(by.css('span[data-automation-id*="category"] 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'));
|
||||
parentTaskIdField: ElementFinder = element(by.css('span[data-automation-id*="parentTaskId"] span'));
|
||||
endDateField: ElementFinder = element.all(by.css('span[data-automation-id*="endDate"] span')).first();
|
||||
idField: ElementFinder = element.all(by.css('span[data-automation-id*="id"] span')).first();
|
||||
descriptionField: ElementFinder = element(by.css('span[data-automation-id*="description"] span'));
|
||||
idCardTextItem: CardTextItemPage = new CardTextItemPage('id');
|
||||
descriptionCardTextItem: CardTextItemPage = new CardTextItemPage('description');
|
||||
taskPropertyList: ElementFinder = element(by.css('adf-cloud-task-header adf-card-view div[class="adf-property-list"]'));
|
||||
|
||||
async getAssignee(): Promise<string> {
|
||||
return BrowserActions.getText(this.assigneeField);
|
||||
return this.assigneeCardTextItem.getFieldValue();
|
||||
}
|
||||
|
||||
async clickOnAssignee(): Promise<void> {
|
||||
await this.assigneeCardTextItem.clickOnToggleTextField();
|
||||
}
|
||||
|
||||
async getStatus(): Promise<string> {
|
||||
return BrowserActions.getText(this.statusField);
|
||||
return this.statusCardTextItem.getFieldValue();
|
||||
}
|
||||
|
||||
async getPriority(): Promise<string> {
|
||||
return BrowserActions.getText(this.priorityField);
|
||||
return this.priorityCardTextItem.getFieldValue();
|
||||
}
|
||||
|
||||
async getCategory(): Promise<string> {
|
||||
@@ -67,11 +72,11 @@ export class TaskHeaderCloudPage {
|
||||
}
|
||||
|
||||
async getId(): Promise<string> {
|
||||
return BrowserActions.getText(this.idField);
|
||||
return this.idCardTextItem.getFieldValue();
|
||||
}
|
||||
|
||||
async getDescription(): Promise<string> {
|
||||
return BrowserActions.getText(this.descriptionField);
|
||||
return this.descriptionCardTextItem.getFieldValue();
|
||||
}
|
||||
|
||||
async getDueDate(): Promise<string> {
|
||||
|
Reference in New Issue
Block a user