[ADF-5463] Rework Protractor tests - changes related to element/element… (#7284)

* ADF-5463 Rework Protractor tests - changes related to element/elements and duplication of locators

* Fix one which I missed

* Remove console.logs

* Remove console.logs

* Reverse the timeouts

* Fixed things TSLint

* Remove unused import

* Fixed broken tests

* Last test fixed
This commit is contained in:
MichalFidor
2021-10-08 17:28:37 +02:00
committed by GitHub
parent db6a638a2d
commit 1e62b46060
156 changed files with 1653 additions and 1647 deletions

View File

@@ -15,18 +15,18 @@
* limitations under the License.
*/
import { element, by, protractor } from 'protractor';
import { element, by, protractor, $ } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class AnalyticsPage {
toolbarTitleInput = element(by.css('input[data-automation-id="reportName"]'));
toolbarTitleContainer = element(by.css('adf-toolbar-title'));
toolbarTitleInput = $('input[data-automation-id="reportName"]');
toolbarTitleContainer = $('adf-toolbar-title');
toolbarTitle = element(by.xpath('//mat-toolbar/adf-toolbar-title/div/h4'));
reportMessage = element(by.css('div[class="ng-star-inserted"] span'));
reportMessage = $('div[class="ng-star-inserted"] span');
async getReport(title: string): Promise<void> {
const reportTitle = element(by.css(`mat-icon[data-automation-id="${title}_filter"]`));
const reportTitle = $(`mat-icon[data-automation-id="${title}_filter"]`);
await BrowserActions.click(reportTitle);
}

View File

@@ -15,18 +15,18 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { $ } from 'protractor';
import { BrowserVisibility, BrowserActions, DropdownPage } from '@alfresco/adf-testing';
export class AttachFormPage {
noFormMessage = element(by.css('.adf-empty-content__title'));
attachFormButton = element(by.id('adf-attach-form-attach-button'));
completeButton = element(by.id('adf-attach-form-complete-button'));
formDropdown = element(by.id('form_id'));
cancelButton = element(by.id('adf-attach-form-cancel-button'));
defaultTitle = element(by.css('.mat-card-title'));
attachFormDropdown = new DropdownPage(element(by.css('.adf-attach-form-row')));
noFormMessage = $('.adf-empty-content__title');
attachFormButton = $('#adf-attach-form-attach-button');
completeButton = $('#adf-attach-form-complete-button');
formDropdown = $('#form_id');
cancelButton = $('#adf-attach-form-cancel-button');
defaultTitle = $('.mat-card-title');
attachFormDropdown = new DropdownPage($('.adf-attach-form-row'));
async checkNoFormMessageIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.noFormMessage);
@@ -70,6 +70,6 @@ export class AttachFormPage {
}
async checkAttachFormButtonIsDisabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.css('button[id="adf-attach-form-attach-button"][disabled]')));
await BrowserVisibility.waitUntilElementIsVisible($('button[id="adf-attach-form-attach-button"][disabled]'));
}
}

View File

