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> {
|
async doubleClickFile(name: string): Promise<void> {
|
||||||
await BrowserActions.closeMenuAndDialogs();
|
await BrowserActions.closeMenuAndDialogs();
|
||||||
await BrowserVisibility.waitUntilElementIsVisible(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();
|
const fileAttached = element.all(by.css(`div[data-automation-id="${name}"]`)).first();
|
||||||
await BrowserActions.click(fileAttached);
|
await BrowserActions.click(fileAttached);
|
||||||
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
|
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkFileIsRemoved(name: string): Promise<void> {
|
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);
|
await BrowserVisibility.waitUntilElementIsNotVisible(fileAttached);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -132,6 +132,7 @@ describe('Attachment list action menu for processes', () => {
|
|||||||
|
|
||||||
await processFiltersPage.selectFromProcessList(processName.completed);
|
await processFiltersPage.selectFromProcessList(processName.completed);
|
||||||
await processDetailsPage.checkProcessTitleIsDisplayed();
|
await processDetailsPage.checkProcessTitleIsDisplayed();
|
||||||
|
await processFiltersPage.waitForTableBody();
|
||||||
|
|
||||||
await attachmentListPage.clickAttachFileButton(pngFile.location);
|
await attachmentListPage.clickAttachFileButton(pngFile.location);
|
||||||
await attachmentListPage.checkFileIsAttached(pngFile.name);
|
await attachmentListPage.checkFileIsAttached(pngFile.name);
|
||||||
|
@@ -54,12 +54,12 @@ describe('Start Task - Task App', () => {
|
|||||||
await apiService.getInstance().activiti.appsApi.importAppDefinition(file);
|
await apiService.getInstance().activiti.appsApi.importAppDefinition(file);
|
||||||
|
|
||||||
await loginPage.login(processUserModel.email, processUserModel.password);
|
await loginPage.login(processUserModel.email, processUserModel.password);
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp()).clickTasksButton();
|
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp()).clickTasksButton();
|
||||||
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
|
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 () => {
|
it('[C260421] Should a standalone task be displayed when creating a new task without form', async () => {
|
||||||
const task = await taskPage.createNewTask();
|
const task = await taskPage.createNewTask();
|
||||||
|
@@ -105,6 +105,28 @@ export class DataTableComponentPage {
|
|||||||
await browser.actions().sendKeys(protractor.Key.NULL).perform();
|
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> {
|
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')]`));
|
const selectedRow = this.getCellElementByValue(columnName, columnValue).element(by.xpath(`ancestor::adf-datatable-row[contains(@class, 'is-selected')]`));
|
||||||
await BrowserVisibility.waitUntilElementIsVisible(selectedRow);
|
await BrowserVisibility.waitUntilElementIsVisible(selectedRow);
|
||||||
@@ -159,11 +181,7 @@ export class DataTableComponentPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async rightClickOnRow(columnName: string, columnValue: string): Promise<void> {
|
async rightClickOnRow(columnName: string, columnValue: string): Promise<void> {
|
||||||
Logger.log(`Right Click On Row ${columnName} ${columnValue}`);
|
await this.rightClickOnItem(columnName, columnValue);
|
||||||
|
|
||||||
const row = this.getRow(columnName, columnValue);
|
|
||||||
await BrowserActions.rightClick(row);
|
|
||||||
|
|
||||||
await BrowserVisibility.waitUntilElementIsVisible(element(by.id('adf-context-menu-content')));
|
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')));
|
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 {
|
getFileHyperlink(filename: string): ElementFinder {
|
||||||
return element(by.cssContainingText('adf-name-column[class*="adf-datatable-link"] span', filename));
|
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 {
|
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 {
|
getRowByIndex(index: number): ElementFinder {
|
||||||
@@ -304,8 +327,8 @@ export class DataTableComponentPage {
|
|||||||
return BrowserActions.getText(this.contents.get(position - 1));
|
return BrowserActions.getText(this.contents.get(position - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
getCellElementByValue(columnName: string, columnValue: string): ElementFinder {
|
getCellElementByValue(columnName: string, columnValue: string, columnPrefix = 'text_'): ElementFinder {
|
||||||
return this.rootElement.all(by.css(`div[title="${columnName}"] div[data-automation-id="text_${columnValue}"] span`)).first();
|
return this.rootElement.all(by.css(`div[title="${columnName}"] div[data-automation-id="${columnPrefix}${columnValue}"] span`)).first();
|
||||||
}
|
}
|
||||||
|
|
||||||
async tableIsLoaded(): Promise<void> {
|
async tableIsLoaded(): Promise<void> {
|
||||||
|
@@ -215,5 +215,4 @@ export class BrowserActions {
|
|||||||
stream.write(Buffer.from(pngData, 'base64'));
|
stream.write(Buffer.from(pngData, 'base64'));
|
||||||
stream.end();
|
stream.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user