[ACA-3596] Fix e2e due to process header properties changes (#5873)

* [ACA-3596] Fix e2e due to process header properties changes

* Change pages structure

* Move the build demoshell as last step and exclude for PR

* move more pages

* change testing pkg

* better JSON import

* update script

* move CLOUD in the right place

* some logs and not used methods

* retrycout

Co-authored-by: maurizio vitale <maurizio.vitale@alfresco.com>
Co-authored-by: Eugenio Romano <eugenio.romano@alfresco.com>
Co-authored-by: Eugenio Romano <eromano@users.noreply.github.com>
This commit is contained in:
arditdomi
2020-07-16 23:22:22 +02:00
committed by GitHub
parent 33965d0a41
commit b9dc285d2b
234 changed files with 571 additions and 584 deletions

View File

@@ -0,0 +1,252 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { by, element } from 'protractor';
import { BrowserVisibility, BrowserActions, CardTextItemPage, DropdownPage, CardBooleanItemPage } from '@alfresco/adf-testing';
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']`));
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"]`));
selectDropdown = new DropdownPage(element(by.css('mat-select[data-automation-class="select-box"]')));
async clickOnAddButton(): Promise<void> {
await BrowserActions.click(this.addButton);
}
async checkNameTextLabelIsPresent(): Promise<void> {
await this.nameCardTextItem.checkLabelIsPresent();
}
async getNameTextFieldText(): Promise<string> {
return this.nameCardTextItem.getFieldValue();
}
async enterNameTextField(text: string): Promise<void> {
await this.nameCardTextItem.enterTextField(text);
}
async clickOnNameTextSaveIcon(): Promise<void> {
await this.nameCardTextItem.clickOnSaveButton();
}
async clickOnNameTextClearIcon(): Promise<void> {
await this.nameCardTextItem.clickOnClearButton();
}
async clickOnResetButton(): Promise<void> {
await BrowserActions.click(this.resetButton);
}
async clickOnIntField(): Promise<void> {
const toggleText = element(by.css('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"]'));
await BrowserActions.click(clearIcon);
}
async clickOnIntSaveIcon(): Promise<void> {
const saveIcon = element(by.css('button[data-automation-id="card-textitem-update-int"]'));
await BrowserActions.click(saveIcon);
}
async enterIntField(text): Promise<void> {
await BrowserActions.clearSendKeys(this.intField, text);
}
getIntFieldText(): Promise<string> {
const textField = element(by.css('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"]'));
return BrowserActions.getText(errorElement);
}
async clickOnFloatField(): Promise<void> {
const toggleText = element(by.css('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"]`));
await BrowserActions.click(clearIcon);
}
async clickOnFloatSaveIcon(): Promise<void> {
const saveIcon = element(by.css(`button[data-automation-id="card-textitem-update-float"]`));
await BrowserActions.click(saveIcon);
}
async enterFloatField(text): Promise<void> {
await BrowserActions.clearSendKeys(this.floatField, text);
}
getFloatFieldText(): Promise<string> {
const textField = element(by.css('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"]'));
return BrowserActions.getText(errorElement);
}
async setName(name: string): Promise<void> {
await BrowserActions.clearSendKeys(this.nameInputField, name);
}
async setValue(value): Promise<void> {
await BrowserActions.clearSendKeys(this.valueInputField, value);
}
async waitForOutput(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.consoleLog);
}
getOutputText(index: number): Promise<string> {
return BrowserActions.getText(this.consoleLog.all(by.css('p')).get(index));
}
async deletePairsValues(): Promise<void> {
await BrowserActions.click(this.deleteButton);
}
async clickSelectBox(): Promise<void> {
await this.selectDropdown.clickDropdown();
await this.selectDropdown.checkOptionsPanelIsDisplayed();
}
async checkboxClick(): Promise<void> {
await this.booleanCardBooleanItem.checkboxClick();
}
async checkBooleanLabelIsPresent(): Promise<void> {
await this.booleanCardBooleanItem.checkLabelIsPresent();
}
async selectValueFromComboBox(index): Promise<void> {
await this.selectDropdown.selectOptionFromIndex(index);
}
async disableEdit(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.editableSwitch);
const check = await this.editableSwitch.getAttribute('class');
if (check.indexOf('mat-checked') > -1) {
await BrowserActions.click(this.editableSwitch);
await expect(await this.editableSwitch.getAttribute('class')).not.toContain('mat-checked');
}
}
async getDateValue(): Promise<string> {
const dateValue = element(by.css('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"]'));
return dateTimeValue.getText();
}
async clearDateField(): Promise<void> {
const clearDateButton = element(by.css('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"]'));
await BrowserActions.click(clearDateButton);
}
async enableClearDate(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.clearDateSwitch);
const switchClass = await this.clearDateSwitch.getAttribute('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"]'));
await BrowserVisibility.waitUntilElementIsVisible(clearDateChecked);
}
}
async enableNoneOption(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.noneOptionSwitch);
const switchClass = await this.noneOptionSwitch.getAttribute('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"]'));
await BrowserVisibility.waitUntilElementIsVisible(noneOptionChecked);
}
}
async isErrorNotDisplayed(): Promise<boolean> {
const errorElement = element(by.css('mat-error[data-automation-id="card-textitem-error-int"]'));
try {
await BrowserVisibility.waitUntilElementIsNotVisible(errorElement);
return true;
} catch {
return false;
}
}
async getClickableValue(): Promise<string> {
return this.clickableField.getText();
}
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"]'));
await BrowserVisibility.waitUntilElementIsPresent(inputField);
await BrowserActions.clearSendKeys(inputField, text);
const save = element(by.css('[data-automation-id="card-textitem-update-click"]'));
await BrowserVisibility.waitUntilElementIsVisible(save);
await BrowserActions.click(save);
}
async hasCardViewConsoleLog(text: string): Promise<string> {
const cardViewConsole = element(by.cssContainingText('.app-console', text));
await BrowserVisibility.waitUntilElementIsVisible(cardViewConsole);
return cardViewConsole.getText();
}
async clearIntField(): Promise<void> {
await this.intField.clear();
}
}

View File

@@ -0,0 +1,69 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { BrowserActions, BrowserVisibility, TabsPage } from '@alfresco/adf-testing';
import { by, element } 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']"));
async getTotalNumberOfComments(): Promise<string> {
return BrowserActions.getText(this.numberOfComments);
}
async checkUserIconIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.commentUserIcon.first());
}
getUserName(position: number): Promise<string> {
return BrowserActions.getText(this.commentUserName.get(position));
}
getMessage(position: number): Promise<string> {
return BrowserActions.getText(this.commentMessage.get(position));
}
getTime(position: number): Promise<string> {
return BrowserActions.getText(this.commentTime.get(position));
}
async checkCommentInputIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.commentInput);
}
async addComment(comment: string): Promise<void> {
await BrowserActions.clearSendKeys(this.commentInput, comment);
await BrowserActions.click(this.addCommentButton);
}
async checkCommentsTabIsSelected(): Promise<void> {
await this.tabsPage.checkTabIsSelectedByTitle('Comments');
}
async checkCommentInputIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.commentInput);
}
}

View File

