mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ACA-3373] Add e2e multi item select method in DataTable component (#6129)
* [ACA-3373] Update data-table component page object methods * Remove one line methods * Fix datatable-component and e2e test * Fix standalone-task-e2e test * Remove browser.sleep call
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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();
|
||||
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);
|
||||
@@ -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')));
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
@@ -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 {
|
||||
@@ -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> {
|
||||
|
@@ -215,5 +215,4 @@ export class BrowserActions {
|
||||
stream.write(Buffer.from(pngData, 'base64'));
|
||||
stream.end();
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user