[AAE-1926] automated e2e tests - interacting with an attached file in an active & completed form (#5528)

This commit is contained in:
Alexandra Abrudan
2020-03-02 14:52:41 +00:00
committed by GitHub
parent 7a2af38699
commit 133140d69b
11 changed files with 182 additions and 18 deletions

View File

@@ -26,6 +26,12 @@ export class AttachFileWidgetPage {
uploadLocator = by.css('button[id="attachfile"]');
localStorageButton: ElementFinder = element(by.css('input[id="attachfile"]'));
filesListLocator = by.css('div[id="adf-attach-widget-readonly-list"]');
attachFileWidget: ElementFinder = element(by.css('#attachfile'));
attachedFileMenu: ElementFinder = element(by.css('mat-list-item button'));
attachedFileOptions: ElementFinder = element(by.css('.mat-menu-panel .mat-menu-content'));
viewFileOptionButton: ElementFinder = element(by.css(`.mat-menu-panel .mat-menu-content button[id$="show-file"]`));
downloadFileOptionButton: ElementFinder = element(by.css(`.mat-menu-panel .mat-menu-content button[id$="download-file"]`));
removeFileOptionButton: ElementFinder = element(by.css(`.mat-menu-panel .mat-menu-content button[id$="remove"]`));
async attachFile(fieldId, fileLocation): Promise<void> {
browser.setFileDetector(new remote.FileDetector());
@@ -47,4 +53,38 @@ export class AttachFileWidgetPage {
await BrowserActions.click(fileView);
await browser.actions().doubleClick(fileView).perform();
}
async attachFileWidgetDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.attachFileWidget);
}
async toggleAttachedFileMenu(): Promise<void> {
await BrowserActions.click(this.attachedFileMenu);
}
async checkAttachFileOptionsActiveForm(): Promise <void> {
await BrowserVisibility.waitUntilElementIsVisible(this.attachedFileOptions);
await BrowserVisibility.waitUntilElementIsVisible(this.viewFileOptionButton);
await BrowserVisibility.waitUntilElementIsVisible(this.downloadFileOptionButton);
await BrowserVisibility.waitUntilElementIsVisible(this.removeFileOptionButton);
}
async checkAttachFileOptionsCompletedForm(): Promise <void> {
await BrowserVisibility.waitUntilElementIsVisible(this.attachedFileOptions);
await BrowserVisibility.waitUntilElementIsVisible(this.viewFileOptionButton);
await BrowserVisibility.waitUntilElementIsVisible(this.downloadFileOptionButton);
await BrowserVisibility.waitUntilElementIsNotVisible(this.removeFileOptionButton);
}
async viewAttachedFile(): Promise<void> {
await BrowserActions.click(this.viewFileOptionButton);
}
async downloadFile(): Promise<void> {
await BrowserActions.click(this.downloadFileOptionButton);
}
async removeAttachedFile(): Promise<void> {
await BrowserActions.click(this.removeFileOptionButton);
}
}

View File

@@ -28,7 +28,7 @@ export class FileBrowserUtil {
return fs.existsSync(path.join(DEFAULT_ROOT_PATH, 'downloads', fileName));
}, 30000);
await expect(file).toBe(true);
await expect(file).toBe(true, `${fileName} not downloaded`);
return !!file;
}