@@ -0,0 +1,694 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { DropActions, BrowserActions, BrowserVisibility, DateUtil, DocumentListPage, TogglePage, DropdownPage } from '@alfresco/adf-testing';
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';
import * as path from 'path';
export class ContentServicesPage {
columns = {
name: 'Display name',
size: 'Size',
nodeId: 'Node id',
createdBy: 'Created by',
created: 'Created'
};
contentList = new DocumentListPage(element.all(by.css('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 = 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'));
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"]'));
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"]')));
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}"`));
await BrowserVisibility.waitUntilElementIsVisible(actionButton);
}
async isContextActionEnabled(actionName): Promise<boolean> {
const actionButton = element(by.css(`button[data-automation-id="context-${actionName}"`));
await BrowserVisibility.waitUntilElementIsVisible(actionButton);
return actionButton.isEnabled();
}
getDocumentList(): DocumentListPage {
return this.contentList;
}
async closeActionContext(): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
}
async checkLockedIcon(content): Promise<void> {
return this.contentList.checkLockedIcon(content);
}
async checkUnlockedIcon(content): Promise<void> {
return this.contentList.checkUnlockedIcon(content);
}
async checkDeleteIsDisabled(content): Promise<void> {
await this.contentList.clickOnActionMenu(content);
await this.waitForContentOptions();
const disabledDelete = element(by.css(`button[data-automation-id*='DELETE'][disabled='true']`));
await BrowserVisibility.waitUntilElementIsVisible(disabledDelete);
}
async deleteContent(content): Promise<void> {
await this.contentList.clickOnActionMenu(content);
await this.waitForContentOptions();
await BrowserActions.click(this.deleteContentElement);
}
async clickDeleteOnToolbar(): Promise<void> {
await BrowserActions.click(this.deleteNodesButton);
}
async checkToolbarDeleteIsDisabled(): Promise<void> {
await BrowserActions.checkIsDisabled(this.deleteNodesButton);
}
async metadataContent(content): Promise<void> {
await this.contentList.clickOnActionMenu(content);
await this.waitForContentOptions();
await BrowserActions.click(this.metadataAction);
}
async versionManagerContent(content): Promise<void> {
await this.contentList.clickOnActionMenu(content);
await this.waitForContentOptions();
await BrowserActions.click(this.versionManagerAction);
}
async copyContent(content): Promise<void> {
await this.contentList.clickOnActionMenu(content);
await BrowserActions.click(this.copyContentElement);
}
async moveContent(content): Promise<void> {
await this.contentList.clickOnActionMenu(content);
await BrowserActions.click(this.moveContentElement);
}
async lockContent(content): Promise<void> {
await this.contentList.clickOnActionMenu(content);
await BrowserActions.click(this.lockContentElement);
}
async waitForContentOptions(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.copyContentElement);
await BrowserVisibility.waitUntilElementIsVisible(this.moveContentElement);
await BrowserVisibility.waitUntilElementIsVisible(this.deleteContentElement);
await BrowserVisibility.waitUntilElementIsVisible(this.downloadContent);
}
async clickFileHyperlink(fileName): Promise<void> {
const hyperlink = this.contentList.dataTablePage().getFileHyperlink(fileName);
await BrowserActions.click(hyperlink);
}
async checkFileHyperlinkIsEnabled(fileName): Promise<void> {
const hyperlink = this.contentList.dataTablePage().getFileHyperlink(fileName);
await BrowserVisibility.waitUntilElementIsVisible(hyperlink);
}
async clickHyperlinkNavigationToggle(): Promise<void> {
const hyperlinkToggle = element(by.cssContainingText('.mat-slide-toggle-content', 'Hyperlink navigation'));
await BrowserActions.click(hyperlinkToggle);
}
async enableDropFilesInAFolder(): Promise<void> {
await this.togglePage.enableToggle(this.multipleFileUploadToggle);
}
async disableDropFilesInAFolder(): Promise<void> {
await browser.executeScript('arguments[0].scrollIntoView()', this.multipleFileUploadToggle);
await this.togglePage.disableToggle(this.multipleFileUploadToggle);
}
async getElementsDisplayedId() {
return this.contentList.dataTablePage().getAllRowsColumnValues(this.columns.nodeId);
}
checkElementsDateSortedAsc(elements) {
let sorted = true;
let i = 0;
while (elements.length > 1 && sorted === true && i < (elements.length - 1)) {
const left = DateUtil.parse(elements[i], 'DD-MM-YY');
const right = DateUtil.parse(elements[i + 1], 'DD-MM-YY');
if (left > right) {
sorted = false;
}
i++;
}
return sorted;
}
checkElementsDateSortedDesc(elements) {
let sorted = true;
let i = 0;
while (elements.length > 1 && sorted === true && i < (elements.length - 1)) {
const left = DateUtil.parse(elements[i], 'DD-MM-YY');
const right = DateUtil.parse(elements[i + 1], 'DD-MM-YY');
if (left < right) {
sorted = false;
}
i++;
}
return sorted;
}
async checkRecentFileToBeShowed() {
await BrowserVisibility.waitUntilElementIsVisible(this.recentFiles);
}
async expandRecentFiles(): Promise<void> {
await this.checkRecentFileToBeShowed();
await this.checkRecentFileToBeClosed();
await BrowserActions.click(this.recentFilesClosed);
await this.checkRecentFileToBeOpened();
}
async closeRecentFiles(): Promise<void> {
await this.checkRecentFileToBeShowed();
await this.checkRecentFileToBeOpened();
await BrowserActions.click(this.recentFilesExpanded);
await this.checkRecentFileToBeClosed();
}
async checkRecentFileToBeClosed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.recentFilesClosed);
}
async checkRecentFileToBeOpened(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.recentFilesExpanded);
}
async getRecentFileIcon(): Promise<string> {
return BrowserActions.getText(this.recentFileIcon);
}
async checkDocumentListElementsAreDisplayed(): Promise<void> {
await this.checkAcsContainer();
await this.waitForTableBody();
}
async checkAcsContainer(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.uploadBorder);
}
async waitForTableBody(): Promise<void> {
await this.contentList.waitForTableBody();
}
async goToDocumentList(): Promise<void> {
const navigationBarPage = new NavigationBarPage();
await navigationBarPage.clickContentServicesButton();
}
async clickOnContentServices(): Promise<void> {
await BrowserActions.click(this.contentServices);
}
async numberOfResultsDisplayed(): Promise<number> {
return this.contentList.dataTablePage().numberOfRows();
}
async currentFolderName(): Promise<string> {
return BrowserActions.getText(this.currentFolder);
}
async getAllRowsNameColumn(): Promise<any> {
return this.contentList.getAllRowsColumnValues(this.columns.name);
}
async sortByName(sortOrder: string): Promise<any> {
await this.contentList.dataTable.sortByColumn(sortOrder, this.nameColumnHeader);
}
async sortByAuthor(sortOrder: string): Promise<any> {
await this.contentList.dataTable.sortByColumn(sortOrder, this.createdByColumnHeader);
}
async sortByCreated(sortOrder: string): Promise<any> {
await this.contentList.dataTable.sortByColumn(sortOrder, this.createdColumnHeader);
}
async sortAndCheckListIsOrderedByName(sortOrder: string): Promise<any> {
await this.sortByName(sortOrder);
return this.checkListIsSortedByNameColumn(sortOrder);
}
async checkListIsSortedByNameColumn(sortOrder: string): Promise<any> {
return this.contentList.dataTablePage().checkListIsSorted(sortOrder, this.columns.name);
}
async checkListIsSortedByCreatedColumn(sortOrder: string): Promise<any> {
return this.contentList.dataTablePage().checkListIsSorted(sortOrder, this.columns.created);
}
async checkListIsSortedByAuthorColumn(sortOrder: string): Promise<any> {
return this.contentList.dataTablePage().checkListIsSorted(sortOrder, this.columns.createdBy);
}
async checkListIsSortedBySizeColumn(sortOrder: string): Promise<any> {
return this.contentList.dataTablePage().checkListIsSorted(sortOrder, this.columns.size);
}
async sortAndCheckListIsOrderedByAuthor(sortOrder: string): Promise<any> {
await this.sortByAuthor(sortOrder);
return this.checkListIsSortedByAuthorColumn(sortOrder);
}
async sortAndCheckListIsOrderedByCreated(sortOrder: string): Promise<any> {
await this.sortByCreated(sortOrder);
return this.checkListIsSortedByCreatedColumn(sortOrder);
}
async doubleClickRow(nodeName): Promise<void> {
await this.contentList.doubleClickRow(nodeName);
}
async selectRow(nodeName): Promise<void> {
await this.contentList.selectRow(nodeName);
}
async clickOnCreateNewFolder(): Promise<void> {
await BrowserActions.click(this.createFolderButton);
}
async clickOnFavoriteButton(): Promise<void> {
await BrowserActions.click(this.favoriteButton);
}
async checkIsMarkedFavorite(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.markedFavorite);
}
async checkIsNotMarkedFavorite(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.notMarkedFavorite);
}
async clickOnEditFolder(): Promise<void> {
await BrowserActions.click(this.editFolderButton);
}
async isEditFolderButtonEnabled(): Promise<boolean> {
return this.editFolderButton.isEnabled();
}
async openCreateLibraryDialog(): Promise<void> {
await BrowserActions.click(this.createLibraryButton);
await this.createLibraryDialog.waitForDialogToOpen();
}
async createNewFolder(folderName: string): Promise<void> {
await this.clickOnCreateNewFolder();
await this.createFolderDialog.addFolderName(folderName);
await this.createFolderDialog.clickOnCreateUpdateButton();
}
async createAndOpenNewFolder(folderName: string): Promise<void> {
await this.createNewFolder(folderName);
await this.checkContentIsDisplayed(folderName);
await this.openFolder(folderName);
}
async openFolder(folderName: string): Promise<void> {
await this.doubleClickRow(folderName);
await this.checkDocumentListElementsAreDisplayed();
}
async checkContentIsDisplayed(content): Promise<void> {
await this.contentList.dataTablePage().checkContentIsDisplayed(this.columns.name, content);
}
async checkContentsAreDisplayed(content): Promise<void> {
for (let i = 0; i < content.length; i++) {
await this.checkContentIsDisplayed(content[i]);
}
}
async checkContentIsNotDisplayed(content): Promise<void> {
await this.contentList.dataTablePage().checkContentIsNotDisplayed(this.columns.name, content);
}
async deleteAndCheckFolderNotDisplayed(folderName: string): Promise<void> {
await this.deleteContent(folderName);
await this.checkContentIsNotDisplayed(folderName);
}
async deleteSubFolderUnderRoot(folderName: string, subFolderName: string): Promise<void> {
await this.goToDocumentList();
await this.openFolder(folderName);
await this.deleteAndCheckFolderNotDisplayed(subFolderName);
}
async getActiveBreadcrumb(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.activeBreadcrumb);
return this.activeBreadcrumb.getAttribute('title');
}
async uploadFile(fileLocation): Promise<void> {
await this.checkUploadButton();
await this.uploadFileButtonInput.sendKeys(path.resolve(path.join(browser.params.testConfig.main.rootPath, fileLocation)));
await this.checkUploadButton();
}
async uploadMultipleFile(files): Promise<void> {
await BrowserVisibility.waitUntilElementIsPresent(this.uploadMultipleFileButton);
let allFiles = path.resolve(path.join(browser.params.testConfig.main.rootPath, files[0]));
for (let i = 1; i < files.length; i++) {
allFiles = allFiles + '\n' + path.resolve(path.join(browser.params.testConfig.main.rootPath, files[i]));
}
await this.uploadMultipleFileButton.sendKeys(allFiles);
await BrowserVisibility.waitUntilElementIsPresent(this.uploadMultipleFileButton);
}
async uploadFolder(folderLocation: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsPresent(this.uploadFolderButton);
await this.uploadFolderButton.sendKeys(path.resolve(path.join(browser.params.testConfig.main.rootPath, folderLocation)));
}
async getSingleFileButtonTooltip(): Promise<string> {
await BrowserVisibility.waitUntilElementIsPresent(this.uploadFileButton);
return this.uploadFileButtonInput.getAttribute('title');
}
async getMultipleFileButtonTooltip(): Promise<string> {
await BrowserVisibility.waitUntilElementIsPresent(this.uploadMultipleFileButton);
return this.uploadMultipleFileButton.getAttribute('title');
}
async getFolderButtonTooltip(): Promise<string> {
await BrowserVisibility.waitUntilElementIsPresent(this.uploadFolderButton);
return this.uploadFolderButton.getAttribute('title');
}
async checkUploadButton(): Promise<void> {
await BrowserVisibility.waitUntilElementIsClickable(this.uploadFileButton);
}
async uploadButtonIsEnabled(): Promise<boolean> {
return this.uploadFileButton.isEnabled();
}
async getErrorMessage(): Promise<string> {
return BrowserActions.getText(this.errorSnackBar);
}
async enableInfiniteScrolling(): Promise<void> {
const infiniteScrollButton = element(by.cssContainingText('.mat-slide-toggle-content', 'Enable Infinite Scrolling'));
await BrowserActions.click(infiniteScrollButton);
}
async enableCustomPermissionMessage(): Promise<void> {
const customPermissionMessage = element(by.cssContainingText('.mat-slide-toggle-content', 'Enable custom permission message'));
await BrowserActions.click(customPermissionMessage);
}
async enableMediumTimeFormat(): Promise<void> {
const mediumTimeFormat = element(by.css('#enableMediumTimeFormat'));
await BrowserActions.click(mediumTimeFormat);
}
async enableThumbnails(): Promise<void> {
const thumbnailSlide = element(by.id('adf-thumbnails-upload-switch'));
await BrowserActions.click(thumbnailSlide);
}
async checkPaginationIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.emptyPagination);
}
async getDocumentListRowNumber(): Promise<number> {
const documentList = element(by.css('adf-upload-drag-area adf-document-list'));
await BrowserVisibility.waitUntilElementIsVisible(documentList);
return $$('adf-upload-drag-area adf-document-list .adf-datatable-row').count();
}
async checkColumnNameHeader(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.nameHeader);
}
async checkColumnSizeHeader(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.sizeHeader);
}
async checkColumnCreatedByHeader(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.createdByHeader);
}
async checkColumnCreatedHeader(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.createdHeader);
}
async checkDragAndDropDIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.dragAndDrop);
}
async dragAndDropFile(file: string): Promise<void> {
await this.checkDragAndDropDIsDisplayed();
await DropActions.dropFile(this.dragAndDrop, file);
}
async dragAndDropFolder(folderName: string): Promise<void> {
await this.checkDragAndDropDIsDisplayed();
await DropActions.dropFolder(this.dragAndDrop, folderName);
}
async checkLockIsDisplayedForElement(name): Promise<void> {
const lockButton = element(by.css(`div.adf-datatable-cell[data-automation-id="${name}"] button`));
await BrowserVisibility.waitUntilElementIsVisible(lockButton);
}
async getColumnValueForRow(file, columnName): Promise<string> {
return this.contentList.dataTablePage().getColumnValueForRow(this.columns.name, file, columnName);
}
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}"]`));
await BrowserVisibility.waitUntilElementIsVisible(row);
return row.getCssValue(styleName);
}
async checkEmptyFolderTextToBe(text): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.emptyFolder);
await expect(await this.emptyFolder.getText()).toContain(text);
}
async checkEmptyFolderImageUrlToContain(url): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.emptyFolderImage);
await expect(await this.emptyFolderImage.getAttribute('src')).toContain(url);
}
async checkEmptyRecentFileIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.emptyRecent);
}
async getRowIconImageUrl(fileName): Promise<string> {
const iconRow = element(by.css(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${fileName}"] img`));
await BrowserVisibility.waitUntilElementIsVisible(iconRow);
return iconRow.getAttribute('src');
}
async checkGridViewButtonIsVisible(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.gridViewButton);
}
async clickGridViewButton(): Promise<void> {
await this.checkGridViewButtonIsVisible();
await BrowserActions.click(this.gridViewButton);
}
async checkCardViewContainerIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.cardViewContainer);
}
async getCardElementShowedInPage(): Promise<number> {
await BrowserVisibility.waitUntilElementIsVisible(this.cardViewContainer);
return $$('div.app-document-list-container div.adf-datatable-card div.adf-cell-value img').count();
}
async getDocumentCardIconForElement(elementName): Promise<string> {
const elementIcon = element(by.css(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"] img`));
return elementIcon.getAttribute('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}"]`));
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`));
return BrowserActions.getText(elementSize);
}
async checkMenuIsShowedForElementIndex(elementIndex): Promise<void> {
const elementMenu = element(by.css(`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}"]`));
await BrowserActions.click(folderCard);
const folderSelected = element(by.css(`.adf-datatable-row.adf-is-selected div[data-automation-id="${folderName}"].adf-datatable-cell--image`));
await BrowserVisibility.waitUntilElementIsVisible(folderSelected);
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
}
async selectGridSortingFromDropdown(sortingOption): Promise<void> {
await this.sortingDropdown.selectDropdownOption(sortingOption);
}
async checkRowIsDisplayed(rowName): Promise<void> {
const row = this.contentList.dataTablePage().getCellElementByValue(this.columns.name, rowName);
await BrowserVisibility.waitUntilElementIsVisible(row);
}
async clickShareButton(): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.click(this.shareNodeButton);
}
async checkSelectedSiteIsDisplayed(siteName): Promise<void> {
await this.siteListDropdown.checkOptionIsSelected(siteName);
}
async selectSite(siteName: string): Promise<void> {
await this.siteListDropdown.selectDropdownOption(siteName);
}
async clickDownloadButton(): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.click(this.downloadButton);
}
async clickMultiSelectToggle() {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.click(this.multiSelectToggle);
}
async multiSelectToggleIsEnabled(): Promise<boolean> {
return this.multiSelectToggle.isEnabled();
}
async clickSelectAllCheckbox(): Promise<void> {
await BrowserActions.click(this.selectAllCheckbox);
}
getRowByName(rowName: string): ElementFinder {
return this.contentList.dataTable.getRow(this.columns.name, rowName);
}
async selectFolder(folderName: string): Promise<void> {
const folderSelected = element(by.css(`div[data-automation-id="${folderName}"] .adf-datatable-center-img-ie`));
await BrowserVisibility.waitUntilElementIsVisible(folderSelected);
await BrowserActions.click(folderSelected);
}
async selectFolderWithCommandKey(folderName: string): Promise<void> {
await browser.actions().sendKeys(protractor.Key.COMMAND).perform();
await this.selectRow(folderName);
await browser.actions().sendKeys(protractor.Key.NULL).perform();
}
async chooseSelectionMode(option: string): Promise<void> {
const dropdownPage = new DropdownPage(this.selectionModeDropdown);
await dropdownPage.selectDropdownOption(option);
}
async getItemSelected(): Promise<string> {
return BrowserActions.getArrayText(this.selectedNodesList);
}
async selectItemWithCheckbox(itemName: string): Promise<void> {
const item = element(by.css(`adf-datatable-row[aria-label="${itemName}"] mat-checkbox .mat-checkbox-input`));
await BrowserVisibility.waitUntilElementIsVisible(item);
await BrowserActions.clickScript(item);
}
async unSelectItemWithCheckbox(itemName: string): Promise<void> {
const item = element(by.css(`adf-datatable-row[aria-label="${itemName} selected"] mat-checkbox .mat-checkbox-input`));
await BrowserVisibility.waitUntilElementIsVisible(item);
await BrowserActions.click(item);
}
}

