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

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

* Fix one which I missed

* Remove console.logs

* Remove console.logs

* Reverse the timeouts

* Fixed things TSLint

* Remove unused import

* Fixed broken tests

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

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { $ } from 'protractor';
import { createApiService,
BreadcrumbPage,
BreadcrumbDropdownPage,
@@ -47,7 +47,7 @@ describe('Document List Component - Actions', () => {
const usersActions = new UsersActions(apiService);
const uploadActions = new UploadActions(apiService);
const infinitePaginationPage = new InfinitePaginationPage(element(by.css('adf-content-node-selector')));
const infinitePaginationPage = new InfinitePaginationPage($('adf-content-node-selector'));
describe('Folder Actions - Copy and Move', () => {
const folderModel1 = new FolderModel({ name: StringUtil.generateRandomString() });

View File

@@ -22,7 +22,7 @@ import {
DropdownPage,
TestElement
} from '@alfresco/adf-testing';
import { browser, by } from 'protractor';
import { browser } from 'protractor';
export class PermissionsPage {
@@ -55,7 +55,7 @@ export class PermissionsPage {
async clickRoleDropdownByUserOrGroupName(name: string): Promise<void> {
const row = this.dataTableComponentPage.getRow('Users and Groups', name);
await row.click();
await BrowserActions.click(row.element(by.css('[id="adf-select-role-permission"] .mat-select-trigger')));
await BrowserActions.click(row.$('[id="adf-select-role-permission"] .mat-select-trigger'));
await TestElement.byCss('.mat-select-panel').waitVisible();
}

View File

@@ -15,12 +15,12 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { $ } from 'protractor';
import { BrowserActions } from '@alfresco/adf-testing';
export class SocialPage {
nodeIdField = element(by.css(`input[id="nodeId"]`));
nodeIdField = $(`input[id="nodeId"]`);
async getNodeIdFieldValue(): Promise<string> {
return BrowserActions.getInputValue(this.nodeIdField);

View File

@@ -15,13 +15,13 @@
* limitations under the License.
*/
import { element, by, protractor, browser } from 'protractor';
import { by, protractor, browser, $, $$ } from 'protractor';
import { BrowserActions, TestElement } from '@alfresco/adf-testing';
export class TagPage {
addTagButton = TestElement.byCss('#add-tag');
insertNodeIdElement = element(by.css('input[id="nodeId"]'));
insertNodeIdElement = $('input[id="nodeId"]');
newTagInput = TestElement.byCss('input[id="new-tag-text"]');
tagListRow = TestElement.byCss('adf-tag-node-actions-list mat-list-item');
tagListByNodeIdRow = TestElement.byCss('adf-tag-node-list mat-chip');
@@ -30,7 +30,7 @@ export class TagPage {
showDeleteButton = TestElement.byCss('#adf-remove-button-tag');
showMoreButton = TestElement.byCss('button[data-automation-id="show-more-tags"]');
showLessButton = TestElement.byCss('button[data-automation-id="show-fewer-tags"]');
tagsOnPage = element.all(by.css('div[class*="adf-list-tag"]'));
tagsOnPage = $$('div[class*="adf-list-tag"]');
confirmTag = TestElement.byCss('#adf-tag-node-send');
getNodeId(): Promise<string> {

View File

@@ -15,15 +15,15 @@
* limitations under the License.
*/
import { element, by, protractor } from 'protractor';
import { element, by, protractor, $, $$ } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class TreeViewPage {
treeViewTitle = element(by.cssContainingText('app-tree-view div', 'TREE VIEW TEST'));
nodeIdInput = element(by.css('input[data-placeholder="Node Id"]'));
noNodeMessage = element(by.id('adf-tree-view-missing-node'));
nodesOnPage = element.all(by.css('mat-tree-node'));
nodeIdInput = $('input[data-placeholder="Node Id"]');
noNodeMessage = $('#adf-tree-view-missing-node');
nodesOnPage = $$('mat-tree-node');
async checkTreeViewTitleIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.treeViewTitle);
@@ -34,17 +34,17 @@ export class TreeViewPage {
}
async clickNode(nodeName: string): Promise<void> {
const node = element(by.css('mat-tree-node[id="' + nodeName + '-tree-child-node"] button'));
const node = $('mat-tree-node[id="' + nodeName + '-tree-child-node"] button');
await BrowserActions.click(node);
}
async checkNodeIsDisplayedAsClosed(nodeName: string): Promise<void> {
const node = element(by.css('mat-tree-node[id="' + nodeName + '-tree-child-node"][aria-expanded="false"]'));
const node = $('mat-tree-node[id="' + nodeName + '-tree-child-node"][aria-expanded="false"]');
await BrowserVisibility.waitUntilElementIsVisible(node);
}
async checkNodeIsDisplayedAsOpen(nodeName: string): Promise<void> {
const node = element(by.css('mat-tree-node[id="' + nodeName + '-tree-child-node"][aria-expanded="true"]'));
const node = $('mat-tree-node[id="' + nodeName + '-tree-child-node"][aria-expanded="true"]');
await BrowserVisibility.waitUntilElementIsVisible(node);
}
@@ -54,7 +54,7 @@ export class TreeViewPage {
}
async checkNodeIsNotDisplayed(nodeName: string): Promise<void> {
const node = element(by.id('' + nodeName + '-tree-child-node'));
const node = $('#' + nodeName + '-tree-child-node');
await BrowserVisibility.waitUntilElementIsNotVisible(node);
}

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { $, by, element } from 'protractor';
import {
BrowserVisibility,
BrowserActions,
@@ -29,19 +29,19 @@ export class CardViewComponentPage {
addButton = element(by.className('adf-card-view__key-value-pairs__add-btn'));
nameCardTextItem = new CardTextItemPage('name');
booleanCardBooleanItem = new CardBooleanItemPage('boolean');
intField = element(by.css(`input[data-automation-id='card-textitem-editinput-int']`));
floatField = element(by.css(`input[data-automation-id='card-textitem-editinput-float']`));
intField = $(`input[data-automation-id='card-textitem-editinput-int']`);
floatField = $(`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('app-console'));
deleteButton = element.all(by.className('adf-card-view__key-value-pairs__remove-btn')).first();
resetButton = element(by.css(`#adf-reset-card-log`));
editableSwitch = element(by.id('app-toggle-editable'));
clearDateSwitch = element(by.id('app-toggle-clear-date'));
noneOptionSwitch = element(by.id('app-toggle-none-option'));
clickableField = element(by.css(`[data-automation-id="card-textitem-toggle-click"]`));
resetButton = $(`#adf-reset-card-log`);
editableSwitch = $('#app-toggle-editable');
clearDateSwitch = $('#app-toggle-clear-date');
noneOptionSwitch = $('#app-toggle-none-option');
clickableField = $(`[data-automation-id="card-textitem-toggle-click"]`);
selectDropdown = new DropdownPage(element(by.css('mat-select[data-automation-class="select-box"]')));
selectDropdown = new DropdownPage($('mat-select[data-automation-class="select-box"]'));
async clickOnAddButton(): Promise<void> {
await BrowserActions.click(this.addButton);
@@ -72,18 +72,18 @@ export class CardViewComponentPage {
}
async clickOnIntField(): Promise<void> {
const toggleText = element(by.css('div[data-automation-id="card-textitem-toggle-int"]'));
const toggleText = $('div[data-automation-id="card-textitem-toggle-int"]');
await BrowserActions.click(toggleText);
await BrowserVisibility.waitUntilElementIsVisible(this.intField);
}
async clickOnIntClearIcon(): Promise<void> {
const clearIcon = element(by.css('button[data-automation-id="card-textitem-reset-int"]'));
const clearIcon = $('button[data-automation-id="card-textitem-reset-int"]');
await BrowserActions.click(clearIcon);
}
async clickOnIntSaveIcon(): Promise<void> {
const saveIcon = element(by.css('button[data-automation-id="card-textitem-update-int"]'));
const saveIcon = $('button[data-automation-id="card-textitem-update-int"]');
await BrowserActions.click(saveIcon);
}
@@ -92,28 +92,28 @@ export class CardViewComponentPage {
}
getIntFieldText(): Promise<string> {
const textField = element(by.css('span[data-automation-id="card-textitem-value-int"]'));
const textField = $('span[data-automation-id="card-textitem-value-int"]');
return BrowserActions.getText(textField);
}
getErrorInt(): Promise<string> {
const errorElement = element(by.css('mat-error[data-automation-id="card-textitem-error-int"]'));
const errorElement = $('mat-error[data-automation-id="card-textitem-error-int"]');
return BrowserActions.getText(errorElement);
}
async clickOnFloatField(): Promise<void> {
const toggleText = element(by.css('div[data-automation-id="card-textitem-toggle-float"]'));
const toggleText = $('div[data-automation-id="card-textitem-toggle-float"]');
await BrowserActions.click(toggleText);
await BrowserVisibility.waitUntilElementIsVisible(this.floatField);
}
async clickOnFloatClearIcon(): Promise<void> {
const clearIcon = element(by.css(`button[data-automation-id="card-textitem-reset-float"]`));
const clearIcon = $(`button[data-automation-id="card-textitem-reset-float"]`);
await BrowserActions.click(clearIcon);
}
async clickOnFloatSaveIcon(): Promise<void> {
const saveIcon = element(by.css(`button[data-automation-id="card-textitem-update-float"]`));
const saveIcon = $(`button[data-automation-id="card-textitem-update-float"]`);
await BrowserActions.click(saveIcon);
}
@@ -122,12 +122,12 @@ export class CardViewComponentPage {
}
getFloatFieldText(): Promise<string> {
const textField = element(by.css('span[data-automation-id="card-textitem-value-float"]'));
const textField = $('span[data-automation-id="card-textitem-value-float"]');
return BrowserActions.getText(textField);
}
getErrorFloat(): Promise<string> {
const errorElement = element(by.css('mat-error[data-automation-id="card-textitem-error-float"]'));
const errorElement = $('mat-error[data-automation-id="card-textitem-error-float"]');
return BrowserActions.getText(errorElement);
}
@@ -144,7 +144,7 @@ export class CardViewComponentPage {
}
getOutputText(index: number): Promise<string> {
return BrowserActions.getText(this.consoleLog.all(by.css('p')).get(index));
return BrowserActions.getText(this.consoleLog.$$('p').get(index));
}
async deletePairsValues(): Promise<void> {
@@ -177,22 +177,22 @@ export class CardViewComponentPage {
}
async getDateValue(): Promise<string> {
const dateValue = element(by.css('span[data-automation-id="card-date-value-date"]'));
const dateValue = $('span[data-automation-id="card-date-value-date"]');
return dateValue.getText();
}
async getDateTimeValue(): Promise<string> {
const dateTimeValue = element(by.css('span[data-automation-id="card-datetime-value-datetime"]'));
const dateTimeValue = $('span[data-automation-id="card-datetime-value-datetime"]');
return dateTimeValue.getText();
}
async clearDateField(): Promise<void> {
const clearDateButton = element(by.css('mat-icon[data-automation-id="datepicker-date-clear-date"]'));
const clearDateButton = $('mat-icon[data-automation-id="datepicker-date-clear-date"]');
await BrowserActions.click(clearDateButton);
}
async clearDateTimeField(): Promise<void> {
const clearDateButton = element(by.css('mat-icon[data-automation-id="datepicker-date-clear-datetime"]'));
const clearDateButton = $('mat-icon[data-automation-id="datepicker-date-clear-datetime"]');
await BrowserActions.click(clearDateButton);
}
@@ -200,7 +200,7 @@ export class CardViewComponentPage {
const switchClass = await BrowserActions.getAttribute(this.editableSwitch, 'class');
if (switchClass.indexOf('mat-checked') === -1) {
await this.clearDateSwitch.click();
const clearDateChecked = element(by.css('mat-slide-toggle[id="app-toggle-clear-date"][class*="mat-checked"]'));
const clearDateChecked = $('mat-slide-toggle[id="app-toggle-clear-date"][class*="mat-checked"]');
await BrowserVisibility.waitUntilElementIsVisible(clearDateChecked);
}
}
@@ -209,13 +209,13 @@ export class CardViewComponentPage {
const switchClass = await BrowserActions.getAttribute(this.noneOptionSwitch, 'class');
if (switchClass.indexOf('mat-checked') === -1) {
await this.noneOptionSwitch.click();
const noneOptionChecked = element(by.css('mat-slide-toggle[id="app-toggle-none-option"][class*="mat-checked"]'));
const noneOptionChecked = $('mat-slide-toggle[id="app-toggle-none-option"][class*="mat-checked"]');
await BrowserVisibility.waitUntilElementIsVisible(noneOptionChecked);
}
}
async isErrorNotDisplayed(): Promise<boolean> {
const errorElement = element(by.css('mat-error[data-automation-id="card-textitem-error-int"]'));
const errorElement = $('mat-error[data-automation-id="card-textitem-error-int"]');
try {
await BrowserVisibility.waitUntilElementIsNotVisible(errorElement);
return true;
@@ -231,10 +231,10 @@ export class CardViewComponentPage {
async updateClickableField(text: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.clickableField);
await BrowserActions.click(this.clickableField);
const inputField = element(by.css('input[data-automation-id="card-textitem-editinput-click"]'));
const inputField = $('input[data-automation-id="card-textitem-editinput-click"]');
await BrowserVisibility.waitUntilElementIsPresent(inputField);
await BrowserActions.clearSendKeys(inputField, text);
const save = element(by.css('[data-automation-id="card-textitem-update-click"]'));
const save = $('[data-automation-id="card-textitem-update-click"]');
await BrowserVisibility.waitUntilElementIsVisible(save);
await BrowserActions.click(save);
}

View File

@@ -16,18 +16,18 @@
*/
import { BrowserActions, BrowserVisibility, TabsPage } from '@alfresco/adf-testing';
import { by, element } from 'protractor';
import { $, $$ } from 'protractor';
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']"));
numberOfComments = $('#comment-header');
commentUserIcon = $$('#comment-user-icon');
commentUserName = $$('#comment-user');
commentMessage = $$('#comment-message');
commentTime = $$('#comment-time');
commentInput = $('#comment-input');
addCommentButton = $("[data-automation-id='comments-input-add']");
async getTotalNumberOfComments(text: string): Promise<void> {
await BrowserVisibility.waitUntilElementHasText(this.numberOfComments, text);

View File

@@ -25,7 +25,7 @@ import {
DropdownPage,
Logger
} from '@alfresco/adf-testing';
import { Locator, $$, browser, by, element, ElementFinder, protractor } from 'protractor';
import { $$, browser, by, element, ElementFinder, protractor, $ } from 'protractor';
import { CreateLibraryDialogPage } from './dialog/create-library-dialog.page';
import { FolderDialogPage } from './dialog/folder-dialog.page';
import { NavigationBarPage } from './navigation-bar.page';
@@ -42,74 +42,73 @@ export class ContentServicesPage {
created: 'Created'
};
contentList = new DocumentListPage(element.all(by.css('adf-upload-drag-area adf-document-list')).first());
contentList = new DocumentListPage($$('adf-upload-drag-area adf-document-list').first());
togglePage = new TogglePage();
createFolderDialog = new FolderDialogPage();
createLibraryDialog = new CreateLibraryDialogPage();
multipleFileUploadToggle = element(by.id('adf-document-list-enable-drop-files'));
uploadBorder = element(by.id('document-list-container'));
contentServices = element(by.css('.app-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"]'));
deleteNodesButton = element(by.css('button[data-automation-id="delete-toolbar-button"]'));
createLibraryButton = element(by.css('button[data-automation-id="create-new-library"]'));
activeBreadcrumb = element(by.css('div[class*="active"]'));
tooltip: Locator = 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.all(by.css('div[data-automation-id="auto_id_name"] > span')).first();
sizeHeader = element.all(by.css('div[data-automation-id="auto_id_content.sizeInBytes"] > span')).first();
createdByHeader = element.all(by.css('div[data-automation-id="auto_id_createdByUser.displayName"] > span')).first();
createdHeader = element.all(by.css('div[data-automation-id="auto_id_createdAt"] > span')).first();
recentFiles = element(by.css('.app-container-recent'));
recentFilesExpanded = element(by.css('.app-container-recent mat-expansion-panel-header.mat-expanded'));
recentFilesClosed = element(by.css('.app-container-recent mat-expansion-panel-header'));
recentFileIcon = element(by.css('.app-container-recent mat-expansion-panel-header mat-icon'));
emptyFolder = element(by.css('.adf-empty-folder-this-space-is-empty'));
emptyFolderImage = element(by.css('.adf-empty-folder-image'));
emptyRecent = element(by.css('.app-container-recent .app-empty-list__title'));
gridViewButton = element(by.css('button[data-automation-id="document-list-grid-view"]'));
cardViewContainer = element(by.css('div.app-document-list-container div.adf-datatable-card'));
multipleFileUploadToggle = $('#adf-document-list-enable-drop-files');
uploadBorder = $('#document-list-container');
contentServices = $('.app-sidenav-link[data-automation-id="Content Services"]');
currentFolder = $('div[class*="adf-breadcrumb-item adf-active"] div');
createFolderButton = $('button[data-automation-id="create-new-folder"]');
editFolderButton = $('button[data-automation-id="edit-folder"]');
deleteNodesButton = $('button[data-automation-id="delete-toolbar-button"]');
createLibraryButton = $('button[data-automation-id="create-new-library"]');
activeBreadcrumb = $('div[class*="active"]');
uploadFileButton = $('.adf-upload-button-file-container button');
uploadFileButtonInput = $('input[data-automation-id="upload-single-file"]');
uploadMultipleFileButton = $('input[data-automation-id="upload-multiple-files"]');
uploadFolderButton = $('input[data-automation-id="uploadFolder"]');
errorSnackBar = $('simple-snack-bar[class*="mat-simple-snackbar"]');
emptyPagination = $('adf-pagination[class*="adf-pagination__empty"]');
dragAndDrop = $$('adf-upload-drag-area div').first();
nameHeader = $$('div[data-automation-id="auto_id_name"] > span').first();
sizeHeader = $$('div[data-automation-id="auto_id_content.sizeInBytes"] > span').first();
createdByHeader = $$('div[data-automation-id="auto_id_createdByUser.displayName"] > span').first();
createdHeader = $$('div[data-automation-id="auto_id_createdAt"] > span').first();
recentFiles = $('.app-container-recent');
recentFilesExpanded = $('.app-container-recent mat-expansion-panel-header.mat-expanded');
recentFilesClosed = $('.app-container-recent mat-expansion-panel-header');
recentFileIcon = $('.app-container-recent mat-expansion-panel-header mat-icon');
emptyFolder = $('.adf-empty-folder-this-space-is-empty');
emptyFolderImage = $('.adf-empty-folder-image');
emptyRecent = $('.app-container-recent .app-empty-list__title');
gridViewButton = $('button[data-automation-id="document-list-grid-view"]');
cardViewContainer = $('div.app-document-list-container div.adf-datatable-card');
shareNodeButton = 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"]'));
downloadButton = element(by.css('button[title="Download"]'));
favoriteButton = element(by.css('button[data-automation-id="favorite"]'));
deleteContentElement = $('button[data-automation-id*="DELETE"]');
metadataAction = $('button[data-automation-id*="METADATA"]');
versionManagerAction = $('button[data-automation-id*="VERSIONS"]');
moveContentElement = $('button[data-automation-id*="MOVE"]');
copyContentElement = $('button[data-automation-id*="COPY"]');
lockContentElement = $('button[data-automation-id="DOCUMENT_LIST.ACTIONS.LOCK"]');
downloadContent = $('button[data-automation-id*="DOWNLOAD"]');
downloadButton = $('button[title="Download"]');
favoriteButton = $('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.css('[data-automation-id="multiSelectToggle"]'));
selectAllCheckbox = element.all(by.css('.adf-checkbox-sr-only')).first();
selectionModeDropdown = element(by.css('.mat-select[aria-label="Selection Mode"]'));
selectedNodesList = element.all(by.css('.app-content-service-settings li'));
siteListDropdown = new DropdownPage(element(by.css(`mat-select[data-automation-id='site-my-files-option']`)));
sortingDropdown = new DropdownPage(element(by.css('mat-select[data-automation-id="grid-view-sorting"]')));
multiSelectToggle = $('[data-automation-id="multiSelectToggle"]');
selectAllCheckbox = $$('.adf-checkbox-sr-only').first();
selectionModeDropdown = $('.mat-select[aria-label="Selection Mode"]');
selectedNodesList = $$('.app-content-service-settings li');
siteListDropdown = new DropdownPage($(`mat-select[data-automation-id='site-my-files-option']`));
sortingDropdown = new DropdownPage($('mat-select[data-automation-id="grid-view-sorting"]'));
async pressContextMenuActionNamed(actionName): Promise<void> {
await BrowserActions.clickExecuteScript(`button[data-automation-id="context-${actionName}"]`);
}
async checkContextActionIsVisible(actionName) {
const actionButton = element(by.css(`button[data-automation-id="context-${actionName}"`));
const actionButton = $(`button[data-automation-id="context-${actionName}"`);
await BrowserVisibility.waitUntilElementIsVisible(actionButton);
}
async isContextActionEnabled(actionName): Promise<boolean> {
const actionButton = element(by.css(`button[data-automation-id="context-${actionName}"`));
const actionButton = $(`button[data-automation-id="context-${actionName}"`);
await BrowserVisibility.waitUntilElementIsVisible(actionButton);
return actionButton.isEnabled();
}
@@ -132,7 +131,7 @@ export class ContentServicesPage {
async checkDeleteIsDisabled(content): Promise<void> {
await this.contentList.clickOnActionMenu(content);
const disabledDelete = element(by.css(`button[data-automation-id*='DELETE'][disabled='true']`));
const disabledDelete = $(`button[data-automation-id*='DELETE'][disabled='true']`);
await BrowserVisibility.waitUntilElementIsVisible(disabledDelete);
}
@@ -489,12 +488,12 @@ export class ContentServicesPage {
}
async enableMediumTimeFormat(): Promise<void> {
const mediumTimeFormat = element(by.css('#enableMediumTimeFormat'));
const mediumTimeFormat = $('#enableMediumTimeFormat');
await BrowserActions.click(mediumTimeFormat);
}
async enableThumbnails(): Promise<void> {
const thumbnailSlide = element(by.id('adf-thumbnails-upload-switch'));
const thumbnailSlide = $('#adf-thumbnails-upload-switch');
await BrowserActions.click(thumbnailSlide);
}
@@ -503,7 +502,7 @@ export class ContentServicesPage {
}
async getDocumentListRowNumber(): Promise<number> {
const documentList = element(by.css('adf-upload-drag-area adf-document-list'));
const documentList = $('adf-upload-drag-area adf-document-list');
await BrowserVisibility.waitUntilElementIsVisible(documentList);
return $$('adf-upload-drag-area adf-document-list .adf-datatable-row').count();
}
@@ -539,7 +538,7 @@ export class ContentServicesPage {
}
async checkLockIsDisplayedForElement(name): Promise<void> {
const lockButton = element(by.css(`div.adf-datatable-cell[data-automation-id="${name}"] button`));
const lockButton = $(`div.adf-datatable-cell[data-automation-id="${name}"] button`);
await BrowserVisibility.waitUntilElementIsVisible(lockButton);
}
@@ -548,7 +547,7 @@ export class ContentServicesPage {
}
async getStyleValueForRowText(rowName, styleName): Promise<string> {
const row = element(by.css(`div.adf-datatable-cell[data-automation-id="${rowName}"] span.adf-datatable-cell-value[title="${rowName}"]`));
const row = $(`div.adf-datatable-cell[data-automation-id="${rowName}"] span.adf-datatable-cell-value[title="${rowName}"]`);
await BrowserVisibility.waitUntilElementIsVisible(row);
return row.getCssValue(styleName);
}
@@ -567,7 +566,7 @@ export class ContentServicesPage {
}
async getRowIconImageUrl(fileName): Promise<string> {
const iconRow = element(by.css(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${fileName}"] img`));
const iconRow = $(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${fileName}"] img`);
return BrowserActions.getAttribute(iconRow, 'src');
}
@@ -590,30 +589,30 @@ export class ContentServicesPage {
}
async getDocumentCardIconForElement(elementName): Promise<string> {
const elementIcon = element(by.css(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"] img`));
const elementIcon = $(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"] img`);
return BrowserActions.getAttribute(elementIcon, 'src');
}
async checkDocumentCardPropertyIsShowed(elementName, propertyName): Promise<void> {
const elementProperty = element(by.css(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"][title="${propertyName}"]`));
const elementProperty = $(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"][title="${propertyName}"]`);
await BrowserVisibility.waitUntilElementIsVisible(elementProperty);
}
async getAttributeValueForElement(elementName, propertyName): Promise<string> {
const elementSize = element(by.css(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"][title="${propertyName}"] span`));
const elementSize = $(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"][title="${propertyName}"] span`);
return BrowserActions.getText(elementSize);
}
async checkMenuIsShowedForElementIndex(elementIndex): Promise<void> {
const elementMenu = element(by.css(`button[data-automation-id="action_menu_${elementIndex}"]`));
const elementMenu = $(`button[data-automation-id="action_menu_${elementIndex}"]`);
await BrowserVisibility.waitUntilElementIsVisible(elementMenu);
}
async navigateToCardFolder(folderName): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
const folderCard = element(by.css(`.app-document-list-container div.adf-image-table-cell.adf-datatable-cell[data-automation-id="${folderName}"]`));
const folderCard = $(`.app-document-list-container div.adf-image-table-cell.adf-datatable-cell[data-automation-id="${folderName}"]`);
await BrowserActions.click(folderCard);
const folderSelected = element(by.css(`.adf-datatable-row.adf-is-selected div[data-automation-id="${folderName}"].adf-datatable-cell--image`));
const folderSelected = $(`.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();
}
@@ -660,7 +659,7 @@ export class ContentServicesPage {
}
async selectFolder(folderName: string): Promise<void> {
const folderSelected = element(by.css(`div[data-automation-id="${folderName}"] .adf-datatable-center-img-ie`));
const folderSelected = $(`div[data-automation-id="${folderName}"] .adf-datatable-center-img-ie`);
await BrowserVisibility.waitUntilElementIsVisible(folderSelected);
await BrowserActions.click(folderSelected);
}
@@ -681,13 +680,13 @@ export class ContentServicesPage {
}
async selectItemWithCheckbox(itemName: string): Promise<void> {
const item = element(by.css(`adf-datatable-row[aria-label="${itemName}"] mat-checkbox .mat-checkbox-input`));
const item = $(`adf-datatable-row[aria-label="${itemName}"] mat-checkbox .mat-checkbox-input`);
await BrowserVisibility.waitUntilElementIsVisible(item);
await BrowserActions.click(item);
}
async unSelectItemWithCheckbox(itemName: string): Promise<void> {
const item = element(by.css(`adf-datatable-row[aria-label="${itemName} selected"] mat-checkbox .mat-checkbox-input`));
const item = $(`adf-datatable-row[aria-label="${itemName} selected"] mat-checkbox .mat-checkbox-input`);
await BrowserVisibility.waitUntilElementIsVisible(item);
await BrowserActions.click(item);
}

View File

@@ -16,7 +16,7 @@
*/
import { BrowserActions, BrowserVisibility, DataTableComponentPage, DropdownPage } from '@alfresco/adf-testing';
import { by, element } from 'protractor';
import { $ } from 'protractor';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
const source = {
@@ -39,8 +39,8 @@ export class CustomSourcesPage {
dataTable = new DataTableComponentPage();
navigationBarPage = new NavigationBarPage();
toolbar = element(by.css('app-custom-sources .adf-toolbar-title'));
selectModeDropdown = new DropdownPage(element(by.css('mat-select[data-automation-id="custom-sources-select"]')));
toolbar = $('app-custom-sources .adf-toolbar-title');
selectModeDropdown = new DropdownPage($('mat-select[data-automation-id="custom-sources-select"]'));
async waitForToolbarToBeVisible(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.toolbar);

View File

@@ -16,7 +16,7 @@
*/
import { BrowserActions, BrowserVisibility, DataTableComponentPage, DropdownPage } from '@alfresco/adf-testing';
import { browser, by, element, ElementFinder, protractor } from 'protractor';
import { $, $$, browser, by, element, ElementFinder, protractor } from 'protractor';
export class DataTablePage {
@@ -33,30 +33,30 @@ export class DataTablePage {
};
dataTable: DataTableComponentPage;
multiSelect = element(by.css(`div[data-automation-id='multiselect'] label > .mat-checkbox-inner-container`));
multiSelect = $(`div[data-automation-id='multiselect'] label > .mat-checkbox-inner-container`);
reset = element(by.xpath(`//span[contains(text(),'Reset to default')]/..`));
allSelectedRows = element.all(by.css(`adf-datatable-row[class*='is-selected']`));
selectedRowNumber = element(by.css(`adf-datatable-row[class*='is-selected'] div[data-automation-id*='text_']`));
selectAll = element(by.css(`div[class*='header'] label`));
allSelectedRows = $$(`adf-datatable-row[class*='is-selected']`);
selectedRowNumber = $(`adf-datatable-row[class*='is-selected'] div[data-automation-id*='text_']`);
selectAll = $(`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']`));
createdOnColumn = $(`div[data-automation-id='auto_id_createdOn']`);
idColumnHeader = $(`div[data-automation-id='auto_id_id']`);
pasteClipboardInput = $(`input[data-automation-id='paste clipboard input']`);
selectModeDropdown = new DropdownPage(element(by.css(`mat-select[data-automation-id='datatable-selection-mode']`)));
selectModeDropdown = new DropdownPage($(`mat-select[data-automation-id='datatable-selection-mode']`));
constructor(data?) {
if (this.data[data]) {
this.dataTable = new DataTableComponentPage(element(by.css(`div[data-automation-id='` + this.data[data] + `']`)));
this.dataTable = new DataTableComponentPage($(`div[data-automation-id='` + this.data[data] + `']`));
} else {
this.dataTable = new DataTableComponentPage(element(by.css(`div[data-automation-id='` + this.data.defaultTable + `']`)));
this.dataTable = new DataTableComponentPage($(`div[data-automation-id='` + this.data.defaultTable + `']`));
}
}
async insertFilter(filterText: string): Promise<void> {
const inputFilter = element(by.css(`#adf-datatable-filter-input`));
const inputFilter = $(`#adf-datatable-filter-input`);
await BrowserActions.clearSendKeys(inputFilter, filterText);
}

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { $, $$ } from 'protractor';
import { BrowserActions, TestElement } from '@alfresco/adf-testing';
export class CreateLibraryDialogPage {
@@ -30,11 +30,11 @@ export class CreateLibraryDialogPage {
cancelButton = TestElement.byCss('button[data-automation-id="cancel-library-id"]');
createButton = TestElement.byCss('button[data-automation-id="create-library-id"]');
errorMessage = TestElement.byCss('.mat-dialog-content .mat-error');
errorMessages = element.all(by.css('.mat-dialog-content .mat-error'));
errorMessages = $$('.mat-dialog-content .mat-error');
libraryNameHint = TestElement.byCss('adf-library-dialog .mat-hint');
async getSelectedRadio(): Promise<string> {
const radio = element(by.css('.mat-radio-button[class*="checked"]'));
const radio = $('.mat-radio-button[class*="checked"]');
return BrowserActions.getText(radio);
}

View File

@@ -15,18 +15,18 @@
* limitations under the License.
*/
import { by, element, ElementFinder } from 'protractor';
import { $$, ElementFinder } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class FolderDialogPage {
folderDialog = element.all(by.css('adf-folder-dialog')).first();
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 = $$('adf-folder-dialog').first();
folderNameField = this.folderDialog.$('#adf-folder-name-input');
folderDescriptionField = this.folderDialog.$('#adf-folder-description-input');
createUpdateButton = this.folderDialog.$('#adf-folder-create-button');
cancelButton = this.folderDialog.$('#adf-folder-cancel-button');
folderTitle = this.folderDialog.$('h2.mat-dialog-title');
validationMessage = this.folderDialog.$('div.mat-form-field-subscript-wrapper mat-hint span');
async getDialogTitle(): Promise<string> {
return BrowserActions.getText(this.folderTitle);

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { $$, $ } from 'protractor';
import { BrowserVisibility, TogglePage, BrowserActions, DateTimePickerPage } from '@alfresco/adf-testing';
import moment = require('moment');
@@ -23,18 +23,18 @@ export class ShareDialogPage {
togglePage = new TogglePage();
dateTimePickerPage = new DateTimePickerPage();
shareDialog = element(by.css('adf-share-dialog'));
dialogTitle = element.all(by.css('[data-automation-id="adf-share-dialog-title"]')).first();
shareToggle = element(by.css('[data-automation-id="adf-share-toggle"] label'));
expireToggle = element(by.css(`[data-automation-id="adf-expire-toggle"] label`));
shareToggleChecked = element(by.css('mat-dialog-container mat-slide-toggle.mat-checked'));
shareLink = element(by.css('[data-automation-id="adf-share-link"]'));
closeButton = element(by.css('button[data-automation-id="adf-share-dialog-close"]'));
copySharedLinkButton = element(by.css('.adf-input-action'));
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 = $('adf-share-dialog');
dialogTitle = $$('[data-automation-id="adf-share-dialog-title"]').first();
shareToggle = $('[data-automation-id="adf-share-toggle"] label');
expireToggle = $(`[data-automation-id="adf-expire-toggle"] label`);
shareToggleChecked = $('mat-dialog-container mat-slide-toggle.mat-checked');
shareLink = $('[data-automation-id="adf-share-link"]');
closeButton = $('button[data-automation-id="adf-share-dialog-close"]');
copySharedLinkButton = $('.adf-input-action');
expirationDateInput = $('input[formcontrolname="time"]');
confirmationDialog = $('adf-confirm-dialog');
confirmationCancelButton = $('#adf-confirm-cancel');
confirmationRemoveButton = $('#adf-confirm-accept');
async checkDialogIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.dialogTitle);
@@ -106,7 +106,7 @@ export class ShareDialogPage {
}
async dateTimePickerDialogIsClosed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsStale(element(by.css('mat-datetimepicker-content')));
await BrowserVisibility.waitUntilElementIsStale($('mat-datetimepicker-content'));
}
async getExpirationDate(): Promise<string> {

View File

@@ -15,28 +15,28 @@
* limitations under the License.
*/
import { element, by, browser, ElementFinder, Locator } from 'protractor';
import { element, by, browser, ElementFinder, $, $$ } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class UploadDialogPage {
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: Locator = by.css('mat-icon[class*="status--done"]');
cancelledStatusIcon: Locator = by.css('div[class*="status--cancelled"]');
errorStatusIcon: Locator = by.css('div[class*="status--error"] mat-icon');
errorTooltip = element(by.css('div.mat-tooltip'));
closeButton = $('footer[class*="upload-dialog__actions"] button[id="adf-upload-dialog-close"]');
dialog = $('div[id="upload-dialog"]');
minimizedDialog = $('div[class*="upload-dialog--minimized"]');
uploadedStatusIcon = 'mat-icon[class*="status--done"]';
cancelledStatusIcon = 'div[class*="status--cancelled"]';
errorStatusIcon = 'div[class*="status--error"] mat-icon';
errorTooltip = $('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('.upload-dialog__confirmation--title'));
canUploadConfirmationDescription = element(by.css('.upload-dialog__confirmation--text'));
title = $('span[class*="upload-dialog__title"]');
minimizeButton = $('mat-icon[title="Minimize"]');
maximizeButton = $('mat-icon[title="Maximize"]');
canUploadConfirmationTitle = $('.upload-dialog__confirmation--title');
canUploadConfirmationDescription = $('.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"]')));
cancelUploadInProgressButton = element(by.css('div[data-automation-id="cancel-upload-progress"]'));
cancelUploadsElement = $('footer[class*="upload-dialog__actions"] button[id="adf-upload-dialog-cancel-all"]');
cancelUploadInProgressButton = $('div[data-automation-id="cancel-upload-progress"]');
async clickOnCloseButton(): Promise<void> {
await this.checkCloseButtonIsDisplayed();
@@ -59,24 +59,20 @@ export class UploadDialogPage {
await BrowserVisibility.waitUntilElementIsNotVisible(this.dialog);
}
getRowsByName(content: string): ElementFinder {
return element.all(by.css(`div[class*='uploading-row'] span[title="${content}"]`)).first();
}
async getRowByRowName(content: string): Promise<ElementFinder> {
const rows = this.getRowsByName(content);
await BrowserVisibility.waitUntilElementIsVisible(rows);
return rows.element(this.rowByRowName);
const row = await $$(`div[class*='uploading-row'] span[title="${content}"]`).last();
await BrowserVisibility.waitUntilElementIsVisible(row);
return row.element(this.rowByRowName);
}
async fileIsUploaded(content: string): Promise<void> {
const row = await this.getRowByRowName(content);
await BrowserVisibility.waitUntilElementIsVisible(row.element(this.uploadedStatusIcon), 60000);
const row: ElementFinder = await this.getRowByRowName(content);
await BrowserVisibility.waitUntilElementIsVisible(row.$(this.uploadedStatusIcon), 10000);
}
async fileIsError(content: string) {
const row = await this.getRowByRowName(content);
await BrowserVisibility.waitUntilElementIsVisible(row.element(this.errorStatusIcon));
const row: ElementFinder = await this.getRowByRowName(content);
await BrowserVisibility.waitUntilElementIsVisible(row.$(this.errorStatusIcon));
}
async filesAreUploaded(content: string[]): Promise<void> {
@@ -86,7 +82,7 @@ export class UploadDialogPage {
}
async fileIsNotDisplayedInDialog(content: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(element(by.css(`div[class*='uploading-row'] span[title="${content}"]`)));
await BrowserVisibility.waitUntilElementIsNotVisible($(`div[class*='uploading-row'] span[title="${content}"]`));
}
async cancelUploads(): Promise<void> {
@@ -102,16 +98,16 @@ export class UploadDialogPage {
}
async fileIsCancelled(content: string): Promise<void> {
const row = await this.getRowByRowName(content);
const row: ElementFinder = await this.getRowByRowName(content);
await BrowserVisibility.waitUntilElementIsVisible(row);
await BrowserVisibility.waitUntilElementIsVisible(row.element(this.cancelledStatusIcon), 10000);
await BrowserVisibility.waitUntilElementIsVisible(row.$(this.cancelledStatusIcon), 10000);
}
async removeUploadedFile(content: string): Promise<void> {
const row = await this.getRowByRowName(content);
await BrowserVisibility.waitUntilElementIsVisible(row.element(this.uploadedStatusIcon));
const row: ElementFinder = await this.getRowByRowName(content);
await BrowserVisibility.waitUntilElementIsVisible(row.$(this.uploadedStatusIcon));
const elementRow = await this.getRowByRowName(content);
await BrowserActions.click(elementRow.element(this.uploadedStatusIcon));
await BrowserActions.click(elementRow.$(this.uploadedStatusIcon));
}
async getTitleText(): Promise<string> {
@@ -156,8 +152,8 @@ export class UploadDialogPage {
}
async displayTooltip(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(this.errorStatusIcon));
await browser.actions().mouseMove(element(this.errorStatusIcon)).perform();
await BrowserVisibility.waitUntilElementIsVisible($(this.errorStatusIcon));
await browser.actions().mouseMove($(this.errorStatusIcon)).perform();
}
async getTooltip(): Promise<string> {

View File

@@ -15,20 +15,20 @@
* limitations under the License.
*/
import { browser, by, element } from 'protractor';
import { $, browser } from 'protractor';
import { BrowserActions, BrowserVisibility, TogglePage } from '@alfresco/adf-testing';
export class UploadTogglesPage {
togglePage = new TogglePage();
multipleFileUploadToggle = element(by.id('adf-multiple-upload-switch'));
uploadFolderToggle = element(by.css('#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"]'));
multipleFileUploadToggle = $('#adf-multiple-upload-switch');
uploadFolderToggle = $('#adf-folder-upload-switch');
extensionFilterToggle = $('#adf-extension-filter-upload-switch');
maxSizeToggle = $('#adf-max-size-filter-upload-switch');
versioningToggle = $('#adf-version-upload-switch');
extensionAcceptedField = $('input[data-automation-id="accepted-files-type"]');
maxSizeField = $('input[data-automation-id="max-files-size"]');
disableUploadCheckbox = $('[id="adf-disable-upload"]');
async enableMultipleFileUpload(): Promise<void> {
await browser.executeScript('arguments[0].scrollIntoView()', this.multipleFileUploadToggle);
@@ -46,7 +46,7 @@ export class UploadTogglesPage {
async checkFolderUploadToggleIsEnabled(): Promise<boolean> {
try {
const enabledFolderUpload = element(by.css('mat-slide-toggle[id="adf-folder-upload-switch"][class*="mat-checked"]'));
const enabledFolderUpload = $('mat-slide-toggle[id="adf-folder-upload-switch"][class*="mat-checked"]');
await BrowserVisibility.waitUntilElementIsVisible(enabledFolderUpload);
return true;
} catch {
@@ -55,17 +55,17 @@ export class UploadTogglesPage {
}
async checkMultipleFileUploadToggleIsEnabled(): Promise<void> {
const enabledToggle = element(by.css('mat-slide-toggle[id="adf-multiple-upload-switch"][class*="mat-checked"]'));
const enabledToggle = $('mat-slide-toggle[id="adf-multiple-upload-switch"][class*="mat-checked"]');
await BrowserVisibility.waitUntilElementIsVisible(enabledToggle);
}
async checkMaxSizeToggleIsEnabled(): Promise<void> {
const enabledToggle = element(by.css('mat-slide-toggle[id="adf-max-size-filter-upload-switch"][class*="mat-checked"]'));
const enabledToggle = $('mat-slide-toggle[id="adf-max-size-filter-upload-switch"][class*="mat-checked"]');
await BrowserVisibility.waitUntilElementIsVisible(enabledToggle);
}
async checkVersioningToggleIsEnabled(): Promise<void> {
const enabledToggle = element(by.css('mat-slide-toggle[id="adf-version-upload-switch"][class*="mat-checked"]'));
const enabledToggle = $('mat-slide-toggle[id="adf-version-upload-switch"][class*="mat-checked"]');
await BrowserVisibility.waitUntilElementIsVisible(enabledToggle);
}
@@ -74,7 +74,7 @@ export class UploadTogglesPage {
}
async checkFolderUploadToggleIsNotEnabled(): Promise<boolean> {
try {
const inactiveToggleFolder = element(by.css('#adf-folder-upload-switch .mat-slide-toggle-label'));
const inactiveToggleFolder = $('#adf-folder-upload-switch .mat-slide-toggle-label');
await BrowserVisibility.waitUntilElementIsVisible(inactiveToggleFolder);
return true;
} catch {

View File

@@ -15,18 +15,13 @@
* limitations under the License.
*/
import { by, element, ElementFinder } from 'protractor';
import { $, ElementFinder } from 'protractor';
import { BrowserVisibility } from '@alfresco/adf-testing';
export class IconsPage {
locateCustomIcon(name: string): ElementFinder {
return element(by.css(`adf-icon[value='${name}'] svg`));
}
locateLigatureIcon(name: string): ElementFinder {
return element(by.css(`adf-icon[value='${name}'] .material-icons`));
}
locateCustomIcon = (name: string): ElementFinder => $(`adf-icon[value='${name}'] svg`);
locateLigatureIcon = (name: string): ElementFinder => $(`adf-icon[value='${name}'] .material-icons`);
async isCustomIconDisplayed(name: string) {
const present = await BrowserVisibility.waitUntilElementIsVisible(this.locateCustomIcon(name));

View File

@@ -15,18 +15,18 @@
* limitations under the License.
*/
import { element, by, ElementFinder } from 'protractor';
import { ElementFinder, $, $$ } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class InfinitePaginationPage {
rootElement: ElementFinder;
loadMoreButton;
loading = element(by.css('[data-automation-id="adf-infinite-pagination-spinner"]'));
loadMoreButton: ElementFinder;
loading = $('[data-automation-id="adf-infinite-pagination-spinner"]');
constructor(rootElement = element.all(by.css('adf-infinite-pagination')).first()) {
constructor(rootElement = $$('adf-infinite-pagination').first()) {
this.rootElement = rootElement;
this.loadMoreButton = this.rootElement.element(by.css('button[data-automation-id="adf-infinite-pagination-button"]'));
this.loadMoreButton = this.rootElement.$('button[data-automation-id="adf-infinite-pagination-button"]');
}
async clickLoadMoreButton(): Promise<void> {

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { browser, by, element } from 'protractor';
import { $, browser, by, element } from 'protractor';
import { TogglePage, BrowserActions, BrowserVisibility, LoginPage } from '@alfresco/adf-testing';
export class LoginShellPage {
@@ -24,33 +24,33 @@ export class LoginShellPage {
loginSSOPage = new LoginPage();
togglePage = new TogglePage();
txtUsername = element(by.css('input[id="username"]'));
txtPassword = element(by.css('input[id="password"]'));
logoImg = element(by.css('img[id="adf-login-img-logo"]'));
successRouteTxt = element(by.css('input[data-automation-id="adf-success-route"]'));
logoTxt = element(by.css('input[data-automation-id="adf-url-logo"]'));
usernameError = element(by.css('span[data-automation-id="username-error"]'));
passwordError = element(by.css('span[data-automation-id="password-required"]'));
loginError = element(by.css('.adf-login-error-message'));
usernameInactive = element(by.css('input[id="username"][aria-invalid="false"]'));
passwordInactive = element(by.css('input[id="password"][aria-invalid="false"]'));
adfLogo = element(by.css('.adf-img-logo'));
txtUsername = $('input[id="username"]');
txtPassword = $('input[id="password"]');
logoImg = $('img[id="adf-login-img-logo"]');
successRouteTxt = $('input[data-automation-id="adf-success-route"]');
logoTxt = $('input[data-automation-id="adf-url-logo"]');
usernameError = $('span[data-automation-id="username-error"]');
passwordError = $('span[data-automation-id="password-required"]');
loginError = $('.adf-login-error-message');
usernameInactive = $('input[id="username"][aria-invalid="false"]');
passwordInactive = $('input[id="password"][aria-invalid="false"]');
adfLogo = $('.adf-img-logo');
usernameHighlighted = element(by.css('input[id="username"][aria-invalid="true"]'));
passwordHighlighted = element(by.css('input[id="password"][aria-invalid="true"]'));
signInButton = element(by.id('login-button'));
showPasswordElement = element(by.css('button[data-automation-id="show_password"]'));
hidePasswordElement = element(by.css('button[data-automation-id="hide_password"]'));
rememberMe = element(by.css('mat-checkbox[id="adf-login-remember"]'));
needHelp = element(by.id('adf-login-action-left'));
register = element(by.id('adf-login-action-right'));
footerSwitch = element(by.id('switch4'));
rememberMeSwitch = element(by.id('adf-toggle-show-rememberme'));
successRouteSwitch = element(by.id('adf-toggle-show-successRoute'));
logoSwitch = element(by.id('adf-toggle-logo'));
header = element(by.id('adf-header'));
usernameHighlighted = $('input[id="username"][aria-invalid="true"]');
passwordHighlighted = $('input[id="password"][aria-invalid="true"]');
signInButton = $('#login-button');
showPasswordElement = $('button[data-automation-id="show_password"]');
hidePasswordElement = $('button[data-automation-id="hide_password"]');
rememberMe = $('mat-checkbox[id="adf-login-remember"]');
needHelp = $('#adf-login-action-left');
register = $('#adf-login-action-right');
footerSwitch = $('#switch4');
rememberMeSwitch = $('#adf-toggle-show-rememberme');
successRouteSwitch = $('#adf-toggle-show-successRoute');
logoSwitch = $('#adf-toggle-logo');
header = $('#adf-header');
settingsIcon = element(by.cssContainingText('a[data-automation-id="settings"] mat-icon', 'settings'));
sidenavLayout = element(by.css(`[data-automation-id="sidenav-layout"]`));
sidenavLayout = $(`[data-automation-id="sidenav-layout"]`);
async goToLoginPage(): Promise<void> {
await BrowserActions.getUrl(this.loginURL);

View File

@@ -15,12 +15,12 @@
* limitations under the License.
*/
import { by, element, ElementFinder } from 'protractor';
import { $ } from 'protractor';
import { BrowserVisibility } from '@alfresco/adf-testing';
export class LogoutPage {
logoutSection: ElementFinder = element(by.css('div[data-automation-id="adf-logout-section"]'));
logoutSection = $('div[data-automation-id="adf-logout-section"]');
async checkLogoutSectionIsDisplayed() {
await BrowserVisibility.waitUntilElementIsVisible(this.logoutSection);

View File

@@ -15,45 +15,48 @@
* limitations under the License.
*/
import { by, element, Key, Locator, protractor } from 'protractor';
import { $, by, element, Key, protractor, ElementFinder } from 'protractor';
import { BrowserActions, BrowserVisibility, DropdownPage, TestElement, Logger } 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']`));
aspectTitle: Locator = by.css(`mat-panel-title`);
name = element(by.css(`[data-automation-id='card-textitem-value-properties.cm:name']`));
creator = element(by.css(`[data-automation-id='card-textitem-value-createdByUser.displayName']`));
createdDate = element(by.css(`span[data-automation-id='card-dateitem-createdAt']`));
modifier = element(by.css(`[data-automation-id='card-textitem-value-modifiedByUser.displayName']`));
modifiedDate = element(by.css(`span[data-automation-id='card-dateitem-modifiedAt']`));
mimetypeName = element(by.css(`[data-automation-id='card-textitem-value-content.mimeTypeName']`));
size = element(by.css(`[data-automation-id='card-textitem-value-content.sizeInBytes']`));
description = element(by.css(`span[data-automation-id='card-textitem-value-properties.cm:description']`));
author = element(by.css(`[data-automation-id='card-textitem-value-properties.cm:author']`));
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'));
title = $(`div[info-drawer-title]`);
expandedAspect = $(`mat-expansion-panel-header[aria-expanded='true']`);
aspectTitle = `mat-panel-title`;
name = $(`[data-automation-id='card-textitem-value-properties.cm:name']`);
creator = $(`[data-automation-id='card-textitem-value-createdByUser.displayName']`);
createdDate = $(`span[data-automation-id='card-dateitem-createdAt']`);
modifier = $(`[data-automation-id='card-textitem-value-modifiedByUser.displayName']`);
modifiedDate = $(`span[data-automation-id='card-dateitem-modifiedAt']`);
mimetypeName = $(`[data-automation-id='card-textitem-value-content.mimeTypeName']`);
size = $(`[data-automation-id='card-textitem-value-content.sizeInBytes']`);
description = $(`span[data-automation-id='card-textitem-value-properties.cm:description']`);
author = $(`[data-automation-id='card-textitem-value-properties.cm:author']`);
titleProperty = $(`span[data-automation-id='card-textitem-value-properties.cm:title'] span`);
editIcon = $(`button[data-automation-id='meta-data-card-toggle-edit']`);
informationButton = $(`button[data-automation-id='meta-data-card-toggle-expand']`);
informationSpan = $(`span[data-automation-id='meta-data-card-toggle-expand-label']`);
informationIcon = $(`span[data-automation-id='meta-data-card-toggle-expand-label'] ~ mat-icon`);
displayEmptySwitch = $(`#adf-metadata-empty`);
readonlySwitch = $(`#adf-metadata-readonly`);
multiSwitch = $(`#adf-metadata-multi`);
presetSwitch = $('#adf-toggle-custom-preset');
defaultPropertiesSwitch = $('#adf-metadata-default-properties');
closeButton = element(by.cssContainingText('button.mat-button span', 'Close'));
displayAspect = element(by.css(`input[data-placeholder='Display Aspect']`));
displayAspect = $(`input[data-placeholder='Display Aspect']`);
applyAspect = element(by.cssContainingText(`button span.mat-button-wrapper`, 'Apply Aspect'));
saveMetadataButton = element(by.css(`[data-automation-id='save-metadata']`));
resetMetadataButton = element(by.css(`[data-automation-id='reset-metadata']`));
saveMetadataButton = $(`[data-automation-id='save-metadata']`);
resetMetadataButton = $(`[data-automation-id='reset-metadata']`);
private getMetadataGroupLocator = async (groupName: string): Promise<ElementFinder> => $(`mat-expansion-panel[data-automation-id="adf-metadata-group-${groupName}"]`);
private getExpandedMetadataGroupLocator = async (groupName: string): Promise<ElementFinder> => $(`mat-expansion-panel[data-automation-id="adf-metadata-group-${groupName}"] > mat-expansion-panel-header`);
async getTitle(): Promise<string> {
return BrowserActions.getText(this.title);
}
async getExpandedAspectName(): Promise<string> {
return BrowserActions.getText(this.expandedAspect.element(this.aspectTitle));
return BrowserActions.getText(this.expandedAspect.$(this.aspectTitle));
}
async getName(): Promise<string> {
@@ -138,79 +141,79 @@ export class MetadataViewPage {
}
async editPropertyIconIsDisplayed(propertyName: string) {
const editPropertyIcon = element(by.css('[data-automation-id="header-' + propertyName + '"] .adf-textitem-edit-icon'));
const editPropertyIcon = $('[data-automation-id="header-' + propertyName + '"] .adf-textitem-edit-icon');
await BrowserVisibility.waitUntilElementIsPresent(editPropertyIcon);
}
async clickResetButton(): Promise<void> {
const clearPropertyIcon = element(by.css('button[data-automation-id="reset-metadata"]'));
const clearPropertyIcon = $('button[data-automation-id="reset-metadata"]');
await BrowserActions.click(clearPropertyIcon);
}
async enterPropertyText(propertyName: string, text: string | number): Promise<void> {
const textField = element(by.css('input[data-automation-id="card-textitem-value-' + propertyName + '"]'));
const textField = $('input[data-automation-id="card-textitem-value-' + propertyName + '"]');
await BrowserActions.clearSendKeys(textField, text.toString());
await textField.sendKeys(protractor.Key.ENTER);
}
async enterPresetText(text: string): Promise<void> {
const presetField = element(by.css('input[data-automation-id="adf-text-custom-preset"]'));
const presetField = $('input[data-automation-id="adf-text-custom-preset"]');
await BrowserActions.clearSendKeys(presetField, text.toString());
await presetField.sendKeys(protractor.Key.ENTER);
const applyButton = element(by.css('button[id="adf-metadata-aplly"]'));
const applyButton = $('button[id="adf-metadata-aplly"]');
await BrowserActions.click(applyButton);
}
async enterDescriptionText(text: string): Promise<void> {
const textField = element(by.css('textarea[data-automation-id="card-textitem-value-properties.cm:description"]'));
const textField = $('textarea[data-automation-id="card-textitem-value-properties.cm:description"]');
await BrowserActions.clearSendKeys(textField, text);
await textField.sendKeys(Key.TAB);
}
async getPropertyText(propertyName: string, type?: string): Promise<string> {
const propertyType = type || 'textitem';
const textField = element(by.css('[data-automation-id="card-' + propertyType + '-value-' + propertyName + '"]'));
const textField = $('[data-automation-id="card-' + propertyType + '-value-' + propertyName + '"]');
return BrowserActions.getInputValue(textField);
}
async getPropertyIconTooltip(propertyName: string): Promise<string> {
const editPropertyIcon = element(by.css('[data-automation-id="header-' + propertyName + '"] .adf-textitem-edit-icon'));
const editPropertyIcon = $('[data-automation-id="header-' + propertyName + '"] .adf-textitem-edit-icon');
return BrowserActions.getAttribute(editPropertyIcon, 'title');
}
async clickMetadataGroup(groupName: string): Promise<void> {
const group = element(by.css('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"]'));
const group = await this.getMetadataGroupLocator(groupName);
await BrowserActions.click(group);
}
async checkMetadataGroupIsPresent(groupName: string): Promise<void> {
const group = element(by.css('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"]'));
const group = await this.getMetadataGroupLocator(groupName);
await BrowserVisibility.waitUntilElementIsVisible(group);
}
async checkMetadataGroupIsNotPresent(groupName: string): Promise<void> {
const group = element(by.css('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"]'));
const group = await this.getMetadataGroupLocator(groupName);
await BrowserVisibility.waitUntilElementIsNotVisible(group);
}
async checkMetadataGroupIsExpand(groupName: string): Promise<void> {
const group = element(by.css('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"] > mat-expansion-panel-header'));
const group = await this.getExpandedMetadataGroupLocator(groupName);
await expect(await BrowserActions.getAttribute(group, 'class')).toContain('mat-expanded');
}
async checkMetadataGroupIsNotExpand(groupName: string): Promise<void> {
const group = element(by.css('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"] > mat-expansion-panel-header'));
const group = await this.getExpandedMetadataGroupLocator(groupName);
await expect(await BrowserActions.getAttribute(group, 'class')).not.toContain('mat-expanded');
}
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'));
const group = $('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"] > mat-expansion-panel-header > span > mat-panel-title');
return BrowserActions.getText(group);
}
async checkPropertyIsVisible(propertyName: string, type: string): Promise<void> {
const property = element(by.css('div[data-automation-id="card-' + type + '-label-' + propertyName + '"]'));
const property = $('div[data-automation-id="card-' + type + '-label-' + propertyName + '"]');
await BrowserVisibility.waitUntilElementIsVisible(property);
}

View File

@@ -16,32 +16,34 @@
*/
import { AppListCloudPage, BrowserActions, BrowserVisibility, Logger } from '@alfresco/adf-testing';
import { browser, by, element, ElementFinder } from 'protractor';
import { $, browser, ElementFinder } from 'protractor';
import { ProcessServicesPage } from '../../process-services/pages/process-services.page';
export class NavigationBarPage {
linkListContainer = element(by.css('.app-sidenav-linklist'));
linkMenuChildrenContainer = element(by.css('.nestedMenu'));
dataTableNestedButton = this.linkMenuChildrenContainer.element(by.css('.app-sidenav-link[data-automation-id="Datatable"]'));
dataTableCopyContentButton = this.linkMenuChildrenContainer.element(by.css('.app-sidenav-link[data-automation-id="Copy Content"]'));
dataTableDragAndDropButton = this.linkMenuChildrenContainer.element(by.css('.app-sidenav-link[data-automation-id="Drag and Drop"]'));
processServicesNestedButton = this.linkMenuChildrenContainer.element(by.css('.app-sidenav-link[data-automation-id="App"]'));
processServicesCloudHomeButton = this.linkMenuChildrenContainer.element(by.css('.app-sidenav-link[data-automation-id="Home"]'));
themeButton = element(by.css('button[data-automation-id="theme menu"]'));
themeMenuContent = element(by.css('div[class*="mat-menu-panel"]'));
appTitle = element(by.css('.adf-app-title'));
menuButton = element(by.css('button[data-automation-id="adf-menu-icon"]'));
formButton = this.linkMenuChildrenContainer.element(by.css('.app-sidenav-link[data-automation-id="Form"]'));
peopleGroupCloudButton = this.linkMenuChildrenContainer.element(by.css('.app-sidenav-link[data-automation-id="People/Group Cloud"]'));
serviceTaskListButton = this.linkMenuChildrenContainer.element(by.css('.app-sidenav-link[data-automation-id="Service Task List"]'));
logoutSection: ElementFinder = element(by.css('div[data-automation-id="adf-logout-section"]'));
personalFiles: ElementFinder = element(by.css('div [title="Personal Files"]'));
linkListContainer = $('.app-sidenav-linklist');
linkMenuChildrenContainer = $('.nestedMenu');
dataTableNestedButton = this.linkMenuChildrenContainer.$('.app-sidenav-link[data-automation-id="Datatable"]');
dataTableCopyContentButton = this.linkMenuChildrenContainer.$('.app-sidenav-link[data-automation-id="Copy Content"]');
dataTableDragAndDropButton = this.linkMenuChildrenContainer.$('.app-sidenav-link[data-automation-id="Drag and Drop"]');
processServicesNestedButton = this.linkMenuChildrenContainer.$('.app-sidenav-link[data-automation-id="App"]');
processServicesCloudHomeButton = this.linkMenuChildrenContainer.$('.app-sidenav-link[data-automation-id="Home"]');
themeButton = $('button[data-automation-id="theme menu"]');
themeMenuContent = $('div[class*="mat-menu-panel"]');
appTitle = $('.adf-app-title');
menuButton = $('button[data-automation-id="adf-menu-icon"]');
formButton = this.linkMenuChildrenContainer.$('.app-sidenav-link[data-automation-id="Form"]');
peopleGroupCloudButton = this.linkMenuChildrenContainer.$('.app-sidenav-link[data-automation-id="People/Group Cloud"]');
serviceTaskListButton = this.linkMenuChildrenContainer.$('.app-sidenav-link[data-automation-id="Service Task List"]');
logoutSection = $('div[data-automation-id="adf-logout-section"]');
personalFiles = $('div [title="Personal Files"]');
getMenuItemLocator = (title: string) => $(`.app-sidenav-link[data-automation-id="${title}"]`);
async clickNavigationBarItem(title: string, untilElementIsVisible?: ElementFinder): Promise<void> {
Logger.log(`clickNavigationBarItem ${title}`);
const menu = element(by.css(`.app-sidenav-link[data-automation-id="${title}"]`));
const menu = $(`.app-sidenav-link[data-automation-id="${title}"]`);
await BrowserActions.closeMenuAndDialogs();
if (untilElementIsVisible) {
@@ -69,7 +71,7 @@ export class NavigationBarPage {
async clickProcessCloudButton() {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.clickUntilIsNotVisible(this.getMenuItem('Process Cloud'), this.linkMenuChildrenContainer);
await BrowserActions.clickUntilIsNotVisible(this.getMenuItemLocator('Process Cloud'), this.linkMenuChildrenContainer);
}
async navigateToProcessServicesCloudPage(): Promise<AppListCloudPage> {
@@ -99,11 +101,7 @@ export class NavigationBarPage {
private async clickProcessServicesButton() {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.clickUntilIsNotVisible(this.getMenuItem('Process Services'), this.linkMenuChildrenContainer);
}
private getMenuItem(title: string) {
return element(by.css(`.app-sidenav-link[data-automation-id="${title}"]`));
await BrowserActions.clickUntilIsNotVisible(this.getMenuItemLocator('Process Services'), this.linkMenuChildrenContainer);
}
async navigateToProcessServicesPage(): Promise<ProcessServicesPage> {
@@ -205,7 +203,7 @@ export class NavigationBarPage {
}
async clickOnSpecificThemeButton(themeName): Promise<void> {
const themeElement = element(by.css(`button[data-automation-id="${themeName}"]`));
const themeElement = $(`button[data-automation-id="${themeName}"]`);
await BrowserActions.click(themeElement);
await BrowserVisibility.waitUntilElementIsNotPresent(this.linkMenuChildrenContainer);
}
@@ -223,12 +221,12 @@ export class NavigationBarPage {
}
async checkToolbarColor(color: string): Promise<void> {
const toolbarColor = element(by.css(`mat-toolbar[class*="mat-${color}"]`));
const toolbarColor = $(`mat-toolbar[class*="mat-${color}"]`);
await BrowserVisibility.waitUntilElementIsVisible(toolbarColor);
}
async clickAppLogo(logoTitle: string): Promise<void> {
const appLogo = element(by.css('a[title="' + logoTitle + '"]'));
const appLogo = $('a[title="' + logoTitle + '"]');
await BrowserActions.click(appLogo);
}
@@ -237,7 +235,7 @@ export class NavigationBarPage {
}
async checkLogoTooltip(logoTooltipTitle: string): Promise<void> {
const logoTooltip = element(by.css('a[title="' + logoTooltipTitle + '"]'));
const logoTooltip = $('a[title="' + logoTooltipTitle + '"]');
await BrowserVisibility.waitUntilElementIsVisible(logoTooltip);
}

View File

@@ -15,24 +15,24 @@
* limitations under the License.
*/
import { element, by, browser } from 'protractor';
import { element, by, browser, $, $$ } from 'protractor';
import { BrowserVisibility, BrowserActions, DropdownPage, SnackbarPage } from '@alfresco/adf-testing';
export class NotificationDemoPage {
snackbarPage = new SnackbarPage();
messageField = element(by.css('input[data-automation-id="notification-message"]'));
durationField = element(by.css('input[data-automation-id="notification-duration"]'));
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"]'));
notificationsPage = element(by.css('.app-sidenav-link[data-automation-id="Notifications"]'));
notificationConfig = element(by.css('p[data-automation-id="notification-custom-object"]'));
messageField = $('input[data-automation-id="notification-message"]');
durationField = $('input[data-automation-id="notification-duration"]');
actionToggle = $('mat-slide-toggle[data-automation-id="notification-action-toggle"]');
notificationSnackBar = $$('simple-snack-bar').first();
actionOutput = $('div[data-automation-id="notification-action-output"]');
notificationsPage = $('.app-sidenav-link[data-automation-id="Notifications"]');
notificationConfig = $('p[data-automation-id="notification-custom-object"]');
horizontalPositionDropdown = new DropdownPage(element(by.css('mat-select[data-automation-id="notification-horizontal-position"]')));
verticalPositionDropdown = new DropdownPage(element(by.css('mat-select[data-automation-id="notification-vertical-position"]')));
directionDropdown = new DropdownPage(element(by.css('mat-select[data-automation-id="notification-direction"]')));
horizontalPositionDropdown = new DropdownPage($('mat-select[data-automation-id="notification-horizontal-position"]'));
verticalPositionDropdown = new DropdownPage($('mat-select[data-automation-id="notification-vertical-position"]'));
directionDropdown = new DropdownPage($('mat-select[data-automation-id="notification-direction"]'));
async checkNotifyContains(message): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element.all(by.cssContainingText('simple-snack-bar', message)).first());
@@ -79,7 +79,7 @@ export class NotificationDemoPage {
}
async clickNotificationButton(): Promise<void> {
const button = element(by.css('button[data-automation-id="notification-custom-config-button"]'));
const button = $('button[data-automation-id="notification-custom-config-button"]');
await BrowserActions.click(button);
}

View File

@@ -16,19 +16,19 @@
*/
import { BrowserActions, BrowserVisibility, DocumentListPage } from '@alfresco/adf-testing';
import { Locator, element, by, browser } from 'protractor';
import { browser, $$, $ } from 'protractor';
export class TrashcanPage {
contentList = new DocumentListPage(element(by.css('adf-document-list')));
rows: Locator = by.css('adf-document-list div[class*="adf-datatable-body"] adf-datatable-row[class*="adf-datatable-row"]');
tableBody = element.all(by.css('adf-document-list .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 = new DocumentListPage($('adf-document-list'));
rows = $$('adf-document-list div[class*="adf-datatable-body"] adf-datatable-row[class*="adf-datatable-row"]');
tableBody = $$('adf-document-list .adf-datatable-body').first();
pagination = $('adf-pagination');
emptyTrashcan = $('adf-empty-content');
restoreButton = $(`button[title='Restore']`);
async numberOfResultsDisplayed(): Promise<number> {
return element.all(this.rows).count();
return this.rows.count();
}
async waitForTableBody(): Promise<void> {

View File

@@ -17,7 +17,7 @@
import * as path from 'path';
import { BrowserActions, TestElement, TogglePage } from '@alfresco/adf-testing';
import { browser, by, element } from 'protractor';
import { $, browser } from 'protractor';
export class VersionManagePage {
@@ -31,9 +31,9 @@ export class VersionManagePage {
majorRadio = TestElement.byId('adf-new-version-major');
minorRadio = TestElement.byId('adf-new-version-minor');
commentText = TestElement.byId('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'));
readOnlySwitch = $('#adf-version-manager-switch-readonly');
downloadSwitch = $('#adf-version-manager-switch-download');
commentsSwitch = $('#adf-version-manager-switch-comments');
confirmAccept = TestElement.byId('adf-confirm-accept');
confirmCancel = TestElement.byId('adf-confirm-cancel');

View File

@@ -106,18 +106,14 @@ describe('Pagination - returns to previous page when current is empty', () => {
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
await expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(itemsPerPage.fiveValue);
let list = await contentServicesPage.getAllRowsNameColumn();
await expect(ArrayUtil.arrayContainsArray(list, fileNames.slice(0, 5))).toEqual(true);
await paginationPage.clickOnNextPage();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
list = await contentServicesPage.getAllRowsNameColumn();
await expect(ArrayUtil.arrayContainsArray(list, fileNames.slice(5, 6))).toEqual(true);
await contentServicesPage.deleteContent(lastFile);
await contentServicesPage.checkContentIsNotDisplayed(lastFile);

View File

@@ -25,7 +25,7 @@ import {
TaskFormCloudComponent,
StartProcessCloudPage, ProcessCloudWidgetPage
} from '@alfresco/adf-testing';
import { browser, by } from 'protractor';
import { browser } from 'protractor';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TasksCloudDemoPage } from '.././pages/tasks-cloud-demo.page';
@@ -96,11 +96,11 @@ describe('Task cloud visibility', async () => {
await taskFormCloudComponent.formFields().checkWidgetIsHidden('Number2');
await expect(await taskFormCloudComponent.formFields().isCompleteFormButtonEnabled()).toEqual(false);
await taskFormCloudComponent.formFields().setFieldValue(by.id, 'Number1', '5');
await taskFormCloudComponent.formFields().setFieldValue('Number1', '5');
await taskFormCloudComponent.formFields().checkWidgetIsVisible('Number2');
await expect(await taskFormCloudComponent.formFields().isCompleteFormButtonEnabled()).toEqual(true);
await taskFormCloudComponent.formFields().setFieldValue(by.id, 'Number1', '123');
await taskFormCloudComponent.formFields().setFieldValue('Number1', '123');
await expect(await taskFormCloudComponent.formFields().isCompleteFormButtonEnabled()).toEqual(false);
await taskFormCloudComponent.formFields().checkWidgetIsHidden('Number2');
});
@@ -125,15 +125,15 @@ describe('Task cloud visibility', async () => {
await taskFormCloudComponent.formFields().checkWidgetIsHidden('Number2');
await expect(await taskFormCloudComponent.formFields().isCompleteFormButtonEnabled()).toEqual(false);
await taskFormCloudComponent.formFields().setFieldValue(by.id, 'Number1', '5');
await taskFormCloudComponent.formFields().setFieldValue('Number1', '5');
await taskFormCloudComponent.formFields().checkWidgetIsVisible('Number2');
await expect(await taskFormCloudComponent.formFields().isCompleteFormButtonEnabled()).toEqual(true);
await taskFormCloudComponent.formFields().setFieldValue(by.id, 'Number1', '123');
await taskFormCloudComponent.formFields().setFieldValue('Number1', '123');
await expect(await taskFormCloudComponent.formFields().isCompleteFormButtonEnabled()).toEqual(false);
await taskFormCloudComponent.formFields().checkWidgetIsHidden('Number2');
await taskFormCloudComponent.formFields().setFieldValue(by.id, 'Number1', '4');
await taskFormCloudComponent.formFields().setFieldValue('Number1', '4');
await expect(await taskFormCloudComponent.formFields().isCompleteFormButtonEnabled()).toEqual(true);
await taskFormCloudComponent.clickCompleteButton();
});

View File

@@ -15,30 +15,30 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { by, element, $, $$ } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class PeopleGroupCloudComponentPage {
peopleCloudSingleSelectionChecked = element(by.css('mat-radio-button[data-automation-id="app-people-single-mode"][class*="mat-radio-checked"]'));
peopleCloudMultipleSelectionChecked = element(by.css('mat-radio-button[data-automation-id="app-people-multiple-mode"][class*="mat-radio-checked"]'));
peopleCloudSingleSelection = element(by.css('mat-radio-button[data-automation-id="app-people-single-mode"]'));
peopleCloudMultipleSelection = element(by.css('mat-radio-button[data-automation-id="app-people-multiple-mode"]'));
peopleCloudFilterRole = element(by.css('mat-radio-button[data-automation-id="app-people-filter-role"]'));
groupCloudSingleSelection = element(by.css('mat-radio-button[data-automation-id="app-group-single-mode"]'));
groupCloudMultipleSelection = element(by.css('mat-radio-button[data-automation-id="app-group-multiple-mode"]'));
groupCloudFilterRole = element(by.css('mat-radio-button[data-automation-id="app-group-filter-role"]'));
peopleRoleInput = element(by.css('input[data-automation-id="app-people-roles-input"]'));
peopleAppInput = element(by.css('input[data-automation-id="app-people-app-input"]'));
peoplePreselect = element(by.css('input[data-automation-id="app-people-preselect-input"]'));
groupRoleInput = element(by.css('input[data-automation-id="app-group-roles-input"]'));
groupAppInput = element(by.css('input[data-automation-id="app-group-app-input"]'));
peopleCloudSingleSelectionChecked = $('mat-radio-button[data-automation-id="app-people-single-mode"][class*="mat-radio-checked"]');
peopleCloudMultipleSelectionChecked = $('mat-radio-button[data-automation-id="app-people-multiple-mode"][class*="mat-radio-checked"]');
peopleCloudSingleSelection = $('mat-radio-button[data-automation-id="app-people-single-mode"]');
peopleCloudMultipleSelection = $('mat-radio-button[data-automation-id="app-people-multiple-mode"]');
peopleCloudFilterRole = $('mat-radio-button[data-automation-id="app-people-filter-role"]');
groupCloudSingleSelection = $('mat-radio-button[data-automation-id="app-group-single-mode"]');
groupCloudMultipleSelection = $('mat-radio-button[data-automation-id="app-group-multiple-mode"]');
groupCloudFilterRole = $('mat-radio-button[data-automation-id="app-group-filter-role"]');
peopleRoleInput = $('input[data-automation-id="app-people-roles-input"]');
peopleAppInput = $('input[data-automation-id="app-people-app-input"]');
peoplePreselect = $('input[data-automation-id="app-people-preselect-input"]');
groupRoleInput = $('input[data-automation-id="app-group-roles-input"]');
groupAppInput = $('input[data-automation-id="app-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.all(by.css('mat-checkbox.app-preselect-value')).first();
preselectValidationStatus = element.all(by.css('mat-checkbox.app-preselect-value label input')).first();
peopleFilterByAppName = element(by.css('.app-people-control-options mat-radio-button[value="appName"]'));
groupFilterByAppName = element(by.css('.app-groups-control-options mat-radio-button[value="appName"]'));
preselectValidation = $$('mat-checkbox.app-preselect-value').first();
preselectValidationStatus = $$('mat-checkbox.app-preselect-value label input').first();
peopleFilterByAppName = $('.app-people-control-options mat-radio-button[value="appName"]');
groupFilterByAppName = $('.app-groups-control-options mat-radio-button[value="appName"]');
async checkPeopleCloudComponentTitleIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.peopleCloudComponentTitle);

View File

@@ -16,12 +16,12 @@
*/
import { BrowserActions, BrowserVisibility, EditProcessFilterCloudComponentPage, ProcessFiltersCloudComponentPage, ProcessListCloudComponentPage } from '@alfresco/adf-testing';
import { by, element } from 'protractor';
import { by, element, $ } from 'protractor';
export class ProcessCloudDemoPage {
createButton = element(by.css('button[data-automation-id="create-button"'));
newProcessButton = element(by.css('button[data-automation-id="btn-start-process"]'));
createButton = $('button[data-automation-id="create-button"');
newProcessButton = $('button[data-automation-id="btn-start-process"]');
processListCloud = new ProcessListCloudComponentPage();
editProcessFilterCloud = new EditProcessFilterCloudComponentPage();

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { $ } from 'protractor';
import {
BrowserVisibility,
BrowserActions,
@@ -24,15 +24,15 @@ import {
export class ServiceTaskListPage {
dataTableComponentPage = new DataTableComponentPage();
allServiceTaskButton = element(by.css('button[data-automation-id="my-service-tasks_filter"]'));
completedServiceTaskButton = element(by.css('button[data-automation-id="completed-tasks_filter"]'));
errorServiceTaskButton = element(by.css('button[data-automation-id="errored-service-tasks_filter"]'));
searchHeader = element(by.css('adf-cloud-edit-service-task-filter mat-expansion-panel-header'));
serviceTaskList = element(by.css('adf-cloud-service-task-list'));
activityNameField = element(by.css('input[data-automation-id="adf-cloud-edit-task-property-activityName"]'));
activityStatus = element(by.css('[data-automation-id="datatable-row-0"] div[aria-label="Status"]'));
activityName = element(by.css('[data-automation-id="datatable-row-0"] div[aria-label="Activity name"]'));
resultList = element(by.css('div[role="rowgroup"].adf-datatable-body'));
allServiceTaskButton = $('button[data-automation-id="my-service-tasks_filter"]');
completedServiceTaskButton = $('button[data-automation-id="completed-tasks_filter"]');
errorServiceTaskButton = $('button[data-automation-id="errored-service-tasks_filter"]');
searchHeader = $('adf-cloud-edit-service-task-filter mat-expansion-panel-header');
serviceTaskList = $('adf-cloud-service-task-list');
activityNameField = $('input[data-automation-id="adf-cloud-edit-task-property-activityName"]');
activityStatus = $('[data-automation-id="datatable-row-0"] div[aria-label="Status"]');
activityName = $('[data-automation-id="datatable-row-0"] div[aria-label="Activity name"]');
resultList = $('div[role="rowgroup"].adf-datatable-body');
async checkServiceTaskFiltersDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.allServiceTaskButton);

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { element, by, browser } from 'protractor';
import { element, by, browser, $ } from 'protractor';
import {
TogglePage,
TaskFiltersCloudComponentPage,
@@ -30,12 +30,12 @@ export class TasksCloudDemoPage {
newTaskButton = TestElement.byCss('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();
displayTaskDetailsToggle = element(by.css('mat-slide-toggle[data-automation-id="taskDetailsRedirection"]'));
displayProcessDetailsToggle = element(by.css('mat-slide-toggle[data-automation-id="processDetailsRedirection"]'));
actionMenuToggle = element(by.css('mat-slide-toggle[data-automation-id="actionmenu"]'));
contextMenuToggle = element(by.css('mat-slide-toggle[data-automation-id="contextmenu"]'));
multiSelectionToggle = element(by.css('mat-slide-toggle[data-automation-id="multiSelection"]'));
testingModeToggle = element(by.css('mat-slide-toggle[data-automation-id="testingMode"]'));
displayTaskDetailsToggle = $('mat-slide-toggle[data-automation-id="taskDetailsRedirection"]');
displayProcessDetailsToggle = $('mat-slide-toggle[data-automation-id="processDetailsRedirection"]');
actionMenuToggle = $('mat-slide-toggle[data-automation-id="actionmenu"]');
contextMenuToggle = $('mat-slide-toggle[data-automation-id="contextmenu"]');
multiSelectionToggle = $('mat-slide-toggle[data-automation-id="multiSelection"]');
testingModeToggle = $('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"));
addActionTitle = element(by.cssContainingText('.mat-card-title', 'Add Action'));
@@ -46,7 +46,7 @@ export class TasksCloudDemoPage {
disableCheckbox = TestElement.byCss(`mat-checkbox[formcontrolname='disabled']`);
visibleCheckbox = TestElement.byCss(`mat-checkbox[formcontrolname='visible']`);
spinner = TestElement.byTag('mat-progress-spinner');
modeDropdown = new DropdownPage(element(by.css('mat-form-field[data-automation-id="selectionMode"]')));
modeDropdown = new DropdownPage($('mat-form-field[data-automation-id="selectionMode"]'));
togglePage = new TogglePage();

View File

@@ -128,7 +128,6 @@ describe('Process Task - Attach content file', () => {
await processList.checkContentIsDisplayedById(processInstance.entry.id);
await processList.selectRowById(processInstance.entry.id);
await taskList.checkTaskListIsLoaded();
await taskList.selectRow(taskName);

View File

@@ -44,7 +44,6 @@ describe('Task filters cloud', () => {
const tasksCloudDemoPage = new TasksCloudDemoPage();
const editTaskFilter = tasksCloudDemoPage.editTaskFilterCloud;
const taskList = new TaskListCloudComponentPage();
const apiService = createApiService();
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);

View File

@@ -23,7 +23,7 @@ import { createApiService,
TaskUtil,
UsersActions
} from '@alfresco/adf-testing';
import { browser, by } from 'protractor';
import { browser } from 'protractor';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { AttachFormPage } from './../pages/attach-form.page';
import { TasksPage } from './../pages/tasks.page';
@@ -126,7 +126,7 @@ describe('Attach Form Component', () => {
await attachFormPage.selectAttachFormOption(testNames.formName);
await attachFormPage.clickAttachFormButton();
await formFields.setFieldValue(by.id, formTextField, testNames.formFieldValue);
await formFields.setFieldValue(formTextField, testNames.formFieldValue);
await formFields.completeForm();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -51,7 +51,6 @@ describe('Comment component for Processes', () => {
await apiService.loginWithProfile('admin');
user = await usersActions.createUser();
await apiService.login(user.username, user.password);
const importedApp = await applicationsService.importPublishDeployApp(app.file_path);

View File

@@ -16,7 +16,7 @@
*/
import { createApiService, ApplicationsUtil, LoginPage, UserModel, UsersActions } from '@alfresco/adf-testing';
import { browser, by } from 'protractor';
import { browser } from 'protractor';
import { FileModel } from '../../models/ACS/file.model';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
@@ -148,21 +148,21 @@ describe('Start Task - Custom App', () => {
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[4]);
await taskPage.formFields().setFieldValue(by.id, formTextField, formFieldValue);
await taskPage.formFields().setFieldValue(formTextField, formFieldValue);
await taskPage.formFields().refreshForm();
await taskPage.formFields().checkFieldValue(by.id, formTextField, '');
await taskPage.formFields().checkFieldValue(formTextField, '');
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[4]);
await taskPage.formFields().setFieldValue(by.id, formTextField, formFieldValue);
await taskPage.formFields().setFieldValue(formTextField, formFieldValue);
await taskPage.formFields().checkFieldValue(by.id, formTextField, formFieldValue);
await taskPage.formFields().checkFieldValue(formTextField, formFieldValue);
await taskPage.formFields().saveForm();
await taskPage.formFields().checkFieldValue(by.id, formTextField, formFieldValue);
await taskPage.formFields().checkFieldValue(formTextField, formFieldValue);
});
it('[C263951] Should be possible to assign a user', async () => {

View File

@@ -23,14 +23,14 @@ import { createApiService,
UserModel,
UsersActions
} from '@alfresco/adf-testing';
import { browser, by } from 'protractor';
import { browser } from 'protractor';
import { FileModel } from '../../models/ACS/file.model';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { AttachmentListPage } from './../pages/attachment-list.page';
import { ChecklistDialog } from './../pages/dialog/create-checklist-dialog.page';
import { ProcessServiceTabBarPage } from './../pages/process-service-tab-bar.page';
import { TasksPage } from './../pages/tasks.page';
import CONSTANTS = require('../../util/constants');
import * as CONSTANTS from '../../util/constants';
describe('Start Task - Task App', () => {
@@ -133,17 +133,17 @@ describe('Start Task - Task App', () => {
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[4]);
const formFields = await taskPage.formFields();
await formFields.setFieldValue(by.id, formTextField, formFieldValue);
await formFields.setFieldValue(formTextField, formFieldValue);
await formFields.refreshForm();
await formFields.checkFieldValue(by.id, formTextField, '');
await formFields.checkFieldValue(formTextField, '');
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[4]);
await formFields.setFieldValue(by.id, formTextField, formFieldValue);
await formFields.checkFieldValue(by.id, formTextField, formFieldValue);
await formFields.setFieldValue(formTextField, formFieldValue);
await formFields.checkFieldValue(formTextField, formFieldValue);
await taskPage.formFields().saveForm();
await formFields.checkFieldValue(by.id, formTextField, formFieldValue);
await formFields.checkFieldValue(formTextField, formFieldValue);
});
it('[C260425] Should be possible to assign a user', async () => {

View File

@@ -64,7 +64,7 @@ let specs = function () {
} else {
const FOLDER = process.env.FOLDER || '';
setProvider(FOLDER);
const specsToRun = FOLDER ? `./${FOLDER}/**/*.e2e.ts` : './**/*.ts';
const specsToRun = FOLDER ? `./${FOLDER}/**/*.e2e.ts` : './**/*.e2e.ts';
arraySpecs = [specsToRun];
}

View File

@@ -15,23 +15,25 @@
* limitations under the License.
*/
import { Locator, browser, by, element, ElementFinder, protractor } from 'protractor';
import { browser, ElementFinder, protractor, $ } from 'protractor';
import { BrowserVisibility, BrowserActions, TestElement } from '@alfresco/adf-testing';
export class SearchBarPage {
searchIcon = element(by.css(`button[class*='adf-search-button']`));
searchBar = element(by.css(`adf-search-control input`));
searchIcon = $(`button[class*='adf-search-button']`);
searchBar = $(`adf-search-control input`);
searchBarExpanded: TestElement = TestElement.byCss(`adf-search-control mat-form-field[class*="mat-focused"] input`);
noResultMessage = element(by.css(`p[class*='adf-search-fixed-text']`));
rowsAuthor: Locator = by.css(`.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`);
searchBarPage = element(by.css(`mat-list[id='autocomplete-search-result-list']`));
noResultMessage = $(`p[class*='adf-search-fixed-text']`);
rowsAuthor = `.mat-list-text p[class*='adf-search-fixed-text']`;
completeName = `h4[class*='adf-search-fixed-text']`;
highlightName = `.adf-highlight`;
searchBarPage = $(`mat-list[id='autocomplete-search-result-list']`);
getRowByRowName = (name: string): ElementFinder => $(`mat-list-item[data-automation-id='autocomplete_for_${name}']`);
async pressDownArrowAndEnter(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.searchBar);
await this.searchBar.sendKeys(protractor.Key.ARROW_DOWN);
await BrowserActions.clearSendKeys(this.searchBar, protractor.Key.ARROW_DOWN);
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
}
@@ -80,20 +82,16 @@ export class SearchBarPage {
await BrowserActions.click(this.getRowByRowName(fileName));
}
getRowByRowName(name: string): ElementFinder {
return element(by.css(`mat-list-item[data-automation-id='autocomplete_for_${name}']`));
}
async getSpecificRowsHighlightName(fileName: string): Promise<string> {
return BrowserActions.getText(this.getRowByRowName(fileName).element(this.highlightName));
return BrowserActions.getText(this.getRowByRowName(fileName).$(this.highlightName));
}
async getSpecificRowsCompleteName(fileName: string): Promise<string> {
return BrowserActions.getText(this.getRowByRowName(fileName).element(this.completeName));
return BrowserActions.getText(this.getRowByRowName(fileName).$(this.completeName));
}
async getSpecificRowsAuthor(fileName: string): Promise<string> {
return BrowserActions.getText(this.getRowByRowName(fileName).element(this.rowsAuthor));
return BrowserActions.getText(this.getRowByRowName(fileName).$(this.rowsAuthor));
}
async clearText(): Promise<void> {

View File

@@ -16,28 +16,28 @@
*/
import { BrowserVisibility, DateRangeFilterPage, NumberRangeFilterPage, SearchCategoriesPage, SearchCheckListPage, SearchRadioPage, SearchSliderPage, SearchTextPage } from '@alfresco/adf-testing';
import { by, element } from 'protractor';
import { $, by } from 'protractor';
export class SearchFiltersPage {
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"],' +
'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"]'));
searchFilters = $('adf-search-filter');
fileTypeFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_FIELDS.TYPE"]');
creatorFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_FIELDS.CREATOR"]');
fileSizeFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-SEARCH.FACET_FIELDS.SIZE"]');
nameFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-Name"]');
checkListFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-Check List"]');
createdDateRangeFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-Created Date (range)"]');
typeFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-Type"]');
sizeRangeFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-Content Size (range)"]');
sizeSliderFilter = $('mat-expansion-panel[data-automation-id="expansion-panel-Content Size"]');
facetQueriesDefaultGroup = $('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 = $('mat-expansion-panel[data-automation-id="expansion-panel-Type facet queries"]');
facetQueriesSizeGroup = $('mat-expansion-panel[data-automation-id="expansion-panel-Size facet queries"]');
facetIntervalsByCreated = $('mat-expansion-panel[data-automation-id="expansion-panel-The Created"]');
facetIntervalsByModified = $('mat-expansion-panel[data-automation-id="expansion-panel-TheModified"]');
async checkSearchFiltersIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.searchFilters);
@@ -72,7 +72,7 @@ export class SearchFiltersPage {
}
async checkCustomFacetFieldLabelIsDisplayed(fieldLabel: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.css(`mat-expansion-panel[data-automation-id="expansion-panel-${fieldLabel}"]`)));
await BrowserVisibility.waitUntilElementIsVisible($(`mat-expansion-panel[data-automation-id="expansion-panel-${fieldLabel}"]`));
}
sizeSliderFilterPage(): SearchSliderPage {

View File

@@ -16,12 +16,12 @@
*/
import { BrowserVisibility, DataTableComponentPage, SearchSortingPickerPage } from '@alfresco/adf-testing';
import { by, element } from 'protractor';
import { $ } from 'protractor';
import { ContentServicesPage } from '../../core/pages/content-services.page';
export class SearchResultsPage {
noResultsMessage = element(by.css('.app-no-result-message'));
noResultsMessage = $('.app-no-result-message');
dataTable = new DataTableComponentPage();
searchSortingPicker = new SearchSortingPickerPage();
contentServices = new ContentServicesPage();

View File

@@ -90,7 +90,7 @@ describe('Search Component - Multi-Select Facet', () => {
afterAll(async () => {
await apiService.loginWithProfile('admin');
const sitesApi = new SitesApi(apiService.getInstance());
await Promise.all([
uploadActions.deleteFileOrFolder(jpgFile.entry.id),
uploadActions.deleteFileOrFolder(jpgFileSite.entry.id),
@@ -214,7 +214,7 @@ describe('Search Component - Multi-Select Facet', () => {
await usersActions.createUser(acsUser);
await apiService.login(acsUser.username, acsUser.password);
const sitesApi = new SitesApi(apiService.getInstance());
site = await sitesApi.createSite({
title: StringUtil.generateRandomString(8),
visibility: 'PUBLIC'
@@ -236,7 +236,7 @@ describe('Search Component - Multi-Select Facet', () => {
afterAll(async () => {
await apiService.loginWithProfile('admin');
await uploadActions.deleteFileOrFolder(txtFile.entry.id);
const sitesApi = new SitesApi(apiService.getInstance());
await sitesApi.deleteSite(site.entry.id, { permanent: true });
});

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { $, by, element, $$ } from 'protractor';
import { BrowserActions } from '../../core/utils/browser-actions';
import { DataTableComponentPage } from '../../core/pages/data-table-component.page';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
@@ -29,13 +29,17 @@ const column = {
export class AddPermissionsDialogPage {
dataTableComponentPage: DataTableComponentPage = new DataTableComponentPage();
userRoleDataTableComponentPage: DataTableComponentPage = new DataTableComponentPage(element(by.css('[data-automation-id="adf-user-role-selection-table"]')));
userRoleDataTableComponentPage: DataTableComponentPage = new DataTableComponentPage($('[data-automation-id="adf-user-role-selection-table"]'));
addPermissionDialog = element(by.css('adf-add-permission-dialog'));
searchUserInput = element(by.id('searchInput'));
searchResults = element(by.css('#adf-add-permission-authority-results #adf-search-results-content'));
addButton = element(by.css('[data-automation-id="add-permission-dialog-confirm-button"]'));
closeButton = element(by.id('add-permission-dialog-close-button'));
addPermissionDialog = $('adf-add-permission-dialog');
searchUserInput = $('#searchInput');
searchResults = $('#adf-add-permission-authority-results #adf-search-results-content');
addButton = $('[data-automation-id="add-permission-dialog-confirm-button"]');
closeButton = $('#add-permission-dialog-close-button');
getRoleDropdownOptions() {
return $$('.mat-option-text');
}
async clickCloseButton(): Promise<void> {
await BrowserActions.click(this.closeButton);
@@ -69,7 +73,7 @@ export class AddPermissionsDialogPage {
}
async checkPermissionsDatatableIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.css('[class*="adf-datatable-permission"]')));
await BrowserVisibility.waitUntilElementIsVisible($('[class*="adf-datatable-permission"]'));
}
async getRoleCellValue(rowName: string): Promise<string> {
@@ -79,11 +83,7 @@ export class AddPermissionsDialogPage {
async clickRoleDropdownByUserOrGroupName(name: string): Promise<void> {
const row = this.dataTableComponentPage.getRow('Users and Groups', name);
await BrowserActions.click(row.element(by.id('adf-select-role-permission')));
}
getRoleDropdownOptions() {
return element.all(by.css('.mat-option-text'));
await BrowserActions.click(row.$('adf-select-role-permission'));
}
async selectOption(name: string): Promise<void> {
@@ -105,7 +105,7 @@ export class AddPermissionsDialogPage {
async selectRole(name: string, role: string) {
const row = this.userRoleDataTableComponentPage.getRow('Users and Groups', name);
await BrowserActions.click(row.element(by.css('[id="adf-select-role-permission"] .mat-select-trigger')));
await BrowserActions.click(row.$('[id="adf-select-role-permission"] .mat-select-trigger'));
await TestElement.byCss('.mat-select-panel').waitVisible();
await this.selectOption(role);
}

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { $, $$, by } from 'protractor';
import { DocumentListPage } from '../pages/document-list.page';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions';
@@ -27,22 +27,22 @@ import { UploadButtonPage } from '../pages/upload-button.page';
import { FileModel } from '../../core/models/file.model';
export class ContentNodeSelectorDialogPage {
dialog = element(by.css(`adf-content-node-selector`));
header = this.dialog.element(by.css(`header[data-automation-id='content-node-selector-title']`));
searchInputElement = this.dialog.element(by.css(`input[data-automation-id='content-node-selector-search-input']`));
searchLabel = this.dialog.element(by.css('.adf-content-node-selector-content-input .mat-form-field-label'));
selectedRow = this.dialog.element(by.css(`adf-datatable-row[class*="adf-is-selected"]`));
cancelButton = element(by.css(`button[data-automation-id='content-node-selector-actions-cancel']`));
moveCopyButton = element(by.css(`button[data-automation-id='content-node-selector-actions-choose']`));
dialog = $(`adf-content-node-selector`);
header = this.dialog.$(`header[data-automation-id='content-node-selector-title']`);
searchInputElement = this.dialog.$(`input[data-automation-id='content-node-selector-search-input']`);
searchLabel = this.dialog.$('.adf-content-node-selector-content-input .mat-form-field-label');
selectedRow = this.dialog.$(`adf-datatable-row[class*="adf-is-selected"]`);
cancelButton = $(`button[data-automation-id='content-node-selector-actions-cancel']`);
moveCopyButton = $(`button[data-automation-id='content-node-selector-actions-choose']`);
contentList = new DocumentListPage(this.dialog);
dataTable = this.contentList.dataTablePage();
siteListDropdown = new DropdownPage(this.dialog.element(by.css(`mat-select[data-automation-id='site-my-files-option']`)));
siteListDropdown = new DropdownPage(this.dialog.$(`mat-select[data-automation-id='site-my-files-option']`));
breadcrumbDropdown = new BreadcrumbDropdownPage();
tabPage: TabPage = new TabPage();
uploadButtonComponent = new UploadButtonPage();
uploadFromLocalTab = element.all(by.css('*[role="tab"]')).get(1);
uploadFromLocalTab = $$('*[role="tab"]').get(1);
uploadFromLocalTabName = 'Upload from your device';
repositoryTabName = 'Repository';

View File

@@ -15,11 +15,11 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { $ } from 'protractor';
import { BrowserActions } from '../../core/utils/browser-actions';
export class DownloadDialogPage {
cancelButton = element(by.id(`cancel-button`));
cancelButton = $(`#cancel-button`);
async clickCancelButton(): Promise<void> {
await BrowserActions.click(this.cancelButton);

View File

@@ -15,18 +15,18 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { $, $$ } from 'protractor';
import { BrowserActions } from '../../../core/utils/browser-actions';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
import { DropdownPage } from '../../../core/pages/material/dropdown.page';
export class BreadcrumbDropdownPage {
breadCrumb = 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']`));
currentFolder = this.breadCrumb.element(by.css(`div span[data-automation-id="current-folder"]`));
breadCrumb = $(`adf-dropdown-breadcrumb[data-automation-id='content-node-selector-content-breadcrumb']`);
parentFolder = this.breadCrumb.$(`button[data-automation-id='dropdown-breadcrumb-trigger']`);
currentFolder = this.breadCrumb.$(`div span[data-automation-id="current-folder"]`);
breadCrumbDropdown = new DropdownPage(element.all(by.css(`div[class*='mat-select-panel']`)).first());
breadCrumbDropdown = new DropdownPage($$(`div[class*='mat-select-panel']`).first());
async choosePath(pathName: string): Promise<void> {
await this.breadCrumbDropdown.selectOption(pathName);

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Locator, by, element, ElementFinder, browser } from 'protractor';
import { by, ElementFinder, browser, $$ } from 'protractor';
import { DataTableComponentPage } from '../../core/pages/data-table-component.page';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions';
@@ -24,14 +24,14 @@ import { Logger } from '../../core/utils/logger';
export class DocumentListPage {
rootElement: ElementFinder;
optionButton: Locator = by.css('button[data-automation-id*="action_menu_"]');
optionButton = 'button[data-automation-id*="action_menu_"]';
tableBody: ElementFinder;
dataTable: DataTableComponentPage;
constructor(rootElement = element.all(by.css('adf-document-list')).first()) {
constructor(rootElement = $$('adf-document-list').first()) {
this.rootElement = rootElement;
this.dataTable = new DataTableComponentPage(this.rootElement);
this.tableBody = rootElement.all(by.css('.adf-datatable-body')).first();
this.tableBody = rootElement.$$('.adf-datatable-body').first();
}
async checkLockedIcon(content: string): Promise<void> {
@@ -70,7 +70,7 @@ export class DocumentListPage {
Logger.log(`Click action menu ${content}`);
await BrowserActions.closeMenuAndDialogs();
const row = this.dataTable.getRow('Display name', content);
await BrowserActions.click(row.element(this.optionButton));
await BrowserActions.click(row.$(this.optionButton));
await BrowserActions.waitUntilActionMenuIsVisible();
await browser.sleep(500);
}
@@ -96,7 +96,7 @@ export class DocumentListPage {
}
async getLibraryRole(name: string): Promise<string> {
return this.dataTable.getRow('Display name', name).element(by.css('adf-library-role-column')).getText();
return this.dataTable.getRow('Display name', name).$('adf-library-role-column').getText();
}
}

View File

@@ -15,15 +15,15 @@
* limitations under the License.
*/
import { browser, by, element } from 'protractor';
import { $, browser } from 'protractor';
import { BrowserActions } from '../../core/utils/browser-actions';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
export class LikePage {
likeCounter = element(by.css(`div[id="adf-like-counter"]`));
likeButton = element(by.css(`.adf-like-grey`));
unlikeButton = element(by.css(`.adf-like-select`));
likeCounter = $(`div[id="adf-like-counter"]`);
likeButton = $(`.adf-like-grey`);
unlikeButton = $(`.adf-like-select`);
async checkLikeCounter(counter: number): Promise<void> {
await BrowserVisibility.waitUntilElementHasText(this.likeCounter, counter);

View File

@@ -15,49 +15,52 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { $ } from 'protractor';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions';
export class RatePage {
private ratingsCounter = $(`div[id="adf-rating-counter"]`);
private coloredStar = async (rateValue: number) => $(`span[id="adf-rate-${rateValue}"] mat-icon`);
private greyStar = async (rateValue: number) => $(`mat-icon[id="adf-grey-star-${rateValue}"]`);
async rateComponent(rateValue: number) {
const unratedStar = element(by.css(`span[id="adf-rate-${rateValue}"]`));
const unratedStar = await this.coloredStar(rateValue);
await BrowserActions.click(unratedStar);
}
async removeRating(rateValue: number): Promise<void> {
const ratedStar = element(by.css(`mat-icon[id="adf-colored-star-${rateValue}"]`));
const ratedStar = await this.coloredStar(rateValue);
await BrowserActions.click(ratedStar);
}
async checkRatingCounter(rating: number): Promise<void> {
const ratingsCounter = element(by.css(`div[id="adf-rating-counter"]`));
await BrowserVisibility.waitUntilElementHasText(ratingsCounter, rating);
await BrowserVisibility.waitUntilElementHasText(this.ratingsCounter, rating);
}
async isStarRated(rateValue: number): Promise<void> {
const ratedStar = element(by.css(`mat-icon[id="adf-colored-star-${rateValue}"]`));
const ratedStar = await this.coloredStar(rateValue);
await BrowserVisibility.waitUntilElementIsVisible(ratedStar);
}
async isNotStarRated(rateValue: number): Promise<void> {
const unratedStar = element(by.css(`mat-icon[id="adf-grey-star-${rateValue}"]`));
const unratedStar = await this.greyStar(rateValue);
await BrowserVisibility.waitUntilElementIsVisible(unratedStar);
}
async getRatedStarColor(rateValue: number): Promise<string> {
const ratedStar = element(by.css(`mat-icon[id="adf-colored-star-${rateValue}"]`));
const ratedStar = await this.coloredStar(rateValue);
return BrowserActions.getColor(ratedStar);
}
async getUnratedStarColor(rateValue: number): Promise<string> {
const unratedStar = element(by.css(`mat-icon[id="adf-grey-star-${rateValue}"]`));
const unratedStar = await this.greyStar(rateValue);
return BrowserActions.getColor(unratedStar);
}
async getAverageStarColor(rateValue: number): Promise<string> {
const coloredStar = element(by.css(`mat-icon[id="adf-colored-star-${rateValue}"]`));
const coloredStar = await this.coloredStar(rateValue);
return BrowserActions.getColor(coloredStar);
}

View File

@@ -15,21 +15,21 @@
* limitations under the License.
*/
import { by, protractor, ElementFinder, Locator, element } from 'protractor';
import { protractor, ElementFinder, $ } from 'protractor';
import { DatePickerCalendarPage } from '../../../core/pages/material/date-picker-calendar.page';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
import { BrowserActions } from '../../../core/utils/browser-actions';
export class DateRangeFilterPage {
fromField: Locator = by.css('input[data-automation-id="date-range-from-input"]');
fromDateToggle: Locator = by.css('mat-datepicker-toggle[data-automation-id="date-range-from-date-toggle"]');
toField: Locator = by.css('input[data-automation-id="date-range-to-input"]');
toDateToggle: Locator = by.css('mat-datepicker-toggle[data-automation-id="date-range-to-date-toggle"]');
applyButton: Locator = by.css('button[data-automation-id="date-range-apply-btn"]');
clearButton: Locator = by.css('button[data-automation-id="date-range-clear-btn"]');
fromErrorMessage: Locator = by.css('mat-error[data-automation-id="date-range-from-error"]');
toErrorMessage: Locator = by.css('mat-error[data-automation-id="date-range-to-error"]');
fromField = 'input[data-automation-id="date-range-from-input"]';
fromDateToggle = 'mat-datepicker-toggle[data-automation-id="date-range-from-date-toggle"]';
toField = 'input[data-automation-id="date-range-to-input"]';
toDateToggle = 'mat-datepicker-toggle[data-automation-id="date-range-to-date-toggle"]';
applyButton = 'button[data-automation-id="date-range-apply-btn"]';
clearButton = 'button[data-automation-id="date-range-clear-btn"]';
fromErrorMessage = 'mat-error[data-automation-id="date-range-from-error"]';
toErrorMessage = 'mat-error[data-automation-id="date-range-to-error"]';
filter: ElementFinder;
constructor(filter: ElementFinder) {
@@ -37,13 +37,13 @@ export class DateRangeFilterPage {
}
async getFromDate(): Promise<string> {
return BrowserActions.getInputValue(this.filter.element(this.fromField));
return BrowserActions.getInputValue(this.filter.$(this.fromField));
}
async putFromDate(date): Promise<void> {
await this.checkFromFieldIsDisplayed();
await BrowserActions.clearSendKeys(this.filter.element(this.fromField), date);
await this.filter.element(this.fromField).sendKeys(protractor.Key.ENTER);
await BrowserActions.clearSendKeys(this.filter.$(this.fromField), date);
await this.filter.$(this.fromField).sendKeys(protractor.Key.ENTER);
}
async getFromCalendarSelectedDate(): Promise<string> {
@@ -54,7 +54,7 @@ export class DateRangeFilterPage {
}
async openFromDatePicker(): Promise<DatePickerCalendarPage> {
await BrowserActions.click(this.filter.element(this.fromDateToggle));
await BrowserActions.click(this.filter.$(this.fromDateToggle));
const datePicker = new DatePickerCalendarPage();
await datePicker.checkDatePickerIsDisplayed();
@@ -62,82 +62,82 @@ export class DateRangeFilterPage {
}
async openToDatePicker(): Promise<DatePickerCalendarPage> {
await BrowserActions.click(this.filter.element(this.toDateToggle));
await BrowserActions.click(this.filter.$(this.toDateToggle));
const datePicker = new DatePickerCalendarPage();
await datePicker.checkDatePickerIsDisplayed();
return datePicker;
}
async clickFromField(): Promise<void> {
await BrowserActions.click(this.filter.element(this.fromField));
await BrowserActions.click(this.filter.$(this.fromField));
}
async checkFromErrorMessageIsDisplayed(msg: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromErrorMessage));
const text = await BrowserActions.getText(this.filter.element(this.fromErrorMessage));
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.fromErrorMessage));
const text = await BrowserActions.getText(this.filter.$(this.fromErrorMessage));
await expect(text).toEqual(msg);
}
async checkFromErrorMessageIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.fromErrorMessage));
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.fromErrorMessage));
}
async checkFromFieldIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromField));
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.fromField));
}
async checkFromDateToggleIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromDateToggle));
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.fromDateToggle));
}
async getToDate(): Promise<string> {
return BrowserActions.getInputValue(this.filter.element(this.toField));
return BrowserActions.getInputValue(this.filter.$(this.toField));
}
async putToDate(date): Promise<void> {
await this.checkToFieldIsDisplayed();
await BrowserActions.clearSendKeys(element(this.toField), date);
await this.filter.element(this.toField).sendKeys(protractor.Key.ENTER);
await BrowserActions.clearSendKeys($(this.toField), date);
await this.filter.$(this.toField).sendKeys(protractor.Key.ENTER);
}
async clickToField(): Promise<void> {
await BrowserActions.click(this.filter.element(this.toField));
await BrowserActions.click(this.filter.$(this.toField));
}
async checkToErrorMessageIsDisplayed(msg): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toErrorMessage));
const text = await BrowserActions.getText(this.filter.element(this.toErrorMessage));
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.toErrorMessage));
const text = await BrowserActions.getText(this.filter.$(this.toErrorMessage));
await expect(text).toEqual(msg);
}
async checkToFieldIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toField));
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.toField));
}
async checkToDateToggleIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toDateToggle));
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.toDateToggle));
}
async clickApplyButton(): Promise<void> {
await BrowserActions.click(this.filter.element(this.applyButton));
await BrowserActions.click(this.filter.$(this.applyButton));
}
async checkApplyButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.applyButton));
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.applyButton));
}
async checkApplyButtonIsEnabled(): Promise<void> {
const isEnabled = await this.filter.element(this.applyButton).isEnabled();
const isEnabled = await this.filter.$(this.applyButton).isEnabled();
await expect(isEnabled).toBe(true);
}
async checkApplyButtonIsDisabled(): Promise<void> {
const isEnabled = await this.filter.element(this.applyButton).isEnabled();
const isEnabled = await this.filter.$(this.applyButton).isEnabled();
await expect(isEnabled).toBe(false);
}
async checkClearButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.clearButton));
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.clearButton));
}
}

View File

@@ -14,20 +14,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { by, ElementFinder, Locator, protractor } from 'protractor';
import { ElementFinder, protractor } from 'protractor';
import { BrowserActions } from '../../../core/utils/browser-actions';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
export class NumberRangeFilterPage {
fromInput: Locator = by.css('input[data-automation-id="number-range-from-input"]');
toInput: Locator = by.css('input[data-automation-id="number-range-to-input"]');
applyButton: Locator = by.css('button[data-automation-id="number-range-btn-apply"]');
clearButton: Locator = by.css('button[data-automation-id="number-range-btn-clear"]');
fromErrorInvalid: Locator = by.css('mat-error[data-automation-id="number-range-from-error-invalid"]');
fromErrorRequired: Locator = by.css('mat-error[data-automation-id="number-range-from-error-required"]');
toErrorInvalid: Locator = by.css('mat-error[data-automation-id="number-range-to-error-invalid"]');
toErrorRequired: Locator = by.css('mat-error[data-automation-id="number-range-to-error-required"]');
fromInput = 'input[data-automation-id="number-range-from-input"]';
toInput = 'input[data-automation-id="number-range-to-input"]';
applyButton = 'button[data-automation-id="number-range-btn-apply"]';
clearButton = 'button[data-automation-id="number-range-btn-clear"]';
fromErrorInvalid = 'mat-error[data-automation-id="number-range-from-error-invalid"]';
fromErrorRequired = 'mat-error[data-automation-id="number-range-from-error-required"]';
toErrorInvalid = 'mat-error[data-automation-id="number-range-to-error-invalid"]';
toErrorRequired = 'mat-error[data-automation-id="number-range-to-error-required"]';
filter: ElementFinder;
constructor(filter: ElementFinder) {
@@ -35,99 +35,99 @@ export class NumberRangeFilterPage {
}
async clearFromField(): Promise<void> {
await BrowserVisibility.waitUntilElementIsClickable(this.filter.element(this.fromInput));
await BrowserActions.clearWithBackSpace(this.filter.element(this.fromInput));
await BrowserVisibility.waitUntilElementIsClickable(this.filter.$(this.fromInput));
await BrowserActions.clearWithBackSpace(this.filter.$(this.fromInput));
}
async getFromNumber(): Promise<string> {
return BrowserActions.getInputValue(this.filter.element(this.fromInput));
return BrowserActions.getInputValue(this.filter.$(this.fromInput));
}
async putFromNumber(value): Promise<void> {
await this.checkFromFieldIsDisplayed();
await BrowserActions.clearSendKeys(this.filter.element(this.fromInput), value);
await this.filter.element(this.fromInput).sendKeys(protractor.Key.ENTER);
await BrowserActions.clearSendKeys(this.filter.$(this.fromInput), value);
await this.filter.$(this.fromInput).sendKeys(protractor.Key.ENTER);
}
async getFromErrorRequired(): Promise<string> {
return BrowserActions.getText(this.filter.element(this.fromErrorRequired));
return BrowserActions.getText(this.filter.$(this.fromErrorRequired));
}
async checkFromErrorRequiredIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromErrorRequired));
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.fromErrorRequired));
}
async getFromErrorInvalid(): Promise<string> {
return BrowserActions.getText(this.filter.element(this.fromErrorInvalid));
return BrowserActions.getText(this.filter.$(this.fromErrorInvalid));
}
async checkFromErrorInvalidIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromErrorInvalid));
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.fromErrorInvalid));
}
async checkFromFieldIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.fromInput));
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.fromInput));
}
async clearToField(): Promise<void> {
await BrowserVisibility.waitUntilElementIsClickable(this.filter.element(this.toInput));
await BrowserActions.clearWithBackSpace(this.filter.element(this.toInput));
await BrowserVisibility.waitUntilElementIsClickable(this.filter.$(this.toInput));
await BrowserActions.clearWithBackSpace(this.filter.$(this.toInput));
}
async getToNumber(): Promise<string> {
return BrowserActions.getInputValue(this.filter.element(this.toInput));
return BrowserActions.getInputValue(this.filter.$(this.toInput));
}
async putToNumber(value): Promise<void> {
await this.checkToFieldIsDisplayed();
await BrowserActions.clearSendKeys(this.filter.element(this.toInput), value);
await this.filter.element(this.toInput).sendKeys(protractor.Key.ENTER);
await BrowserActions.clearSendKeys(this.filter.$(this.toInput), value);
await this.filter.$(this.toInput).sendKeys(protractor.Key.ENTER);
}
async getToErrorRequired(): Promise<string> {
return BrowserActions.getText(this.filter.element(this.toErrorRequired));
return BrowserActions.getText(this.filter.$(this.toErrorRequired));
}
async checkToErrorRequiredIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toErrorRequired));
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.toErrorRequired));
}
async getToErrorInvalid(): Promise<string> {
return BrowserActions.getText(this.filter.element(this.toErrorInvalid));
return BrowserActions.getText(this.filter.$(this.toErrorInvalid));
}
async checkToErrorInvalidIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toErrorInvalid));
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.toErrorInvalid));
}
async checkToFieldIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.toInput));
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.toInput));
}
async clickApplyButton(): Promise<void> {
await BrowserActions.click(this.filter.element(this.applyButton));
await BrowserActions.click(this.filter.$(this.applyButton));
}
async checkApplyButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.applyButton));
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.applyButton));
}
async checkApplyButtonIsEnabled(): Promise<boolean> {
return this.filter.element(this.applyButton).isEnabled();
return this.filter.$(this.applyButton).isEnabled();
}
async clickClearButton(): Promise<void> {
await BrowserActions.click(this.filter.element(this.clearButton));
await BrowserActions.click(this.filter.$(this.clearButton));
}
async checkClearButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.clearButton));
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.clearButton));
}
async checkNoErrorMessageIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.fromErrorInvalid));
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.fromErrorRequired));
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.toErrorInvalid));
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.toErrorRequired));
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.fromErrorInvalid));
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.fromErrorRequired));
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.toErrorInvalid));
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.toErrorRequired));
}
}

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { by, ElementFinder } from 'protractor';
import { ElementFinder } from 'protractor';
import { SearchTextPage } from './search-text.page';
import { SearchCheckListPage } from './search-check-list.page';
import { SearchRadioPage } from './search-radio.page';
@@ -56,11 +56,11 @@ export class SearchCategoriesPage {
}
async clickFilter(filter: ElementFinder): Promise<void> {
await BrowserActions.click(filter.element(by.css('mat-expansion-panel-header')));
await BrowserActions.click(filter.$('mat-expansion-panel-header'));
}
async clickFilterHeader(filter: ElementFinder): Promise<void> {
const fileSizeFilterHeader = filter.element(by.css('mat-expansion-panel-header'));
const fileSizeFilterHeader = filter.$('mat-expansion-panel-header');
await BrowserActions.click(fileSizeFilterHeader);
}

View File

@@ -15,17 +15,17 @@
* limitations under the License.
*/
import { Locator, element, by, ElementFinder, browser } from 'protractor';
import { element, by, ElementFinder, browser } from 'protractor';
import { BrowserActions } from '../../../core/utils/browser-actions';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
export class SearchCheckListPage {
filter: ElementFinder;
inputBy: Locator = by.css('div[class*="mat-expansion-panel-content"] input');
showMoreBy: Locator = by.css('button[title="Show more"]');
showLessBy: Locator = by.css('button[title="Show less"]');
clearAllButton: Locator = by.css('button');
inputBy = 'div[class*="mat-expansion-panel-content"] input';
showMoreBy = 'button[title="Show more"]';
showLessBy = 'button[title="Show less"]';
clearAllButton = 'button';
constructor(filter: ElementFinder) {
this.filter = filter;
@@ -33,20 +33,20 @@ export class SearchCheckListPage {
async clickCheckListOption(option: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const result = this.filter.all(by.css(`mat-checkbox[data-automation-id*='${option}'] .mat-checkbox-inner-container`)).first();
const result = this.filter.$$(`mat-checkbox[data-automation-id*='${option}'] .mat-checkbox-inner-container`).first();
await BrowserActions.click(result);
}
async checkChipIsDisplayed(option: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('mat-chip', option)).element(by.css('mat-icon')));
await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText('mat-chip', option)).$('mat-icon'));
}
async checkChipIsNotDisplayed(option: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(element(by.cssContainingText('mat-chip', option)).element(by.css('mat-icon')));
await BrowserVisibility.waitUntilElementIsNotVisible(element(by.cssContainingText('mat-chip', option)).$('mat-icon'));
}
async removeFilterOption(option: string): Promise<void> {
const cancelChipButton = element(by.cssContainingText('mat-chip', option)).element(by.css('mat-icon'));
const cancelChipButton = element(by.cssContainingText('mat-chip', option)).$('mat-icon');
await BrowserActions.click(cancelChipButton);
}
@@ -59,50 +59,50 @@ export class SearchCheckListPage {
}
async checkSearchFilterInputIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.all(this.inputBy).first());
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$$(this.inputBy).first());
}
async searchInFilter(option: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsClickable(this.filter);
const inputElement = this.filter.all(this.inputBy).first();
const inputElement = this.filter.$$(this.inputBy).first();
await BrowserVisibility.waitUntilElementIsClickable(inputElement);
await BrowserActions.clearSendKeys(inputElement, option);
}
async checkShowLessButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.showLessBy));
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.showLessBy));
}
async checkShowLessButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.showLessBy));
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.showLessBy));
}
async checkShowMoreButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.showMoreBy));
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.showMoreBy));
}
async checkShowMoreButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.showMoreBy));
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.showMoreBy));
}
async clickShowMoreButtonUntilIsNotDisplayed(): Promise<void> {
const visible = await browser.isElementPresent(this.filter.element(this.showMoreBy));
const visible = await browser.isElementPresent(this.filter.$(this.showMoreBy));
if (visible) {
await BrowserActions.click(this.filter.element(this.showMoreBy));
await BrowserActions.click(this.filter.$(this.showMoreBy));
await this.clickShowMoreButtonUntilIsNotDisplayed();
}
}
async clickShowLessButtonUntilIsNotDisplayed(): Promise<void> {
const visible = await browser.isElementPresent(this.filter.element(this.showLessBy));
const visible = await browser.isElementPresent(this.filter.$(this.showLessBy));
if (visible) {
await BrowserActions.click(this.filter.element(this.showLessBy));
await BrowserActions.click(this.filter.$(this.showLessBy));
await this.clickShowLessButtonUntilIsNotDisplayed();
}
}
async getBucketNumberOfFilterType(option: string): Promise<any> {
const fileTypeFilter = this.filter.all(by.css('mat-checkbox[data-automation-id*=".' + option + '"] span')).first();
const fileTypeFilter = this.filter.$$('mat-checkbox[data-automation-id*=".' + option + '"] span').first();
await BrowserVisibility.waitUntilElementIsVisible(fileTypeFilter);
const valueOfBucket = await BrowserActions.getText(fileTypeFilter);
const numberOfBucket = valueOfBucket.split('(')[1];
@@ -112,47 +112,47 @@ export class SearchCheckListPage {
async checkCheckListOptionIsDisplayed(option: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const result = this.filter.element(by.css(`mat-checkbox[data-automation-id*='-${option}']`));
const result = this.filter.$(`mat-checkbox[data-automation-id*='-${option}']`);
await BrowserVisibility.waitUntilElementIsVisible(result);
}
async checkCheckListOptionIsNotSelected(option: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const result = this.filter.element(by.css(`mat-checkbox[data-automation-id*='-${option}'][class*='checked']`));
const result = this.filter.$(`mat-checkbox[data-automation-id*='-${option}'][class*='checked']`);
await BrowserVisibility.waitUntilElementIsNotVisible(result);
}
async checkCheckListOptionIsSelected(option: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const result = this.filter.element(by.css(`mat-checkbox[data-automation-id*='-${option}'][class*='checked']`));
const result = this.filter.$(`mat-checkbox[data-automation-id*='-${option}'][class*='checked']`);
await BrowserVisibility.waitUntilElementIsVisible(result);
}
async checkClearAllButtonIsDisplayed() {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const result = this.filter.element(this.clearAllButton);
const result = this.filter.$(this.clearAllButton);
await BrowserVisibility.waitUntilElementIsVisible(result);
}
async clickClearAllButton(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const result = this.filter.element(this.clearAllButton);
const result = this.filter.$(this.clearAllButton);
await BrowserActions.click(result);
}
async getCheckListOptionsNumberOnPage(): Promise<number> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
const checkListOptions = this.filter.all(by.css('.checklist mat-checkbox'));
const checkListOptions = this.filter.$$('.checklist mat-checkbox');
return checkListOptions.count();
}
async clickShowMoreButton(): Promise<void> {
await BrowserActions.click(this.filter.element(this.showMoreBy));
await BrowserActions.click(this.filter.$(this.showMoreBy));
}
async clickShowLessButton(): Promise<void> {
await BrowserActions.click(this.filter.element(this.showLessBy));
await BrowserActions.click(this.filter.$(this.showLessBy));
}
}

