Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Sep 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I can really understand the difference from the name of:
checkNoFileIsAttached checkFileIsNotAttached
checkFileIsAttached checkFilesAreAttachedToWidget

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checkNoFileIsAttached -> this checks that no file is attached; checkFileIsNotAttached -> this checks that a specific file is not attached, others may be; checkFileIsAttached -> checks that a specific file is attached; checkFilesAreAttachedToWidget -> you can give multiple files as parameter

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);
}
}