View File

@@ -0,0 +1,79 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { BrowserActions, BrowserVisibility, DataTableComponentPage, DropdownPage } from '@alfresco/adf-testing';
import { by, element } from 'protractor';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
const source = {
favorites: 'Favorites',
recent: 'Recent',
sharedLinks: 'Shared Links',
sites: 'Sites',
mySites: 'My Sites',
trashcan: 'Trashcan',
root: 'Root',
my: 'My',
shared: 'Shared'
};
const column = {
status: 'Status'
};
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"]')));
async waitForToolbarToBeVisible(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.toolbar);
}
async navigateToCustomSources(): Promise<void> {
await this.navigationBarPage.clickCustomSources();
await this.waitForToolbarToBeVisible();
}
async selectMySitesSourceType(): Promise<void> {
await this.selectModeDropdown.selectDropdownOption(source.mySites);
}
async selectFavoritesSourceType(): Promise<void> {
await this.selectModeDropdown.selectDropdownOption(source.favorites);
}
async selectSharedLinksSourceType(): Promise<void> {
await this.selectModeDropdown.selectDropdownOption(source.sharedLinks);
}
checkRowIsDisplayed(rowName: string): Promise<void> {
return this.dataTable.checkContentIsDisplayed('Name', rowName);
}
checkRowIsNotDisplayed(rowName: string): Promise<void> {
return this.dataTable.checkContentIsNotDisplayed('Name', rowName);
}
async getStatusCell(rowName: string): Promise<string> {
const cell = this.dataTable.getCellByRowContentAndColumn('Name', rowName, column.status);
return BrowserActions.getText(cell);
}
}

View File