@@ -15,18 +15,18 @@
* limitations under the License.
*/
import { element, by, protractor, browser } from 'protractor';
import { protractor, browser, $, $$ } from 'protractor';
import * as path from 'path';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class AttachmentListPage {
attachFileButton = element(by.css("input[type='file']"));
buttonMenu = element(by.css("button[data-automation-id='action_menu_0']"));
viewButton = element(by.css("button[data-automation-id*='MENU_ACTIONS.VIEW_CONTENT']"));
removeButton = element(by.css("button[data-automation-id*='MENU_ACTIONS.REMOVE_CONTENT']"));
downloadButton = element(by.css("button[data-automation-id*='MENU_ACTIONS.DOWNLOAD_CONTENT']"));
noContentContainer = element(by.css("div[class*='adf-no-content-container']"));
attachFileButton = $("input[type='file']");
buttonMenu = $("button[data-automation-id='action_menu_0']");
viewButton = $("button[data-automation-id*='MENU_ACTIONS.VIEW_CONTENT']");
removeButton = $("button[data-automation-id*='MENU_ACTIONS.REMOVE_CONTENT']");
downloadButton = $("button[data-automation-id*='MENU_ACTIONS.DOWNLOAD_CONTENT']");
noContentContainer = $("div[class*='adf-no-content-container']");
async checkEmptyAttachmentList(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.noContentContainer);
@@ -39,7 +39,7 @@ export class AttachmentListPage {
}
async checkFileIsAttached(name: string): Promise<void> {
const fileAttached = element.all(by.css('div[data-automation-id="' + name + '"]')).first();
const fileAttached = $$('div[data-automation-id="' + name + '"]').first();
await BrowserVisibility.waitUntilElementIsVisible(fileAttached);
}
@@ -49,7 +49,7 @@ export class AttachmentListPage {
async viewFile(name: string): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.click(element.all(by.css('div[data-automation-id="' + name + '"]')).first());
await BrowserActions.click($$('div[data-automation-id="' + name + '"]').first());
await BrowserActions.click(this.buttonMenu);
await browser.sleep(500);
await BrowserActions.click(this.viewButton);
@@ -58,7 +58,7 @@ export class AttachmentListPage {
async removeFile(name: string): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.click(element.all(by.css('div[data-automation-id="' + name + '"]')).first());
await BrowserActions.click($$('div[data-automation-id="' + name + '"]').first());
await BrowserActions.click(this.buttonMenu);
await browser.sleep(500);
await BrowserActions.click(this.removeButton);
@@ -67,7 +67,7 @@ export class AttachmentListPage {
async downloadFile(name: string): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.click(element.all(by.css('div[data-automation-id="' + name + '"]')).first());
await BrowserActions.click($$('div[data-automation-id="' + name + '"]').first());
await BrowserActions.click(this.buttonMenu);
await browser.sleep(500);
await BrowserActions.click(this.downloadButton);
@@ -75,14 +75,14 @@ export class AttachmentListPage {
async doubleClickFile(name: string): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserVisibility.waitUntilElementIsVisible(element.all(by.css(`div[data-automation-id="${name}"]`)).first());
const fileAttached = element.all(by.css(`div[data-automation-id="${name}"]`)).first();
await BrowserVisibility.waitUntilElementIsVisible($$(`div[data-automation-id="${name}"]`).first());
const fileAttached = $$(`div[data-automation-id="${name}"]`).first();
await BrowserActions.click(fileAttached);
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
}
async checkFileIsRemoved(name: string): Promise<void> {
const fileAttached = element.all(by.css(`div[data-automation-id="${name}"]`)).first();
const fileAttached = $$(`div[data-automation-id="${name}"]`).first();
await BrowserVisibility.waitUntilElementIsNotVisible(fileAttached);
}

View File

@@ -16,15 +16,15 @@
*/
import { TogglePage } from '@alfresco/adf-testing';
import { element, by } from 'protractor';
import { $ } from 'protractor';
export class AppSettingsTogglesPage {
togglePage = new TogglePage();
showDetailsHeaderToggle = element(by.id('adf-show-header'));
showTaskFilterIconsToggle = element(by.id('adf-show-task-filter-icon'));
showProcessFilterIconsToggle = element(by.id('adf-show-process-filter-icon'));
showDetailsHeaderToggle = $('#adf-show-header');
showTaskFilterIconsToggle = $('#adf-show-task-filter-icon');
showProcessFilterIconsToggle = $('#adf-show-process-filter-icon');
async enableShowHeader(): Promise<void> {
await this.togglePage.enableToggle(this.showDetailsHeaderToggle);

View File

@@ -15,15 +15,15 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { $ } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class ChecklistDialog {
nameField = element(by.css('input[data-automation-id="checklist-name"]'));
addChecklistButton = element(by.css('button[id="add-check"] span'));
closeButton = element(by.css('button[id="close-check-dialog"] span'));
dialogTitle = element(by.id('add-checklist-title'));
nameField = $('input[data-automation-id="checklist-name"]');
addChecklistButton = $('button[id="add-check"] span');
closeButton = $('button[id="close-check-dialog"] span');
dialogTitle = $('#add-checklist-title');
async addName(name: string): Promise<void> {
await BrowserActions.clearSendKeys(this.nameField, name);

View File

@@ -15,20 +15,20 @@
* limitations under the License.
*/
import { element, by, Key, ElementFinder } from 'protractor';
import { element, by, Key, ElementFinder, $ } from 'protractor';
import { BrowserVisibility, BrowserActions, DropdownPage } from '@alfresco/adf-testing';
export class StartTaskDialogPage {
name = element(by.css('input[id="name_id"]'));
dueDate = element(by.css('input[id="date_id"]'));
description = element(by.css('textarea[id="description_id"]'));
assignee = element(by.css('div#people-widget-content input'));
startButton = element(by.css('button[id="button-start"]'));
startButtonEnabled = element(by.css('button[id="button-start"]:not(disabled)'));
cancelButton = element(by.css('button[id="button-cancel"]'));
name = $('input[id="name_id"]');
dueDate = $('input[id="date_id"]');
description = $('textarea[id="description_id"]');
assignee = $('div#people-widget-content input');
startButton = $('button[id="button-start"]');
startButtonEnabled = $('button[id="button-start"]:not(disabled)');
cancelButton = $('button[id="button-cancel"]');
selectFormDropdown = new DropdownPage(element(by.css('mat-select[id="form_id"]')));
selectFormDropdown = new DropdownPage($('mat-select[id="form_id"]'));
selectAssigneeDropdown = new DropdownPage();
async addName(userName: string): Promise<void> {
@@ -74,7 +74,7 @@ export class StartTaskDialogPage {
}
async checkStartButtonIsDisabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.css('button[id="button-start"]:disabled')));
await BrowserVisibility.waitUntilElementIsVisible($('button[id="button-start"]:disabled'));
}
async clickCancelButton(): Promise<void> {

View File

@@ -16,11 +16,11 @@
*/
import { BrowserActions, BrowserVisibility, DataTableComponentPage } from '@alfresco/adf-testing';
import { by, element } from 'protractor';
import { $ } from 'protractor';
export class FiltersPage {
activeFilter = element(by.css('.adf-active'));
activeFilter = $('.adf-active');
dataTable: DataTableComponentPage = new DataTableComponentPage();
async getActiveFilter(): Promise<string> {
@@ -29,7 +29,7 @@ export class FiltersPage {
async goToFilter(filterName): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
const filter = element(by.css(`button[data-automation-id="${filterName}_filter"]`));
const filter = $(`button[data-automation-id="${filterName}_filter"]`);
await BrowserActions.click(filter);
await this.dataTable.waitTillContentLoaded();
}
@@ -43,7 +43,7 @@ export class FiltersPage {
}
async checkFilterIsHighlighted(filterName: string): Promise<void> {
const highlightedFilter = element(by.css(`.adf-active [data-automation-id='${filterName}_filter']`));
const highlightedFilter = $(`.adf-active [data-automation-id='${filterName}_filter']`);
await BrowserVisibility.waitUntilElementIsVisible(highlightedFilter);
}
}

View File

@@ -16,12 +16,12 @@
*/
import { BrowserActions, BrowserVisibility, ConfigEditorPage } from '@alfresco/adf-testing';
import { by, element } from 'protractor';
import { $$, $ } from 'protractor';
export class FormDemoPage {
formCloudEditor = element.all(by.css('.mat-tab-list .mat-tab-label')).get(1);
formCloudRender = element.all(by.css('.mat-tab-list .mat-tab-label')).get(0);
formCloudEditor = $$('.mat-tab-list .mat-tab-label').get(1);
formCloudRender = $$('.mat-tab-list .mat-tab-label').get(0);
configEditorPage = new ConfigEditorPage();
@@ -34,8 +34,8 @@ export class FormDemoPage {
}
async setConfigToEditor(text: string): Promise<void> {
const configEditor = element(by.id('adf-form-config-editor'));
const form = element(by.css('adf-form'));
const configEditor = $('#adf-form-config-editor');
const form = $('adf-form');
await this.goToEditor();
await BrowserVisibility.waitUntilElementIsVisible(configEditor);
await this.configEditorPage.enterBulkConfiguration(text);

View File

@@ -16,25 +16,23 @@
*/
import { BrowserActions, BrowserVisibility, DataTableComponentPage, StartProcessPage } from '@alfresco/adf-testing';
import { Locator, by, element } from 'protractor';
import { $, $$ } from 'protractor';
export class ProcessFiltersPage {
dataTable = new DataTableComponentPage();
runningFilter = element(by.css('button[data-automation-id="Running_filter"]'));
completedFilter = element(by.css('button[data-automation-id="Completed_filter"]'));
allFilter = element(by.css('button[data-automation-id="All_filter"]'));
createProcessButton = element(by.css('.app-processes-menu button[data-automation-id="create-button"] > span'));
newProcessButton = element(by.css('div > button[data-automation-id="btn-start-process"]'));
processesPage = element(by.id('app-processes-menu'));
accordionMenu = element(by.css('.app-processes-menu mat-accordion'));
buttonWindow = element(by.css('div > button[data-automation-id="btn-start-process"] > div'));
noContentMessage = element.all(by.css('.adf-empty-content__title')).first();
rows: Locator = by.css('adf-process-instance-list .adf-datatable-body adf-datatable-row[class*="adf-datatable-row"]');
tableBody = element.all(by.css('adf-datatable .adf-datatable-body')).first();
nameColumn: Locator = by.css('div[class*="adf-datatable-body"] adf-datatable-row[class*="adf-datatable-row"] div[title="Name"] span');
processIcon: Locator = by.css('adf-icon[data-automation-id="adf-filter-icon"]');
startProcessEl = element(by.css('adf-start-process .adf-start-process'));
createProcessButton = $('.app-processes-menu button[data-automation-id="create-button"] > span');
newProcessButton = $('div > button[data-automation-id="btn-start-process"]');
processesPage = $('#app-processes-menu');
accordionMenu = $('.app-processes-menu mat-accordion');
buttonWindow = $('div > button[data-automation-id="btn-start-process"] > div');
noContentMessage = $$('.adf-empty-content__title').first();
rows = $$('adf-process-instance-list .adf-datatable-body adf-datatable-row[class*="adf-datatable-row"]');
tableBody = $$('adf-datatable .adf-datatable-body').first();
processIcon = 'adf-icon[data-automation-id="adf-filter-icon"]';
startProcessEl = $('adf-start-process .adf-start-process');
getButtonFilterLocatorByName = (name: string) => $(`button[data-automation-id='${name}_filter']`);
async startProcess(): Promise<StartProcessPage> {
await this.clickCreateProcessButton();
@@ -43,17 +41,19 @@ export class ProcessFiltersPage {
}
async clickRunningFilterButton(): Promise<void> {
await BrowserActions.click(this.runningFilter);
await BrowserActions.click(await this.getButtonFilterLocatorByName('Running'));
}
async clickCompletedFilterButton(): Promise<void> {
await BrowserActions.click(this.completedFilter);
await expect(await this.completedFilter.isEnabled()).toBe(true);
const completedFilterButtonLocator = await this.getButtonFilterLocatorByName('Completed');
await BrowserActions.click(completedFilterButtonLocator);
await expect(await completedFilterButtonLocator.isEnabled()).toBe(true);
}
async clickAllFilterButton(): Promise<void> {
await BrowserActions.click(this.allFilter);
await expect(await this.allFilter.isEnabled()).toBe(true);
const allFilterButtonLocator = await this.getButtonFilterLocatorByName('All');
await BrowserActions.click(allFilterButtonLocator);
await expect(await allFilterButtonLocator.isEnabled()).toBe(true);
}
async clickCreateProcessButton(): Promise<void> {
@@ -78,18 +78,18 @@ export class ProcessFiltersPage {
async selectFromProcessList(title: string): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
const processName = element.all(by.css(`div[data-automation-id="text_${title}"]`)).first();
const processName = $$(`div[data-automation-id="text_${title}"]`).first();
await BrowserActions.click(processName);
}
async checkFilterIsHighlighted(filterName: string): Promise<void> {
const processNameHighlighted = element(by.css(`adf-process-instance-filters .adf-active button[data-automation-id='${filterName}_filter']`));
const processNameHighlighted = $(`adf-process-instance-filters .adf-active button[data-automation-id='${filterName}_filter']`);
await BrowserVisibility.waitUntilElementIsVisible(processNameHighlighted);
}
async numberOfProcessRows(): Promise<number> {
await BrowserVisibility.waitUntilElementIsVisible(element.all(this.rows).first());
return element.all(this.rows).count();
await BrowserVisibility.waitUntilElementIsVisible(await this.rows.first());
return this.rows.count();
}
async waitForTableBody(): Promise<void> {
@@ -110,25 +110,25 @@ export class ProcessFiltersPage {
}
async checkFilterIsDisplayed(name: string): Promise<void> {
const filterName = element(by.css(`button[data-automation-id='${name}_filter']`));
const filterName = await this.getButtonFilterLocatorByName(name);
await BrowserVisibility.waitUntilElementIsVisible(filterName);
}
async checkFilterHasNoIcon(name: string): Promise<void> {
const filterName = element(by.css(`button[data-automation-id='${name}_filter']`));
const filterName = await this.getButtonFilterLocatorByName(name);
await BrowserVisibility.waitUntilElementIsVisible(filterName);
await BrowserVisibility.waitUntilElementIsNotVisible(filterName.element(this.processIcon));
await BrowserVisibility.waitUntilElementIsNotVisible(filterName.$(this.processIcon));
}
async getFilterIcon(name: string): Promise<string> {
const filterName = element(by.css(`button[data-automation-id='${name}_filter']`));
const filterName = await this.getButtonFilterLocatorByName(name);
await BrowserVisibility.waitUntilElementIsVisible(filterName);
const icon = filterName.element(this.processIcon);
const icon = filterName.$(this.processIcon);
return BrowserActions.getText(icon);
}
async checkFilterIsNotDisplayed(name: string): Promise<void> {
const filterName = element(by.css(`button[data-automation-id='${name}_filter']`));
const filterName = await this.getButtonFilterLocatorByName(name);
await BrowserVisibility.waitUntilElementIsNotVisible(filterName);
}

View File

@@ -16,18 +16,18 @@
*/
import { BrowserActions, BrowserVisibility, DataTableComponentPage, DropdownPage } from '@alfresco/adf-testing';
import { by, element, protractor } from 'protractor';
import { $, by, element, protractor } from 'protractor';
export class ProcessListDemoPage {
appIdInput = element(by.css('input[data-automation-id="app-id"]'));
appIdInput = $('input[data-automation-id="app-id"]');
resetButton = element(by.cssContainingText('button span', 'Reset'));
emptyProcessContent = element(by.css('.adf-empty-content'));
processDefinitionInput = element(by.css('input[data-automation-id="process-definition-id"]'));
processInstanceInput = element(by.css('input[data-automation-id="process-instance-id"]'));
emptyProcessContent = $('.adf-empty-content');
processDefinitionInput = $('input[data-automation-id="process-definition-id"]');
processInstanceInput = $('input[data-automation-id="process-instance-id"]');
stateDropdown = new DropdownPage(element(by.css('mat-select[data-automation-id="state"')));
sortDropdown = new DropdownPage(element(by.css('mat-select[data-automation-id="sort"')));
stateDropdown = new DropdownPage($('mat-select[data-automation-id="state"'));
sortDropdown = new DropdownPage($('mat-select[data-automation-id="sort"'));
dataTable = new DataTableComponentPage();

View File

@@ -16,12 +16,12 @@
*/
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
import { element, by } from 'protractor';
import { $ } from 'protractor';
export class ProcessListPage {
processListTitle = element(by.css('.adf-empty-content__title'));
processInstanceList = element(by.css('adf-process-instance-list'));
processListTitle = $('.adf-empty-content__title');
processInstanceList = $('adf-process-instance-list');
getDisplayedProcessListTitle(): Promise<string> {
return BrowserActions.getText(this.processListTitle);

View File

@@ -17,23 +17,24 @@
import { ProcessServiceTabBarPage } from './process-service-tab-bar.page';
import { Locator, element, by, browser } from 'protractor';
import { browser, $, ElementFinder } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
import { TasksPage } from './tasks.page';
export class ProcessServicesPage {
apsAppsContainer = element(by.css('.adf-app-listgrid'));
taskApp = element(by.css('mat-card[title="Task App"]'));
iconTypeLocator: Locator = by.css('mat-icon[class*="card-logo-icon"]');
descriptionLocator: Locator = by.css('mat-card-subtitle[class*="subtitle"]');
apsAppsContainer = $('.adf-app-listgrid');
iconTypeLocator = 'mat-icon[class*="card-logo-icon"]';
descriptionLocator = 'mat-card-subtitle[class*="subtitle"]';
getApplicationNameLocator = (name: string): ElementFinder => $(`mat-card[title="${name}"]`);
async checkApsContainer(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.apsAppsContainer);
}
async goToApp(applicationName: string): Promise<ProcessServiceTabBarPage> {
const app = element(by.css('mat-card[title="' + applicationName + '"]'));
const app = this.getApplicationNameLocator(applicationName);
await BrowserActions.click(app);
const taskPage = new TasksPage();
await taskPage.tasksListPage().checkTaskListIsLoaded();
@@ -41,7 +42,8 @@ export class ProcessServicesPage {
}
async goToTaskApp(): Promise<ProcessServiceTabBarPage> {
await BrowserActions.click(this.taskApp);
const taskAppLocator = this.getApplicationNameLocator('Task App');
await BrowserActions.click(taskAppLocator);
return new ProcessServiceTabBarPage();
}
@@ -53,32 +55,32 @@ export class ProcessServicesPage {
}
async getAppIconType(applicationName: string): Promise<string> {
const app = element(by.css('mat-card[title="' + applicationName + '"]'));
const app = this.getApplicationNameLocator(applicationName);
await BrowserVisibility.waitUntilElementIsVisible(app);
const iconType = app.element(this.iconTypeLocator);
const iconType = await app.$(this.iconTypeLocator);
return BrowserActions.getText(iconType);
}
async getBackgroundColor(applicationName: string): Promise<string> {
const app = element(by.css('mat-card[title="' + applicationName + '"]'));
const app = this.getApplicationNameLocator(applicationName);
await BrowserVisibility.waitUntilElementIsVisible(app);
return app.getCssValue('background-color');
}
async getDescription(applicationName: string): Promise<string> {
const app = element(by.css('mat-card[title="' + applicationName + '"]'));
const app = this.getApplicationNameLocator(applicationName);
await BrowserVisibility.waitUntilElementIsVisible(app);
const description = app.element(this.descriptionLocator);
const description = await app.$(this.descriptionLocator);
return BrowserActions.getText(description);
}
async checkAppIsNotDisplayed(applicationName: string): Promise<void> {
const app = element(by.css('mat-card[title="' + applicationName + '"]'));
const app = this.getApplicationNameLocator(applicationName);
await BrowserVisibility.waitUntilElementIsNotVisible(app);
}
async checkAppIsDisplayed(applicationName: string): Promise<void> {
const app = element(by.css('mat-card[title="' + applicationName + '"]'));
const app = this.getApplicationNameLocator(applicationName);
await BrowserVisibility.waitUntilElementIsVisible(app);
}
}

View File

@@ -16,73 +16,73 @@
*/
import { BrowserActions, BrowserVisibility, DropdownPage, TabsPage } from '@alfresco/adf-testing';
import { browser, by, element, Key } from 'protractor';
import { browser, by, element, Key, $, $$ } from 'protractor';
import { AppSettingsTogglesPage } from './dialog/app-settings-toggles.page';
export class TaskDetailsPage {
appSettingsTogglesClass = new AppSettingsTogglesPage();
formContent = element(by.css('adf-form'));
formContent = $('adf-form');
formNameField = element(by.css('[data-automation-id="card-textitem-value-formName"]'));
formNameButton = element(by.css('[data-automation-id="card-textitem-toggle-formName"]'));
assigneeField = element(by.css('[data-automation-id="card-textitem-value-assignee"]'));
assigneeButton = element(by.css('[data-automation-id="card-textitem-toggle-assignee"]'));
statusField = element(by.css('[data-automation-id="card-textitem-value-status"]'));
categoryField = element(by.css('[data-automation-id="card-textitem-value-category"] '));
parentNameField = element(by.css('span[data-automation-id*="parentName"] span'));
parentTaskIdField = element(by.css('[data-automation-id="card-textitem-value-parentTaskId"] '));
durationField = element(by.css('[data-automation-id="card-textitem-value-duration"] '));
endDateField = element.all(by.css('span[data-automation-id*="endDate"] span')).first();
createdField = element(by.css('span[data-automation-id="card-dateitem-created"]'));
idField = element.all(by.css('[data-automation-id="card-textitem-value-id"]')).first();
descriptionField = element(by.css('[data-automation-id="card-textitem-value-description"]'));
dueDateField = element.all(by.css('span[data-automation-id*="dueDate"] span')).first();
activitiesTitle = element(by.css('div[class*="adf-info-drawer-layout-header-title"] div'));
commentField = element(by.id('comment-input'));
addCommentButton = element(by.css('[data-automation-id="comments-input-add"]'));
involvePeopleButton = element(by.css('div[class*="add-people"]'));
addPeopleField = element(by.css('input[data-automation-id="adf-people-search-input"]'));
addInvolvedUserButton = element(by.css('button[id="add-people"]'));
formNameField = $('[data-automation-id="card-textitem-value-formName"]');
formNameButton = $('[data-automation-id="card-textitem-toggle-formName"]');
assigneeField = $('[data-automation-id="card-textitem-value-assignee"]');
assigneeButton = $('[data-automation-id="card-textitem-toggle-assignee"]');
statusField = $('[data-automation-id="card-textitem-value-status"]');
categoryField = $('[data-automation-id="card-textitem-value-category"] ');
parentNameField = $('span[data-automation-id*="parentName"] span');
parentTaskIdField = $('[data-automation-id="card-textitem-value-parentTaskId"] ');
durationField = $('[data-automation-id="card-textitem-value-duration"] ');
endDateField = $$('span[data-automation-id*="endDate"] span').first();
createdField = $('span[data-automation-id="card-dateitem-created"]');
idField = $$('[data-automation-id="card-textitem-value-id"]').first();
descriptionField = $('[data-automation-id="card-textitem-value-description"]');
dueDateField = $$('span[data-automation-id*="dueDate"] span').first();
activitiesTitle = $('div[class*="adf-info-drawer-layout-header-title"] div');
commentField = $('#comment-input');
addCommentButton = $('[data-automation-id="comments-input-add"]');
involvePeopleButton = $('div[class*="add-people"]');
addPeopleField = $('input[data-automation-id="adf-people-search-input"]');
addInvolvedUserButton = $('button[id="add-people"]');
taskDetailsInfoDrawer = element(by.tagName('adf-info-drawer'));
taskDetailsSection = element(by.css('div[data-automation-id="app-tasks-details"]'));
taskDetailsEmptySection = element(by.css('div[data-automation-id="adf-tasks-details--empty"]'));
completeTask = element(by.css('button[id="adf-no-form-complete-button"]'));
completeFormTask = element(by.css('button[id="adf-form-complete"]'));
taskDetailsTitle = element(by.css('.adf-activiti-task-details__header span'));
auditLogButton = element(by.css('button[adf-task-audit]'));
noPeopleInvolved = element(by.id('no-people-label'));
cancelInvolvePeopleButton = element(by.id('close-people-search'));
involvePeopleHeader = element(by.css('.adf-search-text-header'));
removeInvolvedPeople = element(by.css('button[data-automation-id="Remove"]'));
peopleTitle = element(by.id('people-title'));
noFormMessage = element(by.css('span[id*="no-form-message"]'));
cancelAttachForm = element(by.id('adf-no-form-cancel-button'));
attachFormButton = element(by.id('adf-no-form-attach-form-button'));
disabledAttachFormButton = element(by.css('button[id="adf-no-form-attach-form-button"][disabled]'));
removeAttachForm = element(by.id('adf-attach-form-remove-button'));
attachFormName = element(by.css('.adf-form-title'));
emptyTaskDetails = element(by.css('adf-task-details > div > div'));
priority = element(by.css('[data-automation-id*="card-textitem-value-priority"]'));
editableAssignee = element(by.css('[data-automation-id="card-textitem-value-assignee"][class*="clickable"]'));
claimElement = element(by.css('[data-automation-id="header-claim-button"]'));
releaseElement = element(by.css('[data-automation-id="header-unclaim-button"]'));
saveFormButton = element(by.css('button[id="adf-form-save"]'));
taskDetailsSection = $('div[data-automation-id="app-tasks-details"]');
taskDetailsEmptySection = $('div[data-automation-id="adf-tasks-details--empty"]');
completeTask = $('button[id="adf-no-form-complete-button"]');
completeFormTask = $('button[id="adf-form-complete"]');
taskDetailsTitle = $('.adf-activiti-task-details__header span');
auditLogButton = $('button[adf-task-audit]');
noPeopleInvolved = $('#no-people-label');
cancelInvolvePeopleButton = $('#close-people-search');
involvePeopleHeader = $('.adf-search-text-header');
removeInvolvedPeople = $('button[data-automation-id="Remove"]');
peopleTitle = $('#people-title');
noFormMessage = $('span[id*="no-form-message"]');
cancelAttachForm = $('#adf-no-form-cancel-button');
attachFormButton = $('#adf-no-form-attach-form-button');
disabledAttachFormButton = $('button[id="adf-no-form-attach-form-button"][disabled]');
removeAttachForm = $('#adf-attach-form-remove-button');
attachFormName = $('.adf-form-title');
emptyTaskDetails = $('adf-task-details > div > div');
priority = $('[data-automation-id*="card-textitem-value-priority"]');
editableAssignee = $('[data-automation-id="card-textitem-value-assignee"][class*="clickable"]');
claimElement = $('[data-automation-id="header-claim-button"]');
releaseElement = $('[data-automation-id="header-unclaim-button"]');
saveFormButton = $('button[id="adf-form-save"]');
attachFormDropdown = new DropdownPage(element(by.css('.adf-attach-form-row')));
attachFormDropdown = new DropdownPage($('.adf-attach-form-row'));
async checkEditableAssigneeIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.editableAssignee);
}
async checkEditableFormIsNotDisplayed(): Promise<void> {
const editableForm = element(by.css('[data-automation-id="card-textitem-value-formName"][class*="clickable"]'));
const editableForm = $('[data-automation-id="card-textitem-value-formName"][class*="clickable"]');
await BrowserVisibility.waitUntilElementIsNotVisible(editableForm);
}
async checkDueDatePickerButtonIsNotDisplayed(): Promise<void> {
const dueDatePickerButton = element(by.css('mat-datetimepicker-toggle[data-automation-id="datepickertoggle-dueDate"]'));
const dueDatePickerButton = $('mat-datetimepicker-toggle[data-automation-id="datepickertoggle-dueDate"]');
await BrowserVisibility.waitUntilElementIsNotVisible(dueDatePickerButton);
}
@@ -219,33 +219,33 @@ export class TaskDetailsPage {
async updatePriority(priority?: string): Promise<void> {
await BrowserActions.click(this.priority);
await BrowserActions.clearWithBackSpace(this.priority);
await BrowserActions.clearSendKeys(element(by.css('input[data-automation-id="card-textitem-value-priority"]')), priority, 500);
await BrowserActions.clearSendKeys($('input[data-automation-id="card-textitem-value-priority"]'), priority, 500);
await this.priority.sendKeys(Key.TAB);
await browser.sleep(1000);
}
async updateDueDate(): Promise<void> {
await BrowserActions.click(this.dueDateField);
await BrowserActions.click(element.all(by.css('.mat-datetimepicker-calendar-body-cell')).first());
await BrowserActions.click($$('.mat-datetimepicker-calendar-body-cell').first());
await browser.sleep(1000);
}
async updateDescription(description?: string): Promise<void> {
await BrowserActions.click(this.descriptionField);
await BrowserActions.clearWithBackSpace(this.descriptionField);
await BrowserActions.clearSendKeys(element(by.css('[data-automation-id="card-textitem-value-description"]')), description ? description : '');
await BrowserActions.clearSendKeys($('[data-automation-id="card-textitem-value-description"]'), description ? description : '');
await this.descriptionField.sendKeys(Key.TAB);
await browser.sleep(1000);
}
async updateAssignee(fullName: string): Promise<void> {
await BrowserActions.click(this.assigneeButton);
await BrowserActions.clearSendKeys(element(by.css('[id="userSearchText"]')), fullName);
await BrowserActions.clearSendKeys($('[id="userSearchText"]'), fullName);
await BrowserActions.click(element(by.cssContainingText('.adf-people-full-name', fullName)));
await BrowserVisibility.waitUntilElementIsVisible(element(by.css(`adf-datatable-row[class*='is-selected']`)));
await BrowserVisibility.waitUntilElementIsVisible($(`adf-datatable-row[class*='is-selected']`));
await browser.sleep(2000);
await BrowserActions.click(element(by.css('button[id="add-people"]')));
await BrowserActions.click($('button[id="add-people"]'));
}
getTitle(): Promise<string> {
@@ -304,19 +304,19 @@ export class TaskDetailsPage {
}
getRowsUser(user: string) {
return element(by.css(`div[data-automation-id="adf-people-full-name-${user.replace(' ', '-')}"]`));
return $(`div[data-automation-id="adf-people-full-name-${user.replace(' ', '-')}"]`);
}
async removeInvolvedUser(user): Promise<void> {
const row = this.getRowsUser(user).element(by.xpath('ancestor::adf-datatable-row[contains(@class, "adf-datatable-row")]'));
await BrowserActions.click(row.element(by.css('button[data-automation-id="action_menu_0"]')));
await BrowserActions.click(row.$('button[data-automation-id="action_menu_0"]'));
await BrowserVisibility.waitUntilElementIsVisible(this.removeInvolvedPeople);
await BrowserActions.click(this.removeInvolvedPeople);
}
async getInvolvedUserEmail(user): Promise<string> {
return BrowserActions.getText(element(by.css(`div[data-automation-id="adf-people-email-${user.replace(' ', '-')}"]`)));
return BrowserActions.getText($(`div[data-automation-id="adf-people-email-${user.replace(' ', '-')}"]`));
}
async clickAuditLogButton(): Promise<void> {

View File

@@ -16,16 +16,16 @@
*/
import { BrowserActions } from '@alfresco/adf-testing';
import { element, by } from 'protractor';
import { $ } from 'protractor';
import { TaskFiltersPage } from './task-filters.page';
export class TaskFiltersDemoPage {
myTasks = element(by.css('button[data-automation-id="My Tasks_filter"]'));
queuedTask = element(by.css('button[data-automation-id="Queued Tasks_filter"]'));
completedTask = element(by.css('button[data-automation-id="Completed Tasks_filter"]'));
involvedTask = element(by.css('button[data-automation-id="Involved Tasks_filter"]'));
activeFilter = element(by.css('adf-task-filters .adf-active'));
myTasks = $('button[data-automation-id="My Tasks_filter"]');
queuedTask = $('button[data-automation-id="Queued Tasks_filter"]');
completedTask = $('button[data-automation-id="Completed Tasks_filter"]');
involvedTask = $('button[data-automation-id="Involved Tasks_filter"]');
activeFilter = $('adf-task-filters .adf-active');
myTasksFilter(): TaskFiltersPage {
return new TaskFiltersPage(this.myTasks);
@@ -44,7 +44,7 @@ export class TaskFiltersDemoPage {
}
customTaskFilter(filterName: string): TaskFiltersPage {
return new TaskFiltersPage(element(by.css(`button[data-automation-id="${filterName}_filter"]`)));
return new TaskFiltersPage($(`button[data-automation-id="${filterName}_filter"]`));
}
async checkActiveFilterActive(): Promise<string> {

View File

@@ -15,13 +15,13 @@
* limitations under the License.
*/
import { Locator, by, ElementFinder } from 'protractor';
import { ElementFinder } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class TaskFiltersPage {
filter;
taskIcon: Locator = by.css('adf-icon[data-automation-id="adf-filter-icon"]');
filter: ElementFinder;
taskIcon = 'adf-icon[data-automation-id="adf-filter-icon"]';
constructor(filter: ElementFinder) {
this.filter = filter;
@@ -33,13 +33,13 @@ export class TaskFiltersPage {
async getTaskFilterIcon(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const icon = this.filter.element(this.taskIcon);
const icon = this.filter.$(this.taskIcon);
return BrowserActions.getText(icon);
}
async checkTaskFilterHasNoIcon(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.taskIcon));
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.taskIcon));
}
async clickTaskFilter(): Promise<void> {

View File

@@ -16,26 +16,26 @@
*/
import { BrowserActions, BrowserVisibility, DropdownPage, PaginationPage } from '@alfresco/adf-testing';
import { by, element } from 'protractor';
import { $ } from 'protractor';
import { TasksListPage } from './tasks-list.page';
export class TaskListDemoPage {
taskListPage = new TasksListPage();
appId = element(by.css("input[data-automation-id='appId input']"));
itemsPerPage = element(by.css("input[data-automation-id='items per page']"));
itemsPerPageForm = element(by.css("mat-form-field[data-automation-id='items per page']"));
processDefinitionId = element(by.css("input[data-automation-id='process definition id']"));
processInstanceId = element(by.css("input[data-automation-id='process instance id']"));
page = element(by.css("input[data-automation-id='page']"));
pageForm = element(by.css("mat-form-field[data-automation-id='page']"));
taskName = element(by.css("input[data-automation-id='task name']"));
resetButton = element(by.css('.app-reset-button button'));
dueBefore = element(by.css("input[data-automation-id='due before']"));
dueAfter = element(by.css("input[data-automation-id='due after']"));
taskId = element(by.css("input[data-automation-id='task id']"));
appId = $("input[data-automation-id='appId input']");
itemsPerPage = $("input[data-automation-id='items per page']");
itemsPerPageForm = $("mat-form-field[data-automation-id='items per page']");
processDefinitionId = $("input[data-automation-id='process definition id']");
processInstanceId = $("input[data-automation-id='process instance id']");
page = $("input[data-automation-id='page']");
pageForm = $("mat-form-field[data-automation-id='page']");
taskName = $("input[data-automation-id='task name']");
resetButton = $('.app-reset-button button');
dueBefore = $("input[data-automation-id='due before']");
dueAfter = $("input[data-automation-id='due after']");
taskId = $("input[data-automation-id='task id']");
stateDropDownArrow = element(by.css("mat-form-field[data-automation-id='state']"));
stateDropDownArrow = $("mat-form-field[data-automation-id='state']");
stateDropdown = new DropdownPage(this.stateDropDownArrow);
taskList(): TasksListPage {
@@ -97,7 +97,7 @@ export class TaskListDemoPage {
async getItemsPerPageFieldErrorMessage(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.itemsPerPageForm);
const errorMessage = this.itemsPerPageForm.element(by.css('mat-error'));
const errorMessage = this.itemsPerPageForm.$('mat-error');
return BrowserActions.getText(errorMessage);
}
@@ -111,7 +111,7 @@ export class TaskListDemoPage {
async getPageFieldErrorMessage(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.pageForm);
const errorMessage = this.pageForm.element(by.css('mat-error'));
const errorMessage = this.pageForm.$('mat-error');
return BrowserActions.getText(errorMessage);
}

View File

@@ -16,12 +16,12 @@
*/
import { BrowserActions, BrowserVisibility, DataTableComponentPage } from '@alfresco/adf-testing';
import { browser, by, element } from 'protractor';
import { browser, $, $$ } from 'protractor';
export class TasksListPage {
taskList = element(by.css('adf-tasklist'));
noTasksFound = element.all(by.css('.adf-empty-content__title')).first();
taskList = $('adf-tasklist');
noTasksFound = $$('.adf-empty-content__title').first();
dataTable = new DataTableComponentPage(this.taskList);
getDataTable(): DataTableComponentPage {

View File

@@ -21,22 +21,20 @@ import { TaskDetailsPage } from './task-details.page';
import { FiltersPage } from './filters.page';
import { ChecklistDialog } from './dialog/create-checklist-dialog.page';
import { TasksListPage } from './tasks-list.page';
import { Locator, element, by } from 'protractor';
import { element, by, $ } from 'protractor';
import { BrowserVisibility, BrowserActions, FormFields } from '@alfresco/adf-testing';
export class TasksPage {
createButton = element(by.css('button[data-automation-id="create-button"'));
newTaskButton = element(by.css('button[data-automation-id="btn-start-task"]'));
addChecklistButton = element(by.css('button[class*="adf-add-to-checklist-button"]'));
createButton = $('button[data-automation-id="create-button"');
newTaskButton = $('button[data-automation-id="btn-start-task"]');
addChecklistButton = $('button[class*="adf-add-to-checklist-button"]');
rowByRowName = by.xpath('ancestor::mat-chip');
checklistContainer: Locator = by.css('div[class*="checklist-menu"]');
checklistContainer = $('div[class*="checklist-menu"]');
taskTitle = '.adf-activiti-task-details__header span';
rows: Locator = by.css('div[class*="adf-datatable-body"] adf-datatable-row[class*="adf-datatable-row"] div[class*="adf-datatable-cell"]');
completeButtonNoForm = element(by.id('adf-no-form-complete-button'));
checklistDialog = element(by.id('checklist-dialog'));
checklistNoMessage = element(by.id('checklist-none-message'));
numberOfChecklists = element(by.css('[data-automation-id="checklist-label"] mat-chip'));
sortByName: Locator = by.css('div[data-automation-id="auto_id_name"]');
completeButtonNoForm = $('#adf-no-form-complete-button');
checklistDialog = $('#checklist-dialog');
checklistNoMessage = $('#checklist-none-message');
numberOfChecklists = $('[data-automation-id="checklist-label"] mat-chip');
async createNewTask(): Promise<StartTaskDialogPage> {
await this.clickOnCreateButton();
@@ -89,7 +87,7 @@ export class TasksPage {
}
getRowsName(name: string) {
return element(this.checklistContainer).element(by.cssContainingText('span', name));
return this.checklistContainer.element(by.cssContainingText('span', name));
}
getChecklistByName(name: string) {
@@ -104,11 +102,11 @@ export class TasksPage {
}
async checkChecklistIsNotDisplayed(name: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(element(this.checklistContainer).element(by.cssContainingText('span', name)));
await BrowserVisibility.waitUntilElementIsNotVisible(this.checklistContainer.element(by.cssContainingText('span', name)));
}
async checkTaskTitle(taskName: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.css(this.taskTitle)));
await BrowserVisibility.waitUntilElementIsVisible($(this.taskTitle));
const title = element(by.cssContainingText(this.taskTitle, taskName));
await BrowserVisibility.waitUntilElementIsVisible(title);
}
@@ -140,13 +138,13 @@ export class TasksPage {
async removeChecklists(name: string): Promise<void> {
const elem = this.getRowsName(name);
const row = elem.element(this.rowByRowName);
await BrowserActions.click(row.element(by.css('mat-icon')));
await BrowserActions.click(row.$('mat-icon'));
}
async checkChecklistsRemoveButtonIsNotDisplayed(name: string): Promise<void> {
const elem = this.getRowsName(name);
const row = elem.element(this.rowByRowName);
await BrowserVisibility.waitUntilElementIsNotVisible(row.element(by.css('mat-icon')));
await BrowserVisibility.waitUntilElementIsNotVisible(row.$('mat-icon'));
}
async clickSortByNameAsc(): Promise<any> {