[ACA-3441] Add method to attach file widget PO (#6085)

* Add methods and locator for uploadButton of attach file widget of type local

* Add method to attach-file-widget

* Modify the right click
This commit is contained in:
Cristina Jalba 2020-09-06 22:11:52 +03:00 committed by GitHub
parent a630cfb390
commit c11237a2ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 48 additions and 5 deletions

View File

@ -53,7 +53,8 @@ export class DataTableItem {
async rightClickOnRow(columnName: string, columnValue: string): Promise<void> { async rightClickOnRow(columnName: string, columnValue: string): Promise<void> {
const row = await this.getRow(columnName, columnValue); 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> { async waitForFirstRow(): Promise<void> {

View File

@ -22,7 +22,7 @@ import { Locator, element, by, browser } from 'protractor';
export class AttachFileWidgetPage { export class AttachFileWidgetPage {
formFields = new FormFields(); formFields = new FormFields();
uploadLocator: Locator = by.css('button[id="attachfile"]'); alfrescoTypeUploadLocator: Locator = by.css('button[id="attachfile"]');
localStorageButton = element(by.css('input[id="attachfile"]')); localStorageButton = element(by.css('input[id="attachfile"]'));
filesListLocator: Locator = by.css('div[id="adf-attach-widget-readonly-list"]'); filesListLocator: Locator = by.css('div[id="adf-attach-widget-readonly-list"]');
attachFileWidget = element(by.css('#attachfile')); attachFileWidget = element(by.css('#attachfile'));
@ -34,18 +34,36 @@ export class AttachFileWidgetPage {
async attachFile(fieldId, fileLocation): Promise<void> { async attachFile(fieldId, fileLocation): Promise<void> {
const widget = await this.formFields.getWidget(fieldId); 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 BrowserActions.click(uploadButton);
await BrowserVisibility.waitUntilElementIsPresent(this.localStorageButton); await BrowserVisibility.waitUntilElementIsPresent(this.localStorageButton);
await this.localStorageButton.sendKeys(fileLocation); 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> { async checkFileIsAttached(fieldId, name): Promise<void> {
const widget = await this.formFields.getWidget(fieldId); const widget = await this.formFields.getWidget(fieldId);
const fileAttached = widget.element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name)); const fileAttached = widget.element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name));
await BrowserVisibility.waitUntilElementIsVisible(fileAttached); 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> { async viewFile(name: string): Promise<void> {
const fileView = element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name)); const fileView = element(this.filesListLocator).element(by.cssContainingText('mat-list-item span ', name));
await BrowserActions.click(fileView); await BrowserActions.click(fileView);
@ -105,11 +123,29 @@ export class AttachFileWidgetPage {
} }
async checkUploadIsNotVisible(fieldId): Promise<void> { async checkUploadIsNotVisible(fieldId): Promise<void> {
const alfrescoTypeUploadLocator = by.css(`button[id="${fieldId}"]`);
const widget = await this.formFields.getWidget(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); 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> { async selectUploadSource(name: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.attachedFileOptions); await BrowserVisibility.waitUntilElementIsVisible(this.attachedFileOptions);
await BrowserActions.click(element(by.css(`button[id="attach-${name}"]`))); await BrowserActions.click(element(by.css(`button[id="attach-${name}"]`)));
@ -118,7 +154,7 @@ export class AttachFileWidgetPage {
async clickUploadButton(fieldId): Promise<void> { async clickUploadButton(fieldId): Promise<void> {
await BrowserActions.closeMenuAndDialogs(); await BrowserActions.closeMenuAndDialogs();
const widget = await this.formFields.getWidget(fieldId); 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 BrowserActions.click(uploadButton);
} }
} }

View File

@ -170,4 +170,10 @@ export class StartProcessPage {
await this.selectFromProcessDropdown(processName); await this.selectFromProcessDropdown(processName);
await this.clickStartProcessButton(); await this.clickStartProcessButton();
} }
async selectApplicationAndProcess(applicationName: string, processName: string) {
await this.selectFromApplicationDropdown(applicationName);
await this.checkProcessDefinitionDropdownIsEnabled();
await this.selectFromProcessDropdown(processName);
}
} }