@@ -0,0 +1,195 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { BrowserActions, BrowserVisibility, DataTableComponentPage, DropdownPage } from '@alfresco/adf-testing';
import { browser, by, element, ElementFinder, protractor } from 'protractor';
export class DataTablePage {
columns = {
id: 'Id',
name: 'Name',
createdBy: 'Created By',
json: 'Json'
};
data = {
copyClipboardDataTable: 'copyClipboard-datatable',
defaultTable: 'datatable'
};
dataTable: DataTableComponentPage;
multiSelect = element(by.css(`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`));
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']`));
selectModeDropdown = new DropdownPage(element(by.css(`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] + `']`)));
} else {
this.dataTable = new DataTableComponentPage(element(by.css(`div[data-automation-id='` + this.data.defaultTable + `']`)));
}
}
async insertFilter(filterText: string): Promise<void> {
const inputFilter = element(by.css(`#adf-datatable-filter-input`));
await BrowserActions.clearSendKeys(inputFilter, filterText);
}
async addRow(): Promise<void> {
await BrowserActions.click(this.addRowElement);
}
async replaceRows(id: string): Promise<void> {
const rowID = this.dataTable.getCellElementByValue(this.columns.id, id);
await BrowserVisibility.waitUntilElementIsVisible(rowID);
await BrowserActions.click(this.replaceRowsElement);
await BrowserVisibility.waitUntilElementIsNotVisible(rowID);
}
async replaceColumns(): Promise<void> {
await BrowserActions.click(this.replaceColumnsElement);
await BrowserVisibility.waitUntilElementIsNotVisible(this.createdOnColumn);
}
async clickMultiSelect(): Promise<void> {
await BrowserActions.click(this.multiSelect);
}
async clickReset(): Promise<void> {
await BrowserActions.click(this.reset);
}
async checkRowIsNotSelected(rowNumber: string): Promise<void> {
const isRowSelected = this.dataTable.getCellElementByValue(this.columns.id, rowNumber)
.element(by.xpath(`ancestor::adf-datatable-row[contains(@class, 'adf-datatable-row custom-row-style ng-star-inserted is-selected')]`));
await BrowserVisibility.waitUntilElementIsNotVisible(isRowSelected);
}
async checkNoRowIsSelected(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.selectedRowNumber);
}
async checkAllRows(): Promise<void> {
await BrowserActions.click(this.selectAll);
}
async checkRowIsChecked(rowNumber: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.getRowCheckbox(rowNumber));
}
async checkRowIsNotChecked(rowNumber: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.getRowCheckbox(rowNumber));
}
async getNumberOfSelectedRows(): Promise<number> {
return this.allSelectedRows.count();
}
async clickCheckbox(rowNumber: string): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
const checkbox = this.dataTable.getCellElementByValue(this.columns.id, rowNumber)
.element(by.xpath(`ancestor::adf-datatable-row[contains(@class, 'adf-datatable-row')]//mat-checkbox/label`));
await BrowserActions.click(checkbox);
}
async selectRow(rowNumber: string): Promise<void> {
const row = this.dataTable.getCellElementByValue(this.columns.id, rowNumber);
await BrowserActions.click(row);
}
async selectRowWithKeyboard(rowNumber: string): Promise<void> {
await browser.actions().sendKeys(protractor.Key.COMMAND).perform();
await this.selectRow(rowNumber);
await browser.actions().sendKeys(protractor.Key.NULL).perform();
}
async selectSelectionMode(selectionMode: string): Promise<void> {
await this.selectModeDropdown.selectDropdownOption(selectionMode);
}
getRowCheckbox(rowNumber: string): ElementFinder {
return this.dataTable.getCellElementByValue(this.columns.id, rowNumber).element(by.xpath(`ancestor::adf-datatable-row/div/mat-checkbox[contains(@class, 'mat-checkbox-checked')]`));
}
async getCopyContentTooltip(): Promise<string> {
return this.dataTable.getCopyContentTooltip();
}
async mouseOverNameColumn(name: string): Promise<void> {
await this.dataTable.mouseOverColumn(this.columns.name, name);
}
async mouseOverCreatedByColumn(name: string): Promise<void> {
await this.dataTable.mouseOverColumn(this.columns.createdBy, name);
}
async mouseOverIdColumn(name: string): Promise<void> {
await this.dataTable.mouseOverColumn(this.columns.id, name);
}
async mouseOverJsonColumn(rowNumber: number): Promise<void> {
const cell = this.dataTable.getCellByRowNumberAndColumnName(rowNumber - 1, this.columns.json);
await BrowserVisibility.waitUntilElementIsVisible(cell);
await browser.actions().mouseMove(cell).perform();
}
getDropTargetIdColumnCell(rowNumber: number): ElementFinder {
return this.dataTable.getCellByRowNumberAndColumnName(rowNumber - 1, this.columns.id);
}
getDropTargetIdColumnHeader(): ElementFinder {
return this.idColumnHeader;
}
async clickOnIdColumn(name: string): Promise<void> {
await this.dataTable.clickColumn(this.columns.id, name);
}
async clickOnJsonColumn(rowNumber: number): Promise<void> {
await BrowserActions.click(this.dataTable.getCellByRowNumberAndColumnName(rowNumber - 1, this.columns.json));
}
async clickOnNameColumn(name: string): Promise<void> {
await this.dataTable.clickColumn(this.columns.name, name);
}
async clickOnCreatedByColumn(name: string): Promise<void> {
await this.dataTable.clickColumn(this.columns.createdBy, name);
}
async pasteClipboard(): Promise<void> {
await this.pasteClipboardInput.clear();
await BrowserActions.click(this.pasteClipboardInput);
await this.pasteClipboardInput.sendKeys(protractor.Key.chord(protractor.Key.SHIFT, protractor.Key.INSERT));
}
async getClipboardInputText(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.pasteClipboardInput);
return this.pasteClipboardInput.getAttribute('value');
}
}

View File

@@ -0,0 +1,154 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { by, element, browser, protractor } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class CreateLibraryDialogPage {
libraryDialog = element(by.css('[role="dialog"]'));
libraryTitle = element(by.css('.adf-library-dialog>h2'));
libraryNameField = element(by.css('input[formcontrolname="title"]'));
libraryIdField = element(by.css('input[formcontrolname="id"]'));
libraryDescriptionField = element(by.css('textarea[formcontrolname="description"]'));
publicRadioButton = element(by.css('[data-automation-id="PUBLIC"]>label'));
privateRadioButton = element(by.css('[data-automation-id="PRIVATE"]>label'));
moderatedRadioButton = element(by.css('[data-automation-id="MODERATED"]>label'));
cancelButton = element(by.css('button[data-automation-id="cancel-library-id"]'));
createButton = element(by.css('button[data-automation-id="create-library-id"]'));
errorMessage = element(by.css('.mat-dialog-content .mat-error'));
errorMessages = element.all(by.css('.mat-dialog-content .mat-error'));
libraryNameHint = element(by.css('adf-library-dialog .mat-hint'));
async getSelectedRadio(): Promise<string> {
const radio = element(by.css('.mat-radio-button[class*="checked"]'));
return BrowserActions.getText(radio);
}
async waitForDialogToOpen(): Promise<void> {
await BrowserVisibility.waitUntilElementIsPresent(this.libraryDialog);
}
async waitForDialogToClose(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotPresent(this.libraryDialog);
}
async isDialogOpen(): Promise<any> {
return browser.isElementPresent(this.libraryDialog);
}
async getTitle(): Promise<string> {
return BrowserActions.getText(this.libraryTitle);
}
async getLibraryIdText(): Promise<string> {
return this.libraryIdField.getAttribute('value');
}
async isErrorMessageDisplayed(): Promise<boolean> {
return this.errorMessage.isDisplayed();
}
async getErrorMessage(): Promise<string> {
return BrowserActions.getText(this.errorMessage);
}
async getErrorMessages(position: number): Promise<string> {
return BrowserActions.getText(this.errorMessages.get(position));
}
async waitForLibraryNameHint(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.libraryNameHint);
}
async getLibraryNameHint(): Promise<string> {
return BrowserActions.getText(this.libraryNameHint);
}
async isNameDisplayed(): Promise<boolean> {
return this.libraryNameField.isDisplayed();
}
async isLibraryIdDisplayed(): Promise<boolean> {
return this.libraryIdField.isDisplayed();
}
async isDescriptionDisplayed(): Promise<boolean> {
return this.libraryDescriptionField.isDisplayed();
}
async isPublicDisplayed(): Promise<boolean> {
return this.publicRadioButton.isDisplayed();
}
async isModeratedDisplayed(): Promise<boolean> {
return this.moderatedRadioButton.isDisplayed();
}
async isPrivateDisplayed(): Promise<boolean> {
return this.privateRadioButton.isDisplayed();
}
async isCreateEnabled(): Promise<boolean> {
return this.createButton.isEnabled();
}
async isCancelEnabled(): Promise<boolean> {
return this.cancelButton.isEnabled();
}
async clickCreate(): Promise<void> {
await BrowserActions.click(this.createButton);
}
async clickCancel(): Promise<void> {
await BrowserActions.click(this.cancelButton);
}
async typeLibraryName(libraryName: string): Promise<void> {
await BrowserActions.clearSendKeys(this.libraryNameField, libraryName);
}
async typeLibraryId(libraryId: string): Promise<void> {
await BrowserActions.clearSendKeys(this.libraryIdField, libraryId);
}
async typeLibraryDescription(libraryDescription: string): Promise<void> {
await BrowserActions.clearSendKeys(this.libraryDescriptionField, libraryDescription);
}
async clearLibraryName(): Promise<void> {
await this.libraryNameField.clear();
await this.libraryNameField.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE);
}
async clearLibraryId(): Promise<void> {
await this.libraryIdField.clear();
await this.libraryIdField.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE);
}
async selectPublic(): Promise<void> {
await BrowserActions.click(this.publicRadioButton);
}
async selectPrivate(): Promise<void> {
await BrowserActions.click(this.privateRadioButton);
}
async selectModerated(): Promise<void> {
await BrowserActions.click(this.moderatedRadioButton);
}
}

View File

@@ -0,0 +1,90 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { by, element, ElementFinder } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class FolderDialogPage {
folderDialog = element(by.css('adf-folder-dialog'));
folderNameField = this.folderDialog.element(by.id('adf-folder-name-input'));
folderDescriptionField = this.folderDialog.element(by.id('adf-folder-description-input'));
createUpdateButton = this.folderDialog.element(by.id('adf-folder-create-button'));
cancelButton = this.folderDialog.element(by.id('adf-folder-cancel-button'));
folderTitle = this.folderDialog.element((by.css('h2.mat-dialog-title')));
validationMessage = this.folderDialog.element(by.css('div.mat-form-field-subscript-wrapper mat-hint span'));
async getDialogTitle(): Promise<string> {
return BrowserActions.getText(this.folderTitle);
}
async checkFolderDialogIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.folderDialog);
}
async checkFolderDialogIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.folderDialog);
}
async clickOnCreateUpdateButton(): Promise<void> {
await BrowserActions.click(this.createUpdateButton);
}
async checkCreateUpdateBtnIsDisabled(): Promise<void> {
await BrowserActions.checkIsDisabled(this.createUpdateButton);
}
async clickOnCancelButton(): Promise<void> {
await BrowserActions.click(this.cancelButton);
}
async addFolderName(folderName): Promise<void> {
await BrowserActions.clearSendKeys(this.folderNameField, folderName);
}
async addFolderDescription(folderDescription): Promise<void> {
await BrowserActions.clearSendKeys(this.folderDescriptionField, folderDescription);
}
async getFolderName(): Promise<string> {
return this.folderNameField.getAttribute('value');
}
async getValidationMessage(): Promise<string> {
return BrowserActions.getText(this.validationMessage);
}
async checkValidationMessageIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.validationMessage);
}
getFolderNameField(): ElementFinder {
return this.folderNameField;
}
getFolderDescriptionField(): ElementFinder {
return this.folderDescriptionField;
}
async checkCreateUpdateBtnIsEnabled(): Promise<void> {
await this.createUpdateButton.isEnabled();
}
async checkCancelBtnIsEnabled(): Promise<void> {
await this.cancelButton.isEnabled();
}
}

View File