View File

@@ -15,27 +15,27 @@
* limitations under the License.
*/
import { element, by, browser, ElementFinder } from 'protractor';
import { browser, ElementFinder, $, $$ } from 'protractor';
import { BrowserActions } from '../../../core/utils/browser-actions';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
export class SearchRadioPage {
filter: ElementFinder;
showMoreButton = element(by.css('adf-search-radio button[title="Show more"]'));
showLessButton = element(by.css('adf-search-radio button[title="Show less"]'));
showMoreButton = $('adf-search-radio button[title="Show more"]');
showLessButton = $('adf-search-radio button[title="Show less"]');
constructor(filter: ElementFinder) {
this.filter = filter;
}
async checkFilterRadioButtonIsDisplayed(filterName: string): Promise<void> {
const filterType = element(by.css('mat-radio-button[data-automation-id="search-radio-' + filterName + '"]'));
const filterType = $(`mat-radio-button[data-automation-id="search-radio-${filterName}"]`);
await BrowserVisibility.waitUntilElementIsVisible(filterType);
}
async checkFilterRadioButtonIsChecked(filterName: string): Promise<void> {
const selectedFilterType = element(by.css('mat-radio-button[data-automation-id="search-radio-' + filterName + '"][class*="checked"]'));
const selectedFilterType = $(`mat-radio-button[data-automation-id="search-radio-${filterName}"][class*="checked"]`);
await BrowserVisibility.waitUntilElementIsVisible(selectedFilterType);
}
@@ -44,7 +44,7 @@ export class SearchRadioPage {
}
async getRadioButtonsNumberOnPage(): Promise<number> {
const radioButtons = element.all(by.css('mat-radio-button'));
const radioButtons = $$('mat-radio-button');
return radioButtons.count();
}

View File

@@ -15,64 +15,64 @@
* limitations under the License.
*/
import { Locator, browser, by, ElementFinder } from 'protractor';
import { browser, ElementFinder } from 'protractor';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
import { BrowserActions } from '../../../core/utils/browser-actions';
export class SearchSliderPage {
filter: ElementFinder;
slider: Locator = by.css('mat-slider[data-automation-id="slider-range"]');
clearButton: Locator = by.css('button[data-automation-id="slider-btn-clear"]');
sliderWithThumbLabel: Locator = by.css('mat-slider[data-automation-id="slider-range"][class*="mat-slider-thumb-label-showing"]');
slider = 'mat-slider[data-automation-id="slider-range"]';
clearButton = 'button[data-automation-id="slider-btn-clear"]';
sliderWithThumbLabel = 'mat-slider[data-automation-id="slider-range"][class*="mat-slider-thumb-label-showing"]';
constructor(filter: ElementFinder) {
this.filter = filter;
}
async getMaxValue() {
return BrowserActions.getAttribute(this.filter.element(this.slider), 'aria-valuemax');
return BrowserActions.getAttribute(this.filter.$(this.slider), 'aria-valuemax');
}
async getMinValue() {
return BrowserActions.getAttribute(this.filter.element(this.slider), 'aria-valuemin');
return BrowserActions.getAttribute(this.filter.$(this.slider), 'aria-valuemin');
}
async getValue() {
return BrowserActions.getAttribute(this.filter.element(this.slider), 'aria-valuenow');
return BrowserActions.getAttribute(this.filter.$(this.slider), 'aria-valuenow');
}
async setValue(value: number): Promise<void> {
const elem = this.filter.element(this.slider).element(by.css('.mat-slider-wrapper'));
const elem = this.filter.$(this.slider).$('.mat-slider-wrapper');
await browser.actions().mouseMove(elem, { x: 0, y: 0 }).perform();
await browser.actions().mouseDown().mouseMove({x: value * 10, y: 0}).mouseUp().perform();
}
async checkSliderIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.slider));
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.slider));
}
async checkSliderIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.slider));
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.slider));
}
async checkSliderWithThumbLabelIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.sliderWithThumbLabel));
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.sliderWithThumbLabel));
}
async clickClearButton(): Promise<void> {
await BrowserActions.click(this.filter.element(this.clearButton));
await BrowserActions.click(this.filter.$(this.clearButton));
}
async checkClearButtonIsEnabled() {
return this.filter.element(this.clearButton).isEnabled();
return this.filter.$(this.clearButton).isEnabled();
}
async checkClearButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter.element(this.clearButton));
await BrowserVisibility.waitUntilElementIsVisible(this.filter.$(this.clearButton));
}
async checkClearButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.element(this.clearButton));
await BrowserVisibility.waitUntilElementIsNotVisible(this.filter.$(this.clearButton));
}
}

