[ADF-4059] - Move Copy Folders with Load more- take2 (#4562)

* C260132 automated

* debbugging

* in progress

* done

* review comments.

* in progress

* Update content-node-selector-dialog.page.ts

* fix the locators

* code review comments

* removed the datatablecomponentPage call directly from hte test.
This commit is contained in:
gmandakini
2019-04-10 19:41:16 +01:00
committed by Eugenio Romano
parent 558ee4c031
commit 1bda3c914c
11 changed files with 511 additions and 175 deletions

View File

@@ -0,0 +1,100 @@
/*!
* @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 { DocumentListPage } from '../pages/document-list.page';
import { BrowserVisibility } from '../../core/browser-visibility';
export class ContentNodeSelectorDialogPage {
dialog = element(by.css(`adf-content-node-selector`));
header = this.dialog.element(by.css(`header[data-automation-id='content-node-selector-title']`));
searchInputElement = this.dialog.element(by.css(`input[data-automation-id='content-node-selector-search-input']`));
searchLabel = this.searchInputElement.element(by.xpath("ancestor::div[@class='mat-form-field-infix']/span/label"));
siteListDropdown = this.dialog.element(by.css(`mat-select[data-automation-id='site-my-files-option']`));
cancelButton = element(by.css(`button[data-automation-id='content-node-selector-actions-cancel']`));
moveCopyButton = element(by.css(`button[data-automation-id='content-node-selector-actions-choose']`));
contentList = new DocumentListPage(this.dialog);
checkDialogIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.dialog);
return this;
}
checkDialogIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotOnPage(this.dialog);
return this;
}
getDialogHeaderText() {
BrowserVisibility.waitUntilElementIsVisible(this.header);
return this.header.getText();
}
checkSearchInputIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.searchInputElement);
return this;
}
getSearchLabel() {
BrowserVisibility.waitUntilElementIsVisible(this.searchLabel);
return this.searchLabel.getText();
}
checkSelectedSiteIsDisplayed(siteName) {
BrowserVisibility.waitUntilElementIsVisible(this.siteListDropdown.element(by.cssContainingText('.mat-select-value-text span', siteName)));
}
checkCancelButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.cancelButton);
}
clickCancelButton() {
BrowserVisibility.waitUntilElementIsVisible(this.cancelButton);
return this.cancelButton.click();
}
checkMoveCopyButtonIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.moveCopyButton);
}
getMoveCopyButtonText() {
BrowserVisibility.waitUntilElementIsVisible(this.moveCopyButton);
return this.moveCopyButton.getText();
}
clickMoveCopyButton() {
BrowserVisibility.waitUntilElementIsVisible(this.moveCopyButton);
return this.moveCopyButton.click();
}
numberOfResultsDisplayed() {
return this.contentList.dataTablePage().numberOfRows();
}
typeIntoNodeSelectorSearchField(text) {
BrowserVisibility.waitUntilElementIsVisible(this.searchInputElement);
this.searchInputElement.sendKeys(text);
}
clickContentNodeSelectorResult(name) {
this.contentList.dataTablePage().clickRowByContent(name);
}
contentListPage() {
return this.contentList;
}
}

View File

@@ -15,6 +15,4 @@
* limitations under the License.
*/
export class ExamplePage {
}
export * from './content-node-selector-dialog.page';

View File

@@ -0,0 +1,91 @@
/*!
* @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, browser } from 'protractor';
import { DataTableComponentPage } from '../../core/pages/data-table-component.page';
import { BrowserVisibility } from '../../core/browser-visibility';
export class DocumentListPage {
rootElement: ElementFinder;
actionMenu = element(by.css('div[role="menu"]'));
optionButton = by.css('button[data-automation-id*="action_menu_"]');
tableBody;
dataTable;
constructor(rootElement: ElementFinder = element.all(by.css('adf-document-list')).first()) {
this.rootElement = rootElement;
this.dataTable = new DataTableComponentPage(this.rootElement);
this.tableBody = rootElement.all(by.css('div[class="adf-datatable-body"]')).first();
}
checkLockedIcon(content) {
const row = this.dataTable.getRow('Display name', content);
const lockIcon = row.element(by.cssContainingText('div[title="Lock"] mat-icon', 'lock'));
BrowserVisibility.waitUntilElementIsVisible(lockIcon);
return this;
}
checkUnlockedIcon(content) {
const row = this.dataTable.getRow('Display name', content);
const lockIcon = row.element(by.cssContainingText('div[title="Lock"] mat-icon', 'lock_open'));
BrowserVisibility.waitUntilElementIsVisible(lockIcon);
return this;
}
waitForTableBody() {
return BrowserVisibility.waitUntilElementIsVisible(this.tableBody);
}
getTooltip(nodeName) {
return this.dataTable.getTooltip('Display name', nodeName);
}
selectRow(nodeName) {
return this.dataTable.selectRow('Display name', nodeName);
}
rightClickOnRow(nodeName) {
return this.dataTable.rightClickOnRow('Display name', nodeName);
}
clickOnActionMenu(content) {
const row = this.dataTable.getRow('Display name', content);
row.element(this.optionButton).click();
BrowserVisibility.waitUntilElementIsVisible(this.actionMenu);
browser.sleep(500);
return this;
}
checkActionMenuIsNotDisplayed() {
BrowserVisibility.waitUntilElementIsNotVisible(this.actionMenu);
return this;
}
dataTablePage() {
return new DataTableComponentPage(this.rootElement);
}
getAllRowsColumnValues(column) {
return this.dataTable.getAllRowsColumnValues(column);
}
doubleClickRow(nodeName) {
this.dataTable.doubleClickRow('Display name', nodeName);
return this;
}
}

View File

@@ -15,4 +15,4 @@
* limitations under the License.
*/
export * from './example.page';
export * from './document-list.page';

View File

@@ -17,3 +17,4 @@
export * from './pages/public-api';
export * from './actions/public-api';
export * from './dialog/public-api';

View File

@@ -282,4 +282,28 @@ export class DataTableComponentPage {
getCellByRowAndColumn(rowColumn, rowContent, columnName) {
return this.getRow(rowColumn, rowContent).element(by.css(`div[title='${columnName}']`));
}
selectRowByContent(content) {
const row = this.getCellByContent(content);
return row.click();
}
checkRowByContentIsSelected(folderName) {
const selectedRow = this.getCellByContent(folderName).element(by.xpath(`ancestor::div[contains(@class, 'is-selected')]`));
BrowserVisibility.waitUntilElementIsVisible(selectedRow);
return this;
}
getCellByContent(content) {
const cell = this.rootElement.element(by.cssContainingText(`div[class*='adf-datatable-row'] div[class*='adf-name-location-cell-name']`, content));
BrowserVisibility.waitUntilElementIsVisible(cell);
return cell;
}
clickRowByContent(name) {
const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${name}']`)).first();
BrowserVisibility.waitUntilElementIsVisible(resultElement);
BrowserVisibility.waitUntilElementIsClickable(resultElement);
resultElement.click();
}
}