From 2badd8163403bc70c296128fc33c8f270a06542b Mon Sep 17 00:00:00 2001 From: rgherghelas <39947234+rgherghelas@users.noreply.github.com> Date: Tue, 5 Feb 2019 14:54:40 +0200 Subject: [PATCH] [ADF-3828] - e2e add assignee tests (#4221) * add identity host * add test for assign user * clear assignee input field * added hostIdentity parameter * add test for default assignee user * add hostIdentity parameter * add test for remove assignee * add a new constant for start task name * add hostIdentitty in setProviderBpmSso method * remove duplicated method * fix test C291799 * fix test C291872 --- e2e/core/icons-component.e2e.ts | 4 +- e2e/core/login/login-sso/login-sso.e2e.ts | 4 +- e2e/core/user-info-component-cloud.e2e.ts | 2 +- e2e/pages/adf/dataTablePage.ts | 4 -- .../editTaskFilterCloudComponent.ts | 14 ++++++ .../process-cloud/startTasksCloudComponent.ts | 3 +- e2e/pages/adf/settingsPage.ts | 12 ++++- .../apps-section-cloud.e2e.ts | 2 +- .../edit-task-filters-component.e2e.ts | 5 +-- .../process-custom-filters.e2e.ts | 2 +- .../process-filters-cloud.e2e.ts | 2 +- .../start-process-cloud.e2e.ts | 2 +- .../start-task-custom-app-cloud.e2e.ts | 44 ++++++++++++++++--- .../task-details-cloud.e2e.ts | 2 +- .../task-filters-cloud.e2e.ts | 2 +- .../tasks-custom-filters.e2e.ts | 2 +- 16 files changed, 76 insertions(+), 30 deletions(-) diff --git a/e2e/core/icons-component.e2e.ts b/e2e/core/icons-component.e2e.ts index 041ecb9e97..f7c192b161 100644 --- a/e2e/core/icons-component.e2e.ts +++ b/e2e/core/icons-component.e2e.ts @@ -52,11 +52,11 @@ describe('Universal Icon component', function () { it('[C291872] Should display the icons on the page', () => { - expect(iconsPage.locateLigatureIcon('alarm').isDisplayed()).toBe(true, 'Ligature icon is not displayed'); + expect(iconsPage.locateLigatureIcon('folder').isDisplayed()).toBe(true, 'Ligature icon is not displayed'); expect(iconsPage.locateCustomIcon('adf:move_file').isDisplayed()).toBe(true, 'Named icon is not displayed'); - expect(iconsPage.locateCustomIcon('image/gif').isDisplayed()).toBe(true, 'Thumbnail service icon is not displayed'); + expect(iconsPage.locateCustomIcon('adf:folder').isDisplayed()).toBe(true, 'Thumbnail service icon is not displayed'); }); }); diff --git a/e2e/core/login/login-sso/login-sso.e2e.ts b/e2e/core/login/login-sso/login-sso.e2e.ts index cf3248ed6d..639ada637b 100644 --- a/e2e/core/login/login-sso/login-sso.e2e.ts +++ b/e2e/core/login/login-sso/login-sso.e2e.ts @@ -36,13 +36,13 @@ describe('Login component - SSO', () => { it('[C261050] Should be possible login in the PS with SSO', () => { silentLogin = false; - settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, silentLogin); + settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, TestConfig.adf.hostIdentity, silentLogin); loginApsPage.clickOnSSOButton(); loginApsPage.loginAPS(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); }); it('[C280667] Should be redirect directly to keycloak without show the login page with silent login', () => { - settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso); + settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, TestConfig.adf.hostIdentity); loginApsPage.loginAPS(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); }); }); diff --git a/e2e/core/user-info-component-cloud.e2e.ts b/e2e/core/user-info-component-cloud.e2e.ts index b13004fc81..20b3859ac5 100644 --- a/e2e/core/user-info-component-cloud.e2e.ts +++ b/e2e/core/user-info-component-cloud.e2e.ts @@ -36,7 +36,7 @@ describe('User Info - SSO', () => { await identityService.init(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); identityUser = await identityService.createIdentityUser(); silentLogin = false; - settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, silentLogin); + settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, TestConfig.adf.hostIdentity, silentLogin); loginSSOPage.clickOnSSOButton(); browser.ignoreSynchronization = true; loginSSOPage.loginAPS(identityUser['0'].username, identityUser['0'].password); diff --git a/e2e/pages/adf/dataTablePage.ts b/e2e/pages/adf/dataTablePage.ts index e53dc2f9dd..ea702d3f1f 100644 --- a/e2e/pages/adf/dataTablePage.ts +++ b/e2e/pages/adf/dataTablePage.ts @@ -251,10 +251,6 @@ export class DataTablePage { return this; } - checkSpinnerIsNotDisplayed() { - Util.waitUntilElementIsNotOnPage(this.spinner); - } - checkRowIsDisplayedByName(filename) { Util.waitUntilElementIsVisible(element.all(by.css(`div[filename="${filename}"]`)).first()); } diff --git a/e2e/pages/adf/process-cloud/editTaskFilterCloudComponent.ts b/e2e/pages/adf/process-cloud/editTaskFilterCloudComponent.ts index b503b746b2..3d6480f9b0 100644 --- a/e2e/pages/adf/process-cloud/editTaskFilterCloudComponent.ts +++ b/e2e/pages/adf/process-cloud/editTaskFilterCloudComponent.ts @@ -152,4 +152,18 @@ export class EditTaskFilterCloudComponent { return this; } + clearAssignment() { + this.clearField(this.assignment); + return this; + } + + clearField(locator) { + Util.waitUntilElementIsVisible(locator); + locator.getAttribute('value').then((result) => { + for (let i = result.length; i >= 0; i--) { + locator.sendKeys(protractor.Key.BACK_SPACE); + } + }); + } + } diff --git a/e2e/pages/adf/process-cloud/startTasksCloudComponent.ts b/e2e/pages/adf/process-cloud/startTasksCloudComponent.ts index 52e221e431..d442eade32 100644 --- a/e2e/pages/adf/process-cloud/startTasksCloudComponent.ts +++ b/e2e/pages/adf/process-cloud/startTasksCloudComponent.ts @@ -57,6 +57,7 @@ export class StartTasksCloudComponent { addAssignee(name) { Util.waitUntilElementIsVisible(this.assignee); + this.assignee.clear(); this.assignee.sendKeys(name); this.selectAssigneeFromList(name); return this; @@ -72,7 +73,7 @@ export class StartTasksCloudComponent { getAssignee() { Util.waitUntilElementIsVisible(this.assignee); - return this.assignee.getAttribute('placeholder'); + return this.assignee.getAttribute('value'); } clickStartButton() { diff --git a/e2e/pages/adf/settingsPage.ts b/e2e/pages/adf/settingsPage.ts index 1f46b5720e..688d772e31 100644 --- a/e2e/pages/adf/settingsPage.ts +++ b/e2e/pages/adf/settingsPage.ts @@ -44,8 +44,9 @@ export class SettingsPage { bpmText = element(by.css('input[data-automation-id*="bpmHost"]')); clientIdText = element(by.css('input[id="clientId"]')); authHostText = element(by.css('input[id="oauthHost"]')); - ssoRadioButton = element(by.cssContainingText('mat-radio-button[id*="mat-radio"]', 'SSO')); basicAuthRadioButton = element(by.cssContainingText('mat-radio-button[id*="mat-radio"]', 'Basic Authentication')); + identityHostText = element(by.css('input[id="identityHost"]')); + ssoRadioButton = element(by.cssContainingText('[id*="mat-radio"]', 'SSO')); silentLoginToggleLabel = element(by.css('mat-slide-toggle[name="silentLogin"] label')); silentLoginToggleElement = element(by.css('mat-slide-toggle[name="silentLogin"]')); implicitFlowLabel = element(by.css('mat-slide-toggle[name="implicitFlow"] label')); @@ -139,7 +140,7 @@ export class SettingsPage { await this.ssoRadioButton.click(); } - async setProviderBpmSso (processServiceURL, authHost, silentLogin = true, implicitFlow = true ) { + async setProviderBpmSso (processServiceURL, authHost, identityHost, silentLogin = true, implicitFlow = true ) { this.goToSettingsPage(); this.setProvider(this.bpm.option, this.bpm.text); Util.waitUntilElementIsVisible(this.bpmText); @@ -148,6 +149,7 @@ export class SettingsPage { await this.setClientId(); await this.setProcessServicesURL(processServiceURL); await this.setAuthHost(authHost); + await this.setIdentityHost(identityHost); await this.setSilentLogin(silentLogin); await this.setImplicitFlow(implicitFlow); await this.clickApply(); @@ -191,6 +193,12 @@ export class SettingsPage { await this.authHostText.sendKeys(authHostURL); } + async setIdentityHost (identityHost) { + Util.waitUntilElementIsVisible(this.identityHostText); + await this.identityHostText.clear(); + await this.identityHostText.sendKeys(identityHost); + } + async clickApply () { Util.waitUntilElementIsVisible(this.applyButton); await this.applyButton.click(); diff --git a/e2e/process-services-cloud/apps-section-cloud.e2e.ts b/e2e/process-services-cloud/apps-section-cloud.e2e.ts index 67cfd38b2e..9d271fba14 100644 --- a/e2e/process-services-cloud/apps-section-cloud.e2e.ts +++ b/e2e/process-services-cloud/apps-section-cloud.e2e.ts @@ -30,7 +30,7 @@ describe('Applications list', () => { const appName = 'simple-app'; it('[C289910] Should the app be displayed on dashboard when is deployed on APS', () => { - settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso); + settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, TestConfig.adf.hostIdentity); loginSSOPage.loginAPS(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); navigationBarPage.navigateToProcessServicesCloudPage(); appListCloudComponent.checkApsContainer(); diff --git a/e2e/process-services-cloud/edit-task-filters-component.e2e.ts b/e2e/process-services-cloud/edit-task-filters-component.e2e.ts index 1d01c7e221..a694a991c8 100644 --- a/e2e/process-services-cloud/edit-task-filters-component.e2e.ts +++ b/e2e/process-services-cloud/edit-task-filters-component.e2e.ts @@ -43,7 +43,7 @@ describe('Edit task filters cloud', () => { beforeAll(async () => { silentLogin = false; - settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, silentLogin); + settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, TestConfig.adf.hostIdentity, silentLogin); loginSSOPage.clickOnSSOButton(); loginSSOPage.loginAPS(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); @@ -62,9 +62,6 @@ describe('Edit task filters cloud', () => { afterEach((done) => { tasksCloudDemoPage.myTasksFilter().clickTaskFilter(); - tasksCloudDemoPage.editTaskFilterCloudComponent().clickCustomiseFilterHeader().setSortFilterDropDown('Created Date'); - expect(tasksCloudDemoPage.editTaskFilterCloudComponent().getSortFilterDropDownValue()).toEqual('Created Date'); - tasksCloudDemoPage.editTaskFilterCloudComponent().clickSaveButton(); done(); }); diff --git a/e2e/process-services-cloud/process-custom-filters.e2e.ts b/e2e/process-services-cloud/process-custom-filters.e2e.ts index bd42f16abb..e0125837f5 100644 --- a/e2e/process-services-cloud/process-custom-filters.e2e.ts +++ b/e2e/process-services-cloud/process-custom-filters.e2e.ts @@ -51,7 +51,7 @@ describe('Process list cloud', () => { beforeAll(async () => { silentLogin = false; - settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, silentLogin); + settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, TestConfig.adf.hostIdentity, silentLogin); loginSSOPage.clickOnSSOButton(); loginSSOPage.loginAPS(user, password); diff --git a/e2e/process-services-cloud/process-filters-cloud.e2e.ts b/e2e/process-services-cloud/process-filters-cloud.e2e.ts index 197be06821..44863ae17e 100644 --- a/e2e/process-services-cloud/process-filters-cloud.e2e.ts +++ b/e2e/process-services-cloud/process-filters-cloud.e2e.ts @@ -51,7 +51,7 @@ describe('Process filters cloud', () => { beforeAll(async () => { silentLogin = false; - settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, silentLogin); + settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, TestConfig.adf.hostIdentity, silentLogin); loginSSOPage.clickOnSSOButton(); loginSSOPage.loginAPS(user, password); diff --git a/e2e/process-services-cloud/start-process-cloud.e2e.ts b/e2e/process-services-cloud/start-process-cloud.e2e.ts index 5689de1395..2be85eb011 100644 --- a/e2e/process-services-cloud/start-process-cloud.e2e.ts +++ b/e2e/process-services-cloud/start-process-cloud.e2e.ts @@ -43,7 +43,7 @@ describe('Start Process', () => { beforeAll((done) => { silentLogin = false; - settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, silentLogin); + settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, TestConfig.adf.hostIdentity, silentLogin); loginSSOPage.clickOnSSOButton(); loginSSOPage.loginAPS(user, password); navigationBarPage.navigateToProcessServicesCloudPage(); diff --git a/e2e/process-services-cloud/start-task-custom-app-cloud.e2e.ts b/e2e/process-services-cloud/start-task-custom-app-cloud.e2e.ts index 1be46ae935..e9d308b0cb 100644 --- a/e2e/process-services-cloud/start-task-custom-app-cloud.e2e.ts +++ b/e2e/process-services-cloud/start-task-custom-app-cloud.e2e.ts @@ -32,7 +32,8 @@ describe('Start Task', () => { const appListCloudComponent = new AppListCloudComponent(); const tasksCloudDemoPage = new TasksCloudDemoPage(); const startTask = new StartTasksCloudComponent(); - const standaloneTaskName = Util.generateRandomString(5); + const standaloneTaskName1 = Util.generateRandomString(5); + const standaloneTaskName2 = Util.generateRandomString(5); const taskName255Characters = Util.generateRandomString(255); const taskNameBiggerThen255Characters = Util.generateRandomString(256); const lengthValidationError = 'Length exceeded, 255 characters max.'; @@ -44,7 +45,7 @@ describe('Start Task', () => { beforeAll((done) => { silentLogin = false; - settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, silentLogin); + settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, TestConfig.adf.hostIdentity, silentLogin); loginSSOPage.clickOnSSOButton(); loginSSOPage.loginAPS(user, password); navigationBarPage.navigateToProcessServicesCloudPage(); @@ -60,22 +61,22 @@ describe('Start Task', () => { startTask.checkStartButtonIsDisabled() .blur(startTask.name) .checkValidationErrorIsDisplayed(requiredError); - startTask.addName(standaloneTaskName) + startTask.addName(standaloneTaskName1) .addDescription('descriptions') .addDueDate('12/12/2018'); startTask.checkStartButtonIsEnabled(); startTask.clickCancelButton(); - tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkContentIsNotDisplayed(standaloneTaskName); + tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkContentIsNotDisplayed(standaloneTaskName1); }); it('[C290180] Should be able to create a new standalone task', () => { tasksCloudDemoPage.openNewTaskForm(); - startTask.addName(standaloneTaskName) + startTask.addName(standaloneTaskName1) .addDescription('descriptions') .addDueDate('12/12/2018') .addPriority('50') .clickStartButton(); - tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkContentIsDisplayed(standaloneTaskName); + tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkContentIsDisplayed(standaloneTaskName1); }); it('[C290181] Should be displayed an error message if task name exceed 255 characters', () => { @@ -96,7 +97,36 @@ describe('Start Task', () => { startTask.addDueDate('invalid date') .blur(startTask.dueDate) .validateDate(dateValidationError) - .checkStartButtonIsDisabled(); + .checkStartButtonIsDisabled() + .clickCancelButton(); + }); + + it('[C290182] Should be possible to assign the task to another user', () => { + tasksCloudDemoPage.openNewTaskForm(); + startTask.addName(standaloneTaskName1) + .addAssignee('Super Admin') + .clickStartButton(); + tasksCloudDemoPage.myTasksFilter().clickTaskFilter(); + expect(tasksCloudDemoPage.getActiveFilterName()).toBe('My Tasks'); + tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkContentIsNotDisplayed(standaloneTaskName1); + }); + + it('[C291953] Assignee field should display the logged user as default', () => { + tasksCloudDemoPage.openNewTaskForm(); + expect(startTask.getAssignee()).toContain('Admin', 'does not contain Admin'); + startTask.clickCancelButton(); + }); + + it('[C291956] Should be able to create a new standalone task without assignee', () => { + tasksCloudDemoPage.openNewTaskForm(); + startTask.addName(standaloneTaskName2); + startTask.clearField(startTask.assignee); + startTask.clickStartButton(); + tasksCloudDemoPage.editTaskFilterCloudComponent() + .clickCustomiseFilterHeader() + .setStateFilterDropDown('CREATED') + .clearAssignment(); + tasksCloudDemoPage.taskListCloudComponent().getDataTable().checkContentIsDisplayed(standaloneTaskName2); }); }); diff --git a/e2e/process-services-cloud/task-details-cloud.e2e.ts b/e2e/process-services-cloud/task-details-cloud.e2e.ts index e589362e4f..9b2b743ed2 100644 --- a/e2e/process-services-cloud/task-details-cloud.e2e.ts +++ b/e2e/process-services-cloud/task-details-cloud.e2e.ts @@ -53,7 +53,7 @@ describe('Task Header cloud component', () => { beforeAll(async (done) => { silentLogin = false; - settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, silentLogin); + settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, TestConfig.adf.hostIdentity, silentLogin); loginSSOPage.clickOnSSOButton(); loginSSOPage.loginAPS(user, password); diff --git a/e2e/process-services-cloud/task-filters-cloud.e2e.ts b/e2e/process-services-cloud/task-filters-cloud.e2e.ts index 86d537ba0b..b37824e22d 100644 --- a/e2e/process-services-cloud/task-filters-cloud.e2e.ts +++ b/e2e/process-services-cloud/task-filters-cloud.e2e.ts @@ -42,7 +42,7 @@ describe('Task filters cloud', () => { beforeAll(() => { silentLogin = false; - settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, silentLogin); + settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, TestConfig.adf.hostIdentity, silentLogin); loginSSOPage.clickOnSSOButton(); loginSSOPage.loginAPS(user, password); }); diff --git a/e2e/process-services-cloud/tasks-custom-filters.e2e.ts b/e2e/process-services-cloud/tasks-custom-filters.e2e.ts index 28e0b214ee..19d1403527 100644 --- a/e2e/process-services-cloud/tasks-custom-filters.e2e.ts +++ b/e2e/process-services-cloud/tasks-custom-filters.e2e.ts @@ -57,7 +57,7 @@ describe('Task filters cloud', () => { beforeAll(async () => { silentLogin = false; - settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, silentLogin); + settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, TestConfig.adf.hostIdentity, silentLogin); loginSSOPage.clickOnSSOButton(); loginSSOPage.loginAPS(user, password);