@@ -0,0 +1,124 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { element, by } from 'protractor';
import { BrowserVisibility, TogglePage, BrowserActions, DateTimePickerPage } from '@alfresco/adf-testing';
import moment = require('moment');
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'));
async checkDialogIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.dialogTitle);
}
async clickUnShareFile() {
await this.togglePage.enableToggle(this.shareToggle);
}
async clickExpireToggle() {
await this.togglePage.enableToggle(this.expireToggle);
}
async clickConfirmationDialogCancelButton(): Promise<void> {
await BrowserActions.click(this.confirmationCancelButton);
}
async clickConfirmationDialogRemoveButton(): Promise<void> {
await BrowserActions.click(this.confirmationRemoveButton);
}
async checkShareLinkIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.shareLink);
}
async getShareLink(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.shareLink);
return this.shareLink.getAttribute('value');
}
async clickCloseButton(): Promise<void> {
await BrowserActions.click(this.closeButton);
}
async clickShareLinkButton(): Promise<void> {
await BrowserActions.click(this.copySharedLinkButton);
}
async shareToggleButtonIsChecked(): Promise<void> {
await BrowserVisibility.waitUntilElementIsPresent(this.shareToggleChecked);
}
async dialogIsClosed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsStale(this.shareDialog);
}
async clickDateTimePickerButton(): Promise<void> {
await this.dateTimePickerPage.clickDateTimePicker();
}
async calendarTodayDayIsDisabled(): Promise<void> {
const tomorrow = moment().add(1, 'days').format('D');
if (tomorrow !== '1') {
await this.dateTimePickerPage.checkCalendarTodayDayIsDisabled();
}
}
async setDefaultDay(): Promise<void> {
const tomorrow = moment().add(1, 'days').format('D');
await this.dateTimePickerPage.setDate(tomorrow);
}
async setDefaultHour(): Promise<void> {
await this.dateTimePickerPage.dateTime.setDefaultEnabledHour();
}
async setDefaultMinutes() {
await this.dateTimePickerPage.dateTime.setDefaultEnabledMinutes();
}
async dateTimePickerDialogIsClosed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsStale(element(by.css('mat-datetimepicker-content')));
}
async getExpirationDate(): Promise<string> {
return this.expirationDateInput.getAttribute('value');
}
async expirationDateInputHasValue(value): Promise<void> {
await BrowserVisibility.waitUntilElementHasValue(this.expirationDateInput, value);
}
async confirmationDialogIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.confirmationDialog);
}
}

View File

@@ -0,0 +1,165 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { element, by, 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 = by.css('mat-icon[class*="status--done"]');
cancelledStatusIcon = by.css('div[class*="status--cancelled"]');
errorStatusIcon = by.css('div[class*="status--error"] mat-icon');
errorTooltip = element(by.css('div.mat-tooltip'));
rowByRowName = by.xpath('ancestor::adf-file-uploading-list-row');
title = element(by.css('span[class*="upload-dialog__title"]'));
minimizeButton = element(by.css('mat-icon[title="Minimize"]'));
maximizeButton = element(by.css('mat-icon[title="Maximize"]'));
canUploadConfirmationTitle = element(by.css('.upload-dialog__confirmation--title'));
canUploadConfirmationDescription = element(by.css('.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"]'));
async clickOnCloseButton(): Promise<void> {
await this.checkCloseButtonIsDisplayed();
await BrowserActions.clickExecuteScript('footer[class*="upload-dialog__actions"] button[id="adf-upload-dialog-close"]');
}
async checkCloseButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.closeButton);
}
async dialogIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.dialog);
}
async dialogIsMinimized(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.minimizedDialog);
}
async dialogIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.dialog);
}
getRowsByName(content: string): ElementFinder {
return element.all(by.css(`div[class*='uploading-row'] span[title="${content}"]`)).first();
}
getRowByRowName(content: string) {
const rows = this.getRowsByName(content);
return rows.element(this.rowByRowName);
}
async fileIsUploaded(content: string): Promise<void> {
const row = await this.getRowByRowName(content);
await BrowserVisibility.waitUntilElementIsVisible(row.element(this.uploadedStatusIcon));
}
async fileIsError(content: string) {
const row = await this.getRowByRowName(content);
await BrowserVisibility.waitUntilElementIsVisible(row.element(this.errorStatusIcon));
}
async filesAreUploaded(content: string[]): Promise<void> {
for (let i = 0; i < content.length; i++) {
await this.fileIsUploaded(content[i]);
}
}
async fileIsNotDisplayedInDialog(content: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(element(by.css(`div[class*='uploading-row'] span[title="${content}"]`)));
}
async cancelUploads(): Promise<void> {
await BrowserActions.click(this.cancelUploadsElement);
}
async cancelProgress(): Promise<void> {
await BrowserActions.click(this.cancelUploadInProgressButton);
}
async checkCancelProgressIsVisible(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.cancelUploadInProgressButton);
}
async fileIsCancelled(content: string): Promise<void> {
const row = await this.getRowByRowName(content);
await BrowserVisibility.waitUntilElementIsVisible(row.element(this.cancelledStatusIcon), 10000);
}
async removeUploadedFile(content: string): Promise<void> {
const row = await this.getRowByRowName(content);
await BrowserVisibility.waitUntilElementIsVisible(row.element(this.uploadedStatusIcon));
const elementRow = await this.getRowByRowName(content);
await BrowserActions.click(elementRow.element(this.uploadedStatusIcon));
}
async getTitleText(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.title);
return this.title.getText();
}
async getConfirmationDialogTitleText(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.canUploadConfirmationTitle);
return this.canUploadConfirmationTitle.getText();
}
async getConfirmationDialogDescriptionText(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.canUploadConfirmationDescription);
return this.canUploadConfirmationDescription.getText();
}
async clickOnConfirmationDialogYesButton(): Promise<void> {
await BrowserActions.click(this.confirmationDialogYesButton);
}
async clickOnConfirmationDialogNoButton(): Promise<void> {
await BrowserActions.click(this.confirmationDialogNoButton);
}
async numberOfCurrentFilesUploaded(): Promise<string> {
const text = await this.getTitleText();
return text.split('Uploaded ')[1].split(' / ')[0];
}
async numberOfInitialFilesUploaded(): Promise<string> {
const text = await this.getTitleText();
return text.split('Uploaded ')[1].split(' / ')[1];
}
async minimizeUploadDialog(): Promise<void> {
await BrowserActions.click(this.minimizeButton);
}
async maximizeUploadDialog(): Promise<void> {
await BrowserActions.click(this.maximizeButton);
}
async displayTooltip(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(this.errorStatusIcon));
await browser.actions().mouseMove(element(this.errorStatusIcon)).perform();
}
async getTooltip(): Promise<string> {
return BrowserActions.getText(this.errorTooltip);
}
}

View File

@@ -0,0 +1,129 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { browser, by, element } 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"]'));
async enableMultipleFileUpload(): Promise<void> {
await browser.executeScript('arguments[0].scrollIntoView()', this.multipleFileUploadToggle);
await this.togglePage.enableToggle(this.multipleFileUploadToggle);
}
async disableMultipleFileUpload(): Promise<void> {
await browser.executeScript('arguments[0].scrollIntoView()', this.multipleFileUploadToggle);
await this.togglePage.disableToggle(this.multipleFileUploadToggle);
}
async enableFolderUpload(): Promise<void> {
await this.togglePage.enableToggle(this.uploadFolderToggle);
}
async checkFolderUploadToggleIsEnabled(): Promise<boolean> {
try {
const enabledFolderUpload = element(by.css('mat-slide-toggle[id="adf-folder-upload-switch"][class*="mat-checked"]'));
await BrowserVisibility.waitUntilElementIsVisible(enabledFolderUpload);
return true;
} catch {
return false;
}
}
async checkMultipleFileUploadToggleIsEnabled(): Promise<void> {
const enabledToggle = element(by.css('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"]'));
await BrowserVisibility.waitUntilElementIsVisible(enabledToggle);
}
async checkVersioningToggleIsEnabled(): Promise<void> {
const enabledToggle = element(by.css('mat-slide-toggle[id="adf-version-upload-switch"][class*="mat-checked"]'));
await BrowserVisibility.waitUntilElementIsVisible(enabledToggle);
}
async disableFolderUpload(): Promise<void> {
await this.togglePage.disableToggle(this.uploadFolderToggle);
}
async checkFolderUploadToggleIsNotEnabled(): Promise<boolean> {
try {
const inactiveToggleFolder = element(by.css('#adf-folder-upload-switch .mat-slide-toggle-label'));
await BrowserVisibility.waitUntilElementIsVisible(inactiveToggleFolder);
return true;
} catch {
return false;
}
}
async enableExtensionFilter(): Promise<void> {
await browser.executeScript('arguments[0].scrollIntoView()', this.extensionFilterToggle);
await this.togglePage.enableToggle(this.extensionFilterToggle);
}
async disableExtensionFilter(): Promise<void> {
await browser.executeScript('arguments[0].scrollIntoView()', this.extensionFilterToggle);
await this.togglePage.disableToggle(this.extensionFilterToggle);
}
async enableMaxSize(): Promise<void> {
await this.togglePage.enableToggle(this.maxSizeToggle);
}
async disableMaxSize(): Promise<void> {
await this.togglePage.disableToggle(this.maxSizeToggle);
}
async enableVersioning(): Promise<void> {
await this.togglePage.enableToggle(this.versioningToggle);
}
async disableVersioning(): Promise<void> {
await this.togglePage.disableToggle(this.versioningToggle);
}
async clickCheckboxDisableUpload(): Promise<void> {
await BrowserActions.click(this.disableUploadCheckbox);
}
async addExtension(extension: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.extensionAcceptedField);
await this.extensionAcceptedField.sendKeys(',' + extension);
}
async addMaxSize(size): Promise<void> {
await this.clearText();
await this.maxSizeField.sendKeys(size);
}
async clearText(): Promise<void> {
await BrowserActions.clearSendKeys(this.maxSizeField, '');
}
}

View File

