mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
[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:
parent
a630cfb390
commit
c11237a2ff
@ -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> {
|
||||
|
@ -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'));
|
||||
@ -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);
|
||||
@ -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}"]`)));
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user