[ADF-4823] added download and show preview for attach cloud widget (#4996)

* [ADF-4823] fixed download and start fixing show preview

* [ADF-4823] fixed preview files

* [ADF-4823] - added unit test

* [ADF-4823] - fixed lint problem

* [ADF-4823] - rebased and fixed lint problem

* added a new method in BrowserActions to check that the action menu is visible, and using that in the tests.

* linting fixes
This commit is contained in:
Vito
2019-09-03 11:10:40 +01:00
committed by Eugenio Romano
parent c142371222
commit 19a17ca6e6
14 changed files with 478 additions and 281 deletions

View File

@@ -23,7 +23,6 @@ import { BrowserActions } from '../../core/utils/browser-actions';
export class DocumentListPage {
rootElement: ElementFinder;
actionMenu: ElementFinder = element(by.css('div[role="menu"]'));
optionButton: Locator = by.css('button[data-automation-id*="action_menu_"]');
tableBody: ElementFinder;
dataTable: DataTableComponentPage;
@@ -66,12 +65,12 @@ export class DocumentListPage {
await BrowserActions.closeMenuAndDialogs();
const row: ElementFinder = this.dataTable.getRow('Display name', content);
await BrowserActions.click(row.element(this.optionButton));
await BrowserVisibility.waitUntilElementIsVisible(this.actionMenu);
await BrowserActions.waitUntilActionMenuIsVisible();
await browser.sleep(500);
}
async checkActionMenuIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.actionMenu);
await BrowserActions.waitUntilActionMenuIsNotVisible();
}
dataTablePage(): DataTableComponentPage {

View File

@@ -76,8 +76,12 @@ export class AttachFileWidgetCloud {
async removeFile(fileName: string): Promise<void> {
const fileId = await this.getFileId(fileName);
const deleteButton = this.widget.element(by.css(`button[id='${fileId}-remove']`));
const optionMenu = this.widget.element(by.css(`button[id='${fileId}-option-menu']`));
await BrowserActions.click(optionMenu);
await BrowserActions.waitUntilActionMenuIsVisible();
const deleteButton = element(by.css(`button#${fileId}-remove`));
await BrowserActions.click(deleteButton);
await BrowserVisibility.waitUntilElementIsNotVisible(deleteButton);
}
async viewFile(name): Promise<void> {

View File

@@ -26,6 +26,16 @@ export class BrowserActions {
await elementFinder.click();
}
static async waitUntilActionMenuIsVisible(): Promise<void> {
const actionMenu = element(by.css('div[role="menu"]'));
await BrowserVisibility.waitUntilElementIsVisible(actionMenu);
}
static async waitUntilActionMenuIsNotVisible(): Promise<void> {
const actionMenu = element(by.css('div[role="menu"]'));
await BrowserVisibility.waitUntilElementIsNotVisible(actionMenu);
}
static async getUrl(url: string): Promise<any> {
return browser.get(url);
}