@@ -0,0 +1,129 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { element, by, protractor } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class HeaderPage {
checkBox = element(by.cssContainingText('.mat-checkbox-label', 'Show menu button'));
headerColor = element(by.css('option[value="primary"]'));
titleInput = element(by.css('input[name="title"]'));
iconInput = element(by.css('input[placeholder="URL path"]'));
hexColorInput = element(by.css('input[placeholder="hex color code"]'));
logoHyperlinkInput = element(by.css('input[placeholder="Redirect URL"]'));
logoTooltipInput = element(by.css('input[placeholder="Tooltip text"]'));
positionStart = element.all(by.css('mat-radio-button[value="start"]')).first();
positionEnd = element.all(by.css('mat-radio-button[value="end"]')).first();
sideBarPositionRight = element(by.css('mat-sidenav.mat-drawer.mat-sidenav.mat-drawer-end'));
sideBarPositionLeft = element(by.css('mat-sidenav.mat-drawer.mat-sidenav'));
async checkShowMenuCheckBoxIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.checkBox);
}
async checkChooseHeaderColourIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.headerColor);
}
async checkChangeTitleIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.titleInput);
}
async checkChangeUrlPathIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.iconInput);
}
async clickShowMenuButton(): Promise<void> {
const checkBox = element(by.css('mat-checkbox'));
await BrowserActions.click(checkBox.get(0));
}
async changeHeaderColor(color: string): Promise<void> {
const headerColor = element(by.css('option[value="' + color + '"]'));
await BrowserActions.click(headerColor);
}
async checkAppTitle(name: string): Promise<void> {
const title = element(by.cssContainingText('.adf-app-title', name));
await BrowserVisibility.waitUntilElementIsVisible(title);
}
async addTitle(title: string): Promise<void> {
await BrowserActions.click(this.titleInput);
await BrowserActions.clearSendKeys(this.titleInput, title);
await this.titleInput.sendKeys(protractor.Key.ENTER);
}
async checkIconIsDisplayed(url: string): Promise<void> {
const icon = element(by.css('img[src="' + url + '"]'));
await BrowserVisibility.waitUntilElementIsVisible(icon);
}
async addIcon(url: string): Promise<void> {
await BrowserActions.click(this.iconInput);
await BrowserActions.clearSendKeys(this.iconInput, url);
await this.iconInput.sendKeys(protractor.Key.ENTER);
}
async checkHexColorInputIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.hexColorInput);
}
async checkLogoHyperlinkInputIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.logoHyperlinkInput);
}
async checkLogoTooltipInputIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.logoTooltipInput);
}
async addHexCodeColor(hexCode: string): Promise<void> {
await BrowserActions.click(this.hexColorInput);
await this.hexColorInput.sendKeys(hexCode);
await this.hexColorInput.sendKeys(protractor.Key.ENTER);
}
async addLogoHyperlink(hyperlink: string): Promise<void> {
await BrowserActions.click(this.logoHyperlinkInput);
await this.logoHyperlinkInput.sendKeys(hyperlink);
await this.logoHyperlinkInput.sendKeys(protractor.Key.ENTER);
}
async addLogoTooltip(tooltip: string): Promise<void> {
await BrowserActions.click(this.logoTooltipInput);
await this.logoTooltipInput.sendKeys(tooltip);
await this.logoTooltipInput.sendKeys(protractor.Key.ENTER);
}
async sideBarPositionStart(): Promise<void> {
await BrowserActions.click(this.positionStart);
}
async sideBarPositionEnd(): Promise<void> {
await BrowserActions.click(this.positionEnd);
}
async checkSidebarPositionStart(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.sideBarPositionLeft);
}
async checkSidebarPositionEnd(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.sideBarPositionRight);
}
}

View File