View File

@@ -15,15 +15,15 @@
* limitations under the License.
*/
import { browser, by, element } from 'protractor';
import { $, browser, by, element } from 'protractor';
import { BrowserActions } from '../../../core/utils/browser-actions';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
import { DropdownPage } from '../../../core/pages/material/dropdown.page';
export class SearchSortingPickerPage {
sortingDropdown = new DropdownPage(element(by.css('.adf-sorting-picker .mat-select-arrow')));
orderArrow = element(by.css('adf-sorting-picker button mat-icon'));
sortingDropdown = new DropdownPage($('.adf-sorting-picker .mat-select-arrow'));
orderArrow = $('adf-sorting-picker button mat-icon');
async sortBy(sortOrder: string, sortType: string | RegExp): Promise<void> {
await this.sortingDropdown.clickDropdown();

View File

@@ -15,14 +15,14 @@
* limitations under the License.
*/
import { protractor, by, ElementFinder, Locator } from 'protractor';
import { protractor, ElementFinder } from 'protractor';
import { BrowserVisibility } from '../../../core/utils/browser-visibility';
import { BrowserActions } from '../../../core/utils/browser-actions';
export class SearchTextPage {
filter: ElementFinder;
inputBy: Locator = by.css('input');
inputBy = 'input';
constructor(filter: ElementFinder) {
this.filter = filter;
@@ -30,7 +30,7 @@ export class SearchTextPage {
async searchByName(name: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.filter);
await BrowserActions.clearSendKeys(this.filter.element(this.inputBy), name);
await this.filter.element(this.inputBy).sendKeys(protractor.Key.ENTER);
await BrowserActions.clearSendKeys(this.filter.$(this.inputBy), name);
await this.filter.$(this.inputBy).sendKeys(protractor.Key.ENTER);
}
}

View File

@@ -15,13 +15,13 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { $ } from 'protractor';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { FileModel } from '../../core/models/file.model';
export class UploadButtonPage {
uploadButton = element(by.css('adf-upload-button input'));
uploadButton = $('adf-upload-button input');
async attachFiles(files: FileModel[]): Promise<void> {
await BrowserVisibility.waitUntilElementIsPresent(this.uploadButton);
@@ -31,11 +31,13 @@ export class UploadButtonPage {
}
async isButtonNotDisplayed(): Promise<boolean> {
let result = false;
try {
await BrowserVisibility.waitUntilElementIsNotVisible(this.uploadButton);
return true;
} catch (e) {
return false;
}
result = true;
} catch (e) { /* do nothing */ }
return result;
}
}

View File

@@ -15,15 +15,15 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { $, by, element } from 'protractor';
import { BrowserActions } from '../../core/utils/browser-actions';
import { BrowserVisibility } from '../../core/utils/browser-visibility';
export class EditJsonDialog {
dialog = element(by.css(`.adf-edit-json-dialog`));
dialog = $(`.adf-edit-json-dialog`);
closeButton = element(by.cssContainingText(`button span`, 'Close'));
dialogContent = this.dialog.element(by.css(`mat-dialog-content textarea`));
dialogContent = this.dialog.$(`mat-dialog-content textarea`);
async checkDialogIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.dialog);

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { $ } from 'protractor';
import { BrowserVisibility } from '../utils/browser-visibility';
import { DataTableComponentPage } from './data-table-component.page';
@@ -47,21 +47,21 @@ export class AboutPage {
version: 'version'
};
appTitle = element(by.css('[data-automation-id="adf-github-app-title"]'));
sourceCodeTitle = element(by.css('[data-automation-id="adf-github-source-code-title"]'));
githubUrl = element(by.css('[data-automation-id="adf-github-url"]'));
githubVersion = element(by.css('[data-automation-id="adf-github-version"]'));
bpmHost = element(by.css('[data-automation-id="adf-process-service-host"]'));
ecmHost = element(by.css('[data-automation-id="adf-content-service-host"]'));
productVersionTitle = element(by.css('[data-automation-id="adf-about-product-version-title"]'));
bpmEdition = element(by.css('[data-automation-id="adf-about-bpm-edition"]'));
ecmEdition = element(by.css('[data-automation-id="adf-about-ecm-edition"]'));
bpmVersion = element(by.css('[data-automation-id="adf-about-bpm-version"]'));
ecmVersion = element(by.css('[data-automation-id="adf-about-ecm-version"]'));
ecmStatusTitle = element(by.css('[data-automation-id="adf-about-ecm-status-title"]'));
ecmLicenseTitle = element(by.css('[data-automation-id="adf-about-ecm-license-title"]'));
ecmModulesTitle = element(by.css('[data-automation-id="adf-about-ecm-modules-title"]'));
aboutModulesTitle = element(by.css('[data-automation-id="adf-about-modules-title"]'));
appTitle = $('[data-automation-id="adf-github-app-title"]');
sourceCodeTitle = $('[data-automation-id="adf-github-source-code-title"]');
githubUrl = $('[data-automation-id="adf-github-url"]');
githubVersion = $('[data-automation-id="adf-github-version"]');
bpmHost = $('[data-automation-id="adf-process-service-host"]');
ecmHost = $('[data-automation-id="adf-content-service-host"]');
productVersionTitle = $('[data-automation-id="adf-about-product-version-title"]');
bpmEdition = $('[data-automation-id="adf-about-bpm-edition"]');
ecmEdition = $('[data-automation-id="adf-about-ecm-edition"]');
bpmVersion = $('[data-automation-id="adf-about-bpm-version"]');
ecmVersion = $('[data-automation-id="adf-about-ecm-version"]');
ecmStatusTitle = $('[data-automation-id="adf-about-ecm-status-title"]');
ecmLicenseTitle = $('[data-automation-id="adf-about-ecm-license-title"]');
ecmModulesTitle = $('[data-automation-id="adf-about-ecm-modules-title"]');
aboutModulesTitle = $('[data-automation-id="adf-about-modules-title"]');
dataTable = new DataTableComponentPage();
@@ -158,7 +158,7 @@ export class AboutPage {
}
async checkColumnIsDisplayed(column: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.css(`div[data-automation-id="auto_id_${column}"]`)));
await BrowserVisibility.waitUntilElementIsVisible($(`div[data-automation-id="auto_id_${column}"]`));
}
}

