Disable control flow e2e ADF (#4954)

* update project script possible different JS-API

* first commit no controll flow

* second commit no controll flow

* third commit no controll flow

* 4 commit no controll flow

* 5 commit no controll flow

* 6 commit no controll flow

* 7 commit no controll flow

* 8 commit no controll flow

* 9 commit no controll flow

* 10 commit no controll flow

* 11 commit no controll flow

* 12 commit no controll flow

* 13 commit no controll flow

* 14 commit no controll flow

* 15 commit no controll flow

* 16 commit no controll flow

* 17 commit no controll flow

* 18 commit no controll flow

* 19 commit no controll flow

* 20 commit no controll flow

* remove wdpromise, protractor promise and deferred promises

* - fixed some incorrect “expect” calls
- fixed some matchers
- removed “return this;” when not needed
- added a few more await-s

* forgot a file

* fix some failing tests

* replaced driver calls with browser calls and enabled back waitForAngular

* fix rightClick methods and hopefully some tests

* fix settings-component

* some more fixes for core and content tests

* try to fix some more issues

* linting

* revert some changes, allowing download on headless chrome won’t work with multiple browser instances

* fixes for Search tests

* try to remove some wait calls

* fix build

* increase allScriptsTimeout and try another protractor and web driver version

* improve navigation methods

* some fixes for notification history and login sso

* forgot a space

* fix packages and enable some screenshots

* navigation bar fixes

* fix some test

* some fixes for notification history and navigation bar
use correct visibility method in attachFileWidget test

* fix searching and another fix for navigation

* try solve sso login

* some more fixes

* refactor async forEach into for..of

* try fix for search tests

* resolve rebabse problems

* remove install

* fix lint

* fix core e2e

* fix core e2e

* fix core e2e

* fix ps tests

* fix some tests

* fix core e2e

* fix core e2e

* fix core

* fix some issues PS

* fix core

* fix core

* fix some ps test

* fix rebase issues

* remove save

* fix url regressed after rebase

* fix url regressed after rebase

* fix ps and core

* fix lint

* more parallel e2e ps

* fix some ps cloud test

* some cloud fix

* fix lint

* fix some test

* remove files to be ignored

* out-tsc

* improve one cs test

* fix candidate base app

* fix ps test

* remove click function

* clean methods alrady present in browser action

* try ugly wait

* move wait

* remove duplicate call

* remove underscore

* fix after review

* fix imports

* minor cosmetic fixes

* fix comments test
This commit is contained in:
Eugenio Romano
2019-08-17 14:32:02 +02:00
committed by GitHub
parent 4f3cf669f2
commit 83412bb9b6
328 changed files with 17653 additions and 18793 deletions
+89 -108
View File
@@ -15,182 +15,163 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { by, element, ElementFinder } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
import { ElementFinder } from 'protractor/built/element';
export class CardViewComponentPage {
addButton = element(by.className('adf-card-view__key-value-pairs__add-btn'));
keyValueRow = 'card-view__key-value-pairs__row';
addButton: ElementFinder = element(by.className('adf-card-view__key-value-pairs__add-btn'));
selectValue = 'mat-option';
textField = element(by.css(`input[data-automation-id='card-textitem-editinput-name']`));
intField = element(by.css(`input[data-automation-id='card-textitem-editinput-int']`));
floatField = element(by.css(`input[data-automation-id='card-textitem-editinput-float']`));
valueInputField = element(by.xpath(`//*[contains(@id,'input') and @placeholder='Value']`));
nameInputField = element(by.xpath(`//*[contains(@id,'input') and @placeholder='Name']`));
consoleLog = element(by.className('adf-console'));
deleteButton = element.all(by.className('adf-card-view__key-value-pairs__remove-btn')).first();
select = element(by.css('mat-select[data-automation-class="select-box"]'));
checkbox = element(by.css(`mat-checkbox[data-automation-id='card-boolean-boolean']`));
resetButton = element(by.css(`#adf-reset-card-log`));
listContent = element(by.css('.mat-select-panel'));
editableSwitch = element(by.id('adf-toggle-editable'));
textField: ElementFinder = element(by.css(`input[data-automation-id='card-textitem-editinput-name']`));
intField: ElementFinder = element(by.css(`input[data-automation-id='card-textitem-editinput-int']`));
floatField: ElementFinder = element(by.css(`input[data-automation-id='card-textitem-editinput-float']`));
valueInputField: ElementFinder = element(by.xpath(`//*[contains(@id,'input') and @placeholder='Value']`));
nameInputField: ElementFinder = element(by.xpath(`//*[contains(@id,'input') and @placeholder='Name']`));
consoleLog: ElementFinder = element(by.className('adf-console'));
deleteButton: ElementFinder = element.all(by.className('adf-card-view__key-value-pairs__remove-btn')).first();
select: ElementFinder = element(by.css('mat-select[data-automation-class="select-box"]'));
checkbox: ElementFinder = element(by.css(`mat-checkbox[data-automation-id='card-boolean-boolean']`));
resetButton: ElementFinder = element(by.css(`#adf-reset-card-log`));
listContent: ElementFinder = element(by.css('.mat-select-panel'));
editableSwitch: ElementFinder = element(by.id('adf-toggle-editable'));
clickOnAddButton() {
BrowserActions.click(this.addButton);
return this;
async clickOnAddButton(): Promise<void> {
await BrowserActions.click(this.addButton);
}
clickOnResetButton() {
BrowserActions.click(this.resetButton);
return this;
async clickOnResetButton(): Promise<void> {
await BrowserActions.click(this.resetButton);
}
clickOnTextField() {
const toggleText = element(by.css(`div[data-automation-id='card-textitem-edit-toggle-name']`));
BrowserActions.click(toggleText);
BrowserVisibility.waitUntilElementIsVisible(this.textField);
return this;
async clickOnTextField(): Promise<void> {
const toggleText: ElementFinder = element(by.css(`div[data-automation-id='card-textitem-edit-toggle-name']`));
await BrowserActions.click(toggleText);
await BrowserVisibility.waitUntilElementIsVisible(this.textField);
}
clickOnTextClearIcon() {
const clearIcon = element(by.css(`mat-icon[data-automation-id="card-textitem-reset-name"]`));
BrowserActions.click(clearIcon);
async clickOnTextClearIcon(): Promise<void> {
const clearIcon: ElementFinder = element(by.css(`mat-icon[data-automation-id="card-textitem-reset-name"]`));
await BrowserActions.click(clearIcon);
}
clickOnTextSaveIcon() {
const saveIcon = element(by.css(`mat-icon[data-automation-id="card-textitem-update-name"]`));
BrowserActions.click(saveIcon);
async clickOnTextSaveIcon(): Promise<void> {
const saveIcon: ElementFinder = element(by.css(`mat-icon[data-automation-id="card-textitem-update-name"]`));
await BrowserActions.click(saveIcon);
}
getTextFieldText() {
const textField = element(by.css(`span[data-automation-id="card-textitem-value-name"]`));
getTextFieldText(): Promise<string> {
const textField: ElementFinder = element(by.css(`span[data-automation-id="card-textitem-value-name"]`));
return BrowserActions.getText(textField);
}
enterTextField(text) {
BrowserVisibility.waitUntilElementIsVisible(this.textField);
BrowserActions.clearSendKeys(this.textField, text);
return this;
async enterTextField(text: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.textField);
await BrowserActions.clearSendKeys(this.textField, text);
}
clickOnIntField() {
const toggleText = element(by.css('div[data-automation-id="card-textitem-edit-toggle-int"]'));
BrowserActions.click(toggleText);
BrowserVisibility.waitUntilElementIsVisible(this.intField);
return this;
async clickOnIntField(): Promise<void> {
const toggleText: ElementFinder = element(by.css('div[data-automation-id="card-textitem-edit-toggle-int"]'));
await BrowserActions.click(toggleText);
await BrowserVisibility.waitUntilElementIsVisible(this.intField);
}
clickOnIntClearIcon() {
const clearIcon = element(by.css('mat-icon[data-automation-id="card-textitem-reset-int"]'));
BrowserActions.click(clearIcon);
async clickOnIntClearIcon(): Promise<void> {
const clearIcon: ElementFinder = element(by.css('mat-icon[data-automation-id="card-textitem-reset-int"]'));
await BrowserActions.click(clearIcon);
}
clickOnIntSaveIcon() {
const saveIcon = element(by.css('mat-icon[data-automation-id="card-textitem-update-int"]'));
BrowserActions.click(saveIcon);
async clickOnIntSaveIcon(): Promise<void> {
const saveIcon: ElementFinder = element(by.css('mat-icon[data-automation-id="card-textitem-update-int"]'));
await BrowserActions.click(saveIcon);
}
enterIntField(text) {
BrowserVisibility.waitUntilElementIsVisible(this.intField);
BrowserActions.clearSendKeys(this.intField, text);
return this;
async enterIntField(text): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.intField);
await BrowserActions.clearSendKeys(this.intField, text);
}
getIntFieldText() {
const textField = element(by.css('span[data-automation-id="card-textitem-value-int"]'));
getIntFieldText(): Promise<string> {
const textField: ElementFinder = element(by.css('span[data-automation-id="card-textitem-value-int"]'));
return BrowserActions.getText(textField);
}
getErrorInt() {
const errorElement = element(by.css('mat-error[data-automation-id="card-textitem-error-int"]'));
getErrorInt(): Promise<string> {
const errorElement: ElementFinder = element(by.css('mat-error[data-automation-id="card-textitem-error-int"]'));
return BrowserActions.getText(errorElement);
}
clickOnFloatField() {
const toggleText = element(by.css('div[data-automation-id="card-textitem-edit-toggle-float"]'));
BrowserActions.click(toggleText);
BrowserVisibility.waitUntilElementIsVisible(this.floatField);
return this;
async clickOnFloatField(): Promise<void> {
const toggleText: ElementFinder = element(by.css('div[data-automation-id="card-textitem-edit-toggle-float"]'));
await BrowserActions.click(toggleText);
await BrowserVisibility.waitUntilElementIsVisible(this.floatField);
}
clickOnFloatClearIcon() {
const clearIcon = element(by.css(`mat-icon[data-automation-id="card-textitem-reset-float"]`));
BrowserActions.click(clearIcon);
async clickOnFloatClearIcon(): Promise<void> {
const clearIcon: ElementFinder = element(by.css(`mat-icon[data-automation-id="card-textitem-reset-float"]`));
await BrowserActions.click(clearIcon);
}
clickOnFloatSaveIcon() {
const saveIcon = element(by.css(`mat-icon[data-automation-id="card-textitem-update-float"]`));
BrowserActions.click(saveIcon);
async clickOnFloatSaveIcon(): Promise<void> {
const saveIcon: ElementFinder = element(by.css(`mat-icon[data-automation-id="card-textitem-update-float"]`));
await BrowserActions.click(saveIcon);
}
enterFloatField(text) {
BrowserVisibility.waitUntilElementIsVisible(this.floatField);
BrowserActions.clearSendKeys(this.floatField, text);
return this;
async enterFloatField(text): Promise<void> {
await BrowserActions.clearSendKeys(this.floatField, text);
}
getFloatFieldText() {
const textField = element(by.css('span[data-automation-id="card-textitem-value-float"]'));
getFloatFieldText(): Promise<string> {
const textField: ElementFinder = element(by.css('span[data-automation-id="card-textitem-value-float"]'));
return BrowserActions.getText(textField);
}
getErrorFloat() {
const errorElement = element(by.css('mat-error[data-automation-id="card-textitem-error-float"]'));
getErrorFloat(): Promise<string> {
const errorElement: ElementFinder = element(by.css('mat-error[data-automation-id="card-textitem-error-float"]'));
return BrowserActions.getText(errorElement);
}
setName(name) {
BrowserVisibility.waitUntilElementIsVisible(this.nameInputField);
this.nameInputField.sendKeys(name);
return this;
async setName(name: string): Promise<void> {
await BrowserActions.clearSendKeys(this.nameInputField, name);
}
setValue(value) {
BrowserVisibility.waitUntilElementIsVisible(this.valueInputField);
this.valueInputField.sendKeys(value);
return this;
async setValue(value): Promise<void> {
await BrowserActions.clearSendKeys(this.valueInputField, value);
}
waitForOutput() {
BrowserVisibility.waitUntilElementIsVisible(this.consoleLog);
return this;
async waitForOutput(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.consoleLog);
}
getOutputText(index) {
getOutputText(index: number): Promise<string> {
return BrowserActions.getText(this.consoleLog.all(by.css('p')).get(index));
}
deletePairsValues() {
BrowserActions.click(this.deleteButton);
return this;
async deletePairsValues(): Promise<void> {
await BrowserActions.click(this.deleteButton);
}
clickSelectBox() {
BrowserActions.click(this.select);
BrowserVisibility.waitUntilElementIsVisible(this.listContent);
async clickSelectBox(): Promise<void> {
await BrowserActions.click(this.select);
await BrowserVisibility.waitUntilElementIsVisible(this.listContent);
}
checkboxClick() {
BrowserActions.click(this.checkbox);
async checkboxClick(): Promise<void> {
await BrowserActions.click(this.checkbox);
}
selectValueFromComboBox(index) {
async selectValueFromComboBox(index): Promise<void> {
const value: ElementFinder = element.all(by.className(this.selectValue)).get(index);
BrowserActions.click(value);
return this;
await BrowserActions.click(value);
}
disableEdit() {
BrowserVisibility.waitUntilElementIsVisible(this.editableSwitch);
async disableEdit(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.editableSwitch);
this.editableSwitch.getAttribute('class').then((check) => {
if (check.indexOf('mat-checked') > -1) {
this.editableSwitch.click();
expect(this.editableSwitch.getAttribute('class')).not.toContain('mat-checked');
}
});
const check = await this.editableSwitch.getAttribute('class');
if (check.indexOf('mat-checked') > -1) {
await BrowserActions.click(this.editableSwitch);
await expect(await this.editableSwitch.getAttribute('class')).not.toContain('mat-checked');
}
}
}
+24 -26
View File
@@ -15,59 +15,57 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { element, by, ElementFinder, ElementArrayFinder } from 'protractor';
import { TabsPage } from '@alfresco/adf-testing';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class CommentsPage {
tabsPage = new TabsPage();
numberOfComments = element(by.id('comment-header'));
commentUserIcon = element.all(by.id('comment-user-icon'));
commentUserName = element.all(by.id('comment-user'));
commentMessage = element.all(by.id('comment-message'));
commentTime = element.all(by.id('comment-time'));
commentInput = element(by.id('comment-input'));
addCommentButton = element(by.css("[data-automation-id='comments-input-add']"));
tabsPage: TabsPage = new TabsPage();
numberOfComments: ElementFinder = element(by.id('comment-header'));
commentUserIcon: ElementArrayFinder = element.all(by.id('comment-user-icon'));
commentUserName: ElementArrayFinder = element.all(by.id('comment-user'));
commentMessage: ElementArrayFinder = element.all(by.id('comment-message'));
commentTime: ElementArrayFinder = element.all(by.id('comment-time'));
commentInput: ElementFinder = element(by.id('comment-input'));
addCommentButton: ElementFinder = element(by.css("[data-automation-id='comments-input-add']"));
getTotalNumberOfComments() {
async getTotalNumberOfComments(): Promise<string> {
return BrowserActions.getText(this.numberOfComments);
}
checkUserIconIsDisplayed(position) {
BrowserVisibility.waitUntilElementIsVisible(this.commentUserIcon.first());
return this.commentUserIcon.get(position);
async checkUserIconIsDisplayed(position): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.commentUserIcon.first());
}
getUserName(position) {
getUserName(position): Promise<string> {
return BrowserActions.getText(this.commentUserName.get(position));
}
getMessage(position) {
getMessage(position): Promise<string> {
return BrowserActions.getText(this.commentMessage.get(position));
}
getTime(position) {
getTime(position): Promise<string> {
return BrowserActions.getText(this.commentTime.get(position));
}
checkCommentInputIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotVisible(this.commentInput);
async checkCommentInputIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.commentInput);
}
addComment(comment) {
BrowserVisibility.waitUntilElementIsVisible(this.commentInput);
this.commentInput.sendKeys(comment);
BrowserActions.click(this.addCommentButton);
async addComment(comment): Promise<void> {
await BrowserActions.clearSendKeys(this.commentInput, comment);
await BrowserActions.click(this.addCommentButton);
}
checkCommentsTabIsSelected() {
this.tabsPage.checkTabIsSelectedByTitle('Comments');
async checkCommentsTabIsSelected(): Promise<void> {
await this.tabsPage.checkTabIsSelectedByTitle('Comments');
}
checkCommentInputIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.commentInput);
async checkCommentInputIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.commentInput);
}
}
+16 -19
View File
@@ -15,35 +15,32 @@
* limitations under the License.
*/
import { element, by, browser } from 'protractor';
import { element, by, browser, ElementFinder } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class ConfigEditorPage {
textField = element(by.css('#adf-form-config-editor div.overflow-guard > textarea'));
textField: ElementFinder = element(by.css('#adf-form-config-editor div.overflow-guard > textarea'));
enterConfiguration(text) {
BrowserVisibility.waitUntilElementIsVisible(this.textField);
this.textField.sendKeys(text);
return this;
async enterConfiguration(text): Promise<void> {
await BrowserActions.clearSendKeys(this.textField, text);
}
clickSaveButton() {
const saveButton = element(by.id('adf-form-config-save'));
BrowserActions.click(saveButton);
async clickSaveButton(): Promise<void> {
const saveButton: ElementFinder = element(by.id('adf-form-config-save'));
await BrowserActions.click(saveButton);
}
clickClearButton() {
BrowserVisibility.waitUntilElementIsVisible(this.textField);
const clearButton = element(by.id('adf-form-config-clear'));
BrowserActions.click(clearButton);
async clickClearButton(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.textField);
const clearButton: ElementFinder = element(by.id('adf-form-config-clear'));
await BrowserActions.click(clearButton);
}
enterBulkConfiguration(text) {
this.clickClearButton();
BrowserVisibility.waitUntilElementIsVisible(this.textField);
browser.executeScript('this.monaco.editor.getModels()[0].setValue(`' + JSON.stringify(text) + '`)');
this.clickSaveButton();
async enterBulkConfiguration(text): Promise<void> {
await this.clickClearButton();
await BrowserVisibility.waitUntilElementIsVisible(this.textField);
await browser.executeScript('this.monaco.editor.getModels()[0].setValue(`' + JSON.stringify(text) + '`)');
await this.clickSaveButton();
}
}
@@ -15,32 +15,32 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { element, by, ElementFinder } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class BreadCrumbDropdownPage {
breadCrumb = element(by.css(`adf-dropdown-breadcrumb[data-automation-id='content-node-selector-content-breadcrumb']`));
breadCrumb: ElementFinder = element(by.css(`adf-dropdown-breadcrumb[data-automation-id='content-node-selector-content-breadcrumb']`));
parentFolder = this.breadCrumb.element(by.css(`button[data-automation-id='dropdown-breadcrumb-trigger']`));
breadCrumbDropdown = element(by.css(`div[class*='mat-select-panel']`));
breadCrumbDropdown: ElementFinder = element(by.css(`div[class*='mat-select-panel']`));
currentFolder = this.breadCrumb.element(by.css(`div span[data-automation-id="current-folder"]`));
choosePath(pathName) {
async choosePath(pathName): Promise<void> {
const path = this.breadCrumbDropdown.element(by.cssContainingText(`mat-option[data-automation-class='dropdown-breadcrumb-path-option'] span[class='mat-option-text']`,
pathName));
BrowserActions.click(path);
await BrowserActions.click(path);
}
clickParentFolder() {
BrowserActions.click(this.parentFolder);
async clickParentFolder(): Promise<void> {
await BrowserActions.click(this.parentFolder);
}
checkBreadCrumbDropdownIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.breadCrumbDropdown);
async checkBreadCrumbDropdownIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.breadCrumbDropdown);
}
getTextOfCurrentFolder() {
async getTextOfCurrentFolder(): Promise<string> {
return BrowserActions.getText(this.currentFolder);
}
}
@@ -15,16 +15,16 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { element, by, ElementFinder } from 'protractor';
import { BrowserActions } from '@alfresco/adf-testing';
export class BreadCrumbPage {
breadCrumb = element(by.css(`adf-breadcrumb nav[data-automation-id='breadcrumb']`));
breadCrumb: ElementFinder = element(by.css(`adf-breadcrumb nav[data-automation-id='breadcrumb']`));
chooseBreadCrumb(breadCrumbItem) {
async chooseBreadCrumb(breadCrumbItem): Promise<void> {
const path = this.breadCrumb.element(by.css(`a[data-automation-id='breadcrumb_${breadCrumbItem}']`));
BrowserActions.click(path);
await BrowserActions.click(path);
}
}
+40 -44
View File
@@ -15,76 +15,72 @@
* limitations under the License.
*/
import { element, by, protractor } from 'protractor';
import { element, by, ElementFinder, ElementArrayFinder, protractor } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class TreeViewPage {
treeViewTitle = element(by.cssContainingText('app-tree-view div', 'TREE VIEW TEST'));
nodeIdInput = element(by.css('input[placeholder="Node Id"]'));
noNodeMessage = element(by.id('adf-tree-view-missing-node'));
nodesOnPage = element.all(by.css('mat-tree-node'));
treeViewTitle: ElementFinder = element(by.cssContainingText('app-tree-view div', 'TREE VIEW TEST'));
nodeIdInput: ElementFinder = element(by.css('input[placeholder="Node Id"]'));
noNodeMessage: ElementFinder = element(by.id('adf-tree-view-missing-node'));
nodesOnPage: ElementArrayFinder = element.all(by.css('mat-tree-node'));
checkTreeViewTitleIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.treeViewTitle);
async checkTreeViewTitleIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.treeViewTitle);
}
getNodeId() {
BrowserVisibility.waitUntilElementIsVisible(this.nodeIdInput);
return this.nodeIdInput.getAttribute('value');
async getNodeId(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.nodeIdInput);
return await this.nodeIdInput.getAttribute('value');
}
clickNode(nodeName) {
const node = element(by.css('mat-tree-node[id="' + nodeName + '-tree-child-node"] button'));
return BrowserActions.click(node);
async clickNode(nodeName): Promise<void> {
const node: ElementFinder = element(by.css('mat-tree-node[id="' + nodeName + '-tree-child-node"] button'));
await BrowserActions.click(node);
}
checkNodeIsDisplayedAsClosed(nodeName) {
const node = element(by.css('mat-tree-node[id="' + nodeName + '-tree-child-node"][aria-expanded="false"]'));
return BrowserVisibility.waitUntilElementIsVisible(node);
async checkNodeIsDisplayedAsClosed(nodeName): Promise<void> {
const node: ElementFinder = element(by.css('mat-tree-node[id="' + nodeName + '-tree-child-node"][aria-expanded="false"]'));
await BrowserVisibility.waitUntilElementIsVisible(node);
}
checkNodeIsDisplayedAsOpen(nodeName) {
const node = element(by.css('mat-tree-node[id="' + nodeName + '-tree-child-node"][aria-expanded="true"]'));
return BrowserVisibility.waitUntilElementIsVisible(node);
async checkNodeIsDisplayedAsOpen(nodeName): Promise<void> {
const node: ElementFinder = element(by.css('mat-tree-node[id="' + nodeName + '-tree-child-node"][aria-expanded="true"]'));
await BrowserVisibility.waitUntilElementIsVisible(node);
}
checkClickedNodeName(nodeName) {
const clickedNode = element(by.cssContainingText('span', ' CLICKED NODE: ' + nodeName + ''));
return BrowserVisibility.waitUntilElementIsVisible(clickedNode);
async checkClickedNodeName(nodeName): Promise<void> {
const clickedNode: ElementFinder = element(by.cssContainingText('span', ' CLICKED NODE: ' + nodeName + ''));
await BrowserVisibility.waitUntilElementIsVisible(clickedNode);
}
checkNodeIsNotDisplayed(nodeName) {
const node = element(by.id('' + nodeName + '-tree-child-node'));
return BrowserVisibility.waitUntilElementIsNotVisible(node);
async checkNodeIsNotDisplayed(nodeName): Promise<void> {
const node: ElementFinder = element(by.id('' + nodeName + '-tree-child-node'));
await BrowserVisibility.waitUntilElementIsNotVisible(node);
}
clearNodeIdInput() {
BrowserVisibility.waitUntilElementIsVisible(this.nodeIdInput);
this.nodeIdInput.getAttribute('value').then((value) => {
for (let i = value.length; i >= 0; i--) {
this.nodeIdInput.sendKeys(protractor.Key.BACK_SPACE);
}
});
async clearNodeIdInput(): Promise<void> {
await BrowserActions.click(this.nodeIdInput);
await BrowserActions.clearWithBackSpace(this.nodeIdInput);
}
checkNoNodeIdMessageIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.noNodeMessage);
async checkNoNodeIdMessageIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.noNodeMessage);
}
addNodeId(nodeId) {
BrowserActions.click(this.nodeIdInput);
this.nodeIdInput.clear();
this.nodeIdInput.sendKeys(nodeId + ' ');
this.nodeIdInput.sendKeys(protractor.Key.BACK_SPACE);
async addNodeId(nodeId): Promise<void> {
await BrowserActions.click(this.nodeIdInput);
await BrowserActions.clearSendKeys(this.nodeIdInput, nodeId);
await this.nodeIdInput.sendKeys('a');
await this.nodeIdInput.sendKeys(protractor.Key.BACK_SPACE);
}
checkErrorMessageIsDisplayed() {
const clickedNode = element(by.cssContainingText('span', 'An Error Occurred '));
return BrowserVisibility.waitUntilElementIsVisible(clickedNode);
async checkErrorMessageIsDisplayed(): Promise<void> {
const clickedNode: ElementFinder = element(by.cssContainingText('span', 'An Error Occurred '));
await BrowserVisibility.waitUntilElementIsVisible(clickedNode);
}
getTotalNodes() {
return this.nodesOnPage.count();
async getTotalNodes() {
return await this.nodesOnPage.count();
}
}
+316 -390
View File
@@ -19,7 +19,7 @@ import { FolderDialog } from './dialog/folderDialog';
import { CreateLibraryDialog } from './dialog/createLibraryDialog';
import { FormControllersPage } from '@alfresco/adf-testing';
import { DropActions } from '../../actions/drop.actions';
import { by, element, protractor, $$, browser } from 'protractor';
import { by, element, protractor, $$, browser, ElementFinder } from 'protractor';
import path = require('path');
import { BrowserVisibility, DocumentListPage, BrowserActions, DateUtil } from '@alfresco/adf-testing';
@@ -35,166 +35,158 @@ export class ContentServicesPage {
created: 'Created'
};
contentList = new DocumentListPage(element.all(by.css('adf-upload-drag-area adf-document-list')).first());
formControllersPage = new FormControllersPage();
multipleFileUploadToggle = element(by.id('adf-document-list-enable-drop-files'));
createFolderDialog = new FolderDialog();
createLibraryDialog = new CreateLibraryDialog();
dragAndDropAction = new DropActions();
uploadBorder = element(by.id('document-list-container'));
contentServices = element(by.css('.adf-sidenav-link[data-automation-id="Content Services"]'));
currentFolder = element(by.css('div[class*="adf-breadcrumb-item adf-active"] div'));
createFolderButton = element(by.css('button[data-automation-id="create-new-folder"]'));
editFolderButton = element(by.css('button[data-automation-id="edit-folder"]'));
createLibraryButton = element(by.css('button[data-automation-id="create-new-library"]'));
activeBreadcrumb = element(by.css('div[class*="active"]'));
contentList: DocumentListPage = new DocumentListPage(element.all(by.css('adf-upload-drag-area adf-document-list')).first());
formControllersPage: FormControllersPage = new FormControllersPage();
createFolderDialog: FolderDialog = new FolderDialog();
createLibraryDialog: CreateLibraryDialog = new CreateLibraryDialog();
dragAndDropAction: DropActions = new DropActions();
multipleFileUploadToggle: ElementFinder = element(by.id('adf-document-list-enable-drop-files'));
uploadBorder: ElementFinder = element(by.id('document-list-container'));
contentServices: ElementFinder = element(by.css('.adf-sidenav-link[data-automation-id="Content Services"]'));
currentFolder: ElementFinder = element(by.css('div[class*="adf-breadcrumb-item adf-active"] div'));
createFolderButton: ElementFinder = element(by.css('button[data-automation-id="create-new-folder"]'));
editFolderButton: ElementFinder = element(by.css('button[data-automation-id="edit-folder"]'));
createLibraryButton: ElementFinder = element(by.css('button[data-automation-id="create-new-library"]'));
activeBreadcrumb: ElementFinder = element(by.css('div[class*="active"]'));
tooltip = by.css('div[class*="--text adf-full-width"] span');
uploadFileButton = element(by.css('.adf-upload-button-file-container button'));
uploadFileButtonInput = element(by.css('input[data-automation-id="upload-single-file"]'));
uploadMultipleFileButton = element(by.css('input[data-automation-id="upload-multiple-files"]'));
uploadFolderButton = element(by.css('input[data-automation-id="uploadFolder"]'));
errorSnackBar = element(by.css('simple-snack-bar[class*="mat-simple-snackbar"]'));
emptyPagination = element(by.css('adf-pagination[class*="adf-pagination__empty"]'));
dragAndDrop = element.all(by.css('adf-upload-drag-area div')).first();
nameHeader = element(by.css('div[data-automation-id="auto_id_name"] > span'));
sizeHeader = element(by.css('div[data-automation-id="auto_id_content.sizeInBytes"] > span'));
createdByHeader = element(by.css('div[data-automation-id="auto_id_createdByUser.displayName"] > span'));
createdHeader = element(by.css('div[data-automation-id="auto_id_createdAt"] > span'));
recentFiles = element(by.css('.adf-container-recent'));
recentFilesExpanded = element(by.css('.adf-container-recent mat-expansion-panel-header.mat-expanded'));
recentFilesClosed = element(by.css('.adf-container-recent mat-expansion-panel-header'));
recentFileIcon = element(by.css('.adf-container-recent mat-expansion-panel-header mat-icon'));
documentListSpinner = element(by.css('mat-progress-spinner'));
emptyFolder = element(by.css('.adf-empty-folder-this-space-is-empty'));
emptyFolderImage = element(by.css('.adf-empty-folder-image'));
emptyRecent = element(by.css('.adf-container-recent .adf-empty-list__title'));
gridViewButton = element(by.css('button[data-automation-id="document-list-grid-view"]'));
cardViewContainer = element(by.css('div.adf-document-list-container div.adf-datatable-card'));
shareNodeButton = element(by.cssContainingText('mat-icon', ' share '));
uploadFileButton: ElementFinder = element(by.css('.adf-upload-button-file-container button'));
uploadFileButtonInput: ElementFinder = element(by.css('input[data-automation-id="upload-single-file"]'));
uploadMultipleFileButton: ElementFinder = element(by.css('input[data-automation-id="upload-multiple-files"]'));
uploadFolderButton: ElementFinder = element(by.css('input[data-automation-id="uploadFolder"]'));
errorSnackBar: ElementFinder = element(by.css('simple-snack-bar[class*="mat-simple-snackbar"]'));
emptyPagination: ElementFinder = element(by.css('adf-pagination[class*="adf-pagination__empty"]'));
dragAndDrop: ElementFinder = element.all(by.css('adf-upload-drag-area div')).first();
nameHeader: ElementFinder = element(by.css('div[data-automation-id="auto_id_name"] > span'));
sizeHeader: ElementFinder = element(by.css('div[data-automation-id="auto_id_content.sizeInBytes"] > span'));
createdByHeader: ElementFinder = element(by.css('div[data-automation-id="auto_id_createdByUser.displayName"] > span'));
createdHeader: ElementFinder = element(by.css('div[data-automation-id="auto_id_createdAt"] > span'));
recentFiles: ElementFinder = element(by.css('.adf-container-recent'));
recentFilesExpanded: ElementFinder = element(by.css('.adf-container-recent mat-expansion-panel-header.mat-expanded'));
recentFilesClosed: ElementFinder = element(by.css('.adf-container-recent mat-expansion-panel-header'));
recentFileIcon: ElementFinder = element(by.css('.adf-container-recent mat-expansion-panel-header mat-icon'));
emptyFolder: ElementFinder = element(by.css('.adf-empty-folder-this-space-is-empty'));
emptyFolderImage: ElementFinder = element(by.css('.adf-empty-folder-image'));
emptyRecent: ElementFinder = element(by.css('.adf-container-recent .adf-empty-list__title'));
gridViewButton: ElementFinder = element(by.css('button[data-automation-id="document-list-grid-view"]'));
cardViewContainer: ElementFinder = element(by.css('div.adf-document-list-container div.adf-datatable-card'));
shareNodeButton: ElementFinder = element(by.cssContainingText('mat-icon', ' share '));
nameColumnHeader = 'name';
createdByColumnHeader = 'createdByUser.displayName';
createdColumnHeader = 'createdAt';
deleteContentElement = element(by.css('button[data-automation-id*="DELETE"]'));
metadataAction = element(by.css('button[data-automation-id*="METADATA"]'));
versionManagerAction = element(by.css('button[data-automation-id*="VERSIONS"]'));
moveContentElement = element(by.css('button[data-automation-id*="MOVE"]'));
copyContentElement = element(by.css('button[data-automation-id*="COPY"]'));
lockContentElement = element(by.css('button[data-automation-id="DOCUMENT_LIST.ACTIONS.LOCK"]'));
downloadContent = element(by.css('button[data-automation-id*="DOWNLOAD"]'));
siteListDropdown = element(by.css(`mat-select[data-automation-id='site-my-files-option']`));
downloadButton = element(by.css('button[title="Download"]'));
favoriteButton = element(by.css('button[data-automation-id="favorite"]'));
markedFavorite = element(by.cssContainingText( 'button[data-automation-id="favorite"] mat-icon', 'star'));
notMarkedFavorite = element(by.cssContainingText( 'button[data-automation-id="favorite"] mat-icon', 'star_border'));
multiSelectToggle = element(by.cssContainingText('span.mat-slide-toggle-content', ' Multiselect (with checkboxes) '));
deleteContentElement: ElementFinder = element(by.css('button[data-automation-id*="DELETE"]'));
metadataAction: ElementFinder = element(by.css('button[data-automation-id*="METADATA"]'));
versionManagerAction: ElementFinder = element(by.css('button[data-automation-id*="VERSIONS"]'));
moveContentElement: ElementFinder = element(by.css('button[data-automation-id*="MOVE"]'));
copyContentElement: ElementFinder = element(by.css('button[data-automation-id*="COPY"]'));
lockContentElement: ElementFinder = element(by.css('button[data-automation-id="DOCUMENT_LIST.ACTIONS.LOCK"]'));
downloadContent: ElementFinder = element(by.css('button[data-automation-id*="DOWNLOAD"]'));
siteListDropdown: ElementFinder = element(by.css(`mat-select[data-automation-id='site-my-files-option']`));
downloadButton: ElementFinder = element(by.css('button[title="Download"]'));
favoriteButton: ElementFinder = element(by.css('button[data-automation-id="favorite"]'));
markedFavorite: ElementFinder = element(by.cssContainingText('button[data-automation-id="favorite"] mat-icon', 'star'));
notMarkedFavorite: ElementFinder = element(by.cssContainingText('button[data-automation-id="favorite"] mat-icon', 'star_border'));
multiSelectToggle: ElementFinder = element(by.cssContainingText('span.mat-slide-toggle-content', ' Multiselect (with checkboxes) '));
pressContextMenuActionNamed(actionName) {
BrowserActions.clickExecuteScript(`button[data-automation-id="context-${actionName}"]`);
async pressContextMenuActionNamed(actionName): Promise<void> {
await BrowserActions.clickExecuteScript(`button[data-automation-id="context-${actionName}"]`);
}
checkContextActionIsVisible(actionName) {
const actionButton = element(by.css(`button[data-automation-id="context-${actionName}"`));
BrowserVisibility.waitUntilElementIsVisible(actionButton);
return actionButton;
async checkContextActionIsVisible(actionName) {
const actionButton: ElementFinder = element(by.css(`button[data-automation-id="context-${actionName}"`));
await BrowserVisibility.waitUntilElementIsVisible(actionButton);
}
checkContentActionIsEnabled(actionName) {
const actionButton = element(by.css(`button[data-automation-id="context-${actionName}"`));
BrowserVisibility.waitUntilElementIsVisible(actionButton);
async isContextActionEnabled(actionName): Promise<boolean> {
const actionButton: ElementFinder = element(by.css(`button[data-automation-id="context-${actionName}"`));
await BrowserVisibility.waitUntilElementIsVisible(actionButton);
return actionButton.isEnabled();
}
getDocumentList() {
getDocumentList(): DocumentListPage {
return this.contentList;
}
closeActionContext() {
BrowserActions.closeMenuAndDialogs();
return this;
async closeActionContext(): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
}
checkLockedIcon(content) {
return this.contentList.checkLockedIcon(content);
async checkLockedIcon(content): Promise<void> {
return await this.contentList.checkLockedIcon(content);
}
checkUnlockedIcon(content) {
return this.contentList.checkUnlockedIcon(content);
async checkUnlockedIcon(content): Promise<void> {
return await this.contentList.checkUnlockedIcon(content);
}
checkDeleteIsDisabled(content) {
this.contentList.clickOnActionMenu(content);
this.waitForContentOptions();
const disabledDelete = element(by.css(`button[data-automation-id*='DELETE'][disabled='true']`));
BrowserVisibility.waitUntilElementIsVisible(disabledDelete);
async checkDeleteIsDisabled(content): Promise<void> {
await this.contentList.clickOnActionMenu(content);
await this.waitForContentOptions();
const disabledDelete: ElementFinder = element(by.css(`button[data-automation-id*='DELETE'][disabled='true']`));
await BrowserVisibility.waitUntilElementIsVisible(disabledDelete);
}
deleteContent(content) {
this.contentList.clickOnActionMenu(content);
this.waitForContentOptions();
BrowserActions.click(this.deleteContentElement);
async deleteContent(content): Promise<void> {
await this.contentList.clickOnActionMenu(content);
await this.waitForContentOptions();
await BrowserActions.click(this.deleteContentElement);
}
metadataContent(content) {
this.contentList.clickOnActionMenu(content);
this.waitForContentOptions();
BrowserActions.click(this.metadataAction);
async metadataContent(content): Promise<void> {
await this.contentList.clickOnActionMenu(content);
await this.waitForContentOptions();
await BrowserActions.click(this.metadataAction);
}
versionManagerContent(content) {
this.contentList.clickOnActionMenu(content);
this.waitForContentOptions();
BrowserActions.click(this.versionManagerAction);
async versionManagerContent(content): Promise<void> {
await this.contentList.clickOnActionMenu(content);
await this.waitForContentOptions();
await BrowserActions.click(this.versionManagerAction);
}
copyContent(content) {
this.contentList.clickOnActionMenu(content);
BrowserActions.click(this.copyContentElement);
async copyContent(content): Promise<void> {
await this.contentList.clickOnActionMenu(content);
await BrowserActions.click(this.copyContentElement);
}
lockContent(content) {
this.contentList.clickOnActionMenu(content);
BrowserActions.click(this.lockContentElement);
async lockContent(content): Promise<void> {
await this.contentList.clickOnActionMenu(content);
await BrowserActions.click(this.lockContentElement);
}
waitForContentOptions() {
BrowserVisibility.waitUntilElementIsVisible(this.copyContentElement);
BrowserVisibility.waitUntilElementIsVisible(this.moveContentElement);
BrowserVisibility.waitUntilElementIsVisible(this.deleteContentElement);
BrowserVisibility.waitUntilElementIsVisible(this.downloadContent);
async waitForContentOptions(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.copyContentElement);
await BrowserVisibility.waitUntilElementIsVisible(this.moveContentElement);
await BrowserVisibility.waitUntilElementIsVisible(this.deleteContentElement);
await BrowserVisibility.waitUntilElementIsVisible(this.downloadContent);
}
clickFileHyperlink(fileName) {
async clickFileHyperlink(fileName): Promise<void> {
const hyperlink = this.contentList.dataTablePage().getFileHyperlink(fileName);
BrowserActions.click(hyperlink);
return this;
await BrowserActions.click(hyperlink);
}
checkFileHyperlinkIsEnabled(fileName) {
async checkFileHyperlinkIsEnabled(fileName): Promise<void> {
const hyperlink = this.contentList.dataTablePage().getFileHyperlink(fileName);
BrowserVisibility.waitUntilElementIsVisible(hyperlink);
return this;
await BrowserVisibility.waitUntilElementIsVisible(hyperlink);
}
clickHyperlinkNavigationToggle() {
const hyperlinkToggle = element(by.cssContainingText('.mat-slide-toggle-content', 'Hyperlink navigation'));
BrowserActions.click(hyperlinkToggle);
return this;
async clickHyperlinkNavigationToggle(): Promise<void> {
const hyperlinkToggle: ElementFinder = element(by.cssContainingText('.mat-slide-toggle-content', 'Hyperlink navigation'));
await BrowserActions.click(hyperlinkToggle);
}
enableDropFilesInAFolder() {
this.formControllersPage.enableToggle(this.multipleFileUploadToggle);
return this;
async enableDropFilesInAFolder(): Promise<void> {
await this.formControllersPage.enableToggle(this.multipleFileUploadToggle);
}
disableDropFilesInAFolder() {
browser.executeScript('arguments[0].scrollIntoView()', this.multipleFileUploadToggle);
this.formControllersPage.disableToggle(this.multipleFileUploadToggle);
return this;
async disableDropFilesInAFolder(): Promise<void> {
await browser.executeScript('arguments[0].scrollIntoView()', this.multipleFileUploadToggle);
await this.formControllersPage.disableToggle(this.multipleFileUploadToggle);
}
getElementsDisplayedId() {
return this.contentList.dataTablePage().getAllRowsColumnValues(this.columns.nodeId);
async getElementsDisplayedId() {
return await this.contentList.dataTablePage().getAllRowsColumnValues(this.columns.nodeId);
}
checkElementsDateSortedAsc(elements) {
@@ -229,459 +221,393 @@ export class ContentServicesPage {
return sorted;
}
getContentList() {
return this.contentList;
async checkRecentFileToBeShowed() {
await BrowserVisibility.waitUntilElementIsVisible(this.recentFiles);
}
checkRecentFileToBeShowed() {
BrowserVisibility.waitUntilElementIsVisible(this.recentFiles);
async expandRecentFiles(): Promise<void> {
await this.checkRecentFileToBeShowed();
await this.checkRecentFileToBeClosed();
await BrowserActions.click(this.recentFilesClosed);
await this.checkRecentFileToBeOpened();
}
expandRecentFiles() {
this.checkRecentFileToBeShowed();
this.checkRecentFileToBeClosed();
BrowserActions.click(this.recentFilesClosed);
this.checkRecentFileToBeOpened();
async closeRecentFiles(): Promise<void> {
await this.checkRecentFileToBeShowed();
await this.checkRecentFileToBeOpened();
await BrowserActions.click(this.recentFilesExpanded);
await this.checkRecentFileToBeClosed();
}
closeRecentFiles() {
this.checkRecentFileToBeShowed();
this.checkRecentFileToBeOpened();
BrowserActions.click(this.recentFilesExpanded);
this.checkRecentFileToBeClosed();
async checkRecentFileToBeClosed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.recentFilesClosed);
}
checkRecentFileToBeClosed() {
BrowserVisibility.waitUntilElementIsVisible(this.recentFilesClosed);
async checkRecentFileToBeOpened(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.recentFilesExpanded);
}
checkRecentFileToBeOpened() {
BrowserVisibility.waitUntilElementIsVisible(this.recentFilesExpanded);
async getRecentFileIcon(): Promise<string> {
return await BrowserActions.getText(this.recentFileIcon);
}
async getRecentFileIcon() {
return BrowserActions.getText(this.recentFileIcon);
async checkAcsContainer(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.uploadBorder);
}
checkAcsContainer() {
return BrowserVisibility.waitUntilElementIsVisible(this.uploadBorder);
}
async waitForTableBody() {
async waitForTableBody(): Promise<void> {
await this.contentList.waitForTableBody();
}
goToDocumentList() {
async goToDocumentList(): Promise<void> {
const navigationBarPage = new NavigationBarPage();
navigationBarPage.clickContentServicesButton();
return this;
await navigationBarPage.clickContentServicesButton();
}
clickOnContentServices() {
BrowserActions.click(this.contentServices);
async clickOnContentServices(): Promise<void> {
await BrowserActions.click(this.contentServices);
}
numberOfResultsDisplayed() {
return this.contentList.dataTablePage().numberOfRows();
async numberOfResultsDisplayed(): Promise<number> {
return await this.contentList.dataTablePage().numberOfRows();
}
currentFolderName() {
const deferred = protractor.promise.defer();
BrowserVisibility.waitUntilElementIsVisible(this.currentFolder);
this.currentFolder.getText().then(function (result) {
deferred.fulfill(result);
});
return deferred.promise;
async currentFolderName(): Promise<string> {
return await BrowserActions.getText(this.currentFolder);
}
getAllRowsNameColumn() {
return this.contentList.getAllRowsColumnValues(this.columns.name);
async getAllRowsNameColumn(): Promise<any> {
return await this.contentList.getAllRowsColumnValues(this.columns.name);
}
sortByName(sortOrder: string) {
return this.contentList.dataTable.sortByColumn(sortOrder, this.nameColumnHeader);
async sortByName(sortOrder: string): Promise<any> {
await this.contentList.dataTable.sortByColumn(sortOrder, this.nameColumnHeader);
}
sortByAuthor(sortOrder: string) {
return this.contentList.dataTable.sortByColumn(sortOrder, this.createdByColumnHeader);
async sortByAuthor(sortOrder: string): Promise<any> {
await this.contentList.dataTable.sortByColumn(sortOrder, this.createdByColumnHeader);
}
sortByCreated(sortOrder: string) {
return this.contentList.dataTable.sortByColumn(sortOrder, this.createdColumnHeader);
async sortByCreated(sortOrder: string): Promise<any> {
await this.contentList.dataTable.sortByColumn(sortOrder, this.createdColumnHeader);
}
sortAndCheckListIsOrderedByName(sortOrder: string) {
this.sortByName(sortOrder);
const deferred = protractor.promise.defer();
this.checkListIsSortedByNameColumn(sortOrder).then((result) => {
deferred.fulfill(result);
});
return deferred.promise;
async sortAndCheckListIsOrderedByName(sortOrder: string): Promise<any> {
await this.sortByName(sortOrder);
return await this.checkListIsSortedByNameColumn(sortOrder);
}
async checkListIsSortedByNameColumn(sortOrder: string) {
async checkListIsSortedByNameColumn(sortOrder: string): Promise<any> {
return await this.contentList.dataTablePage().checkListIsSorted(sortOrder, this.columns.name);
}
async checkListIsSortedByCreatedColumn(sortOrder: string) {
async checkListIsSortedByCreatedColumn(sortOrder: string): Promise<any> {
return await this.contentList.dataTablePage().checkListIsSorted(sortOrder, this.columns.created);
}
async checkListIsSortedByAuthorColumn(sortOrder: string) {
async checkListIsSortedByAuthorColumn(sortOrder: string): Promise<any> {
return await this.contentList.dataTablePage().checkListIsSorted(sortOrder, this.columns.createdBy);
}
async checkListIsSortedBySizeColumn(sortOrder: string) {
async checkListIsSortedBySizeColumn(sortOrder: string): Promise<any> {
return await this.contentList.dataTablePage().checkListIsSorted(sortOrder, this.columns.size);
}
sortAndCheckListIsOrderedByAuthor(sortOrder: string) {
this.sortByAuthor(sortOrder);
const deferred = protractor.promise.defer();
this.checkListIsSortedByAuthorColumn(sortOrder).then((result) => {
deferred.fulfill(result);
});
return deferred.promise;
async sortAndCheckListIsOrderedByAuthor(sortOrder: string): Promise<any> {
await this.sortByAuthor(sortOrder);
return await this.checkListIsSortedByAuthorColumn(sortOrder);
}
sortAndCheckListIsOrderedByCreated(sortOrder: string) {
this.sortByCreated(sortOrder);
const deferred = protractor.promise.defer();
this.checkListIsSortedByCreatedColumn(sortOrder).then((result) => {
deferred.fulfill(result);
});
return deferred.promise;
async sortAndCheckListIsOrderedByCreated(sortOrder: string): Promise<any> {
await this.sortByCreated(sortOrder);
return await this.checkListIsSortedByCreatedColumn(sortOrder);
}
doubleClickRow(nodeName) {
this.contentList.doubleClickRow(nodeName);
return this;
async doubleClickRow(nodeName): Promise<void> {
await this.contentList.doubleClickRow(nodeName);
}
clickOnCreateNewFolder() {
BrowserActions.click(this.createFolderButton);
return this;
async clickOnCreateNewFolder(): Promise<void> {
await BrowserActions.click(this.createFolderButton);
}
clickOnFavoriteButton() {
BrowserActions.click(this.favoriteButton);
return this;
async clickOnFavoriteButton(): Promise<void> {
await BrowserActions.click(this.favoriteButton);
}
checkIsMarkedFavorite() {
BrowserVisibility.waitUntilElementIsVisible(this.markedFavorite);
return this;
async checkIsMarkedFavorite(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.markedFavorite);
}
checkIsNotMarkedFavorite() {
BrowserVisibility.waitUntilElementIsVisible(this.notMarkedFavorite);
return this;
async checkIsNotMarkedFavorite(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.notMarkedFavorite);
}
clickOnEditFolder() {
BrowserActions.click(this.editFolderButton);
return this;
async clickOnEditFolder(): Promise<void> {
await BrowserActions.click(this.editFolderButton);
}
checkEditFolderButtonIsEnabled() {
async isEditFolderButtonEnabled(): Promise<boolean> {
return this.editFolderButton.isEnabled();
}
openCreateLibraryDialog() {
BrowserActions.click(this.createLibraryButton);
this.createLibraryDialog.waitForDialogToOpen();
return this.createLibraryDialog;
async openCreateLibraryDialog(): Promise<void> {
await BrowserActions.click(this.createLibraryButton);
await this.createLibraryDialog.waitForDialogToOpen();
}
createNewFolder(folder) {
this.clickOnCreateNewFolder();
this.createFolderDialog.addFolderName(folder);
browser.sleep(200);
this.createFolderDialog.clickOnCreateUpdateButton();
return this;
async createNewFolder(folder): Promise<void> {
await this.clickOnCreateNewFolder();
await this.createFolderDialog.addFolderName(folder);
await this.createFolderDialog.clickOnCreateUpdateButton();
}
checkContentIsDisplayed(content) {
this.contentList.dataTablePage().checkContentIsDisplayed(this.columns.name, content);
return this;
async checkContentIsDisplayed(content): Promise<void> {
await this.contentList.dataTablePage().checkContentIsDisplayed(this.columns.name, content);
}
checkContentsAreDisplayed(content) {
async checkContentsAreDisplayed(content): Promise<void> {
for (let i = 0; i < content.length; i++) {
this.checkContentIsDisplayed(content[i]);
await this.checkContentIsDisplayed(content[i]);
}
return this;
}
checkContentIsNotDisplayed(content) {
this.contentList.dataTablePage().checkContentIsNotDisplayed(this.columns.name, content);
return this;
async checkContentIsNotDisplayed(content): Promise<void> {
await this.contentList.dataTablePage().checkContentIsNotDisplayed(this.columns.name, content);
}
getActiveBreadcrumb() {
BrowserVisibility.waitUntilElementIsVisible(this.activeBreadcrumb);
return this.activeBreadcrumb.getAttribute('title');
async getActiveBreadcrumb(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.activeBreadcrumb);
return await this.activeBreadcrumb.getAttribute('title');
}
uploadFile(fileLocation) {
this.checkUploadButton();
this.uploadFileButtonInput.sendKeys(path.resolve(path.join(browser.params.testConfig.main.rootPath, fileLocation)));
this.checkUploadButton();
return this;
async uploadFile(fileLocation): Promise<void> {
await this.checkUploadButton();
await this.uploadFileButtonInput.sendKeys(path.resolve(path.join(browser.params.testConfig.main.rootPath, fileLocation)));
await this.checkUploadButton();
}
uploadMultipleFile(files) {
BrowserVisibility.waitUntilElementIsVisible(this.uploadMultipleFileButton);
async uploadMultipleFile(files): Promise<void> {
await BrowserVisibility.waitUntilElementIsPresent(this.uploadMultipleFileButton);
let allFiles = path.resolve(path.join(browser.params.testConfig.main.rootPath, files[0]));
for (let i = 1; i < files.length; i++) {
allFiles = allFiles + '\n' + path.resolve(path.join(browser.params.testConfig.main.rootPath, files[i]));
}
this.uploadMultipleFileButton.sendKeys(allFiles);
BrowserVisibility.waitUntilElementIsVisible(this.uploadMultipleFileButton);
return this;
await this.uploadMultipleFileButton.sendKeys(allFiles);
await BrowserVisibility.waitUntilElementIsPresent(this.uploadMultipleFileButton);
}
uploadFolder(folder) {
BrowserVisibility.waitUntilElementIsVisible(this.uploadFolderButton);
this.uploadFolderButton.sendKeys(path.resolve(path.join(browser.params.testConfig.main.rootPath, folder)));
BrowserVisibility.waitUntilElementIsVisible(this.uploadFolderButton);
return this;
async uploadFolder(folder): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.uploadFolderButton);
await this.uploadFolderButton.sendKeys(path.resolve(path.join(browser.params.testConfig.main.rootPath, folder)));
await BrowserVisibility.waitUntilElementIsVisible(this.uploadFolderButton);
}
getSingleFileButtonTooltip() {
BrowserVisibility.waitUntilElementIsVisible(this.uploadFileButton);
return this.uploadFileButtonInput.getAttribute('title');
async getSingleFileButtonTooltip(): Promise<string> {
await BrowserVisibility.waitUntilElementIsPresent(this.uploadFileButton);
return await this.uploadFileButtonInput.getAttribute('title');
}
getMultipleFileButtonTooltip() {
BrowserVisibility.waitUntilElementIsVisible(this.uploadMultipleFileButton);
return this.uploadMultipleFileButton.getAttribute('title');
async getMultipleFileButtonTooltip(): Promise<string> {
await BrowserVisibility.waitUntilElementIsPresent(this.uploadMultipleFileButton);
return await this.uploadMultipleFileButton.getAttribute('title');
}
getFolderButtonTooltip() {
BrowserVisibility.waitUntilElementIsVisible(this.uploadFolderButton);
return this.uploadFolderButton.getAttribute('title');
async getFolderButtonTooltip(): Promise<string> {
await BrowserVisibility.waitUntilElementIsPresent(this.uploadFolderButton);
return await this.uploadFolderButton.getAttribute('title');
}
checkUploadButton() {
BrowserVisibility.waitUntilElementIsVisible(this.uploadFileButton);
BrowserVisibility.waitUntilElementIsClickable(this.uploadFileButton);
return this;
async checkUploadButton(): Promise<void> {
await BrowserVisibility.waitUntilElementIsClickable(this.uploadFileButton);
}
uploadButtonIsEnabled() {
return this.uploadFileButton.isEnabled();
async uploadButtonIsEnabled(): Promise<boolean> {
return await this.uploadFileButton.isEnabled();
}
getErrorMessage() {
BrowserVisibility.waitUntilElementIsVisible(this.errorSnackBar);
const deferred = protractor.promise.defer();
this.errorSnackBar.getText().then(function (text) {
deferred.fulfill(text);
});
return deferred.promise;
async getErrorMessage(): Promise<string> {
return BrowserActions.getText(this.errorSnackBar);
}
enableInfiniteScrolling() {
const infiniteScrollButton = element(by.cssContainingText('.mat-slide-toggle-content', 'Enable Infinite Scrolling'));
BrowserActions.click(infiniteScrollButton);
return this;
async enableInfiniteScrolling(): Promise<void> {
const infiniteScrollButton: ElementFinder = element(by.cssContainingText('.mat-slide-toggle-content', 'Enable Infinite Scrolling'));
await BrowserActions.click(infiniteScrollButton);
}
enableCustomPermissionMessage() {
const customPermissionMessage = element(by.cssContainingText('.mat-slide-toggle-content', 'Enable custom permission message'));
BrowserActions.click(customPermissionMessage);
return this;
async enableCustomPermissionMessage(): Promise<void> {
const customPermissionMessage: ElementFinder = element(by.cssContainingText('.mat-slide-toggle-content', 'Enable custom permission message'));
await BrowserActions.click(customPermissionMessage);
}
enableMediumTimeFormat() {
const mediumTimeFormat = element(by.css('#enableMediumTimeFormat'));
BrowserActions.click(mediumTimeFormat);
return this;
async enableMediumTimeFormat(): Promise<void> {
const mediumTimeFormat: ElementFinder = element(by.css('#enableMediumTimeFormat'));
await BrowserActions.click(mediumTimeFormat);
}
enableThumbnails() {
const thumbnailSlide = element(by.id('adf-thumbnails-upload-switch'));
BrowserActions.click(thumbnailSlide);
return this;
async enableThumbnails(): Promise<void> {
const thumbnailSlide: ElementFinder = element(by.id('adf-thumbnails-upload-switch'));
await BrowserActions.click(thumbnailSlide);
}
checkPaginationIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.emptyPagination);
async checkPaginationIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.emptyPagination);
}
getDocumentListRowNumber() {
const documentList = element(by.css('adf-upload-drag-area adf-document-list'));
BrowserVisibility.waitUntilElementIsVisible(documentList);
return $$('adf-upload-drag-area adf-document-list .adf-datatable-row').count();
async getDocumentListRowNumber(): Promise<number> {
const documentList: ElementFinder = element(by.css('adf-upload-drag-area adf-document-list'));
await BrowserVisibility.waitUntilElementIsVisible(documentList);
return await $$('adf-upload-drag-area adf-document-list .adf-datatable-row').count();
}
checkColumnNameHeader() {
BrowserVisibility.waitUntilElementIsVisible(this.nameHeader);
async checkColumnNameHeader(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.nameHeader);
}
checkColumnSizeHeader() {
BrowserVisibility.waitUntilElementIsVisible(this.sizeHeader);
async checkColumnSizeHeader(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.sizeHeader);
}
checkColumnCreatedByHeader() {
BrowserVisibility.waitUntilElementIsVisible(this.createdByHeader);
async checkColumnCreatedByHeader(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.createdByHeader);
}
checkColumnCreatedHeader() {
BrowserVisibility.waitUntilElementIsVisible(this.createdHeader);
async checkColumnCreatedHeader(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.createdHeader);
}
checkDragAndDropDIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.dragAndDrop);
async checkDragAndDropDIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.dragAndDrop);
}
dragAndDropFile(file) {
this.checkDragAndDropDIsDisplayed();
this.dragAndDropAction.dropFile(this.dragAndDrop, file);
async dragAndDropFile(file): Promise<void> {
await this.checkDragAndDropDIsDisplayed();
await this.dragAndDropAction.dropFile(this.dragAndDrop, file);
}
dragAndDropFolder(folder) {
this.checkDragAndDropDIsDisplayed();
this.dragAndDropAction.dropFolder(this.dragAndDrop, folder);
async dragAndDropFolder(folder): Promise<void> {
await this.checkDragAndDropDIsDisplayed();
await this.dragAndDropAction.dropFolder(this.dragAndDrop, folder);
}
checkLockIsDisplayedForElement(name) {
const lockButton = element(by.css(`div.adf-datatable-cell[data-automation-id="${name}"] button`));
BrowserVisibility.waitUntilElementIsVisible(lockButton);
async checkLockIsDisplayedForElement(name): Promise<void> {
const lockButton: ElementFinder = element(by.css(`div.adf-datatable-cell[data-automation-id="${name}"] button`));
await BrowserVisibility.waitUntilElementIsVisible(lockButton);
}
getColumnValueForRow(file, columnName) {
return this.contentList.dataTablePage().getColumnValueForRow(this.columns.name, file, columnName);
async getColumnValueForRow(file, columnName): Promise<string> {
return await this.contentList.dataTablePage().getColumnValueForRow(this.columns.name, file, columnName);
}
async getStyleValueForRowText(rowName, styleName) {
const row = element(by.css(`div.adf-datatable-cell[data-automation-id="${rowName}"] span.adf-datatable-cell-value[title="${rowName}"]`));
BrowserVisibility.waitUntilElementIsVisible(row);
return row.getCssValue(styleName);
async getStyleValueForRowText(rowName, styleName): Promise<string> {
const row: ElementFinder = element(by.css(`div.adf-datatable-cell[data-automation-id="${rowName}"] span.adf-datatable-cell-value[title="${rowName}"]`));
await BrowserVisibility.waitUntilElementIsVisible(row);
return await row.getCssValue(styleName);
}
checkSpinnerIsShowed() {
BrowserVisibility.waitUntilElementIsPresent(this.documentListSpinner);
async checkEmptyFolderTextToBe(text): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.emptyFolder);
await expect(await this.emptyFolder.getText()).toContain(text);
}
checkEmptyFolderTextToBe(text) {
BrowserVisibility.waitUntilElementIsVisible(this.emptyFolder);
expect(this.emptyFolder.getText()).toContain(text);
async checkEmptyFolderImageUrlToContain(url): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.emptyFolderImage);
await expect(await this.emptyFolderImage.getAttribute('src')).toContain(url);
}
checkEmptyFolderImageUrlToContain(url) {
BrowserVisibility.waitUntilElementIsVisible(this.emptyFolderImage);
expect(this.emptyFolderImage.getAttribute('src')).toContain(url);
async checkEmptyRecentFileIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.emptyRecent);
}
checkEmptyRecentFileIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.emptyRecent);
async getRowIconImageUrl(fileName): Promise<string> {
const iconRow: ElementFinder = element(by.css(`.adf-document-list-container div.adf-datatable-cell[data-automation-id="${fileName}"] img`));
await BrowserVisibility.waitUntilElementIsVisible(iconRow);
return await iconRow.getAttribute('src');
}
checkIconForRowIsDisplayed(fileName) {
const iconRow = element(by.css(`.adf-document-list-container div.adf-datatable-cell[data-automation-id="${fileName}"] img`));
BrowserVisibility.waitUntilElementIsVisible(iconRow);
return iconRow;
async checkGridViewButtonIsVisible(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.gridViewButton);
}
async getRowIconImageUrl(fileName) {
const iconRow = this.checkIconForRowIsDisplayed(fileName);
return iconRow.getAttribute('src');
async clickGridViewButton(): Promise<void> {
await this.checkGridViewButtonIsVisible();
await BrowserActions.click(this.gridViewButton);
}
checkGridViewButtonIsVisible() {
BrowserVisibility.waitUntilElementIsVisible(this.gridViewButton);
async checkCardViewContainerIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.cardViewContainer);
}
clickGridViewButton() {
this.checkGridViewButtonIsVisible();
BrowserActions.click(this.gridViewButton);
async getCardElementShowedInPage(): Promise<number> {
await BrowserVisibility.waitUntilElementIsVisible(this.cardViewContainer);
return $$('div.adf-document-list-container div.adf-datatable-card div.adf-cell-value img').count();
}
checkCardViewContainerIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.cardViewContainer);
async getDocumentCardIconForElement(elementName): Promise<string> {
const elementIcon: ElementFinder = element(by.css(`.adf-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"] img`));
return await elementIcon.getAttribute('src');
}
getCardElementShowedInPage() {
this.checkCardViewContainerIsDisplayed();
const actualCards = $$('div.adf-document-list-container div.adf-datatable-card div.adf-cell-value img').count();
return actualCards;
async checkDocumentCardPropertyIsShowed(elementName, propertyName): Promise<void> {
const elementProperty: ElementFinder = element(by.css(`.adf-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"][title="${propertyName}"]`));
await BrowserVisibility.waitUntilElementIsVisible(elementProperty);
}
getDocumentCardIconForElement(elementName) {
const elementIcon = element(by.css(`.adf-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"] img`));
return elementIcon.getAttribute('src');
}
checkDocumentCardPropertyIsShowed(elementName, propertyName) {
const elementProperty = element(by.css(`.adf-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"][title="${propertyName}"]`));
BrowserVisibility.waitUntilElementIsVisible(elementProperty);
}
getAttributeValueForElement(elementName, propertyName) {
async getAttributeValueForElement(elementName, propertyName): Promise<string> {
const elementSize = element(by.css(`.adf-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"][title="${propertyName}"] span`));
return BrowserActions.getText(elementSize);
return await BrowserActions.getText(elementSize);
}
checkMenuIsShowedForElementIndex(elementIndex) {
const elementMenu = element(by.css(`button[data-automation-id="action_menu_${elementIndex}"]`));
BrowserVisibility.waitUntilElementIsVisible(elementMenu);
async checkMenuIsShowedForElementIndex(elementIndex): Promise<void> {
const elementMenu: ElementFinder = element(by.css(`button[data-automation-id="action_menu_${elementIndex}"]`));
await BrowserVisibility.waitUntilElementIsVisible(elementMenu);
}
navigateToCardFolder(folderName) {
BrowserActions.closeMenuAndDialogs();
const folderCard = element(by.css(`.adf-document-list-container div.adf-image-table-cell.adf-datatable-cell[data-automation-id="${folderName}"]`));
folderCard.click();
const folderSelected = element(by.css(`.adf-datatable-row.adf-is-selected div[data-automation-id="${folderName}"].adf-datatable-cell--image`));
BrowserVisibility.waitUntilElementIsVisible(folderSelected);
browser.actions().sendKeys(protractor.Key.ENTER).perform();
async navigateToCardFolder(folderName): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
const folderCard: ElementFinder = element(by.css(`.adf-document-list-container div.adf-image-table-cell.adf-datatable-cell[data-automation-id="${folderName}"]`));
await BrowserActions.click(folderCard);
const folderSelected: ElementFinder = element(by.css(`.adf-datatable-row.adf-is-selected div[data-automation-id="${folderName}"].adf-datatable-cell--image`));
await BrowserVisibility.waitUntilElementIsVisible(folderSelected);
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
}
getGridViewSortingDropdown() {
const sortingDropdown = element(by.css('mat-select[data-automation-id="grid-view-sorting"]'));
BrowserVisibility.waitUntilElementIsVisible(sortingDropdown);
return sortingDropdown;
async selectGridSortingFromDropdown(sortingChosen): Promise<void> {
const sortingDropdown: ElementFinder = element(by.css('mat-select[data-automation-id="grid-view-sorting"]'));
await BrowserActions.click(sortingDropdown);
const optionToClick: ElementFinder = element(by.css(`mat-option[data-automation-id="grid-view-sorting-${sortingChosen}"]`));
await BrowserActions.click(optionToClick);
}
selectGridSortingFromDropdown(sortingChosen) {
BrowserActions.closeMenuAndDialogs();
const dropdownSorting = this.getGridViewSortingDropdown();
BrowserActions.click(dropdownSorting);
const optionToClick = element(by.css(`mat-option[data-automation-id="grid-view-sorting-${sortingChosen}"]`));
BrowserActions.click(optionToClick);
}
checkRowIsDisplayed(rowName) {
async checkRowIsDisplayed(rowName): Promise<void> {
const row = this.contentList.dataTablePage().getCellElementByValue(this.columns.name, rowName);
BrowserVisibility.waitUntilElementIsVisible(row);
await BrowserVisibility.waitUntilElementIsVisible(row);
}
clickShareButton() {
BrowserActions.closeMenuAndDialogs();
BrowserActions.click(this.shareNodeButton);
async clickShareButton(): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.click(this.shareNodeButton);
}
checkSelectedSiteIsDisplayed(siteName) {
BrowserVisibility.waitUntilElementIsVisible(this.siteListDropdown.element(by.cssContainingText('.mat-select-value-text span', siteName)));
async checkSelectedSiteIsDisplayed(siteName): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.siteListDropdown.element(by.cssContainingText('.mat-select-value-text span', siteName)));
}
selectSite(siteName: string) {
BrowserActions.clickOnSelectDropdownOption(siteName, this.siteListDropdown);
return this;
async selectSite(siteName: string): Promise<void> {
await BrowserActions.clickOnSelectDropdownOption(siteName, this.siteListDropdown);
}
clickDownloadButton() {
BrowserActions.closeMenuAndDialogs();
BrowserActions.click(this.downloadButton);
async clickDownloadButton(): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.click(this.downloadButton);
}
clickMultiSelectToggle() {
BrowserActions.closeMenuAndDialogs();
BrowserActions.click(this.multiSelectToggle);
async clickMultiSelectToggle() {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.click(this.multiSelectToggle);
}
getRowByName(rowName) {
getRowByName(rowName): ElementFinder {
return this.contentList.dataTable.getRow(this.columns.name, rowName);
}
+66 -67
View File
@@ -15,117 +15,116 @@
* limitations under the License.
*/
import { element, by, protractor } from 'protractor';
import { element, by, protractor, ElementFinder } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class HeaderPage {
checkBox = element(by.cssContainingText('.mat-checkbox-label', 'Show menu button'));
headerColor = element(by.css('option[value="primary"]'));
titleInput = element(by.css('input[name="title"]'));
iconInput = element(by.css('input[placeholder="URL path"]'));
hexColorInput = element(by.css('input[placeholder="hex color code"]'));
logoHyperlinkInput = element(by.css('input[placeholder="Redirect URL"]'));
logoTooltipInput = element(by.css('input[placeholder="Tooltip text"]'));
positionStart = element.all(by.css('mat-radio-button[value="start"]')).first();
positionEnd = element.all(by.css('mat-radio-button[value="end"]')).first();
sideBarPositionRight = element(by.css('mat-sidenav.mat-drawer.mat-sidenav.mat-drawer-end'));
sideBarPositionLeft = element(by.css('mat-sidenav.mat-drawer.mat-sidenav'));
checkBox: ElementFinder = element(by.cssContainingText('.mat-checkbox-label', 'Show menu button'));
headerColor: ElementFinder = element(by.css('option[value="primary"]'));
titleInput: ElementFinder = element(by.css('input[name="title"]'));
iconInput: ElementFinder = element(by.css('input[placeholder="URL path"]'));
hexColorInput: ElementFinder = element(by.css('input[placeholder="hex color code"]'));
logoHyperlinkInput: ElementFinder = element(by.css('input[placeholder="Redirect URL"]'));
logoTooltipInput: ElementFinder = element(by.css('input[placeholder="Tooltip text"]'));
positionStart: ElementFinder = element.all(by.css('mat-radio-button[value="start"]')).first();
positionEnd: ElementFinder = element.all(by.css('mat-radio-button[value="end"]')).first();
sideBarPositionRight: ElementFinder = element(by.css('mat-sidenav.mat-drawer.mat-sidenav.mat-drawer-end'));
sideBarPositionLeft: ElementFinder = element(by.css('mat-sidenav.mat-drawer.mat-sidenav'));
checkShowMenuCheckBoxIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.checkBox);
async checkShowMenuCheckBoxIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.checkBox);
}
checkChooseHeaderColourIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.headerColor);
async checkChooseHeaderColourIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.headerColor);
}
checkChangeTitleIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.titleInput);
async checkChangeTitleIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.titleInput);
}
checkChangeUrlPathIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.iconInput);
async checkChangeUrlPathIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.iconInput);
}
clickShowMenuButton() {
const checkBox = element(by.css('mat-checkbox'));
BrowserVisibility.waitUntilElementIsVisible(checkBox);
return checkBox.get(0).click();
async clickShowMenuButton(): Promise<void> {
const checkBox: ElementFinder = element(by.css('mat-checkbox'));
await BrowserActions.click(checkBox.get(0));
}
changeHeaderColor(color) {
const headerColor = element(by.css('option[value="' + color + '"]'));
BrowserActions.click(headerColor);
async changeHeaderColor(color): Promise<void> {
const headerColor: ElementFinder = element(by.css('option[value="' + color + '"]'));
await BrowserActions.click(headerColor);
}
checkAppTitle(name) {
const title = element(by.cssContainingText('.adf-app-title', name));
return BrowserVisibility.waitUntilElementIsVisible(title);
async checkAppTitle(name): Promise<void> {
const title: ElementFinder = element(by.cssContainingText('.adf-app-title', name));
await BrowserVisibility.waitUntilElementIsVisible(title);
}
addTitle(title) {
BrowserActions.click(this.titleInput);
this.titleInput.sendKeys(title);
this.titleInput.sendKeys(protractor.Key.ENTER);
async addTitle(title): Promise<void> {
await BrowserActions.click(this.titleInput);
await BrowserActions.clearSendKeys(this.titleInput, title);
await this.titleInput.sendKeys(protractor.Key.ENTER);
}
checkIconIsDisplayed(url) {
const icon = element(by.css('img[src="' + url + '"]'));
BrowserVisibility.waitUntilElementIsVisible(icon);
async checkIconIsDisplayed(url): Promise<void> {
const icon: ElementFinder = element(by.css('img[src="' + url + '"]'));
await BrowserVisibility.waitUntilElementIsVisible(icon);
}
addIcon(url) {
BrowserActions.click(this.iconInput);
this.iconInput.sendKeys(url);
this.iconInput.sendKeys(protractor.Key.ENTER);
async addIcon(url): Promise<void> {
await BrowserActions.click(this.iconInput);
await BrowserActions.clearSendKeys(this.iconInput, url);
await this.iconInput.sendKeys(protractor.Key.ENTER);
}
checkHexColorInputIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.hexColorInput);
async checkHexColorInputIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.hexColorInput);
}
checkLogoHyperlinkInputIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.logoHyperlinkInput);
async checkLogoHyperlinkInputIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.logoHyperlinkInput);
}
checkLogoTooltipInputIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.logoTooltipInput);
async checkLogoTooltipInputIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.logoTooltipInput);
}
addHexCodeColor(hexCode) {
BrowserActions.click(this.hexColorInput);
this.hexColorInput.sendKeys(hexCode);
return this.hexColorInput.sendKeys(protractor.Key.ENTER);
async addHexCodeColor(hexCode): Promise<void> {
await BrowserActions.click(this.hexColorInput);
await this.hexColorInput.sendKeys(hexCode);
await this.hexColorInput.sendKeys(protractor.Key.ENTER);
}
addLogoHyperlink(hyperlink) {
BrowserActions.click(this.logoHyperlinkInput);
this.logoHyperlinkInput.sendKeys(hyperlink);
return this.logoHyperlinkInput.sendKeys(protractor.Key.ENTER);
async addLogoHyperlink(hyperlink): Promise<void> {
await BrowserActions.click(this.logoHyperlinkInput);
await this.logoHyperlinkInput.sendKeys(hyperlink);
await this.logoHyperlinkInput.sendKeys(protractor.Key.ENTER);
}
addLogoTooltip(tooltip) {
BrowserActions.click(this.logoTooltipInput);
this.logoTooltipInput.sendKeys(tooltip);
return this.logoTooltipInput.sendKeys(protractor.Key.ENTER);
async addLogoTooltip(tooltip): Promise<void> {
await BrowserActions.click(this.logoTooltipInput);
await this.logoTooltipInput.sendKeys(tooltip);
await this.logoTooltipInput.sendKeys(protractor.Key.ENTER);
}
sideBarPositionStart() {
BrowserActions.click(this.positionStart);
async sideBarPositionStart(): Promise<void> {
await BrowserActions.click(this.positionStart);
}
sideBarPositionEnd() {
BrowserActions.click(this.positionEnd);
async sideBarPositionEnd(): Promise<void> {
await BrowserActions.click(this.positionEnd);
}
checkSidebarPositionStart() {
return BrowserVisibility.waitUntilElementIsVisible(this.sideBarPositionLeft);
async checkSidebarPositionStart(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.sideBarPositionLeft);
}
checkSidebarPositionEnd() {
return BrowserVisibility.waitUntilElementIsVisible(this.sideBarPositionRight);
async checkSidebarPositionEnd(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.sideBarPositionRight);
}
}
+5 -8
View File
@@ -15,9 +15,7 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { ElementFinder } from 'protractor/built/element';
import { element, by, ElementFinder } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class InfinitePaginationPage {
@@ -30,13 +28,12 @@ export class InfinitePaginationPage {
this.loadMoreButton = this.rootElement.element(by.css('button[data-automation-id="adf-infinite-pagination-button"]'));
}
clickLoadMoreButton() {
BrowserActions.click(this.loadMoreButton);
return this;
async clickLoadMoreButton(): Promise<void> {
await BrowserActions.click(this.loadMoreButton);
}
checkLoadMoreButtonIsNotDisplayed() {
return BrowserVisibility.waitUntilElementIsNotOnPage(this.loadMoreButton);
async checkLoadMoreButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.loadMoreButton);
}
}
+22 -23
View File
@@ -16,7 +16,7 @@
*/
import { BrowserVisibility } from '@alfresco/adf-testing';
import { element, by } from 'protractor';
import { element, by, ElementFinder } from 'protractor';
import { DataTableComponentPage, BrowserActions } from '@alfresco/adf-testing';
import { NavigationBarPage } from '../navigationBarPage';
@@ -38,49 +38,48 @@ const column = {
export class CustomSources {
dataTable = new DataTableComponentPage();
navigationBarPage = new NavigationBarPage();
dataTable: DataTableComponentPage = new DataTableComponentPage();
navigationBarPage: NavigationBarPage = new NavigationBarPage();
toolbar = element(by.css('app-custom-sources .adf-toolbar-title'));
sourceTypeDropdown = element(by.css('div[class*="select-arrow"]>div'));
toolbar: ElementFinder = element(by.css('app-custom-sources .adf-toolbar-title'));
sourceTypeDropdown: ElementFinder = element(by.css('div[class*="select-arrow"]>div'));
getSourceType(option) {
getSourceType(option): ElementFinder {
return element(by.cssContainingText('.cdk-overlay-pane span', `${option}`));
}
waitForToolbarToBeVisible() {
BrowserVisibility.waitUntilElementIsVisible(this.toolbar);
return this;
async waitForToolbarToBeVisible(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.toolbar);
}
navigateToCustomSources() {
this.navigationBarPage.navigateToCustomSources();
this.waitForToolbarToBeVisible();
async navigateToCustomSources(): Promise<void> {
await this.navigationBarPage.clickCustomSources();
await this.waitForToolbarToBeVisible();
}
clickOnSourceType() {
BrowserActions.click(this.sourceTypeDropdown);
async clickOnSourceType(): Promise<void> {
await BrowserActions.click(this.sourceTypeDropdown);
}
selectMySitesSourceType() {
this.clickOnSourceType();
BrowserActions.click(this.getSourceType(source.mySites));
async selectMySitesSourceType(): Promise<void> {
await this.clickOnSourceType();
await BrowserActions.click(this.getSourceType(source.mySites));
}
selectFavoritesSourceType() {
this.clickOnSourceType();
BrowserActions.click(this.getSourceType(source.favorites));
async selectFavoritesSourceType(): Promise<void> {
await this.clickOnSourceType();
await BrowserActions.click(this.getSourceType(source.favorites));
}
checkRowIsDisplayed(rowName) {
checkRowIsDisplayed(rowName): Promise<void> {
return this.dataTable.checkContentIsDisplayed('Name', rowName);
}
checkRowIsNotDisplayed(rowName) {
checkRowIsNotDisplayed(rowName): Promise<void> {
return this.dataTable.checkContentIsNotDisplayed('Name', rowName);
}
getStatusCell(rowName) {
async getStatusCell(rowName): Promise<string> {
const cell = this.dataTable.getCellByRowContentAndColumn('Name', rowName, column.status);
return BrowserActions.getText(cell);
}
+83 -86
View File
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { browser, by, element, protractor } from 'protractor';
import { browser, by, element, ElementArrayFinder, ElementFinder, protractor } from 'protractor';
import { DataTableComponentPage } from '@alfresco/adf-testing';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
@@ -33,20 +33,18 @@ export class DataTablePage {
defaultTable: 'datatable'
};
dataTable;
multiSelect = element(by.css(`div[data-automation-id='multiselect'] label > div[class='mat-checkbox-inner-container']`));
reset = element(by.xpath(`//span[contains(text(),'Reset to default')]/..`));
selectionButton = element(by.css(`div[class='mat-select-arrow']`));
selectionDropDown = element(by.css(`div[class*='ng-trigger-transformPanel']`));
allSelectedRows = element.all(by.css(`div[class*='is-selected']`));
selectedRowNumber = element(by.css(`div[class*='is-selected'] div[data-automation-id*='text_']`));
selectAll = element(by.css(`div[class*='header'] label`));
addRowElement = element(by.xpath(`//span[contains(text(),'Add row')]/..`));
replaceRowsElement = element(by.xpath(`//span[contains(text(),'Replace rows')]/..`));
replaceColumnsElement = element(by.xpath(`//span[contains(text(),'Replace columns')]/..`));
createdOnColumn = element(by.css(`div[data-automation-id='auto_id_createdOn']`));
idColumnHeader = element(by.css(`div[data-automation-id='auto_id_id']`));
pasteClipboardInput = element(by.css(`input[data-automation-id='paste clipboard input']`));
dataTable: DataTableComponentPage;
multiSelect: ElementFinder = element(by.css(`div[data-automation-id='multiselect'] label > div[class='mat-checkbox-inner-container']`));
reset: ElementFinder = element(by.xpath(`//span[contains(text(),'Reset to default')]/..`));
allSelectedRows: ElementArrayFinder = element.all(by.css(`div[class*='is-selected']`));
selectedRowNumber: ElementFinder = element(by.css(`div[class*='is-selected'] div[data-automation-id*='text_']`));
selectAll: ElementFinder = element(by.css(`div[class*='header'] label`));
addRowElement: ElementFinder = element(by.xpath(`//span[contains(text(),'Add row')]/..`));
replaceRowsElement: ElementFinder = element(by.xpath(`//span[contains(text(),'Replace rows')]/..`));
replaceColumnsElement: ElementFinder = element(by.xpath(`//span[contains(text(),'Replace columns')]/..`));
createdOnColumn: ElementFinder = element(by.css(`div[data-automation-id='auto_id_createdOn']`));
idColumnHeader: ElementFinder = element(by.css(`div[data-automation-id='auto_id_id']`));
pasteClipboardInput: ElementFinder = element(by.css(`input[data-automation-id='paste clipboard input']`));
constructor(data?) {
if (this.data[data]) {
@@ -56,142 +54,141 @@ export class DataTablePage {
}
}
insertFilter(filterText) {
const inputFilter = element(by.css(`#adf-datatable-filter-input`));
inputFilter.clear();
return inputFilter.sendKeys(filterText);
async insertFilter(filterText): Promise<void> {
const inputFilter: ElementFinder = element(by.css(`#adf-datatable-filter-input`));
await BrowserActions.clearSendKeys(inputFilter, filterText);
}
addRow() {
BrowserActions.click(this.addRowElement);
async addRow(): Promise<void> {
await BrowserActions.click(this.addRowElement);
}
replaceRows(id) {
async replaceRows(id): Promise<void> {
const rowID = this.dataTable.getCellElementByValue(this.columns.id, id);
BrowserVisibility.waitUntilElementIsVisible(rowID);
BrowserActions.click(this.replaceRowsElement);
BrowserVisibility.waitUntilElementIsNotVisible(rowID);
await BrowserVisibility.waitUntilElementIsVisible(rowID);
await BrowserActions.click(this.replaceRowsElement);
await BrowserVisibility.waitUntilElementIsNotVisible(rowID);
}
replaceColumns() {
BrowserActions.click(this.replaceColumnsElement);
BrowserVisibility.waitUntilElementIsNotOnPage(this.createdOnColumn);
async replaceColumns(): Promise<void> {
await BrowserActions.click(this.replaceColumnsElement);
await BrowserVisibility.waitUntilElementIsNotVisible(this.createdOnColumn);
}
clickMultiSelect() {
BrowserActions.click(this.multiSelect);
async clickMultiSelect(): Promise<void> {
await BrowserActions.click(this.multiSelect);
}
clickReset() {
BrowserActions.click(this.reset);
async clickReset(): Promise<void> {
await BrowserActions.click(this.reset);
}
checkRowIsNotSelected(rowNumber) {
async checkRowIsNotSelected(rowNumber): Promise<void> {
const isRowSelected = this.dataTable.getCellElementByValue(this.columns.id, rowNumber)
.element(by.xpath(`ancestor::div[contains(@class, 'adf-datatable-row custom-row-style ng-star-inserted is-selected')]`));
BrowserVisibility.waitUntilElementIsNotOnPage(isRowSelected);
await BrowserVisibility.waitUntilElementIsNotVisible(isRowSelected);
}
checkNoRowIsSelected() {
BrowserVisibility.waitUntilElementIsNotOnPage(this.selectedRowNumber);
async checkNoRowIsSelected(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.selectedRowNumber);
}
checkAllRows() {
BrowserActions.click(this.selectAll);
async checkAllRows(): Promise<void> {
await BrowserActions.click(this.selectAll);
}
checkRowIsChecked(rowNumber) {
BrowserVisibility.waitUntilElementIsVisible(this.getRowCheckbox(rowNumber));
async checkRowIsChecked(rowNumber): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.getRowCheckbox(rowNumber));
}
checkRowIsNotChecked(rowNumber) {
BrowserVisibility.waitUntilElementIsNotOnPage(this.getRowCheckbox(rowNumber));
async checkRowIsNotChecked(rowNumber): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.getRowCheckbox(rowNumber));
}
getNumberOfSelectedRows() {
async getNumberOfSelectedRows(): Promise<number> {
return this.allSelectedRows.count();
}
clickCheckbox(rowNumber) {
BrowserActions.closeMenuAndDialogs();
async clickCheckbox(rowNumber): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
const checkbox = this.dataTable.getCellElementByValue(this.columns.id, rowNumber)
.element(by.xpath(`ancestor::div[contains(@class, 'adf-datatable-row')]//mat-checkbox/label`));
BrowserActions.click(checkbox);
await BrowserActions.click(checkbox);
}
async selectRow(rowNumber) {
BrowserActions.clickExecuteScript(`div[title="${this.columns.id}"] div[data-automation-id="text_${rowNumber}"] span`);
return this;
}
selectRowWithKeyboard(rowNumber) {
async selectRow(rowNumber): Promise<void> {
const row = this.dataTable.getCellElementByValue(this.columns.id, rowNumber);
browser.actions().sendKeys(protractor.Key.COMMAND).click(row).perform();
await BrowserActions.click(row);
}
selectSelectionMode(selectionMode) {
const selectMode = element(by.cssContainingText(`span[class='mat-option-text']`, selectionMode));
BrowserActions.clickExecuteScript('div[class="mat-select-arrow"]');
BrowserActions.click(selectMode);
async selectRowWithKeyboard(rowNumber): Promise<void> {
await browser.actions().sendKeys(protractor.Key.COMMAND).perform();
await this.selectRow(rowNumber);
await browser.actions().sendKeys(protractor.Key.NULL).perform();
}
getRowCheckbox(rowNumber) {
async selectSelectionMode(selectionMode): Promise<void> {
const selectMode: ElementFinder = element(by.cssContainingText(`span[class='mat-option-text']`, selectionMode));
await BrowserActions.clickExecuteScript('div[class="mat-select-arrow"]');
await BrowserActions.click(selectMode);
}
getRowCheckbox(rowNumber): ElementFinder {
return this.dataTable.getCellElementByValue(this.columns.id, rowNumber).element(by.xpath(`ancestor::div/div/mat-checkbox[contains(@class, 'mat-checkbox-checked')]`));
}
getCopyContentTooltip() {
return this.dataTable.getCopyContentTooltip();
async getCopyContentTooltip(): Promise<string> {
return await this.dataTable.getCopyContentTooltip();
}
mouseOverNameColumn(name) {
return this.dataTable.mouseOverColumn(this.columns.name, name);
async mouseOverNameColumn(name): Promise<void> {
await this.dataTable.mouseOverColumn(this.columns.name, name);
}
mouseOverCreatedByColumn(name) {
return this.dataTable.mouseOverColumn(this.columns.createdBy, name);
async mouseOverCreatedByColumn(name): Promise<void> {
await this.dataTable.mouseOverColumn(this.columns.createdBy, name);
}
mouseOverIdColumn(name) {
return this.dataTable.mouseOverColumn(this.columns.id, name);
async mouseOverIdColumn(name): Promise<void> {
await this.dataTable.mouseOverColumn(this.columns.id, name);
}
mouseOverJsonColumn(rowNumber) {
return this.dataTable.mouseOverElement(this.dataTable.getCellByRowNumberAndColumnName(rowNumber - 1, this.columns.json));
async mouseOverJsonColumn(rowNumber): Promise<void> {
await this.dataTable.mouseOverElement(this.dataTable.getCellByRowNumberAndColumnName(rowNumber - 1, this.columns.json));
}
getDropTargetIdColumnCell(rowNumber) {
getDropTargetIdColumnCell(rowNumber): ElementFinder {
return this.dataTable.getCellByRowNumberAndColumnName(rowNumber - 1, this.columns.id);
}
getDropTargetIdColumnHeader() {
getDropTargetIdColumnHeader(): ElementFinder {
return this.idColumnHeader;
}
clickOnIdColumn(name) {
return this.dataTable.clickColumn(this.columns.id, name);
async clickOnIdColumn(name): Promise<void> {
await this.dataTable.clickColumn(this.columns.id, name);
}
clickOnJsonColumn(rowNumber) {
return BrowserActions.click(this.dataTable.getCellByRowNumberAndColumnName(rowNumber - 1, this.columns.json));
async clickOnJsonColumn(rowNumber): Promise<void> {
await BrowserActions.click(this.dataTable.getCellByRowNumberAndColumnName(rowNumber - 1, this.columns.json));
}
clickOnNameColumn(name) {
return this.dataTable.clickColumn(this.columns.name, name);
async clickOnNameColumn(name): Promise<void> {
await this.dataTable.clickColumn(this.columns.name, name);
}
clickOnCreatedByColumn(name) {
return this.dataTable.clickColumn(this.columns.createdBy, name);
async clickOnCreatedByColumn(name): Promise<void> {
await this.dataTable.clickColumn(this.columns.createdBy, name);
}
pasteClipboard() {
this.pasteClipboardInput.clear();
BrowserActions.click(this.pasteClipboardInput);
this.pasteClipboardInput.sendKeys(protractor.Key.chord(protractor.Key.SHIFT, protractor.Key.INSERT));
return this;
async pasteClipboard(): Promise<void> {
await this.pasteClipboardInput.clear();
await BrowserActions.click(this.pasteClipboardInput);
await this.pasteClipboardInput.sendKeys(protractor.Key.chord(protractor.Key.SHIFT, protractor.Key.INSERT));
}
getClipboardInputText() {
BrowserVisibility.waitUntilElementIsVisible(this.pasteClipboardInput);
return this.pasteClipboardInput.getAttribute('value');
async getClipboardInputText(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.pasteClipboardInput);
return await this.pasteClipboardInput.getAttribute('value');
}
}
+4 -4
View File
@@ -15,14 +15,14 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { by, element, ElementFinder } from 'protractor';
import { BrowserVisibility } from '@alfresco/adf-testing';
export class LogoutPage {
logoutSection = element(by.css('div[data-automation-id="adf-logout-section"]'));
logoutSection: ElementFinder = element(by.css('div[data-automation-id="adf-logout-section"]'));
checkLogoutSectionIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.logoutSection);
async checkLogoutSectionIsDisplayed() {
await BrowserVisibility.waitUntilElementIsVisible(this.logoutSection);
}
}
@@ -15,14 +15,14 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { by, element, ElementFinder } from 'protractor';
import { BrowserVisibility } from '@alfresco/adf-testing';
export class MonacoExtensionPage {
monacoPlugin = element(by.cssContainingText('mat-row > mat-cell', 'monaco plugin'));
monacoPlugin: ElementFinder = element(by.cssContainingText('mat-row > mat-cell', 'monaco plugin'));
checkMonacoPluginIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.monacoPlugin);
async checkMonacoPluginIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.monacoPlugin);
}
}
@@ -17,28 +17,28 @@
import { ConfigEditorPage } from '../../configEditorPage';
import { BrowserActions } from '@alfresco/adf-testing';
import { by, element, browser } from 'protractor';
import { by, element, browser, ElementFinder } from 'protractor';
export class FormCloudDemoPage {
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: ElementFinder = element.all(by.css('.mat-tab-list .mat-tab-label')).get(1);
formCloudRender: ElementFinder = element.all(by.css('.mat-tab-list .mat-tab-label')).get(0);
configEditorPage = new ConfigEditorPage();
goToEditor() {
BrowserActions.click(this.formCloudEditor);
async goToEditor(): Promise<void> {
await BrowserActions.click(this.formCloudEditor);
}
goToRenderedForm() {
BrowserActions.click(this.formCloudRender);
async goToRenderedForm(): Promise<void> {
await BrowserActions.click(this.formCloudRender);
}
setConfigToEditor(text) {
this.goToEditor();
browser.sleep(2000);
this.configEditorPage.enterBulkConfiguration(text);
this.goToRenderedForm();
browser.sleep(2000);
async setConfigToEditor(text): Promise<void> {
await this.goToEditor();
await browser.sleep(2000);
await this.configEditorPage.enterBulkConfiguration(text);
await this.goToRenderedForm();
await browser.sleep(2000);
}
}
@@ -19,15 +19,13 @@ import { DataTableComponentPage } from '@alfresco/adf-testing';
export class ProcessDetailsCloudDemoPage {
dataTable = new DataTableComponentPage();
dataTable: DataTableComponentPage = new DataTableComponentPage();
checkTaskIsDisplayed(taskName: string) {
this.dataTable.checkContentIsDisplayed('Name', taskName);
return this;
async checkTaskIsDisplayed(taskName: string): Promise<void> {
await this.dataTable.checkContentIsDisplayed('Name', taskName);
}
selectProcessTaskByName(taskName: string) {
this.dataTable.selectRow('Name', taskName);
return this;
async selectProcessTaskByName(taskName: string): Promise<void> {
await this.dataTable.selectRow('Name', taskName);
}
}
@@ -15,136 +15,120 @@
* limitations under the License.
*/
import { by, element, protractor } from 'protractor';
import { by, element, ElementFinder } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class PeopleGroupCloudComponentPage {
peopleCloudSingleSelectionChecked = element(by.css('mat-radio-button[data-automation-id="adf-people-single-mode"][class*="mat-radio-checked"]'));
peopleCloudMultipleSelectionChecked = element(by.css('mat-radio-button[data-automation-id="adf-people-multiple-mode"][class*="mat-radio-checked"]'));
peopleCloudSingleSelection = element(by.css('mat-radio-button[data-automation-id="adf-people-single-mode"]'));
peopleCloudMultipleSelection = element(by.css('mat-radio-button[data-automation-id="adf-people-multiple-mode"]'));
peopleCloudFilterRole = element(by.css('mat-radio-button[data-automation-id="adf-people-filter-role"]'));
groupCloudSingleSelection = element(by.css('mat-radio-button[data-automation-id="adf-group-single-mode"]'));
groupCloudMultipleSelection = element(by.css('mat-radio-button[data-automation-id="adf-group-multiple-mode"]'));
groupCloudFilterRole = element(by.css('mat-radio-button[data-automation-id="adf-group-filter-role"]'));
peopleRoleInput = element(by.css('input[data-automation-id="adf-people-roles-input"]'));
peopleAppInput = element(by.css('input[data-automation-id="adf-people-app-input"]'));
peoplePreselect = element(by.css('input[data-automation-id="adf-people-preselect-input"]'));
groupRoleInput = element(by.css('input[data-automation-id="adf-group-roles-input"]'));
groupAppInput = element(by.css('input[data-automation-id="adf-group-app-input"]'));
peopleCloudComponentTitle = element(by.cssContainingText('mat-card-title', 'People Cloud Component'));
groupCloudComponentTitle = element(by.cssContainingText('mat-card-title', 'Groups Cloud Component'));
preselectValidation = element(by.css('mat-checkbox.adf-preselect-value'));
preselectValidationStatus = element(by.css('mat-checkbox.adf-preselect-value label input'));
peopleFilterByAppName = element(by.css('.people-control-options mat-radio-button[value="appName"]'));
groupFilterByAppName = element(by.css('.groups-control-options mat-radio-button[value="appName"]'));
peopleCloudSingleSelectionChecked: ElementFinder = element(by.css('mat-radio-button[data-automation-id="adf-people-single-mode"][class*="mat-radio-checked"]'));
peopleCloudMultipleSelectionChecked: ElementFinder = element(by.css('mat-radio-button[data-automation-id="adf-people-multiple-mode"][class*="mat-radio-checked"]'));
peopleCloudSingleSelection: ElementFinder = element(by.css('mat-radio-button[data-automation-id="adf-people-single-mode"]'));
peopleCloudMultipleSelection: ElementFinder = element(by.css('mat-radio-button[data-automation-id="adf-people-multiple-mode"]'));
peopleCloudFilterRole: ElementFinder = element(by.css('mat-radio-button[data-automation-id="adf-people-filter-role"]'));
groupCloudSingleSelection: ElementFinder = element(by.css('mat-radio-button[data-automation-id="adf-group-single-mode"]'));
groupCloudMultipleSelection: ElementFinder = element(by.css('mat-radio-button[data-automation-id="adf-group-multiple-mode"]'));
groupCloudFilterRole: ElementFinder = element(by.css('mat-radio-button[data-automation-id="adf-group-filter-role"]'));
peopleRoleInput: ElementFinder = element(by.css('input[data-automation-id="adf-people-roles-input"]'));
peopleAppInput: ElementFinder = element(by.css('input[data-automation-id="adf-people-app-input"]'));
peoplePreselect: ElementFinder = element(by.css('input[data-automation-id="adf-people-preselect-input"]'));
groupRoleInput: ElementFinder = element(by.css('input[data-automation-id="adf-group-roles-input"]'));
groupAppInput: ElementFinder = element(by.css('input[data-automation-id="adf-group-app-input"]'));
peopleCloudComponentTitle: ElementFinder = element(by.cssContainingText('mat-card-title', 'People Cloud Component'));
groupCloudComponentTitle: ElementFinder = element(by.cssContainingText('mat-card-title', 'Groups Cloud Component'));
preselectValidation: ElementFinder = element(by.css('mat-checkbox.adf-preselect-value'));
preselectValidationStatus: ElementFinder = element(by.css('mat-checkbox.adf-preselect-value label input'));
peopleFilterByAppName: ElementFinder = element(by.css('.people-control-options mat-radio-button[value="appName"]'));
groupFilterByAppName: ElementFinder = element(by.css('.groups-control-options mat-radio-button[value="appName"]'));
checkPeopleCloudComponentTitleIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudComponentTitle);
return this;
async checkPeopleCloudComponentTitleIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudComponentTitle);
}
checkGroupsCloudComponentTitleIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.groupCloudComponentTitle);
return this;
async checkGroupsCloudComponentTitleIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.groupCloudComponentTitle);
}
clickPeopleCloudSingleSelection() {
BrowserActions.click(this.peopleCloudSingleSelection);
async clickPeopleCloudSingleSelection(): Promise<void> {
await BrowserActions.click(this.peopleCloudSingleSelection);
}
clickPeopleCloudMultipleSelection() {
BrowserActions.click(this.peopleCloudMultipleSelection);
async clickPeopleCloudMultipleSelection(): Promise<void> {
await BrowserActions.click(this.peopleCloudMultipleSelection);
}
checkPeopleCloudSingleSelectionIsSelected() {
BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudSingleSelectionChecked);
async checkPeopleCloudSingleSelectionIsSelected(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudSingleSelectionChecked);
}
checkPeopleCloudMultipleSelectionIsSelected() {
BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudMultipleSelectionChecked);
async checkPeopleCloudMultipleSelectionIsSelected(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudMultipleSelectionChecked);
}
checkPeopleCloudFilterRole() {
BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudFilterRole);
async checkPeopleCloudFilterRole(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudFilterRole);
}
clickPeopleCloudFilterRole() {
BrowserActions.click(this.peopleCloudFilterRole);
async clickPeopleCloudFilterRole(): Promise<void> {
await BrowserActions.click(this.peopleCloudFilterRole);
}
clickGroupCloudFilterRole() {
BrowserActions.click(this.groupCloudFilterRole);
async clickGroupCloudFilterRole(): Promise<void> {
await BrowserActions.click(this.groupCloudFilterRole);
}
enterPeopleRoles(roles) {
BrowserVisibility.waitUntilElementIsVisible(this.peopleRoleInput);
this.peopleRoleInput.clear();
this.peopleRoleInput.sendKeys(roles);
return this;
async enterPeopleRoles(roles): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.peopleRoleInput);
await BrowserActions.clearSendKeys(this.peopleRoleInput, roles);
}
enterPeoplePreselect(preselect) {
BrowserVisibility.waitUntilElementIsVisible(this.peoplePreselect);
this.peoplePreselect.clear();
this.peoplePreselect.sendKeys(preselect);
return this;
async enterPeoplePreselect(preselect): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.peoplePreselect);
await BrowserActions.clearSendKeys(this.peoplePreselect, preselect);
}
clearField(locator) {
BrowserVisibility.waitUntilElementIsVisible(locator);
locator.getAttribute('value').then((result) => {
for (let i = result.length; i >= 0; i--) {
locator.sendKeys(protractor.Key.BACK_SPACE);
}
});
async clearField(locator): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(locator);
await BrowserActions.clearSendKeys(locator, '');
}
clickGroupCloudSingleSelection() {
BrowserActions.click(this.groupCloudSingleSelection);
async clickGroupCloudSingleSelection(): Promise<void> {
await BrowserActions.click(this.groupCloudSingleSelection);
}
clickGroupCloudMultipleSelection() {
BrowserActions.click(this.groupCloudMultipleSelection);
async clickGroupCloudMultipleSelection(): Promise<void> {
await BrowserActions.click(this.groupCloudMultipleSelection);
}
enterGroupRoles(roles) {
BrowserVisibility.waitUntilElementIsVisible(this.groupRoleInput);
this.groupRoleInput.clear();
this.groupRoleInput.sendKeys(roles);
return this;
async enterGroupRoles(roles): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.groupRoleInput);
await BrowserActions.clearSendKeys(this.groupRoleInput, roles);
}
clickPreselectValidation() {
BrowserActions.click(this.preselectValidation);
async clickPreselectValidation(): Promise<void> {
await BrowserActions.click(this.preselectValidation);
}
getPreselectValidationStatus() {
BrowserVisibility.waitUntilElementIsVisible(this.preselectValidationStatus);
async getPreselectValidationStatus(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.preselectValidationStatus);
return this.preselectValidationStatus.getAttribute('aria-checked');
}
clickPeopleFilerByApp() {
return BrowserActions.click(this.peopleFilterByAppName);
async clickPeopleFilerByApp(): Promise<void> {
await BrowserActions.click(this.peopleFilterByAppName);
}
clickGroupFilerByApp() {
return BrowserActions.click(this.groupFilterByAppName);
async clickGroupFilerByApp(): Promise<void> {
await BrowserActions.click(this.groupFilterByAppName);
}
enterPeopleAppName(appName) {
BrowserVisibility.waitUntilElementIsVisible(this.peopleAppInput);
this.peopleAppInput.clear();
this.peopleAppInput.sendKeys(appName);
return this;
async enterPeopleAppName(appName): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.peopleAppInput);
await BrowserActions.clearSendKeys(this.peopleAppInput, appName);
}
enterGroupAppName(appName) {
BrowserVisibility.waitUntilElementIsVisible(this.groupAppInput);
this.groupAppInput.clear();
this.groupAppInput.sendKeys(appName);
return this;
async enterGroupAppName(appName): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.groupAppInput);
await BrowserActions.clearSendKeys(this.groupAppInput, appName);
}
}
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { element, by, ElementFinder } from 'protractor';
import { BrowserVisibility } from '@alfresco/adf-testing';
import {
ProcessFiltersCloudComponentPage,
@@ -26,74 +26,71 @@ import {
export class ProcessCloudDemoPage {
allProcesses = element(by.css('span[data-automation-id="all-processes_filter"]'));
runningProcesses = element(by.css('span[data-automation-id="running-processes_filter"]'));
completedProcesses = element(by.css('span[data-automation-id="completed-processes_filter"]'));
activeFilter = element(by.css("mat-list-item[class*='active'] span"));
processFilters = element(by.css("mat-expansion-panel[data-automation-id='Process Filters']"));
processFiltersList = element(by.css('adf-cloud-process-filters'));
allProcesses: ElementFinder = element(by.css('span[data-automation-id="all-processes_filter"]'));
runningProcesses: ElementFinder = element(by.css('span[data-automation-id="running-processes_filter"]'));
completedProcesses: ElementFinder = element(by.css('span[data-automation-id="completed-processes_filter"]'));
activeFilter: ElementFinder = element(by.css("mat-list-item[class*='active'] span"));
processFilters: ElementFinder = element(by.css("mat-expansion-panel[data-automation-id='Process Filters']"));
processFiltersList: ElementFinder = element(by.css('adf-cloud-process-filters'));
createButton = element(by.css('button[data-automation-id="create-button"'));
newProcessButton = element(by.css('button[data-automation-id="btn-start-process"]'));
createButton: ElementFinder = element(by.css('button[data-automation-id="create-button"'));
newProcessButton: ElementFinder = element(by.css('button[data-automation-id="btn-start-process"]'));
processListCloud = new ProcessListCloudComponentPage();
editProcessFilterCloud = new EditProcessFilterCloudComponentPage();
editProcessFilterCloudComponent() {
editProcessFilterCloudComponent(): EditProcessFilterCloudComponentPage {
return this.editProcessFilterCloud;
}
processListCloudComponent() {
processListCloudComponent(): ProcessListCloudComponentPage {
return this.processListCloud;
}
getAllRowsByIdColumn() {
getAllRowsByIdColumn(): Promise<any> {
return this.processListCloud.getAllRowsByColumn('Id');
}
allProcessesFilter() {
allProcessesFilter(): ProcessFiltersCloudComponentPage {
return new ProcessFiltersCloudComponentPage(this.allProcesses);
}
runningProcessesFilter() {
runningProcessesFilter(): ProcessFiltersCloudComponentPage {
return new ProcessFiltersCloudComponentPage(this.runningProcesses);
}
completedProcessesFilter() {
completedProcessesFilter(): ProcessFiltersCloudComponentPage {
return new ProcessFiltersCloudComponentPage(this.completedProcesses);
}
customProcessFilter(filterName) {
customProcessFilter(filterName): ProcessFiltersCloudComponentPage {
return new ProcessFiltersCloudComponentPage(element(by.css(`span[data-automation-id="${filterName}_filter"]`)));
}
getActiveFilterName() {
async getActiveFilterName(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.activeFilter);
return BrowserActions.getText(this.activeFilter);
}
clickOnProcessFilters() {
return BrowserActions.click(this.processFilters);
async clickOnProcessFilters(): Promise<void> {
await BrowserActions.click(this.processFilters);
}
openNewProcessForm() {
this.clickOnCreateButton();
this.newProcessButtonIsDisplayed();
BrowserActions.click(this.newProcessButton);
return this;
async openNewProcessForm(): Promise<void> {
await this.clickOnCreateButton();
await this.newProcessButtonIsDisplayed();
await BrowserActions.click(this.newProcessButton);
}
newProcessButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.newProcessButton);
return this;
async newProcessButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.newProcessButton);
}
isProcessFiltersListVisible() {
BrowserVisibility.waitUntilElementIsVisible(this.processFiltersList);
return this;
async isProcessFiltersListVisible(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.processFiltersList);
}
clickOnCreateButton() {
BrowserActions.click(this.createButton);
return this;
async clickOnCreateButton(): Promise<void> {
await BrowserActions.click(this.createButton);
}
}
@@ -17,96 +17,88 @@
import { BrowserVisibility } from '@alfresco/adf-testing';
import { DataTableComponentPage, BrowserActions } from '@alfresco/adf-testing';
import { element, by, protractor } from 'protractor';
import { element, by, protractor, ElementFinder } from 'protractor';
export class ProcessListDemoPage {
appIdInput = element(by.css('input[data-automation-id="app-id"]'));
resetButton = element(by.cssContainingText('button span', 'Reset'));
emptyProcessContent = element(by.css('div[class="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"]'));
stateSelector = element(by.css('mat-select[data-automation-id="state"'));
sortSelector = element(by.css('mat-select[data-automation-id="sort"'));
appIdInput: ElementFinder = element(by.css('input[data-automation-id="app-id"]'));
resetButton: ElementFinder = element(by.cssContainingText('button span', 'Reset'));
emptyProcessContent: ElementFinder = element(by.css('div[class="adf-empty-content"]'));
processDefinitionInput: ElementFinder = element(by.css('input[data-automation-id="process-definition-id"]'));
processInstanceInput: ElementFinder = element(by.css('input[data-automation-id="process-instance-id"]'));
stateSelector: ElementFinder = element(by.css('mat-select[data-automation-id="state"'));
sortSelector: ElementFinder = element(by.css('mat-select[data-automation-id="sort"'));
dataTable = new DataTableComponentPage();
dataTable: DataTableComponentPage = new DataTableComponentPage();
getDisplayedProcessesNames() {
getDisplayedProcessesNames(): Promise<any> {
return this.dataTable.getAllRowsColumnValues('Name');
}
selectSorting(sort) {
BrowserActions.click(this.sortSelector);
const sortLocator = element(by.cssContainingText('mat-option span', sort));
BrowserActions.click(sortLocator);
return this;
async selectSorting(sort): Promise<void> {
await BrowserActions.click(this.sortSelector);
const sortLocator: ElementFinder = element(by.cssContainingText('mat-option span', sort));
await BrowserActions.click(sortLocator);
}
selectStateFilter(state) {
BrowserActions.click(this.stateSelector);
const stateLocator = element(by.cssContainingText('mat-option span', state));
BrowserActions.click(stateLocator);
return this;
async selectStateFilter(state): Promise<void> {
await BrowserActions.click(this.stateSelector);
const stateLocator: ElementFinder = element(by.cssContainingText('mat-option span', state));
await BrowserActions.click(stateLocator);
}
addAppId(appId) {
BrowserActions.click(this.appIdInput);
this.appIdInput.sendKeys(protractor.Key.ENTER);
this.appIdInput.clear();
return this.appIdInput.sendKeys(appId);
async addAppId(appId): Promise<void> {
await BrowserActions.click(this.appIdInput);
await this.appIdInput.sendKeys(protractor.Key.ENTER);
await this.appIdInput.clear();
await this.appIdInput.sendKeys(appId);
}
clickResetButton() {
return BrowserActions.click(this.resetButton);
async clickResetButton(): Promise<void> {
await BrowserActions.click(this.resetButton);
}
checkErrorMessageIsDisplayed(error) {
const errorMessage = element(by.cssContainingText('mat-error', error));
BrowserVisibility.waitUntilElementIsVisible(errorMessage);
async checkErrorMessageIsDisplayed(error): Promise<void> {
const errorMessage: ElementFinder = element(by.cssContainingText('mat-error', error));
await BrowserVisibility.waitUntilElementIsVisible(errorMessage);
}
checkNoProcessFoundIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.emptyProcessContent);
async checkNoProcessFoundIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.emptyProcessContent);
}
checkProcessIsNotDisplayed(processName) {
return this.dataTable.checkContentIsNotDisplayed('Name', processName);
async checkProcessIsNotDisplayed(processName): Promise<void> {
await this.dataTable.checkContentIsNotDisplayed('Name', processName);
}
checkProcessIsDisplayed(processName) {
return this.dataTable.checkContentIsDisplayed('Name', processName);
async checkProcessIsDisplayed(processName): Promise<void> {
await this.dataTable.checkContentIsDisplayed('Name', processName);
}
checkAppIdFieldIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.appIdInput);
return this;
async checkAppIdFieldIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.appIdInput);
}
checkProcessInstanceIdFieldIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.processInstanceInput);
return this;
async checkProcessInstanceIdFieldIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.processInstanceInput);
}
checkStateFieldIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.stateSelector);
return this;
async checkStateFieldIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.stateSelector);
}
checkSortFieldIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.sortSelector);
return this;
async checkSortFieldIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.sortSelector);
}
addProcessDefinitionId(procDefinitionId) {
BrowserActions.click(this.processDefinitionInput);
this.processDefinitionInput.clear();
return this.processDefinitionInput.sendKeys(procDefinitionId);
async addProcessDefinitionId(procDefinitionId): Promise<void> {
await BrowserActions.click(this.processDefinitionInput);
await BrowserActions.clearSendKeys(this.processDefinitionInput, procDefinitionId);
}
addProcessInstanceId(procInstanceId) {
BrowserActions.click(this.processInstanceInput);
this.processInstanceInput.clear();
return this.processInstanceInput.sendKeys(procInstanceId);
async addProcessInstanceId(procInstanceId): Promise<void> {
await BrowserActions.click(this.processInstanceInput);
await BrowserActions.clearSendKeys(this.processInstanceInput, procInstanceId);
}
}
@@ -16,22 +16,22 @@
*/
import { BrowserActions } from '@alfresco/adf-testing';
import { element, by } from 'protractor';
import { element, by, ElementFinder } from 'protractor';
import { TaskFiltersPage } from '../../process-services/taskFiltersPage';
export class TaskFiltersDemoPage {
myTasks = element(by.css('span[data-automation-id="My Tasks_filter"]'));
queuedTask = element(by.css('span[data-automation-id="Queued Tasks_filter"]'));
completedTask = element(by.css('span[data-automation-id="Completed Tasks_filter"]'));
involvedTask = element(by.css('span[data-automation-id="Involved Tasks_filter"]'));
activeFilter = element(by.css("mat-list-item[class*='active']"));
myTasks: ElementFinder = element(by.css('span[data-automation-id="My Tasks_filter"]'));
queuedTask: ElementFinder = element(by.css('span[data-automation-id="Queued Tasks_filter"]'));
completedTask: ElementFinder = element(by.css('span[data-automation-id="Completed Tasks_filter"]'));
involvedTask: ElementFinder = element(by.css('span[data-automation-id="Involved Tasks_filter"]'));
activeFilter: ElementFinder = element(by.css("mat-list-item[class*='active']"));
myTasksFilter() {
myTasksFilter(): TaskFiltersPage {
return new TaskFiltersPage(this.myTasks);
}
queuedTasksFilter() {
queuedTasksFilter(): TaskFiltersPage {
return new TaskFiltersPage(this.queuedTask);
}
@@ -39,15 +39,15 @@ export class TaskFiltersDemoPage {
return new TaskFiltersPage(this.completedTask);
}
involvedTasksFilter() {
involvedTasksFilter(): TaskFiltersPage {
return new TaskFiltersPage(this.involvedTask);
}
customTaskFilter(filterName) {
customTaskFilter(filterName): TaskFiltersPage {
return new TaskFiltersPage(element(by.css(`span[data-automation-id="${filterName}_filter"]`)));
}
checkActiveFilterActive () {
async checkActiveFilterActive(): Promise<string> {
return BrowserActions.getText(this.activeFilter);
}
@@ -17,188 +17,153 @@
import { TasksListPage } from '../../process-services/tasksListPage';
import { PaginationPage } from '@alfresco/adf-testing';
import { element, by } from 'protractor';
import { element, by, ElementFinder } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class TaskListDemoPage {
taskListPage: TasksListPage = 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("div[class='adf-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']"));
stateDropDownArrow = element(by.css("mat-form-field[data-automation-id='state'] div[class*='arrow']"));
stateSelector = element(by.css("div[class*='mat-select-panel']"));
sortDropDownArrow = element(by.css("mat-form-field[data-automation-id='sort'] div[class*='arrow']"));
sortSelector = element(by.css("div[class*='mat-select-panel']"));
appId: ElementFinder = element(by.css("input[data-automation-id='appId input']"));
itemsPerPage: ElementFinder = element(by.css("input[data-automation-id='items per page']"));
itemsPerPageForm: ElementFinder = element(by.css("mat-form-field[data-automation-id='items per page']"));
processDefinitionId: ElementFinder = element(by.css("input[data-automation-id='process definition id']"));
processInstanceId: ElementFinder = element(by.css("input[data-automation-id='process instance id']"));
page: ElementFinder = element(by.css("input[data-automation-id='page']"));
pageForm: ElementFinder = element(by.css("mat-form-field[data-automation-id='page']"));
taskName: ElementFinder = element(by.css("input[data-automation-id='task name']"));
resetButton: ElementFinder = element(by.css("div[class='adf-reset-button'] button"));
dueBefore: ElementFinder = element(by.css("input[data-automation-id='due before']"));
dueAfter: ElementFinder = element(by.css("input[data-automation-id='due after']"));
taskId: ElementFinder = element(by.css("input[data-automation-id='task id']"));
stateDropDownArrow: ElementFinder = element(by.css("mat-form-field[data-automation-id='state'] div[class*='arrow']"));
stateSelector: ElementFinder = element(by.css("div[class*='mat-select-panel']"));
taskList(): TasksListPage {
return this.taskListPage;
}
paginationPage() {
paginationPage(): PaginationPage {
return new PaginationPage();
}
typeAppId(input) {
BrowserVisibility.waitUntilElementIsVisible(this.appId);
this.clearText(this.appId);
this.appId.sendKeys(input);
return this;
async typeAppId(input): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.appId);
await BrowserActions.clearSendKeys(this.appId, input);
}
clickAppId() {
BrowserActions.click(this.appId);
return this;
async clickAppId(): Promise<void> {
await BrowserActions.click(this.appId);
}
getAppId() {
BrowserVisibility.waitUntilElementIsVisible(this.appId);
async getAppId(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.appId);
return this.appId.getAttribute('value');
}
typeTaskId(input) {
BrowserVisibility.waitUntilElementIsVisible(this.taskId);
this.clearText(this.taskId);
this.taskId.sendKeys(input);
return this;
async typeTaskId(input): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.taskId);
await BrowserActions.clearSendKeys(this.taskId, input);
}
getTaskId() {
BrowserVisibility.waitUntilElementIsVisible(this.taskId);
async getTaskId(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.taskId);
return this.taskId.getAttribute('value');
}
typeTaskName(input) {
BrowserVisibility.waitUntilElementIsVisible(this.taskName);
this.clearText(this.taskName);
this.taskName.sendKeys(input);
return this;
async typeTaskName(input): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.taskName);
await BrowserActions.clearSendKeys(this.taskName, input);
}
getTaskName() {
BrowserVisibility.waitUntilElementIsVisible(this.taskName);
async getTaskName(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.taskName);
return this.taskName.getAttribute('value');
}
typeItemsPerPage(input) {
BrowserVisibility.waitUntilElementIsVisible(this.itemsPerPage);
this.clearText(this.itemsPerPage);
this.itemsPerPage.sendKeys(input);
return this;
async typeItemsPerPage(input): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.itemsPerPage);
await BrowserActions.clearSendKeys(this.itemsPerPage, input);
}
typeProcessDefinitionId(input) {
BrowserVisibility.waitUntilElementIsVisible(this.processDefinitionId);
this.clearText(this.processDefinitionId);
this.processDefinitionId.sendKeys(input);
return this;
async typeProcessDefinitionId(input): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.processDefinitionId);
await BrowserActions.clearSendKeys(this.processDefinitionId, input);
}
getProcessDefinitionId() {
BrowserVisibility.waitUntilElementIsVisible(this.processInstanceId);
async getProcessDefinitionId(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.processInstanceId);
return this.processInstanceId.getAttribute('value');
}
typeProcessInstanceId(input) {
BrowserVisibility.waitUntilElementIsVisible(this.processInstanceId);
this.clearText(this.processInstanceId);
this.processInstanceId.sendKeys(input);
return this;
async typeProcessInstanceId(input): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.processInstanceId);
await BrowserActions.clearSendKeys(this.processInstanceId, input);
}
getProcessInstanceId() {
BrowserVisibility.waitUntilElementIsVisible(this.processInstanceId);
async getProcessInstanceId(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.processInstanceId);
return this.processInstanceId.getAttribute('value');
}
getItemsPerPageFieldErrorMessage() {
BrowserVisibility.waitUntilElementIsVisible(this.itemsPerPageForm);
async getItemsPerPageFieldErrorMessage(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.itemsPerPageForm);
const errorMessage = this.itemsPerPageForm.element(by.css('mat-error'));
return BrowserActions.getText(errorMessage);
}
typePage(input) {
BrowserVisibility.waitUntilElementIsVisible(this.page);
this.clearText(this.page);
this.page.sendKeys(input);
return this;
async typePage(input): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.page);
await BrowserActions.clearSendKeys(this.page, input);
}
getPage() {
BrowserVisibility.waitUntilElementIsVisible(this.page);
async getPage(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.page);
return this.page.getAttribute('value');
}
getPageFieldErrorMessage() {
BrowserVisibility.waitUntilElementIsVisible(this.pageForm);
async getPageFieldErrorMessage(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.pageForm);
const errorMessage = this.pageForm.element(by.css('mat-error'));
return BrowserActions.getText(errorMessage);
}
typeDueAfter(input) {
BrowserVisibility.waitUntilElementIsVisible(this.dueAfter);
this.clearText(this.dueAfter);
this.dueAfter.sendKeys(input);
return this;
async typeDueAfter(input): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.dueAfter);
await BrowserActions.clearSendKeys(this.dueAfter, input);
}
typeDueBefore(input) {
BrowserVisibility.waitUntilElementIsVisible(this.dueBefore);
this.clearText(this.dueBefore);
this.dueBefore.sendKeys(input);
return this;
async typeDueBefore(input): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.dueBefore);
await BrowserActions.clearSendKeys(this.dueBefore, input);
}
clearText(input) {
BrowserVisibility.waitUntilElementIsVisible(input);
return input.clear();
async clearText(input): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(input);
await input.clear();
}
clickResetButton() {
BrowserActions.closeMenuAndDialogs();
BrowserActions.click(this.resetButton);
async clickResetButton(): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.click(this.resetButton);
}
selectSort(sort) {
this.clickOnSortDropDownArrow();
async selectState(state): Promise<void> {
await this.clickOnStateDropDownArrow();
const sortElement = element.all(by.cssContainingText('mat-option span', sort)).first();
BrowserActions.click(sortElement);
return this;
const stateElement: ElementFinder = element.all(by.cssContainingText('mat-option span', state)).first();
await BrowserActions.click(stateElement);
}
clickOnSortDropDownArrow() {
BrowserActions.click(this.sortDropDownArrow);
BrowserVisibility.waitUntilElementIsVisible(this.sortSelector);
async clickOnStateDropDownArrow(): Promise<void> {
await BrowserActions.click(this.stateDropDownArrow);
await BrowserVisibility.waitUntilElementIsVisible(this.stateSelector);
}
selectState(state) {
this.clickOnStateDropDownArrow();
const stateElement = element.all(by.cssContainingText('mat-option span', state)).first();
BrowserActions.click(stateElement);
return this;
}
clickOnStateDropDownArrow() {
BrowserActions.click(this.stateDropDownArrow);
BrowserVisibility.waitUntilElementIsVisible(this.stateSelector);
}
getAllProcessDefinitionIds() {
getAllProcessDefinitionIds(): Promise<any> {
return this.taskList().getDataTable().getAllRowsColumnValues('Process Definition Id');
}
getAllProcessInstanceIds() {
getAllProcessInstanceIds(): Promise<any> {
return this.taskList().getDataTable().getAllRowsColumnValues('Process Instance Id');
}
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { element, by, browser } from 'protractor';
import { element, by, browser, ElementFinder, ElementArrayFinder } from 'protractor';
import {
FormControllersPage,
TaskFiltersCloudComponentPage,
@@ -27,132 +27,114 @@ import {
export class TasksCloudDemoPage {
myTasks = element(by.css('span[data-automation-id="my-tasks-filter"]'));
completedTasks = element(by.css('span[data-automation-id="completed-tasks-filter"]'));
activeFilter = element(by.css("mat-list-item[class*='active'] span"));
myTasks: ElementFinder = element(by.css('span[data-automation-id="my-tasks-filter"]'));
completedTasks: ElementFinder = element(by.css('span[data-automation-id="completed-tasks-filter"]'));
activeFilter: ElementFinder = element(by.css("mat-list-item[class*='active'] span"));
defaultActiveFilter = element.all(by.css('.adf-filters__entry')).first();
defaultActiveFilter: ElementFinder = element.all(by.css('.adf-filters__entry')).first();
createButton = element(by.css('button[data-automation-id="create-button"'));
newTaskButton = element(by.css('button[data-automation-id="btn-start-task"]'));
settingsButton = element.all(by.cssContainingText('div[class*="mat-tab-label"] .mat-tab-labels div', 'Settings')).first();
appButton = element.all(by.cssContainingText('div[class*="mat-tab-label"] .mat-tab-labels div', 'App')).first();
modeDropDownArrow = element(by.css('mat-form-field[data-automation-id="selectionMode"] div[class*="arrow-wrapper"]'));
modeSelector = element(by.css("div[class*='mat-select-panel']"));
displayTaskDetailsToggle = element(by.css('mat-slide-toggle[data-automation-id="taskDetailsRedirection"]'));
displayProcessDetailsToggle = element(by.css('mat-slide-toggle[data-automation-id="processDetailsRedirection"]'));
multiSelectionToggle = element(by.css('mat-slide-toggle[data-automation-id="multiSelection"]'));
testingModeToggle = element(by.css('mat-slide-toggle[data-automation-id="testingMode"]'));
selectedRows = element(by.xpath("//div[text()=' Selected rows: ']"));
noOfSelectedRows = element.all(by.xpath("//div[text()=' Selected rows: ']//li"));
createButton: ElementFinder = element(by.css('button[data-automation-id="create-button"'));
newTaskButton: ElementFinder = element(by.css('button[data-automation-id="btn-start-task"]'));
settingsButton: ElementFinder = element.all(by.cssContainingText('div[class*="mat-tab-label"] .mat-tab-labels div', 'Settings')).first();
appButton: ElementFinder = element.all(by.cssContainingText('div[class*="mat-tab-label"] .mat-tab-labels div', 'App')).first();
modeDropDownArrow: ElementFinder = element(by.css('mat-form-field[data-automation-id="selectionMode"] div[class*="arrow-wrapper"]'));
modeSelector: ElementFinder = element(by.css("div[class*='mat-select-panel']"));
displayTaskDetailsToggle: ElementFinder = element(by.css('mat-slide-toggle[data-automation-id="taskDetailsRedirection"]'));
displayProcessDetailsToggle: ElementFinder = element(by.css('mat-slide-toggle[data-automation-id="processDetailsRedirection"]'));
multiSelectionToggle: ElementFinder = element(by.css('mat-slide-toggle[data-automation-id="multiSelection"]'));
testingModeToggle: ElementFinder = element(by.css('mat-slide-toggle[data-automation-id="testingMode"]'));
selectedRows: ElementFinder = element(by.xpath("//div[text()=' Selected rows: ']"));
noOfSelectedRows: ElementArrayFinder = element.all(by.xpath("//div[text()=' Selected rows: ']//li"));
formControllersPage = new FormControllersPage();
formControllersPage: FormControllersPage = new FormControllersPage();
editTaskFilterCloud = new EditTaskFilterCloudComponentPage();
editTaskFilterCloud: EditTaskFilterCloudComponentPage = new EditTaskFilterCloudComponentPage();
disableDisplayTaskDetails() {
this.formControllersPage.disableToggle(this.displayTaskDetailsToggle);
return this;
async disableDisplayTaskDetails(): Promise<void> {
await this.formControllersPage.disableToggle(this.displayTaskDetailsToggle);
}
disableDisplayProcessDetails() {
this.formControllersPage.disableToggle(this.displayProcessDetailsToggle);
return this;
async disableDisplayProcessDetails(): Promise<void> {
await this.formControllersPage.disableToggle(this.displayProcessDetailsToggle);
}
enableMultiSelection() {
this.formControllersPage.enableToggle(this.multiSelectionToggle);
return this;
async enableMultiSelection(): Promise<void> {
await this.formControllersPage.enableToggle(this.multiSelectionToggle);
}
enableTestingMode() {
this.formControllersPage.enableToggle(this.testingModeToggle);
return this;
async enableTestingMode(): Promise<void> {
await this.formControllersPage.enableToggle(this.testingModeToggle);
}
taskFiltersCloudComponent(filter) {
return new TaskFiltersCloudComponentPage(filter);
}
taskListCloudComponent() {
taskListCloudComponent(): TaskListCloudComponentPage {
return new TaskListCloudComponentPage();
}
editTaskFilterCloudComponent() {
editTaskFilterCloudComponent(): EditTaskFilterCloudComponentPage {
return this.editTaskFilterCloud;
}
myTasksFilter() {
myTasksFilter(): TaskFiltersCloudComponentPage {
return new TaskFiltersCloudComponentPage(this.myTasks);
}
completedTasksFilter() {
completedTasksFilter(): TaskFiltersCloudComponentPage {
return new TaskFiltersCloudComponentPage(this.completedTasks);
}
getActiveFilterName() {
return BrowserActions.getText(this.activeFilter);
async getActiveFilterName(): Promise<string> {
return await BrowserActions.getText(this.activeFilter);
}
customTaskFilter(filterName) {
customTaskFilter(filterName): TaskFiltersCloudComponentPage {
return new TaskFiltersCloudComponentPage(element(by.css(`span[data-automation-id="${filterName}-filter"]`)));
}
openNewTaskForm() {
BrowserActions.click(this.createButton);
BrowserActions.clickExecuteScript('button[data-automation-id="btn-start-task"]');
return this;
async openNewTaskForm(): Promise<void> {
await BrowserActions.click(this.createButton);
await BrowserActions.clickExecuteScript('button[data-automation-id="btn-start-task"]');
}
clickOnCreateButton() {
BrowserActions.click(this.createButton);
return this;
async firstFilterIsActive(): Promise<boolean> {
const value = await this.defaultActiveFilter.getAttribute('class');
return value.includes('adf-active');
}
firstFilterIsActive() {
return this.defaultActiveFilter.getAttribute('class').then((value) => value.includes('adf-active'));
async clickSettingsButton(): Promise<void> {
await BrowserActions.click(this.settingsButton);
await browser.sleep(400);
await BrowserVisibility.waitUntilElementIsVisible(this.multiSelectionToggle);
await BrowserVisibility.waitUntilElementIsClickable(this.modeDropDownArrow);
}
clickSettingsButton() {
BrowserActions.click(this.settingsButton);
browser.driver.sleep(400);
BrowserVisibility.waitUntilElementIsVisible(this.multiSelectionToggle);
BrowserVisibility.waitUntilElementIsVisible(this.modeDropDownArrow);
BrowserVisibility.waitUntilElementIsClickable(this.modeDropDownArrow);
return this;
async clickAppButton(): Promise<void> {
await BrowserActions.click(this.appButton);
}
clickAppButton() {
BrowserActions.click(this.appButton);
return this;
async selectSelectionMode(mode): Promise<void> {
await this.clickOnSelectionModeDropDownArrow();
const modeElement: ElementFinder = element.all(by.cssContainingText('mat-option span', mode)).first();
await BrowserActions.click(modeElement);
}
selectSelectionMode(mode) {
this.clickOnSelectionModeDropDownArrow();
const modeElement = element.all(by.cssContainingText('mat-option span', mode)).first();
BrowserActions.click(modeElement);
return this;
async clickOnSelectionModeDropDownArrow(): Promise<void> {
await BrowserActions.click(this.modeDropDownArrow);
await BrowserVisibility.waitUntilElementIsVisible(this.modeSelector);
}
clickOnSelectionModeDropDownArrow() {
BrowserActions.click(this.modeDropDownArrow);
BrowserVisibility.waitUntilElementIsVisible(this.modeSelector);
async checkSelectedRowsIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.selectedRows);
}
checkSelectedRowsIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.selectedRows);
return this;
async getNoOfSelectedRows(): Promise<number> {
await this.checkSelectedRowsIsDisplayed();
return await this.noOfSelectedRows.count();
}
getNoOfSelectedRows() {
this.checkSelectedRowsIsDisplayed();
return this.noOfSelectedRows.count();
}
getSelectedTaskRowText(rowNo: string) {
this.checkSelectedRowsIsDisplayed();
const row = element(by.xpath(`//div[text()=' Selected rows: ']//li[${rowNo}]`));
return row.getText();
async getSelectedTaskRowText(rowNo: string): Promise<string> {
await this.checkSelectedRowsIsDisplayed();
const row: ElementFinder = element(by.xpath(`//div[text()=' Selected rows: ']//li[${rowNo}]`));
return await BrowserActions.getText(row);
}
}
+6 -6
View File
@@ -15,20 +15,20 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { by, element, ElementFinder } from 'protractor';
import { BrowserActions, BrowserVisibility } from '@alfresco/adf-testing';
export class SocialPage {
nodeIdField = element(by.css(`input[id="nodeId"]`));
nodeIdField: ElementFinder = element(by.css(`input[id="nodeId"]`));
getNodeIdFieldValue() {
BrowserVisibility.waitUntilElementIsVisible(this.nodeIdField);
async getNodeIdFieldValue(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.nodeIdField);
return this.nodeIdField.getAttribute('value');
}
writeCustomNodeId(nodeId: string) {
return BrowserActions.clearSendKeys(this.nodeIdField, nodeId);
async writeCustomNodeId(nodeId: string): Promise<void> {
await BrowserActions.clearSendKeys(this.nodeIdField, nodeId);
}
}
+75 -78
View File
@@ -15,143 +15,140 @@
* limitations under the License.
*/
import { by, element, browser, protractor } from 'protractor';
import { by, element, browser, protractor, ElementFinder, ElementArrayFinder } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class CreateLibraryDialog {
libraryDialog = element(by.css('[role="dialog"]'));
libraryTitle = element(by.css('.adf-library-dialog>h2'));
libraryNameField = element(by.css('input[formcontrolname="title"]'));
libraryIdField = element(by.css('input[formcontrolname="id"]'));
libraryDescriptionField = element(by.css('textarea[formcontrolname="description"]'));
publicRadioButton = element(by.css('[data-automation-id="PUBLIC"]>label'));
privateRadioButton = element(by.css('[data-automation-id="PRIVATE"]>label'));
moderatedRadioButton = element(by.css('[data-automation-id="MODERATED"]>label'));
cancelButton = element(by.css('button[data-automation-id="cancel-library-id"]'));
createButton = element(by.css('button[data-automation-id="create-library-id"]'));
errorMessage = element(by.css('.mat-dialog-content .mat-error'));
errorMessages = element.all(by.css('.mat-dialog-content .mat-error'));
libraryNameHint = element(by.css('adf-library-dialog .mat-hint'));
libraryDialog: ElementFinder = element(by.css('[role="dialog"]'));
libraryTitle: ElementFinder = element(by.css('.adf-library-dialog>h2'));
libraryNameField: ElementFinder = element(by.css('input[formcontrolname="title"]'));
libraryIdField: ElementFinder = element(by.css('input[formcontrolname="id"]'));
libraryDescriptionField: ElementFinder = element(by.css('textarea[formcontrolname="description"]'));
publicRadioButton: ElementFinder = element(by.css('[data-automation-id="PUBLIC"]>label'));
privateRadioButton: ElementFinder = element(by.css('[data-automation-id="PRIVATE"]>label'));
moderatedRadioButton: ElementFinder = element(by.css('[data-automation-id="MODERATED"]>label'));
cancelButton: ElementFinder = element(by.css('button[data-automation-id="cancel-library-id"]'));
createButton: ElementFinder = element(by.css('button[data-automation-id="create-library-id"]'));
errorMessage: ElementFinder = element(by.css('.mat-dialog-content .mat-error'));
errorMessages: ElementArrayFinder = element.all(by.css('.mat-dialog-content .mat-error'));
libraryNameHint: ElementFinder = element(by.css('adf-library-dialog .mat-hint'));
getSelectedRadio() {
const radio = element(by.css('.mat-radio-button[class*="checked"]'));
return BrowserActions.getText(radio);
async getSelectedRadio(): Promise<string> {
const radio: ElementFinder = element(by.css('.mat-radio-button[class*="checked"]'));
return await BrowserActions.getText(radio);
}
waitForDialogToOpen() {
BrowserVisibility.waitUntilElementIsPresent(this.libraryDialog);
return this;
async waitForDialogToOpen(): Promise<void> {
await BrowserVisibility.waitUntilElementIsPresent(this.libraryDialog);
}
waitForDialogToClose() {
BrowserVisibility.waitUntilElementIsNotOnPage(this.libraryDialog);
return this;
async waitForDialogToClose(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotPresent(this.libraryDialog);
}
isDialogOpen() {
return browser.isElementPresent(this.libraryDialog);
async isDialogOpen(): Promise<any> {
return await browser.isElementPresent(this.libraryDialog);
}
getTitle() {
return BrowserActions.getText(this.libraryTitle);
async getTitle(): Promise<string> {
return await BrowserActions.getText(this.libraryTitle);
}
getLibraryIdText() {
return this.libraryIdField.getAttribute('value');
async getLibraryIdText(): Promise<string> {
return await this.libraryIdField.getAttribute('value');
}
isErrorMessageDisplayed() {
return this.errorMessage.isDisplayed();
async isErrorMessageDisplayed(): Promise<boolean> {
return await this.errorMessage.isDisplayed();
}
getErrorMessage() {
return BrowserActions.getText(this.errorMessage);
async getErrorMessage(): Promise<string> {
return await BrowserActions.getText(this.errorMessage);
}
getErrorMessages(position) {
return BrowserActions.getText(this.errorMessages.get(position));
async getErrorMessages(position): Promise<string> {
return await BrowserActions.getText(this.errorMessages.get(position));
}
waitForLibraryNameHint() {
BrowserVisibility.waitUntilElementIsVisible(this.libraryNameHint);
return this;
async waitForLibraryNameHint(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.libraryNameHint);
}
getLibraryNameHint() {
return BrowserActions.getText(this.libraryNameHint);
async getLibraryNameHint(): Promise<string> {
return await BrowserActions.getText(this.libraryNameHint);
}
isNameDisplayed() {
return this.libraryNameField.isDisplayed();
async isNameDisplayed(): Promise<boolean> {
return await this.libraryNameField.isDisplayed();
}
isLibraryIdDisplayed() {
return this.libraryIdField.isDisplayed();
async isLibraryIdDisplayed(): Promise<boolean> {
return await this.libraryIdField.isDisplayed();
}
isDescriptionDisplayed() {
return this.libraryDescriptionField.isDisplayed();
async isDescriptionDisplayed(): Promise<boolean> {
return await this.libraryDescriptionField.isDisplayed();
}
isPublicDisplayed() {
return this.publicRadioButton.isDisplayed();
async isPublicDisplayed(): Promise<boolean> {
return await this.publicRadioButton.isDisplayed();
}
isModeratedDisplayed() {
return this.moderatedRadioButton.isDisplayed();
async isModeratedDisplayed(): Promise<boolean> {
return await this.moderatedRadioButton.isDisplayed();
}
isPrivateDisplayed() {
return this.privateRadioButton.isDisplayed();
async isPrivateDisplayed(): Promise<boolean> {
return await this.privateRadioButton.isDisplayed();
}
isCreateEnabled() {
return this.createButton.isEnabled();
async isCreateEnabled(): Promise<boolean> {
return await this.createButton.isEnabled();
}
isCancelEnabled() {
return this.cancelButton.isEnabled();
async isCancelEnabled(): Promise<boolean> {
return await this.cancelButton.isEnabled();
}
clickCreate() {
BrowserActions.click(this.createButton);
async clickCreate(): Promise<void> {
await BrowserActions.click(this.createButton);
}
clickCancel() {
BrowserActions.click(this.cancelButton);
async clickCancel(): Promise<void> {
await BrowserActions.click(this.cancelButton);
}
typeLibraryName(libraryName: string) {
BrowserActions.clearSendKeys(this.libraryNameField, libraryName);
async typeLibraryName(libraryName: string): Promise<void> {
await BrowserActions.clearSendKeys(this.libraryNameField, libraryName);
}
typeLibraryId(libraryId) {
BrowserActions.clearSendKeys(this.libraryIdField, libraryId);
async typeLibraryId(libraryId): Promise<void> {
await BrowserActions.clearSendKeys(this.libraryIdField, libraryId);
}
typeLibraryDescription(libraryDescription) {
BrowserActions.clearSendKeys(this.libraryDescriptionField, libraryDescription);
async typeLibraryDescription(libraryDescription): Promise<void> {
await BrowserActions.clearSendKeys(this.libraryDescriptionField, libraryDescription);
}
clearLibraryName() {
this.libraryNameField.clear();
this.libraryNameField.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE);
async clearLibraryName(): Promise<void> {
await this.libraryNameField.clear();
await this.libraryNameField.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE);
}
clearLibraryId() {
this.libraryIdField.clear();
this.libraryIdField.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE);
async clearLibraryId(): Promise<void> {
await this.libraryIdField.clear();
await this.libraryIdField.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE);
}
selectPublic() {
BrowserActions.click(this.publicRadioButton);
async selectPublic(): Promise<void> {
await BrowserActions.click(this.publicRadioButton);
}
selectPrivate() {
BrowserActions.click(this.privateRadioButton);
async selectPrivate(): Promise<void> {
await BrowserActions.click(this.privateRadioButton);
}
selectModerated() {
BrowserActions.click(this.moderatedRadioButton);
async selectModerated(): Promise<void> {
await BrowserActions.click(this.moderatedRadioButton);
}
}
+42 -51
View File
@@ -15,87 +15,78 @@
* limitations under the License.
*/
import { browser, by, element } from 'protractor';
import { by, element, ElementFinder } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class FolderDialog {
folderDialog = element(by.css('adf-folder-dialog'));
folderNameField = this.folderDialog.element(by.id('adf-folder-name-input'));
folderDescriptionField = this.folderDialog.element(by.id('adf-folder-description-input'));
createUpdateButton = this.folderDialog.element(by.id('adf-folder-create-button'));
cancelButton = this.folderDialog.element(by.id('adf-folder-cancel-button'));
folderTitle = this.folderDialog.element((by.css('h2.mat-dialog-title')));
validationMessage = this.folderDialog.element(by.css('div.mat-form-field-subscript-wrapper mat-hint span'));
folderDialog: ElementFinder = element(by.css('adf-folder-dialog'));
folderNameField: ElementFinder = this.folderDialog.element(by.id('adf-folder-name-input'));
folderDescriptionField: ElementFinder = this.folderDialog.element(by.id('adf-folder-description-input'));
createUpdateButton: ElementFinder = this.folderDialog.element(by.id('adf-folder-create-button'));
cancelButton: ElementFinder = this.folderDialog.element(by.id('adf-folder-cancel-button'));
folderTitle: ElementFinder = this.folderDialog.element((by.css('h2.mat-dialog-title')));
validationMessage: ElementFinder = this.folderDialog.element(by.css('div.mat-form-field-subscript-wrapper mat-hint span'));
getDialogTitle() {
return BrowserActions.getText(this.folderTitle);
async getDialogTitle(): Promise<string> {
return await BrowserActions.getText(this.folderTitle);
}
checkFolderDialogIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.folderDialog);
return this;
async checkFolderDialogIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.folderDialog);
}
checkFolderDialogIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotVisible(this.folderDialog);
return this;
async checkFolderDialogIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.folderDialog);
}
clickOnCreateUpdateButton() {
BrowserActions.click(this.createUpdateButton);
async clickOnCreateUpdateButton(): Promise<void> {
await BrowserActions.click(this.createUpdateButton);
}
checkCreateUpdateBtnIsDisabled() {
BrowserActions.checkIsDisabled(this.createUpdateButton);
return this;
async checkCreateUpdateBtnIsDisabled(): Promise<void> {
await BrowserActions.checkIsDisabled(this.createUpdateButton);
}
checkCreateUpdateBtnIsEnabled() {
this.createUpdateButton.isEnabled();
return this;
async clickOnCancelButton(): Promise<void> {
await BrowserActions.click(this.cancelButton);
}
checkCancelBtnIsEnabled() {
this.cancelButton.isEnabled();
return this;
async addFolderName(folderName): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.folderNameField);
await BrowserActions.clearSendKeys(this.folderNameField, folderName);
}
clickOnCancelButton() {
BrowserActions.click(this.cancelButton);
async addFolderDescription(folderDescription): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.folderDescriptionField);
await BrowserActions.clearSendKeys(this.folderDescriptionField, folderDescription);
}
addFolderName(folderName) {
BrowserVisibility.waitUntilElementIsVisible(this.folderNameField);
BrowserActions.clearSendKeys(this.folderNameField, folderName);
browser.driver.sleep(500);
return this;
async getFolderName(): Promise<string> {
return await this.folderNameField.getAttribute('value');
}
addFolderDescription(folderDescription) {
BrowserVisibility.waitUntilElementIsVisible(this.folderDescriptionField);
BrowserActions.clearSendKeys(this.folderDescriptionField, folderDescription);
return this;
async getValidationMessage(): Promise<string> {
return await BrowserActions.getText(this.validationMessage);
}
getFolderName() {
return this.folderNameField.getAttribute('value');
async checkValidationMessageIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.validationMessage);
}
getValidationMessage() {
return BrowserActions.getText(this.validationMessage);
}
checkValidationMessageIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotVisible(this.validationMessage);
return this;
}
getFolderNameField() {
getFolderNameField(): ElementFinder {
return this.folderNameField;
}
getFolderDescriptionField() {
getFolderDescriptionField(): ElementFinder {
return this.folderDescriptionField;
}
async checkCreateUpdateBtnIsEnabled(): Promise<void> {
await this.createUpdateButton.isEnabled();
}
async checkCancelBtnIsEnabled(): Promise<void> {
await this.cancelButton.isEnabled();
}
}
+47 -61
View File
@@ -15,102 +15,88 @@
* limitations under the License.
*/
import { browser, by, element, protractor } from 'protractor';
import { browser, by, element, ElementFinder, Locator, protractor } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class SearchDialog {
searchIcon = element(by.css(`button[class*='adf-search-button']`));
searchBar = element(by.css(`adf-search-control input`));
searchBarExpanded = element(by.css(`adf-search-control mat-form-field[class*="mat-focused"] input`));
noResultMessage = element(by.css(`p[class*='adf-search-fixed-text']`));
rowsAuthor = by.css(`div[class='mat-list-text'] p[class*='adf-search-fixed-text']`);
completeName = by.css(`h4[class*='adf-search-fixed-text']`);
highlightName = by.css(`.adf-highlight`);
searchDialog = element(by.css(`mat-list[id='autocomplete-search-result-list']`));
searchIcon: ElementFinder = element(by.css(`button[class*='adf-search-button']`));
searchBar: ElementFinder = element(by.css(`adf-search-control input`));
searchBarExpanded: ElementFinder = element(by.css(`adf-search-control mat-form-field[class*="mat-focused"] input`));
noResultMessage: ElementFinder = element(by.css(`p[class*='adf-search-fixed-text']`));
rowsAuthor: Locator = by.css(`div[class='mat-list-text'] p[class*='adf-search-fixed-text']`);
completeName: Locator = by.css(`h4[class*='adf-search-fixed-text']`);
highlightName: Locator = by.css(`.adf-highlight`);
searchDialog: ElementFinder = element(by.css(`mat-list[id='autocomplete-search-result-list']`));
pressDownArrowAndEnter() {
element(by.css(`adf-search-control div input`)).sendKeys(protractor.Key.ARROW_DOWN);
return browser.actions().sendKeys(protractor.Key.ENTER).perform();
async pressDownArrowAndEnter(): Promise<void> {
await element(by.css(`adf-search-control div input`)).sendKeys(protractor.Key.ARROW_DOWN);
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
}
clickOnSearchIcon() {
BrowserActions.click(this.searchIcon);
return this;
async clickOnSearchIcon(): Promise<void> {
await BrowserActions.click(this.searchIcon);
}
checkSearchIconIsVisible() {
BrowserVisibility.waitUntilElementIsVisible(this.searchIcon);
return this;
async checkSearchIconIsVisible(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.searchIcon);
}
checkSearchBarIsVisible() {
BrowserVisibility.waitUntilElementIsVisible(this.searchBar);
return this;
async checkSearchBarIsVisible(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.searchBar);
}
checkSearchBarIsNotVisible() {
BrowserVisibility.waitUntilElementIsVisible(this.searchBar);
BrowserVisibility.waitUntilElementIsNotVisible(this.searchBarExpanded);
return this;
async checkSearchBarIsNotVisible(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.searchBarExpanded);
}
checkNoResultMessageIsDisplayed() {
browser.driver.sleep(500);
BrowserVisibility.waitUntilElementIsVisible(this.noResultMessage);
return this;
async checkNoResultMessageIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.noResultMessage);
}
checkNoResultMessageIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotOnPage(this.noResultMessage);
return this;
async checkNoResultMessageIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.noResultMessage);
}
enterText(text) {
BrowserVisibility.waitUntilElementIsVisible(this.searchBar);
BrowserActions.clickExecuteScript('adf-search-control input');
this.searchBar.sendKeys(text);
return this;
async enterText(text): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.searchBar);
await this.searchBar.sendKeys(text);
}
enterTextAndPressEnter(text) {
BrowserVisibility.waitUntilElementIsVisible(this.searchBar);
BrowserActions.clickExecuteScript('adf-search-control input');
this.searchBar.sendKeys(text);
this.searchBar.sendKeys(protractor.Key.ENTER);
return this;
async enterTextAndPressEnter(text): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.searchBar);
await this.searchBar.sendKeys(text);
await this.searchBar.sendKeys(protractor.Key.ENTER);
}
resultTableContainsRow(name) {
BrowserVisibility.waitUntilElementIsVisible(this.searchDialog);
BrowserVisibility.waitUntilElementIsVisible(this.getRowByRowName(name));
return this;
async resultTableContainsRow(name): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.searchDialog);
await BrowserVisibility.waitUntilElementIsVisible(this.getRowByRowName(name));
}
clickOnSpecificRow(name) {
this.resultTableContainsRow(name);
this.getRowByRowName(name).click();
return this;
async clickOnSpecificRow(name): Promise<void> {
await this.resultTableContainsRow(name);
await BrowserActions.click(this.getRowByRowName(name));
}
getRowByRowName(name) {
getRowByRowName(name): ElementFinder {
return element(by.css(`mat-list-item[data-automation-id='autocomplete_for_${name}']`));
}
getSpecificRowsHighlightName(name) {
return BrowserActions.getText(this.getRowByRowName(name).element(this.highlightName));
async getSpecificRowsHighlightName(name): Promise<string> {
return await BrowserActions.getText(this.getRowByRowName(name).element(this.highlightName));
}
getSpecificRowsCompleteName(name) {
return BrowserActions.getText(this.getRowByRowName(name).element(this.completeName));
async getSpecificRowsCompleteName(name): Promise<string> {
return await BrowserActions.getText(this.getRowByRowName(name).element(this.completeName));
}
getSpecificRowsAuthor(name) {
return BrowserActions.getText(this.getRowByRowName(name).element(this.rowsAuthor));
async getSpecificRowsAuthor(name): Promise<string> {
return await BrowserActions.getText(this.getRowByRowName(name).element(this.rowsAuthor));
}
clearText() {
BrowserVisibility.waitUntilElementIsVisible(this.searchBar);
return this.searchBar.clear();
async clearText(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.searchBar);
await this.searchBar.clear();
}
}
+63 -73
View File
@@ -15,129 +15,119 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { element, by, ElementFinder } from 'protractor';
import { BrowserVisibility, FormControllersPage, BrowserActions } from '@alfresco/adf-testing';
import moment = require('moment');
export class ShareDialog {
formControllersPage = new FormControllersPage();
shareDialog = element(by.css('adf-share-dialog'));
dialogTitle = element(by.css('[data-automation-id="adf-share-dialog-title"]'));
shareToggle = element(by.css('[data-automation-id="adf-share-toggle"] label'));
shareToggleChecked = element(by.css('mat-dialog-container mat-slide-toggle.mat-checked'));
shareToggleDisabled = element(by.css('mat-dialog-container mat-slide-toggle.mat-disabled'));
shareLink = element(by.css('[data-automation-id="adf-share-link"]'));
closeButton = element(by.css('button[data-automation-id="adf-share-dialog-close"]'));
snackBar = element(by.css('simple-snack-bar'));
copySharedLinkButton = element(by.css('.adf-input-action'));
timeDatePickerButton = element(by.css('mat-datetimepicker-toggle button'));
dayPicker = element(by.css('mat-datetimepicker-month-view'));
clockPicker = element(by.css('mat-datetimepicker-clock'));
hoursPicker = element(by.css('.mat-datetimepicker-clock-hours'));
minutePicker = element(by.css('.mat-datetimepicker-clock-minutes'));
expirationDateInput = element(by.css('input[formcontrolname="time"]'));
confirmationDialog = element(by.css('adf-confirm-dialog'));
confirmationCancelButton = element(by.id('adf-confirm-cancel'));
confirmationRemoveButton = element(by.id('adf-confirm-accept'));
shareDialog: ElementFinder = element(by.css('adf-share-dialog'));
dialogTitle: ElementFinder = element(by.css('[data-automation-id="adf-share-dialog-title"]'));
shareToggle: ElementFinder = element(by.css('[data-automation-id="adf-share-toggle"] label'));
shareToggleChecked: ElementFinder = element(by.css('mat-dialog-container mat-slide-toggle.mat-checked'));
shareLink: ElementFinder = element(by.css('[data-automation-id="adf-share-link"]'));
closeButton: ElementFinder = element(by.css('button[data-automation-id="adf-share-dialog-close"]'));
copySharedLinkButton: ElementFinder = element(by.css('.adf-input-action'));
timeDatePickerButton: ElementFinder = element(by.css('mat-datetimepicker-toggle button'));
dayPicker: ElementFinder = element(by.css('mat-datetimepicker-month-view'));
clockPicker: ElementFinder = element(by.css('mat-datetimepicker-clock'));
hoursPicker: ElementFinder = element(by.css('.mat-datetimepicker-clock-hours'));
minutePicker: ElementFinder = element(by.css('.mat-datetimepicker-clock-minutes'));
expirationDateInput: ElementFinder = element(by.css('input[formcontrolname="time"]'));
confirmationDialog: ElementFinder = element(by.css('adf-confirm-dialog'));
confirmationCancelButton: ElementFinder = element(by.id('adf-confirm-cancel'));
confirmationRemoveButton: ElementFinder = element(by.id('adf-confirm-accept'));
checkDialogIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.dialogTitle);
async checkDialogIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.dialogTitle);
}
clickUnShareFile() {
this.formControllersPage.enableToggle(this.shareToggle);
async clickUnShareFile() {
await this.formControllersPage.enableToggle(this.shareToggle);
}
clickConfirmationDialogCancelButton() {
BrowserActions.click(this.confirmationCancelButton);
async clickConfirmationDialogCancelButton(): Promise<void> {
await BrowserActions.click(this.confirmationCancelButton);
}
clickConfirmationDialogRemoveButton() {
BrowserActions.click(this.confirmationRemoveButton);
async clickConfirmationDialogRemoveButton(): Promise<void> {
await BrowserActions.click(this.confirmationRemoveButton);
}
checkShareLinkIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.shareLink);
async checkShareLinkIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.shareLink);
}
getShareLink() {
BrowserVisibility.waitUntilElementIsVisible(this.shareLink);
return this.shareLink.getAttribute('value');
async getShareLink(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.shareLink);
return await this.shareLink.getAttribute('value');
}
clickCloseButton() {
return BrowserActions.click(this.closeButton);
async clickCloseButton(): Promise<void> {
await BrowserActions.click(this.closeButton);
}
clickShareLinkButton() {
return BrowserActions.click(this.copySharedLinkButton);
async clickShareLinkButton(): Promise<void> {
await BrowserActions.click(this.copySharedLinkButton);
}
shareToggleButtonIsChecked() {
BrowserVisibility.waitUntilElementIsPresent(this.shareToggleChecked);
async shareToggleButtonIsChecked(): Promise<void> {
await BrowserVisibility.waitUntilElementIsPresent(this.shareToggleChecked);
}
shareToggleButtonIsDisabled() {
BrowserVisibility.waitUntilElementIsPresent(this.shareToggleDisabled);
async dialogIsClosed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsStale(this.shareDialog);
}
dialogIsClosed() {
BrowserVisibility.waitUntilElementIsStale(this.shareDialog);
async clickDateTimePickerButton(): Promise<void> {
await BrowserActions.click(this.timeDatePickerButton);
}
clickDateTimePickerButton() {
BrowserActions.click(this.timeDatePickerButton);
}
calendarTodayDayIsDisabled() {
async calendarTodayDayIsDisabled(): Promise<void> {
const tomorrow = moment().add(1, 'days').format('D');
if (tomorrow !== '1') {
const today: any = this.dayPicker.element(by.css('.mat-datetimepicker-calendar-body-today')).getText();
BrowserVisibility.waitUntilElementIsPresent(element(by.cssContainingText('.mat-datetimepicker-calendar-body-disabled', today)));
const today = await BrowserActions.getText(this.dayPicker.element(by.css('.mat-datetimepicker-calendar-body-today')));
await BrowserVisibility.waitUntilElementIsPresent(element(by.cssContainingText('.mat-datetimepicker-calendar-body-disabled', today)));
}
}
setDefaultDay() {
BrowserVisibility.waitUntilElementIsVisible(this.dayPicker);
async setDefaultDay(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.dayPicker);
const tomorrow = moment().add(1, 'days').format('LL');
BrowserVisibility.waitUntilElementIsClickable(this.dayPicker.element(by.css(`td[aria-label="${tomorrow}"]`)));
this.dayPicker.element(by.css(`td[aria-label="${tomorrow}"]`)).click();
await BrowserVisibility.waitUntilElementIsClickable(this.dayPicker.element(by.css(`td[aria-label="${tomorrow}"]`)));
await BrowserActions.click(this.dayPicker.element(by.css(`td[aria-label="${tomorrow}"]`)));
}
setDefaultHour() {
async setDefaultHour(): Promise<void> {
const selector = '.mat-datetimepicker-clock-cell:not(.mat-datetimepicker-clock-cell-disabled)';
BrowserVisibility.waitUntilElementIsVisible(this.clockPicker);
BrowserVisibility.waitUntilElementIsVisible(this.hoursPicker);
this.hoursPicker.all(by.css(selector)).first().click();
await BrowserVisibility.waitUntilElementIsVisible(this.clockPicker);
await BrowserVisibility.waitUntilElementIsVisible(this.hoursPicker);
await BrowserActions.click(this.hoursPicker.all(by.css(selector)).first());
}
setDefaultMinutes() {
async setDefaultMinutes() {
const selector = '.mat-datetimepicker-clock-cell:not(.mat-datetimepicker-clock-cell-disabled)';
BrowserVisibility.waitUntilElementIsVisible(this.minutePicker);
this.minutePicker.all(by.css(selector)).first().click();
await BrowserVisibility.waitUntilElementIsVisible(this.minutePicker);
await BrowserActions.click(this.minutePicker.all(by.css(selector)).first());
}
dateTimePickerDialogIsClosed() {
BrowserVisibility.waitUntilElementIsStale(element(by.css('mat-datetimepicker-content')));
async dateTimePickerDialogIsClosed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsStale(element(by.css('mat-datetimepicker-content')));
}
getExpirationDate() {
return this.expirationDateInput.getAttribute('value');
async getExpirationDate(): Promise<string> {
return await this.expirationDateInput.getAttribute('value');
}
expirationDateInputHasValue(value) {
BrowserVisibility.waitUntilElementHasValue(this.expirationDateInput, value);
async expirationDateInputHasValue(value): Promise<void> {
await BrowserVisibility.waitUntilElementHasValue(this.expirationDateInput, value);
}
confirmationDialogIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.confirmationDialog);
}
confirmationDialogIsNotDisplayed() {
return BrowserVisibility.waitUntilElementIsNotVisible(this.confirmationDialog);
async confirmationDialogIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.confirmationDialog);
}
}
+78 -110
View File
@@ -15,176 +15,144 @@
* limitations under the License.
*/
import { element, by, protractor, browser } from 'protractor';
import { element, by, browser, ElementFinder, Locator } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class UploadDialog {
closeButton = element((by.css('footer[class*="upload-dialog__actions"] button[id="adf-upload-dialog-close"]')));
dialog = element(by.css('div[id="upload-dialog"]'));
minimizedDialog = element(by.css('div[class*="upload-dialog--minimized"]'));
uploadedStatusIcon = by.css('mat-icon[class*="status--done"]');
cancelledStatusIcon = by.css('div[class*="status--cancelled"]');
closeButton: ElementFinder = element((by.css('footer[class*="upload-dialog__actions"] button[id="adf-upload-dialog-close"]')));
dialog: ElementFinder = element(by.css('div[id="upload-dialog"]'));
minimizedDialog: ElementFinder = element(by.css('div[class*="upload-dialog--minimized"]'));
uploadedStatusIcon: Locator = by.css('mat-icon[class*="status--done"]');
cancelledStatusIcon: Locator = by.css('div[class*="status--cancelled"]');
errorStatusIcon = by.css('div[class*="status--error"] mat-icon');
errorTooltip = element(by.css('div.mat-tooltip'));
errorTooltip: ElementFinder = element(by.css('div.mat-tooltip'));
rowByRowName = by.xpath('ancestor::adf-file-uploading-list-row');
title = element(by.css('span[class*="upload-dialog__title"]'));
minimizeButton = element(by.css('mat-icon[title="Minimize"]'));
maximizeButton = element(by.css('mat-icon[title="Maximize"]'));
canUploadConfirmationTitle = element(by.css('p[class="upload-dialog__confirmation--title"]'));
canUploadConfirmationDescription = element(by.css('p[class="upload-dialog__confirmation--text"]'));
confirmationDialogNoButton = element(by.partialButtonText('No'));
confirmationDialogYesButton = element(by.partialButtonText('Yes'));
cancelUploadsElement = element((by.css('footer[class*="upload-dialog__actions"] button[id="adf-upload-dialog-cancel-all"]')));
title: ElementFinder = element(by.css('span[class*="upload-dialog__title"]'));
minimizeButton: ElementFinder = element(by.css('mat-icon[title="Minimize"]'));
maximizeButton: ElementFinder = element(by.css('mat-icon[title="Maximize"]'));
canUploadConfirmationTitle: ElementFinder = element(by.css('p[class="upload-dialog__confirmation--title"]'));
canUploadConfirmationDescription: ElementFinder = element(by.css('p[class="upload-dialog__confirmation--text"]'));
confirmationDialogNoButton: ElementFinder = element(by.partialButtonText('No'));
confirmationDialogYesButton: ElementFinder = element(by.partialButtonText('Yes'));
cancelUploadsElement: ElementFinder = element((by.css('footer[class*="upload-dialog__actions"] button[id="adf-upload-dialog-cancel-all"]')));
clickOnCloseButton() {
this.checkCloseButtonIsDisplayed();
BrowserActions.click(this.closeButton);
return this;
async clickOnCloseButton(): Promise<void> {
await this.checkCloseButtonIsDisplayed();
await BrowserActions.clickExecuteScript('footer[class*="upload-dialog__actions"] button[id="adf-upload-dialog-close"]');
}
checkCloseButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.closeButton);
return this;
async checkCloseButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.closeButton);
}
dialogIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.dialog);
return this;
async dialogIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.dialog);
}
dialogIsMinimized() {
BrowserVisibility.waitUntilElementIsVisible(this.minimizedDialog);
return this;
async dialogIsMinimized(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.minimizedDialog);
}
dialogIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotOnPage(this.dialog);
return this;
async dialogIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.dialog);
}
getRowsName(content) {
const row = element.all(by.css(`div[class*='uploading-row'] span[title="${content}"]`)).first();
BrowserVisibility.waitUntilElementIsVisible(row);
const row: ElementFinder = element.all(by.css(`div[class*='uploading-row'] span[title="${content}"]`)).first();
return row;
}
getRowByRowName(content) {
return this.getRowsName(content).element(this.rowByRowName);
const rows = this.getRowsName(content);
return rows.element(this.rowByRowName);
}
fileIsUploaded(content) {
BrowserVisibility.waitUntilElementIsVisible(this.getRowByRowName(content).element(this.uploadedStatusIcon));
return this;
async fileIsUploaded(content): Promise<void> {
const row = await this.getRowByRowName(content);
await BrowserVisibility.waitUntilElementIsVisible(row.element(this.uploadedStatusIcon));
}
fileIsError(content) {
BrowserVisibility.waitUntilElementIsVisible(this.getRowByRowName(content).element(this.errorStatusIcon));
return this;
async fileIsError(content) {
const row = await this.getRowByRowName(content);
await BrowserVisibility.waitUntilElementIsVisible(row.element(this.errorStatusIcon));
}
filesAreUploaded(content) {
async filesAreUploaded(content): Promise<void> {
for (let i = 0; i < content.length; i++) {
this.fileIsUploaded(content[i]);
await this.fileIsUploaded(content[i]);
}
return this;
}
fileIsNotDisplayedInDialog(content) {
BrowserVisibility.waitUntilElementIsNotVisible(element(by.css(`div[class*='uploading-row'] span[title="${content}"]`)));
return this;
async fileIsNotDisplayedInDialog(content): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(element(by.css(`div[class*='uploading-row'] span[title="${content}"]`)));
}
cancelUploads() {
BrowserActions.click(this.cancelUploadsElement);
return this;
async cancelUploads(): Promise<void> {
await BrowserActions.click(this.cancelUploadsElement);
}
fileIsCancelled(content) {
BrowserVisibility.waitUntilElementIsVisible(this.getRowByRowName(content).element(this.cancelledStatusIcon));
return this;
async fileIsCancelled(content): Promise<void> {
const row = await this.getRowByRowName(content);
await BrowserVisibility.waitUntilElementIsVisible(row.element(this.cancelledStatusIcon));
}
removeUploadedFile(content) {
BrowserVisibility.waitUntilElementIsVisible(this.getRowByRowName(content).element(this.uploadedStatusIcon));
this.getRowByRowName(content).element(this.uploadedStatusIcon).click();
return this;
async removeUploadedFile(content): Promise<void> {
const row = await this.getRowByRowName(content);
await BrowserVisibility.waitUntilElementIsVisible(row.element(this.uploadedStatusIcon));
const elementRow = await this.getRowByRowName(content);
await BrowserActions.click(elementRow.element(this.uploadedStatusIcon));
}
getTitleText() {
BrowserVisibility.waitUntilElementIsVisible(this.title);
const deferred = protractor.promise.defer();
this.title.getText().then((text) => {
deferred.fulfill(text);
});
return deferred.promise;
async getTitleText(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.title);
return await this.title.getText();
}
getConfirmationDialogTitleText() {
BrowserVisibility.waitUntilElementIsVisible(this.canUploadConfirmationTitle);
const deferred = protractor.promise.defer();
this.canUploadConfirmationTitle.getText().then((text) => {
deferred.fulfill(text);
});
return deferred.promise;
async getConfirmationDialogTitleText(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.canUploadConfirmationTitle);
return this.canUploadConfirmationTitle.getText();
}
getConfirmationDialogDescriptionText() {
BrowserVisibility.waitUntilElementIsVisible(this.canUploadConfirmationDescription);
const deferred = protractor.promise.defer();
this.canUploadConfirmationDescription.getText().then((text) => {
deferred.fulfill(text);
});
return deferred.promise;
async getConfirmationDialogDescriptionText(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.canUploadConfirmationDescription);
return this.canUploadConfirmationDescription.getText();
}
clickOnConfirmationDialogYesButton() {
BrowserActions.click(this.confirmationDialogYesButton);
return this;
async clickOnConfirmationDialogYesButton(): Promise<void> {
await BrowserActions.click(this.confirmationDialogYesButton);
}
clickOnConfirmationDialogNoButton() {
BrowserActions.click(this.confirmationDialogNoButton);
return this;
async clickOnConfirmationDialogNoButton(): Promise<void> {
await BrowserActions.click(this.confirmationDialogNoButton);
}
async checkUploadCompleted() {
return (await this.numberOfCurrentFilesUploaded()) === (await this.numberOfInitialFilesUploaded());
async numberOfCurrentFilesUploaded(): Promise<string> {
const text = await this.getTitleText();
return text.split('Uploaded ')[1].split(' / ')[0];
}
numberOfCurrentFilesUploaded() {
const deferred = protractor.promise.defer();
this.getTitleText().then((text: any) => {
deferred.fulfill(text.split('Uploaded ')[1].split(' / ')[0]);
});
return deferred.promise;
async numberOfInitialFilesUploaded(): Promise<string> {
const text = await this.getTitleText();
return text.split('Uploaded ')[1].split(' / ')[1];
}
numberOfInitialFilesUploaded() {
const deferred = protractor.promise.defer();
this.getTitleText().then((text: any) => {
deferred.fulfill(text.split('Uploaded ')[1].split(' / ')[1]);
});
return deferred.promise;
async minimizeUploadDialog(): Promise<void> {
await BrowserActions.click(this.minimizeButton);
}
minimizeUploadDialog() {
BrowserActions.click(this.minimizeButton);
return this;
async maximizeUploadDialog(): Promise<void> {
await BrowserActions.click(this.maximizeButton);
}
maximizeUploadDialog() {
BrowserActions.click(this.maximizeButton);
return this;
async displayTooltip(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(this.errorStatusIcon));
await browser.actions().mouseMove(element(this.errorStatusIcon)).perform();
}
displayTooltip() {
BrowserVisibility.waitUntilElementIsVisible(element(this.errorStatusIcon));
browser.actions().mouseMove(element(this.errorStatusIcon)).perform();
}
getTooltip() {
return BrowserActions.getText(this.errorTooltip);
async getTooltip(): Promise<string> {
return await BrowserActions.getText(this.errorTooltip);
}
}
+55 -77
View File
@@ -15,119 +15,97 @@
* limitations under the License.
*/
import { browser, by, element, protractor } from 'protractor';
import { BrowserVisibility, FormControllersPage } from '@alfresco/adf-testing';
import { browser, by, element, ElementFinder } from 'protractor';
import { BrowserActions, BrowserVisibility, FormControllersPage } from '@alfresco/adf-testing';
export class UploadToggles {
formControllersPage = new FormControllersPage();
multipleFileUploadToggle = element(by.id('adf-multiple-upload-switch'));
uploadFolderToggle = element(by.id('adf-folder-upload-switch'));
extensionFilterToggle = element(by.id('adf-extension-filter-upload-switch'));
maxSizeToggle = element(by.id('adf-max-size-filter-upload-switch'));
versioningToggle = element(by.id('adf-version-upload-switch'));
extensionAcceptedField = element(by.css('input[data-automation-id="accepted-files-type"]'));
maxSizeField = element(by.css('input[data-automation-id="max-files-size"]'));
disableUploadCheckbox = element(by.css('[id="adf-disable-upload"]'));
formControllersPage: FormControllersPage = new FormControllersPage();
multipleFileUploadToggle: ElementFinder = element(by.id('adf-multiple-upload-switch'));
uploadFolderToggle: ElementFinder = element(by.id('adf-folder-upload-switch'));
extensionFilterToggle: ElementFinder = element(by.id('adf-extension-filter-upload-switch'));
maxSizeToggle: ElementFinder = element(by.id('adf-max-size-filter-upload-switch'));
versioningToggle: ElementFinder = element(by.id('adf-version-upload-switch'));
extensionAcceptedField: ElementFinder = element(by.css('input[data-automation-id="accepted-files-type"]'));
maxSizeField: ElementFinder = element(by.css('input[data-automation-id="max-files-size"]'));
disableUploadCheckbox: ElementFinder = element(by.css('[id="adf-disable-upload"]'));
enableMultipleFileUpload() {
browser.executeScript('arguments[0].scrollIntoView()', this.multipleFileUploadToggle);
this.formControllersPage.enableToggle(this.multipleFileUploadToggle);
return this;
async enableMultipleFileUpload(): Promise<void> {
await browser.executeScript('arguments[0].scrollIntoView()', this.multipleFileUploadToggle);
await this.formControllersPage.enableToggle(this.multipleFileUploadToggle);
}
disableMultipleFileUpload() {
this.formControllersPage.disableToggle(this.multipleFileUploadToggle);
return this;
async disableMultipleFileUpload(): Promise<void> {
await browser.executeScript('arguments[0].scrollIntoView()', this.multipleFileUploadToggle);
await this.formControllersPage.disableToggle(this.multipleFileUploadToggle);
}
enableFolderUpload() {
this.formControllersPage.enableToggle(this.uploadFolderToggle);
return this;
async enableFolderUpload(): Promise<void> {
await this.formControllersPage.enableToggle(this.uploadFolderToggle);
}
checkFolderUploadToggleIsEnabled() {
const enabledToggle = element(by.css('mat-slide-toggle[id="adf-folder-upload-switch"][class*="mat-checked"]'));
BrowserVisibility.waitUntilElementIsVisible(enabledToggle);
return this;
async checkMultipleFileUploadToggleIsEnabled(): Promise<void> {
const enabledToggle: ElementFinder = element(by.css('mat-slide-toggle[id="adf-multiple-upload-switch"][class*="mat-checked"]'));
await BrowserVisibility.waitUntilElementIsVisible(enabledToggle);
}
checkMultipleFileUploadToggleIsEnabled() {
const enabledToggle = element(by.css('mat-slide-toggle[id="adf-multiple-upload-switch"][class*="mat-checked"]'));
BrowserVisibility.waitUntilElementIsVisible(enabledToggle);
return this;
async checkMaxSizeToggleIsEnabled(): Promise<void> {
const enabledToggle: ElementFinder = element(by.css('mat-slide-toggle[id="adf-max-size-filter-upload-switch"][class*="mat-checked"]'));
await BrowserVisibility.waitUntilElementIsVisible(enabledToggle);
}
checkMaxSizeToggleIsEnabled() {
const enabledToggle = element(by.css('mat-slide-toggle[id="adf-max-size-filter-upload-switch"][class*="mat-checked"]'));
BrowserVisibility.waitUntilElementIsVisible(enabledToggle);
return this;
async checkVersioningToggleIsEnabled(): Promise<void> {
const enabledToggle: ElementFinder = element(by.css('mat-slide-toggle[id="adf-version-upload-switch"][class*="mat-checked"]'));
await BrowserVisibility.waitUntilElementIsVisible(enabledToggle);
}
checkVersioningToggleIsEnabled() {
const enabledToggle = element(by.css('mat-slide-toggle[id="adf-version-upload-switch"][class*="mat-checked"]'));
BrowserVisibility.waitUntilElementIsVisible(enabledToggle);
return this;
async disableFolderUpload(): Promise<void> {
await this.formControllersPage.disableToggle(this.uploadFolderToggle);
}
disableFolderUpload() {
this.formControllersPage.disableToggle(this.uploadFolderToggle);
return this;
async enableExtensionFilter(): Promise<void> {
await browser.executeScript('arguments[0].scrollIntoView()', this.extensionFilterToggle);
await this.formControllersPage.enableToggle(this.extensionFilterToggle);
}
enableExtensionFilter() {
browser.executeScript('arguments[0].scrollIntoView()', this.extensionFilterToggle);
this.formControllersPage.enableToggle(this.extensionFilterToggle);
return this;
async disableExtensionFilter(): Promise<void> {
await browser.executeScript('arguments[0].scrollIntoView()', this.extensionFilterToggle);
await this.formControllersPage.disableToggle(this.extensionFilterToggle);
}
disableExtensionFilter() {
browser.executeScript('arguments[0].scrollIntoView()', this.extensionFilterToggle);
this.formControllersPage.disableToggle(this.extensionFilterToggle);
return this;
async enableMaxSize(): Promise<void> {
await this.formControllersPage.enableToggle(this.maxSizeToggle);
}
enableMaxSize() {
this.formControllersPage.enableToggle(this.maxSizeToggle);
return this;
async disableMaxSize(): Promise<void> {
await this.formControllersPage.disableToggle(this.maxSizeToggle);
}
disableMaxSize() {
this.formControllersPage.disableToggle(this.maxSizeToggle);
return this;
async enableVersioning(): Promise<void> {
await this.formControllersPage.enableToggle(this.versioningToggle);
}
enableVersioning() {
this.formControllersPage.enableToggle(this.versioningToggle);
return this;
async disableVersioning(): Promise<void> {
await this.formControllersPage.disableToggle(this.versioningToggle);
}
disableVersioning() {
this.formControllersPage.disableToggle(this.versioningToggle);
return this;
async clickCheckboxDisableUpload(): Promise<void> {
await BrowserActions.click(this.disableUploadCheckbox);
}
clickCheckboxDisableUpload() {
return this.disableUploadCheckbox.click();
async addExtension(extension): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.extensionAcceptedField);
await this.extensionAcceptedField.sendKeys(',' + extension);
}
addExtension(extension) {
BrowserVisibility.waitUntilElementIsVisible(this.extensionAcceptedField);
this.extensionAcceptedField.sendKeys(',' + extension);
async addMaxSize(size): Promise<void> {
await this.clearText();
await this.maxSizeField.sendKeys(size);
}
addMaxSize(size) {
this.clearText();
this.maxSizeField.sendKeys(size);
}
clearText() {
BrowserVisibility.waitUntilElementIsVisible(this.maxSizeField);
const deferred = protractor.promise.defer();
this.maxSizeField.clear().then(() => {
this.maxSizeField.sendKeys(protractor.Key.ESCAPE);
});
return deferred.promise;
async clearText(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.maxSizeField);
await BrowserActions.clearSendKeys(this.maxSizeField, '');
}
}
+21 -3
View File
@@ -15,15 +15,33 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { browser, by, element, ElementFinder } from 'protractor';
export class IconsPage {
locateCustomIcon(name) {
locateCustomIcon(name): ElementFinder {
return element(by.css(`adf-icon[value='${name}'] svg`));
}
locateLigatureIcon(name) {
locateLigatureIcon(name): ElementFinder {
return element(by.css(`adf-icon[value='${name}'] .material-icons`));
}
async isCustomIconDisplayed(name) {
const present = await browser.isElementPresent(this.locateCustomIcon(name));
if (present) {
return await this.locateCustomIcon(name).isDisplayed();
} else {
return false;
}
}
async isLigatureIconDisplayed(name) {
const present = await browser.isElementPresent(this.locateLigatureIcon(name));
if (present) {
return await this.locateLigatureIcon(name).isDisplayed();
} else {
return false;
}
}
}
+20 -20
View File
@@ -15,42 +15,42 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { element, by, ElementFinder } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class LockFilePage {
cancelButton = element(by.css('button[data-automation-id="lock-dialog-btn-cancel"]'));
saveButton = element(by.cssContainingText('button span', 'Save'));
lockFileCheckboxText = element(by.cssContainingText('mat-checkbox label span', ' Lock file '));
lockFileCheckbox = element(by.css('mat-checkbox[data-automation-id="adf-lock-node-checkbox"]'));
allowOwnerCheckbox = element(by.cssContainingText('mat-checkbox[class*="adf-lock-file-name"] span', ' Allow the owner to modify this file '));
cancelButton: ElementFinder = element(by.css('button[data-automation-id="lock-dialog-btn-cancel"]'));
saveButton: ElementFinder = element(by.cssContainingText('button span', 'Save'));
lockFileCheckboxText: ElementFinder = element(by.cssContainingText('mat-checkbox label span', ' Lock file '));
lockFileCheckbox: ElementFinder = element(by.css('mat-checkbox[data-automation-id="adf-lock-node-checkbox"]'));
allowOwnerCheckbox: ElementFinder = element(by.cssContainingText('mat-checkbox[class*="adf-lock-file-name"] span', ' Allow the owner to modify this file '));
checkLockFileCheckboxIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.lockFileCheckboxText);
async checkLockFileCheckboxIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.lockFileCheckboxText);
}
checkCancelButtonIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.cancelButton);
async checkCancelButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.cancelButton);
}
checkSaveButtonIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.saveButton);
async checkSaveButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.saveButton);
}
clickCancelButton() {
BrowserActions.click(this.cancelButton);
async clickCancelButton(): Promise<void> {
await BrowserActions.click(this.cancelButton);
}
clickLockFileCheckbox() {
BrowserActions.click(this.lockFileCheckbox);
async clickLockFileCheckbox(): Promise<void> {
await BrowserActions.click(this.lockFileCheckbox);
}
clickSaveButton() {
BrowserActions.click(this.saveButton);
async clickSaveButton(): Promise<void> {
await BrowserActions.click(this.saveButton);
}
clickAllowOwnerCheckbox() {
BrowserActions.click(this.allowOwnerCheckbox);
async clickAllowOwnerCheckbox(): Promise<void> {
await BrowserActions.click(this.allowOwnerCheckbox);
}
}
+140 -156
View File
@@ -15,256 +15,240 @@
* limitations under the License.
*/
import { browser, by, element, promise } from 'protractor';
import { by, element, ElementFinder } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class MetadataViewPage {
title = element(by.css(`div[info-drawer-title]`));
expandedAspect = element(by.css(`mat-expansion-panel-header[aria-expanded='true']`));
title: ElementFinder = element(by.css(`div[info-drawer-title]`));
expandedAspect: ElementFinder = element(by.css(`mat-expansion-panel-header[aria-expanded='true']`));
aspectTitle = by.css(`mat-panel-title`);
name = element(by.css(`span[data-automation-id='card-textitem-value-name'] span`));
creator = element(by.css(`span[data-automation-id='card-textitem-value-createdByUser.displayName'] span`));
createdDate = element(by.css(`span[data-automation-id='card-dateitem-createdAt'] span`));
modifier = element(by.css(`span[data-automation-id='card-textitem-value-modifiedByUser.displayName'] span`));
modifiedDate = element(by.css(`span[data-automation-id='card-dateitem-modifiedAt'] span`));
mimetypeName = element(by.css(`span[data-automation-id='card-textitem-value-content.mimeTypeName']`));
size = element(by.css(`span[data-automation-id='card-textitem-value-content.sizeInBytes']`));
description = element(by.css(`span[data-automation-id='card-textitem-value-properties.cm:description'] span`));
author = element(by.css(`span[data-automation-id='card-textitem-value-properties.cm:author'] span`));
titleProperty = element(by.css(`span[data-automation-id='card-textitem-value-properties.cm:title'] span`));
editIcon = element(by.css(`button[data-automation-id='meta-data-card-toggle-edit']`));
informationButton = element(by.css(`button[data-automation-id='meta-data-card-toggle-expand']`));
informationSpan = element(by.css(`span[data-automation-id='meta-data-card-toggle-expand-label']`));
informationIcon = element(by.css(`span[data-automation-id='meta-data-card-toggle-expand-label'] ~ mat-icon`));
displayEmptySwitch = element(by.id(`adf-metadata-empty`));
readonlySwitch = element(by.id(`adf-metadata-readonly`));
multiSwitch = element(by.id(`adf-metadata-multi`));
presetSwitch = element(by.id('adf-toggle-custom-preset'));
defaultPropertiesSwitch = element(by.id('adf-metadata-default-properties'));
closeButton = element(by.cssContainingText('button.mat-button span', 'Close'));
displayAspect = element(by.css(`input[placeholder='Display Aspect']`));
applyAspect = element(by.cssContainingText(`button span.mat-button-wrapper`, 'Apply Aspect'));
name: ElementFinder = element(by.css(`span[data-automation-id='card-textitem-value-name'] span`));
creator: ElementFinder = element(by.css(`span[data-automation-id='card-textitem-value-createdByUser.displayName'] span`));
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`));
modifiedDate: ElementFinder = element(by.css(`span[data-automation-id='card-dateitem-modifiedAt'] span`));
mimetypeName: ElementFinder = element(by.css(`span[data-automation-id='card-textitem-value-content.mimeTypeName']`));
size: ElementFinder = element(by.css(`span[data-automation-id='card-textitem-value-content.sizeInBytes']`));
description: ElementFinder = element(by.css(`span[data-automation-id='card-textitem-value-properties.cm:description'] span`));
author: ElementFinder = element(by.css(`span[data-automation-id='card-textitem-value-properties.cm:author'] span`));
titleProperty: ElementFinder = element(by.css(`span[data-automation-id='card-textitem-value-properties.cm:title'] span`));
editIcon: ElementFinder = element(by.css(`button[data-automation-id='meta-data-card-toggle-edit']`));
informationButton: ElementFinder = element(by.css(`button[data-automation-id='meta-data-card-toggle-expand']`));
informationSpan: ElementFinder = element(by.css(`span[data-automation-id='meta-data-card-toggle-expand-label']`));
informationIcon: ElementFinder = element(by.css(`span[data-automation-id='meta-data-card-toggle-expand-label'] ~ mat-icon`));
displayEmptySwitch: ElementFinder = element(by.id(`adf-metadata-empty`));
readonlySwitch: ElementFinder = element(by.id(`adf-metadata-readonly`));
multiSwitch: ElementFinder = element(by.id(`adf-metadata-multi`));
presetSwitch: ElementFinder = element(by.id('adf-toggle-custom-preset'));
defaultPropertiesSwitch: ElementFinder = element(by.id('adf-metadata-default-properties'));
closeButton: ElementFinder = element(by.cssContainingText('button.mat-button span', 'Close'));
displayAspect: ElementFinder = element(by.css(`input[placeholder='Display Aspect']`));
applyAspect: ElementFinder = element(by.cssContainingText(`button span.mat-button-wrapper`, 'Apply Aspect'));
getTitle(): promise.Promise<string> {
return BrowserActions.getText(this.title);
async getTitle(): Promise<string> {
return await BrowserActions.getText(this.title);
}
getExpandedAspectName(): promise.Promise<string> {
return BrowserActions.getText(this.expandedAspect.element(this.aspectTitle));
async getExpandedAspectName(): Promise<string> {
return await BrowserActions.getText(this.expandedAspect.element(this.aspectTitle));
}
getName(): promise.Promise<string> {
return BrowserActions.getText(this.name);
async getName(): Promise<string> {
return await BrowserActions.getText(this.name);
}
getCreator(): promise.Promise<string> {
return BrowserActions.getText(this.creator);
async getCreator(): Promise<string> {
return await BrowserActions.getText(this.creator);
}
getCreatedDate(): promise.Promise<string> {
return BrowserActions.getText(this.createdDate);
async getCreatedDate(): Promise<string> {
return await BrowserActions.getText(this.createdDate);
}
getModifier(): promise.Promise<string> {
return BrowserActions.getText(this.modifier);
async getModifier(): Promise<string> {
return await BrowserActions.getText(this.modifier);
}
getModifiedDate(): promise.Promise<string> {
return BrowserActions.getText(this.modifiedDate);
async getModifiedDate(): Promise<string> {
return await BrowserActions.getText(this.modifiedDate);
}
getMimetypeName(): promise.Promise<string> {
return BrowserActions.getText(this.mimetypeName);
async getMimetypeName(): Promise<string> {
return await BrowserActions.getText(this.mimetypeName);
}
getSize(): promise.Promise<string> {
return BrowserActions.getText(this.size);
async getSize(): Promise<string> {
return await BrowserActions.getText(this.size);
}
getDescription(): promise.Promise<string> {
return BrowserActions.getText(this.description);
async getDescription(): Promise<string> {
return await BrowserActions.getText(this.description);
}
getAuthor(): promise.Promise<string> {
return BrowserActions.getText(this.author);
async getAuthor(): Promise<string> {
return await BrowserActions.getText(this.author);
}
getTitleProperty() {
BrowserActions.getText(this.titleProperty);
async getTitleProperty(): Promise<string> {
return await BrowserActions.getText(this.titleProperty);
}
editIconIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.editIcon);
async editIconIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.editIcon);
}
editIconIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotVisible(this.editIcon);
async editIconIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.editIcon);
}
editIconClick() {
BrowserActions.clickExecuteScript('button[data-automation-id="meta-data-card-toggle-edit"]');
async editIconClick(): Promise<void> {
await BrowserActions.clickExecuteScript('button[data-automation-id="meta-data-card-toggle-edit"]');
}
informationButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.informationButton);
BrowserVisibility.waitUntilElementIsClickable(this.informationButton);
async informationButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsClickable(this.informationButton);
}
informationButtonIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotVisible(this.informationButton);
async informationButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.informationButton);
}
clickOnInformationButton(): MetadataViewPage {
this.informationButtonIsDisplayed();
browser.sleep(600);
BrowserActions.click(this.informationButton);
return this;
async clickOnInformationButton(): Promise<void> {
await BrowserActions.click(this.informationButton);
}
getInformationButtonText(): promise.Promise<string> {
return BrowserActions.getText(this.informationSpan);
async getInformationButtonText(): Promise<string> {
return await BrowserActions.getText(this.informationSpan);
}
getInformationIconText(): promise.Promise<string> {
return BrowserActions.getText(this.informationIcon);
async getInformationIconText(): Promise<string> {
return await BrowserActions.getText(this.informationIcon);
}
clickOnPropertiesTab(): MetadataViewPage {
BrowserActions.closeMenuAndDialogs();
const propertiesTab = element(by.cssContainingText(`.adf-info-drawer-layout-content div.mat-tab-labels div .mat-tab-label-content`, `Properties`));
BrowserActions.click(propertiesTab);
return this;
async clickOnPropertiesTab(): Promise<void> {
const propertiesTab: ElementFinder = element(by.cssContainingText(`.adf-info-drawer-layout-content div.mat-tab-labels div .mat-tab-label-content`, `Properties`));
await BrowserActions.click(propertiesTab);
}
getEditIconTooltip(): promise.Promise<string> {
return this.editIcon.getAttribute('title');
async getEditIconTooltip(): Promise<string> {
return await this.editIcon.getAttribute('title');
}
editPropertyIconIsDisplayed(propertyName: string) {
const editPropertyIcon = element(by.css('mat-icon[data-automation-id="card-textitem-edit-icon-' + propertyName + '"]'));
BrowserVisibility.waitUntilElementIsPresent(editPropertyIcon);
async editPropertyIconIsDisplayed(propertyName: string) {
const editPropertyIcon: ElementFinder = element(by.css('mat-icon[data-automation-id="card-textitem-edit-icon-' + propertyName + '"]'));
await BrowserVisibility.waitUntilElementIsPresent(editPropertyIcon);
}
updatePropertyIconIsDisplayed(propertyName: string) {
const updatePropertyIcon = element(by.css('mat-icon[data-automation-id="card-textitem-update-' + propertyName + '"]'));
BrowserVisibility.waitUntilElementIsVisible(updatePropertyIcon);
async updatePropertyIconIsDisplayed(propertyName: string) {
const updatePropertyIcon: ElementFinder = element(by.css('mat-icon[data-automation-id="card-textitem-update-' + propertyName + '"]'));
await BrowserVisibility.waitUntilElementIsVisible(updatePropertyIcon);
}
clickUpdatePropertyIcon(propertyName: string): promise.Promise<void> {
const updatePropertyIcon = element(by.css('mat-icon[data-automation-id="card-textitem-update-' + propertyName + '"]'));
return BrowserActions.click(updatePropertyIcon);
async clickUpdatePropertyIcon(propertyName: string): Promise<void> {
const updatePropertyIcon: ElementFinder = element(by.css('mat-icon[data-automation-id="card-textitem-update-' + propertyName + '"]'));
await BrowserActions.click(updatePropertyIcon);
}
clickClearPropertyIcon(propertyName: string): promise.Promise<void> {
const clearPropertyIcon = element(by.css('mat-icon[data-automation-id="card-textitem-reset-' + propertyName + '"]'));
return BrowserActions.click(clearPropertyIcon);
async clickClearPropertyIcon(propertyName: string): Promise<void> {
const clearPropertyIcon: ElementFinder = element(by.css('mat-icon[data-automation-id="card-textitem-reset-' + propertyName + '"]'));
await BrowserActions.click(clearPropertyIcon);
}
enterPropertyText(propertyName: string, text: string | number): MetadataViewPage {
const textField = element(by.css('input[data-automation-id="card-textitem-editinput-' + propertyName + '"]'));
BrowserVisibility.waitUntilElementIsVisible(textField);
textField.sendKeys('');
textField.clear();
textField.sendKeys(text);
return this;
async enterPropertyText(propertyName: string, text: string | number): Promise<void> {
const textField: ElementFinder = element(by.css('input[data-automation-id="card-textitem-editinput-' + propertyName + '"]'));
await BrowserVisibility.waitUntilElementIsClickable(textField);
await BrowserActions.clearSendKeys(textField, text.toString());
}
enterPresetText(text: string): MetadataViewPage {
const presetField = element(by.css('input[data-automation-id="adf-text-custom-preset"]'));
BrowserVisibility.waitUntilElementIsVisible(presetField);
presetField.sendKeys('');
presetField.clear();
presetField.sendKeys(text);
const applyButton = element(by.css('button[id="adf-metadata-aplly"]'));
BrowserActions.click(applyButton);
return this;
async enterPresetText(text: string): Promise<void> {
const presetField: ElementFinder = element(by.css('input[data-automation-id="adf-text-custom-preset"]'));
await BrowserVisibility.waitUntilElementIsVisible(presetField);
await BrowserActions.clearSendKeys(presetField, text);
const applyButton: ElementFinder = element(by.css('button[id="adf-metadata-aplly"]'));
await BrowserActions.click(applyButton);
}
enterDescriptionText(text: string): MetadataViewPage {
const textField = element(by.css('textarea[data-automation-id="card-textitem-edittextarea-properties.cm:description"]'));
BrowserVisibility.waitUntilElementIsVisible(textField);
textField.sendKeys('');
textField.clear();
textField.sendKeys(text);
return this;
async enterDescriptionText(text: string): Promise<void> {
const textField: ElementFinder = element(by.css('textarea[data-automation-id="card-textitem-edittextarea-properties.cm:description"]'));
await BrowserVisibility.waitUntilElementIsVisible(textField);
await BrowserActions.clearSendKeys(textField, text);
}
getPropertyText(propertyName: string, type?: string): promise.Promise<string> {
async getPropertyText(propertyName: string, type?: string): Promise<string> {
const propertyType = type || 'textitem';
const textField = element(by.css('span[data-automation-id="card-' + propertyType + '-value-' + propertyName + '"]'));
const textField: ElementFinder = element(by.css('span[data-automation-id="card-' + propertyType + '-value-' + propertyName + '"]'));
return BrowserActions.getText(textField);
return await BrowserActions.getText(textField);
}
clearPropertyIconIsDisplayed(propertyName: string) {
const clearPropertyIcon = element(by.css('mat-icon[data-automation-id="card-textitem-reset-' + propertyName + '"]'));
BrowserVisibility.waitUntilElementIsVisible(clearPropertyIcon);
async clearPropertyIconIsDisplayed(propertyName: string): Promise<void> {
const clearPropertyIcon: ElementFinder = element(by.css('mat-icon[data-automation-id="card-textitem-reset-' + propertyName + '"]'));
await BrowserVisibility.waitUntilElementIsVisible(clearPropertyIcon);
}
clickEditPropertyIcons(propertyName: string) {
const editPropertyIcon = element(by.css('mat-icon[data-automation-id="card-textitem-edit-icon-' + propertyName + '"]'));
BrowserActions.click(editPropertyIcon);
async clickEditPropertyIcons(propertyName: string): Promise<void> {
const editPropertyIcon: ElementFinder = element(by.css('mat-icon[data-automation-id="card-textitem-edit-icon-' + propertyName + '"]'));
await BrowserActions.click(editPropertyIcon);
}
getPropertyIconTooltip(propertyName: string): promise.Promise<string> {
const editPropertyIcon = element(by.css('mat-icon[data-automation-id="card-textitem-edit-icon-' + propertyName + '"]'));
return editPropertyIcon.getAttribute('title');
async getPropertyIconTooltip(propertyName: string): Promise<string> {
const editPropertyIcon: ElementFinder = element(by.css('mat-icon[data-automation-id="card-textitem-edit-icon-' + propertyName + '"]'));
return await editPropertyIcon.getAttribute('title');
}
clickMetadataGroup(groupName: string) {
const group = element(by.css('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"]'));
BrowserActions.click(group);
async clickMetadataGroup(groupName: string): Promise<void> {
const group: ElementFinder = element(by.css('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"]'));
await BrowserActions.click(group);
}
checkMetadataGroupIsPresent(groupName: string): promise.Promise<boolean> {
const group = element(by.css('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"]'));
return BrowserVisibility.waitUntilElementIsVisible(group);
async checkMetadataGroupIsPresent(groupName: string): Promise<void> {
const group: ElementFinder = element(by.css('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"]'));
await BrowserVisibility.waitUntilElementIsVisible(group);
}
checkMetadataGroupIsNotPresent(groupName: string): promise.Promise<any> {
const group = element(by.css('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"]'));
return BrowserVisibility.waitUntilElementIsNotVisible(group);
async checkMetadataGroupIsNotPresent(groupName: string): Promise<void> {
const group: ElementFinder = element(by.css('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"]'));
await BrowserVisibility.waitUntilElementIsNotVisible(group);
}
checkMetadataGroupIsExpand(groupName: string) {
const group = element(by.css('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"] > mat-expansion-panel-header'));
BrowserVisibility.waitUntilElementIsVisible(group);
expect(group.getAttribute('class')).toContain('mat-expanded');
async checkMetadataGroupIsExpand(groupName: string): Promise<void> {
const group: ElementFinder = element(by.css('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"] > mat-expansion-panel-header'));
await BrowserVisibility.waitUntilElementIsVisible(group);
await expect(await group.getAttribute('class')).toContain('mat-expanded');
}
checkMetadataGroupIsNotExpand(groupName: string) {
const group = element(by.css('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"] > mat-expansion-panel-header'));
BrowserVisibility.waitUntilElementIsPresent(group);
expect(group.getAttribute('class')).not.toContain('mat-expanded');
async checkMetadataGroupIsNotExpand(groupName: string): Promise<void> {
const group: ElementFinder = element(by.css('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"] > mat-expansion-panel-header'));
await BrowserVisibility.waitUntilElementIsPresent(group);
await expect(await group.getAttribute('class')).not.toContain('mat-expanded');
}
getMetadataGroupTitle(groupName: string): promise.Promise<string> {
async getMetadataGroupTitle(groupName: string): Promise<string> {
const group = element(by.css('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"] > mat-expansion-panel-header > span > mat-panel-title'));
return BrowserActions.getText(group);
return await BrowserActions.getText(group);
}
checkPropertyIsVisible(propertyName: string, type: string) {
const property = element(by.css('div[data-automation-id="card-' + type + '-label-' + propertyName + '"]'));
BrowserVisibility.waitUntilElementIsVisible(property);
async checkPropertyIsVisible(propertyName: string, type: string): Promise<void> {
const property: ElementFinder = element(by.css('div[data-automation-id="card-' + type + '-label-' + propertyName + '"]'));
await BrowserVisibility.waitUntilElementIsVisible(property);
}
checkPropertyIsNotVisible(propertyName: string, type: string) {
const property = element(by.css('div[data-automation-id="card-' + type + '-label-' + propertyName + '"]'));
BrowserVisibility.waitUntilElementIsNotVisible(property);
async checkPropertyIsNotVisible(propertyName: string, type: string): Promise<void> {
const property: ElementFinder = element(by.css('div[data-automation-id="card-' + type + '-label-' + propertyName + '"]'));
await BrowserVisibility.waitUntilElementIsNotVisible(property);
}
clickCloseButton() {
BrowserActions.click(this.closeButton);
async clickCloseButton(): Promise<void> {
await BrowserActions.click(this.closeButton);
}
typeAspectName(aspectName) {
BrowserVisibility.waitUntilElementIsVisible(this.displayAspect);
this.displayAspect.clear();
this.displayAspect.sendKeys(aspectName);
async typeAspectName(aspectName): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.displayAspect);
await BrowserActions.clearSendKeys(this.displayAspect, aspectName);
}
clickApplyAspect() {
BrowserActions.click(this.applyAspect);
async clickApplyAspect(): Promise<void> {
await BrowserActions.click(this.applyAspect);
}
}
+139 -122
View File
@@ -23,209 +23,226 @@ import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class NavigationBarPage {
linkListContainer = element(by.css('.adf-sidenav-linklist'));
linkMenuChildrenContainer = element(by.css('.nestedMenu'));
linkListContainer: ElementFinder = element(by.css('.adf-sidenav-linklist'));
linkMenuChildrenContainer: ElementFinder = element(by.css('.nestedMenu'));
dataTableNestedButton = this.linkMenuChildrenContainer.element(by.css('.adf-sidenav-link[data-automation-id="Datatable"]'));
dataTableCopyContentButton = this.linkMenuChildrenContainer.element(by.css('.adf-sidenav-link[data-automation-id="Copy Content"]'));
dataTableDragAndDropButton = this.linkMenuChildrenContainer.element(by.css('.adf-sidenav-link[data-automation-id="Drag and Drop"]'));
processServicesButton = element(by.css('.adf-sidenav-link[data-automation-id="Process Services"]'));
processServicesNestedButton = this.linkMenuChildrenContainer.element(by.css('.adf-sidenav-link[data-automation-id="App"]'));
processServicesCloudHomeButton = this.linkMenuChildrenContainer.element(by.css('.adf-sidenav-link[data-automation-id="Home"]'));
loginButton = element(by.css('.adf-sidenav-link[data-automation-id="Login"]'));
overlayViewerButton = element(by.css('.adf-sidenav-link[data-automation-id="Overlay Viewer"]'));
themeButton = element(by.css('button[data-automation-id="theme menu"]'));
themeMenuContent = element(by.css('div[class*="mat-menu-panel"]'));
logoutButton = element(by.css('.adf-sidenav-link[adf-logout]'));
cardViewButton = element(by.css('.adf-sidenav-link[data-automation-id="CardView"]'));
languageMenuButton = element(by.css('button[data-automation-id="language-menu-button"]'));
appTitle = element(by.css('.adf-app-title'));
menuButton = element(by.css('button[data-automation-id="adf-menu-icon"]'));
themeButton: ElementFinder = element(by.css('button[data-automation-id="theme menu"]'));
themeMenuContent: ElementFinder = element(by.css('div[class*="mat-menu-panel"]'));
languageMenuButton: ElementFinder = element(by.css('button[data-automation-id="language-menu-button"]'));
appTitle: ElementFinder = element(by.css('.adf-app-title'));
menuButton: ElementFinder = element(by.css('button[data-automation-id="adf-menu-icon"]'));
formButton = this.linkMenuChildrenContainer.element(by.css('.adf-sidenav-link[data-automation-id="Form"]'));
peopleGroupCloudButton = this.linkMenuChildrenContainer.element(by.css('.adf-sidenav-link[data-automation-id="People/Group Cloud"]'));
clickMenuButton(title) {
BrowserActions.clickExecuteScript(`.adf-sidenav-link[data-automation-id="${title}"]`);
async clickNavigationBarItem(title): Promise<void> {
const menu = element(by.css(`.adf-sidenav-link[data-automation-id="${title}"]`));
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.click(menu);
}
async clickSocialButton() {
this.clickMenuButton('Social');
async clickHomeButton(): Promise<void> {
await this.clickNavigationBarItem('Home');
}
async clickTagButton() {
this.clickMenuButton('Tag');
async clickContentServicesButton(): Promise<void> {
await this.clickNavigationBarItem('Content Services');
}
async navigateToDatatable() {
this.clickMenuButton('Datatable');
BrowserActions.click(this.dataTableNestedButton);
async clickCardViewButton(): Promise<void> {
await this.clickNavigationBarItem('CardView');
}
async navigateToCopyContentDatatable() {
this.clickMenuButton('Datatable');
BrowserActions.click(this.dataTableCopyContentButton);
async clickHeaderDataButton(): Promise<void> {
await this.clickNavigationBarItem('Header Data');
}
async navigateToDragAndDropDatatable() {
this.clickMenuButton('Datatable');
BrowserActions.click(this.dataTableDragAndDropButton);
async clickTaskListButton(): Promise<void> {
await this.clickNavigationBarItem('Task List');
}
async clickContentServicesButton() {
this.clickMenuButton('Content Services');
async clickProcessCloudButton() {
await this.clickNavigationBarItem('Process Cloud');
await BrowserVisibility.waitUntilElementIsVisible(this.linkMenuChildrenContainer);
}
async clickTaskListButton() {
this.clickMenuButton('Task List');
}
async clickHomeButton() {
this.clickMenuButton('Home');
}
async clickConfigEditorButton() {
this.clickMenuButton('Configuration Editor');
}
navigateToProcessServicesPage() {
this.clickMenuButton('Process Services');
BrowserActions.click(this.processServicesNestedButton);
return new ProcessServicesPage();
}
navigateToProcessServicesCloudPage() {
this.clickMenuButton('Process Cloud');
BrowserActions.click(this.processServicesCloudHomeButton);
async navigateToProcessServicesCloudPage(): Promise<AppListCloudPage> {
await this.clickProcessCloudButton();
await BrowserActions.click(this.processServicesCloudHomeButton);
await BrowserVisibility.waitUntilElementIsNotPresent(this.linkMenuChildrenContainer);
return new AppListCloudPage();
}
navigateToPeopleGroupCloudPage() {
this.clickMenuButton('Process Cloud');
BrowserActions.click(this.peopleGroupCloudButton);
async navigateToFormCloudPage(): Promise<void> {
await this.clickProcessCloudButton();
await BrowserActions.click(this.formButton);
await BrowserVisibility.waitUntilElementIsNotPresent(this.linkMenuChildrenContainer);
}
async navigateToPeopleGroupCloudPage(): Promise<PeopleGroupCloudComponentPage> {
await this.clickProcessCloudButton();
await BrowserActions.click(this.peopleGroupCloudButton);
await BrowserVisibility.waitUntilElementIsNotPresent(this.linkMenuChildrenContainer);
return new PeopleGroupCloudComponentPage();
}
async navigateToSettingsPage() {
this.clickMenuButton('Settings');
return new AppListCloudPage();
async clickProcessServicesButton() {
await this.clickNavigationBarItem('Process Services');
await BrowserVisibility.waitUntilElementIsVisible(this.linkMenuChildrenContainer);
}
async clickLoginButton() {
this.clickMenuButton('Login');
async navigateToProcessServicesPage(): Promise<ProcessServicesPage> {
await this.clickProcessServicesButton();
await BrowserActions.click(this.processServicesNestedButton);
await BrowserVisibility.waitUntilElementIsNotPresent(this.linkMenuChildrenContainer);
return new ProcessServicesPage();
}
async clickTrashcanButton() {
this.clickMenuButton('Trashcan');
async navigateToProcessServicesFormPage(): Promise<void> {
await this.clickProcessServicesButton();
await BrowserActions.click(this.formButton);
await BrowserVisibility.waitUntilElementIsNotPresent(this.linkMenuChildrenContainer);
}
async clickOverlayViewerButton() {
this.clickMenuButton('Overlay Viewer');
return this;
async clickLoginButton(): Promise<void> {
await this.clickNavigationBarItem('Login');
}
async clickThemeButton() {
BrowserActions.closeMenuAndDialogs();
BrowserActions.click(this.themeButton);
BrowserVisibility.waitUntilElementIsVisible(this.themeMenuContent);
async clickTrashcanButton(): Promise<void> {
await this.clickNavigationBarItem('Trashcan');
}
async clickOnSpecificThemeButton(themeName) {
const themeElement = element(by.css(`button[data-automation-id="${themeName}"]`));
BrowserActions.click(themeElement);
async clickCustomSources(): Promise<void> {
await this.clickNavigationBarItem('Custom Sources');
}
async clickLogoutButton() {
BrowserActions.closeMenuAndDialogs();
BrowserActions.clickExecuteScript('.adf-sidenav-link[adf-logout]');
async clickDataTable(): Promise<void> {
await this.clickNavigationBarItem('Datatable');
await BrowserVisibility.waitUntilElementIsVisible(this.linkMenuChildrenContainer);
}
async clickCardViewButton() {
BrowserActions.closeMenuAndDialogs();
BrowserActions.click(this.cardViewButton);
async navigateToDatatable(): Promise<void> {
await this.clickDataTable();
await BrowserActions.click(this.dataTableNestedButton);
await BrowserVisibility.waitUntilElementIsNotPresent(this.linkMenuChildrenContainer);
}
openContentServicesFolder(folderId) {
return BrowserActions.getUrl(browser.params.testConfig.adf.url + '/files/' + folderId);
async navigateToDragAndDropDatatable(): Promise<void> {
await this.clickDataTable();
await BrowserActions.click(this.dataTableDragAndDropButton);
await BrowserVisibility.waitUntilElementIsNotPresent(this.linkMenuChildrenContainer);
}
chooseLanguage(language) {
const buttonLanguage = element(by.xpath(`//adf-language-menu//button[contains(text(), '${language}')]`));
BrowserActions.click(buttonLanguage);
async navigateToCopyContentDatatable(): Promise<void> {
await this.clickDataTable();
await BrowserActions.click(this.dataTableCopyContentButton);
await BrowserVisibility.waitUntilElementIsNotPresent(this.linkMenuChildrenContainer);
}
openLanguageMenu() {
BrowserActions.click(this.languageMenuButton);
BrowserVisibility.waitUntilElementIsVisible(this.appTitle);
async clickTagButton(): Promise<void> {
await this.clickNavigationBarItem('Tag');
}
async clickHeaderDataButton() {
this.clickMenuButton('Header Data');
async clickSocialButton(): Promise<void> {
await this.clickNavigationBarItem('Social');
}
async clickAboutButton() {
this.clickMenuButton('About');
async clickSettingsButton(): Promise<void> {
await this.clickNavigationBarItem('Settings');
}
async clickTreeViewButton() {
this.clickMenuButton('Tree View');
async clickConfigEditorButton(): Promise<void> {
await this.clickNavigationBarItem('Configuration Editor');
}
async navigateToIconsPage() {
this.clickMenuButton('Icons');
async clickOverlayViewerButton(): Promise<void> {
await this.clickNavigationBarItem('Overlay Viewer');
}
async navigateToCustomSources() {
this.clickMenuButton('Custom Sources');
async clickTreeViewButton(): Promise<void> {
await this.clickNavigationBarItem('Tree View');
}
checkMenuButtonIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.menuButton);
async clickIconsButton(): Promise<void> {
await this.clickNavigationBarItem('Icons');
}
checkMenuButtonIsNotDisplayed() {
return BrowserVisibility.waitUntilElementIsNotVisible(this.menuButton);
async clickAboutButton(): Promise<void> {
await this.clickNavigationBarItem('About');
}
checkToolbarColor(color) {
const toolbarColor = element(by.css(`mat-toolbar[class*="mat-${color}"]`));
return BrowserVisibility.waitUntilElementIsVisible(toolbarColor);
async clickLogoutButton(): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.clickExecuteScript('.adf-sidenav-link[adf-logout]');
}
clickAppLogo(logoTitle) {
const appLogo = element(by.css('a[title="' + logoTitle + '"]'));
BrowserActions.click(appLogo);
async clickThemeButton(): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.click(this.themeButton);
await BrowserVisibility.waitUntilElementIsVisible(this.themeMenuContent);
}
clickAppLogoText() {
BrowserActions.click(this.appTitle);
async clickOnSpecificThemeButton(themeName): Promise<void> {
const themeElement: ElementFinder = element(by.css(`button[data-automation-id="${themeName}"]`));
await BrowserActions.click(themeElement);
await BrowserVisibility.waitUntilElementIsNotPresent(this.linkMenuChildrenContainer);
}
clickFormButton() {
BrowserActions.closeMenuAndDialogs();
BrowserActions.click(this.processServicesButton);
BrowserActions.click(this.formButton);
async openContentServicesFolder(folderId): Promise<void> {
await BrowserActions.getUrl(`${browser.params.testConfig.adf.url}/files/${folderId}`);
}
clickFormCloudButton() {
this.clickMenuButton('Process Cloud');
BrowserActions.click(this.formButton);
async openLanguageMenu(): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.click(this.languageMenuButton);
await BrowserVisibility.waitUntilElementIsVisible(this.appTitle);
}
checkLogoTooltip(logoTooltipTitle) {
const logoTooltip = element(by.css('a[title="' + logoTooltipTitle + '"]'));
BrowserVisibility.waitUntilElementIsVisible(logoTooltip);
async chooseLanguage(language): Promise<void> {
const buttonLanguage: ElementFinder = element(by.xpath(`//adf-language-menu//button[contains(text(), '${language}')]`));
await BrowserActions.click(buttonLanguage);
await BrowserVisibility.waitUntilElementIsNotPresent(this.linkMenuChildrenContainer);
}
async openViewer(nodeId) {
await BrowserActions.getUrl(browser.params.testConfig.adf.url + `/files(overlay:files/${nodeId}/view`);
return this;
async checkMenuButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.menuButton);
}
async goToSite(site) {
async checkMenuButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.menuButton);
}
async checkToolbarColor(color): Promise<void> {
const toolbarColor: ElementFinder = element(by.css(`mat-toolbar[class*="mat-${color}"]`));
await BrowserVisibility.waitUntilElementIsVisible(toolbarColor);
}
async clickAppLogo(logoTitle): Promise<void> {
const appLogo: ElementFinder = element(by.css('a[title="' + logoTitle + '"]'));
await BrowserActions.click(appLogo);
}
async clickAppLogoText(): Promise<void> {
await BrowserActions.click(this.appTitle);
}
async checkLogoTooltip(logoTooltipTitle): Promise<void> {
const logoTooltip: ElementFinder = element(by.css('a[title="' + logoTooltipTitle + '"]'));
await BrowserVisibility.waitUntilElementIsVisible(logoTooltip);
}
async openViewer(nodeId): Promise<void> {
await BrowserActions.getUrl(browser.params.testConfig.adf.url + `/files(overlay:files/${nodeId}/view`);
}
async goToSite(site): Promise<void> {
await BrowserActions.getUrl(browser.params.testConfig.adf.url + `/files/${site.entry.guid}/display/list`);
}
async scrollTo(el: ElementFinder) {
async scrollTo(el: ElementFinder): Promise<void> {
await browser.executeScript(`return arguments[0].scrollTop = arguments[1].offsetTop`, this.linkListContainer.getWebElement(), el.getWebElement());
return this;
}
}
+57 -66
View File
@@ -15,107 +15,98 @@
* limitations under the License.
*/
import { element, by, protractor, browser } from 'protractor';
import { element, by, browser, ElementFinder } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class NotificationPage {
messageField = element(by.css('input[data-automation-id="notification-message"]'));
horizontalPosition = element(by.css('mat-select[data-automation-id="notification-horizontal-position"]'));
verticalPosition = element(by.css('mat-select[data-automation-id="notification-vertical-position"]'));
durationField = element(by.css('input[data-automation-id="notification-duration"]'));
direction = element(by.css('mat-select[data-automation-id="notification-direction"]'));
actionToggle = element(by.css('mat-slide-toggle[data-automation-id="notification-action-toggle"]'));
notificationSnackBar = element.all(by.css('simple-snack-bar')).first();
actionOutput = element(by.css('div[data-automation-id="notification-action-output"]'));
selectionDropDown = element.all(by.css('.mat-select-panel')).first();
notificationsPage = element(by.css('.adf-sidenav-link[data-automation-id="Notifications"]'));
notificationConfig = element(by.css('p[data-automation-id="notification-custom-object"]'));
messageField: ElementFinder = element(by.css('input[data-automation-id="notification-message"]'));
horizontalPosition: ElementFinder = element(by.css('mat-select[data-automation-id="notification-horizontal-position"]'));
verticalPosition: ElementFinder = element(by.css('mat-select[data-automation-id="notification-vertical-position"]'));
durationField: ElementFinder = element(by.css('input[data-automation-id="notification-duration"]'));
direction: ElementFinder = element(by.css('mat-select[data-automation-id="notification-direction"]'));
actionToggle: ElementFinder = element(by.css('mat-slide-toggle[data-automation-id="notification-action-toggle"]'));
notificationSnackBar: ElementFinder = element.all(by.css('simple-snack-bar')).first();
actionOutput: ElementFinder = element(by.css('div[data-automation-id="notification-action-output"]'));
selectionDropDown: ElementFinder = element.all(by.css('.mat-select-panel')).first();
notificationsPage: ElementFinder = element(by.css('.adf-sidenav-link[data-automation-id="Notifications"]'));
notificationConfig: ElementFinder = element(by.css('p[data-automation-id="notification-custom-object"]'));
checkNotifyContains(message) {
BrowserVisibility.waitUntilElementIsVisible(element.all(by.cssContainingText('simple-snack-bar', message)).first());
return this;
async checkNotifyContains(message): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element.all(by.cssContainingText('simple-snack-bar', message)).first());
}
goToNotificationsPage() {
BrowserActions.click(this.notificationsPage);
async goToNotificationsPage(): Promise<void> {
await BrowserActions.click(this.notificationsPage);
}
getConfigObject() {
getConfigObject(): Promise<string> {
return BrowserActions.getText(this.notificationConfig);
}
checkNotificationSnackBarIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.notificationSnackBar);
return this;
async checkNotificationSnackBarIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.notificationSnackBar);
}
checkNotificationSnackBarIsDisplayedWithMessage(message) {
const notificationSnackBarMessage = element(by.cssContainingText('simple-snack-bar', message));
BrowserVisibility.waitUntilElementIsVisible(notificationSnackBarMessage);
return this;
async checkNotificationSnackBarIsDisplayedWithMessage(message): Promise<void> {
const notificationSnackBarMessage: ElementFinder = element(by.cssContainingText('simple-snack-bar', message));
await BrowserVisibility.waitUntilElementIsVisible(notificationSnackBarMessage);
}
checkNotificationSnackBarIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotVisible(this.notificationSnackBar);
return this;
async checkNotificationSnackBarIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.notificationSnackBar);
}
enterMessageField(text) {
BrowserVisibility.waitUntilElementIsVisible(this.messageField);
this.messageField.clear();
this.messageField.sendKeys(text);
async enterMessageField(text): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.messageField);
await BrowserActions.clearSendKeys(this.messageField, text);
}
enterDurationField(time) {
BrowserVisibility.waitUntilElementIsVisible(this.durationField);
this.durationField.clear();
this.durationField.sendKeys(time);
async enterDurationField(time): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.durationField);
await BrowserActions.clearSendKeys(this.durationField, time);
}
selectHorizontalPosition(selectedItem) {
const selectItem = element(by.cssContainingText('span[class="mat-option-text"]', selectedItem));
BrowserActions.click(this.horizontalPosition);
BrowserVisibility.waitUntilElementIsVisible(this.selectionDropDown);
BrowserActions.click(selectItem);
async selectHorizontalPosition(selectedItem): Promise<void> {
const selectItem: ElementFinder = element(by.cssContainingText('span[class="mat-option-text"]', selectedItem));
await BrowserActions.click(this.horizontalPosition);
await BrowserVisibility.waitUntilElementIsVisible(this.selectionDropDown);
await BrowserActions.click(selectItem);
}
selectVerticalPosition(selectedItem) {
const selectItem = element(by.cssContainingText('span[class="mat-option-text"]', selectedItem));
BrowserActions.click(this.verticalPosition);
BrowserVisibility.waitUntilElementIsVisible(this.selectionDropDown);
BrowserActions.click(selectItem);
async selectVerticalPosition(selectedItem): Promise<void> {
const selectItem: ElementFinder = element(by.cssContainingText('span[class="mat-option-text"]', selectedItem));
await BrowserActions.click(this.verticalPosition);
await BrowserVisibility.waitUntilElementIsVisible(this.selectionDropDown);
await BrowserActions.click(selectItem);
}
selectDirection(selectedItem) {
const selectItem = element(by.cssContainingText('span[class="mat-option-text"]', selectedItem));
BrowserActions.click(this.direction);
BrowserVisibility.waitUntilElementIsVisible(this.selectionDropDown);
BrowserActions.click(selectItem);
async selectDirection(selectedItem): Promise<void> {
const selectItem: ElementFinder = element(by.cssContainingText('span[class="mat-option-text"]', selectedItem));
await BrowserActions.click(this.direction);
await BrowserVisibility.waitUntilElementIsVisible(this.selectionDropDown);
await BrowserActions.click(selectItem);
}
clickNotificationButton() {
const button = element(by.css('button[data-automation-id="notification-custom-config-button"]'));
BrowserActions.click(button);
async clickNotificationButton(): Promise<void> {
const button: ElementFinder = element(by.css('button[data-automation-id="notification-custom-config-button"]'));
await BrowserActions.click(button);
}
checkActionEvent() {
BrowserVisibility.waitUntilElementIsVisible(this.actionOutput);
return this;
async checkActionEvent(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.actionOutput);
}
clickActionToggle() {
BrowserActions.click(this.actionToggle);
async clickActionToggle(): Promise<void> {
await BrowserActions.click(this.actionToggle);
}
clickActionButton() {
browser.executeScript(`document.querySelector("simple-snack-bar > div > button").click();`);
async clickActionButton(): Promise<void> {
await browser.executeScript(`document.querySelector("simple-snack-bar > div > button").click();`);
}
clearMessage() {
BrowserVisibility.waitUntilElementIsVisible(this.messageField);
this.messageField.clear();
this.messageField.sendKeys('a');
this.messageField.sendKeys(protractor.Key.BACK_SPACE);
async clearMessage(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.messageField);
await BrowserActions.clearSendKeys(this.messageField, '');
}
}
+60 -71
View File
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { element, by, ElementFinder } from 'protractor';
import { DataTableComponentPage } from '@alfresco/adf-testing';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
@@ -28,121 +28,110 @@ export class PermissionsPage {
dataTableComponentPage: DataTableComponentPage = new DataTableComponentPage();
addPermissionButton = element(by.css("button[data-automation-id='adf-add-permission-button']"));
addPermissionDialog = element(by.css('adf-add-permission-dialog'));
searchUserInput = element(by.id('searchInput'));
searchResults = element.all(by.id('adf-search-results-content')).first();
addButton = element(by.id('add-permission-dialog-confirm-button'));
permissionInheritedButton = element.all(by.css("div[class='adf-inherit_permission_button'] button")).first();
permissionInheritedButtonText = this.permissionInheritedButton.element(by.css('span'));
noPermissions = element(by.css('div[id="adf-no-permissions-template"]'));
roleDropdown = element(by.id('adf-select-role-permission'));
roleDropdownOptions = element.all(by.css('.mat-option-text'));
assignPermissionError = element(by.css('simple-snack-bar'));
deletePermissionButton = element(by.css(`button[data-automation-id='adf-delete-permission-button']`));
permissionDisplayContainer = element(by.css(`div[id='adf-permission-display-container']`));
closeButton = element(by.id('add-permission-dialog-close-button'));
addPermissionButton: ElementFinder = element(by.css("button[data-automation-id='adf-add-permission-button']"));
addPermissionDialog: ElementFinder = element(by.css('adf-add-permission-dialog'));
searchUserInput: ElementFinder = element(by.id('searchInput'));
searchResults: ElementFinder = element(by.css('#adf-add-permission-authority-results #adf-search-results-content'));
addButton: ElementFinder = element(by.id('add-permission-dialog-confirm-button'));
permissionInheritedButton: ElementFinder = element.all(by.css("div[class='adf-inherit_permission_button'] button")).first();
noPermissions: ElementFinder = element(by.css('div[id="adf-no-permissions-template"]'));
deletePermissionButton: ElementFinder = element(by.css(`button[data-automation-id='adf-delete-permission-button']`));
permissionDisplayContainer: ElementFinder = element(by.css(`div[id='adf-permission-display-container']`));
closeButton: ElementFinder = element(by.id('add-permission-dialog-close-button'));
clickCloseButton() {
BrowserActions.click(this.closeButton);
async clickCloseButton(): Promise<void> {
await BrowserActions.click(this.closeButton);
}
checkAddPermissionButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.addPermissionButton);
async checkAddPermissionButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.addPermissionButton);
}
clickAddPermissionButton() {
BrowserActions.clickExecuteScript('button[data-automation-id="adf-add-permission-button"]');
async clickAddPermissionButton(): Promise<void> {
await BrowserActions.clickExecuteScript('button[data-automation-id="adf-add-permission-button"]');
}
checkAddPermissionDialogIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.addPermissionDialog);
async checkAddPermissionDialogIsDisplayed() {
await BrowserVisibility.waitUntilElementIsVisible(this.addPermissionDialog);
}
checkSearchUserInputIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.searchUserInput);
async checkSearchUserInputIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.searchUserInput);
}
searchUserOrGroup(name) {
BrowserActions.clearSendKeys(this.searchUserInput, name);
async searchUserOrGroup(name): Promise<void> {
await BrowserActions.clearSendKeys(this.searchUserInput, name);
}
checkResultListIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.searchResults);
async checkResultListIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.searchResults);
}
clickUserOrGroup(name) {
const userOrGroupName = element(by.cssContainingText('mat-list-option .mat-list-text', name));
BrowserActions.click(userOrGroupName);
return BrowserActions.click(this.addButton);
async clickUserOrGroup(name): Promise<void> {
const userOrGroupName: ElementFinder = element(by.cssContainingText('mat-list-option .mat-list-text', name));
await BrowserActions.click(userOrGroupName);
await BrowserActions.click(this.addButton);
}
checkUserOrGroupIsAdded(name) {
const userOrGroupName = element(by.css('div[data-automation-id="text_' + name + '"]'));
BrowserVisibility.waitUntilElementIsVisible(userOrGroupName);
async checkUserOrGroupIsAdded(name): Promise<void> {
const userOrGroupName: ElementFinder = element(by.css('div[data-automation-id="text_' + name + '"]'));
await BrowserVisibility.waitUntilElementIsVisible(userOrGroupName);
}
checkUserOrGroupIsDeleted(name) {
const userOrGroupName = element(by.css('div[data-automation-id="text_' + name + '"]'));
BrowserVisibility.waitUntilElementIsNotVisible(userOrGroupName);
async checkUserOrGroupIsDeleted(name): Promise<void> {
const userOrGroupName: ElementFinder = element(by.css('div[data-automation-id="text_' + name + '"]'));
await BrowserVisibility.waitUntilElementIsNotVisible(userOrGroupName);
}
checkPermissionInheritedButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.permissionInheritedButton);
async checkPermissionInheritedButtonIsDisplayed() {
await BrowserVisibility.waitUntilElementIsVisible(this.permissionInheritedButton);
}
clickPermissionInheritedButton() {
return BrowserActions.click(this.permissionInheritedButton);
async clickPermissionInheritedButton(): Promise<void> {
await BrowserActions.click(this.permissionInheritedButton);
}
clickDeletePermissionButton() {
return BrowserActions.click(this.deletePermissionButton);
async clickDeletePermissionButton(): Promise<void> {
await BrowserActions.click(this.deletePermissionButton);
}
checkNoPermissionsIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.noPermissions);
async checkNoPermissionsIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.noPermissions);
}
getPermissionInheritedButtonText() {
return BrowserActions.getText(this.permissionInheritedButton);
async getPermissionInheritedButtonText(): Promise<string> {
return await BrowserActions.getText(this.permissionInheritedButton);
}
checkPermissionsDatatableIsDisplayed() {
return new DataTableComponentPage(element(by.css('[class*="adf-datatable-permission"]')));
async checkPermissionsDatatableIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.css('[class*="adf-datatable-permission"]')));
}
getRoleCellValue(rowName) {
const locator = new DataTableComponentPage().getCellByRowContentAndColumn('Authority ID', rowName, column.role);
return BrowserActions.getText(locator);
async getRoleCellValue(rowName): Promise<string> {
const locator = this.dataTableComponentPage.getCellByRowContentAndColumn('Authority ID', rowName, column.role);
return await BrowserActions.getText(locator);
}
clickRoleDropdownByUserOrGroupName(name) {
async clickRoleDropdownByUserOrGroupName(name): Promise<void> {
const row = this.dataTableComponentPage.getRow('Authority ID', name);
return BrowserActions.click(row.element(by.id('adf-select-role-permission')));
await BrowserActions.click(row.element(by.id('adf-select-role-permission')));
}
getRoleDropdownOptions() {
BrowserVisibility.waitUntilElementIsVisible(this.roleDropdownOptions.first());
return this.roleDropdownOptions;
return element.all(by.css('.mat-option-text'));
}
selectOption(name) {
async selectOption(name): Promise<void> {
const selectProcessDropdown = element(by.cssContainingText('.mat-option-text', name));
BrowserActions.click(selectProcessDropdown);
return this;
await BrowserActions.click(selectProcessDropdown);
}
getAssignPermissionErrorText() {
return BrowserActions.getText(this.assignPermissionError);
async checkPermissionContainerIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.permissionDisplayContainer);
}
checkPermissionContainerIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.permissionDisplayContainer);
}
checkUserOrGroupIsDisplayed(name) {
const userOrGroupName = element(by.cssContainingText('mat-list-option .mat-list-text', name));
BrowserVisibility.waitUntilElementIsVisible(userOrGroupName);
async checkUserOrGroupIsDisplayed(name): Promise<void> {
const userOrGroupName: ElementFinder = element(by.cssContainingText('mat-list-option .mat-list-text', name));
await BrowserVisibility.waitUntilElementIsVisible(userOrGroupName);
}
}
+21 -26
View File
@@ -15,46 +15,41 @@
* limitations under the License.
*/
import { element, by, protractor } from 'protractor';
import { element, by, protractor, ElementFinder } 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'));
toolbarTitle = element(by.xpath('//mat-toolbar/adf-toolbar-title/div/h4'));
reportMessage = element(by.css('div[class="ng-star-inserted"] span'));
toolbarTitleInput: ElementFinder = element(by.css('input[data-automation-id="reportName"]'));
toolbarTitleContainer: ElementFinder = element(by.css('adf-toolbar-title'));
toolbarTitle: ElementFinder = element(by.xpath('//mat-toolbar/adf-toolbar-title/div/h4'));
reportMessage: ElementFinder = element(by.css('div[class="ng-star-inserted"] span'));
getReport(title) {
const reportTitle = element(by.css(`mat-icon[data-automation-id="${title}_filter"]`));
BrowserActions.click(reportTitle);
async getReport(title): Promise<void> {
const reportTitle: ElementFinder = element(by.css(`mat-icon[data-automation-id="${title}_filter"]`));
await BrowserActions.click(reportTitle);
}
changeReportTitle(title) {
BrowserActions.click(this.toolbarTitleContainer);
BrowserActions.click(this.toolbarTitleInput);
this.clearReportTitle();
this.toolbarTitleInput.sendKeys(title);
this.toolbarTitleInput.sendKeys(protractor.Key.ENTER);
async changeReportTitle(title): Promise<void> {
await BrowserActions.click(this.toolbarTitleContainer);
await BrowserActions.click(this.toolbarTitleInput);
await this.clearReportTitle();
await this.toolbarTitleInput.sendKeys(title);
await this.toolbarTitleInput.sendKeys(protractor.Key.ENTER);
}
clearReportTitle() {
BrowserVisibility.waitUntilElementIsVisible(this.toolbarTitleInput);
this.toolbarTitleInput.getAttribute('value').then((value) => {
let i;
for (i = value.length; i >= 0; i--) {
this.toolbarTitleInput.sendKeys(protractor.Key.BACK_SPACE);
}
});
BrowserVisibility.waitUntilElementIsVisible(this.toolbarTitleInput);
async clearReportTitle(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.toolbarTitleInput);
await BrowserActions.clearSendKeys(this.toolbarTitleInput, '');
await BrowserVisibility.waitUntilElementIsVisible(this.toolbarTitleInput);
}
getReportTitle() {
async getReportTitle(): Promise<string> {
return BrowserActions.getText(this.toolbarTitle);
}
checkNoReportMessage() {
BrowserVisibility.waitUntilElementIsVisible(this.reportMessage);
async checkNoReportMessage(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.reportMessage);
}
}
@@ -15,63 +15,62 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { element, by, ElementFinder } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class AttachFormPage {
noFormMessage = element(by.id('adf-no-form-message'));
attachFormButton = element(by.id('adf-no-form-attach-form-button'));
completeButton = element(by.id('adf-no-form-complete-button'));
formDropdown = element(by.id('form_id'));
cancelButton = element(by.id('adf-no-form-cancel-button'));
defaultTitle = element(by.css('mat-card-title[class="mat-card-title mat-card-title"]'));
attachFormDropdown = element(by.css("div[class='adf-attach-form-row']"));
noFormMessage: ElementFinder = element(by.id('adf-no-form-message'));
attachFormButton: ElementFinder = element(by.id('adf-no-form-attach-form-button'));
completeButton: ElementFinder = element(by.id('adf-no-form-complete-button'));
formDropdown: ElementFinder = element(by.id('form_id'));
cancelButton: ElementFinder = element(by.id('adf-no-form-cancel-button'));
defaultTitle: ElementFinder = element(by.css('mat-card-title[class="mat-card-title mat-card-title"]'));
attachFormDropdown: ElementFinder = element(by.css("div[class='adf-attach-form-row']"));
checkNoFormMessageIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.noFormMessage);
async checkNoFormMessageIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.noFormMessage);
}
checkAttachFormButtonIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.attachFormButton);
async checkAttachFormButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.attachFormButton);
}
checkCompleteButtonIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.completeButton);
async checkCompleteButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.completeButton);
}
clickAttachFormButton() {
BrowserActions.click(this.attachFormButton);
async clickAttachFormButton(): Promise<void> {
await BrowserActions.click(this.attachFormButton);
}
checkDefaultFormTitleIsDisplayed(formTitle) {
this.defaultTitle.getText().then((result) => {
expect(result).toEqual(formTitle);
});
async checkDefaultFormTitleIsDisplayed(formTitle): Promise<void> {
const result = await BrowserActions.getText(this.defaultTitle);
await expect(result).toEqual(formTitle);
}
checkFormDropdownIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.formDropdown);
async checkFormDropdownIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.formDropdown);
}
checkCancelButtonIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.cancelButton);
async checkCancelButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.cancelButton);
}
clickAttachFormDropdown() {
BrowserActions.click(this.attachFormDropdown);
async clickAttachFormDropdown(): Promise<void> {
await BrowserActions.click(this.attachFormDropdown);
}
selectAttachFormOption(option) {
BrowserVisibility.waitUntilElementIsClickable(element(by.cssContainingText("mat-option[role='option']", option)));
return element(by.cssContainingText("mat-option[role='option']", option)).click();
async selectAttachFormOption(option): Promise<void> {
await BrowserVisibility.waitUntilElementIsClickable(element(by.cssContainingText("mat-option[role='option']", option)));
await BrowserActions.click(element(by.cssContainingText("mat-option[role='option']", option)));
}
clickCancelButton() {
BrowserActions.click(this.cancelButton);
async clickCancelButton(): Promise<void> {
await BrowserActions.click(this.cancelButton);
}
checkAttachFormButtonIsDisabled() {
return BrowserVisibility.waitUntilElementIsVisible(element(by.css('button[id="adf-no-form-attach-form-button"][disabled]')));
async checkAttachFormButtonIsDisabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.css('button[id="adf-no-form-attach-form-button"][disabled]')));
}
}
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { element, by, protractor, browser } from 'protractor';
import { element, by, protractor, browser, ElementFinder } from 'protractor';
import path = require('path');
import remote = require('selenium-webdriver/remote');
@@ -23,77 +23,70 @@ 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: ElementFinder = element(by.css("input[type='file']"));
buttonMenu: ElementFinder = element(by.css("button[data-automation-id='action_menu_0']"));
viewButton: ElementFinder = element(by.css("button[data-automation-id*='MENU_ACTIONS.VIEW_CONTENT']"));
removeButton: ElementFinder = element(by.css("button[data-automation-id*='MENU_ACTIONS.REMOVE_CONTENT']"));
downloadButton: ElementFinder = element(by.css("button[data-automation-id*='MENU_ACTIONS.DOWNLOAD_CONTENT']"));
noContentContainer: ElementFinder = element(by.css("div[class*='adf-no-content-container']"));
checkEmptyAttachmentList() {
BrowserVisibility.waitUntilElementIsVisible(this.noContentContainer);
async checkEmptyAttachmentList(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.noContentContainer);
}
clickAttachFileButton(fileLocation) {
async clickAttachFileButton(fileLocation): Promise<void> {
browser.setFileDetector(new remote.FileDetector());
BrowserVisibility.waitUntilElementIsVisible(this.attachFileButton);
return this.attachFileButton.sendKeys(path.resolve(path.join(browser.params.testConfig.main.rootPath, fileLocation)));
await BrowserVisibility.waitUntilElementIsPresent(this.attachFileButton);
await this.attachFileButton.sendKeys(path.resolve(path.join(browser.params.testConfig.main.rootPath, fileLocation)));
}
checkFileIsAttached(name) {
const fileAttached = element.all(by.css('div[data-automation-id="' + name + '"]')).first();
BrowserVisibility.waitUntilElementIsVisible(fileAttached);
async checkFileIsAttached(name): Promise<void> {
const fileAttached: ElementFinder = element.all(by.css('div[data-automation-id="' + name + '"]')).first();
await BrowserVisibility.waitUntilElementIsVisible(fileAttached);
}
checkAttachFileButtonIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotVisible(this.attachFileButton);
async checkAttachFileButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.attachFileButton);
}
viewFile(name) {
BrowserActions.closeMenuAndDialogs();
BrowserVisibility.waitUntilElementIsVisible(element.all(by.css('div[data-automation-id="' + name + '"]')).first());
element.all(by.css('div[data-automation-id="' + name + '"]')).first().click();
BrowserActions.click(this.buttonMenu);
browser.driver.sleep(500);
BrowserActions.click(this.viewButton);
browser.driver.sleep(500);
return this;
async viewFile(name): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.click(element.all(by.css('div[data-automation-id="' + name + '"]')).first());
await BrowserActions.click(this.buttonMenu);
await browser.sleep(500);
await BrowserActions.click(this.viewButton);
await browser.sleep(500);
}
removeFile(name) {
BrowserActions.closeMenuAndDialogs();
BrowserVisibility.waitUntilElementIsVisible(element.all(by.css('div[data-automation-id="' + name + '"]')).first());
element.all(by.css('div[data-automation-id="' + name + '"]')).first().click();
BrowserActions.click(this.buttonMenu);
browser.driver.sleep(500);
BrowserActions.click(this.removeButton);
browser.driver.sleep(500);
return this;
async removeFile(name): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.click(element.all(by.css('div[data-automation-id="' + name + '"]')).first());
await BrowserActions.click(this.buttonMenu);
await browser.sleep(500);
await BrowserActions.click(this.removeButton);
await browser.sleep(500);
}
downloadFile(name) {
BrowserActions.closeMenuAndDialogs();
BrowserVisibility.waitUntilElementIsVisible(element.all(by.css('div[data-automation-id="' + name + '"]')).first());
element.all(by.css('div[data-automation-id="' + name + '"]')).first().click();
BrowserActions.click(this.buttonMenu);
browser.driver.sleep(500);
BrowserActions.click(this.downloadButton);
return this;
async downloadFile(name): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.click(element.all(by.css('div[data-automation-id="' + name + '"]')).first());
await BrowserActions.click(this.buttonMenu);
await browser.sleep(500);
await BrowserActions.click(this.downloadButton);
}
doubleClickFile(name) {
BrowserActions.closeMenuAndDialogs();
BrowserVisibility.waitUntilElementIsVisible(element.all(by.css('div[data-automation-id="' + name + '"]')).first());
const fileAttached = element.all(by.css('div[data-automation-id="' + name + '"]')).first();
BrowserActions.click(fileAttached);
browser.actions().sendKeys(protractor.Key.ENTER).perform();
async doubleClickFile(name): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserVisibility.waitUntilElementIsVisible(element.all(by.css('div[data-automation-id="' + name + '"]')).first());
const fileAttached: ElementFinder = element.all(by.css('div[data-automation-id="' + name + '"]')).first();
await BrowserActions.click(fileAttached);
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
}
checkFileIsRemoved(name) {
const fileAttached = element.all(by.css('div[data-automation-id="' + name + '"]')).first();
BrowserVisibility.waitUntilElementIsNotVisible(fileAttached);
return this;
async checkFileIsRemoved(name): Promise<void> {
const fileAttached: ElementFinder = element.all(by.css('div[data-automation-id="' + name + '"]')).first();
await BrowserVisibility.waitUntilElementIsNotVisible(fileAttached);
}
}
@@ -16,34 +16,30 @@
*/
import { FormControllersPage } from '@alfresco/adf-testing';
import { element, by } from 'protractor';
import { element, by, ElementFinder } from 'protractor';
export class AppSettingsToggles {
formControllersPage = new FormControllersPage();
formControllersPage: FormControllersPage = new FormControllersPage();
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: ElementFinder = element(by.id('adf-show-header'));
showTaskFilterIconsToggle: ElementFinder = element(by.id('adf-show-task-filter-icon'));
showProcessFilterIconsToggle: ElementFinder = element(by.id('adf-show-process-filter-icon'));
enableShowHeader() {
this.formControllersPage.enableToggle(this.showDetailsHeaderToggle);
return this;
async enableShowHeader(): Promise<void> {
await this.formControllersPage.enableToggle(this.showDetailsHeaderToggle);
}
disableShowHeader() {
this.formControllersPage.disableToggle(this.showDetailsHeaderToggle);
return this;
async disableShowHeader(): Promise<void> {
await this.formControllersPage.disableToggle(this.showDetailsHeaderToggle);
}
enableTaskFiltersIcon() {
this.formControllersPage.enableToggle(this.showTaskFilterIconsToggle);
return this;
async enableTaskFiltersIcon(): Promise<void> {
await this.formControllersPage.enableToggle(this.showTaskFilterIconsToggle);
}
enableProcessFiltersIcon() {
this.formControllersPage.enableToggle(this.showProcessFilterIconsToggle);
return this;
async enableProcessFiltersIcon(): Promise<void> {
await this.formControllersPage.enableToggle(this.showProcessFilterIconsToggle);
}
}
@@ -15,49 +15,46 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { element, by, ElementFinder } 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: ElementFinder = element(by.css('input[data-automation-id="checklist-name"]'));
addChecklistButton: ElementFinder = element(by.css('button[id="add-check"] span'));
closeButton: ElementFinder = element(by.css('button[id="close-check-dialog"] span'));
dialogTitle: ElementFinder = element(by.id('add-checklist-title'));
addName(name) {
BrowserVisibility.waitUntilElementIsClickable(this.nameField);
BrowserActions.clearSendKeys(this.nameField, name);
return this;
async addName(name): Promise<void> {
await BrowserVisibility.waitUntilElementIsClickable(this.nameField);
await BrowserActions.clearSendKeys(this.nameField, name);
}
clickCreateChecklistButton() {
BrowserActions.click(this.addChecklistButton);
async clickCreateChecklistButton(): Promise<void> {
await BrowserActions.click(this.addChecklistButton);
}
clickCancelButton() {
BrowserActions.click(this.closeButton);
async clickCancelButton(): Promise<void> {
await BrowserActions.click(this.closeButton);
}
getDialogTitle() {
getDialogTitle(): Promise<string> {
return BrowserActions.getText(this.dialogTitle);
}
getNameFieldPlaceholder() {
BrowserVisibility.waitUntilElementIsVisible(this.nameField);
async getNameFieldPlaceholder(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.nameField);
return this.nameField.getAttribute('placeholder');
}
checkCancelButtonIsEnabled() {
BrowserVisibility.waitUntilElementIsVisible(this.closeButton);
BrowserVisibility.waitUntilElementIsClickable(this.closeButton);
return this;
async checkCancelButtonIsEnabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.closeButton);
await BrowserVisibility.waitUntilElementIsClickable(this.closeButton);
}
checkAddChecklistButtonIsEnabled() {
BrowserVisibility.waitUntilElementIsVisible(this.addChecklistButton);
BrowserVisibility.waitUntilElementIsClickable(this.addChecklistButton);
return this;
async checkAddChecklistButtonIsEnabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.addChecklistButton);
await BrowserVisibility.waitUntilElementIsClickable(this.addChecklistButton);
}
}
@@ -15,96 +15,86 @@
* limitations under the License.
*/
import { element, by, Key } from 'protractor';
import { element, by, Key, ElementFinder } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class StartTaskDialog {
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"]'));
formDropDown = element(by.css('mat-select[id="form_id"]'));
name: ElementFinder = element(by.css('input[id="name_id"]'));
dueDate: ElementFinder = element(by.css('input[id="date_id"]'));
description: ElementFinder = element(by.css('textarea[id="description_id"]'));
assignee: ElementFinder = element(by.css('div#people-widget-content input'));
startButton: ElementFinder = element(by.css('button[id="button-start"]'));
startButtonEnabled: ElementFinder = element(by.css('button[id="button-start"]:not(disabled)'));
cancelButton: ElementFinder = element(by.css('button[id="button-cancel"]'));
formDropDown: ElementFinder = element(by.css('mat-select[id="form_id"]'));
addName(userName) {
BrowserVisibility.waitUntilElementIsVisible(this.name);
this.name.clear();
this.name.sendKeys(userName);
return this;
async addName(userName): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.name);
await this.name.clear();
await this.name.sendKeys(userName);
}
addDescription(userDescription) {
BrowserVisibility.waitUntilElementIsVisible(this.description);
this.description.sendKeys(userDescription);
return this;
async addDescription(userDescription): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.description);
await this.description.sendKeys(userDescription);
}
addDueDate(date) {
BrowserVisibility.waitUntilElementIsVisible(this.dueDate);
this.dueDate.sendKeys(date);
return this;
async addDueDate(date): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.dueDate);
await this.dueDate.sendKeys(date);
}
addAssignee(name) {
BrowserVisibility.waitUntilElementIsVisible(this.assignee);
this.assignee.sendKeys(name);
this.selectAssigneeFromList(name);
return this;
async addAssignee(name): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.assignee);
await this.assignee.sendKeys(name);
await this.selectAssigneeFromList(name);
}
selectAssigneeFromList(name) {
const assigneeRow = element(by.cssContainingText('mat-option span.adf-people-label-name', name));
BrowserActions.click(assigneeRow);
BrowserVisibility.waitUntilElementIsNotVisible(assigneeRow);
return this;
async selectAssigneeFromList(name): Promise<void> {
const assigneeRow: ElementFinder = element(by.cssContainingText('mat-option span.adf-people-label-name', name));
await BrowserActions.click(assigneeRow);
await BrowserVisibility.waitUntilElementIsNotVisible(assigneeRow);
}
getAssignee() {
BrowserVisibility.waitUntilElementIsVisible(this.assignee);
async getAssignee(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.assignee);
return this.assignee.getAttribute('placeholder');
}
addForm(form) {
BrowserActions.click(this.formDropDown);
async addForm(form): Promise<void> {
await BrowserActions.click(this.formDropDown);
return this.selectForm(form);
}
selectForm(form) {
const option = element(by.cssContainingText('span[class*="mat-option-text"]', form));
BrowserActions.click(option);
return this;
async selectForm(form): Promise<void> {
const option: ElementFinder = element(by.cssContainingText('span[class*="mat-option-text"]', form));
await BrowserActions.click(option);
}
clickStartButton() {
async clickStartButton(): Promise<void> {
return BrowserActions.click(this.startButton);
}
checkStartButtonIsEnabled() {
BrowserVisibility.waitUntilElementIsVisible(this.startButtonEnabled);
return this;
async checkStartButtonIsEnabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.startButtonEnabled);
}
checkStartButtonIsDisabled() {
BrowserVisibility.waitUntilElementIsVisible(element(by.css('button[id="button-start"]:disabled')));
return this;
async checkStartButtonIsDisabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.css('button[id="button-start"]:disabled')));
}
clickCancelButton() {
return BrowserActions.click(this.cancelButton);
async clickCancelButton(): Promise<void> {
await BrowserActions.click(this.cancelButton);
}
blur(locator) {
BrowserActions.click(locator);
locator.sendKeys(Key.TAB);
return this;
async blur(locator): Promise<void> {
await BrowserActions.click(locator);
await locator.sendKeys(Key.TAB);
}
checkValidationErrorIsDisplayed(error, elementRef = 'mat-error') {
const errorElement = element(by.cssContainingText(elementRef, error));
BrowserVisibility.waitUntilElementIsVisible(errorElement);
return this;
async checkValidationErrorIsDisplayed(error, elementRef = 'mat-error'): Promise<void> {
const errorElement: ElementFinder = element(by.cssContainingText(elementRef, error));
await BrowserVisibility.waitUntilElementIsVisible(errorElement);
}
}
+11 -12
View File
@@ -15,31 +15,30 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { by, element, ElementFinder } from 'protractor';
import { DataTableComponentPage } from '@alfresco/adf-testing';
import { BrowserActions } from '@alfresco/adf-testing';
export class FiltersPage {
activeFilter = element(by.css('mat-list-item[class*="active"]'));
dataTable = new DataTableComponentPage();
activeFilter: ElementFinder = element(by.css('mat-list-item[class*="active"]'));
dataTable: DataTableComponentPage = new DataTableComponentPage();
getActiveFilter() {
async getActiveFilter(): Promise<string> {
return BrowserActions.getText(this.activeFilter);
}
goToFilter(filterName) {
BrowserActions.closeMenuAndDialogs();
BrowserActions.clickExecuteScript(`span[data-automation-id="${filterName}_filter"]`);
return this;
async goToFilter(filterName): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.clickExecuteScript(`span[data-automation-id="${filterName}_filter"]`);
}
sortByName(sortOrder: string) {
this.dataTable.sortByColumn(sortOrder, 'name');
async sortByName(sortOrder: string): Promise<void> {
await this.dataTable.sortByColumn(sortOrder, 'name');
}
getAllRowsNameColumn() {
return this.dataTable.getAllRowsColumnValues('Name');
async getAllRowsNameColumn() {
return await this.dataTable.getAllRowsColumnValues('Name');
}
}
@@ -15,146 +15,143 @@
* limitations under the License.
*/
import { by, element, protractor } from 'protractor';
import { by, element, ElementFinder, protractor } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class ProcessDetailsPage {
// Process Details
processTitle = element(by.css('mat-card-title[class="mat-card-title"]'));
processDetailsMessage = element(by.css('adf-process-instance-details div[class="ng-star-inserted"]'));
processStatusField = element(by.css('span[data-automation-id="card-textitem-value-status"]'));
processEndDateField = element(by.css('span[data-automation-id="card-dateitem-ended"]'));
processCategoryField = element(by.css('span[data-automation-id="card-textitem-value-category"]'));
processBusinessKeyField = element(by.css('span[data-automation-id="card-textitem-value-businessKey"]'));
processCreatedByField = element(by.css('span[data-automation-id="card-textitem-value-assignee"]'));
processCreatedField = element(by.css('span[data-automation-id="card-dateitem-created"]'));
processIdField = element(by.css('span[data-automation-id="card-textitem-value-id"]'));
processDescription = element(by.css('span[data-automation-id="card-textitem-value-description"]'));
showDiagramButtonDisabled = element(by.css('button[id="show-diagram-button"][disabled]'));
propertiesList = element(by.css('div[class="adf-property-list"]'));
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"]'));
processStatusField: ElementFinder = element(by.css('span[data-automation-id="card-textitem-value-status"]'));
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"]'));
processBusinessKeyField: ElementFinder = element(by.css('span[data-automation-id="card-textitem-value-businessKey"]'));
processCreatedByField: ElementFinder = element(by.css('span[data-automation-id="card-textitem-value-assignee"]'));
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"]'));
processDescription: ElementFinder = element(by.css('span[data-automation-id="card-textitem-value-description"]'));
showDiagramButtonDisabled: ElementFinder = element(by.css('button[id="show-diagram-button"][disabled]'));
propertiesList: ElementFinder = element(by.css('div[class="adf-property-list"]'));
// Show Diagram
showDiagramButton = element(by.id('show-diagram-button'));
diagramCanvas = element(by.css('svg[xmlns="http://www.w3.org/2000/svg"]'));
backButton = element(by.css('app-show-diagram button[class="mat-mini-fab mat-accent"]'));
showDiagramButton: ElementFinder = element(by.id('show-diagram-button'));
diagramCanvas: ElementFinder = element(by.css('svg[xmlns="http://www.w3.org/2000/svg"]'));
backButton: ElementFinder = element(by.css('app-show-diagram button[class="mat-mini-fab mat-accent"]'));
// Comments
commentInput = element(by.id('comment-input'));
commentInput: ElementFinder = element(by.id('comment-input'));
// Audit Log
auditLogButton = element(by.css('button[adf-process-audit]'));
auditLogButton: ElementFinder = element(by.css('button[adf-process-audit]'));
// Cancel Process button
cancelProcessButton = element(by.css('div[data-automation-id="header-status"] > button'));
cancelProcessButton: ElementFinder = element(by.css('div[data-automation-id="header-status"] > button'));
// Tasks
activeTask = element(by.css('div[data-automation-id="active-tasks"]'));
startForm = element(by.css('div[data-automation-id="start-form"]'));
completedTask = element(by.css('div[data-automation-id="completed-tasks"]'));
taskTitle = element(by.css('h2[class="adf-activiti-task-details__header"]'));
activeTask: ElementFinder = element(by.css('div[data-automation-id="active-tasks"]'));
startForm: ElementFinder = element(by.css('div[data-automation-id="start-form"]'));
completedTask: ElementFinder = element(by.css('div[data-automation-id="completed-tasks"]'));
taskTitle: ElementFinder = element(by.css('h2[class="adf-activiti-task-details__header"]'));
checkDetailsAreDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.processStatusField);
BrowserVisibility.waitUntilElementIsVisible(this.processEndDateField);
BrowserVisibility.waitUntilElementIsVisible(this.processCategoryField);
BrowserVisibility.waitUntilElementIsVisible(this.processBusinessKeyField);
BrowserVisibility.waitUntilElementIsVisible(this.processCreatedByField);
BrowserVisibility.waitUntilElementIsVisible(this.processCreatedField);
BrowserVisibility.waitUntilElementIsVisible(this.processIdField);
BrowserVisibility.waitUntilElementIsVisible(this.processDescription);
BrowserVisibility.waitUntilElementIsVisible(this.showDiagramButton);
BrowserVisibility.waitUntilElementIsVisible(this.activeTask);
BrowserVisibility.waitUntilElementIsVisible(this.cancelProcessButton);
BrowserVisibility.waitUntilElementIsVisible(this.commentInput);
BrowserVisibility.waitUntilElementIsVisible(this.auditLogButton);
return this;
async checkDetailsAreDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.processStatusField);
await BrowserVisibility.waitUntilElementIsVisible(this.processEndDateField);
await BrowserVisibility.waitUntilElementIsVisible(this.processCategoryField);
await BrowserVisibility.waitUntilElementIsVisible(this.processBusinessKeyField);
await BrowserVisibility.waitUntilElementIsVisible(this.processCreatedByField);
await BrowserVisibility.waitUntilElementIsVisible(this.processCreatedField);
await BrowserVisibility.waitUntilElementIsVisible(this.processIdField);
await BrowserVisibility.waitUntilElementIsVisible(this.processDescription);
await BrowserVisibility.waitUntilElementIsVisible(this.showDiagramButton);
await BrowserVisibility.waitUntilElementIsVisible(this.activeTask);
await BrowserVisibility.waitUntilElementIsVisible(this.cancelProcessButton);
await BrowserVisibility.waitUntilElementIsVisible(this.commentInput);
await BrowserVisibility.waitUntilElementIsVisible(this.auditLogButton);
}
checkProcessTitleIsDisplayed() {
checkProcessTitleIsDisplayed(): Promise<string> {
return BrowserActions.getText(this.processTitle);
}
checkProcessDetailsMessage() {
checkProcessDetailsMessage(): Promise<string> {
return BrowserActions.getText(this.processDetailsMessage);
}
getProcessStatus() {
getProcessStatus(): Promise<string> {
return BrowserActions.getText(this.processStatusField);
}
getEndDate() {
getEndDate(): Promise<string> {
return BrowserActions.getText(this.processEndDateField);
}
getProcessCategory() {
getProcessCategory(): Promise<string> {
return BrowserActions.getText(this.processCategoryField);
}
getBusinessKey() {
getBusinessKey(): Promise<string> {
return BrowserActions.getText(this.processBusinessKeyField);
}
getCreatedBy() {
getCreatedBy(): Promise<string> {
return BrowserActions.getText(this.processCreatedByField);
}
getCreated() {
getCreated(): Promise<string> {
return BrowserActions.getText(this.processCreatedField);
}
getId() {
getId(): Promise<string> {
return BrowserActions.getText(this.processIdField);
}
getProcessDescription() {
getProcessDescription(): Promise<string> {
return BrowserActions.getText(this.processDescription);
}
clickShowDiagram() {
BrowserActions.click(this.showDiagramButton);
BrowserVisibility.waitUntilElementIsVisible(this.diagramCanvas);
BrowserActions.click(this.backButton);
async clickShowDiagram(): Promise<void> {
await BrowserActions.click(this.showDiagramButton);
await BrowserVisibility.waitUntilElementIsVisible(this.diagramCanvas);
await BrowserActions.click(this.backButton);
}
checkShowDiagramIsDisabled() {
BrowserVisibility.waitUntilElementIsVisible(this.showDiagramButtonDisabled);
async checkShowDiagramIsDisabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.showDiagramButtonDisabled);
}
addComment(comment) {
BrowserVisibility.waitUntilElementIsVisible(this.commentInput);
this.commentInput.sendKeys(comment);
this.commentInput.sendKeys(protractor.Key.ENTER);
return this;
async addComment(comment): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.commentInput);
await this.commentInput.sendKeys(comment);
await this.commentInput.sendKeys(protractor.Key.ENTER);
}
checkCommentIsDisplayed(comment) {
const commentInserted = element(by.cssContainingText('div[id="comment-message"]', comment));
BrowserVisibility.waitUntilElementIsVisible(commentInserted);
return this;
async checkCommentIsDisplayed(comment): Promise<void> {
const commentInserted: ElementFinder = element(by.cssContainingText('div[id="comment-message"]', comment));
await BrowserVisibility.waitUntilElementIsVisible(commentInserted);
}
clickAuditLogButton() {
BrowserActions.click(this.auditLogButton);
async clickAuditLogButton(): Promise<void> {
await BrowserActions.click(this.auditLogButton);
}
clickCancelProcessButton() {
BrowserActions.click(this.cancelProcessButton);
async clickCancelProcessButton(): Promise<void> {
await BrowserActions.click(this.cancelProcessButton);
}
clickOnActiveTask() {
return BrowserActions.click(this.activeTask);
async clickOnActiveTask(): Promise<void> {
await BrowserActions.click(this.activeTask);
}
clickOnStartForm() {
return BrowserActions.click(this.startForm);
async clickOnStartForm(): Promise<void> {
await BrowserActions.click(this.startForm);
}
clickOnCompletedTask() {
return BrowserActions.click(this.completedTask);
async clickOnCompletedTask(): Promise<void> {
await BrowserActions.click(this.completedTask);
}
checkActiveTaskTitleIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.taskTitle);
async checkActiveTaskTitleIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.taskTitle);
}
checkProcessDetailsCard() {
BrowserVisibility.waitUntilElementIsVisible(this.propertiesList);
async checkProcessDetailsCard(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.propertiesList);
}
}
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { element, by, ElementFinder, Locator } from 'protractor';
import { StartProcessPage } from './startProcessPage';
import { DataTableComponentPage } from '@alfresco/adf-testing';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
@@ -23,74 +23,73 @@ import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class ProcessFiltersPage {
dataTable = new DataTableComponentPage();
runningFilter = element(by.css('span[data-automation-id="Running_filter"]'));
completedFilter = element(by.css('div[class="mat-list-text"] > span[data-automation-id="Completed_filter"]'));
allFilter = element(by.css('span[data-automation-id="All_filter"]'));
createProcessButton = element(by.css('.adf-processes-menu button[data-automation-id="create-button"] > span'));
newProcessButton = element(by.css('div > button[data-automation-id="btn-start-process"]'));
processesPage = element(by.css('div[class="adf-grid"] > div[class="adf-grid-item adf-processes-menu"]'));
accordionMenu = element(by.css('.adf-processes-menu mat-accordion'));
buttonWindow = element(by.css('div > button[data-automation-id="btn-start-process"] > div'));
noContentMessage = element.all(by.css('div[class="adf-empty-content__title"]')).first();
rows = by.css('adf-process-instance-list div[class="adf-datatable-body"] div[class*="adf-datatable-row"]');
tableBody = element.all(by.css('adf-datatable div[class="adf-datatable-body"]')).first();
nameColumn = by.css('div[class*="adf-datatable-body"] div[class*="adf-datatable-row"] div[title="Name"] span');
processIcon = by.xpath('ancestor::div[@class="mat-list-item-content"]/mat-icon');
runningFilter: ElementFinder = element(by.css('span[data-automation-id="Running_filter"]'));
completedFilter: ElementFinder = element(by.css('div[class="mat-list-text"] > span[data-automation-id="Completed_filter"]'));
allFilter: ElementFinder = element(by.css('span[data-automation-id="All_filter"]'));
createProcessButton: ElementFinder = element(by.css('.adf-processes-menu button[data-automation-id="create-button"] > span'));
newProcessButton: ElementFinder = element(by.css('div > button[data-automation-id="btn-start-process"]'));
processesPage: ElementFinder = element(by.css('div[class="adf-grid"] > div[class="adf-grid-item adf-processes-menu"]'));
accordionMenu: ElementFinder = element(by.css('.adf-processes-menu mat-accordion'));
buttonWindow: ElementFinder = element(by.css('div > button[data-automation-id="btn-start-process"] > div'));
noContentMessage: ElementFinder = element.all(by.css('div[class="adf-empty-content__title"]')).first();
rows: Locator = by.css('adf-process-instance-list div[class="adf-datatable-body"] div[class*="adf-datatable-row"]');
tableBody: ElementFinder = element.all(by.css('adf-datatable div[class="adf-datatable-body"]')).first();
nameColumn: Locator = by.css('div[class*="adf-datatable-body"] div[class*="adf-datatable-row"] div[title="Name"] span');
processIcon: Locator = by.xpath('ancestor::div[@class="mat-list-item-content"]/mat-icon');
startProcess() {
this.clickCreateProcessButton();
this.clickNewProcessDropdown();
async startProcess(): Promise<StartProcessPage> {
await this.clickCreateProcessButton();
await this.clickNewProcessDropdown();
return new StartProcessPage();
}
clickRunningFilterButton() {
return BrowserActions.click(this.runningFilter);
async clickRunningFilterButton(): Promise<void> {
await BrowserActions.click(this.runningFilter);
}
clickCompletedFilterButton() {
BrowserActions.click(this.completedFilter);
expect(this.completedFilter.isEnabled()).toBe(true);
async clickCompletedFilterButton(): Promise<void> {
await BrowserActions.click(this.completedFilter);
await expect(await this.completedFilter.isEnabled()).toBe(true);
}
clickAllFilterButton() {
BrowserActions.click(this.allFilter);
expect(this.allFilter.isEnabled()).toBe(true);
async clickAllFilterButton(): Promise<void> {
await BrowserActions.click(this.allFilter);
await expect(await this.allFilter.isEnabled()).toBe(true);
}
clickCreateProcessButton() {
BrowserActions.closeMenuAndDialogs();
BrowserVisibility.waitUntilElementIsOnPage(this.accordionMenu);
BrowserVisibility.waitUntilElementIsVisible(this.processesPage);
BrowserActions.click(this.createProcessButton);
async clickCreateProcessButton(): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserVisibility.waitUntilElementIsVisible(this.accordionMenu);
await BrowserVisibility.waitUntilElementIsVisible(this.processesPage);
await BrowserActions.click(this.createProcessButton);
}
clickNewProcessDropdown() {
BrowserVisibility.waitUntilElementIsOnPage(this.buttonWindow);
BrowserActions.click(this.newProcessButton);
async clickNewProcessDropdown(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.buttonWindow);
await BrowserActions.click(this.newProcessButton);
}
checkNoContentMessage() {
return BrowserVisibility.waitUntilElementIsVisible(this.noContentMessage);
async checkNoContentMessage(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.noContentMessage);
}
selectFromProcessList(title) {
BrowserActions.closeMenuAndDialogs();
const processName = element.all(by.css(`div[data-automation-id="text_${title}"]`)).first();
BrowserActions.click(processName);
async selectFromProcessList(title): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
const processName: ElementFinder = element.all(by.css(`div[data-automation-id="text_${title}"]`)).first();
await BrowserActions.click(processName);
}
checkFilterIsHighlighted(filterName) {
const processNameHighlighted = element(by.css(`mat-list-item.adf-active span[data-automation-id='${filterName}_filter']`));
BrowserVisibility.waitUntilElementIsVisible(processNameHighlighted);
async checkFilterIsHighlighted(filterName): Promise<void> {
const processNameHighlighted: ElementFinder = element(by.css(`mat-list-item.adf-active span[data-automation-id='${filterName}_filter']`));
await BrowserVisibility.waitUntilElementIsVisible(processNameHighlighted);
}
numberOfProcessRows() {
return element.all(this.rows).count();
async numberOfProcessRows(): Promise<number> {
return await element.all(this.rows).count();
}
waitForTableBody() {
BrowserVisibility.waitUntilElementIsVisible(this.tableBody);
async waitForTableBody(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.tableBody);
}
/**
@@ -98,50 +97,48 @@ export class ProcessFiltersPage {
*
* @param sortOrder : 'ASC' to sort the list ascendant and 'DESC' for descendant
*/
sortByName(sortOrder: string) {
this.dataTable.sortByColumn(sortOrder, 'name');
async sortByName(sortOrder: string) {
await this.dataTable.sortByColumn(sortOrder, 'name');
}
getAllRowsNameColumn() {
return this.dataTable.getAllRowsColumnValues('Name');
async getAllRowsNameColumn() {
return await this.dataTable.getAllRowsColumnValues('Name');
}
checkFilterIsDisplayed(name) {
const filterName = element(by.css(`span[data-automation-id='${name}_filter']`));
return BrowserVisibility.waitUntilElementIsVisible(filterName);
async checkFilterIsDisplayed(name): Promise<void> {
const filterName: ElementFinder = element(by.css(`span[data-automation-id='${name}_filter']`));
await BrowserVisibility.waitUntilElementIsVisible(filterName);
}
checkFilterHasNoIcon(name) {
const filterName = element(by.css(`span[data-automation-id='${name}_filter']`));
BrowserVisibility.waitUntilElementIsVisible(filterName);
return BrowserVisibility.waitUntilElementIsNotOnPage(filterName.element(this.processIcon));
async checkFilterHasNoIcon(name): Promise<void> {
const filterName: ElementFinder = element(by.css(`span[data-automation-id='${name}_filter']`));
await BrowserVisibility.waitUntilElementIsVisible(filterName);
await BrowserVisibility.waitUntilElementIsNotVisible(filterName.element(this.processIcon));
}
getFilterIcon(name) {
const filterName = element(by.css(`span[data-automation-id='${name}_filter']`));
BrowserVisibility.waitUntilElementIsVisible(filterName);
async getFilterIcon(name): Promise<string> {
const filterName: ElementFinder = element(by.css(`span[data-automation-id='${name}_filter']`));
await BrowserVisibility.waitUntilElementIsVisible(filterName);
const icon = filterName.element(this.processIcon);
return BrowserActions.getText(icon);
return await BrowserActions.getText(icon);
}
checkFilterIsNotDisplayed(name) {
const filterName = element(by.css(`span[data-automation-id='${name}_filter']`));
return BrowserVisibility.waitUntilElementIsNotVisible(filterName);
async checkFilterIsNotDisplayed(name): Promise<void> {
const filterName: ElementFinder = element(by.css(`span[data-automation-id='${name}_filter']`));
await BrowserVisibility.waitUntilElementIsNotVisible(filterName);
}
checkProcessesSortedByNameAsc() {
this.getAllRowsNameColumn().then((list) => {
for (let i = 1; i < list.length; i++) {
expect(JSON.stringify(list[i]) > JSON.stringify(list[i - 1])).toEqual(true);
}
});
async checkProcessesSortedByNameAsc(): Promise<void> {
const list = await this.getAllRowsNameColumn();
for (let i = 1; i < list.length; i++) {
await expect(JSON.stringify(list[i]) > JSON.stringify(list[i - 1])).toEqual(true);
}
}
checkProcessesSortedByNameDesc() {
this.getAllRowsNameColumn().then((list) => {
for (let i = 1; i < list.length; i++) {
expect(JSON.stringify(list[i]) < JSON.stringify(list[i - 1])).toEqual(true);
}
});
async checkProcessesSortedByNameDesc(): Promise<void> {
const list = await this.getAllRowsNameColumn();
for (let i = 1; i < list.length; i++) {
await expect(JSON.stringify(list[i]) < JSON.stringify(list[i - 1])).toEqual(true);
}
}
}
@@ -16,19 +16,19 @@
*/
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
import { element, by } from 'protractor';
import { element, by, ElementFinder } from 'protractor';
export class ProcessListPage {
processListTitle = element.all(by.css("div[class='adf-empty-content__title']")).first();
processInstanceList = element(by.css('adf-process-instance-list'));
processListTitle: ElementFinder = element.all(by.css("div[class='adf-empty-content__title']")).first();
processInstanceList: ElementFinder = element(by.css('adf-process-instance-list'));
checkProcessListTitleIsDisplayed() {
getDisplayedProcessListTitle(): Promise<string> {
return BrowserActions.getText(this.processListTitle);
}
checkProcessListIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.processInstanceList);
async checkProcessListIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.processInstanceList);
}
}
@@ -16,33 +16,33 @@
*/
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
import { element, by, browser } from 'protractor';
import { element, by, browser, ElementFinder } from 'protractor';
export class ProcessServiceTabBarPage {
tasksButton = element.all(by.cssContainingText('div[class*="mat-tab-label"] .mat-tab-labels div', 'Tasks')).first();
processButton = element.all(by.cssContainingText('div[class*="mat-tab-label"] .mat-tab-labels div', 'Process')).first();
reportsButton = element.all(by.cssContainingText('div[class*="mat-tab-label"] .mat-tab-labels div', 'Reports')).first();
settingsButton = element.all(by.cssContainingText('div[class*="mat-tab-label"] .mat-tab-labels div', 'Settings')).first();
reportsButtonSelected = element.all(by.cssContainingText('div[class*="mat-tab-label"] .mat-tab-labels div[aria-selected="true"]', 'Reports')).first();
tasksButton: ElementFinder = element.all(by.cssContainingText('div[class*="mat-tab-label"] .mat-tab-labels div', 'Tasks')).first();
processButton: ElementFinder = element.all(by.cssContainingText('div[class*="mat-tab-label"] .mat-tab-labels div', 'Process')).first();
reportsButton: ElementFinder = element.all(by.cssContainingText('div[class*="mat-tab-label"] .mat-tab-labels div', 'Reports')).first();
settingsButton: ElementFinder = element.all(by.cssContainingText('div[class*="mat-tab-label"] .mat-tab-labels div', 'Settings')).first();
reportsButtonSelected: ElementFinder = element.all(by.cssContainingText('div[class*="mat-tab-label"] .mat-tab-labels div[aria-selected="true"]', 'Reports')).first();
clickTasksButton() {
BrowserActions.click(this.tasksButton);
browser.sleep(700);
async clickTasksButton(): Promise<void> {
await BrowserActions.click(this.tasksButton);
await browser.sleep(300);
}
clickProcessButton() {
BrowserActions.click(this.processButton);
browser.sleep(700);
async clickProcessButton(): Promise<void> {
await BrowserActions.click(this.processButton);
await browser.sleep(300);
}
clickSettingsButton() {
BrowserActions.click(this.settingsButton);
browser.sleep(700);
async clickSettingsButton(): Promise<void> {
await BrowserActions.click(this.settingsButton);
await browser.sleep(300);
}
clickReportsButton() {
BrowserActions.click(this.reportsButton);
return BrowserVisibility.waitUntilElementIsVisible(this.reportsButtonSelected);
async clickReportsButton(): Promise<void> {
await BrowserActions.click(this.reportsButton);
await BrowserVisibility.waitUntilElementIsVisible(this.reportsButtonSelected);
}
}
@@ -17,59 +17,60 @@
import { ProcessServiceTabBarPage } from './processServiceTabBarPage';
import { element, by } from 'protractor';
import { element, by, ElementFinder } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
import { __await } from 'tslib';
export class ProcessServicesPage {
apsAppsContainer = element(by.css('div[class="adf-app-listgrid ng-star-inserted"]'));
taskApp = element(by.css('mat-card[title="Task App"]'));
apsAppsContainer: ElementFinder = element(by.css('div[class="adf-app-listgrid ng-star-inserted"]'));
taskApp: ElementFinder = element(by.css('mat-card[title="Task App"]'));
iconTypeLocator = by.css('mat-icon[class*="card-logo-icon"]');
descriptionLocator = by.css('mat-card-subtitle[class*="subtitle"]');
checkApsContainer() {
BrowserVisibility.waitUntilElementIsVisible(this.apsAppsContainer);
async checkApsContainer(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.apsAppsContainer);
}
goToApp(applicationName) {
const app = element(by.css('mat-card[title="' + applicationName + '"]'));
BrowserActions.click(app);
async goToApp(applicationName): Promise<ProcessServiceTabBarPage> {
const app: ElementFinder = element(by.css('mat-card[title="' + applicationName + '"]'));
await BrowserActions.click(app);
return new ProcessServiceTabBarPage();
}
goToTaskApp() {
BrowserActions.click(this.taskApp);
async goToTaskApp(): Promise<ProcessServiceTabBarPage> {
await BrowserActions.click(this.taskApp);
return new ProcessServiceTabBarPage();
}
getAppIconType(applicationName) {
const app = element(by.css('mat-card[title="' + applicationName + '"]'));
BrowserVisibility.waitUntilElementIsVisible(app);
async getAppIconType(applicationName): Promise<string> {
const app: ElementFinder = element(by.css('mat-card[title="' + applicationName + '"]'));
await BrowserVisibility.waitUntilElementIsVisible(app);
const iconType = app.element(this.iconTypeLocator);
return BrowserActions.getText(iconType);
}
getBackgroundColor(applicationName) {
const app = element(by.css('mat-card[title="' + applicationName + '"]'));
BrowserVisibility.waitUntilElementIsVisible(app);
async getBackgroundColor(applicationName): Promise<string> {
const app: ElementFinder = element(by.css('mat-card[title="' + applicationName + '"]'));
await BrowserVisibility.waitUntilElementIsVisible(app);
return app.getCssValue('background-color');
}
getDescription(applicationName) {
const app = element(by.css('mat-card[title="' + applicationName + '"]'));
BrowserVisibility.waitUntilElementIsVisible(app);
async getDescription(applicationName): Promise<string> {
const app: ElementFinder = element(by.css('mat-card[title="' + applicationName + '"]'));
await BrowserVisibility.waitUntilElementIsVisible(app);
const description = app.element(this.descriptionLocator);
return BrowserActions.getText(description);
}
checkAppIsNotDisplayed(applicationName) {
const app = element(by.css('mat-card[title="' + applicationName + '"]'));
return BrowserVisibility.waitUntilElementIsNotOnPage(app);
async checkAppIsNotDisplayed(applicationName): Promise<void> {
const app: ElementFinder = element(by.css('mat-card[title="' + applicationName + '"]'));
await BrowserVisibility.waitUntilElementIsNotVisible(app);
}
checkAppIsDisplayed(applicationName) {
const app = element(by.css('mat-card[title="' + applicationName + '"]'));
return BrowserVisibility.waitUntilElementIsVisible(app);
async checkAppIsDisplayed(applicationName): Promise<void> {
const app: ElementFinder = element(by.css('mat-card[title="' + applicationName + '"]'));
await BrowserVisibility.waitUntilElementIsVisible(app);
}
}
@@ -15,157 +15,130 @@
* limitations under the License.
*/
import { by, element, Key, protractor, browser } from 'protractor';
import { by, element, Key, protractor, browser, ElementFinder } from 'protractor';
import { BrowserVisibility, BrowserActions, FormFields } from '@alfresco/adf-testing';
export class StartProcessPage {
defaultProcessName = element(by.css('input[id="processName"]'));
processNameInput = element(by.id('processName'));
selectProcessDropdownArrow = element(by.css('button[id="adf-select-process-dropdown"]'));
cancelProcessButton = element(by.id('cancel_process'));
formStartProcessButton = element(by.css('button[data-automation-id="adf-form-start process"]'));
startProcessButton = element(by.css('button[data-automation-id="btn-start"]'));
noProcess = element(by.id('no-process-message'));
processDefinition = element(by.css('input[id="processDefinitionName"]'));
processDefinitionOptionsPanel = element(by.css('div[class*="processDefinitionOptions"]'));
defaultProcessName: ElementFinder = element(by.css('input[id="processName"]'));
processNameInput: ElementFinder = element(by.id('processName'));
selectProcessDropdownArrow: ElementFinder = element(by.css('button[id="adf-select-process-dropdown"]'));
cancelProcessButton: ElementFinder = element(by.id('cancel_process'));
formStartProcessButton: ElementFinder = element(by.css('button[data-automation-id="adf-form-start process"]'));
startProcessButton: ElementFinder = element(by.css('button[data-automation-id="btn-start"]'));
noProcess: ElementFinder = element(by.id('no-process-message'));
processDefinition: ElementFinder = element(by.css('input[id="processDefinitionName"]'));
processDefinitionOptionsPanel: ElementFinder = element(by.css('div[class*="processDefinitionOptions"]'));
checkNoProcessMessage() {
BrowserVisibility.waitUntilElementIsVisible(this.noProcess);
async checkNoProcessMessage(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.noProcess);
}
pressDownArrowAndEnter() {
this.processDefinition.sendKeys(protractor.Key.ARROW_DOWN);
return browser.actions().sendKeys(protractor.Key.ENTER).perform();
async pressDownArrowAndEnter(): Promise<void> {
await this.processDefinition.sendKeys(protractor.Key.ARROW_DOWN);
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
}
checkNoProcessDefinitionOptionIsDisplayed() {
BrowserVisibility.waitUntilElementIsNotOnPage(this.processDefinitionOptionsPanel);
async checkNoProcessDefinitionOptionIsDisplayed() {
await BrowserVisibility.waitUntilElementIsNotVisible(this.processDefinitionOptionsPanel);
}
getDefaultName() {
BrowserVisibility.waitUntilElementIsVisible(this.defaultProcessName);
async getDefaultName(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.defaultProcessName);
return this.defaultProcessName.getAttribute('value');
}
deleteDefaultName(name) {
BrowserVisibility.waitUntilElementIsVisible(this.processNameInput);
this.processNameInput.getAttribute('value').then((currentValue) => {
for (let i = currentValue.length; i >= 0; i--) {
if (currentValue === name) {
this.processNameInput.sendKeys(protractor.Key.BACK_SPACE);
}
}
});
async deleteDefaultName(name) {
await BrowserVisibility.waitUntilElementIsVisible(this.processNameInput);
await BrowserActions.clearWithBackSpace(this.processNameInput);
}
enterProcessName(name) {
BrowserVisibility.waitUntilElementIsVisible(this.processNameInput);
this.clearProcessName();
this.processNameInput.sendKeys(name);
async enterProcessName(name): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.processNameInput);
await BrowserActions.clearSendKeys(this.processNameInput, name);
}
clearProcessName() {
BrowserVisibility.waitUntilElementIsVisible(this.processNameInput);
this.processNameInput.clear();
async selectFromProcessDropdown(name): Promise<void> {
await this.clickProcessDropdownArrow();
await this.selectOption(name);
}
selectFromProcessDropdown(name) {
this.clickProcessDropdownArrow();
return this.selectOption(name);
async clickProcessDropdownArrow(): Promise<void> {
await BrowserActions.click(this.selectProcessDropdownArrow);
}
clickProcessDropdownArrow() {
BrowserActions.click(this.selectProcessDropdownArrow);
async checkOptionIsDisplayed(name): Promise<void> {
const selectProcessDropdown: ElementFinder = element(by.cssContainingText('.mat-option-text', name));
await BrowserVisibility.waitUntilElementIsVisible(selectProcessDropdown);
await BrowserVisibility.waitUntilElementIsClickable(selectProcessDropdown);
}
checkOptionIsDisplayed(name) {
const selectProcessDropdown = element(by.cssContainingText('.mat-option-text', name));
BrowserVisibility.waitUntilElementIsVisible(selectProcessDropdown);
BrowserVisibility.waitUntilElementIsClickable(selectProcessDropdown);
return this;
async checkOptionIsNotDisplayed(name): Promise<void> {
const selectProcessDropdown: ElementFinder = element(by.cssContainingText('.mat-option-text', name));
await BrowserVisibility.waitUntilElementIsNotVisible(selectProcessDropdown);
}
checkOptionIsNotDisplayed(name) {
const selectProcessDropdown = element(by.cssContainingText('.mat-option-text', name));
BrowserVisibility.waitUntilElementIsNotOnPage(selectProcessDropdown);
return this;
async selectOption(name): Promise<void> {
const selectProcessDropdown: ElementFinder = element(by.cssContainingText('.mat-option-text', name));
await BrowserActions.click(selectProcessDropdown);
}
selectOption(name) {
const selectProcessDropdown = element(by.cssContainingText('.mat-option-text', name));
BrowserActions.click(selectProcessDropdown);
return this;
async typeProcessDefinition(name): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.processDefinition);
await BrowserVisibility.waitUntilElementIsClickable(this.processDefinition);
await BrowserActions.clearSendKeys(this.processDefinition, name);
}
typeProcessDefinition(name) {
BrowserVisibility.waitUntilElementIsVisible(this.processDefinition);
BrowserVisibility.waitUntilElementIsClickable(this.processDefinition);
this.processDefinition.clear();
this.processDefinition.sendKeys(name);
return this;
}
getProcessDefinitionValue() {
BrowserVisibility.waitUntilElementIsVisible(this.processDefinition);
async getProcessDefinitionValue(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.processDefinition);
return this.processDefinition.getAttribute('value');
}
clickCancelProcessButton() {
BrowserActions.click(this.cancelProcessButton);
async clickCancelProcessButton(): Promise<void> {
await BrowserActions.click(this.cancelProcessButton);
}
clickFormStartProcessButton() {
return BrowserActions.click(this.formStartProcessButton);
async clickFormStartProcessButton(): Promise<void> {
await BrowserActions.click(this.formStartProcessButton);
}
checkStartFormProcessButtonIsEnabled() {
expect(this.formStartProcessButton.isEnabled()).toBe(true);
async checkStartFormProcessButtonIsEnabled() {
await expect(await this.formStartProcessButton.isEnabled()).toBe(true);
}
checkStartProcessButtonIsEnabled() {
expect(this.startProcessButton.isEnabled()).toBe(true);
async checkStartProcessButtonIsEnabled() {
await expect(await this.startProcessButton.isEnabled()).toBe(true);
}
checkStartProcessButtonIsDisabled() {
expect(this.startProcessButton.isEnabled()).toBe(false);
async checkStartProcessButtonIsDisabled() {
await expect(await this.startProcessButton.isEnabled()).toBe(false);
}
clickStartProcessButton() {
return BrowserActions.click(this.startProcessButton);
async clickStartProcessButton(): Promise<void> {
await BrowserActions.click(this.startProcessButton);
}
checkSelectProcessPlaceholderIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.processDefinition);
const processPlaceholder = this.processDefinition.getAttribute('value').then(((result) => {
return result;
}));
async checkSelectProcessPlaceholderIsDisplayed(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.processDefinition);
const processPlaceholder = await this.processDefinition.getAttribute('value');
return processPlaceholder;
}
checkValidationErrorIsDisplayed(error, elementRef = 'mat-error') {
const errorElement = element(by.cssContainingText(elementRef, error));
BrowserVisibility.waitUntilElementIsVisible(errorElement);
return this;
async checkValidationErrorIsDisplayed(error, elementRef = 'mat-error'): Promise<void> {
const errorElement: ElementFinder = element(by.cssContainingText(elementRef, error));
await BrowserVisibility.waitUntilElementIsVisible(errorElement);
}
blur(locator) {
BrowserActions.click(locator);
locator.sendKeys(Key.TAB);
return this;
async blur(locator): Promise<void> {
await BrowserActions.click(locator);
await locator.sendKeys(Key.TAB);
}
clearField(locator) {
BrowserVisibility.waitUntilElementIsVisible(locator);
locator.getAttribute('value').then((result) => {
for (let i = result.length; i >= 0; i--) {
locator.sendKeys(protractor.Key.BACK_SPACE);
}
});
async clearField(locator): Promise<void> {
await BrowserActions.clearWithBackSpace(locator);
}
formFields() {
formFields(): FormFields {
return new FormFields();
}
}
+170 -193
View File
@@ -16,7 +16,7 @@
*/
import { AppSettingsToggles } from './dialog/appSettingsToggles';
import { element, by, browser } from 'protractor';
import { element, by, browser, ElementFinder } from 'protractor';
import { TabsPage } from '@alfresco/adf-testing';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
@@ -24,348 +24,325 @@ export class TaskDetailsPage {
appSettingsTogglesClass = new AppSettingsToggles();
formContent = element(by.css('adf-form'));
formNameField = element(by.css('span[data-automation-id*="formName"] span'));
assigneeField = element(by.css('span[data-automation-id*="assignee"] span'));
statusField = element(by.css('span[data-automation-id*="status"] span'));
categoryField = element(by.css('span[data-automation-id*="category"] span'));
parentNameField = element(by.css('span[data-automation-id*="parentName"] span'));
parentTaskIdField = element(by.css('span[data-automation-id*="parentTaskId"] span'));
durationField = element(by.css('span[data-automation-id*="duration"] span'));
endDateField = element.all(by.css('span[data-automation-id*="endDate"] span')).first();
createdField = element(by.css('span[data-automation-id="card-dateitem-created"] span'));
idField = element.all(by.css('span[data-automation-id*="id"] span')).first();
descriptionField = element(by.css('span[data-automation-id*="description"] span'));
dueDateField = element(by.css('span[data-automation-id*="dueDate"] span'));
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"] span'));
formContent: ElementFinder = element(by.css('adf-form'));
formNameField: ElementFinder = element(by.css('span[data-automation-id*="formName"] span'));
assigneeField: ElementFinder = element(by.css('span[data-automation-id*="assignee"] span'));
statusField: ElementFinder = element(by.css('span[data-automation-id*="status"] span'));
categoryField: ElementFinder = element(by.css('span[data-automation-id*="category"] span'));
parentNameField: ElementFinder = element(by.css('span[data-automation-id*="parentName"] span'));
parentTaskIdField: ElementFinder = element(by.css('span[data-automation-id*="parentTaskId"] span'));
durationField: ElementFinder = element(by.css('span[data-automation-id*="duration"] span'));
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'));
idField: ElementFinder = element.all(by.css('span[data-automation-id*="id"] span')).first();
descriptionField: ElementFinder = element(by.css('span[data-automation-id*="description"] span'));
dueDateField: ElementFinder = element(by.css('span[data-automation-id*="dueDate"] span'));
activitiesTitle: ElementFinder = element(by.css('div[class*="adf-info-drawer-layout-header-title"] div'));
commentField: ElementFinder = element(by.id('comment-input'));
addCommentButton: ElementFinder = element(by.css('[data-automation-id="comments-input-add"]'));
involvePeopleButton: ElementFinder = element(by.css('div[class*="add-people"]'));
addPeopleField: ElementFinder = element(by.css('input[data-automation-id="adf-people-search-input"]'));
addInvolvedUserButton: ElementFinder = element(by.css('button[id="add-people"] span'));
emailInvolvedUser = by.xpath('following-sibling::div[@class="adf-people-email"]');
taskDetailsInfoDrawer = element(by.tagName('adf-info-drawer'));
taskDetailsSection = element(by.css('div[data-automation-id="adf-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('h2[class="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('div[class="adf-search-text-header"]'));
removeInvolvedPeople = element(by.css('button[data-automation-id="Remove"]'));
peopleTitle = element(by.id('people-title'));
attachFormDropdown = element(by.css('div[class="adf-attach-form-row"]'));
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-no-form-remove-button'));
attachFormName = element(by.css('span[class="adf-form-title ng-star-inserted"]'));
emptyTaskDetails = element(by.css('adf-task-details > div > div'));
taskDetailsInfoDrawer: ElementFinder = element(by.tagName('adf-info-drawer'));
taskDetailsSection: ElementFinder = element(by.css('div[data-automation-id="adf-tasks-details"]'));
taskDetailsEmptySection: ElementFinder = element(by.css('div[data-automation-id="adf-tasks-details--empty"]'));
completeTask: ElementFinder = element(by.css('button[id="adf-no-form-complete-button"]'));
completeFormTask: ElementFinder = element(by.css('button[id="adf-form-complete"]'));
taskDetailsTitle: ElementFinder = element(by.css('h2[class="adf-activiti-task-details__header"] span'));
auditLogButton: ElementFinder = element(by.css('button[adf-task-audit]'));
noPeopleInvolved: ElementFinder = element(by.id('no-people-label'));
cancelInvolvePeopleButton: ElementFinder = element(by.id('close-people-search'));
involvePeopleHeader: ElementFinder = element(by.css('div[class="adf-search-text-header"]'));
removeInvolvedPeople: ElementFinder = element(by.css('button[data-automation-id="Remove"]'));
peopleTitle: ElementFinder = element(by.id('people-title'));
attachFormDropdown: ElementFinder = element(by.css('div[class="adf-attach-form-row"]'));
cancelAttachForm: ElementFinder = element(by.id('adf-no-form-cancel-button'));
attachFormButton: ElementFinder = element(by.id('adf-no-form-attach-form-button'));
disabledAttachFormButton: ElementFinder = element(by.css('button[id="adf-no-form-attach-form-button"][disabled]'));
removeAttachForm: ElementFinder = element(by.id('adf-no-form-remove-button'));
attachFormName: ElementFinder = element(by.css('span[class="adf-form-title ng-star-inserted"]'));
emptyTaskDetails: ElementFinder = element(by.css('adf-task-details > div > div'));
getTaskDetailsTitle() {
getTaskDetailsTitle(): Promise<string> {
return BrowserActions.getText(this.taskDetailsTitle);
}
checkSelectedForm(formName) {
BrowserVisibility.waitUntilElementIsVisible(this.attachFormName);
expect(formName).toEqual(this.attachFormName.getText());
async checkSelectedForm(formName): Promise<void> {
const text = await BrowserActions.getText(this.attachFormName);
await expect(formName).toEqual(text);
}
checkAttachFormButtonIsDisabled() {
BrowserVisibility.waitUntilElementIsVisible(this.disabledAttachFormButton);
async checkAttachFormButtonIsDisabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.disabledAttachFormButton);
}
checkAttachFormButtonIsEnabled() {
BrowserVisibility.waitUntilElementIsClickable(this.attachFormButton);
async checkAttachFormButtonIsEnabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsClickable(this.attachFormButton);
}
checkAttachFormDropdownIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.attachFormDropdown);
async checkAttachFormDropdownIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.attachFormDropdown);
}
clickAttachFormDropdown() {
return BrowserActions.click(this.attachFormDropdown);
async clickAttachFormDropdown(): Promise<void> {
await BrowserActions.click(this.attachFormDropdown);
}
selectAttachFormOption(option) {
const selectedOption = element(by.cssContainingText('mat-option[role="option"]', option));
return BrowserActions.click(selectedOption);
async selectAttachFormOption(option): Promise<void> {
const selectedOption: ElementFinder = element(by.cssContainingText('mat-option[role="option"]', option));
await BrowserActions.click(selectedOption);
}
checkCancelAttachFormIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.cancelAttachForm);
async checkCancelAttachFormIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.cancelAttachForm);
}
noFormIsDisplayed() {
BrowserVisibility.waitUntilElementIsNotOnPage(this.formContent);
return this;
async noFormIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.formContent);
}
clickCancelAttachForm() {
return BrowserActions.click(this.cancelAttachForm);
async clickCancelAttachForm(): Promise<void> {
await BrowserActions.click(this.cancelAttachForm);
}
checkRemoveAttachFormIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.removeAttachForm);
async checkRemoveAttachFormIsDisplayed() {
await BrowserVisibility.waitUntilElementIsVisible(this.removeAttachForm);
}
clickRemoveAttachForm() {
return BrowserActions.click(this.removeAttachForm);
async clickRemoveAttachForm(): Promise<void> {
await BrowserActions.click(this.removeAttachForm);
}
checkAttachFormButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.attachFormButton);
async checkAttachFormButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.attachFormButton);
}
checkAttachFormButtonIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotOnPage(this.attachFormButton);
async checkAttachFormButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.attachFormButton);
}
clickAttachFormButton() {
async clickAttachFormButton(): Promise<void> {
return BrowserActions.click(this.attachFormButton);
}
checkFormIsAttached(formName) {
BrowserVisibility.waitUntilElementIsVisible(this.formNameField);
this.formNameField.getText().then((attachedFormName) => {
expect(attachedFormName).toEqual(formName);
});
async checkFormIsAttached(formName): Promise<void> {
const attachedFormName = await BrowserActions.getText(this.formNameField);
await expect(attachedFormName).toEqual(formName);
}
getFormName() {
getFormName(): Promise<string> {
return BrowserActions.getText(this.formNameField);
}
clickForm() {
BrowserActions.closeMenuAndDialogs();
BrowserActions.click(this.formNameField);
async clickForm(): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.click(this.formNameField);
}
getAssignee() {
getAssignee(): Promise<string> {
return BrowserActions.getText(this.assigneeField);
}
getStatus() {
getStatus(): Promise<string> {
return BrowserActions.getText(this.statusField);
}
getCategory() {
getCategory(): Promise<string> {
return BrowserActions.getText(this.categoryField);
}
getParentName() {
getParentName(): Promise<string> {
return BrowserActions.getText(this.parentNameField);
}
getParentTaskId() {
getParentTaskId(): Promise<string> {
return BrowserActions.getText(this.parentTaskIdField);
}
getDuration() {
getDuration(): Promise<string> {
return BrowserActions.getText(this.durationField);
}
getEndDate() {
getEndDate(): Promise<string> {
return BrowserActions.getText(this.endDateField);
}
getCreated() {
getCreated(): Promise<string> {
return BrowserActions.getText(this.createdField);
}
getId() {
getId(): Promise<string> {
return BrowserActions.getText(this.idField);
}
getDescription() {
getDescription(): Promise<string> {
return BrowserActions.getText(this.descriptionField);
}
getDueDate() {
getDueDate(): Promise<string> {
return BrowserActions.getText(this.dueDateField);
}
getTitle() {
getTitle(): Promise<string> {
return BrowserActions.getText(this.activitiesTitle);
}
selectActivityTab() {
const tabsPage = new TabsPage;
tabsPage.clickTabByTitle('Activity');
return this;
async selectActivityTab(): Promise<void> {
const tabsPage: TabsPage = new TabsPage;
await tabsPage.clickTabByTitle('Activity');
}
selectDetailsTab() {
const tabsPage = new TabsPage;
tabsPage.clickTabByTitle('Details');
return this;
async selectDetailsTab(): Promise<void> {
const tabsPage: TabsPage = new TabsPage;
await tabsPage.clickTabByTitle('Details');
}
addComment(comment) {
BrowserVisibility.waitUntilElementIsVisible(this.commentField);
this.commentField.sendKeys(comment);
BrowserActions.click(this.addCommentButton);
return this;
async addComment(comment): Promise<void> {
await BrowserActions.clearSendKeys(this.commentField, comment);
await BrowserActions.click(this.addCommentButton);
}
checkCommentIsDisplayed(comment) {
const row = element(by.cssContainingText('div[id="comment-message"]', comment));
BrowserVisibility.waitUntilElementIsVisible(row);
return this;
async checkCommentIsDisplayed(comment): Promise<void> {
const row: ElementFinder = element(by.cssContainingText('div[id="comment-message"]', comment));
await BrowserVisibility.waitUntilElementIsVisible(row);
}
clickInvolvePeopleButton() {
BrowserVisibility.waitUntilElementIsVisible(this.involvePeopleButton);
BrowserVisibility.waitUntilElementIsClickable(this.involvePeopleButton);
browser.actions().mouseMove(this.involvePeopleButton).perform();
BrowserActions.click(this.involvePeopleButton);
return this;
async clickInvolvePeopleButton(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.involvePeopleButton);
await BrowserVisibility.waitUntilElementIsClickable(this.involvePeopleButton);
await browser.actions().mouseMove(this.involvePeopleButton).perform();
await BrowserActions.click(this.involvePeopleButton);
}
typeUser(user) {
BrowserVisibility.waitUntilElementIsVisible(this.addPeopleField);
this.addPeopleField.sendKeys(user);
return this;
async typeUser(user): Promise<void> {
await BrowserActions.clearSendKeys(this.addPeopleField, user);
}
selectUserToInvolve(user) {
this.getRowsUser(user).click();
return this;
async selectUserToInvolve(user): Promise<void> {
const row = this.getRowsUser(user);
await BrowserActions.click(row);
}
checkUserIsSelected(user) {
const row = element(by.cssContainingText('div[class*="search-list-container"] div[class*="people-full-name"]', user));
BrowserVisibility.waitUntilElementIsVisible(row);
return this;
async checkUserIsSelected(user): Promise<void> {
const row: ElementFinder = element(by.cssContainingText('div[class*="search-list-container"] div[class*="people-full-name"]', user));
await BrowserVisibility.waitUntilElementIsVisible(row);
}
clickAddInvolvedUserButton() {
BrowserActions.click(this.addInvolvedUserButton);
return this;
async clickAddInvolvedUserButton(): Promise<void> {
await BrowserActions.click(this.addInvolvedUserButton);
}
getRowsUser(user) {
const row = element(by.cssContainingText('div[class*="people-full-name"]', user));
BrowserVisibility.waitUntilElementIsVisible(row);
return row;
return element(by.cssContainingText('div[class*="people-full-name"]', user));
}
removeInvolvedUser(user) {
async removeInvolvedUser(user): Promise<void> {
const row = this.getRowsUser(user).element(by.xpath('ancestor::div[contains(@class, "adf-datatable-row")]'));
BrowserVisibility.waitUntilElementIsVisible(row);
row.element(by.css('button[data-automation-id="action_menu_0"]')).click();
BrowserVisibility.waitUntilElementIsVisible(this.removeInvolvedPeople);
return BrowserActions.click(this.removeInvolvedPeople);
await BrowserActions.click(row.element(by.css('button[data-automation-id="action_menu_0"]')));
await BrowserVisibility.waitUntilElementIsVisible(this.removeInvolvedPeople);
await BrowserActions.click(this.removeInvolvedPeople);
}
getInvolvedUserEmail(user) {
const email = this.getRowsUser(user).element(this.emailInvolvedUser);
async getInvolvedUserEmail(user): Promise<string> {
const row = this.getRowsUser(user);
const email = row.element(this.emailInvolvedUser);
return BrowserActions.getText(email);
}
clickAuditLogButton() {
BrowserActions.click(this.auditLogButton);
async clickAuditLogButton(): Promise<void> {
await BrowserActions.click(this.auditLogButton);
}
appSettingsToggles() {
appSettingsToggles(): AppSettingsToggles {
return this.appSettingsTogglesClass;
}
taskInfoDrawerIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.taskDetailsInfoDrawer);
async taskInfoDrawerIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.taskDetailsInfoDrawer);
}
taskInfoDrawerIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotOnPage(this.taskDetailsInfoDrawer);
async taskInfoDrawerIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.taskDetailsInfoDrawer);
}
checkNoPeopleIsInvolved() {
BrowserVisibility.waitUntilElementIsVisible(this.noPeopleInvolved);
return this;
async checkNoPeopleIsInvolved(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.noPeopleInvolved);
}
clickCancelInvolvePeopleButton() {
BrowserActions.click(this.cancelInvolvePeopleButton);
return this;
async clickCancelInvolvePeopleButton(): Promise<void> {
await BrowserActions.click(this.cancelInvolvePeopleButton);
}
getInvolvePeopleHeader() {
getInvolvePeopleHeader(): Promise<string> {
return BrowserActions.getText(this.involvePeopleHeader);
}
getInvolvePeoplePlaceholder() {
BrowserVisibility.waitUntilElementIsVisible(this.addPeopleField);
async getInvolvePeoplePlaceholder(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.addPeopleField);
return this.addPeopleField.getAttribute('placeholder');
}
checkCancelButtonIsEnabled() {
BrowserVisibility.waitUntilElementIsVisible(this.cancelInvolvePeopleButton);
BrowserVisibility.waitUntilElementIsClickable(this.cancelInvolvePeopleButton);
return this;
async checkCancelButtonIsEnabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.cancelInvolvePeopleButton);
await BrowserVisibility.waitUntilElementIsClickable(this.cancelInvolvePeopleButton);
}
checkAddPeopleButtonIsEnabled() {
BrowserVisibility.waitUntilElementIsVisible(this.addInvolvedUserButton);
BrowserVisibility.waitUntilElementIsClickable(this.addInvolvedUserButton);
return this;
async checkAddPeopleButtonIsEnabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.addInvolvedUserButton);
await BrowserVisibility.waitUntilElementIsClickable(this.addInvolvedUserButton);
}
noUserIsDisplayedInSearchInvolvePeople(user) {
BrowserVisibility.waitUntilElementIsNotOnPage(element(by.cssContainingText('div[class*="people-full-name"]', user)));
return this;
async noUserIsDisplayedInSearchInvolvePeople(user): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(element(by.cssContainingText('div[class*="people-full-name"]', user)));
}
getInvolvedPeopleTitle() {
getInvolvedPeopleTitle(): Promise<string> {
return BrowserActions.getText(this.peopleTitle);
}
checkTaskDetailsEmpty() {
checkTaskDetailsEmpty(): Promise<string> {
return BrowserActions.getText(this.taskDetailsEmptySection);
}
checkTaskDetailsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.taskDetailsSection);
BrowserVisibility.waitUntilElementIsVisible(this.formNameField);
BrowserVisibility.waitUntilElementIsVisible(this.assigneeField);
BrowserVisibility.waitUntilElementIsVisible(this.statusField);
BrowserVisibility.waitUntilElementIsVisible(this.categoryField);
BrowserVisibility.waitUntilElementIsVisible(this.parentNameField);
BrowserVisibility.waitUntilElementIsVisible(this.createdField);
BrowserVisibility.waitUntilElementIsVisible(this.idField);
BrowserVisibility.waitUntilElementIsVisible(this.descriptionField);
BrowserVisibility.waitUntilElementIsVisible(this.dueDateField);
BrowserVisibility.waitUntilElementIsVisible(this.activitiesTitle);
async checkTaskDetailsDisplayed(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.taskDetailsSection);
await BrowserVisibility.waitUntilElementIsVisible(this.formNameField);
await BrowserVisibility.waitUntilElementIsVisible(this.assigneeField);
await BrowserVisibility.waitUntilElementIsVisible(this.statusField);
await BrowserVisibility.waitUntilElementIsVisible(this.categoryField);
await BrowserVisibility.waitUntilElementIsVisible(this.parentNameField);
await BrowserVisibility.waitUntilElementIsVisible(this.createdField);
await BrowserVisibility.waitUntilElementIsVisible(this.idField);
await BrowserVisibility.waitUntilElementIsVisible(this.descriptionField);
await BrowserVisibility.waitUntilElementIsVisible(this.dueDateField);
await BrowserVisibility.waitUntilElementIsVisible(this.activitiesTitle);
return BrowserActions.getText(this.taskDetailsSection);
}
clickCompleteTask() {
return BrowserActions.click(this.completeTask);
async clickCompleteTask(): Promise<void> {
await BrowserActions.click(this.completeTask);
}
checkCompleteFormButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.completeFormTask);
return this.completeFormTask;
async checkCompleteFormButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.completeFormTask);
}
checkCompleteTaskButtonIsEnabled() {
BrowserVisibility.waitUntilElementIsClickable(this.completeTask);
return this;
async checkCompleteTaskButtonIsEnabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsClickable(this.completeTask);
}
checkCompleteTaskButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.completeTask);
return this;
async checkCompleteTaskButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.completeTask);
}
clickCompleteFormTask() {
return BrowserActions.click(this.completeFormTask);
async clickCompleteFormTask(): Promise<void> {
await BrowserActions.click(this.completeFormTask);
}
getEmptyTaskDetailsMessage() {
async getEmptyTaskDetailsMessage(): Promise<string> {
return BrowserActions.getText(this.emptyTaskDetails);
}
@@ -15,41 +15,39 @@
* limitations under the License.
*/
import { by } from 'protractor';
import { by, ElementFinder, Locator } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class TaskFiltersPage {
filter;
taskIcon = by.xpath("ancestor::div[@class='mat-list-item-content']/mat-icon");
taskIcon: Locator = by.xpath("ancestor::div[@class='mat-list-item-content']/mat-icon");
constructor(filter) {
constructor(filter: ElementFinder) {
this.filter = filter;
}
checkTaskFilterIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
return this;
async checkTaskFilterIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
}
getTaskFilterIcon() {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
async getTaskFilterIcon(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const icon = this.filter.element(this.taskIcon);
return BrowserActions.getText(icon);
}
checkTaskFilterHasNoIcon() {
BrowserVisibility.waitUntilElementIsVisible(this.filter);
BrowserVisibility.waitUntilElementIsNotOnPage(this.filter.element(this.taskIcon));
async checkTaskFilterHasNoIcon(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.taskIcon));
}
clickTaskFilter() {
async clickTaskFilter(): Promise<void> {
return BrowserActions.click(this.filter);
}
checkTaskFilterNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotVisible(this.filter);
return this.filter;
async checkTaskFilterNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter);
}
}
+13 -14
View File
@@ -17,48 +17,47 @@
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
import { DataTableComponentPage } from '@alfresco/adf-testing';
import { by, element } from 'protractor';
import { by, element, ElementFinder } from 'protractor';
export class TasksListPage {
taskList = element(by.css('adf-tasklist'));
noTasksFound = element.all(by.css("div[class='adf-empty-content__title']")).first();
dataTable = new DataTableComponentPage(this.taskList);
taskList: ElementFinder = element(by.css('adf-tasklist'));
noTasksFound: ElementFinder = element.all(by.css("div[class='adf-empty-content__title']")).first();
dataTable: DataTableComponentPage = new DataTableComponentPage(this.taskList);
getDataTable() {
return this.dataTable;
}
getRowsDisplayedWithSameName(taskName) {
getRowsDisplayedWithSameName(taskName): Promise<string> {
return this.dataTable.getRowsWithSameColumnValues('Name', taskName);
}
checkContentIsDisplayed(taskName) {
checkContentIsDisplayed(taskName): Promise<void> {
return this.dataTable.checkContentIsDisplayed('Name', taskName);
}
checkContentIsNotDisplayed(taskName) {
checkContentIsNotDisplayed(taskName): Promise<void> {
return this.dataTable.checkContentIsNotDisplayed('Name', taskName);
}
checkRowIsSelected(taskName) {
checkRowIsSelected(taskName): Promise<void> {
return this.dataTable.checkRowIsSelected('Name', taskName);
}
selectRow(taskName) {
selectRow(taskName): Promise<void> {
return this.dataTable.selectRow('Name', taskName);
}
getAllRowsNameColumn() {
getAllRowsNameColumn(): Promise<any> {
return this.dataTable.getAllRowsColumnValues('Name');
}
checkTaskListIsLoaded() {
BrowserVisibility.waitUntilElementIsVisible(this.taskList);
return this;
async checkTaskListIsLoaded(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.taskList);
}
getNoTasksFoundMessage() {
getNoTasksFoundMessage(): Promise<string> {
return BrowserActions.getText(this.noTasksFound);
}
+57 -67
View File
@@ -21,141 +21,131 @@ import { TaskDetailsPage } from './taskDetailsPage';
import { FiltersPage } from './filtersPage';
import { ChecklistDialog } from './dialog/createChecklistDialog';
import { TasksListPage } from './tasksListPage';
import { element, by } from 'protractor';
import { element, by, ElementFinder } 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: ElementFinder = element(by.css('button[data-automation-id="create-button"'));
newTaskButton: ElementFinder = element(by.css('button[data-automation-id="btn-start-task"]'));
addChecklistButton: ElementFinder = element(by.css('button[class*="adf-add-to-checklist-button"]'));
rowByRowName = by.xpath('ancestor::mat-chip');
checklistContainer = by.css('div[class*="checklist-menu"]');
taskTitle = 'h2[class="adf-activiti-task-details__header"] span';
rows = by.css('div[class*="adf-datatable-body"] div[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'));
completeButtonNoForm: ElementFinder = element(by.id('adf-no-form-complete-button'));
checklistDialog: ElementFinder = element(by.id('checklist-dialog'));
checklistNoMessage: ElementFinder = element(by.id('checklist-none-message'));
numberOfChecklists: ElementFinder = element(by.css('[data-automation-id="checklist-label"] mat-chip'));
sortByName = by.css('div[data-automation-id="auto_id_name"]');
createNewTask() {
this.clickOnCreateButton();
BrowserActions.click(this.newTaskButton);
async createNewTask(): Promise<StartTaskDialog> {
await this.clickOnCreateButton();
await BrowserActions.clickExecuteScript('button[data-automation-id="btn-start-task"]');
return new StartTaskDialog();
}
newTaskButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.newTaskButton);
return this;
async newTaskButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.newTaskButton);
}
clickOnCreateButton() {
BrowserActions.click(this.createButton);
return this;
async clickOnCreateButton(): Promise<void> {
await BrowserActions.click(this.createButton);
}
formFields() {
formFields(): FormFields {
return new FormFields();
}
taskDetails() {
taskDetails(): TaskDetailsPage {
return new TaskDetailsPage();
}
filtersPage() {
filtersPage(): FiltersPage {
return new FiltersPage();
}
tasksListPage() {
tasksListPage(): TasksListPage {
return new TasksListPage();
}
usingCheckListDialog() {
usingCheckListDialog(): ChecklistDialog {
return new ChecklistDialog();
}
clickOnAddChecklistButton() {
BrowserActions.click(this.addChecklistButton);
async clickOnAddChecklistButton(): Promise<ChecklistDialog> {
await BrowserActions.click(this.addChecklistButton);
return new ChecklistDialog();
}
getRowsName(name) {
const row = element(this.checklistContainer).element(by.cssContainingText('span', name));
BrowserVisibility.waitUntilElementIsVisible(row);
const row: ElementFinder = element(this.checklistContainer).element(by.cssContainingText('span', name));
return row;
}
getChecklistByName(checklist) {
const row = this.getRowsName(checklist).element(this.rowByRowName);
BrowserVisibility.waitUntilElementIsVisible(row);
const elem = this.getRowsName(checklist);
const row = elem.element(this.rowByRowName);
return row;
}
checkChecklistIsDisplayed(checklist) {
BrowserVisibility.waitUntilElementIsVisible(this.getChecklistByName(checklist));
return this;
async checkChecklistIsDisplayed(checklist): Promise<void> {
const checklistEle = this.getChecklistByName(checklist);
await BrowserVisibility.waitUntilElementIsVisible(checklistEle);
}
checkChecklistIsNotDisplayed(checklist) {
BrowserVisibility.waitUntilElementIsNotOnPage(element(this.checklistContainer).element(by.cssContainingText('span', checklist)));
return this;
async checkChecklistIsNotDisplayed(checklist): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(element(this.checklistContainer).element(by.cssContainingText('span', checklist)));
}
checkTaskTitle(taskName) {
BrowserVisibility.waitUntilElementIsVisible(element(by.css(this.taskTitle)));
const title = element(by.cssContainingText(this.taskTitle, taskName));
BrowserVisibility.waitUntilElementIsVisible(title);
return this;
async checkTaskTitle(taskName): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.css(this.taskTitle)));
const title: ElementFinder = element(by.cssContainingText(this.taskTitle, taskName));
await BrowserVisibility.waitUntilElementIsVisible(title);
}
completeTaskNoForm() {
BrowserActions.click(this.completeButtonNoForm);
async completeTaskNoForm(): Promise<void> {
await BrowserActions.click(this.completeButtonNoForm);
}
completeTaskNoFormNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotOnPage(this.completeButtonNoForm);
return this;
async completeTaskNoFormNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.completeButtonNoForm);
}
checkChecklistDialogIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.checklistDialog);
return this;
async checkChecklistDialogIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.checklistDialog);
}
checkChecklistDialogIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotOnPage(this.checklistDialog);
return this;
async checkChecklistDialogIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.checklistDialog);
}
checkNoChecklistIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.checklistNoMessage);
return this;
async checkNoChecklistIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.checklistNoMessage);
}
getNumberOfChecklists() {
getNumberOfChecklists(): Promise<string> {
return BrowserActions.getText(this.numberOfChecklists);
}
removeChecklists(checklist) {
const row = this.getRowsName(checklist).element(this.rowByRowName);
BrowserVisibility.waitUntilElementIsVisible(row.element(by.css('mat-icon')));
row.element(by.css('mat-icon')).click();
return this;
async removeChecklists(checklist): Promise<void> {
const elem = this.getRowsName(checklist);
const row = elem.element(this.rowByRowName);
await BrowserActions.click(row.element(by.css('mat-icon')));
}
checkChecklistsRemoveButtonIsNotDisplayed(checklist) {
const row = this.getRowsName(checklist).element(this.rowByRowName);
BrowserVisibility.waitUntilElementIsNotOnPage(row.element(by.css('mat-icon')));
return this;
async checkChecklistsRemoveButtonIsNotDisplayed(checklist): Promise<void> {
const elem = this.getRowsName(checklist);
const row = elem.element(this.rowByRowName);
await BrowserVisibility.waitUntilElementIsNotVisible(row.element(by.css('mat-icon')));
}
clickSortByNameAsc() {
return this.tasksListPage().getDataTable().sortByColumn('ASC', 'name');
async clickSortByNameAsc(): Promise<any> {
return await this.tasksListPage().getDataTable().sortByColumn('ASC', 'name');
}
clickSortByNameDesc() {
return this.tasksListPage().getDataTable().sortByColumn('DESC', 'name');
async clickSortByNameDesc(): Promise<any> {
return await this.tasksListPage().getDataTable().sortByColumn('DESC', 'name');
}
}
+123 -171
View File
@@ -15,280 +15,232 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { element, by, ElementFinder } from 'protractor';
import { BrowserVisibility, SearchCategoriesPage } from '@alfresco/adf-testing';
import {
SearchCheckListPage,
SearchTextPage,
NumberRangeFilterPage,
DateRangeFilterPage,
SearchSliderPage,
SearchRadioPage
} from '@alfresco/adf-testing';
export class SearchFiltersPage {
searchCategoriesPage = new SearchCategoriesPage();
searchCategoriesPage: SearchCategoriesPage = new SearchCategoriesPage();
searchFilters = element(by.css('adf-search-filter'));
fileTypeFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_FIELDS.TYPE"]'));
creatorFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_FIELDS.CREATOR"]'));
fileSizeFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_FIELDS.SIZE"]'));
nameFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Name"]'));
checkListFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Check List"]'));
createdDateRangeFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Created Date (range)"]'));
typeFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Type"]'));
sizeRangeFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Content Size (range)"]'));
sizeSliderFilter = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Content Size"]'));
facetQueriesDefaultGroup = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_QUERIES.MY_FACET_QUERIES"],' +
searchFilters: ElementFinder = element(by.css('adf-search-filter'));
fileTypeFilter: ElementFinder = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_FIELDS.TYPE"]'));
creatorFilter: ElementFinder = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_FIELDS.CREATOR"]'));
fileSizeFilter: ElementFinder = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_FIELDS.SIZE"]'));
nameFilter: ElementFinder = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Name"]'));
checkListFilter: ElementFinder = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Check List"]'));
createdDateRangeFilter: ElementFinder = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Created Date (range)"]'));
typeFilter: ElementFinder = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Type"]'));
sizeRangeFilter: ElementFinder = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Content Size (range)"]'));
sizeSliderFilter: ElementFinder = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Content Size"]'));
facetQueriesDefaultGroup: ElementFinder = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_QUERIES.MY_FACET_QUERIES"],' +
'mat-expansion-panel[data-automation-id="expansion-panel-My facet queries"]'));
facetQueriesTypeGroup = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Type facet queries"]'));
facetQueriesSizeGroup = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Size facet queries"]'));
facetIntervalsByCreated = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-The Created"]'));
facetIntervalsByModified = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-TheModified"]'));
facetQueriesTypeGroup: ElementFinder = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Type facet queries"]'));
facetQueriesSizeGroup: ElementFinder = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-Size facet queries"]'));
facetIntervalsByCreated: ElementFinder = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-The Created"]'));
facetIntervalsByModified: ElementFinder = element(by.css('mat-expansion-panel[data-automation-id="expansion-panel-TheModified"]'));
checkSearchFiltersIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.searchFilters);
async checkSearchFiltersIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.searchFilters);
}
sizeRangeFilterPage() {
return this.searchCategoriesPage.numberRangeFilter(this.sizeRangeFilter);
sizeRangeFilterPage(): NumberRangeFilterPage {
return SearchCategoriesPage.numberRangeFilter(this.sizeRangeFilter);
}
createdDateRangeFilterPage() {
return this.searchCategoriesPage.dateRangeFilter(this.createdDateRangeFilter);
createdDateRangeFilterPage(): DateRangeFilterPage {
return SearchCategoriesPage.dateRangeFilter(this.createdDateRangeFilter);
}
textFiltersPage() {
return this.searchCategoriesPage.textFiltersPage(this.nameFilter);
textFiltersPage(): SearchTextPage {
return SearchCategoriesPage.textFiltersPage(this.nameFilter);
}
checkListFiltersPage() {
return this.searchCategoriesPage.checkListFiltersPage(this.checkListFilter);
checkListFiltersPage(): SearchCheckListPage {
return SearchCategoriesPage.checkListFiltersPage(this.checkListFilter);
}
creatorCheckListFiltersPage() {
return this.searchCategoriesPage.checkListFiltersPage(this.creatorFilter);
creatorCheckListFiltersPage(): SearchCheckListPage {
return SearchCategoriesPage.checkListFiltersPage(this.creatorFilter);
}
fileTypeCheckListFiltersPage() {
return this.searchCategoriesPage.checkListFiltersPage(this.fileTypeFilter);
fileTypeCheckListFiltersPage(): SearchCheckListPage {
return SearchCategoriesPage.checkListFiltersPage(this.fileTypeFilter);
}
checkCustomFacetFieldLabelIsDisplayed(fieldLabel) {
BrowserVisibility.waitUntilElementIsVisible(element(by.css(`mat-expansion-panel[data-automation-id="expansion-panel-${fieldLabel}"]`)));
typeFiltersPage(): SearchRadioPage {
return SearchCategoriesPage.radioFiltersPage(this.typeFilter);
}
sizeSliderFilterPage() {
return this.searchCategoriesPage.sliderFilter(this.sizeSliderFilter);
async checkCustomFacetFieldLabelIsDisplayed(fieldLabel): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.css(`mat-expansion-panel[data-automation-id="expansion-panel-${fieldLabel}"]`)));
}
checkFileTypeFilterIsDisplayed() {
this.searchCategoriesPage.checkFilterIsDisplayed(this.fileTypeFilter);
return this;
sizeSliderFilterPage(): SearchSliderPage {
return SearchCategoriesPage.sliderFilter(this.sizeSliderFilter);
}
checkCreatorFilterIsDisplayed() {
this.searchCategoriesPage.checkFilterIsDisplayed(this.creatorFilter);
return this;
async checkCheckListFilterIsDisplayed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsDisplayed(this.checkListFilter);
}
checkCheckListFilterIsDisplayed() {
this.searchCategoriesPage.checkFilterIsDisplayed(this.checkListFilter);
return this;
async checkNameFilterIsExpanded(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsExpanded(this.nameFilter);
}
checkNameFilterIsExpanded() {
this.searchCategoriesPage.checkFilterIsExpanded(this.nameFilter);
return this;
async checkNameFilterIsDisplayed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsDisplayed(this.nameFilter);
}
checkNameFilterIsDisplayed() {
this.searchCategoriesPage.checkFilterIsDisplayed(this.nameFilter);
return this;
async checkDefaultFacetQueryGroupIsDisplayed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsDisplayed(this.facetQueriesDefaultGroup);
}
checkDefaultFacetQueryGroupIsDisplayed() {
this.searchCategoriesPage.checkFilterIsDisplayed(this.facetQueriesDefaultGroup);
return this;
async checkTypeFacetQueryGroupIsDisplayed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsDisplayed(this.facetQueriesTypeGroup);
}
checkTypeFacetQueryGroupIsDisplayed() {
this.searchCategoriesPage.checkFilterIsDisplayed(this.facetQueriesTypeGroup);
return this;
async checkSizeFacetQueryGroupIsDisplayed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsDisplayed(this.facetQueriesSizeGroup);
}
checkSizeFacetQueryGroupIsDisplayed() {
this.searchCategoriesPage.checkFilterIsDisplayed(this.facetQueriesSizeGroup);
return this;
async checkFacetIntervalsByCreatedIsDisplayed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsDisplayed(this.facetIntervalsByCreated);
}
checkFacetIntervalsByCreatedIsDisplayed() {
this.searchCategoriesPage.checkFilterIsDisplayed(this.facetIntervalsByCreated);
return this;
async checkFacetIntervalsByModifiedIsDisplayed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsDisplayed(this.facetIntervalsByModified);
}
checkFacetIntervalsByModifiedIsDisplayed() {
this.searchCategoriesPage.checkFilterIsDisplayed(this.facetIntervalsByModified);
return this;
async isTypeFacetQueryGroupPresent(): Promise<boolean> {
return await this.facetQueriesTypeGroup.isPresent();
}
isTypeFacetQueryGroupPresent() {
return this.facetQueriesTypeGroup.isPresent();
async isSizeFacetQueryGroupPresent(): Promise<boolean> {
return await this.facetQueriesSizeGroup.isPresent();
}
isSizeFacetQueryGroupPresent() {
return this.facetQueriesSizeGroup.isPresent();
async clickCheckListFilter(): Promise<void> {
await this.searchCategoriesPage.clickFilter(this.checkListFilter);
}
clickCheckListFilter() {
this.searchCategoriesPage.clickFilter(this.checkListFilter);
return this;
async clickFileTypeListFilter(): Promise<void> {
await this.searchCategoriesPage.clickFilter(this.fileTypeFilter);
}
clickFileTypeListFilter() {
this.searchCategoriesPage.clickFilter(this.fileTypeFilter);
return this;
async clickFileSizeFilterHeader(): Promise<void> {
await this.searchCategoriesPage.clickFilterHeader(this.fileSizeFilter);
}
clickFileSizeFilterHeader() {
this.searchCategoriesPage.clickFilterHeader(this.fileSizeFilter);
return this;
async checkFileSizeFilterIsCollapsed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsCollapsed(this.fileSizeFilter);
}
checkFileSizeFilterIsCollapsed() {
this.searchCategoriesPage.checkFilterIsCollapsed(this.fileSizeFilter);
return this;
async checkFileTypeFilterIsCollapsed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsCollapsed(this.fileTypeFilter);
}
clickFileTypeFilterHeader() {
this.searchCategoriesPage.clickFilterHeader(this.fileTypeFilter);
return this;
async checkCheckListFilterIsCollapsed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsCollapsed(this.checkListFilter);
}
checkFileTypeFilterIsCollapsed() {
this.searchCategoriesPage.checkFilterIsCollapsed(this.fileTypeFilter);
return this;
async checkCheckListFilterIsExpanded(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsExpanded(this.checkListFilter);
}
checkCheckListFilterIsCollapsed() {
this.searchCategoriesPage.checkFilterIsCollapsed(this.checkListFilter);
async checkCreatedRangeFilterIsDisplayed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsDisplayed(this.createdDateRangeFilter);
}
checkCheckListFilterIsExpanded() {
this.searchCategoriesPage.checkFilterIsExpanded(this.checkListFilter);
return this;
async clickCreatedRangeFilterHeader(): Promise<void> {
await this.searchCategoriesPage.clickFilterHeader(this.createdDateRangeFilter);
}
checkCreatedRangeFilterIsDisplayed() {
this.searchCategoriesPage.checkFilterIsDisplayed(this.createdDateRangeFilter);
return this;
async checkCreatedRangeFilterIsExpanded(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsExpanded(this.createdDateRangeFilter);
}
clickCreatedRangeFilterHeader() {
this.searchCategoriesPage.clickFilterHeader(this.createdDateRangeFilter);
return this;
async checkTypeFilterIsDisplayed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsDisplayed(this.typeFilter);
}
checkCreatedRangeFilterIsExpanded() {
this.searchCategoriesPage.checkFilterIsExpanded(this.createdDateRangeFilter);
return this;
async checkTypeFilterIsCollapsed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsCollapsed(this.typeFilter);
}
typeFiltersPage() {
return this.searchCategoriesPage.radioFiltersPage(this.typeFilter);
async clickTypeFilterHeader(): Promise<void> {
await this.searchCategoriesPage.clickFilterHeader(this.typeFilter);
}
checkTypeFilterIsDisplayed() {
this.searchCategoriesPage.checkFilterIsDisplayed(this.typeFilter);
return this;
async checkSizeRangeFilterIsDisplayed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsDisplayed(this.createdDateRangeFilter);
}
clickTypeFilter() {
this.searchCategoriesPage.clickFilter(this.typeFilter);
return this;
async clickSizeRangeFilterHeader(): Promise<void> {
await this.searchCategoriesPage.clickFilterHeader(this.sizeRangeFilter);
}
checkTypeFilterIsCollapsed() {
this.searchCategoriesPage.checkFilterIsCollapsed(this.typeFilter);
return this;
async checkSizeRangeFilterIsExpanded(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsExpanded(this.sizeRangeFilter);
}
clickTypeFilterHeader() {
this.searchCategoriesPage.clickFilterHeader(this.typeFilter);
return this;
async checkSizeRangeFilterIsCollapsed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsCollapsed(this.sizeRangeFilter);
}
checkSizeRangeFilterIsDisplayed() {
this.searchCategoriesPage.checkFilterIsDisplayed(this.createdDateRangeFilter);
return this;
async checkSizeSliderFilterIsDisplayed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsDisplayed(this.sizeSliderFilter);
}
clickSizeRangeFilterHeader() {
this.searchCategoriesPage.clickFilterHeader(this.sizeRangeFilter);
return this;
async clickSizeSliderFilterHeader(): Promise<void> {
await this.searchCategoriesPage.clickFilterHeader(this.sizeSliderFilter);
}
checkSizeRangeFilterIsExpanded() {
this.searchCategoriesPage.checkFilterIsExpanded(this.sizeRangeFilter);
return this;
async checkSizeSliderFilterIsExpanded(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsExpanded(this.sizeSliderFilter);
}
checkSizeRangeFilterIsCollapsed() {
this.searchCategoriesPage.checkFilterIsCollapsed(this.sizeRangeFilter);
return this;
async checkSizeSliderFilterIsCollapsed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsCollapsed(this.sizeSliderFilter);
}
checkSizeSliderFilterIsDisplayed() {
this.searchCategoriesPage.checkFilterIsDisplayed(this.sizeSliderFilter);
return this;
async checkFacetIntervalsByCreatedIsExpanded(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsExpanded(this.facetIntervalsByCreated);
}
clickSizeSliderFilterHeader() {
this.searchCategoriesPage.clickFilterHeader(this.sizeSliderFilter);
return this;
async checkFacetIntervalsByCreatedIsCollapsed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsCollapsed(this.facetIntervalsByCreated);
}
checkSizeSliderFilterIsExpanded() {
this.searchCategoriesPage.checkFilterIsExpanded(this.sizeSliderFilter);
return this;
async clickFacetIntervalsByCreatedFilterHeader(): Promise<void> {
await this.searchCategoriesPage.clickFilterHeader(this.facetIntervalsByCreated);
}
checkSizeSliderFilterIsCollapsed() {
this.searchCategoriesPage.checkFilterIsCollapsed(this.sizeSliderFilter);
return this;
async checkFacetIntervalsByModifiedIsExpanded(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsExpanded(this.facetIntervalsByModified);
}
checkFacetIntervalsByCreatedIsExpanded() {
this.searchCategoriesPage.checkFilterIsExpanded(this.facetIntervalsByCreated);
return this;
async checkFacetIntervalsByModifiedIsCollapsed(): Promise<void> {
await this.searchCategoriesPage.checkFilterIsCollapsed(this.facetIntervalsByModified);
}
checkFacetIntervalsByCreatedIsCollapsed() {
this.searchCategoriesPage.checkFilterIsCollapsed(this.facetIntervalsByCreated);
return this;
async clickFacetIntervalsByModifiedFilterHeader(): Promise<void> {
await this.searchCategoriesPage.clickFilterHeader(this.facetIntervalsByModified);
}
clickFacetIntervalsByCreatedFilterHeader() {
this.searchCategoriesPage.clickFilterHeader(this.facetIntervalsByCreated);
return this;
async checkFileTypeFacetLabelIsDisplayed(fileType: string | RegExp): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.fileTypeFilter.element(by.cssContainingText('.adf-facet-label', fileType)));
}
checkFacetIntervalsByModifiedIsExpanded() {
this.searchCategoriesPage.checkFilterIsExpanded(this.facetIntervalsByModified);
return this;
}
checkFacetIntervalsByModifiedIsCollapsed() {
this.searchCategoriesPage.checkFilterIsCollapsed(this.facetIntervalsByModified);
return this;
}
clickFacetIntervalsByModifiedFilterHeader() {
this.searchCategoriesPage.clickFilterHeader(this.facetIntervalsByModified);
return this;
}
checkFileTypeFacetLabelIsDisplayed(fileType: string | RegExp) {
BrowserVisibility.waitUntilElementIsVisible(this.fileTypeFilter.element(by.cssContainingText('.adf-facet-label', fileType)));
return this;
}
checkFileTypeFacetLabelIsNotDisplayed(fileType: string | RegExp) {
BrowserVisibility.waitUntilElementIsNotVisible(this.fileTypeFilter.element(by.cssContainingText('.adf-facet-label', fileType)));
return this;
async checkFileTypeFacetLabelIsNotDisplayed(fileType: string | RegExp): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.fileTypeFilter.element(by.cssContainingText('.adf-facet-label', fileType)));
}
}
+31 -41
View File
@@ -16,85 +16,75 @@
*/
import { DataTableComponentPage } from '@alfresco/adf-testing';
import { element, by } from 'protractor';
import { element, by, ElementFinder } from 'protractor';
import { ContentServicesPage } from './contentServicesPage';
import { BrowserVisibility, SearchSortingPickerPage } from '@alfresco/adf-testing';
export class SearchResultsPage {
noResultsMessage = element(by.css('div[class="adf-no-result-message"]'));
dataTable = new DataTableComponentPage();
searchSortingPicker = new SearchSortingPickerPage();
contentServices = new ContentServicesPage();
noResultsMessage: ElementFinder = element(by.css('div[class="adf-no-result-message"]'));
dataTable: DataTableComponentPage = new DataTableComponentPage();
searchSortingPicker: SearchSortingPickerPage = new SearchSortingPickerPage();
contentServices: ContentServicesPage = new ContentServicesPage();
getNodeHighlight(content) {
return this.dataTable.getCellByRowContentAndColumn('Display name', content, 'Search');
}
tableIsLoaded() {
this.dataTable.tableIsLoaded();
async tableIsLoaded(): Promise<void> {
await this.dataTable.tableIsLoaded();
}
checkContentIsDisplayed(content) {
this.dataTable.checkContentIsDisplayed('Display name', content);
return this;
async checkContentIsDisplayed(content): Promise<void> {
await this.dataTable.checkContentIsDisplayed('Display name', content);
}
numberOfResultsDisplayed() {
return this.dataTable.numberOfRows();
async numberOfResultsDisplayed(): Promise<number> {
return await this.dataTable.numberOfRows();
}
checkContentIsNotDisplayed(content) {
this.dataTable.checkContentIsNotDisplayed('Display name', content);
return this;
async checkContentIsNotDisplayed(content): Promise<void> {
await this.dataTable.checkContentIsNotDisplayed('Display name', content);
}
checkNoResultMessageIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.noResultsMessage);
return this;
async checkNoResultMessageIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.noResultsMessage);
}
checkNoResultMessageIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotOnPage(this.noResultsMessage);
return this;
async checkNoResultMessageIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.noResultsMessage);
}
navigateToFolder(content) {
this.dataTable.doubleClickRow('Display name', content);
return this;
async navigateToFolder(content): Promise<void> {
await this.dataTable.doubleClickRow('Display name', content);
}
deleteContent(content) {
this.contentServices.deleteContent(content);
async deleteContent(content): Promise<void> {
await this.contentServices.deleteContent(content);
}
sortByName(sortOrder: string) {
this.searchSortingPicker.sortBy(sortOrder, 'Name');
async sortByName(sortOrder: string): Promise<void> {
await this.searchSortingPicker.sortBy(sortOrder, 'Name');
}
sortByAuthor(sortOrder: string) {
this.searchSortingPicker.sortBy(sortOrder, 'Author');
async sortByAuthor(sortOrder: string): Promise<void> {
await this.searchSortingPicker.sortBy(sortOrder, 'Author');
}
sortByCreated(sortOrder: string) {
this.searchSortingPicker.sortBy(sortOrder, 'Created');
async sortByCreated(sortOrder: string): Promise<void> {
await this.searchSortingPicker.sortBy(sortOrder, 'Created');
}
sortBySize(sortOrder: string) {
this.searchSortingPicker.sortBy(sortOrder, 'Size');
return this;
async sortBySize(sortOrder: string): Promise<void> {
await this.searchSortingPicker.sortBy(sortOrder, 'Size');
}
async checkListIsOrderedByNameAsc() {
async checkListIsOrderedByNameAsc(): Promise<any> {
return this.contentServices.contentList.dataTablePage().checkListIsSorted('ASC', 'Display name');
}
async checkListIsOrderedByNameDesc() {
async checkListIsOrderedByNameDesc(): Promise<any> {
return this.contentServices.contentList.dataTablePage().checkListIsSorted('DESC', 'Display name');
}
async checkListIsOrderedByAuthorAsc() {
return this.contentServices.contentList.dataTablePage().checkListIsSorted('ASC', 'Created by');
}
}
+116 -140
View File
@@ -15,220 +15,196 @@
* limitations under the License.
*/
import { element, by, protractor, browser } from 'protractor';
import { element, by, protractor, browser, ElementFinder, ElementArrayFinder } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class TagPage {
addTagButton = element(by.css('button[id="add-tag"]'));
insertNodeIdElement = element(by.css('input[id="nodeId"]'));
newTagInput = element(by.css('input[id="new-tag-text"]'));
tagListRow = element(by.css('adf-tag-node-actions-list mat-list-item'));
tagListByNodeIdRow = element(by.css('adf-tag-node-list mat-chip'));
errorMessage = element(by.css('mat-hint[data-automation-id="errorMessage"]'));
addTagButton: ElementFinder = element(by.css('button[id="add-tag"]'));
insertNodeIdElement: ElementFinder = element(by.css('input[id="nodeId"]'));
newTagInput: ElementFinder = element(by.css('input[id="new-tag-text"]'));
tagListRow: ElementFinder = element(by.css('adf-tag-node-actions-list mat-list-item'));
tagListByNodeIdRow: ElementFinder = element(by.css('adf-tag-node-list mat-chip'));
errorMessage: ElementFinder = element(by.css('mat-hint[data-automation-id="errorMessage"]'));
tagListRowLocator = by.css('adf-tag-node-actions-list mat-list-item div');
tagListByNodeIdRowLocator = by.css('adf-tag-node-list mat-chip span');
tagListContentServicesRowLocator = by.css('div[class*="adf-list-tag"]');
showDeleteButton = element(by.id('adf-remove-button-tag'));
showMoreButton = element(by.css('button[data-automation-id="show-more-tags"]'));
showLessButton = element(by.css('button[data-automation-id="show-fewer-tags"]'));
tagsOnPage = element.all(by.css('div[class*="adf-list-tag"]'));
confirmTag = element(by.id('adf-tag-node-send'));
showDeleteButton: ElementFinder = element(by.id('adf-remove-button-tag'));
showMoreButton: ElementFinder = element(by.css('button[data-automation-id="show-more-tags"]'));
showLessButton: ElementFinder = element(by.css('button[data-automation-id="show-fewer-tags"]'));
tagsOnPage: ElementArrayFinder = element.all(by.css('div[class*="adf-list-tag"]'));
confirmTag: ElementFinder = element(by.id('adf-tag-node-send'));
getNodeId() {
BrowserVisibility.waitUntilElementIsVisible(this.insertNodeIdElement);
return this.insertNodeIdElement.getAttribute('value');
async getNodeId(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.insertNodeIdElement);
return await this.insertNodeIdElement.getAttribute('value');
}
insertNodeId(nodeId) {
BrowserActions.clearSendKeys(this.insertNodeIdElement, nodeId);
async insertNodeId(nodeId) {
await BrowserActions.clearSendKeys(this.insertNodeIdElement, nodeId);
browser.driver.sleep(200);
this.insertNodeIdElement.sendKeys(' ');
browser.driver.sleep(200);
this.insertNodeIdElement.sendKeys(protractor.Key.BACK_SPACE);
this.clickConfirmTag();
await browser.sleep(200);
await this.insertNodeIdElement.sendKeys(' ');
await browser.sleep(200);
await this.insertNodeIdElement.sendKeys(protractor.Key.BACK_SPACE);
await this.clickConfirmTag();
}
addNewTagInput(tag) {
BrowserVisibility.waitUntilElementIsVisible(this.newTagInput);
BrowserActions.clearSendKeys(this.newTagInput, tag);
return this;
async addNewTagInput(tag) {
await BrowserVisibility.waitUntilElementIsVisible(this.newTagInput);
await BrowserActions.clearSendKeys(this.newTagInput, tag);
}
addTag(tag) {
this.addNewTagInput(tag);
BrowserActions.click(this.addTagButton);
return this;
async addTag(tag): Promise<void> {
await this.addNewTagInput(tag);
await BrowserActions.click(this.addTagButton);
}
deleteTagFromTagListByNodeId(name) {
const deleteChip = element(by.id('tag_chips_delete_' + name));
BrowserActions.click(deleteChip);
return this;
async deleteTagFromTagListByNodeId(name): Promise<void> {
const deleteChip: ElementFinder = element(by.id('tag_chips_delete_' + name));
await BrowserActions.click(deleteChip);
}
deleteTagFromTagList(name) {
const deleteChip = element(by.id('tag_chips_delete_' + name));
BrowserActions.click(deleteChip);
return this;
async deleteTagFromTagList(name): Promise<void> {
const deleteChip: ElementFinder = element(by.id('tag_chips_delete_' + name));
await BrowserActions.click(deleteChip);
}
getNewTagInput() {
BrowserVisibility.waitUntilElementIsVisible(this.newTagInput);
return this.newTagInput.getAttribute('value');
async getNewTagInput(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.newTagInput);
return await this.newTagInput.getAttribute('value');
}
getNewTagPlaceholder() {
BrowserVisibility.waitUntilElementIsVisible(this.newTagInput);
return this.newTagInput.getAttribute('placeholder');
async getNewTagPlaceholder(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.newTagInput);
return await this.newTagInput.getAttribute('placeholder');
}
addTagButtonIsEnabled() {
BrowserVisibility.waitUntilElementIsVisible(this.addTagButton);
return this.addTagButton.isEnabled();
async addTagButtonIsEnabled(): Promise<boolean> {
await BrowserVisibility.waitUntilElementIsVisible(this.addTagButton);
return await this.addTagButton.isEnabled();
}
checkTagIsDisplayedInTagList(tagName) {
const tag = element(by.cssContainingText('div[id*="tag_name"]', tagName));
return BrowserVisibility.waitUntilElementIsVisible(tag);
async checkTagIsDisplayedInTagList(tagName): Promise<void> {
const tag: ElementFinder = element(by.cssContainingText('div[id*="tag_name"]', tagName));
await BrowserVisibility.waitUntilElementIsVisible(tag);
}
checkTagIsNotDisplayedInTagList(tagName) {
const tag = element(by.cssContainingText('div[id*="tag_name"]', tagName));
return BrowserVisibility.waitUntilElementIsNotOnPage(tag);
async checkTagIsNotDisplayedInTagList(tagName): Promise<void> {
const tag: ElementFinder = element(by.cssContainingText('div[id*="tag_name"]', tagName));
await BrowserVisibility.waitUntilElementIsNotVisible(tag);
}
checkTagIsNotDisplayedInTagListByNodeId(tagName) {
const tag = element(by.cssContainingText('span[id*="tag_name"]', tagName));
return BrowserVisibility.waitUntilElementIsNotOnPage(tag);
async checkTagIsNotDisplayedInTagListByNodeId(tagName): Promise<void> {
const tag: ElementFinder = element(by.cssContainingText('span[id*="tag_name"]', tagName));
await BrowserVisibility.waitUntilElementIsNotVisible(tag);
}
checkTagIsDisplayedInTagListByNodeId(tagName) {
const tag = element(by.cssContainingText('span[id*="tag_name"]', tagName));
return BrowserVisibility.waitUntilElementIsVisible(tag);
async checkTagIsDisplayedInTagListByNodeId(tagName): Promise<void> {
const tag: ElementFinder = element(by.cssContainingText('span[id*="tag_name"]', tagName));
await BrowserVisibility.waitUntilElementIsVisible(tag);
}
checkTagListIsEmpty() {
BrowserVisibility.waitUntilElementIsNotOnPage(this.tagListRow);
async checkTagListIsEmpty(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.tagListRow);
}
checkTagListByNodeIdIsEmpty() {
return BrowserVisibility.waitUntilElementIsNotOnPage(this.tagListByNodeIdRow);
async checkTagListByNodeIdIsEmpty(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.tagListByNodeIdRow);
}
checkTagIsDisplayedInTagListContentServices(tagName) {
const tag = element(by.cssContainingText('div[class="adf-list-tag"][id*="tag_name"]', tagName));
return BrowserVisibility.waitUntilElementIsVisible(tag);
async checkTagIsDisplayedInTagListContentServices(tagName): Promise<void> {
const tag: ElementFinder = element(by.cssContainingText('div[class="adf-list-tag"][id*="tag_name"]', tagName));
await BrowserVisibility.waitUntilElementIsVisible(tag);
}
getErrorMessage() {
return BrowserActions.getText(this.errorMessage);
async getErrorMessage(): Promise<string> {
return await BrowserActions.getText(this.errorMessage);
}
checkTagListIsOrderedAscending() {
const deferred = protractor.promise.defer();
this.checkListIsSorted(false, this.tagListRowLocator).then((result) => {
deferred.fulfill(result);
});
return deferred.promise;
async checkTagListIsOrderedAscending(): Promise<any> {
await this.checkListIsSorted(false, this.tagListRowLocator);
}
checkTagListByNodeIdIsOrderedAscending() {
const deferred = protractor.promise.defer();
this.checkListIsSorted(false, this.tagListByNodeIdRowLocator).then((result) => {
deferred.fulfill(result);
});
return deferred.promise;
async checkTagListByNodeIdIsOrderedAscending(): Promise<any> {
await this.checkListIsSorted(false, this.tagListByNodeIdRowLocator);
}
checkTagListContentServicesIsOrderedAscending() {
const deferred = protractor.promise.defer();
this.checkListIsSorted(false, this.tagListContentServicesRowLocator).then((result) => {
deferred.fulfill(result);
});
return deferred.promise;
async checkTagListContentServicesIsOrderedAscending(): Promise<any> {
await this.checkListIsSorted(false, this.tagListContentServicesRowLocator);
}
checkListIsSorted(sortOrder, locator) {
const deferred = protractor.promise.defer();
const tagList = element.all(locator);
BrowserVisibility.waitUntilElementIsVisible(tagList.first());
async checkListIsSorted(sortOrder, locator): Promise<boolean> {
const tagList: ElementArrayFinder = element.all(locator);
await BrowserVisibility.waitUntilElementIsVisible(tagList.first());
const initialList = [];
tagList.each(function (currentElement) {
currentElement.getText().then(function (text) {
initialList.push(text);
});
}).then(function () {
let sortedList = initialList;
sortedList = sortedList.sort();
if (sortOrder === false) {
sortedList = sortedList.reverse();
}
deferred.fulfill(initialList.toString() === sortedList.toString());
await tagList.each(async (currentElement) => {
const text = await BrowserActions.getText(currentElement);
initialList.push(text);
});
return deferred.promise;
let sortedList = initialList;
sortedList = sortedList.sort();
if (sortOrder === false) {
sortedList = sortedList.reverse();
}
return initialList.toString() === sortedList.toString();
}
checkDeleteTagFromTagListByNodeIdIsDisplayed(name) {
const deleteChip = element(by.id('tag_chips_delete_' + name));
return BrowserVisibility.waitUntilElementIsVisible(deleteChip);
async checkDeleteTagFromTagListByNodeIdIsDisplayed(name): Promise<void> {
const deleteChip: ElementFinder = element(by.id('tag_chips_delete_' + name));
await BrowserVisibility.waitUntilElementIsVisible(deleteChip);
}
checkDeleteTagFromTagListByNodeIdIsNotDisplayed(name) {
const deleteChip = element(by.id('tag_chips_delete_' + name));
return BrowserVisibility.waitUntilElementIsNotVisible(deleteChip);
async checkDeleteTagFromTagListByNodeIdIsNotDisplayed(name): Promise<void> {
const deleteChip: ElementFinder = element(by.id('tag_chips_delete_' + name));
await BrowserVisibility.waitUntilElementIsNotVisible(deleteChip);
}
clickShowDeleteButtonSwitch() {
BrowserActions.click(this.showDeleteButton);
async clickShowDeleteButtonSwitch(): Promise<void> {
await BrowserActions.click(this.showDeleteButton);
}
checkShowMoreButtonIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.showMoreButton);
async checkShowMoreButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.showMoreButton);
}
clickShowMoreButton() {
return BrowserActions.click(this.showMoreButton);
async clickShowMoreButton(): Promise<void> {
await BrowserActions.click(this.showMoreButton);
}
clickShowLessButton() {
return BrowserActions.click(this.showLessButton);
async clickShowLessButton(): Promise<void> {
await BrowserActions.click(this.showLessButton);
}
clickConfirmTag() {
return BrowserActions.click(this.confirmTag);
async clickConfirmTag(): Promise<void> {
await BrowserActions.click(this.confirmTag);
}
checkTagsOnList() {
return this.tagsOnPage.count();
async checkTagsOnList(): Promise<number> {
return await this.tagsOnPage.count();
}
checkShowLessButtonIsDisplayed() {
return BrowserVisibility.waitUntilElementIsVisible(this.showLessButton);
async checkShowLessButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.showLessButton);
}
checkShowLessButtonIsNotDisplayed() {
return BrowserVisibility.waitUntilElementIsNotVisible(this.showLessButton);
async checkShowLessButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.showLessButton);
}
clickShowMoreButtonUntilNotDisplayed() {
this.showMoreButton.isDisplayed().then((visible) => {
if (visible) {
BrowserActions.click(this.showMoreButton);
this.clickShowMoreButtonUntilNotDisplayed();
}
}, () => {
});
async clickShowMoreButtonUntilNotDisplayed(): Promise<void> {
const visible = await this.showMoreButton.isDisplayed();
if (visible) {
await BrowserActions.click(this.showMoreButton);
await this.clickShowMoreButtonUntilNotDisplayed();
}
}
clickShowLessButtonUntilNotDisplayed() {
this.showLessButton.isDisplayed().then((visible) => {
if (visible) {
BrowserActions.click(this.showLessButton);
this.clickShowLessButtonUntilNotDisplayed();
}
}, () => {
});
async clickShowLessButtonUntilNotDisplayed(): Promise<void> {
const visible = await this.showLessButton.isDisplayed();
if (visible) {
await BrowserActions.click(this.showLessButton);
await this.clickShowLessButtonUntilNotDisplayed();
}
}
}
+22 -25
View File
@@ -17,50 +17,47 @@
import { BrowserActions, BrowserVisibility, DocumentListPage } from '@alfresco/adf-testing';
import { element, by } from 'protractor';
import { element, by, ElementFinder, Locator } from 'protractor';
export class TrashcanPage {
contentList = new DocumentListPage(element(by.css('adf-document-list')));
rows = by.css('adf-document-list div[class*="adf-datatable-body"] div[class*="adf-datatable-row"]');
tableBody = element.all(by.css('adf-document-list div[class="adf-datatable-body"]')).first();
pagination = element(by.css('adf-pagination'));
emptyTrashcan = element(by.css('adf-empty-content'));
restoreButton = element(by.css(`button[title='Restore']`));
contentList: DocumentListPage = new DocumentListPage(element(by.css('adf-document-list')));
rows: Locator = by.css('adf-document-list div[class*="adf-datatable-body"] div[class*="adf-datatable-row"]');
tableBody: ElementFinder = element.all(by.css('adf-document-list div[class="adf-datatable-body"]')).first();
pagination: ElementFinder = element(by.css('adf-pagination'));
emptyTrashcan: ElementFinder = element(by.css('adf-empty-content'));
restoreButton: ElementFinder = element(by.css(`button[title='Restore']`));
numberOfResultsDisplayed() {
return element.all(this.rows).count();
async numberOfResultsDisplayed(): Promise<number> {
return await element.all(this.rows).count();
}
waitForTableBody() {
BrowserVisibility.waitUntilElementIsVisible(this.tableBody);
async waitForTableBody(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.tableBody);
}
waitForPagination() {
BrowserVisibility.waitUntilElementIsVisible(this.pagination);
async waitForPagination(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.pagination);
}
checkTrashcanIsEmpty() {
BrowserVisibility.waitUntilElementIsVisible(this.emptyTrashcan);
async checkTrashcanIsEmpty(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.emptyTrashcan);
}
getDocumentList() {
getDocumentList(): DocumentListPage {
return this.contentList;
}
clickRestore() {
BrowserActions.click(this.restoreButton);
return this;
async clickRestore(): Promise<void> {
await BrowserActions.click(this.restoreButton);
}
checkRestoreButtonIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotVisible(this.restoreButton);
return this;
async checkRestoreButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.restoreButton);
}
checkRestoreButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.restoreButton);
return this;
async checkRestoreButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.restoreButton);
}
}
+89 -107
View File
@@ -16,190 +16,172 @@
*/
import path = require('path');
import remote = require('selenium-webdriver/remote');
import { browser, by, element } from 'protractor';
import { browser, by, element, ElementFinder } from 'protractor';
import { FormControllersPage } from '@alfresco/adf-testing';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class VersionManagePage {
formControllersPage = new FormControllersPage();
formControllersPage: FormControllersPage = new FormControllersPage();
showNewVersionButton = element(by.id('adf-show-version-upload-button'));
uploadNewVersionButton = element(by.css('adf-upload-version-button input[data-automation-id="upload-single-file"]'));
uploadNewVersionContainer = element(by.id('adf-new-version-uploader-container'));
cancelButton = element(by.id('adf-new-version-cancel'));
majorRadio = element(by.id('adf-new-version-major'));
minorRadio = element(by.id('adf-new-version-minor'));
commentText = element(by.id('adf-new-version-text-area'));
readOnlySwitch = element(by.id('adf-version-manager-switch-readonly'));
downloadSwitch = element(by.id('adf-version-manager-switch-download'));
commentsSwitch = element(by.id('adf-version-manager-switch-comments'));
showNewVersionButton: ElementFinder = element(by.id('adf-show-version-upload-button'));
uploadNewVersionInput: ElementFinder = element(by.css('adf-upload-version-button input[data-automation-id="upload-single-file"]'));
uploadNewVersionButton: ElementFinder = element(by.css('adf-upload-version-button'));
uploadNewVersionContainer: ElementFinder = element(by.id('adf-new-version-uploader-container'));
cancelButton: ElementFinder = element(by.id('adf-new-version-cancel'));
majorRadio: ElementFinder = element(by.id('adf-new-version-major'));
minorRadio: ElementFinder = element(by.id('adf-new-version-minor'));
commentText: ElementFinder = element(by.id('adf-new-version-text-area'));
readOnlySwitch: ElementFinder = element(by.id('adf-version-manager-switch-readonly'));
downloadSwitch: ElementFinder = element(by.id('adf-version-manager-switch-download'));
commentsSwitch: ElementFinder = element(by.id('adf-version-manager-switch-comments'));
checkUploadNewVersionsButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.showNewVersionButton);
return this;
async checkUploadNewVersionsButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.showNewVersionButton);
}
checkCancelButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.cancelButton);
return this;
async checkCancelButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.cancelButton);
}
uploadNewVersionFile(fileLocation) {
browser.setFileDetector(new remote.FileDetector());
BrowserVisibility.waitUntilElementIsVisible(this.uploadNewVersionButton);
this.uploadNewVersionButton.sendKeys(path.resolve(path.join(browser.params.testConfig.main.rootPath, fileLocation)));
BrowserVisibility.waitUntilElementIsVisible(this.showNewVersionButton);
return this;
async uploadNewVersionFile(fileLocation): Promise<void> {
await BrowserVisibility.waitUntilElementIsPresent(this.uploadNewVersionInput);
await this.uploadNewVersionInput.sendKeys(path.resolve(path.join(browser.params.testConfig.main.rootPath, fileLocation)));
await BrowserVisibility.waitUntilElementIsVisible(this.showNewVersionButton);
}
getFileVersionName(version) {
const fileElement = element(by.css(`[id="adf-version-list-item-name-${version}"]`));
return BrowserActions.getText(fileElement);
async getFileVersionName(version): Promise<string> {
const fileElement: ElementFinder = element(by.css(`[id="adf-version-list-item-name-${version}"]`));
return await BrowserActions.getText(fileElement);
}
checkFileVersionExist(version) {
const fileVersion = element(by.id(`adf-version-list-item-version-${version}`));
return BrowserVisibility.waitUntilElementIsVisible(fileVersion);
async checkFileVersionExist(version): Promise<void> {
const fileVersion: ElementFinder = element(by.id(`adf-version-list-item-version-${version}`));
await BrowserVisibility.waitUntilElementIsVisible(fileVersion);
}
checkFileVersionNotExist(version) {
const fileVersion = element(by.id(`adf-version-list-item-version-${version}`));
return BrowserVisibility.waitUntilElementIsNotVisible(fileVersion);
async checkFileVersionNotExist(version): Promise<void> {
const fileVersion: ElementFinder = element(by.id(`adf-version-list-item-version-${version}`));
await BrowserVisibility.waitUntilElementIsNotVisible(fileVersion);
}
getFileVersionComment(version) {
const fileComment = element(by.id(`adf-version-list-item-comment-${version}`));
return BrowserActions.getText(fileComment);
async getFileVersionComment(version): Promise<string> {
const fileComment: ElementFinder = element(by.id(`adf-version-list-item-comment-${version}`));
return await BrowserActions.getText(fileComment);
}
getFileVersionDate(version) {
const fileDate = element(by.id(`adf-version-list-item-date-${version}`));
return BrowserActions.getText(fileDate);
async getFileVersionDate(version): Promise<string> {
const fileDate: ElementFinder = element(by.id(`adf-version-list-item-date-${version}`));
return await BrowserActions.getText(fileDate);
}
enterCommentText(text) {
BrowserActions.clearSendKeys(this.commentText, text);
return this;
async enterCommentText(text): Promise<void> {
await BrowserActions.clearSendKeys(this.commentText, text);
}
clickMajorChange() {
const radioMajor = element(by.id(`adf-new-version-major`));
BrowserActions.click(radioMajor);
async clickMajorChange(): Promise<void> {
const radioMajor: ElementFinder = element(by.id(`adf-new-version-major`));
await BrowserActions.click(radioMajor);
}
clickMinorChange() {
const radioMinor = element(by.id(`adf-new-version-minor`));
BrowserActions.click(radioMinor);
async clickMinorChange(): Promise<void> {
const radioMinor: ElementFinder = element(by.id(`adf-new-version-minor`));
await BrowserActions.click(radioMinor);
}
/**
* disables readOnly
*/
disableReadOnly() {
this.formControllersPage.disableToggle(this.readOnlySwitch);
async disableReadOnly(): Promise<void> {
await this.formControllersPage.disableToggle(this.readOnlySwitch);
}
/**
* enables readOnly
*/
enableReadOnly() {
this.formControllersPage.enableToggle(this.readOnlySwitch);
async enableReadOnly(): Promise<void> {
await this.formControllersPage.enableToggle(this.readOnlySwitch);
}
/**
* disables download
*/
disableDownload() {
this.formControllersPage.disableToggle(this.downloadSwitch);
async disableDownload(): Promise<void> {
await this.formControllersPage.disableToggle(this.downloadSwitch);
}
/**
* enables download
*/
enableDownload() {
this.formControllersPage.enableToggle(this.downloadSwitch);
async enableDownload(): Promise<void> {
await this.formControllersPage.enableToggle(this.downloadSwitch);
}
/**
*
* disables comments
*/
disableComments() {
this.formControllersPage.disableToggle(this.commentsSwitch);
async disableComments(): Promise<void> {
await this.formControllersPage.disableToggle(this.commentsSwitch);
}
/**
* enables comments
*/
enableComments() {
this.formControllersPage.enableToggle(this.commentsSwitch);
async enableComments(): Promise<void> {
await this.formControllersPage.enableToggle(this.commentsSwitch);
}
clickActionButton(version) {
BrowserActions.click(element(by.id(`adf-version-list-action-menu-button-${version}`)));
return this;
async clickActionButton(version): Promise<void> {
await BrowserActions.click(element(by.id(`adf-version-list-action-menu-button-${version}`)));
await BrowserVisibility.waitUntilElementIsVisible(element(by.css('.cdk-overlay-container .mat-menu-content')));
}
clickAcceptConfirm() {
BrowserActions.click(element(by.id(`adf-confirm-accept`)));
return this;
async clickAcceptConfirm(): Promise<void> {
await BrowserActions.click(element(by.id(`adf-confirm-accept`)));
}
clickCancelConfirm() {
BrowserActions.click(element(by.id(`adf-confirm-cancel`)));
return this;
async clickCancelConfirm(): Promise<void> {
await BrowserActions.click(element(by.id(`adf-confirm-cancel`)));
}
closeActionsMenu() {
const container = element(by.css('div.cdk-overlay-backdrop.cdk-overlay-transparent-backdrop.cdk-overlay-backdrop-showing'));
BrowserActions.closeMenuAndDialogs();
BrowserVisibility.waitUntilElementIsNotVisible(container);
return this;
async closeActionsMenu(): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
}
closeDisabledActionsMenu() {
const container = element(by.css('div.cdk-overlay-backdrop.cdk-overlay-transparent-backdrop.cdk-overlay-backdrop-showing'));
BrowserActions.closeDisabledMenu();
BrowserVisibility.waitUntilElementIsNotVisible(container);
return this;
async closeDisabledActionsMenu(): Promise<void> {
const container: ElementFinder = element(by.css('div.cdk-overlay-backdrop.cdk-overlay-transparent-backdrop.cdk-overlay-backdrop-showing'));
await BrowserActions.closeDisabledMenu();
await BrowserVisibility.waitUntilElementIsNotVisible(container);
}
downloadFileVersion(version) {
this.clickActionButton(version);
const downloadButton = element(by.id(`adf-version-list-action-download-${version}`));
browser.driver.sleep(500);
BrowserActions.click(downloadButton);
return this;
async downloadFileVersion(version): Promise<void> {
await this.clickActionButton(version);
const downloadButton: ElementFinder = element(by.id(`adf-version-list-action-download-${version}`));
await BrowserActions.click(downloadButton);
await BrowserVisibility.waitUntilElementIsNotVisible(downloadButton);
}
deleteFileVersion(version) {
this.clickActionButton(version);
const deleteButton = element(by.id(`adf-version-list-action-delete-${version}`));
browser.driver.sleep(500);
BrowserActions.click(deleteButton);
return this;
async deleteFileVersion(version): Promise<void> {
await this.clickActionButton(version);
const deleteButton: ElementFinder = element(by.id(`adf-version-list-action-delete-${version}`));
await BrowserActions.click(deleteButton);
}
restoreFileVersion(version) {
this.clickActionButton(version);
const restoreButton = element(by.id(`adf-version-list-action-restore-${version}`));
BrowserVisibility.waitUntilElementIsVisible(restoreButton);
browser.driver.sleep(500);
BrowserActions.click(restoreButton);
return this;
async restoreFileVersion(version): Promise<void> {
await this.clickActionButton(version);
const restoreButton: ElementFinder = element(by.id(`adf-version-list-action-restore-${version}`));
await BrowserActions.click(restoreButton);
}
checkActionsArePresent(version) {
BrowserVisibility.waitUntilElementIsVisible(element(by.id(`adf-version-list-action-download-${version}`)));
BrowserVisibility.waitUntilElementIsVisible(element(by.id(`adf-version-list-action-delete-${version}`)));
BrowserVisibility.waitUntilElementIsVisible(element(by.id(`adf-version-list-action-restore-${version}`)));
async checkActionsArePresent(version): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.id(`adf-version-list-action-download-${version}`)));
await BrowserVisibility.waitUntilElementIsVisible(element(by.id(`adf-version-list-action-delete-${version}`)));
await BrowserVisibility.waitUntilElementIsVisible(element(by.id(`adf-version-list-action-restore-${version}`)));
}
closeVersionDialog() {
BrowserActions.closeMenuAndDialogs();
BrowserVisibility.waitUntilElementIsNotOnPage(this.uploadNewVersionContainer);
async closeVersionDialog(): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserVisibility.waitUntilElementIsNotVisible(this.uploadNewVersionContainer);
}
}
File diff suppressed because it is too large Load Diff