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-3373] Add e2e multi item select method in DataTable component #6129

Merged
merged 2 commits into from
Nov 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions e2e/process-services/pages/attachment-list.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ export class AttachmentListPage {

async doubleClickFile(name: string): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserVisibility.waitUntilElementIsVisible(element.all(by.css('div[data-automation-id="' + name + '"]')).first());
const fileAttached = element.all(by.css('div[data-automation-id="' + name + '"]')).first();
await BrowserVisibility.waitUntilElementIsVisible(element.all(by.css(`div[data-automation-id="${name}"]`)).first());
const fileAttached = element.all(by.css(`div[data-automation-id="${name}"]`)).first();
await BrowserActions.click(fileAttached);
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
}

async checkFileIsRemoved(name: string): Promise<void> {
const fileAttached = element.all(by.css('div[data-automation-id="' + name + '"]')).first();
const fileAttached = element.all(by.css(`div[data-automation-id="${name}"]`)).first();
await BrowserVisibility.waitUntilElementIsNotVisible(fileAttached);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ describe('Attachment list action menu for processes', () => {

await processFiltersPage.selectFromProcessList(processName.completed);
await processDetailsPage.checkProcessTitleIsDisplayed();
await processFiltersPage.waitForTableBody();

await attachmentListPage.clickAttachFileButton(pngFile.location);
await attachmentListPage.checkFileIsAttached(pngFile.name);
Expand Down
4 changes: 2 additions & 2 deletions e2e/process-services/standalone-task.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ describe('Start Task - Task App', () => {
await apiService.getInstance().activiti.appsApi.importAppDefinition(file);

await loginPage.login(processUserModel.email, processUserModel.password);
});
});

beforeEach(async () => {
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
});
});

it('[C260421] Should a standalone task be displayed when creating a new task without form', async () => {
const task = await taskPage.createNewTask();
Expand Down
39 changes: 31 additions & 8 deletions lib/testing/src/lib/core/pages/data-table-component.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,28 @@ export class DataTableComponentPage {
await browser.actions().sendKeys(protractor.Key.NULL).perform();
}

async selectMultipleRows(columnName: string, items: string[]): Promise<void> {
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await this.clearRowsSelection();
await browser.actions().sendKeys(protractor.Key.COMMAND).perform();
for (const item of items) {
await this.selectRow(columnName, item);
}
await browser.actions().sendKeys(protractor.Key.NULL).perform();
}

async clearRowsSelection(): Promise<void> {
try {
const count = await this.getNumberOfSelectedRows();
if (count !== 0) {
await browser.refresh();
popovicsandras marked this conversation as resolved.
Show resolved Hide resolved
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement);
}
} catch (error) {
Logger.error('------ clearSelection catch : ', error);
}
}

async checkRowIsSelected(columnName: string, columnValue: string): Promise<void> {
const selectedRow = this.getCellElementByValue(columnName, columnValue).element(by.xpath(`ancestor::adf-datatable-row[contains(@class, 'is-selected')]`));
await BrowserVisibility.waitUntilElementIsVisible(selectedRow);
Expand Down Expand Up @@ -159,11 +181,7 @@ export class DataTableComponentPage {
}

async rightClickOnRow(columnName: string, columnValue: string): Promise<void> {
Logger.log(`Right Click On Row ${columnName} ${columnValue}`);

const row = this.getRow(columnName, columnValue);
await BrowserActions.rightClick(row);

await this.rightClickOnItem(columnName, columnValue);
await BrowserVisibility.waitUntilElementIsVisible(element(by.id('adf-context-menu-content')));
}

Expand All @@ -177,6 +195,11 @@ export class DataTableComponentPage {
await BrowserVisibility.waitUntilElementIsVisible(element(by.id('adf-context-menu-content')));
}

async rightClickOnItem(columnName: string, columnValue: string): Promise<void> {
const row = this.getRow(columnName, columnValue);
await BrowserActions.rightClick(row);
}

getFileHyperlink(filename: string): ElementFinder {
return element(by.cssContainingText('adf-name-column[class*="adf-datatable-link"] span', filename));
}
Expand Down Expand Up @@ -292,7 +315,7 @@ export class DataTableComponentPage {
}

getRow(columnName: string, columnValue: string): ElementFinder {
return this.rootElement.all(by.xpath(`//div[@title="${columnName}"]//div[@data-automation-id="text_${columnValue}"]//ancestor::adf-datatable-row[contains(@class, 'adf-datatable-row')]`)).first();
return this.rootElement.all(by.xpath(`//div[@title='${columnName}']//div[contains(@data-automation-id, '${columnValue}')]//ancestor::adf-datatable-row[contains(@class, 'adf-datatable-row')]`)).first();
}

getRowByIndex(index: number): ElementFinder {
Expand All @@ -304,8 +327,8 @@ export class DataTableComponentPage {
return BrowserActions.getText(this.contents.get(position - 1));
}

getCellElementByValue(columnName: string, columnValue: string): ElementFinder {
return this.rootElement.all(by.css(`div[title="${columnName}"] div[data-automation-id="text_${columnValue}"] span`)).first();
getCellElementByValue(columnName: string, columnValue: string, columnPrefix = 'text_'): ElementFinder {
return this.rootElement.all(by.css(`div[title="${columnName}"] div[data-automation-id="${columnPrefix}${columnValue}"] span`)).first();
}

async tableIsLoaded(): Promise<void> {
Expand Down
1 change: 0 additions & 1 deletion lib/testing/src/lib/core/utils/browser-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,5 +215,4 @@ export class BrowserActions {
stream.write(Buffer.from(pngData, 'base64'));
stream.end();
}

}