View File

@@ -15,16 +15,16 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { $ } from 'protractor';
import { BrowserActions } from '../utils/browser-actions';
export class BreadcrumbPage {
breadcrumb = element(by.css(`adf-breadcrumb nav[data-automation-id='breadcrumb']`));
currentItem = element(by.css('.adf-breadcrumb-item-current'));
breadcrumb = $(`adf-breadcrumb nav[data-automation-id='breadcrumb']`);
currentItem = $('.adf-breadcrumb-item-current');
async chooseBreadCrumb(breadCrumbItem: string): Promise<void> {
const path = this.breadcrumb.element(by.css(`a[data-automation-id='breadcrumb_${breadCrumbItem}']`));
const path = this.breadcrumb.$(`a[data-automation-id='breadcrumb_${breadCrumbItem}']`);
await BrowserActions.click(path);
}

View File

@@ -15,25 +15,25 @@
* limitations under the License.
*/
import { element, by, ElementFinder, Locator } from 'protractor';
import { element, by, ElementFinder } from 'protractor';
import { BrowserActions, BrowserVisibility } from '../../utils/public-api';
export class CardBooleanItemPage {
rootElement: ElementFinder;
labelLocator: Locator = by.css('div[data-automation-id*="card-boolean-label"]');
checkbox: Locator = by.css('mat-checkbox[data-automation-id*="card-boolean"]');
labelLocator = 'div[data-automation-id*="card-boolean-label"]';
checkbox = 'mat-checkbox[data-automation-id*="card-boolean"]';
constructor(label: string = 'required') {
this.rootElement = element(by.xpath(`//div[contains(@data-automation-id, "label-${label}")]/ancestor::adf-card-view-boolitem`));
}
async checkboxClick(): Promise<void> {
await BrowserActions.click(this.rootElement.element(this.checkbox));
await BrowserActions.click(this.rootElement.$(this.checkbox));
}
async checkLabelIsPresent(): Promise<void> {
const labelElement = this.rootElement.element(this.labelLocator);
const labelElement = this.rootElement.$(this.labelLocator);
await BrowserVisibility.waitUntilElementIsPresent(labelElement);
}
}

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Locator, element, by, ElementFinder } from 'protractor';
import { element, by, ElementFinder, $$ } from 'protractor';
import { DateTimePickerPage } from '../material/date-time-picker.page';
import { DatePickerPage } from '../material/date-picker.page';
import { BrowserVisibility } from '../../utils/browser-visibility';
@@ -26,10 +26,10 @@ export class CardDateItemPage {
dateTimePickerPage: DateTimePickerPage;
datePickerPage = new DatePickerPage();
labelLocator: Locator = by.css('div[data-automation-id*="card-dateitem-label"]');
valueLocator: Locator = by.css('span[data-automation-id*="card-date"]');
dateTimePicker = element.all(by.css('.mat-datetimepicker-toggle')).first();
saveButton: Locator = by.css('button[data-automation-id*="card-dateitem-update"]');
labelLocator = 'div[data-automation-id*="card-dateitem-label"]';
valueLocator = 'span[data-automation-id*="card-date"]';
dateTimePicker = $$('.mat-datetimepicker-toggle').first();
saveButton = 'button[data-automation-id*="card-dateitem-update"]';
constructor(label: string = 'minDate') {
this.rootElement = element(by.xpath(`//div[contains(@data-automation-id, "label-${label}")]/ancestor::adf-card-view-dateitem`));
@@ -45,11 +45,11 @@ export class CardDateItemPage {
}
async getDateValue(): Promise<string> {
return this.rootElement.element(this.valueLocator).getText();
return this.rootElement.$(this.valueLocator).getText();
}
async checkLabelIsVisible(): Promise<void> {
const labelElement = this.rootElement.element(this.labelLocator);
const labelElement = this.rootElement.$(this.labelLocator);
await BrowserVisibility.waitUntilElementIsVisible(labelElement);
}
}

View File

@@ -15,24 +15,24 @@
* limitations under the License.
*/
import { element, by, ElementFinder, Locator } from 'protractor';
import { element, by, ElementFinder } from 'protractor';
import { BrowserActions, BrowserVisibility } from '../../utils/public-api';
import { DropdownPage } from '../material/dropdown.page';
export class CardSelectItemPage {
rootElement: ElementFinder;
labelLocator: Locator = by.css('div[data-automation-id*="card-select-label"]');
readOnlyField: Locator = by.css('[data-automation-class="read-only-value"]');
labelLocator = 'div[data-automation-id*="card-select-label"]';
readOnlyField = '[data-automation-class="read-only-value"]';
dropdown: DropdownPage;
constructor(label: string = 'fileSource') {
this.rootElement = element(by.xpath(`//div[contains(@data-automation-id, "label-${label}")]/ancestor::adf-card-view-selectitem`));
this.dropdown = new DropdownPage(this.rootElement.element(by.css('mat-select')));
this.dropdown = new DropdownPage(this.rootElement.$('mat-select'));
}
async checkLabelIsPresent(): Promise<void> {
const labelElement = this.rootElement.element(this.labelLocator);
const labelElement = this.rootElement.$(this.labelLocator);
await BrowserVisibility.waitUntilElementIsPresent(labelElement);
}
@@ -41,8 +41,8 @@ export class CardSelectItemPage {
}
async getReadonlyValue(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.element(this.readOnlyField));
return BrowserActions.getText(this.rootElement.element(this.readOnlyField));
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$(this.readOnlyField));
return BrowserActions.getText(this.rootElement.$(this.readOnlyField));
}
async selectDropdownOption(option: string): Promise<void> {
@@ -50,6 +50,6 @@ export class CardSelectItemPage {
}
async checkElementIsReadonly(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.element(this.readOnlyField));
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$(this.readOnlyField));
}
}