@@ -0,0 +1,47 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { browser, by, element, ElementFinder } from 'protractor';
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`));
}
async isCustomIconDisplayed(name: string) {
const present = await browser.isElementPresent(this.locateCustomIcon(name));
if (present) {
return this.locateCustomIcon(name).isDisplayed();
} else {
return false;
}
}
async isLigatureIconDisplayed(name: string) {
const present = await browser.isElementPresent(this.locateLigatureIcon(name));
if (present) {
return this.locateLigatureIcon(name).isDisplayed();
} else {
return false;
}
}
}

View File

@@ -0,0 +1,39 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { element, by, ElementFinder } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class InfinitePaginationPage {
rootElement: ElementFinder;
loadMoreButton;
constructor(rootElement = element.all(by.css('adf-infinite-pagination')).first()) {
this.rootElement = rootElement;
this.loadMoreButton = this.rootElement.element(by.css('button[data-automation-id="adf-infinite-pagination-button"]'));
}
async clickLoadMoreButton(): Promise<void> {
await BrowserActions.click(this.loadMoreButton);
}
async checkLoadMoreButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.loadMoreButton);
}
}

View File

@@ -0,0 +1,209 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { browser, by, element } from 'protractor';
import { TogglePage, BrowserActions, BrowserVisibility, LoginPage } from '@alfresco/adf-testing';
export class LoginShellPage {
loginURL = browser.baseUrl + '/login';
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'));
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'));
settingsIcon = element(by.cssContainingText('a[data-automation-id="settings"] mat-icon', 'settings'));
sidenavLayout = element(by.css(`[data-automation-id="sidenav-layout"]`));
async goToLoginPage(): Promise<void> {
await BrowserActions.getUrl(this.loginURL);
await this.waitForElements();
}
async waitForElements(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.txtUsername);
await BrowserVisibility.waitUntilElementIsVisible(this.txtPassword);
}
async enterUsername(username: string): Promise<void> {
await BrowserActions.clearSendKeys(this.txtUsername, username);
}
async enterPassword(password: string): Promise<void> {
await BrowserActions.clearSendKeys(this.txtPassword, password);
}
async clearUsername(): Promise<void> {
await BrowserActions.click(this.txtUsername);
await BrowserActions.clearWithBackSpace(this.txtUsername);
}
async clearPassword(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.txtPassword);
await BrowserActions.clearWithBackSpace(this.txtPassword);
}
async getUsernameTooltip(): Promise<string> {
return BrowserActions.getText(this.usernameError);
}
async getPasswordTooltip(): Promise<string> {
return BrowserActions.getText(this.passwordError);
}
async getLoginError(): Promise<string> {
return BrowserActions.getText(this.loginError);
}
async checkLoginImgURL(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.logoImg);
return this.logoImg.getAttribute('src');
}
async checkUsernameInactive(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.usernameInactive);
}
async checkPasswordInactive(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.passwordInactive);
}
async checkUsernameHighlighted(): Promise<void> {
await BrowserActions.click(this.adfLogo);
await BrowserVisibility.waitUntilElementIsVisible(this.usernameHighlighted);
}
async checkPasswordHighlighted(): Promise<void> {
await BrowserActions.click(this.adfLogo);
await BrowserVisibility.waitUntilElementIsVisible(this.passwordHighlighted);
}
async checkUsernameTooltipIsNotVisible(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.usernameError);
}
async checkPasswordTooltipIsNotVisible(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.passwordError);
}
async getSignInButtonIsEnabled(): Promise<boolean> {
return this.signInButton.isEnabled();
}
async clickSignInButton(): Promise<void> {
await BrowserActions.click(this.signInButton);
}
async clickSettingsIcon(): Promise<void> {
await BrowserActions.click(this.settingsIcon);
}
async showPassword(): Promise<void> {
await BrowserActions.click(this.showPasswordElement);
}
async hidePassword(): Promise<void> {
await BrowserActions.click(this.hidePasswordElement);
}
async getShownPassword(): Promise<string> {
return this.txtPassword.getAttribute('value');
}
async checkPasswordIsHidden(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.txtPassword);
}
async checkRememberIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.rememberMe);
}
async checkRememberIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.rememberMe);
}
async checkNeedHelpIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.needHelp);
}
async checkNeedHelpIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.needHelp);
}
async checkRegisterDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.register);
}
async checkRegisterIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.register);
}
async enableFooter(): Promise<void> {
await this.togglePage.enableToggle(this.footerSwitch);
}
async disableFooter(): Promise<void> {
await this.togglePage.disableToggle(this.footerSwitch);
}
async disableRememberMe(): Promise<void> {
await this.togglePage.disableToggle(this.rememberMeSwitch);
}
async enableSuccessRouteSwitch(): Promise<void> {
await this.togglePage.enableToggle(this.successRouteSwitch);
}
async enableLogoSwitch(): Promise<void> {
await this.togglePage.enableToggle(this.logoSwitch);
}
async enterSuccessRoute(route: string): Promise<void> {
await BrowserActions.clearSendKeys(this.successRouteTxt, route);
}
async enterLogo(logo: string): Promise<void> {
await BrowserActions.clearSendKeys(this.logoTxt, logo);
}
async login(username: string, password: string): Promise<void> {
await this.loginSSOPage.login(username, password);
}
}

View File

@@ -0,0 +1,28 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { by, element, ElementFinder } from 'protractor';
import { BrowserVisibility } from '@alfresco/adf-testing';
export class LogoutPage {
logoutSection: ElementFinder = element(by.css('div[data-automation-id="adf-logout-section"]'));
async checkLogoutSectionIsDisplayed() {
await BrowserVisibility.waitUntilElementIsVisible(this.logoutSection);
}
}

View File

@@ -0,0 +1,243 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { by, element, Key, protractor } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class MetadataViewPage {
title = element(by.css(`div[info-drawer-title]`));
expandedAspect = element(by.css(`mat-expansion-panel-header[aria-expanded='true']`));
aspectTitle = by.css(`mat-panel-title`);
name = element(by.css(`[data-automation-id='card-textitem-value-name']`));
creator = element(by.css(`[data-automation-id='card-textitem-value-createdByUser.displayName']`));
createdDate = element(by.css(`span[data-automation-id='card-dateitem-createdAt'] span`));
modifier = element(by.css(`[data-automation-id='card-textitem-value-modifiedByUser.displayName']`));
modifiedDate = element(by.css(`span[data-automation-id='card-dateitem-modifiedAt'] span`));
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'));
closeButton = element(by.cssContainingText('button.mat-button span', 'Close'));
displayAspect = element(by.css(`input[placeholder='Display Aspect']`));
applyAspect = element(by.cssContainingText(`button span.mat-button-wrapper`, 'Apply Aspect'));
saveMetadataButton = element(by.css(`[data-automation-id='save-metadata']`));
resetMetadataButton = element(by.css(`[data-automation-id='reset-metadata']`));
async getTitle(): Promise<string> {
return BrowserActions.getText(this.title);
}
async getExpandedAspectName(): Promise<string> {
return BrowserActions.getText(this.expandedAspect.element(this.aspectTitle));
}
async getName(): Promise<string> {
return BrowserActions.getInputValue(this.name);
}
async getCreator(): Promise<string> {
return BrowserActions.getInputValue(this.creator);
}
async getCreatedDate(): Promise<string> {
return BrowserActions.getText(this.createdDate);
}
async getModifier(): Promise<string> {
return BrowserActions.getInputValue(this.modifier);
}
async getModifiedDate(): Promise<string> {
return BrowserActions.getText(this.modifiedDate);
}
async getMimetypeName(): Promise<string> {
return BrowserActions.getInputValue(this.mimetypeName);
}
async getSize(): Promise<string> {
return BrowserActions.getInputValue(this.size);
}
async getDescription(): Promise<string> {
return BrowserActions.getInputValue(this.description);
}
async getAuthor(): Promise<string> {
return BrowserActions.getInputValue(this.author);
}
async getTitleProperty(): Promise<string> {
return BrowserActions.getText(this.titleProperty);
}
async editIconIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.editIcon);
}
async editIconIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.editIcon);
}
async editIconClick(): Promise<void> {
await BrowserActions.clickExecuteScript('button[data-automation-id="meta-data-card-toggle-edit"]');
}
async informationButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsClickable(this.informationButton);
}
async informationButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.informationButton);
}
async clickOnInformationButton(): Promise<void> {
await BrowserActions.click(this.informationButton);
}
async getInformationButtonText(): Promise<string> {
return BrowserActions.getText(this.informationSpan);
}
async getInformationIconText(): Promise<string> {
return BrowserActions.getText(this.informationIcon);
}
async clickOnPropertiesTab(): Promise<void> {
const propertiesTab = element(by.cssContainingText(`.adf-info-drawer-layout-content div.mat-tab-labels div .mat-tab-label-content`, `Properties`));
await BrowserActions.click(propertiesTab);
}
async getEditIconTooltip(): Promise<string> {
return this.editIcon.getAttribute('title');
}
async editPropertyIconIsDisplayed(propertyName: string) {
const editPropertyIcon = element(by.css('[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"]'));
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 + '"]'));
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"]'));
await BrowserActions.clearSendKeys(presetField, text.toString());
await presetField.sendKeys(protractor.Key.ENTER);
const applyButton = element(by.css('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"]'));
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 + '"]'));
return BrowserActions.getInputValue(textField);
}
async getPropertyIconTooltip(propertyName: string): Promise<string> {
const editPropertyIcon = element(by.css('[data-automation-id="header-' + propertyName + '"] .adf-textitem-edit-icon'));
return editPropertyIcon.getAttribute('title');
}
async clickMetadataGroup(groupName: string): Promise<void> {
const group = element(by.css('mat-expansion-panel[data-automation-id="adf-metadata-group-' + 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 + '"]'));
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 + '"]'));
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'));
await BrowserVisibility.waitUntilElementIsVisible(group);
await expect(await group.getAttribute('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'));
await BrowserVisibility.waitUntilElementIsPresent(group);
await expect(await group.getAttribute('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'));
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 + '"]'));
await BrowserVisibility.waitUntilElementIsVisible(property);
}
async checkPropertyIsNotVisible(propertyName: string, type: string): Promise<void> {
const property = element(by.css('div[data-automation-id="card-' + type + '-label-' + propertyName + '"]'));
await BrowserVisibility.waitUntilElementIsNotVisible(property);
}
async clickCloseButton(): Promise<void> {
await BrowserActions.click(this.closeButton);
}
async typeAspectName(aspectName): Promise<void> {
await BrowserActions.clearSendKeys(this.displayAspect, aspectName);
}
async clickApplyAspect(): Promise<void> {
await BrowserActions.click(this.applyAspect);
}
async clickSaveMetadata(): Promise<void> {
await BrowserActions.click(this.saveMetadataButton);
}
async clickResetMetadata(): Promise<void> {
await BrowserActions.click(this.resetMetadataButton);
}
}

View File

@@ -0,0 +1,245 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AppListCloudPage, BrowserActions, BrowserVisibility } from '@alfresco/adf-testing';
import { browser, by, element, 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"]'));
languageMenuButton = element(by.css('button[data-automation-id="language-menu-button"]'));
appTitle = element(by.css('.adf-app-title'));
menuButton = element(by.css('button[data-automation-id="adf-menu-icon"]'));
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"]'));
async clickNavigationBarItem(title: string): Promise<void> {
const menu = element(by.css(`.app-sidenav-link[data-automation-id="${title}"]`));
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.click(menu);
}
async clickHomeButton(): Promise<void> {
await this.clickNavigationBarItem('Home');
}
async clickContentServicesButton(): Promise<void> {
await this.clickNavigationBarItem('Content Services');
}
async clickCardViewButton(): Promise<void> {
await this.clickNavigationBarItem('CardView');
}
async clickHeaderDataButton(): Promise<void> {
await this.clickNavigationBarItem('Header Data');
}
async clickTaskListButton(): Promise<void> {
await this.clickNavigationBarItem('Task List');
}
async clickProcessCloudButton() {
await this.clickNavigationBarItem('Process Cloud');
await BrowserVisibility.waitUntilElementIsVisible(this.linkMenuChildrenContainer);
}
async navigateToProcessServicesCloudPage(): Promise<AppListCloudPage> {
await this.clickProcessCloudButton();
await BrowserActions.click(this.processServicesCloudHomeButton);
await BrowserVisibility.waitUntilElementIsNotPresent(this.linkMenuChildrenContainer);
return new AppListCloudPage();
}
async navigateToFormCloudPage(): Promise<void> {
await this.clickProcessCloudButton();
await BrowserActions.click(this.formButton);
await BrowserVisibility.waitUntilElementIsNotPresent(this.linkMenuChildrenContainer);
}
async navigateToPeopleGroupCloudPage(): Promise<void> {
await this.clickProcessCloudButton();
await BrowserActions.click(this.peopleGroupCloudButton);
await BrowserVisibility.waitUntilElementIsNotPresent(this.linkMenuChildrenContainer);
}
async clickProcessServicesButton() {
await this.clickNavigationBarItem('Process Services');
await BrowserVisibility.waitUntilElementIsVisible(this.linkMenuChildrenContainer);
}
async navigateToProcessServicesPage(): Promise<ProcessServicesPage> {
await this.clickProcessServicesButton();
await BrowserActions.click(this.processServicesNestedButton);
await BrowserVisibility.waitUntilElementIsNotPresent(this.linkMenuChildrenContainer);
return new ProcessServicesPage();
}
async navigateToProcessServicesFormPage(): Promise<void> {
await this.clickProcessServicesButton();
await BrowserActions.click(this.formButton);
await BrowserVisibility.waitUntilElementIsNotPresent(this.linkMenuChildrenContainer);
}
async clickLoginButton(): Promise<void> {
await this.clickNavigationBarItem('Login');
}
async clickTrashcanButton(): Promise<void> {
await this.clickNavigationBarItem('Trashcan');
}
async clickCustomSources(): Promise<void> {
await this.clickNavigationBarItem('Custom Sources');
}
async clickDataTable(): Promise<void> {
await this.clickNavigationBarItem('Datatable');
await BrowserVisibility.waitUntilElementIsVisible(this.linkMenuChildrenContainer);
}
async navigateToDatatable(): Promise<void> {
await this.clickDataTable();
await BrowserActions.click(this.dataTableNestedButton);
await BrowserVisibility.waitUntilElementIsNotPresent(this.linkMenuChildrenContainer);
}
async navigateToDragAndDropDatatable(): Promise<void> {
await this.clickDataTable();
await BrowserActions.click(this.dataTableDragAndDropButton);
await BrowserVisibility.waitUntilElementIsNotPresent(this.linkMenuChildrenContainer);
}
async navigateToCopyContentDatatable(): Promise<void> {
await this.clickDataTable();
await BrowserActions.click(this.dataTableCopyContentButton);
await BrowserVisibility.waitUntilElementIsNotPresent(this.linkMenuChildrenContainer);
}
async clickTagButton(): Promise<void> {
await this.clickNavigationBarItem('Tag');
}
async clickSocialButton(): Promise<void> {
await this.clickNavigationBarItem('Social');
}
async clickSettingsButton(): Promise<void> {
await this.clickNavigationBarItem('Settings');
}
async clickConfigEditorButton(): Promise<void> {
await this.clickNavigationBarItem('Configuration Editor');
}
async clickOverlayViewerButton(): Promise<void> {
await this.clickNavigationBarItem('Overlay Viewer');
}
async clickTreeViewButton(): Promise<void> {
await this.clickNavigationBarItem('Tree View');
}
async clickIconsButton(): Promise<void> {
await this.clickNavigationBarItem('Icons');
}
async clickAboutButton(): Promise<void> {
await this.clickNavigationBarItem('About');
}
async clickLogoutButton(): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.clickExecuteScript('.app-sidenav-link[adf-logout]');
}
async clickThemeButton(): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.click(this.themeButton);
await BrowserVisibility.waitUntilElementIsVisible(this.themeMenuContent);
}
async clickOnSpecificThemeButton(themeName): Promise<void> {
const themeElement = element(by.css(`button[data-automation-id="${themeName}"]`));
await BrowserActions.click(themeElement);
await BrowserVisibility.waitUntilElementIsNotPresent(this.linkMenuChildrenContainer);
}
async openContentServicesFolder(folderId): Promise<void> {
await BrowserActions.getUrl(`${browser.baseUrl}/files/${folderId}`);
}
async openLanguageMenu(): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.click(this.languageMenuButton);
await BrowserVisibility.waitUntilElementIsVisible(this.appTitle);
}
async chooseLanguage(language): Promise<void> {
const buttonLanguage = element(by.xpath(`//adf-language-menu//button[contains(text(), '${language}')]`));
await BrowserActions.click(buttonLanguage);
await BrowserVisibility.waitUntilElementIsNotPresent(this.linkMenuChildrenContainer);
}
async checkMenuButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.menuButton);
}
async checkMenuButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.menuButton);
}
async checkToolbarColor(color: string): Promise<void> {
const toolbarColor = element(by.css(`mat-toolbar[class*="mat-${color}"]`));
await BrowserVisibility.waitUntilElementIsVisible(toolbarColor);
}
async clickAppLogo(logoTitle: string): Promise<void> {
const appLogo = element(by.css('a[title="' + logoTitle + '"]'));
await BrowserActions.click(appLogo);
}
async clickAppLogoText(): Promise<void> {
await BrowserActions.click(this.appTitle);
}
async checkLogoTooltip(logoTooltipTitle: string): Promise<void> {
const logoTooltip = element(by.css('a[title="' + logoTooltipTitle + '"]'));
await BrowserVisibility.waitUntilElementIsVisible(logoTooltip);
}
async openViewer(nodeId: string): Promise<void> {
await BrowserActions.getUrl(browser.baseUrl + `/files(overlay:files/${nodeId}/view`);
}
async goToSite(site): Promise<void> {
await BrowserActions.getUrl(browser.baseUrl + `/files/${site.entry.guid}/display/list`);
}
async scrollTo(el: ElementFinder): Promise<void> {
await browser.executeScript(`return arguments[0].scrollTop = arguments[1].offsetTop`, this.linkListContainer.getWebElement(), el.getWebElement());
}
}

