Skip to content

Commit

Permalink
[ACA-3441] Add method to attach file widget PO (#6085)
Browse files Browse the repository at this point in the history
* Add methods and locator for uploadButton of attach file widget of type local

* Add method to attach-file-widget

* Modify the right click
  • Loading branch information
cristinaj committed Sep 6, 2020
1 parent a630cfb commit c11237a
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 5 deletions.
3 changes: 2 additions & 1 deletion lib/testing/src/lib/core/pages/data-table/data-table-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ export class DataTableItem {

async rightClickOnRow(columnName: string, columnValue: string): Promise<void> {
const row = await this.getRow(columnName, columnValue);
await BrowserActions.rightClick(row);
await browser.actions().mouseMove(row).perform();
await browser.actions().click(row, protractor.Button.RIGHT).perform();
}

async waitForFirstRow(): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { Locator, element, by, browser } from 'protractor';
export class AttachFileWidgetPage {

formFields = new FormFields();
uploadLocator: Locator = by.css('button[id="attachfile"]');
alfrescoTypeUploadLocator: Locator = by.css('button[id="attachfile"]');
localStorageButton = element(by.css('input[id="attachfile"]'));
filesListLocator: Locator = by.css('div[id="adf-attach-widget-readonly-list"]');
attachFileWidget = element(by.css('#attachfile'));
Expand All @@ -34,18 +34,36 @@ export class AttachFileWidgetPage {

async attachFile(fieldId, fileLocation): Promise<void> {
const widget = await this.formFields.getWidget(fieldId);
const uploadButton = await widget.element(this.uploadLocator);
const uploadButton = await widget.element(this.alfrescoTypeUploadLocator);
await BrowserActions.click(uploadButton);
await BrowserVisibility.waitUntilElementIsPresent(this.localStorageButton);
await this.localStorageButton.sendKeys(fileLocation);
}

async checkNoFileIsAttached(fieldId): Promise<void> {
const widget = await this.formFields.getWidget(fieldId);
const fileItem = widget.element(this.filesListLocator).element(by.css('mat-list-item'));
await BrowserVisibility.waitUntilElementIsNotVisible(fileItem);
}

async checkFileIsAttached(fieldId, name): Promise<void> {
const widget = await this.formFields.getWidget(fieldId);
const fileAttached = widget.element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name));
await BrowserVisibility.waitUntilElementIsVisible(fileAttached);
}

async checkFilesAreAttachedToWidget(fieldId, name): Promise<void> {
await name.forEach(async fileName => {
await this.checkFileIsAttached(fieldId, fileName);
});
}

async checkFileIsNotAttached(fieldId, name): Promise<void> {
const widget = await this.formFields.getWidget(fieldId);
const fileNotAttached = widget.element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name));
await BrowserVisibility.waitUntilElementIsNotVisible(fileNotAttached);
}

async viewFile(name: string): Promise<void> {
const fileView = element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name));
await BrowserActions.click(fileView);
Expand Down Expand Up @@ -105,11 +123,29 @@ export class AttachFileWidgetPage {
}

async checkUploadIsNotVisible(fieldId): Promise<void> {
const alfrescoTypeUploadLocator = by.css(`button[id="${fieldId}"]`);
const widget = await this.formFields.getWidget(fieldId);
const uploadButton = await widget.element(this.uploadLocator);
const uploadButton = await widget.element(alfrescoTypeUploadLocator);
await BrowserVisibility.waitUntilElementIsNotPresent(uploadButton);
}

async checkUploadIsVisible(fieldId): Promise<void> {
const alfrescoTypeUploadLocator = by.css(`button[id="${fieldId}"]`);
const widget = await this.formFields.getWidget(fieldId);
const uploadButton = await widget.element(alfrescoTypeUploadLocator);
await BrowserVisibility.waitUntilElementIsPresent(uploadButton);
}

async checkLocalTypeUploadIsPresent(fieldId): Promise<void> {
const localTypeUpload = element(by.css(`input[id="${fieldId}"]`));
await BrowserVisibility.waitUntilElementIsPresent(localTypeUpload);
}

async checkLocalTypeUploadIsNotPresent(fieldId): Promise<void> {
const localTypeUpload = element(by.css(`input[id="${fieldId}"]`));
await BrowserVisibility.waitUntilElementIsNotPresent(localTypeUpload);
}

async selectUploadSource(name: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.attachedFileOptions);
await BrowserActions.click(element(by.css(`button[id="attach-${name}"]`)));
Expand All @@ -118,7 +154,7 @@ export class AttachFileWidgetPage {
async clickUploadButton(fieldId): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
const widget = await this.formFields.getWidget(fieldId);
const uploadButton = await widget.element(this.uploadLocator);
const uploadButton = await widget.element(this.alfrescoTypeUploadLocator);
await BrowserActions.click(uploadButton);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,10 @@ export class StartProcessPage {
await this.selectFromProcessDropdown(processName);
await this.clickStartProcessButton();
}

async selectApplicationAndProcess(applicationName: string, processName: string) {
await this.selectFromApplicationDropdown(applicationName);
await this.checkProcessDefinitionDropdownIsEnabled();
await this.selectFromProcessDropdown(processName);
}
}

0 comments on commit c11237a

Please sign in to comment.