View File

@@ -15,63 +15,63 @@
* limitations under the License.
*/
import { Locator, element, by, ElementFinder, Key } from 'protractor';
import { element, by, ElementFinder, Key } from 'protractor';
import { BrowserActions, BrowserVisibility } from '../../utils/public-api';
export class CardTextItemPage {
rootElement: ElementFinder;
textField: Locator = by.css('[data-automation-id*="card-textitem-value"]');
saveButton: Locator = by.css('button[data-automation-id*="card-textitem-update"]');
clearButton: Locator = by.css('button[data-automation-id*="card-textitem-reset"]');
field: Locator = by.css('[data-automation-id*="card-textitem-value"]');
labelLocator: Locator = by.css('div[data-automation-id*="card-textitem-label"]');
errorMessage: Locator = by.css('.adf-textitem-editable-error');
clickableElement: Locator = by.css('.adf-textitem-clickable');
readOnlyField: Locator = by.css('.adf-property-read-only');
textField = '[data-automation-id*="card-textitem-value"]';
saveButton = 'button[data-automation-id*="card-textitem-update"]';
clearButton = 'button[data-automation-id*="card-textitem-reset"]';
field = '[data-automation-id*="card-textitem-value"]';
labelLocator = 'div[data-automation-id*="card-textitem-label"]';
errorMessage = '.adf-textitem-editable-error';
clickableElement = '.adf-textitem-clickable';
readOnlyField = '.adf-property-read-only';
constructor(label: string = 'assignee') {
this.rootElement = element(by.xpath(`//div[contains(@data-automation-id, "card-textitem-label-${label}")]//ancestor::adf-card-view-textitem`));
}
async getFieldValue(): Promise<string> {
const fieldElement = this.rootElement.element(this.field);
const fieldElement = this.rootElement.$(this.field);
return BrowserActions.getInputValue(fieldElement);
}
async checkLabelIsPresent(): Promise<void> {
const labelElement = this.rootElement.element(this.labelLocator);
const labelElement = this.rootElement.$(this.labelLocator);
await BrowserVisibility.waitUntilElementIsPresent(labelElement);
}
async checkLabelIsVisible(): Promise<void> {
const labelElement = this.rootElement.element(this.labelLocator);
const labelElement = this.rootElement.$(this.labelLocator);
await BrowserVisibility.waitUntilElementIsVisible(labelElement);
}
async enterTextField(text: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.element(this.textField));
await BrowserActions.clearSendKeys(this.rootElement.element(this.textField), text, 500);
await this.rootElement.element(this.textField).sendKeys(Key.TAB);
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$(this.textField));
await BrowserActions.clearSendKeys(this.rootElement.$(this.textField), text, 500);
await this.rootElement.$(this.textField).sendKeys(Key.TAB);
}
async clickOnSaveButton(): Promise<void> {
await BrowserActions.click(this.rootElement.element(this.saveButton));
await BrowserActions.click(this.rootElement.$(this.saveButton));
}
async clickOnClearButton(): Promise<void> {
await BrowserActions.click(this.rootElement.element(this.clearButton));
await BrowserActions.click(this.rootElement.$(this.clearButton));
}
async getErrorMessage(): Promise<string> {
const errorField = this.rootElement.element(this.errorMessage);
const errorField = this.rootElement.$(this.errorMessage);
return BrowserActions.getText(errorField);
}
async checkElementIsReadonly(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.element(this.readOnlyField));
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$(this.readOnlyField));
}
async clickField(): Promise<void> {
await BrowserActions.click(this.rootElement.element(by.css(`button[data-automation-id*='clickable-icon']`)));
await BrowserActions.click(this.rootElement.$(`button[data-automation-id*='clickable-icon']`));
}
}