View File

@@ -0,0 +1,102 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { element, by, 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"]'));
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"]')));
async checkNotifyContains(message): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element.all(by.cssContainingText('simple-snack-bar', message)).first());
}
async goToNotificationsPage(): Promise<void> {
await BrowserActions.click(this.notificationsPage);
}
getConfigObject(): Promise<string> {
return BrowserActions.getText(this.notificationConfig);
}
async isNotificationSnackBarDisplayed(): Promise<boolean> {
return this.snackbarPage.isNotificationSnackBarDisplayed();
}
async getSnackBarMessage(): Promise<string> {
return this.snackbarPage.getSnackBarMessage();
}
async waitForSnackBarToClose(): Promise<void> {
await this.snackbarPage.waitForSnackBarToClose();
}
async enterMessageField(text: string): Promise<void> {
await BrowserActions.clearSendKeys(this.messageField, text);
}
async enterDurationField(time: number): Promise<void> {
await BrowserActions.clearSendKeys(this.durationField, time.toString());
}
async selectHorizontalPosition(selectItem: string): Promise<void> {
await this.horizontalPositionDropdown.selectDropdownOption(selectItem);
}
async selectVerticalPosition(selectItem: string): Promise<void> {
await this.verticalPositionDropdown.selectDropdownOption(selectItem);
}
async selectDirection(selectItem: string): Promise<void> {
await this.directionDropdown.selectDropdownOption(selectItem);
}
async clickNotificationButton(): Promise<void> {
const button = element(by.css('button[data-automation-id="notification-custom-config-button"]'));
await BrowserActions.click(button);
}
async checkActionEvent(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.actionOutput);
}
async clickActionToggle(): Promise<void> {
await BrowserActions.click(this.actionToggle);
}
async clickActionButton(): Promise<void> {
await browser.executeScript(`document.querySelector("simple-snack-bar > div > button").click();`);
}
async clearMessage(): Promise<void> {
await BrowserActions.click(this.messageField);
await BrowserActions.clearWithBackSpace(this.messageField);
}
}

View File

@@ -0,0 +1,62 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { BrowserActions, BrowserVisibility, DocumentListPage } from '@alfresco/adf-testing';
import { element, by } from 'protractor';
export class TrashcanPage {
contentList = new DocumentListPage(element(by.css('adf-document-list')));
rows = by.css('adf-document-list div[class*="adf-datatable-body"] 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']`));
async numberOfResultsDisplayed(): Promise<number> {
return element.all(this.rows).count();
}
async waitForTableBody(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.tableBody);
}
async waitForPagination(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.pagination);
}
async checkTrashcanIsEmpty(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.emptyTrashcan);
}
getDocumentList(): DocumentListPage {
return this.contentList;
}
async clickRestore(): Promise<void> {
await BrowserActions.click(this.restoreButton);
}
async checkRestoreButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.restoreButton);
}
async checkRestoreButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.restoreButton);
}
}

View File

@@ -0,0 +1,186 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as path from 'path';
import { BrowserActions, BrowserVisibility, TogglePage } from '@alfresco/adf-testing';
import { browser, by, element } from 'protractor';
export class VersionManagePage {
togglePage = new TogglePage();
showNewVersionButton = element(by.id('adf-show-version-upload-button'));
uploadNewVersionInput = element(by.css('adf-upload-version-button input[data-automation-id="upload-single-file"]'));
uploadNewVersionButton = element(by.css('adf-upload-version-button'));
uploadNewVersionContainer = element(by.id('adf-new-version-uploader-container'));
cancelButton = element(by.id('adf-new-version-cancel'));
majorRadio = element(by.id('adf-new-version-major'));
minorRadio = element(by.id('adf-new-version-minor'));
commentText = element(by.id('adf-new-version-text-area'));
readOnlySwitch = element(by.id('adf-version-manager-switch-readonly'));
downloadSwitch = element(by.id('adf-version-manager-switch-download'));
commentsSwitch = element(by.id('adf-version-manager-switch-comments'));
async checkUploadNewVersionsButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.showNewVersionButton);
}
async checkCancelButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.cancelButton);
}
async uploadNewVersionFile(fileLocation: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsPresent(this.uploadNewVersionInput);
await this.uploadNewVersionInput.sendKeys(path.resolve(path.join(browser.params.testConfig.main.rootPath, fileLocation)));
await BrowserVisibility.waitUntilElementIsVisible(this.showNewVersionButton);
}
async getFileVersionName(version: string): Promise<string> {
const fileElement = element(by.css(`[id="adf-version-list-item-name-${version}"]`));
return BrowserActions.getText(fileElement);
}
async checkFileVersionExist(version: string): Promise<void> {
const fileVersion = element(by.id(`adf-version-list-item-version-${version}`));
await BrowserVisibility.waitUntilElementIsVisible(fileVersion);
}
async checkFileVersionNotExist(version: string): Promise<void> {
const fileVersion = element(by.id(`adf-version-list-item-version-${version}`));
await BrowserVisibility.waitUntilElementIsNotVisible(fileVersion);
}
async getFileVersionComment(version: string): Promise<string> {
const fileComment = element(by.id(`adf-version-list-item-comment-${version}`));
return BrowserActions.getText(fileComment);
}
async getFileVersionDate(version: string): Promise<string> {
const fileDate = element(by.id(`adf-version-list-item-date-${version}`));
return BrowserActions.getText(fileDate);
}
async enterCommentText(text: string): Promise<void> {
await BrowserActions.clearSendKeys(this.commentText, text);
}
async clickMajorChange(): Promise<void> {
const radioMajor = element(by.id(`adf-new-version-major`));
await BrowserActions.click(radioMajor);
}
async clickMinorChange(): Promise<void> {
const radioMinor = element(by.id(`adf-new-version-minor`));
await BrowserActions.click(radioMinor);
}
/**
* disables readOnly
*/
async disableReadOnly(): Promise<void> {
await this.togglePage.disableToggle(this.readOnlySwitch);
}
/**
* enables readOnly
*/
async enableReadOnly(): Promise<void> {
await this.togglePage.enableToggle(this.readOnlySwitch);
}
/**
* disables download
*/
async disableDownload(): Promise<void> {
await this.togglePage.disableToggle(this.downloadSwitch);
}
/**
* enables download
*/
async enableDownload(): Promise<void> {
await this.togglePage.enableToggle(this.downloadSwitch);
}
/**
*
* disables comments
*/
async disableComments(): Promise<void> {
await this.togglePage.disableToggle(this.commentsSwitch);
}
/**
* enables comments
*/
async enableComments(): Promise<void> {
await this.togglePage.enableToggle(this.commentsSwitch);
}
async clickActionButton(version: string): Promise<void> {
await BrowserActions.click(element(by.id(`adf-version-list-action-menu-button-${version}`)));
await BrowserVisibility.waitUntilElementIsVisible(element(by.css('.cdk-overlay-container .mat-menu-content')));
}
async clickAcceptConfirm(): Promise<void> {
await BrowserActions.click(element(by.id(`adf-confirm-accept`)));
}
async clickCancelConfirm(): Promise<void> {
await BrowserActions.click(element(by.id(`adf-confirm-cancel`)));
}
async closeActionsMenu(): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
}
async closeDisabledActionsMenu(): Promise<void> {
const container = element(by.css('div.cdk-overlay-backdrop.cdk-overlay-transparent-backdrop.cdk-overlay-backdrop-showing'));
await BrowserActions.closeDisabledMenu();
await BrowserVisibility.waitUntilElementIsNotVisible(container);
}
async downloadFileVersion(version: string): Promise<void> {
await this.clickActionButton(version);
const downloadButton = element(by.id(`adf-version-list-action-download-${version}`));
await BrowserActions.click(downloadButton);
await BrowserVisibility.waitUntilElementIsNotVisible(downloadButton);
}
async deleteFileVersion(version: string): Promise<void> {
await this.clickActionButton(version);
const deleteButton = element(by.id(`adf-version-list-action-delete-${version}`));
await BrowserActions.click(deleteButton);
}
async restoreFileVersion(version: string): Promise<void> {
await this.clickActionButton(version);
const restoreButton = element(by.id(`adf-version-list-action-restore-${version}`));
await BrowserActions.click(restoreButton);
}
async checkActionsArePresent(version: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(element(by.id(`adf-version-list-action-download-${version}`)));
await BrowserVisibility.waitUntilElementIsVisible(element(by.id(`adf-version-list-action-delete-${version}`)));
await BrowserVisibility.waitUntilElementIsVisible(element(by.id(`adf-version-list-action-restore-${version}`)));
}
async closeVersionDialog(): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserVisibility.waitUntilElementIsNotVisible(this.uploadNewVersionContainer);
}
}