fix content service document list action test (#5027)

* fix content service document list action test

* restore build.sh

* perform twice movement mosue for right click for avoid bug in non headless chrome

* change sso ref element present

* change sso ref element present
This commit is contained in:
Eugenio Romano 2019-08-28 23:25:06 +01:00 committed by GitHub
parent 09d3710bcf
commit 609ae3a3ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 77 additions and 66 deletions

View File

@ -101,7 +101,6 @@ describe('Document List Component - Actions', () => {
beforeEach(async () => {
await navigationBarPage.clickContentServicesButton();
});
describe('File Actions', () => {
@ -288,21 +287,26 @@ describe('Document List Component - Actions', () => {
});
it('[C260132] Move action on folder with - Load more', async () => {
await expect(await paginationPage.getCurrentItemsPerPage()).toEqual('5');
await expect(await paginationPage.getPaginationRange()).toEqual('Showing 1-' + 5 + ' of ' + 6);
await contentServicesPage.getDocumentList().rightClickOnRow('A' + folderModel1.name);
await contentServicesPage.checkContextActionIsVisible('Move');
await contentServicesPage.pressContextMenuActionNamed('Move');
await contentNodeSelector.checkDialogIsDisplayed();
await expect(await contentNodeSelector.getDialogHeaderText()).toBe('Move \'' + 'A' + folderModel1.name + '\' to...');
await contentNodeSelector.checkSearchInputIsDisplayed();
await expect(await contentNodeSelector.getSearchLabel()).toBe('Search');
await contentNodeSelector.checkSelectedSiteIsDisplayed('My files');
await contentNodeSelector.checkCancelButtonIsDisplayed();
await contentNodeSelector.checkMoveCopyButtonIsDisplayed();
await expect(await contentNodeSelector.getMoveCopyButtonText()).toBe('MOVE');
await expect(await contentNodeSelector.numberOfResultsDisplayed()).toBe(5);
await infinitePaginationPage.clickLoadMoreButton();
await expect(await contentNodeSelector.numberOfResultsDisplayed()).toBe(6);
await infinitePaginationPage.checkLoadMoreButtonIsNotDisplayed();
await contentNodeSelector.contentListPage().dataTablePage().selectRowByContent('F' + folderModel6.name);
@ -336,7 +340,6 @@ describe('Document List Component - Actions', () => {
await breadCrumbPage.chooseBreadCrumb(contentServicesUser.id);
await contentServicesPage.waitForTableBody();
await contentServicesPage.checkContentIsDisplayed('A' + folderModel1.name);
});
it('[C305051] Copy action on folder with - Load more', async () => {

View File

@ -22,14 +22,13 @@ export class BreadCrumbDropdownPage {
breadCrumb: ElementFinder = element(by.css(`adf-dropdown-breadcrumb[data-automation-id='content-node-selector-content-breadcrumb']`));
parentFolder = this.breadCrumb.element(by.css(`button[data-automation-id='dropdown-breadcrumb-trigger']`));
breadCrumbDropdown: ElementFinder = element(by.css(`div[class*='mat-select-panel']`));
breadCrumbDropdown: ElementFinder = element.all(by.css(`div[class*='mat-select-panel']`)).first();
currentFolder = this.breadCrumb.element(by.css(`div span[data-automation-id="current-folder"]`));
async choosePath(pathName): Promise<void> {
const path = this.breadCrumbDropdown.element(by.cssContainingText(`mat-option[data-automation-class='dropdown-breadcrumb-path-option'] span[class='mat-option-text']`,
pathName));
await BrowserActions.click(path);
}
async clickParentFolder(): Promise<void> {

View File

@ -83,7 +83,7 @@ export class DataTablePage {
await BrowserActions.click(this.reset);
}
async checkRowIsNotSelected(rowNumber): Promise<void> {
async checkRowIsNotSelected(rowNumber: string): Promise<void> {
const isRowSelected = this.dataTable.getCellElementByValue(this.columns.id, rowNumber)
.element(by.xpath(`ancestor::div[contains(@class, 'adf-datatable-row custom-row-style ng-star-inserted is-selected')]`));
await BrowserVisibility.waitUntilElementIsNotVisible(isRowSelected);
@ -97,11 +97,11 @@ export class DataTablePage {
await BrowserActions.click(this.selectAll);
}
async checkRowIsChecked(rowNumber): Promise<void> {
async checkRowIsChecked(rowNumber: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.getRowCheckbox(rowNumber));
}
async checkRowIsNotChecked(rowNumber): Promise<void> {
async checkRowIsNotChecked(rowNumber: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.getRowCheckbox(rowNumber));
}
@ -109,19 +109,19 @@ export class DataTablePage {
return this.allSelectedRows.count();
}
async clickCheckbox(rowNumber): Promise<void> {
async clickCheckbox(rowNumber: string): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
const checkbox = this.dataTable.getCellElementByValue(this.columns.id, rowNumber)
.element(by.xpath(`ancestor::div[contains(@class, 'adf-datatable-row')]//mat-checkbox/label`));
await BrowserActions.click(checkbox);
}
async selectRow(rowNumber): Promise<void> {
async selectRow(rowNumber: string): Promise<void> {
const row = this.dataTable.getCellElementByValue(this.columns.id, rowNumber);
await BrowserActions.click(row);
}
async selectRowWithKeyboard(rowNumber): Promise<void> {
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();
@ -133,7 +133,7 @@ export class DataTablePage {
await BrowserActions.click(selectMode);
}
getRowCheckbox(rowNumber): ElementFinder {
getRowCheckbox(rowNumber: string): ElementFinder {
return this.dataTable.getCellElementByValue(this.columns.id, rowNumber).element(by.xpath(`ancestor::div/div/mat-checkbox[contains(@class, 'mat-checkbox-checked')]`));
}
@ -141,23 +141,25 @@ export class DataTablePage {
return await this.dataTable.getCopyContentTooltip();
}
async mouseOverNameColumn(name): Promise<void> {
async mouseOverNameColumn(name: string): Promise<void> {
await this.dataTable.mouseOverColumn(this.columns.name, name);
}
async mouseOverCreatedByColumn(name): Promise<void> {
async mouseOverCreatedByColumn(name: string): Promise<void> {
await this.dataTable.mouseOverColumn(this.columns.createdBy, name);
}
async mouseOverIdColumn(name): Promise<void> {
async mouseOverIdColumn(name: string): Promise<void> {
await this.dataTable.mouseOverColumn(this.columns.id, name);
}
async mouseOverJsonColumn(rowNumber): Promise<void> {
await this.dataTable.mouseOverElement(this.dataTable.getCellByRowNumberAndColumnName(rowNumber - 1, this.columns.json));
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): ElementFinder {
getDropTargetIdColumnCell(rowNumber: number): ElementFinder {
return this.dataTable.getCellByRowNumberAndColumnName(rowNumber - 1, this.columns.id);
}
@ -165,11 +167,11 @@ export class DataTablePage {
return this.idColumnHeader;
}
async clickOnIdColumn(name): Promise<void> {
async clickOnIdColumn(name: string): Promise<void> {
await this.dataTable.clickColumn(this.columns.id, name);
}
async clickOnJsonColumn(rowNumber): Promise<void> {
async clickOnJsonColumn(rowNumber: number): Promise<void> {
await BrowserActions.click(this.dataTable.getCellByRowNumberAndColumnName(rowNumber - 1, this.columns.json));
}

View File

@ -3,6 +3,11 @@
"dest": "../dist/testing",
"lib": {
"entryFile": "src/public-api.ts",
"flatModuleFile": "adf-testing"
"flatModuleFile": "adf-testing",
"umdModuleIds": {
"@alfresco/js-api": "@alfresco/js-api",
"@alfresco/adf-core": "@alfresco/adf-core",
"moment-es6": "moment-es6"
}
}
}

View File

@ -34,13 +34,13 @@ export class DocumentListPage {
this.tableBody = rootElement.all(by.css('div[class="adf-datatable-body"]')).first();
}
async checkLockedIcon(content): Promise<void> {
async checkLockedIcon(content: string): Promise<void> {
const row = this.dataTable.getRow('Display name', content);
const lockIcon = row.element(by.cssContainingText('div[title="Lock"] mat-icon', 'lock'));
await BrowserVisibility.waitUntilElementIsVisible(lockIcon);
}
async checkUnlockedIcon(content): Promise<void> {
async checkUnlockedIcon(content: string): Promise<void> {
const row = this.dataTable.getRow('Display name', content);
const lockIcon = row.element(by.cssContainingText('div[title="Lock"] mat-icon', 'lock_open'));
await BrowserVisibility.waitUntilElementIsVisible(lockIcon);
@ -50,19 +50,19 @@ export class DocumentListPage {
await BrowserVisibility.waitUntilElementIsVisible(this.tableBody);
}
async getTooltip(nodeName): Promise<string> {
async getTooltip(nodeName: string): Promise<string> {
return await this.dataTable.getTooltip('Display name', nodeName);
}
async selectRow(nodeName): Promise<void> {
async selectRow(nodeName: string): Promise<void> {
await this.dataTable.selectRow('Display name', nodeName);
}
async rightClickOnRow(nodeName): Promise<void> {
async rightClickOnRow(nodeName: string): Promise<void> {
await this.dataTable.rightClickOnRow('Display name', nodeName);
}
async clickOnActionMenu(content): Promise<void> {
async clickOnActionMenu(content: string): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
const row: ElementFinder = this.dataTable.getRow('Display name', content);
await BrowserActions.click(row.element(this.optionButton));
@ -78,11 +78,11 @@ export class DocumentListPage {
return new DataTableComponentPage(this.rootElement);
}
async getAllRowsColumnValues(column) {
async getAllRowsColumnValues(column: string) {
return await this.dataTable.getAllRowsColumnValues(column);
}
async doubleClickRow(nodeName): Promise<void> {
async doubleClickRow(nodeName: string): Promise<void> {
await this.dataTable.doubleClickRow('Display name', nodeName);
}
}

View File

@ -58,21 +58,21 @@ export class DataTableComponentPage {
await BrowserVisibility.waitUntilElementIsNotVisible(this.selectAll.element(by.css('input[aria-checked="true"]')));
}
async clickCheckbox(columnName, columnValue): Promise<void> {
async clickCheckbox(columnName: string, columnValue): Promise<void> {
const checkbox = this.getRowCheckbox(columnName, columnValue);
await BrowserActions.click(checkbox);
}
async checkRowIsNotChecked(columnName, columnValue): Promise<void> {
async checkRowIsNotChecked(columnName: string, columnValue): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.getRowCheckbox(columnName, columnValue).element(by.css('input[aria-checked="true"]')));
}
async checkRowIsChecked(columnName, columnValue): Promise<void> {
async checkRowIsChecked(columnName: string, columnValue): Promise<void> {
const rowCheckbox = this.getRowCheckbox(columnName, columnValue);
await BrowserVisibility.waitUntilElementIsVisible(rowCheckbox.element(by.css('input[aria-checked="true"]')));
}
getRowCheckbox(columnName, columnValue): ElementFinder {
getRowCheckbox(columnName: string, columnValue): ElementFinder {
return this.getRow(columnName, columnValue).element(by.css('mat-checkbox'));
}
@ -138,10 +138,10 @@ export class DataTableComponentPage {
return initialList.toString() === sortedList.toString();
}
async rightClickOnRow(columnName, columnValue): Promise<void> {
async rightClickOnRow(columnName: string, columnValue): Promise<void> {
const row = this.getRow(columnName, columnValue);
await browser.actions().mouseMove(row).perform();
await browser.actions().click(row, protractor.Button.RIGHT).perform();
await BrowserActions.rightClick(row);
await BrowserVisibility.waitUntilElementIsVisible(element(by.id('adf-context-menu-content')));
}
@ -155,7 +155,7 @@ export class DataTableComponentPage {
await BrowserVisibility.waitUntilElementIsVisible(element(by.id('adf-context-menu-content')));
}
getFileHyperlink(filename): ElementFinder {
getFileHyperlink(filename: string): ElementFinder {
return element(by.cssContainingText('adf-name-column[class*="adf-datatable-link"] span', filename));
}
@ -163,7 +163,7 @@ export class DataTableComponentPage {
return await this.rootElement.all(this.rows).count();
}
async getAllRowsColumnValues(column) {
async getAllRowsColumnValues(column: string) {
const columnLocator = by.css("adf-datatable div[class*='adf-datatable-body'] div[class*='adf-datatable-row'] div[title='" + column + "'] span");
await BrowserVisibility.waitUntilElementIsPresent(element.all(columnLocator).first());
return await element.all(columnLocator)
@ -171,7 +171,7 @@ export class DataTableComponentPage {
.map(async (el) => await el.getText());
}
async getRowsWithSameColumnValues(columnName, columnValue) {
async getRowsWithSameColumnValues(columnName: string, columnValue) {
const columnLocator = by.css(`div[title='${columnName}'] div[data-automation-id="text_${columnValue}"] span`);
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.all(columnLocator).first());
return this.rootElement.all(columnLocator).getText();
@ -187,12 +187,12 @@ export class DataTableComponentPage {
await BrowserVisibility.waitUntilElementIsVisible(this.tableBody);
}
async getFirstElementDetail(detail): Promise<string> {
async getFirstElementDetail(detail: string): Promise<string> {
const firstNode = element.all(by.css(`adf-datatable div[title="${detail}"] span`)).first();
return await BrowserActions.getText(firstNode);
}
geCellElementDetail(detail): ElementArrayFinder {
geCellElementDetail(detail: string): ElementArrayFinder {
return element.all(by.css(`adf-datatable div[title="${detail}"] span`));
}
@ -221,31 +221,30 @@ export class DataTableComponentPage {
}
}
async checkContentIsDisplayed(columnName, columnValue): Promise<void> {
async checkContentIsDisplayed(columnName: string, columnValue: string): Promise<void> {
const row = this.getCellElementByValue(columnName, columnValue);
await BrowserVisibility.waitUntilElementIsVisible(row);
}
async checkContentIsNotDisplayed(columnName, columnValue): Promise<void> {
async checkContentIsNotDisplayed(columnName: string, columnValue: string): Promise<void> {
const row = this.getCellElementByValue(columnName, columnValue);
await BrowserVisibility.waitUntilElementIsNotVisible(row);
}
getRow(columnName, columnValue): ElementFinder {
return this.rootElement.all(by.css(`div[title="${columnName}"] div[data-automation-id="text_${columnValue}"]`)).first()
.element(by.xpath(`ancestor::div[contains(@class, 'adf-datatable-row')]`));
getRow(columnName: string, columnValue: string): ElementFinder {
return this.rootElement.all(by.xpath(`//div[@title="${columnName}"]//div[@data-automation-id="text_${columnValue}"]//ancestor::div[contains(@class, 'adf-datatable-row')]`)).first();
}
getRowByIndex(index: number): ElementFinder {
return this.rootElement.element(by.xpath(`//div[contains(@class,'adf-datatable-body')]//div[contains(@class,'adf-datatable-row')][${index}]`));
}
async contentInPosition(position): Promise<string> {
async contentInPosition(position: number): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.contents.first());
return await BrowserActions.getText(this.contents.get(position - 1));
}
getCellElementByValue(columnName, columnValue): ElementFinder {
getCellElementByValue(columnName: string, columnValue: string): ElementFinder {
return this.rootElement.all(by.css(`div[title="${columnName}"] div[data-automation-id="text_${columnValue}"] span`)).first();
}
@ -301,33 +300,33 @@ export class DataTableComponentPage {
await BrowserVisibility.waitUntilElementIsVisible(cell);
}
async clickRowByContent(name): Promise<void> {
async clickRowByContent(name: string): Promise<void> {
const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${name}']`)).first();
await BrowserActions.click(resultElement);
}
async clickRowByContentCheckbox(name): Promise<void> {
async clickRowByContentCheckbox(name: string): Promise<void> {
const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${name}']`)).first().element(by.xpath(`ancestor::div/div/mat-checkbox`));
await browser.actions().mouseMove(resultElement);
await BrowserActions.click(resultElement);
}
async checkRowContentIsDisplayed(content): Promise<void> {
async checkRowContentIsDisplayed(content: string): Promise<void> {
const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${content}']`)).first();
await BrowserVisibility.waitUntilElementIsVisible(resultElement);
}
async checkRowContentIsNotDisplayed(content): Promise<void> {
async checkRowContentIsNotDisplayed(content: string): Promise<void> {
const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${content}']`)).first();
await BrowserVisibility.waitUntilElementIsNotVisible(resultElement);
}
async checkRowContentIsDisabled(content): Promise<void> {
async checkRowContentIsDisabled(content: string): Promise<void> {
const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${content}'] div.adf-cell-value img[aria-label='disable']`)).first();
await BrowserVisibility.waitUntilElementIsVisible(resultElement);
}
async doubleClickRowByContent(name): Promise<void> {
async doubleClickRowByContent(name: string): Promise<void> {
const resultElement = this.rootElement.all(by.css(`div[data-automation-id='${name}']`)).first();
await BrowserActions.click(resultElement);
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
@ -341,17 +340,13 @@ export class DataTableComponentPage {
await BrowserVisibility.waitUntilElementIsStale(this.copyColumnTooltip);
}
async mouseOverColumn(columnName, columnValue): Promise<void> {
async mouseOverColumn(columnName: string, columnValue): Promise<void> {
const column = this.getCellElementByValue(columnName, columnValue);
await this.mouseOverElement(column);
await BrowserVisibility.waitUntilElementIsVisible(column);
await browser.actions().mouseMove(column).perform();
}
async mouseOverElement(elem): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(elem);
await browser.actions().mouseMove(elem).perform();
}
async clickColumn(columnName, columnValue): Promise<void> {
async clickColumn(columnName: string, columnValue: string): Promise<void> {
await BrowserActions.clickExecuteScript(`div[title="${columnName}"] div[data-automation-id="text_${columnValue}"] span`);
}
}

View File

@ -25,7 +25,7 @@ export class LoginSSOPage {
usernameField = element(by.id('username'));
passwordField = element(by.id('password'));
loginButton = element(by.css('input[type="submit"]'));
header = element(by.id('adf-header'));
header = element(by.tagName('adf-layout-header'));
loginError = element(by.css(`div[data-automation-id="login-error"]`));
async loginSSOIdentityService(username, password) {

View File

@ -77,8 +77,7 @@ export class BrowserActions {
}
static async rightClick(elementFinder: ElementFinder): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(elementFinder);
await browser.actions().mouseMove(elementFinder).perform();
await browser.actions().mouseMove(elementFinder).mouseDown().mouseMove(elementFinder).perform();
await browser.actions().click(elementFinder, protractor.Button.RIGHT).perform();
}

View File

@ -10,9 +10,17 @@ rm -rf tmp && mkdir tmp;
if [[ $TRAVIS_PULL_REQUEST == "false" ]];
then
./scripts/update-version.sh -nextalpha -gnu -minor -components
./scripts/npm-build-all.sh -c || exit 1;
if [[ $TRAVIS_BRANCH == "development" ]];
then
./scripts/update-version.sh -gnu -alpha || exit 1;
fi
./scripts/npm-build-all.sh || exit 1;
else
./scripts/update-version.sh -gnu -alpha || exit 1;
npm install;
./scripts/lint.sh || exit 1;
./scripts/smart-build.sh -b $TRAVIS_BRANCH -gnu || exit 1;
fi;