View File

@@ -15,26 +15,26 @@
* limitations under the License.
*/
import { element, by, browser } from 'protractor';
import { browser, $ } from 'protractor';
import { BrowserVisibility } from '../utils/browser-visibility';
import { BrowserActions } from '../utils/browser-actions';
export class ConfigEditorPage {
textField = element(by.css('#adf-form-config-editor div.overflow-guard > textarea'));
textField = $('#adf-form-config-editor div.overflow-guard > textarea');
async enterConfiguration(text: string): Promise<void> {
await BrowserActions.clearSendKeys(this.textField, text);
}
async clickSaveButton(): Promise<void> {
const saveButton = element(by.id('app-form-config-save'));
const saveButton = $('#app-form-config-save');
await BrowserActions.click(saveButton);
}
async clickClearButton(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.textField);
const clearButton = element(by.id('app-form-config-clear'));
const clearButton = $('#app-form-config-clear');
await BrowserActions.click(clearButton);
}

View File

@@ -15,12 +15,12 @@
* limitations under the License.
*/
import { $ } from 'protractor';
import { BrowserActions } from '../utils/browser-actions';
import { element, by } from 'protractor';
import { BrowserVisibility } from '../utils/browser-visibility';
export class ContextMenuPage {
contextMenu = element(by.id('adf-context-menu-content'));
contextMenu = $('#adf-context-menu-content');
async isContextMenuDisplayed(): Promise<boolean> {
try {
@@ -32,6 +32,6 @@ export class ContextMenuPage {
}
async clickContextMenuActionNamed(actionName: string): Promise<void> {
await BrowserActions.click(element(by.css(`button[data-automation-id="context-${actionName}"]`)));
await BrowserActions.click($(`button[data-automation-id="context-${actionName}"]`));
}
}

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Locator, browser, by, element, protractor, ElementFinder, ElementArrayFinder } from 'protractor';
import { browser, by, element, protractor, ElementFinder, ElementArrayFinder, $, $$ } from 'protractor';
import { BrowserVisibility } from '../utils/browser-visibility';
import { BrowserActions } from '../utils/browser-actions';
import { Logger } from '../utils/logger';
@@ -26,7 +26,6 @@ export class DataTableComponentPage {
list: ElementArrayFinder;
contents: ElementArrayFinder;
tableBody: ElementFinder;
rows: Locator = by.css(`adf-datatable div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row']`);
allColumns: ElementArrayFinder;
selectedRowNumber: ElementFinder;
allSelectedRows: ElementArrayFinder;
@@ -36,21 +35,27 @@ export class DataTableComponentPage {
emptyListTitle: ElementFinder;
emptyListSubtitle: ElementFinder;
rows = `adf-datatable div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row']`;
MAX_LOADING_TIME = 120000;
constructor(rootElement = element.all(by.css('adf-datatable')).first()) {
constructor(rootElement = $$('adf-datatable').first()) {
this.rootElement = rootElement;
this.list = this.rootElement.all(by.css(`div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row']`));
this.contents = this.rootElement.all(by.css('.adf-datatable-body span'));
this.tableBody = this.rootElement.all(by.css(`.adf-datatable-body`)).first();
this.allColumns = this.rootElement.all(by.css('div[data-automation-id*="auto_id_entry."]'));
this.selectedRowNumber = this.rootElement.element(by.css(`adf-datatable-row[class*='is-selected'] div[data-automation-id*='text_']`));
this.allSelectedRows = this.rootElement.all(by.css(`adf-datatable-row[class*='is-selected']`));
this.selectAll = this.rootElement.element(by.css(`div[class*='adf-datatable-header'] mat-checkbox`));
this.copyColumnTooltip = this.rootElement.element(by.css(`adf-copy-content-tooltip span`));
this.emptyList = this.rootElement.element(by.css(`adf-empty-content`));
this.emptyListTitle = this.rootElement.element(by.css(`.adf-empty-content__title`));
this.emptyListSubtitle = this.rootElement.element(by.css(`.adf-empty-content__subtitle`));
this.list = this.rootElement.$$(`div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row']`);
this.contents = this.rootElement.$$('.adf-datatable-body span');
this.tableBody = this.rootElement.$$(`.adf-datatable-body`).first();
this.allColumns = this.rootElement.$$('div[data-automation-id*="auto_id_entry."]');
this.selectedRowNumber = this.rootElement.$(`adf-datatable-row[class*='is-selected'] div[data-automation-id*='text_']`);
this.allSelectedRows = this.rootElement.$$(`adf-datatable-row[class*='is-selected']`);
this.selectAll = this.rootElement.$(`div[class*='adf-datatable-header'] mat-checkbox`);
this.copyColumnTooltip = this.rootElement.$(`adf-copy-content-tooltip span`);
this.emptyList = this.rootElement.$(`adf-empty-content`);
this.emptyListTitle = this.rootElement.$(`.adf-empty-content__title`);
this.emptyListSubtitle = this.rootElement.$(`.adf-empty-content__subtitle`);
}
geCellElementDetail(detail: string): ElementArrayFinder {
return $$(`adf-datatable div[title="${detail}"] span`);
}
async checkAllRowsButtonIsDisplayed(): Promise<void> {
@@ -59,12 +64,12 @@ export class DataTableComponentPage {
async checkAllRows(): Promise<void> {
await BrowserActions.click(this.selectAll);
await BrowserVisibility.waitUntilElementIsVisible(this.selectAll.element(by.css('input[aria-checked="true"]')));
await BrowserVisibility.waitUntilElementIsVisible(this.selectAll.$('input[aria-checked="true"]'));
}
async uncheckAllRows(): Promise<void> {
await BrowserActions.click(this.selectAll);
await BrowserVisibility.waitUntilElementIsNotVisible(this.selectAll.element(by.css('input[aria-checked="true"]')));
await BrowserVisibility.waitUntilElementIsNotVisible(this.selectAll.$('input[aria-checked="true"]'));
}
async clickCheckbox(columnName: string, columnValue: string): Promise<void> {
@@ -73,16 +78,16 @@ export class DataTableComponentPage {
}
async checkRowIsNotChecked(columnName: string, columnValue: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.getRowCheckbox(columnName, columnValue).element(by.css('input[aria-checked="true"]')));
await BrowserVisibility.waitUntilElementIsNotVisible(this.getRowCheckbox(columnName, columnValue).$('input[aria-checked="true"]'));
}
async checkRowIsChecked(columnName: string, columnValue: string): Promise<void> {
const rowCheckbox = this.getRowCheckbox(columnName, columnValue);
await BrowserVisibility.waitUntilElementIsVisible(rowCheckbox.element(by.css('input[aria-checked="true"]')));
await BrowserVisibility.waitUntilElementIsVisible(rowCheckbox.$('input[aria-checked="true"]'));
}
getRowCheckbox(columnName: string, columnValue: string): ElementFinder {
return this.getRow(columnName, columnValue).element(by.css('mat-checkbox'));
return this.getRow(columnName, columnValue).$('mat-checkbox');
}
async checkNoRowIsSelected(): Promise<void> {
@@ -140,7 +145,7 @@ export class DataTableComponentPage {
async getColumnValueForRow(identifyingColumn: string, identifyingValue: string, columnName: string): Promise<string> {
const row = this.getRow(identifyingColumn, identifyingValue);
await BrowserVisibility.waitUntilElementIsVisible(row);
const rowColumn = row.element(by.css(`div[title="${columnName}"] span`));
const rowColumn = row.$(`div[title="${columnName}"] span`);
return BrowserActions.getText(rowColumn);
}
@@ -153,7 +158,7 @@ export class DataTableComponentPage {
* @return 'true' if the list is sorted as await expected and 'false' if it isn't
*/
async checkListIsSorted(sortOrder: string, columnTitle: string, listType: string = 'STRING'): Promise<any> {
const column = element.all(by.css(`div.adf-datatable-cell[title='${columnTitle}'] span`));
const column = $$(`div.adf-datatable-cell[title='${columnTitle}'] span`);
await BrowserVisibility.waitUntilElementIsVisible(column.first());
const initialList = [];
@@ -212,7 +217,7 @@ export class DataTableComponentPage {
async rightClickOnRow(columnName: string, columnValue: string): Promise<void> {
await this.rightClickOnItem(columnName, columnValue);
await BrowserVisibility.waitUntilElementIsVisible(element(by.id('adf-context-menu-content')));
await BrowserVisibility.waitUntilElementIsVisible($('#adf-context-menu-content'));
}
async getTooltip(columnName: string, columnValue: string): Promise<string> {
@@ -222,7 +227,7 @@ export class DataTableComponentPage {
async rightClickOnRowByIndex(index: number): Promise<void> {
const row = this.getRowByIndex(index);
await BrowserActions.rightClick(row);
await BrowserVisibility.waitUntilElementIsVisible(element(by.id('adf-context-menu-content')));
await BrowserVisibility.waitUntilElementIsVisible($('#adf-context-menu-content'));
}
async rightClickOnItem(columnName: string, columnValue: string): Promise<void> {
@@ -237,35 +242,37 @@ export class DataTableComponentPage {
async numberOfRows(): Promise<number> {
try {
await this.waitForFirstRow();
return this.rootElement.all(this.rows).count();
return this.rootElement.$$(this.rows).count();
} catch (e) {
return 0;
}
}
async waitForFirstRow(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.all(this.rows).first());
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$$(this.rows).first());
}
async getAllRowsColumnValues(column: string): Promise<string[]> {
let columnValues: string[] = [];
const columnLocator: Locator = by.css("adf-datatable div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row'] div[title='" + column + "'] span");
const columnLocator = $$(`adf-datatable div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row'] div[title="${column}"] span`);
await BrowserVisibility.waitUntilElementIsPresent(await columnLocator.first(), 1000);
try {
await BrowserVisibility.waitUntilElementIsPresent(element.all(columnLocator).first(), 1000);
columnValues = <string[]> await element.all(columnLocator)
await BrowserVisibility.waitUntilElementIsPresent(columnLocator.first(), 1000);
columnValues = await columnLocator
.filter(async (el) => el.isPresent())
.map(async (el) => el.getText());
} catch (error) {
Logger.log(error);
}
return columnValues;
}
async getRowsWithSameColumnValues(columnName: string, columnValue: string) {
const columnLocator: Locator = by.css(`div[title='${columnName}'] div[data-automation-id="text_${columnValue}"] span`);
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.all(columnLocator).first());
return this.rootElement.all(columnLocator).getText();
const columnLocator = `div[title='${columnName}'] div[data-automation-id="text_${columnValue}"] span`;
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$$(columnLocator).first());
return this.rootElement.$$(columnLocator).getText();
}
async doubleClickRow(columnName: string, columnValue: string): Promise<void> {
@@ -279,36 +286,32 @@ export class DataTableComponentPage {
}
async getFirstElementDetail(detail: string): Promise<string> {
const firstNode = element.all(by.css(`adf-datatable div[title="${detail}"] span`)).first();
const firstNode = $$(`adf-datatable div[title="${detail}"] span`).first();
return BrowserActions.getText(firstNode);
}
geCellElementDetail(detail: string): ElementArrayFinder {
return element.all(by.css(`adf-datatable div[title="${detail}"] span`));
}
/**
* Sort the list by name column.
*
* @param sortOrder : 'ASC' to sort the list ascendant and 'DESC' for descendant
*/
async sortByColumn(sortOrder: string, titleColumn: string): Promise<void> {
const locator: Locator = by.css(`div[data-automation-id="auto_id_${titleColumn}"]`);
await BrowserVisibility.waitUntilElementIsVisible(element(locator));
const result = await BrowserActions.getAttribute(element(locator), 'class');
const locator = $(`div[data-automation-id="auto_id_${titleColumn}"]`);
await BrowserVisibility.waitUntilElementIsVisible(locator);
const result = await BrowserActions.getAttribute(locator, 'class');
if (sortOrder.toLocaleLowerCase() === 'asc') {
if (!result.includes('sorted-asc')) {
if (result.includes('sorted-desc') || result.includes('sortable')) {
await BrowserActions.click(element(locator));
await BrowserActions.click(locator);
}
}
} else {
if (result.includes('sorted-asc')) {
await BrowserActions.click(element(locator));
await BrowserActions.click(locator);
} else if (result.includes('sortable')) {
await BrowserActions.click(element(locator));
await BrowserActions.click(element(locator));
await BrowserActions.click(locator);
await BrowserActions.click(locator);
}
}
}
@@ -359,7 +362,7 @@ export class DataTableComponentPage {
}
getCellElementByValue(columnName: string, columnValue: string, columnPrefix = 'text_'): ElementFinder {
return this.rootElement.all(by.css(`div[title="${columnName}"] div[data-automation-id="${columnPrefix}${columnValue}"] span`)).first();
return this.rootElement.$$(`div[title="${columnName}"] div[data-automation-id="${columnPrefix}${columnValue}"] span`).first();
}
async tableIsLoaded(): Promise<void> {
@@ -456,7 +459,7 @@ export class DataTableComponentPage {
}
async checkColumnIsDisplayed(column: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.css(`div[data-automation-id="auto_id_entry.${column}"]`)));
await BrowserVisibility.waitUntilElementIsVisible($(`div[data-automation-id="auto_id_entry.${column}"]`));
}
async getNumberOfColumns(): Promise<number> {
@@ -468,11 +471,11 @@ export class DataTableComponentPage {
}
getCellByRowNumberAndColumnName(rowNumber: number, columnName: string): ElementFinder {
return this.list.get(rowNumber).all(by.css(`div[title="${columnName}"] span`)).first();
return this.list.get(rowNumber).$$(`div[title="${columnName}"] span`).first();
}
getCellByRowContentAndColumn(rowColumn: string, rowContent: string, columnName: string): ElementFinder {
return this.getRow(rowColumn, rowContent).element(by.css(`div[title='${columnName}']`));
return this.getRow(rowColumn, rowContent).$(`div[title='${columnName}']`);
}
async selectRowByContent(content: string): Promise<void> {
@@ -500,33 +503,33 @@ export class DataTableComponentPage {
}
async clickRowByContent(name: string): Promise<void> {
const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${name}']`)).first();
const resultElement = this.rootElement.$$(`div[data-automation-id='${name}']`).first();
await BrowserActions.click(resultElement);
}
async clickRowByContentCheckbox(name: string): Promise<void> {
const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${name}']`)).first().element(by.xpath(`ancestor::adf-datatable-row/div/mat-checkbox`));
const resultElement = this.rootElement.$$(`div[data-automation-id='${name}']`).first().element(by.xpath(`ancestor::adf-datatable-row/div/mat-checkbox`));
await browser.actions().mouseMove(resultElement);
await BrowserActions.click(resultElement);
}
async checkRowContentIsDisplayed(content: string): Promise<void> {
const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${content}']`)).first();
const resultElement = this.rootElement.$$(`div[data-automation-id='${content}']`).first();
await BrowserVisibility.waitUntilElementIsVisible(resultElement);
}
async checkRowContentIsNotDisplayed(content: string): Promise<void> {
const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${content}']`)).first();
const resultElement = this.rootElement.$$(`div[data-automation-id='${content}']`).first();
await BrowserVisibility.waitUntilElementIsNotVisible(resultElement);
}
async checkRowContentIsDisabled(content: string): Promise<void> {
const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${content}'] div.adf-cell-value img[aria-label='Disabled']`)).first();
const resultElement = this.rootElement.$$(`div[data-automation-id='${content}'] div.adf-cell-value img[aria-label='Disabled']`).first();
await BrowserVisibility.waitUntilElementIsVisible(resultElement);
}
async doubleClickRowByContent(name: string): Promise<void> {
const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${name}']`)).first();
const resultElement = this.rootElement.$$(`div[data-automation-id='${name}']`).first();
await BrowserActions.click(resultElement);
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
}
@@ -566,7 +569,7 @@ export class DataTableComponentPage {
async getEmptyListText(): Promise<string> {
const isEmpty = await this.isEmpty();
if (isEmpty) {
return this.rootElement.by.css('adf-custom-empty-content-template').getText();
return this.rootElement.$('adf-custom-empty-content-template').getText();
}
return '';
}

View File

@@ -16,16 +16,16 @@
*/
import { Column } from './column';
import { by, element, ElementFinder, Locator, protractor, browser } from 'protractor';
import { by, element, ElementFinder, protractor, browser, $$ } from 'protractor';
import { BrowserActions } from '../../utils/browser-actions';
import { BrowserVisibility } from '../../utils/browser-visibility';
export class DataTableItem {
columns = new Array<Column>();
rootElement: ElementFinder;
rows: Locator = by.css(`div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row']`);
rows = `div[class*='adf-datatable-body'] adf-datatable-row[class*='adf-datatable-row']`;
constructor(rootElement = element.all(by.css('adf-datatable')).first()) {
constructor(rootElement = $$('adf-datatable').first()) {
this.rootElement = rootElement;
}
@@ -58,7 +58,7 @@ export class DataTableItem {
}
async waitForFirstRow(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.all(this.rows).first());
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$$(this.rows).first());
}
async clickAndEnterOnRow(columnName: string, columnValue: string): Promise<void> {
@@ -70,7 +70,7 @@ export class DataTableItem {
async getColumnValueForRow(identifyingColumnName: string, identifyingColumnValue: string, columnName: string): Promise<string> {
const row = await this.getRow(identifyingColumnName, identifyingColumnValue);
await BrowserVisibility.waitUntilElementIsVisible(row);
const rowColumn = row.element(by.css(`div[title="${columnName}"] span`));
const rowColumn = row.$(`div[title="${columnName}"] span`);
return BrowserActions.getText(rowColumn);
}

View File

@@ -16,14 +16,14 @@
*/
import { BrowserVisibility } from '../utils/browser-visibility';
import { element, by } from 'protractor';
import { $ } from 'protractor';
import { BrowserActions } from '../utils/browser-actions';
export class ErrorPage {
errorPageCode = element(by.css('adf-error-content .adf-error-content-code'));
errorPageTitle = element(by.css('adf-error-content .adf-error-content-title'));
errorPageDescription = element(by.css('adf-error-content .adf-error-content-description'));
errorPageCode = $('adf-error-content .adf-error-content-code');
errorPageTitle = $('adf-error-content .adf-error-content-title');
errorPageDescription = $('adf-error-content .adf-error-content-description');
async checkErrorCode(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.errorPageCode);

View File

@@ -15,37 +15,43 @@
* limitations under the License.
*/
import { browser, Locator, by, element, ElementFinder } from 'protractor';
import { browser, Locator, by, element, ElementFinder, $, $$ } from 'protractor';
import { BrowserVisibility, BrowserActions } from '../../utils/public-api';
import { DropdownPage } from '../material/dropdown.page';
export class FormFields {
formContent = element(by.css('adf-form-renderer'));
refreshButton = element(by.css('div[class*="form-reload-button"] mat-icon'));
selectFormDropdown = new DropdownPage($$('.adf-attach-form .mat-select-arrow').first());
formContent = $('adf-form-renderer');
refreshButton = $('div[class*="form-reload-button"] mat-icon');
saveButton = element(by.cssContainingText('mat-card-actions[class*="adf-for"] span', 'SAVE'));
valueLocator: Locator = by.css('input');
labelLocator: Locator = by.css('label');
noFormMessage = element(by.css('.adf-empty-content__title'));
noFormMessageStandaloneTask = element(by.css('adf-task-standalone #adf-no-form-message'));
noFormTemplate = element(by.css('adf-empty-content'));
completedTaskNoFormMessage = element(by.css('div[id*="completed-form-message"] p'));
completedStandaloneTaskNoFormMessage = element(by.css('adf-task-standalone #adf-completed-form-message'));
attachFormButton = element(by.id('adf-attach-form-attach-button'));
completeButton = element(by.id('adf-form-complete'));
completeNoFormButton = element(by.id('adf-no-form-complete-button'));
cancelButton = element(by.id('adf-no-form-cancel-button'));
noFormMessage = $('.adf-empty-content__title');
noFormMessageStandaloneTask = $('adf-task-standalone #adf-no-form-message');
noFormTemplate = $('adf-empty-content');
completedTaskNoFormMessage = $('div[id*="completed-form-message"] p');
completedStandaloneTaskNoFormMessage = $('adf-task-standalone #adf-completed-form-message');
attachFormButton = $('#adf-attach-form-attach-button');
completeButton = $('#adf-form-complete');
completeNoFormButton = $('#adf-no-form-complete-button');
cancelButton = $('#adf-no-form-cancel-button');
errorMessage: Locator = by.css('.adf-error-text-container .adf-error-text');
selectFormDropdown = new DropdownPage(element.all(by.css('.adf-attach-form .mat-select-arrow')).first());
getWidget = (fieldId: string): ElementFinder => $(`adf-form-field div[id='field-${fieldId}-container']`);
async setFieldValue(locator, field, value: string): Promise<void> {
const fieldElement = element(locator(field));
async setFieldValue(field: string, value: string): Promise<void> {
const fieldElement = $(`#${field}`);
await BrowserActions.clearSendKeys(fieldElement, value);
}
async checkFieldValue(field: string, value: string): Promise<void> {
const fieldElement = $(`#${field}`);
await BrowserVisibility.waitUntilElementHasValue(fieldElement, value);
}
async checkWidgetIsVisible(fieldId: string): Promise<void> {
const fieldElement = element.all(by.css(`adf-form-field div[id='field-${fieldId}-container']`)).first();
const fieldElement = $$(`adf-form-field div[id='field-${fieldId}-container']`).first();
await BrowserVisibility.waitUntilElementIsVisible(fieldElement);
}
@@ -56,19 +62,15 @@ export class FormFields {
}
async checkWidgetIsClickable(fieldId: string): Promise<void> {
const fieldElement = element.all(by.css(`adf-form-field div[id='field-${fieldId}-container']`)).first();
const fieldElement = $$(`adf-form-field div[id='field-${fieldId}-container']`).first();
await BrowserVisibility.waitUntilElementIsClickable(fieldElement);
}
async checkWidgetIsHidden(fieldId: string): Promise<void> {
const hiddenElement = element(by.css(`adf-form-field div[id='field-${fieldId}-container']`));
const hiddenElement = $(`adf-form-field div[id='field-${fieldId}-container']`);
await BrowserVisibility.waitUntilElementIsNotVisible(hiddenElement, 6000);
}
getWidget(fieldId: string): ElementFinder {
return element(by.css(`adf-form-field div[id='field-${fieldId}-container']`));
}
async getFieldValue(fieldId: string, valueLocatorParam?: any): Promise<string> {
const valueWidget = await (await this.getWidget(fieldId)).element(valueLocatorParam || this.valueLocator);
await BrowserVisibility.waitUntilElementIsVisible(valueWidget);
@@ -92,15 +94,11 @@ export class FormFields {
}
async getFieldPlaceHolder(fieldId: string, locator = 'input'): Promise<string> {
const placeHolderLocator = element(by.css(`${locator}#${fieldId}`));
const placeHolderLocator = $(`${locator}#${fieldId}`);
await BrowserVisibility.waitUntilElementIsVisible(placeHolderLocator);
return BrowserActions.getAttribute(placeHolderLocator, 'data-placeholder');
}
async checkFieldValue(locator, field, val): Promise<void> {
await BrowserVisibility.waitUntilElementHasValue(element(locator(field)), val);
}
async refreshForm(): Promise<void> {
await BrowserActions.click(this.refreshButton);
await browser.sleep(500);
@@ -177,13 +175,13 @@ export class FormFields {
}
async checkWidgetIsReadOnlyMode(fieldId: string): Promise<ElementFinder> {
const widget = element(by.css(`adf-form-field #field-${fieldId}-container .adf-readonly`));
const widget = $(`adf-form-field #field-${fieldId}-container .adf-readonly`);
await BrowserVisibility.waitUntilElementIsVisible(widget);
return widget;
}
async isFormFieldEnabled(formFieldId: string): Promise<boolean> {
return element(by.id(`${formFieldId}`)).isEnabled();
return $(`#${formFieldId}`).isEnabled();
}
async completeForm(): Promise<void> {
@@ -199,7 +197,7 @@ export class FormFields {
}
async setValueInInputById(fieldId: string, value: string): Promise<void> {
const input = element(by.id(fieldId));
const input = $(`#${fieldId}`);
await BrowserActions.clearSendKeys(input, value);
}

View File

@@ -15,13 +15,13 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { element, by, $ } from 'protractor';
import { BrowserVisibility } from '../../utils/browser-visibility';
import { BrowserActions } from '../../utils/public-api';
export class FormPage {
errorLog = element(by.css('div[class*="console"]'));
errorLog = $('div[class*="console"]');
saveButton = element(by.cssContainingText('mat-card-actions[class*="adf-for"] span', 'SAVE'));
async checkErrorMessageForWidgetIsDisplayed(errorMessage: string): Promise<void> {
@@ -47,7 +47,7 @@ export class FormPage {
}
async isSaveButtonDisabled(): Promise<boolean> {
const saveButtonDisabled = element(by.css('.adf-form-mat-card-actions [disabled]'));
const saveButtonDisabled = $('.adf-form-mat-card-actions [disabled]');
try {
await saveButtonDisabled.isDisplayed();
return true;
@@ -57,7 +57,7 @@ export class FormPage {
}
async isValidationIconBlue(): Promise<boolean> {
const validationIcon = element(by.css('#adf-valid-form-icon'));
const validationIcon = $('#adf-valid-form-icon');
try {
await validationIcon.isDisplayed();
return true;
@@ -67,7 +67,7 @@ export class FormPage {
}
async isValidationIconRed(): Promise<boolean> {
const validationIcon = element(by.css('#adf-invalid-form-icon'));
const validationIcon = $('#adf-invalid-form-icon');
try {
await validationIcon.isDisplayed();
return true;

View File

@@ -15,23 +15,23 @@
* limitations under the License.
*/
import { element, by, Locator } from 'protractor';
import { $$, $ } from 'protractor';
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
import { FormFields } from '../form-fields';
export class AmountWidgetPage {
currency: Locator = by.css('.adf-amount-widget__prefix-spacing');
currency = '.adf-amount-widget__prefix-spacing';
formFields: FormFields = new FormFields();
async getAmountFieldLabel(fieldId: string): Promise<string> {
const label = element.all(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`)).first();
const label = $$(`adf-form-field div[id="field-${fieldId}-container"] label`).first();
return BrowserActions.getText(label);
}
async getAmountFieldCurrency(fieldId: string): Promise<string> {
const widget = await this.formFields.getWidget(fieldId);
return BrowserActions.getText(widget.element(this.currency));
return BrowserActions.getText(widget.$(this.currency));
}
async setFieldValue(fieldId: string, value: any): Promise<void> {
@@ -39,12 +39,12 @@ export class AmountWidgetPage {
}
async removeFromAmountWidget(fieldId: string) {
const amountWidgetInput = element(by.id(fieldId));
const amountWidgetInput = $(`#${fieldId}`);
await BrowserActions.clearWithBackSpace(amountWidgetInput);
}
async clearFieldValue(fieldId: string): Promise<void> {
const numberField = element(by.id(fieldId));
const numberField = $(`#${fieldId}`);
await BrowserVisibility.waitUntilElementIsVisible(numberField);
await numberField.clear();
}
@@ -54,7 +54,7 @@ export class AmountWidgetPage {
}
async getErrorMessage(fieldId: string): Promise<string> {
const errorMessage = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`));
const errorMessage = $(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`);
return BrowserActions.getText(errorMessage);
}

View File

@@ -17,33 +17,33 @@
import { FormFields } from '../form-fields';
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
import { Locator, element, by, browser } from 'protractor';
import { by, browser, $ } from 'protractor';
import { TestElement } from '../../../test-element';
export class AttachFileWidgetPage {
formFields = new FormFields();
alfrescoTypeUploadLocator: Locator = by.css('button[id="attachfile"]');
localStorageButton = element(by.css('input[id="attachfile"]'));
filesListLocator: Locator = by.css('div[id="adf-attach-widget-readonly-list"]');
attachFileWidget = element(by.css('#attachfile'));
attachedFileMenu = element(by.css('mat-list-item button'));
attachedFileOptions = element(by.css('.mat-menu-panel .mat-menu-content'));
viewFileOptionButton = element(by.css(`.mat-menu-panel .mat-menu-content button[id$="show-file"]`));
downloadFileOptionButton = element(by.css(`.mat-menu-panel .mat-menu-content button[id$="download-file"]`));
alfrescoTypeUploadLocator = 'button[id="attachfile"]';
localStorageButton = $('input[id="attachfile"]');
filesListLocator = 'div[id="adf-attach-widget-readonly-list"]';
attachFileWidget = $('#attachfile');
attachedFileMenu = $('mat-list-item button');
attachedFileOptions = $('.mat-menu-panel .mat-menu-content');
viewFileOptionButton = $(`.mat-menu-panel .mat-menu-content button[id$="show-file"]`);
downloadFileOptionButton = $(`.mat-menu-panel .mat-menu-content button[id$="download-file"]`);
removeFileOptionButton = TestElement.byCss(`.mat-menu-panel .mat-menu-content button[id$="remove"]`);
async attachFile(fieldId, fileLocation): Promise<void> {
async attachFile(fieldId: string, fileLocation: string): Promise<void> {
const widget = await this.formFields.getWidget(fieldId);
const uploadButton = await widget.element(this.alfrescoTypeUploadLocator);
const uploadButton = await widget.$(this.alfrescoTypeUploadLocator);
await BrowserActions.click(uploadButton);
await BrowserVisibility.waitUntilElementIsPresent(this.localStorageButton);
await this.localStorageButton.sendKeys(fileLocation);
}
async checkNoFileIsAttached(fieldId): Promise<void> {
async checkNoFileIsAttached(fieldId: string): Promise<void> {
const widget = await this.formFields.getWidget(fieldId);
const fileItem = widget.element(this.filesListLocator).element(by.css('mat-list-item'));
const fileItem = widget.$(this.filesListLocator).$('mat-list-item');
await BrowserVisibility.waitUntilElementIsNotVisible(fileItem);
}
@@ -54,8 +54,7 @@ export class AttachFileWidgetPage {
}
async checkFileIsAttached(fieldId: string, name: string): Promise<void> {
const widget = await this.formFields.getWidget(fieldId);
const fileAttached = widget.element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name));
const fileAttached = await this.getFileAttachedNotAttachedLocator(fieldId, name);
await BrowserVisibility.waitUntilElementIsVisible(fileAttached);
}
@@ -65,14 +64,13 @@ export class AttachFileWidgetPage {
}
}
async checkFileIsNotAttached(fieldId, name): Promise<void> {
const widget = await this.formFields.getWidget(fieldId);
const fileNotAttached = widget.element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name));
async checkFileIsNotAttached(fieldId: string, name: string): Promise<void> {
const fileNotAttached = await this.getFileAttachedNotAttachedLocator(fieldId, name);
await BrowserVisibility.waitUntilElementIsNotVisible(fileNotAttached);
}
async viewFile(name: string): Promise<void> {
const fileView = element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name));
const fileView = $(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name));
await BrowserActions.click(fileView);
await browser.actions().doubleClick(fileView).perform();
}
@@ -84,10 +82,10 @@ export class AttachFileWidgetPage {
async toggleAttachedFileMenu(fieldId: string, fileName: string): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
const widget = await this.formFields.getWidget(fieldId);
const fileAttached = await widget.element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', fileName));
const fileAttached = await this.getFileAttachedNotAttachedLocator(fieldId, fileName);
await BrowserVisibility.waitUntilElementIsVisible(fileAttached);
const id = await BrowserActions.getAttribute(fileAttached, 'id');
const optionMenu = widget.element(by.css(`button[id='${id}-option-menu']`));
const optionMenu = widget.$(`button[id='${id}-option-menu']`);
await BrowserActions.click(optionMenu);
}
@@ -129,39 +127,44 @@ export class AttachFileWidgetPage {
return this.removeFileOptionButton.isEnabled();
}
async checkUploadIsNotVisible(fieldId): Promise<void> {
const alfrescoTypeUploadLocator = by.css(`button[id="${fieldId}"]`);
async checkUploadIsNotVisible(fieldId: string): Promise<void> {
const alfrescoTypeUploadLocator = `button[id="${fieldId}"]`;
const widget = await this.formFields.getWidget(fieldId);
const uploadButton = await widget.element(alfrescoTypeUploadLocator);
const uploadButton = await widget.$(alfrescoTypeUploadLocator);
await BrowserVisibility.waitUntilElementIsNotPresent(uploadButton);
}
async checkUploadIsVisible(fieldId): Promise<void> {
const alfrescoTypeUploadLocator = by.css(`button[id="${fieldId}"]`);
async checkUploadIsVisible(fieldId: string): Promise<void> {
const alfrescoTypeUploadLocator = `button[id="${fieldId}"]`;
const widget = await this.formFields.getWidget(fieldId);
const uploadButton = await widget.element(alfrescoTypeUploadLocator);
const uploadButton = await widget.$(alfrescoTypeUploadLocator);
await BrowserVisibility.waitUntilElementIsPresent(uploadButton);
}
async checkLocalTypeUploadIsPresent(fieldId): Promise<void> {
const localTypeUpload = element(by.css(`input[id="${fieldId}"]`));
async checkLocalTypeUploadIsPresent(fieldId: string): Promise<void> {
const localTypeUpload = $(`input[id="${fieldId}"]`);
await BrowserVisibility.waitUntilElementIsPresent(localTypeUpload);
}
async checkLocalTypeUploadIsNotPresent(fieldId): Promise<void> {
const localTypeUpload = element(by.css(`input[id="${fieldId}"]`));
async checkLocalTypeUploadIsNotPresent(fieldId: string): Promise<void> {
const localTypeUpload = $(`input[id="${fieldId}"]`);
await BrowserVisibility.waitUntilElementIsNotPresent(localTypeUpload);
}
async selectUploadSource(name: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.attachedFileOptions);
await BrowserActions.click(element(by.css(`button[id="attach-${name}"]`)));
await BrowserActions.click($(`button[id="attach-${name}"]`));
}
async clickUploadButton(fieldId): Promise<void> {
async clickUploadButton(fieldId: string): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
const widget = await this.formFields.getWidget(fieldId);
const uploadButton = await widget.element(this.alfrescoTypeUploadLocator);
const uploadButton = await widget.$(this.alfrescoTypeUploadLocator);
await BrowserActions.click(uploadButton);
}
private async getFileAttachedNotAttachedLocator(fieldId: string, name: string) {
const widget = await this.formFields.getWidget(fieldId);
return widget.$(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name));
}
}

View File

@@ -15,42 +15,45 @@
* limitations under the License.
*/
import { Locator, by, element } from 'protractor';
import { by, $ } from 'protractor';
import { FormFields } from '../form-fields';
import { BrowserActions, BrowserVisibility } from '../../../utils/public-api';
export class AttachFolderWidgetPage {
formFields: FormFields = new FormFields();
foldersListLocator: Locator = by.css('.adf-attach-folder-result');
foldersListLocator = '.adf-attach-folder-result';
async clickWidget(fieldId: string): Promise<void> {
const widget = await this.formFields.getWidget(fieldId).element(by.css(`button[id="folder-${fieldId}-button"]`));
const widget = await this.formFields.getWidget(fieldId).$(`button[id="folder-${fieldId}-button"]`);
await BrowserActions.click(widget);
}
async checkFolderIsAttached(fieldId, name): Promise<void> {
const widget = await this.formFields.getWidget(fieldId);
const folderAttached = widget.element(this.foldersListLocator).element(by.cssContainingText('span', name));
async checkFolderIsAttached(fieldId: string, name: string): Promise<void> {
const folderAttached = await this.getFolderAttachedLocator(fieldId, name);
await BrowserVisibility.waitUntilElementIsVisible(folderAttached);
}
async checkFolderIsNotAttached(fieldId, name): Promise<void> {
const widget = await this.formFields.getWidget(fieldId);
const folderAttached = widget.element(this.foldersListLocator).element(by.cssContainingText('span', name));
async checkFolderIsNotAttached(fieldId: string, name: string): Promise<void> {
const folderAttached = await this.getFolderAttachedLocator(fieldId, name);
await BrowserVisibility.waitUntilElementIsNotPresent(folderAttached);
}
async attachFileWidgetDisplayed(id: string): Promise<void> {
const locator = element(by.css(id ? id : '#attachfolder'));
const locator = $(id ? id : '#attachfolder');
await BrowserVisibility.waitUntilElementIsVisible(locator);
}
async removeFolder(fieldId: string, name: string): Promise<void> {
await this.checkFolderIsAttached(fieldId, name);
const widget = await this.formFields.getWidget(fieldId);
const folderToBeRemoved = widget.element(this.foldersListLocator).element(by.css(`[id="folder-${fieldId}-remove"]`));
const folderToBeRemoved = widget.$(this.foldersListLocator).$(`[id="folder-${fieldId}-remove"]`);
await BrowserActions.click(folderToBeRemoved);
}
private async getFolderAttachedLocator(fieldId: string, name: string) {
const widget = await this.formFields.getWidget(fieldId);
return widget.$(this.foldersListLocator).element(by.cssContainingText('span', name));
}
}

View File

@@ -17,20 +17,20 @@
import { FormFields } from '../form-fields';
import { BrowserActions } from '../../../utils/public-api';
import { Locator, by, element } from 'protractor';
import { $$, $ } from 'protractor';
export class CheckboxWidgetPage {
formFields = new FormFields();
checkboxLabel = element(by.css('span[class*="mat-checkbox-label"]'));
checkboxLocator: Locator = by.css('mat-checkbox');
checkboxLabel = $('span[class*="mat-checkbox-label"]');
checkboxLocator = ('mat-checkbox');
getCheckboxLabel(): Promise<string> {
return BrowserActions.getText(this.checkboxLabel);
}
async clickCheckboxInput(fieldId: string): Promise<void> {
const checkboxInput = element.all(by.css(`mat-checkbox[id="${fieldId}"] div`)).first();
const checkboxInput = $$(`mat-checkbox[id="${fieldId}"] div`).first();
await BrowserActions.click(checkboxInput);
}
@@ -43,7 +43,7 @@ export class CheckboxWidgetPage {
}
async isCheckboxChecked(fieldId: string): Promise<boolean> {
const checkboxWidget = await (await this.formFields.getWidget(fieldId)).element(this.checkboxLocator);
const checkboxWidget = await (await this.formFields.getWidget(fieldId)).$(this.checkboxLocator);
const attributeValue = await BrowserActions.getAttribute(checkboxWidget, 'class');
return attributeValue.includes('mat-checkbox-checked');
}

View File

@@ -24,7 +24,7 @@ export class ContainerWidgetPage {
fileLocator: Locator = by.css("div [class*='upload-widget__content-text']");
getFieldText(fieldId): Promise<string> {
getFieldText(fieldId: string): Promise<string> {
return this.formFields.getFieldText(fieldId, this.fileLocator);
}
}

View File

@@ -16,20 +16,20 @@
*/
import { FormFields } from '../form-fields';
import { element, by } from 'protractor';
import { element, by, $ } from 'protractor';
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
export class DateTimeWidgetPage {
formFields = new FormFields();
outsideLayer = element(by.css('div[class*="cdk-overlay-container"]'));
outsideLayer = $('div[class*="cdk-overlay-container"]');
async checkWidgetIsVisible(fieldId: string): Promise<void> {
await this.formFields.checkWidgetIsVisible(fieldId);
}
async getDateTimeLabel(fieldId: string): Promise<string> {
const label = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`));
const label = $(`adf-form-field div[id="field-${fieldId}-container"] label`);
return BrowserActions.getText(label);
}
@@ -47,7 +47,7 @@ export class DateTimeWidgetPage {
}
async getErrorMessage(fieldId: string): Promise<string> {
const errorMessage = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`));
const errorMessage = $(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`);
return BrowserActions.getText(errorMessage);
}
@@ -57,7 +57,7 @@ export class DateTimeWidgetPage {
}
async openDatepicker(fieldId: string): Promise<void> {
await BrowserActions.click(element(by.id(fieldId)));
await BrowserActions.click($(`#${fieldId}`));
}
async selectTime(time: string): Promise<void> {
@@ -78,13 +78,13 @@ export class DateTimeWidgetPage {
}
async removeFromDatetimeWidget(fieldId: string): Promise<void> {
const amountWidgetInput = $(`#${fieldId}`);
await BrowserVisibility.waitUntilElementIsVisible(await this.formFields.getWidget(fieldId));
const amountWidgetInput = element(by.id(fieldId));
await BrowserActions.clearWithBackSpace(amountWidgetInput);
}
async clearDateTimeInput(fieldId: string): Promise<void> {
const dateInput = element(by.id(fieldId));
const dateInput = $(`#${fieldId}`);
await BrowserVisibility.waitUntilElementIsVisible(dateInput);
await dateInput.clear();
}

View File

@@ -16,7 +16,7 @@
*/
import { FormFields } from '../form-fields';
import { element, by } from 'protractor';
import { $$, $ } from 'protractor';
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
export class DateWidgetPage {
@@ -32,7 +32,7 @@ export class DateWidgetPage {
}
async getDateLabel(fieldId: string): Promise<string> {
const label = element.all(by.css(`adf-form-field div[id="field-${fieldId}-container"] label`)).first();
const label = $$(`adf-form-field div[id="field-${fieldId}-container"] label`).first();
return BrowserActions.getText(label);
}
@@ -46,7 +46,7 @@ export class DateWidgetPage {
}
async clearDateInput(fieldId: string): Promise<void> {
const dateInput = element(by.id(fieldId));
const dateInput = $(`#${fieldId}`);
await BrowserActions.clearWithBackSpace(dateInput);
}
@@ -56,18 +56,18 @@ export class DateWidgetPage {
}
async checkErrorMessageIsNotDisplayed(fieldId: string): Promise<void> {
const errorMessage = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`));
const errorMessage = $(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`);
await BrowserVisibility.waitUntilElementIsNotVisible(errorMessage);
}
async getErrorMessage(fieldId: string): Promise<string> {
const errorMessage = element(by.css(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`));
const errorMessage = $(`adf-form-field div[id="field-${fieldId}-container"] .adf-error-text`);
return BrowserActions.getText(errorMessage);
}
async removeFromDatetimeWidget(fieldId: string): Promise<void> {
const widget = await this.formFields.getWidget(fieldId);
await BrowserVisibility.waitUntilElementIsVisible(widget);
await BrowserActions.clearSendKeys(element(by.id(fieldId)), '');
await BrowserActions.clearSendKeys($(`#${fieldId}`), '');
}
}

View File

@@ -16,7 +16,7 @@
*/
import { FormFields } from '../form-fields';
import { by, element, Locator } from 'protractor';
import { by, Locator, $ } from 'protractor';
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
import { EditJsonDialog } from '../../../dialog/public-api';
@@ -45,7 +45,7 @@ export class DisplayValueWidgetPage {
}
async checkDisplayValueWidgetIsHidden(fieldId: string): Promise<boolean> {
const hiddenElement = element(by.css(`adf-form-field div[id='field-${fieldId}-container'][hidden]`));
const hiddenElement = $(`adf-form-field div[id='field-${fieldId}-container'][hidden]`);
try {
await BrowserVisibility.waitUntilElementIsNotVisible(hiddenElement);
return true;
@@ -55,7 +55,7 @@ export class DisplayValueWidgetPage {
}
async clickOnDisplayJsonValueWidget(fieldId: string) {
const jsonButton = element(by.css(`adf-form-field div[id='field-${fieldId}-container'] button`));
const jsonButton = $(`adf-form-field div[id='field-${fieldId}-container'] button`);
await BrowserActions.click(jsonButton);
await this.editJsonDialog.checkDialogIsDisplayed();
}

View File

@@ -16,7 +16,7 @@
*/
import { FormFields } from '../form-fields';
import { by, element } from 'protractor';
import { by, element, $ } from 'protractor';
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
export class DropdownWidgetPage {
@@ -35,12 +35,12 @@ export class DropdownWidgetPage {
async openDropdown(locator: string = '#dropdown'): Promise<void> {
await this.checkDropdownIsDisplayed(locator);
const dropdown = locator ? element(by.css(`${locator}`)) : element(by.css(`#dropdown`));
const dropdown = locator ? $(`${locator}`) : $(`#dropdown`);
await BrowserActions.click(dropdown);
}
async checkDropdownIsDisplayed(locator: string = '#dropdown'): Promise<void> {
const dropdown = element(by.css(`${locator}`));
const dropdown = $(`${locator}`);
await BrowserVisibility.waitUntilElementIsVisible(dropdown);
}

View File

@@ -16,7 +16,7 @@
*/
import { FormFields } from '../form-fields';
import { Locator, by, element, protractor } from 'protractor';
import { Locator, by, element, protractor, $, $$ } from 'protractor';
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
export class DynamicTableWidgetPage {
@@ -27,14 +27,16 @@ export class DynamicTableWidgetPage {
columnNameLocator: Locator = by.css('table[id*="dynamic-table"] th');
cancelButton = element(by.cssContainingText('button span', 'Cancel'));
editButton = element(by.cssContainingText('button span', 'edit'));
columnDateTime = element(by.id('columnDateTime'));
columnDate = element(by.id('columnDate'));
calendarHeader = element(by.css('.mat-datetimepicker-calendar-header-date-time'));
calendarContent = element(by.css('.mat-datetimepicker-calendar-content'));
columnDateTime = $('#columnDateTime');
columnDate = $('#columnDate');
calendarHeader = $('.mat-datetimepicker-calendar-header-date-time');
calendarContent = $('.mat-datetimepicker-calendar-content');
saveButton = element(by.cssContainingText('button span', 'Save'));
errorMessage = element(by.css('.adf-error-text'));
dateWidget = element.all(by.css('mat-datepicker-toggle button')).first();
tableRow = element.all(by.css('tbody tr'));
errorMessage = $('.adf-error-text');
dateWidget = $$('mat-datepicker-toggle button').first();
tableRow = $$('tbody tr');
private getTableRowByIndex = (idx: string) => $(`#dynamictable-row-${idx}`);
getFieldLabel(fieldId: string): Promise<string> {
return this.formFields.getFieldLabel(fieldId, this.labelLocator);
@@ -45,12 +47,12 @@ export class DynamicTableWidgetPage {
}
async clickAddRow(id?: string): Promise<void> {
const rowButton = element(by.id(`${id ? id : 'label'}-add-row`));
const rowButton = $(`#${id ? id : 'label'}-add-row`);
await BrowserActions.click(rowButton);
}
async clickTableRow(rowNumber): Promise<void> {
const tableRowByIndex = element(by.id('dynamictable-row-' + rowNumber));
const tableRowByIndex = this.getTableRowByIndex(rowNumber);
await BrowserActions.click(tableRowByIndex);
}
@@ -63,18 +65,18 @@ export class DynamicTableWidgetPage {
}
async setDatatableInput(text, id = 'id'): Promise<void> {
const dataTableInput = element(by.id(id));
const dataTableInput = $(`#${id}`);
await BrowserVisibility.waitUntilElementIsVisible(dataTableInput);
await BrowserActions.clearSendKeys(dataTableInput, text);
}
async getTableRowText(rowNumber): Promise<string> {
const tableRowByIndex = element(by.id('dynamictable-row-' + rowNumber));
const tableRowByIndex = this.getTableRowByIndex(rowNumber);
return BrowserActions.getText(tableRowByIndex);
}
async checkTableRowIsNotVisible(rowNumber): Promise<void> {
const tableRowByIndex = element(by.id('dynamictable-row-' + rowNumber));
const tableRowByIndex = this.getTableRowByIndex(rowNumber);
await BrowserVisibility.waitUntilElementIsNotVisible(tableRowByIndex);
}

View File

@@ -16,13 +16,13 @@
*/
import { FormFields } from '../form-fields';
import { Locator, by, element } from 'protractor';
import { Locator, by, element, $ } from 'protractor';
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
export class GroupWidgetPage {
groupField = element(by.css('input[data-automation-id="adf-group-search-input"]'));
firstResult = element(by.id('adf-group-widget-user-0'));
groupField = $('input[data-automation-id="adf-group-search-input"]');
firstResult = $('#adf-group-widget-user-0');
formFields = new FormFields();
groupDropDownList: Locator = by.css('.mat-autocomplete-panel');

Some files were not shown because too many files have changed in this diff Show More