From eefc2013324c83a288a4f174860d7fa4ed6df981 Mon Sep 17 00:00:00 2001 From: Geeta Mandakini Ayyalasomayajula <45559635+gmandakini@users.noreply.github.com> Date: Fri, 25 Oct 2019 01:07:18 +0100 Subject: [PATCH] added test for the visible flag both for process list and task list action menu and context menu (#5190) --- .../demo-shell/process-services/tasksCloudDemoPage.ts | 9 +++++++++ .../process-list-cloud-action-menu.e2e.ts | 4 ++++ .../task-list-cloud-action-menu.e2e.ts | 4 ++++ .../pages/process-list-cloud-component.page.ts | 7 ++++++- .../pages/task-list-cloud-component.page.ts | 7 ++++++- 5 files changed, 29 insertions(+), 2 deletions(-) diff --git a/e2e/pages/adf/demo-shell/process-services/tasksCloudDemoPage.ts b/e2e/pages/adf/demo-shell/process-services/tasksCloudDemoPage.ts index 5e5841296f..a584e9da4b 100644 --- a/e2e/pages/adf/demo-shell/process-services/tasksCloudDemoPage.ts +++ b/e2e/pages/adf/demo-shell/process-services/tasksCloudDemoPage.ts @@ -53,6 +53,7 @@ export class TasksCloudDemoPage { iconInputField: ElementFinder = element(by.css('input[placeholder="Icon"]')); addActionButton: ElementFinder = element(by.cssContainingText('button span', 'Add')); disableCheckbox: ElementFinder = element(by.css(`mat-checkbox[formcontrolname='disabled']`)); + visibleCheckbox: ElementFinder = element(by.css(`mat-checkbox[formcontrolname='visible']`)); formControllersPage: FormControllersPage = new FormControllersPage(); @@ -173,6 +174,14 @@ export class TasksCloudDemoPage { await BrowserActions.click(this.addActionButton); } + async addInvisibleAction(text: string): Promise { + await BrowserActions.clearSendKeys(this.keyInputField, text); + await BrowserActions.clearSendKeys(this.titleInputField, text); + await BrowserActions.clearSendKeys(this.iconInputField, text); + await BrowserActions.click(this.visibleCheckbox); + await BrowserActions.click(this.addActionButton); + } + async actionAdded(action: string): Promise { await BrowserVisibility.waitUntilElementIsVisible(element(by.cssContainingText(`mat-chip`, action))); } diff --git a/e2e/process-services-cloud/process-list-cloud-action-menu.e2e.ts b/e2e/process-services-cloud/process-list-cloud-action-menu.e2e.ts index 4affe23a02..1773496127 100644 --- a/e2e/process-services-cloud/process-list-cloud-action-menu.e2e.ts +++ b/e2e/process-services-cloud/process-list-cloud-action-menu.e2e.ts @@ -90,6 +90,8 @@ describe('Process list cloud', () => { await tasksCloudDemoPage.actionAdded('delete'); await tasksCloudDemoPage.addDisabledAction('disabledaction'); await tasksCloudDemoPage.actionAdded('disabledaction'); + await tasksCloudDemoPage.addInvisibleAction('invisibleaction'); + await tasksCloudDemoPage.actionAdded('invisibleaction'); await tasksCloudDemoPage.clickAppButton(); await processCloudDemoPage.clickOnProcessFilters(); await processCloudDemoPage.runningProcessesFilter().clickProcessFilter(); @@ -101,10 +103,12 @@ describe('Process list cloud', () => { await processCloudDemoPage.processListCloudComponent().checkContentIsDisplayedById(editProcess.entry.id); await processCloudDemoPage.processListCloudComponent().clickOptionsButton(editProcess.entry.id); await expect(await processCloudDemoPage.processListCloudComponent().isCustomActionEnabled('disabledaction')).toBe(false); + await expect(await processCloudDemoPage.processListCloudComponent().getNumberOfOptions()).toBe(3); await processCloudDemoPage.processListCloudComponent().clickOnCustomActionMenu('edit'); await processCloudDemoPage.checkActionExecuted(editProcess.entry.id, 'edit'); await processCloudDemoPage.processListCloudComponent().rightClickOnRow(deleteProcess.entry.id); await expect(await processCloudDemoPage.processListCloudComponent().isCustomActionEnabled('disabledaction')).toBe(false); + await expect(await processCloudDemoPage.processListCloudComponent().getNumberOfOptions()).toBe(3); await processCloudDemoPage.processListCloudComponent().clickContextMenuActionNamed('delete'); await processCloudDemoPage.checkActionExecuted(deleteProcess.entry.id, 'delete'); }); diff --git a/e2e/process-services-cloud/task-list-cloud-action-menu.e2e.ts b/e2e/process-services-cloud/task-list-cloud-action-menu.e2e.ts index 604c2a1fe8..1cdf52c53e 100644 --- a/e2e/process-services-cloud/task-list-cloud-action-menu.e2e.ts +++ b/e2e/process-services-cloud/task-list-cloud-action-menu.e2e.ts @@ -98,6 +98,8 @@ describe('Process list cloud', () => { await tasksCloudDemoPage.actionAdded('delete'); await tasksCloudDemoPage.addDisabledAction('disabledaction'); await tasksCloudDemoPage.actionAdded('disabledaction'); + await tasksCloudDemoPage.addInvisibleAction('invisibleaction'); + await tasksCloudDemoPage.actionAdded('invisibleaction'); await tasksCloudDemoPage.clickAppButton(); await tasksCloudDemoPage.editTaskFilterCloudComponent().openFilter(); await tasksCloudDemoPage.myTasksFilter().checkTaskFilterIsDisplayed(); @@ -109,10 +111,12 @@ describe('Process list cloud', () => { await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedById(editTask.list.entries[0].entry.id); await tasksCloudDemoPage.taskListCloudComponent().clickOptionsButton(editTask.list.entries[0].entry.id); await expect(await tasksCloudDemoPage.taskListCloudComponent().isCustomActionEnabled('disabledaction')).toBe(false); + await expect(await tasksCloudDemoPage.taskListCloudComponent().getNumberOfOptions()).toBe(3); await tasksCloudDemoPage.taskListCloudComponent().clickOnCustomActionMenu('edit'); await tasksCloudDemoPage.checkActionExecuted(editTask.list.entries[0].entry.id, 'edit'); await tasksCloudDemoPage.taskListCloudComponent().rightClickOnRow(deleteTask.list.entries[0].entry.id); await expect(await tasksCloudDemoPage.taskListCloudComponent().isCustomActionEnabled('disabledaction')).toBe(false); + await expect(await tasksCloudDemoPage.taskListCloudComponent().getNumberOfOptions()).toBe(3); await tasksCloudDemoPage.taskListCloudComponent().clickContextMenuActionNamed('delete'); await tasksCloudDemoPage.checkActionExecuted(deleteTask.list.entries[0].entry.id, 'delete'); }); diff --git a/lib/testing/src/lib/process-services-cloud/pages/process-list-cloud-component.page.ts b/lib/testing/src/lib/process-services-cloud/pages/process-list-cloud-component.page.ts index a01b7cf9ce..2e5b636ddc 100644 --- a/lib/testing/src/lib/process-services-cloud/pages/process-list-cloud-component.page.ts +++ b/lib/testing/src/lib/process-services-cloud/pages/process-list-cloud-component.page.ts @@ -29,7 +29,7 @@ export class ProcessListCloudComponentPage { processList: ElementFinder = element(by.css('adf-cloud-process-list')); noProcessFound: ElementFinder = element.all(by.css("div[class='adf-empty-content__title']")).first(); - actionMenu: ElementFinder = element(by.css('div[role="menu"]')); + actionMenu: ElementFinder = element(by.css('*[role="menu"]')); optionButton: Locator = by.css('button[data-automation-id*="action_menu_"]'); dataTable: DataTableComponentPage = new DataTableComponentPage(this.processList); @@ -127,4 +127,9 @@ export class ProcessListCloudComponentPage { await BrowserActions.clickExecuteScript(`button[data-automation-id="context-${actionName}"]`); } + async getNumberOfOptions(): Promise { + const options = await this.actionMenu.all(by.css(`button`)); + return options.length; + } + } diff --git a/lib/testing/src/lib/process-services-cloud/pages/task-list-cloud-component.page.ts b/lib/testing/src/lib/process-services-cloud/pages/task-list-cloud-component.page.ts index c7521c11a2..40de34f74b 100644 --- a/lib/testing/src/lib/process-services-cloud/pages/task-list-cloud-component.page.ts +++ b/lib/testing/src/lib/process-services-cloud/pages/task-list-cloud-component.page.ts @@ -36,7 +36,7 @@ export class TaskListCloudComponentPage { taskList = element(by.css('adf-cloud-task-list')); noTasksFound = element.all(by.css("div[class='adf-empty-content__title']")).first(); - actionMenu: ElementFinder = element(by.css('div[role="menu"]')); + actionMenu: ElementFinder = element(by.css('*[role="menu"]')); optionButton: Locator = by.css('button[data-automation-id*="action_menu_"]'); dataTable = new DataTableComponentPage(this.taskList); @@ -183,4 +183,9 @@ export class TaskListCloudComponentPage { await BrowserActions.clickExecuteScript(`button[data-automation-id="context-${actionName}"]`); } + async getNumberOfOptions(): Promise { + const options = await this.actionMenu.all(by.css(`button`)); + return options.length; + } + }