mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-1923] Form APS E2E (#5540)
* [AAE-1923] Form APS E2E * * minor changes * * fixed e2e
This commit is contained in:
@@ -139,7 +139,8 @@
|
|||||||
"processparent",
|
"processparent",
|
||||||
"uploadfileform",
|
"uploadfileform",
|
||||||
"processwithstarteventform",
|
"processwithstarteventform",
|
||||||
"processstring"
|
"processstring",
|
||||||
|
"typeahed"
|
||||||
],
|
],
|
||||||
"dictionaries": [
|
"dictionaries": [
|
||||||
"html",
|
"html",
|
||||||
|
@@ -56,9 +56,9 @@ export class UsersActions {
|
|||||||
async createApsUserWithName(alfrescoJsApi, tenantId, email, firstName, lastName) {
|
async createApsUserWithName(alfrescoJsApi, tenantId, email, firstName, lastName) {
|
||||||
const user = new User({ tenantId , email, firstName, lastName});
|
const user = new User({ tenantId , email, firstName, lastName});
|
||||||
|
|
||||||
await alfrescoJsApi.activiti.adminUsersApi.createNewUser(user);
|
const { id } = await alfrescoJsApi.activiti.adminUsersApi.createNewUser(user);
|
||||||
|
|
||||||
return user;
|
return { ...user, id };
|
||||||
}
|
}
|
||||||
|
|
||||||
async cleanupTenant(alfrescoJsApi, tenantId) {
|
async cleanupTenant(alfrescoJsApi, tenantId) {
|
||||||
|
@@ -65,6 +65,7 @@ export class TaskDetailsPage {
|
|||||||
editableAssignee = element(by.css('span[data-automation-id="card-textitem-value-assignee"][class*="clickable"]'));
|
editableAssignee = element(by.css('span[data-automation-id="card-textitem-value-assignee"][class*="clickable"]'));
|
||||||
claimElement = element(by.css('[data-automation-id="header-claim-button"]'));
|
claimElement = element(by.css('[data-automation-id="header-claim-button"]'));
|
||||||
releaseElement = element(by.css('[data-automation-id="header-unclaim-button"]'));
|
releaseElement = element(by.css('[data-automation-id="header-unclaim-button"]'));
|
||||||
|
saveFormButton = element(by.css('button[id="adf-form-save"]'));
|
||||||
|
|
||||||
attachFormDropdown = new DropdownPage(element(by.css('div[class="adf-attach-form-row"]')));
|
attachFormDropdown = new DropdownPage(element(by.css('div[class="adf-attach-form-row"]')));
|
||||||
|
|
||||||
@@ -430,4 +431,9 @@ export class TaskDetailsPage {
|
|||||||
await BrowserActions.click(this.releaseElement);
|
await BrowserActions.click(this.releaseElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async saveTaskForm(): Promise<void> {
|
||||||
|
await BrowserVisibility.waitUntilElementIsVisible(this.saveFormButton);
|
||||||
|
await BrowserActions.click(this.saveFormButton);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -32,28 +32,24 @@ describe('Dynamic Table', () => {
|
|||||||
const datePicker = new DatePickerCalendarPage();
|
const datePicker = new DatePickerCalendarPage();
|
||||||
const navigationBarPage = new NavigationBarPage();
|
const navigationBarPage = new NavigationBarPage();
|
||||||
const widget = new Widget();
|
const widget = new Widget();
|
||||||
let user, tenantId, appId, apps, users;
|
const apps = new AppsActions();
|
||||||
|
const users = new UsersActions();
|
||||||
beforeAll(async () => {
|
const alfrescoJsApi = new AlfrescoApi({
|
||||||
this.alfrescoJsApi = new AlfrescoApi({
|
|
||||||
provider: 'BPM',
|
provider: 'BPM',
|
||||||
hostBpm: browser.params.testConfig.adf_aps.host
|
hostBpm: browser.params.testConfig.adf_aps.host
|
||||||
});
|
});
|
||||||
|
|
||||||
apps = new AppsActions();
|
let user, tenantId, appId;
|
||||||
users = new UsersActions();
|
|
||||||
|
|
||||||
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
|
|
||||||
|
|
||||||
user = await users.createTenantAndUser(this.alfrescoJsApi);
|
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
await alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
|
||||||
|
user = await users.createTenantAndUser(alfrescoJsApi);
|
||||||
tenantId = user.tenantId;
|
tenantId = user.tenantId;
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
|
await alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
|
||||||
|
await alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(tenantId);
|
||||||
await this.alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(tenantId);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Date Picker', () => {
|
describe('Date Picker', () => {
|
||||||
@@ -71,23 +67,19 @@ describe('Dynamic Table', () => {
|
|||||||
const rowPosition = 0;
|
const rowPosition = 0;
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await this.alfrescoJsApi.login(user.email, user.password);
|
await alfrescoJsApi.login(user.email, user.password);
|
||||||
|
const importedApp = await apps.importPublishDeployApp(alfrescoJsApi, app.file_location);
|
||||||
const importedApp = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location);
|
|
||||||
appId = importedApp.id;
|
appId = importedApp.id;
|
||||||
|
|
||||||
await loginPage.loginToProcessServicesUsingUserModel(user);
|
await loginPage.loginToProcessServicesUsingUserModel(user);
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
await this.alfrescoJsApi.login(user.email, user.password);
|
await alfrescoJsApi.login(user.email, user.password);
|
||||||
|
await alfrescoJsApi.activiti.modelsApi.deleteModel(appId);
|
||||||
await this.alfrescoJsApi.activiti.modelsApi.deleteModel(appId);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp()).clickProcessButton();
|
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp()).clickProcessButton();
|
||||||
|
|
||||||
await processServiceTabBarPage.clickProcessButton();
|
await processServiceTabBarPage.clickProcessButton();
|
||||||
|
|
||||||
await processFiltersPage.clickCreateProcessButton();
|
await processFiltersPage.clickCreateProcessButton();
|
||||||
@@ -95,14 +87,14 @@ describe('Dynamic Table', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('[C286277] Should have a datepicker and a mask for DateTime field', async () => {
|
it('[C286277] Should have a datepicker and a mask for DateTime field', async () => {
|
||||||
await widget.dynamicTable().clickAddButton();
|
await widget.dynamicTable().clickAddRow();
|
||||||
await widget.dynamicTable().clickColumnDateTime();
|
await widget.dynamicTable().clickColumnDateTime();
|
||||||
|
|
||||||
await expect(await widget.dynamicTable().addRandomStringOnDateTime(randomText.wrongDateTime)).toBe('');
|
await expect(await widget.dynamicTable().addRandomStringOnDateTime(randomText.wrongDateTime)).toBe('');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[C286279] Should be able to save row with Date field', async () => {
|
it('[C286279] Should be able to save row with Date field', async () => {
|
||||||
await widget.dynamicTable().clickAddButton();
|
await widget.dynamicTable().clickAddRow();
|
||||||
await widget.dynamicTable().addRandomStringOnDate(randomText.wrongDate);
|
await widget.dynamicTable().addRandomStringOnDate(randomText.wrongDate);
|
||||||
await widget.dynamicTable().clickSaveButton();
|
await widget.dynamicTable().clickSaveButton();
|
||||||
await expect(await widget.dynamicTable().checkErrorMessage()).toBe(randomText.error);
|
await expect(await widget.dynamicTable().checkErrorMessage()).toBe(randomText.error);
|
||||||
@@ -116,7 +108,7 @@ describe('Dynamic Table', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('[C311456] Should be able to delete date that is not mandatory and save the Dynamic Table', async () => {
|
it('[C311456] Should be able to delete date that is not mandatory and save the Dynamic Table', async () => {
|
||||||
await widget.dynamicTable().clickAddButton();
|
await widget.dynamicTable().clickAddRow();
|
||||||
await widget.dynamicTable().clickSaveButton();
|
await widget.dynamicTable().clickSaveButton();
|
||||||
await expect(await widget.dynamicTable().checkErrorMessage()).toBe(randomText.requiredError);
|
await expect(await widget.dynamicTable().checkErrorMessage()).toBe(randomText.requiredError);
|
||||||
|
|
||||||
@@ -135,35 +127,29 @@ describe('Dynamic Table', () => {
|
|||||||
const dropdown = widget.dropdown();
|
const dropdown = widget.dropdown();
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
|
await alfrescoJsApi.login(user.email, user.password);
|
||||||
|
|
||||||
await this.alfrescoJsApi.login(user.email, user.password);
|
const importedApp = await apps.importPublishDeployApp(alfrescoJsApi, app.file_location);
|
||||||
|
|
||||||
const importedApp = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location);
|
|
||||||
appId = importedApp.id;
|
appId = importedApp.id;
|
||||||
|
|
||||||
await loginPage.loginToProcessServicesUsingUserModel(user);
|
await loginPage.loginToProcessServicesUsingUserModel(user);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
await this.alfrescoJsApi.login(user.email, user.password);
|
await alfrescoJsApi.login(user.email, user.password);
|
||||||
|
await alfrescoJsApi.activiti.modelsApi.deleteModel(appId);
|
||||||
await this.alfrescoJsApi.activiti.modelsApi.deleteModel(appId);
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToApp(app.title)).clickProcessButton();
|
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToApp(app.title)).clickProcessButton();
|
||||||
|
|
||||||
await processServiceTabBarPage.clickProcessButton();
|
await processServiceTabBarPage.clickProcessButton();
|
||||||
|
|
||||||
await processFiltersPage.clickCreateProcessButton();
|
await processFiltersPage.clickCreateProcessButton();
|
||||||
await processFiltersPage.clickNewProcessDropdown();
|
await processFiltersPage.clickNewProcessDropdown();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[C286519] Should be able to save row with required dropdown column', async () => {
|
it('[C286519] Should be able to save row with required dropdown column', async () => {
|
||||||
const dropdownOption = 'Option 1';
|
const dropdownOption = 'Option 1';
|
||||||
await widget.dynamicTable().clickAddButton();
|
await widget.dynamicTable().clickAddRow();
|
||||||
await dropdown.selectOption(dropdownOption);
|
await dropdown.selectOption(dropdownOption);
|
||||||
await widget.dynamicTable().clickSaveButton();
|
await widget.dynamicTable().clickSaveButton();
|
||||||
await widget.dynamicTable().checkItemIsPresent(dropdownOption);
|
await widget.dynamicTable().checkItemIsPresent(dropdownOption);
|
||||||
|
100
e2e/process-services/stencil.e2e.ts
Normal file
100
e2e/process-services/stencil.e2e.ts
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Copyright 2019 Alfresco Software, Ltd.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
|
||||||
|
import { AppsActions } from '../actions/APS/apps.actions';
|
||||||
|
import { UsersActions } from '../actions/users.actions';
|
||||||
|
import { LoginPage } from '@alfresco/adf-testing';
|
||||||
|
import { TasksPage } from '../pages/adf/process-services/tasks.page';
|
||||||
|
import { browser } from 'protractor';
|
||||||
|
import { User } from '../models/APS/user';
|
||||||
|
import { NavigationBarPage } from '../pages/adf/navigation-bar.page';
|
||||||
|
import { ProcessServiceTabBarPage } from '../pages/adf/process-services/process-service-tab-bar.page';
|
||||||
|
import { StartProcessPage } from '../pages/adf/process-services/start-process.page';
|
||||||
|
import { ProcessListDemoPage } from '../pages/adf/demo-shell/process-services/process-list-demo.page';
|
||||||
|
import { ProcessFiltersPage } from '../pages/adf/process-services/process-filters.page';
|
||||||
|
import { ProcessDetailsPage } from '../pages/adf/process-services/process-details.page';
|
||||||
|
import { ProcessListPage } from '../pages/adf/process-services/process-list.page';
|
||||||
|
import CONSTANTS = require('../util/constants');
|
||||||
|
|
||||||
|
describe('Stencil', () => {
|
||||||
|
|
||||||
|
const loginPage = new LoginPage();
|
||||||
|
const taskPage = new TasksPage();
|
||||||
|
const navigationBarPage = new NavigationBarPage();
|
||||||
|
const processServiceTabBarPage = new ProcessServiceTabBarPage();
|
||||||
|
const startProcessPage = new StartProcessPage();
|
||||||
|
const processListDemoPage = new ProcessListDemoPage();
|
||||||
|
const processListPage = new ProcessListPage();
|
||||||
|
const processDetailsPage = new ProcessDetailsPage();
|
||||||
|
const processFiltersPage = new ProcessFiltersPage();
|
||||||
|
const usersActions = new UsersActions();
|
||||||
|
const alfrescoJsApi = new AlfrescoApi({
|
||||||
|
provider: 'BPM',
|
||||||
|
hostBpm: browser.params.testConfig.adf_aps.host
|
||||||
|
});
|
||||||
|
|
||||||
|
const app = browser.params.resources.Files.STENCIL_PROCESS;
|
||||||
|
let user: User;
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
const appsActions = new AppsActions();
|
||||||
|
await alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
|
||||||
|
user = await usersActions.createTenantAndUser(alfrescoJsApi);
|
||||||
|
|
||||||
|
await alfrescoJsApi.login(user.email, user.password);
|
||||||
|
await appsActions.importPublishDeployApp(alfrescoJsApi, app.file_location);
|
||||||
|
await loginPage.loginToProcessServicesUsingUserModel(user);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
|
||||||
|
await alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(user.tenantId);
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp();
|
||||||
|
await taskPage.tasksListPage().checkTaskListIsLoaded();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('[C245648] Can start an app with custom stencil included', async () => {
|
||||||
|
const name = 'test stencil process';
|
||||||
|
await processServiceTabBarPage.clickProcessButton();
|
||||||
|
await processListPage.checkProcessListIsDisplayed();
|
||||||
|
await processFiltersPage.clickCreateProcessButton();
|
||||||
|
await processFiltersPage.clickNewProcessDropdown();
|
||||||
|
|
||||||
|
await startProcessPage.startProcess({ name, processName: app.processName });
|
||||||
|
await processListDemoPage.checkProcessIsDisplayed(name);
|
||||||
|
await processFiltersPage.selectFromProcessList(name);
|
||||||
|
|
||||||
|
await processDetailsPage.clickOnActiveTask();
|
||||||
|
await taskPage.tasksListPage().checkTaskListIsLoaded();
|
||||||
|
await taskPage.taskDetails().clickCompleteTask();
|
||||||
|
|
||||||
|
await processServiceTabBarPage.clickProcessButton();
|
||||||
|
await processFiltersPage.checkNoContentMessage();
|
||||||
|
|
||||||
|
await processFiltersPage.clickCompletedFilterButton();
|
||||||
|
await processListDemoPage.checkProcessIsDisplayed(name);
|
||||||
|
|
||||||
|
await processServiceTabBarPage.clickTasksButton();
|
||||||
|
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS);
|
||||||
|
await taskPage.tasksListPage().checkTaskListIsLoaded();
|
||||||
|
await taskPage.tasksListPage().checkContentIsDisplayed(app.taskName);
|
||||||
|
});
|
||||||
|
});
|
@@ -27,11 +27,13 @@ import { FiltersPage } from '../pages/adf/process-services/filters.page';
|
|||||||
import { TaskDetailsPage } from '../pages/adf/process-services/task-details.page';
|
import { TaskDetailsPage } from '../pages/adf/process-services/task-details.page';
|
||||||
import { TasksListPage } from '../pages/adf/process-services/tasks-list.page';
|
import { TasksListPage } from '../pages/adf/process-services/tasks-list.page';
|
||||||
import CONSTANTS = require('../util/constants');
|
import CONSTANTS = require('../util/constants');
|
||||||
|
import { TasksPage } from '../pages/adf/process-services/tasks.page';
|
||||||
|
|
||||||
describe('Task Details - Form', () => {
|
describe('Task Details - Form', () => {
|
||||||
const loginPage = new LoginPage();
|
const loginPage = new LoginPage();
|
||||||
const tasksListPage = new TasksListPage();
|
const tasksListPage = new TasksListPage();
|
||||||
const taskDetailsPage = new TaskDetailsPage();
|
const taskDetailsPage = new TaskDetailsPage();
|
||||||
|
const taskPage = new TasksPage();
|
||||||
const filtersPage = new FiltersPage();
|
const filtersPage = new FiltersPage();
|
||||||
const widget = new Widget();
|
const widget = new Widget();
|
||||||
let task, otherTask, user, newForm, attachedForm, otherAttachedForm;
|
let task, otherTask, user, newForm, attachedForm, otherAttachedForm;
|
||||||
@@ -373,5 +375,35 @@ describe('Task Details - Form', () => {
|
|||||||
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
|
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
|
||||||
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldValue);
|
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('[C212922] Should a User task form be refreshed, saved or completed.', async () => {
|
||||||
|
await appActions.startProcess(this.alfrescoJsApi, app, app.processName);
|
||||||
|
|
||||||
|
await filtersPage.goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
|
||||||
|
await tasksListPage.checkTaskListIsLoaded();
|
||||||
|
|
||||||
|
await tasksListPage.selectRow(app.taskName);
|
||||||
|
await expect(await taskDetailsPage.getParentName()).toEqual(app.processName);
|
||||||
|
|
||||||
|
await widget.textWidget().isWidgetVisible(app.form_fields.form_fieldId);
|
||||||
|
await widget.textWidget().setValue(app.form_fields.form_fieldId, 'value');
|
||||||
|
|
||||||
|
await taskPage.formFields().refreshForm();
|
||||||
|
|
||||||
|
await widget.textWidget().isWidgetVisible(app.form_fields.form_fieldId);
|
||||||
|
await expect(await widget.textWidget().getFieldValue(app.form_fields.form_fieldId)).toEqual('');
|
||||||
|
|
||||||
|
await widget.textWidget().setValue(app.form_fields.form_fieldId, 'value');
|
||||||
|
await taskPage.taskDetails().saveTaskForm();
|
||||||
|
|
||||||
|
await filtersPage.goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS);
|
||||||
|
await tasksListPage.checkTaskListIsLoaded();
|
||||||
|
|
||||||
|
await filtersPage.goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
|
||||||
|
await tasksListPage.checkTaskListIsLoaded();
|
||||||
|
await expect(await widget.textWidget().getFieldValue(app.form_fields.form_fieldId)).toEqual('value');
|
||||||
|
|
||||||
|
await taskDetailsPage.clickCompleteFormTask();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -22,15 +22,22 @@ import { LoginPage, BrowserActions, Widget } from '@alfresco/adf-testing';
|
|||||||
import { TasksPage } from '../../pages/adf/process-services/tasks.page';
|
import { TasksPage } from '../../pages/adf/process-services/tasks.page';
|
||||||
import CONSTANTS = require('../../util/constants');
|
import CONSTANTS = require('../../util/constants');
|
||||||
import { browser } from 'protractor';
|
import { browser } from 'protractor';
|
||||||
|
import { NavigationBarPage } from '../../pages/adf/navigation-bar.page';
|
||||||
|
|
||||||
describe('Dynamic Table widget ', () => {
|
describe('Dynamic Table widget ', () => {
|
||||||
|
|
||||||
const loginPage = new LoginPage();
|
const loginPage = new LoginPage();
|
||||||
let processUserModel;
|
|
||||||
const taskPage = new TasksPage();
|
const taskPage = new TasksPage();
|
||||||
const widget = new Widget();
|
const widget = new Widget();
|
||||||
let alfrescoJsApi;
|
|
||||||
const appsActions = new AppsActions();
|
const appsActions = new AppsActions();
|
||||||
|
const users = new UsersActions();
|
||||||
|
const navigationBarPage = new NavigationBarPage();
|
||||||
|
const alfrescoJsApi = new AlfrescoApi({
|
||||||
|
provider: 'BPM',
|
||||||
|
hostBpm: browser.params.testConfig.adf_aps.host
|
||||||
|
});
|
||||||
|
|
||||||
|
let processUserModel;
|
||||||
let appModel;
|
let appModel;
|
||||||
let deployedApp, process;
|
let deployedApp, process;
|
||||||
|
|
||||||
@@ -38,27 +45,16 @@ describe('Dynamic Table widget ', () => {
|
|||||||
const app = browser.params.resources.Files.WIDGET_CHECK_APP.DYNAMIC_TABLE;
|
const app = browser.params.resources.Files.WIDGET_CHECK_APP.DYNAMIC_TABLE;
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
const users = new UsersActions();
|
|
||||||
|
|
||||||
alfrescoJsApi = new AlfrescoApi({
|
|
||||||
provider: 'BPM',
|
|
||||||
hostBpm: browser.params.testConfig.adf_aps.host
|
|
||||||
});
|
|
||||||
|
|
||||||
await alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
|
await alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
|
||||||
|
|
||||||
processUserModel = await users.createTenantAndUser(alfrescoJsApi);
|
processUserModel = await users.createTenantAndUser(alfrescoJsApi);
|
||||||
|
|
||||||
await alfrescoJsApi.login(processUserModel.email, processUserModel.password);
|
await alfrescoJsApi.login(processUserModel.email, processUserModel.password);
|
||||||
appModel = await appsActions.importPublishDeployApp(alfrescoJsApi, browser.params.resources.Files.WIDGET_CHECK_APP.file_location);
|
appModel = await appsActions.importPublishDeployApp(alfrescoJsApi, browser.params.resources.Files.WIDGET_CHECK_APP.file_location);
|
||||||
|
|
||||||
const appDefinitions = await alfrescoJsApi.activiti.appsApi.getAppDefinitions();
|
const appDefinitions = await alfrescoJsApi.activiti.appsApi.getAppDefinitions();
|
||||||
deployedApp = appDefinitions.data.find((currentApp) => {
|
deployedApp = appDefinitions.data.find((currentApp) => currentApp.modelId === appModel.id);
|
||||||
return currentApp.modelId === appModel.id;
|
|
||||||
});
|
|
||||||
process = await appsActions.startProcess(alfrescoJsApi, appModel, app.processName);
|
process = await appsActions.startProcess(alfrescoJsApi, appModel, app.processName);
|
||||||
await loginPage.loginToProcessServicesUsingUserModel(processUserModel);
|
await loginPage.loginToProcessServicesUsingUserModel(processUserModel);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
@@ -72,7 +68,7 @@ describe('Dynamic Table widget ', () => {
|
|||||||
await alfrescoJsApi.activiti.processApi.deleteProcessInstance(process.id);
|
await alfrescoJsApi.activiti.processApi.deleteProcessInstance(process.id);
|
||||||
await alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
|
await alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
|
||||||
await alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId);
|
await alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId);
|
||||||
|
await navigationBarPage.clickLogoutButton();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[C276729] Should be possible to set visibility properties for Dynamic Table', async () => {
|
it('[C276729] Should be possible to set visibility properties for Dynamic Table', async () => {
|
||||||
@@ -82,7 +78,7 @@ describe('Dynamic Table widget ', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('[C279349] Should be able to have a Date Time widget in a Dynamic Table widget', async () => {
|
it('[C279349] Should be able to have a Date Time widget in a Dynamic Table widget', async () => {
|
||||||
await widget.dynamicTable().clickAddButton();
|
await widget.dynamicTable().clickAddRow();
|
||||||
await widget.dateTimeWidget().openDatepicker(app.FIELD.dateTime_input_id);
|
await widget.dateTimeWidget().openDatepicker(app.FIELD.dateTime_input_id);
|
||||||
await widget.dateTimeWidget().selectDay('10');
|
await widget.dateTimeWidget().selectDay('10');
|
||||||
await widget.dateTimeWidget().selectHour('8');
|
await widget.dateTimeWidget().selectHour('8');
|
||||||
@@ -95,50 +91,38 @@ describe('Dynamic Table widget ', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('with People Widget App', () => {
|
describe('with People Widget App', () => {
|
||||||
|
|
||||||
const app = browser.params.resources.Files.WIDGET_CHECK_APP.DYNAMIC_TABLE_USERS;
|
const app = browser.params.resources.Files.WIDGET_CHECK_APP.DYNAMIC_TABLE_USERS;
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
const users = new UsersActions();
|
|
||||||
|
|
||||||
alfrescoJsApi = new AlfrescoApi({
|
|
||||||
provider: 'BPM',
|
|
||||||
hostBpm: browser.params.testConfig.adf_aps.host
|
|
||||||
});
|
|
||||||
|
|
||||||
await alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
|
await alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
|
||||||
|
|
||||||
processUserModel = await users.createTenantAndUser(alfrescoJsApi);
|
processUserModel = await users.createTenantAndUser(alfrescoJsApi);
|
||||||
|
|
||||||
await alfrescoJsApi.login(processUserModel.email, processUserModel.password);
|
await alfrescoJsApi.login(processUserModel.email, processUserModel.password);
|
||||||
appModel = await appsActions.importPublishDeployApp(alfrescoJsApi, browser.params.resources.Files.WIDGET_CHECK_APP.file_location);
|
appModel = await appsActions.importPublishDeployApp(alfrescoJsApi, browser.params.resources.Files.WIDGET_CHECK_APP.file_location);
|
||||||
|
|
||||||
const appDefinitions = await alfrescoJsApi.activiti.appsApi.getAppDefinitions();
|
const appDefinitions = await alfrescoJsApi.activiti.appsApi.getAppDefinitions();
|
||||||
deployedApp = appDefinitions.data.find((currentApp) => {
|
deployedApp = appDefinitions.data.find((currentApp) => currentApp.modelId === appModel.id);
|
||||||
return currentApp.modelId === appModel.id;
|
|
||||||
});
|
|
||||||
process = await appsActions.startProcess(alfrescoJsApi, appModel, app.processName);
|
process = await appsActions.startProcess(alfrescoJsApi, appModel, app.processName);
|
||||||
await loginPage.loginToProcessServicesUsingUserModel(processUserModel);
|
await loginPage.loginToProcessServicesUsingUserModel(processUserModel);
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
const urlToNavigateTo = `${browser.params.testConfig.adf.url}/activiti/apps/${deployedApp.id}/tasks/`;
|
|
||||||
await BrowserActions.getUrl(urlToNavigateTo);
|
|
||||||
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
|
|
||||||
await taskPage.formFields().checkFormIsDisplayed();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
await alfrescoJsApi.activiti.processApi.deleteProcessInstance(process.id);
|
await alfrescoJsApi.activiti.processApi.deleteProcessInstance(process.id);
|
||||||
await alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
|
await alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
|
||||||
await alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId);
|
await alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId);
|
||||||
|
await navigationBarPage.clickLogoutButton();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
const urlToNavigateTo = `${browser.params.testConfig.adf.url}/activiti/apps/${deployedApp.id}/tasks/`;
|
||||||
|
await BrowserActions.getUrl(urlToNavigateTo);
|
||||||
|
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
|
||||||
|
await taskPage.tasksListPage().checkTaskListIsLoaded();
|
||||||
|
await taskPage.formFields().checkFormIsDisplayed();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[C260407] Should be able to add/delete/update row in Dynamic Table widget', async () => {
|
it('[C260407] Should be able to add/delete/update row in Dynamic Table widget', async () => {
|
||||||
|
await widget.dynamicTable().clickAddRow(app.FIELD.dynamic_table_id);
|
||||||
await widget.dynamicTable().clickAddRow();
|
|
||||||
await widget.dynamicTable().setDatatableInput('User1');
|
await widget.dynamicTable().setDatatableInput('User1');
|
||||||
await widget.dynamicTable().clickSaveButton();
|
await widget.dynamicTable().clickSaveButton();
|
||||||
await expect(await widget.dynamicTable().getTableRowText(0)).toEqual('User1');
|
await expect(await widget.dynamicTable().getTableRowText(0)).toEqual('User1');
|
||||||
@@ -154,10 +138,65 @@ describe('Dynamic Table widget ', () => {
|
|||||||
await widget.dynamicTable().clickSaveButton();
|
await widget.dynamicTable().clickSaveButton();
|
||||||
await expect(await widget.dynamicTable().getTableRowText(0)).toEqual('User2');
|
await expect(await widget.dynamicTable().getTableRowText(0)).toEqual('User2');
|
||||||
|
|
||||||
await widget.dynamicTable().clickAddRow();
|
await widget.dynamicTable().clickAddRow(app.FIELD.dynamic_table_id);
|
||||||
await widget.dynamicTable().setDatatableInput('User3');
|
await widget.dynamicTable().setDatatableInput('User3');
|
||||||
await widget.dynamicTable().clickCancelButton();
|
await widget.dynamicTable().clickCancelButton();
|
||||||
await widget.dynamicTable().checkTableRowIsNotVisible(1);
|
await widget.dynamicTable().checkTableRowIsNotVisible(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('Custom validation', () => {
|
||||||
|
|
||||||
|
const app = browser.params.resources.Files.WIDGET_CHECK_APP;
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
await alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
|
||||||
|
processUserModel = await users.createTenantAndUser(alfrescoJsApi);
|
||||||
|
|
||||||
|
await alfrescoJsApi.login(processUserModel.email, processUserModel.password);
|
||||||
|
const application = await appsActions.importPublishDeployApp(alfrescoJsApi, app.file_location);
|
||||||
|
|
||||||
|
const appDefinitions = await alfrescoJsApi.activiti.appsApi.getAppDefinitions();
|
||||||
|
deployedApp = appDefinitions.data.find((currentApp) => currentApp.modelId === application.id);
|
||||||
|
process = await appsActions.startProcess(alfrescoJsApi, application, app.CUSTOM_VALIDATOR.processName);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await alfrescoJsApi.activiti.processApi.deleteProcessInstance(process.id);
|
||||||
|
await alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
|
||||||
|
await alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId);
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await loginPage.loginToProcessServicesUsingUserModel(processUserModel);
|
||||||
|
const urlToNavigateTo = `${browser.params.testConfig.adf.url}/activiti/apps/${deployedApp.id}/tasks`;
|
||||||
|
await BrowserActions.getUrl(urlToNavigateTo);
|
||||||
|
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
|
||||||
|
await taskPage.tasksListPage().checkTaskListIsLoaded();
|
||||||
|
await taskPage.formFields().checkFormIsDisplayed();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('[C260437] Customised validator', async () => {
|
||||||
|
await widget.dynamicTable().clickAddRow();
|
||||||
|
await widget.dynamicTable().setDatatableInput('admin', app.CUSTOM_VALIDATOR.FIELD.NAME);
|
||||||
|
await widget.dynamicTable().clickSaveButton();
|
||||||
|
await expect(await widget.dynamicTable().checkErrorMessage()).toBe('Sorry, wrong value. You cannot use "admin".');
|
||||||
|
|
||||||
|
await widget.dynamicTable().setDatatableInput('name', app.CUSTOM_VALIDATOR.FIELD.NAME);
|
||||||
|
await widget.dynamicTable().clickSaveButton();
|
||||||
|
await expect(await widget.dynamicTable().checkErrorMessage()).toBe('Field \'Id\' is required.');
|
||||||
|
|
||||||
|
await widget.dynamicTable().setDatatableInput('id', app.CUSTOM_VALIDATOR.FIELD.ID);
|
||||||
|
await widget.dynamicTable().clickSaveButton();
|
||||||
|
await expect(await widget.dynamicTable().checkErrorMessage()).toBe('Field \'Number\' is required.' );
|
||||||
|
|
||||||
|
await widget.dynamicTable().setDatatableInput('12', app.CUSTOM_VALIDATOR.FIELD.NUM);
|
||||||
|
await widget.dynamicTable().clickSaveButton();
|
||||||
|
await expect(await widget.dynamicTable().checkErrorMessage()).toBe('Field \'Address\' is required.');
|
||||||
|
|
||||||
|
await widget.dynamicTable().setDatatableInput('address', app.CUSTOM_VALIDATOR.FIELD.ADDRESS);
|
||||||
|
await widget.dynamicTable().clickSaveButton();
|
||||||
|
await taskPage.taskDetails().clickCompleteFormTask();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
152
e2e/process-services/widgets/people-group-widget.e2e.ts
Normal file
152
e2e/process-services/widgets/people-group-widget.e2e.ts
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Copyright 2019 Alfresco Software, Ltd.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
|
||||||
|
import { AppsActions } from '../../actions/APS/apps.actions';
|
||||||
|
import { UsersActions } from '../../actions/users.actions';
|
||||||
|
import { LoginPage, StringUtil, Widget } from '@alfresco/adf-testing';
|
||||||
|
import { TasksPage } from '../../pages/adf/process-services/tasks.page';
|
||||||
|
import { browser } from 'protractor';
|
||||||
|
import { User } from '../../models/APS/user';
|
||||||
|
import { NavigationBarPage } from '../../pages/adf/navigation-bar.page';
|
||||||
|
import CONSTANTS = require('../../util/constants');
|
||||||
|
|
||||||
|
describe('People and Group widget', () => {
|
||||||
|
|
||||||
|
const loginPage = new LoginPage();
|
||||||
|
const taskPage = new TasksPage();
|
||||||
|
const navigationBarPage = new NavigationBarPage();
|
||||||
|
const widget = new Widget();
|
||||||
|
const usersActions = new UsersActions();
|
||||||
|
const alfrescoJsApi = new AlfrescoApi({
|
||||||
|
provider: 'BPM',
|
||||||
|
hostBpm: browser.params.testConfig.adf_aps.host
|
||||||
|
});
|
||||||
|
|
||||||
|
const app = browser.params.resources.Files.MORE_WIDGETS;
|
||||||
|
let user: User;
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
const appsActions = new AppsActions();
|
||||||
|
await alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
|
||||||
|
user = await usersActions.createTenantAndUser(alfrescoJsApi);
|
||||||
|
await createGroupAndUsers(user.tenantId);
|
||||||
|
|
||||||
|
await alfrescoJsApi.login(user.email, user.password);
|
||||||
|
try {
|
||||||
|
await appsActions.importPublishDeployApp(alfrescoJsApi, app.file_location, { renewIdmEntries: true });
|
||||||
|
} catch (e) { console.error('failed to deploy the application'); }
|
||||||
|
await loginPage.loginToProcessServicesUsingUserModel(user);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
|
||||||
|
await alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(user.tenantId);
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp();
|
||||||
|
await taskPage.tasksListPage().checkTaskListIsLoaded();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('[C275715] Add group widget - Visibility and group restriction', async () => {
|
||||||
|
const name = 'group visibility task';
|
||||||
|
const groupVisibilityForm = app.ADD_GROUP_VISIBILITY;
|
||||||
|
await taskPage.createTask({name, formName: groupVisibilityForm.formName});
|
||||||
|
await expect(await taskPage.taskDetails().getTitle()).toEqual('Activities');
|
||||||
|
|
||||||
|
await taskPage.formFields().checkWidgetIsHidden(groupVisibilityForm.FIELD.widget_id);
|
||||||
|
await widget.checkboxWidget().clickCheckboxInput(groupVisibilityForm.FIELD.checkbox_id);
|
||||||
|
await taskPage.formFields().checkWidgetIsVisible(groupVisibilityForm.FIELD.widget_id);
|
||||||
|
|
||||||
|
await widget.groupWidget().insertGroup(groupVisibilityForm.FIELD.widget_id, groupVisibilityForm.searchTerm);
|
||||||
|
await widget.groupWidget().checkDropDownListIsDisplayed();
|
||||||
|
await expect(await widget.groupWidget().getDropDownList()).toEqual([ 'Heros', 'Users' ]);
|
||||||
|
await widget.groupWidget().selectGroupFromDropDown('Users');
|
||||||
|
await taskPage.taskDetails().clickCompleteFormTask();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('[C275716] Add group widget - sub group restrictions', async () => {
|
||||||
|
const name = 'group widget - subgroup restriction';
|
||||||
|
const subgroupFrom = app.ADD_GROUP_AND_SUBGROUP_RESTRICTION;
|
||||||
|
await taskPage.createTask({name, formName: subgroupFrom.formName});
|
||||||
|
await expect(await taskPage.taskDetails().getTitle()).toEqual('Activities');
|
||||||
|
|
||||||
|
await taskPage.formFields().checkWidgetIsHidden(subgroupFrom.FIELD.widget_id);
|
||||||
|
await widget.checkboxWidget().clickCheckboxInput(subgroupFrom.FIELD.checkbox_id);
|
||||||
|
await taskPage.formFields().checkWidgetIsVisible(subgroupFrom.FIELD.widget_id);
|
||||||
|
|
||||||
|
await widget.groupWidget().insertGroup(subgroupFrom.FIELD.widget_id, subgroupFrom.searchTerm);
|
||||||
|
await widget.groupWidget().checkDropDownListIsDisplayed();
|
||||||
|
const suggestions = await widget.groupWidget().getDropDownList();
|
||||||
|
await expect(suggestions.sort()).toEqual(getSubGroupsName().sort());
|
||||||
|
await widget.groupWidget().selectGroupFromDropDown(getSubGroupsName()[0]);
|
||||||
|
await taskPage.taskDetails().clickCompleteFormTask();
|
||||||
|
|
||||||
|
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS);
|
||||||
|
await taskPage.tasksListPage().checkTaskListIsLoaded();
|
||||||
|
|
||||||
|
await taskPage.tasksListPage().selectRow(name);
|
||||||
|
await widget.groupWidget().checkGroupFieldIsDisplayed();
|
||||||
|
await expect(await widget.groupWidget().getFieldValue(subgroupFrom.FIELD.widget_id)).toBe('Heros');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('[C275714] Add people widget - group restrictions', async () => {
|
||||||
|
const name = 'people widget - group restrictions';
|
||||||
|
const peopleWidget = app.ADD_PEOPLE_AND_GROUP_RESTRICTION;
|
||||||
|
await taskPage.createTask({name, formName: peopleWidget.formName});
|
||||||
|
await expect(await taskPage.taskDetails().getTitle()).toEqual('Activities');
|
||||||
|
|
||||||
|
await taskPage.formFields().checkWidgetIsHidden(peopleWidget.FIELD.widget_id);
|
||||||
|
await widget.checkboxWidget().clickCheckboxInput(peopleWidget.FIELD.checkbox_id);
|
||||||
|
await taskPage.formFields().checkWidgetIsVisible(peopleWidget.FIELD.widget_id);
|
||||||
|
|
||||||
|
await widget.peopleWidget().insertUser(peopleWidget.FIELD.widget_id, peopleWidget.searchTerm);
|
||||||
|
await widget.peopleWidget().checkDropDownListIsDisplayed();
|
||||||
|
const suggestions = await widget.peopleWidget().getDropDownList();
|
||||||
|
await expect(suggestions.sort()).toEqual(getGroupMembers().sort());
|
||||||
|
await widget.peopleWidget().selectUserFromDropDown(getGroupMembers()[0]);
|
||||||
|
await taskPage.taskDetails().clickCompleteFormTask();
|
||||||
|
});
|
||||||
|
|
||||||
|
async function createGroupAndUsers(tenantId) {
|
||||||
|
await alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const happyUsers: any[] = await Promise.all(app.groupUser.map(happyUser =>
|
||||||
|
usersActions.createApsUserWithName(alfrescoJsApi, tenantId, StringUtil.generateRandomString(), happyUser.firstName, happyUser.lastName)));
|
||||||
|
const subgroupUser = await usersActions.createApsUserWithName(
|
||||||
|
alfrescoJsApi, tenantId, StringUtil.generateRandomString(), app.subGroupUser.firstName, app.subGroupUser.lastName);
|
||||||
|
|
||||||
|
const group = await alfrescoJsApi.activiti.adminGroupsApi.createNewGroup({ name: app.group.name, tenantId, type: 1 });
|
||||||
|
await Promise.all(happyUsers.map(happyUser => alfrescoJsApi.activiti.adminGroupsApi.addGroupMember(group.id, happyUser.id)));
|
||||||
|
|
||||||
|
const subgroups: any[] = await Promise.all(getSubGroupsName().map((name) =>
|
||||||
|
alfrescoJsApi.activiti.adminGroupsApi.createNewGroup({ name, tenantId , type: 1, parentGroupId: group.id })));
|
||||||
|
await Promise.all(subgroups.map((subgroup) => alfrescoJsApi.activiti.adminGroupsApi.addGroupMember(subgroup.id, subgroupUser.id)));
|
||||||
|
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getSubGroupsName() {
|
||||||
|
return app.group.subgroup.map(subgroup => subgroup.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getGroupMembers() {
|
||||||
|
return app.groupUser.map(groupUser => `${groupUser.firstName} ${groupUser.lastName}`);
|
||||||
|
}
|
||||||
|
});
|
90
e2e/process-services/widgets/typeahead-widget.e2e.ts
Normal file
90
e2e/process-services/widgets/typeahead-widget.e2e.ts
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Copyright 2019 Alfresco Software, Ltd.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
|
||||||
|
import { AppsActions } from '../../actions/APS/apps.actions';
|
||||||
|
import { UsersActions } from '../../actions/users.actions';
|
||||||
|
import { LoginPage, Widget } from '@alfresco/adf-testing';
|
||||||
|
import { TasksPage } from '../../pages/adf/process-services/tasks.page';
|
||||||
|
import { browser } from 'protractor';
|
||||||
|
import { User } from '../../models/APS/user';
|
||||||
|
import { NavigationBarPage } from '../../pages/adf/navigation-bar.page';
|
||||||
|
import CONSTANTS = require('../../util/constants');
|
||||||
|
|
||||||
|
describe('Typeahead widget', () => {
|
||||||
|
|
||||||
|
const loginPage = new LoginPage();
|
||||||
|
const taskPage = new TasksPage();
|
||||||
|
const navigationBarPage = new NavigationBarPage();
|
||||||
|
const widget = new Widget();
|
||||||
|
const usersActions = new UsersActions();
|
||||||
|
const alfrescoJsApi = new AlfrescoApi({
|
||||||
|
provider: 'BPM',
|
||||||
|
hostBpm: browser.params.testConfig.adf_aps.host
|
||||||
|
});
|
||||||
|
|
||||||
|
const app = browser.params.resources.Files.WIDGET_CHECK_APP;
|
||||||
|
let user: User;
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
const appsActions = new AppsActions();
|
||||||
|
await alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
|
||||||
|
user = await usersActions.createTenantAndUser(alfrescoJsApi);
|
||||||
|
|
||||||
|
await alfrescoJsApi.login(user.email, user.password);
|
||||||
|
await appsActions.importPublishDeployApp(alfrescoJsApi, app.file_location, { renewIdmEntries: true });
|
||||||
|
await loginPage.loginToProcessServicesUsingUserModel(user);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
|
||||||
|
await alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(user.tenantId);
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp();
|
||||||
|
await taskPage.tasksListPage().checkTaskListIsLoaded();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('[C307988] Type ahead form control should work for URLs', async () => {
|
||||||
|
const name = 'typahead widget task';
|
||||||
|
const typeaheadWidget = app.TYPE_AHEAD_WIDGET;
|
||||||
|
await taskPage.createTask({name, formName: typeaheadWidget.formName});
|
||||||
|
await expect(await taskPage.taskDetails().getTitle()).toEqual('Activities');
|
||||||
|
|
||||||
|
await widget.typeahedWidget().checkTypeaheadFieldIsDisplayed();
|
||||||
|
await widget.typeahedWidget().fillTypeaheadField(typeaheadWidget.case1.searchTerm);
|
||||||
|
await widget.typeahedWidget().checkDropDownListIsDisplayed();
|
||||||
|
let suggestions = await widget.typeahedWidget().getDropDownList();
|
||||||
|
await expect(suggestions.sort()).toEqual(typeaheadWidget.case1.result.sort());
|
||||||
|
|
||||||
|
await widget.typeahedWidget().fillTypeaheadField(typeaheadWidget.case2.searchTerm);
|
||||||
|
await widget.typeahedWidget().checkDropDownListIsDisplayed();
|
||||||
|
suggestions = await widget.typeahedWidget().getDropDownList();
|
||||||
|
await expect(suggestions.sort()).toEqual(typeaheadWidget.case2.result);
|
||||||
|
|
||||||
|
await widget.typeahedWidget().selectOptionFromDropdown();
|
||||||
|
await taskPage.taskDetails().clickCompleteFormTask();
|
||||||
|
|
||||||
|
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS);
|
||||||
|
await taskPage.tasksListPage().checkTaskListIsLoaded();
|
||||||
|
|
||||||
|
await taskPage.tasksListPage().selectRow(name);
|
||||||
|
await widget.typeahedWidget().checkTypeaheadFieldIsDisplayed();
|
||||||
|
await expect(await widget.typeahedWidget().getFieldValue('1583773306434')).toBe(typeaheadWidget.case2.result[0]);
|
||||||
|
});
|
||||||
|
});
|
BIN
e2e/resources/apps/More Widgets.zip
Normal file
BIN
e2e/resources/apps/More Widgets.zip
Normal file
Binary file not shown.
BIN
e2e/resources/apps/Stencil_app.zip
Normal file
BIN
e2e/resources/apps/Stencil_app.zip
Normal file
Binary file not shown.
Binary file not shown.
@@ -296,7 +296,6 @@ exports.Files = {
|
|||||||
checkbox_id: "viewtable",
|
checkbox_id: "viewtable",
|
||||||
dateTime_input_id: "datetime",
|
dateTime_input_id: "datetime",
|
||||||
row: "label-row-0"
|
row: "label-row-0"
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -305,6 +304,7 @@ exports.Files = {
|
|||||||
title: "ALL_WIDGETS",
|
title: "ALL_WIDGETS",
|
||||||
processName: "ALL_WIDGETS",
|
processName: "ALL_WIDGETS",
|
||||||
FIELD: {
|
FIELD: {
|
||||||
|
dynamic_table_id: "dynamictable",
|
||||||
dynamic_table_age_id: "label2",
|
dynamic_table_age_id: "label2",
|
||||||
dynamic_table_date_id: "label",
|
dynamic_table_date_id: "label",
|
||||||
checkbox_id: "viewtable",
|
checkbox_id: "viewtable",
|
||||||
@@ -343,9 +343,88 @@ exports.Files = {
|
|||||||
user_id: "adf-people-search-input",
|
user_id: "adf-people-search-input",
|
||||||
checkbox_id: "check"
|
checkbox_id: "check"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
CUSTOM_VALIDATOR: {
|
||||||
|
formName: "dynamic-table-custom-validation",
|
||||||
|
title: "dynamic-table-custom-validation",
|
||||||
|
processName: "dynamic-table-custom-validation",
|
||||||
|
FIELD: {
|
||||||
|
NAME: "name",
|
||||||
|
ID: "id",
|
||||||
|
NUM: "num",
|
||||||
|
ADDRESS: "address",
|
||||||
|
ROW: "label-row-0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
TYPE_AHEAD_WIDGET: {
|
||||||
|
formName: "Type ahead widget",
|
||||||
|
title: "type-ahead-process",
|
||||||
|
processName: "type-ahead-process",
|
||||||
|
FIELD: {
|
||||||
|
widget_id: "Label"
|
||||||
|
},
|
||||||
|
case1: {
|
||||||
|
searchTerm: 'Customer',
|
||||||
|
result: [
|
||||||
|
'123456789 - Customer Number One',
|
||||||
|
'987654321 - Customer Number Two',
|
||||||
|
'919191919191 - Customer Number Three',
|
||||||
|
'91919191 - Customer Number X'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
case2: {
|
||||||
|
searchTerm: 'One',
|
||||||
|
result: [ '123456789 - Customer Number One' ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
MORE_WIDGETS: {
|
||||||
|
file_location: "/resources/apps/More Widgets.zip",
|
||||||
|
title: "More Widgets",
|
||||||
|
group: { name: "Users", subgroup: [ { name: "Heros" }, { name: "Villains" }] },
|
||||||
|
subGroupUser: { firstName: "Hero", lastName: "User" } ,
|
||||||
|
groupUser: [
|
||||||
|
{ firstName: "Hero", lastName: "Audience" },
|
||||||
|
{ firstName: "Villain", lastName: "Audience" },
|
||||||
|
],
|
||||||
|
|
||||||
|
ADD_PEOPLE_AND_GROUP_RESTRICTION: {
|
||||||
|
formName: 'People widget - group restriction',
|
||||||
|
FIELD: {
|
||||||
|
widget_id: 'Finally',
|
||||||
|
checkbox_id: 'check'
|
||||||
|
},
|
||||||
|
searchTerm: 'Audience'
|
||||||
|
},
|
||||||
|
|
||||||
|
ADD_GROUP_VISIBILITY: {
|
||||||
|
formName: "Group widget - visibility",
|
||||||
|
FIELD: {
|
||||||
|
widget_id: 'Dreamteam',
|
||||||
|
checkbox_id: 'check'
|
||||||
|
},
|
||||||
|
searchTerm: 'e'
|
||||||
|
},
|
||||||
|
|
||||||
|
ADD_GROUP_AND_SUBGROUP_RESTRICTION: {
|
||||||
|
formName: "Group widget - subgroup restriction",
|
||||||
|
FIELD: {
|
||||||
|
widget_id: 'Dreamteam',
|
||||||
|
checkbox_id: 'check'
|
||||||
|
},
|
||||||
|
searchTerm: 's'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
STENCIL_PROCESS: {
|
||||||
|
file_location: "/resources/apps/Stencil_app.zip",
|
||||||
|
processName: 'stencil_process',
|
||||||
|
taskName: 'stencil task'
|
||||||
|
},
|
||||||
|
|
||||||
DYNAMIC_TABLE_APP: {
|
DYNAMIC_TABLE_APP: {
|
||||||
file_location: "/resources/apps/Dynamic Table App.zip",
|
file_location: "/resources/apps/Dynamic Table App.zip",
|
||||||
title: "Dynamic Table App",
|
title: "Dynamic Table App",
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
<input matInput
|
<input matInput
|
||||||
class="adf-input"
|
class="adf-input"
|
||||||
type="text"
|
type="text"
|
||||||
|
data-automation-id="adf-group-search-input"
|
||||||
[id]="field.id"
|
[id]="field.id"
|
||||||
[(ngModel)]="value"
|
[(ngModel)]="value"
|
||||||
(keyup)="onKeyUp($event)"
|
(keyup)="onKeyUp($event)"
|
||||||
@@ -13,10 +14,10 @@
|
|||||||
placeholder="{{field.placeholder}}"
|
placeholder="{{field.placeholder}}"
|
||||||
[matAutocomplete]="auto">
|
[matAutocomplete]="auto">
|
||||||
<mat-autocomplete #auto="matAutocomplete" (optionSelected)="onItemSelect($event.option.value)">
|
<mat-autocomplete #auto="matAutocomplete" (optionSelected)="onItemSelect($event.option.value)">
|
||||||
<mat-option *ngFor="let item of groups"
|
<mat-option *ngFor="let item of groups; let i = index" id="adf-group-widget-user-{{i}}"
|
||||||
[id]="field.id +'-'+item.id"
|
[id]="field.id +'-'+item.id"
|
||||||
(click)="onItemClick(item, $event)" [value]="item">
|
(click)="onItemClick(item, $event)" [value]="item">
|
||||||
<span>{{item.name}}</span>
|
<span id="adf-group-label-name">{{item.name}}</span>
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-autocomplete>
|
</mat-autocomplete>
|
||||||
|
|
||||||
|
@@ -13,11 +13,12 @@
|
|||||||
(ngModelChange)="validate()"
|
(ngModelChange)="validate()"
|
||||||
(keyup)="onKeyUp($event)"
|
(keyup)="onKeyUp($event)"
|
||||||
[disabled]="field.readOnly"
|
[disabled]="field.readOnly"
|
||||||
|
data-automation-id="adf-typeahed-search-input"
|
||||||
placeholder="{{field.placeholder}}"
|
placeholder="{{field.placeholder}}"
|
||||||
[matAutocomplete]="auto">
|
[matAutocomplete]="auto">
|
||||||
<mat-autocomplete #auto="matAutocomplete" (optionSelected)="onItemSelect($event.option.value)">
|
<mat-autocomplete #auto="matAutocomplete" (optionSelected)="onItemSelect($event.option.value)">
|
||||||
<mat-option *ngFor="let item of options" [value]="item">
|
<mat-option *ngFor="let item of options; let i = index" id="adf-typeahed-widget-user-{{i}}" [value]="item">
|
||||||
<span [id]="field.name+'_option_'+item.id">{{item.name}}</span>
|
<span id="adf-typeahed-label-name">{{item.name}}</span>
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-autocomplete>
|
</mat-autocomplete>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
@@ -304,9 +304,9 @@ describe('TypeaheadWidgetComponent', () => {
|
|||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
fixture.whenStable().then(() => {
|
fixture.whenStable().then(() => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(fixture.debugElement.query(By.css('[id="typeahead-name_option_1"]'))).not.toBeNull();
|
expect(fixture.debugElement.query(By.css('[id="adf-typeahed-widget-user-0"] span'))).not.toBeNull();
|
||||||
expect(fixture.debugElement.query(By.css('[id="typeahead-name_option_2"]'))).not.toBeNull();
|
expect(fixture.debugElement.query(By.css('[id="adf-typeahed-widget-user-1"] span'))).not.toBeNull();
|
||||||
expect(fixture.debugElement.query(By.css('[id="typeahead-name_option_3"]'))).not.toBeNull();
|
expect(fixture.debugElement.query(By.css('[id="adf-typeahed-widget-user-2"] span'))).not.toBeNull();
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -321,7 +321,7 @@ describe('TypeaheadWidgetComponent', () => {
|
|||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
fixture.whenStable().then(() => {
|
fixture.whenStable().then(() => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(fixture.debugElement.query(By.css('[id="typeahead-name_option_1"]'))).not.toBeNull();
|
expect(fixture.debugElement.query(By.css('[id="adf-typeahed-widget-user-0"] span'))).not.toBeNull();
|
||||||
typeaheadHTMLElement.focus();
|
typeaheadHTMLElement.focus();
|
||||||
typeaheadWidgetComponent.value = '';
|
typeaheadWidgetComponent.value = '';
|
||||||
typeaheadHTMLElement.dispatchEvent(new Event('keyup'));
|
typeaheadHTMLElement.dispatchEvent(new Event('keyup'));
|
||||||
@@ -329,7 +329,7 @@ describe('TypeaheadWidgetComponent', () => {
|
|||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
fixture.whenStable().then(() => {
|
fixture.whenStable().then(() => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(fixture.debugElement.query(By.css('[id="typeahead-name_option_1"]'))).toBeNull();
|
expect(fixture.debugElement.query(By.css('[id="adf-typeahed-widget-user-0"] span'))).toBeNull();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
@@ -377,9 +377,9 @@ describe('TypeaheadWidgetComponent', () => {
|
|||||||
typeaheadWidgetComponent.onKeyUp(keyboardEvent);
|
typeaheadWidgetComponent.onKeyUp(keyboardEvent);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
fixture.whenStable().then(() => {
|
fixture.whenStable().then(() => {
|
||||||
expect(fixture.debugElement.queryAll(By.css('[id="mat-option-1"]'))).toBeDefined();
|
expect(fixture.debugElement.queryAll(By.css('[id="adf-typeahed-widget-user-0"] span'))).toBeDefined();
|
||||||
expect(fixture.debugElement.queryAll(By.css('[id="mat-option-2"]'))).toBeDefined();
|
expect(fixture.debugElement.queryAll(By.css('[id="adf-typeahed-widget-user-1"] span'))).toBeDefined();
|
||||||
expect(fixture.debugElement.queryAll(By.css('[id="mat-option-3"]'))).toBeDefined();
|
expect(fixture.debugElement.queryAll(By.css('[id="adf-typeahed-widget-user-2"] span'))).toBeDefined();
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
@@ -25,10 +25,8 @@ export class DynamicTableWidgetPage {
|
|||||||
|
|
||||||
labelLocator: Locator = by.css('dynamic-table-widget div div');
|
labelLocator: Locator = by.css('dynamic-table-widget div div');
|
||||||
columnNameLocator: Locator = by.css('table[id*="dynamic-table"] th');
|
columnNameLocator: Locator = by.css('table[id*="dynamic-table"] th');
|
||||||
addButton: ElementFinder = element(by.id('label-add-row'));
|
|
||||||
cancelButton: ElementFinder = element(by.cssContainingText('button span', 'Cancel'));
|
cancelButton: ElementFinder = element(by.cssContainingText('button span', 'Cancel'));
|
||||||
editButton: ElementFinder = element(by.cssContainingText('button span', 'edit'));
|
editButton: ElementFinder = element(by.cssContainingText('button span', 'edit'));
|
||||||
addRow: ElementFinder = element(by.id('dynamictable-add-row'));
|
|
||||||
columnDateTime: ElementFinder = element(by.id('columnDateTime'));
|
columnDateTime: ElementFinder = element(by.id('columnDateTime'));
|
||||||
columnDate: ElementFinder = element(by.id('columnDate'));
|
columnDate: ElementFinder = element(by.id('columnDate'));
|
||||||
calendarHeader: ElementFinder = element(by.css('div[class="mat-datetimepicker-calendar-header-date-time"]'));
|
calendarHeader: ElementFinder = element(by.css('div[class="mat-datetimepicker-calendar-header-date-time"]'));
|
||||||
@@ -37,7 +35,6 @@ export class DynamicTableWidgetPage {
|
|||||||
errorMessage: ElementFinder = element(by.css('div[class="adf-error-text"]'));
|
errorMessage: ElementFinder = element(by.css('div[class="adf-error-text"]'));
|
||||||
dateWidget: ElementFinder = element.all(by.css('mat-datepicker-toggle button')).first();
|
dateWidget: ElementFinder = element.all(by.css('mat-datepicker-toggle button')).first();
|
||||||
tableRow: ElementArrayFinder = element.all(by.css('tbody tr'));
|
tableRow: ElementArrayFinder = element.all(by.css('tbody tr'));
|
||||||
dataTableInput: ElementFinder = element(by.id('id'));
|
|
||||||
|
|
||||||
getFieldLabel(fieldId): Promise<string> {
|
getFieldLabel(fieldId): Promise<string> {
|
||||||
return this.formFields.getFieldLabel(fieldId, this.labelLocator);
|
return this.formFields.getFieldLabel(fieldId, this.labelLocator);
|
||||||
@@ -47,12 +44,9 @@ export class DynamicTableWidgetPage {
|
|||||||
return this.formFields.getFieldText(fieldId, this.columnNameLocator);
|
return this.formFields.getFieldText(fieldId, this.columnNameLocator);
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickAddButton(): Promise<void> {
|
async clickAddRow(id?: string): Promise<void> {
|
||||||
await BrowserActions.click(this.addButton);
|
const rowButton = element(by.id(`${id ? id : 'label'}-add-row`));
|
||||||
}
|
await BrowserActions.click(rowButton);
|
||||||
|
|
||||||
async clickAddRow(): Promise<void> {
|
|
||||||
await BrowserActions.click(this.addRow);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickTableRow(rowNumber): Promise<void> {
|
async clickTableRow(rowNumber): Promise<void> {
|
||||||
@@ -68,10 +62,10 @@ export class DynamicTableWidgetPage {
|
|||||||
await BrowserActions.click(this.cancelButton);
|
await BrowserActions.click(this.cancelButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
async setDatatableInput(text): Promise<void> {
|
async setDatatableInput(text, id = 'id'): Promise<void> {
|
||||||
await BrowserVisibility.waitUntilElementIsVisible(this.dataTableInput);
|
const dataTableInput: ElementFinder = element(by.id(id));
|
||||||
await this.dataTableInput.clear();
|
await BrowserVisibility.waitUntilElementIsVisible(dataTableInput);
|
||||||
await this.dataTableInput.sendKeys(text);
|
await BrowserActions.clearSendKeys(dataTableInput, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getTableRowText(rowNumber): Promise<string> {
|
async getTableRowText(rowNumber): Promise<string> {
|
||||||
|
@@ -0,0 +1,78 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Copyright 2019 Alfresco Software, Ltd.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { FormFields } from '../form-fields';
|
||||||
|
import { by, element, ElementFinder, Locator } from 'protractor';
|
||||||
|
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
|
||||||
|
|
||||||
|
export class GroupWidgetPage {
|
||||||
|
|
||||||
|
groupField: ElementFinder = element(by.css('input[data-automation-id="adf-group-search-input"]'));
|
||||||
|
firstResult: ElementFinder = element(by.id('adf-group-widget-user-0'));
|
||||||
|
formFields: FormFields = new FormFields();
|
||||||
|
groupDropDownList: Locator = by.css('.mat-autocomplete-panel');
|
||||||
|
|
||||||
|
getFieldLabel(fieldId): Promise<string> {
|
||||||
|
return this.formFields.getFieldLabel(fieldId);
|
||||||
|
}
|
||||||
|
|
||||||
|
getFieldValue(fieldId): Promise<string> {
|
||||||
|
return this.formFields.getFieldValue(fieldId);
|
||||||
|
}
|
||||||
|
|
||||||
|
getFieldText(fieldId): Promise<string> {
|
||||||
|
return this.formFields.getFieldText(fieldId);
|
||||||
|
}
|
||||||
|
|
||||||
|
insertGroup(fieldId, value): Promise<void> {
|
||||||
|
return this.formFields.setValueInInputById(fieldId, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
async checkDropDownListIsDisplayed(): Promise<void> {
|
||||||
|
await BrowserVisibility.waitUntilElementIsVisible(element(this.groupDropDownList));
|
||||||
|
}
|
||||||
|
|
||||||
|
async checkGroupIsListed(group): Promise<void> {
|
||||||
|
const groupElement = element(by.cssContainingText('[id="adf-group-label-name"]', group));
|
||||||
|
await BrowserVisibility.waitUntilElementIsVisible(groupElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getDropDownList(): Promise<any[]> {
|
||||||
|
const user = by.css('[id="adf-group-label-name"]');
|
||||||
|
await BrowserVisibility.waitUntilElementIsVisible(element(user));
|
||||||
|
return element.all(user).map((elementFinder) => elementFinder.getText());
|
||||||
|
}
|
||||||
|
|
||||||
|
async selectGroupFromDropDown(groupName): Promise<void> {
|
||||||
|
const group = element(by.cssContainingText('[id="adf-group-label-name"]', groupName));
|
||||||
|
await BrowserActions.click(group);
|
||||||
|
}
|
||||||
|
|
||||||
|
async checkGroupFieldIsDisplayed(): Promise<void> {
|
||||||
|
await BrowserVisibility.waitUntilElementIsVisible(this.groupField);
|
||||||
|
}
|
||||||
|
|
||||||
|
async fillGroupField(value): Promise<void> {
|
||||||
|
await BrowserVisibility.waitUntilElementIsClickable(this.groupField);
|
||||||
|
await this.groupField.sendKeys(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
async selectGroupFromDropdown(): Promise<void> {
|
||||||
|
await BrowserVisibility.waitUntilElementIsVisible(this.firstResult);
|
||||||
|
await BrowserActions.click(this.firstResult);
|
||||||
|
}
|
||||||
|
}
|
@@ -58,6 +58,13 @@ export class PeopleWidgetPage {
|
|||||||
await BrowserActions.click(user);
|
await BrowserActions.click(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getDropDownList(): Promise<any[]> {
|
||||||
|
await this.checkDropDownListIsDisplayed();
|
||||||
|
const users = by.css('.adf-people-label-name');
|
||||||
|
await BrowserVisibility.waitUntilElementIsVisible(element(users));
|
||||||
|
return element.all(users).map((elementFinder) => elementFinder.getText());
|
||||||
|
}
|
||||||
|
|
||||||
async checkPeopleFieldIsDisplayed(): Promise<void> {
|
async checkPeopleFieldIsDisplayed(): Promise<void> {
|
||||||
await BrowserVisibility.waitUntilElementIsVisible(this.peopleField);
|
await BrowserVisibility.waitUntilElementIsVisible(this.peopleField);
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,78 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Copyright 2019 Alfresco Software, Ltd.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { FormFields } from '../form-fields';
|
||||||
|
import { by, element, ElementFinder, Locator } from 'protractor';
|
||||||
|
import { BrowserVisibility, BrowserActions } from '../../../utils/public-api';
|
||||||
|
|
||||||
|
export class TypeaheadWidgetPage {
|
||||||
|
|
||||||
|
field: ElementFinder = element(by.css('input[data-automation-id="adf-typeahed-search-input"]'));
|
||||||
|
firstResult: ElementFinder = element(by.id('adf-typeahed-widget-user-0'));
|
||||||
|
formFields: FormFields = new FormFields();
|
||||||
|
groupDropDownList: Locator = by.css('.mat-autocomplete-panel');
|
||||||
|
|
||||||
|
getFieldLabel(fieldId): Promise<string> {
|
||||||
|
return this.formFields.getFieldLabel(fieldId);
|
||||||
|
}
|
||||||
|
|
||||||
|
getFieldValue(fieldId): Promise<string> {
|
||||||
|
return this.formFields.getFieldValue(fieldId);
|
||||||
|
}
|
||||||
|
|
||||||
|
getFieldText(fieldId): Promise<string> {
|
||||||
|
return this.formFields.getFieldText(fieldId);
|
||||||
|
}
|
||||||
|
|
||||||
|
insertValue(fieldId, value): Promise<void> {
|
||||||
|
return this.formFields.setValueInInputById(fieldId, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
async checkDropDownListIsDisplayed(): Promise<void> {
|
||||||
|
await BrowserVisibility.waitUntilElementIsVisible(element(this.groupDropDownList));
|
||||||
|
}
|
||||||
|
|
||||||
|
async checkOptionIsListed(option): Promise<void> {
|
||||||
|
const optionElement = element(by.cssContainingText('[id="adf-typeahed-label-name"]', option));
|
||||||
|
await BrowserVisibility.waitUntilElementIsVisible(optionElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getDropDownList(): Promise<any[]> {
|
||||||
|
const option = by.css('[id="adf-typeahed-label-name"]');
|
||||||
|
await BrowserVisibility.waitUntilElementIsVisible(element(option));
|
||||||
|
return element.all(option).map((elementFinder) => elementFinder.getText());
|
||||||
|
}
|
||||||
|
|
||||||
|
async selectOptionFromDropDown(userName): Promise<void> {
|
||||||
|
const option = element(by.cssContainingText('[id="adf-typeahed-label-name"]', userName));
|
||||||
|
await BrowserActions.click(option);
|
||||||
|
}
|
||||||
|
|
||||||
|
async checkTypeaheadFieldIsDisplayed(): Promise<void> {
|
||||||
|
await BrowserVisibility.waitUntilElementIsVisible(this.field);
|
||||||
|
}
|
||||||
|
|
||||||
|
async fillTypeaheadField(value): Promise<void> {
|
||||||
|
await BrowserVisibility.waitUntilElementIsClickable(this.field);
|
||||||
|
await BrowserActions.clearSendKeys(this.field, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
async selectOptionFromDropdown(): Promise<void> {
|
||||||
|
await BrowserVisibility.waitUntilElementIsVisible(this.firstResult);
|
||||||
|
await BrowserActions.click(this.firstResult);
|
||||||
|
}
|
||||||
|
}
|
@@ -34,6 +34,8 @@ import { ContainerWidgetPage } from './container-widget.page';
|
|||||||
import { PeopleWidgetPage } from './people-widget.page';
|
import { PeopleWidgetPage } from './people-widget.page';
|
||||||
import { TabPage } from './tab.page';
|
import { TabPage } from './tab.page';
|
||||||
import { DocumentWidgetPage } from './document-widget.page';
|
import { DocumentWidgetPage } from './document-widget.page';
|
||||||
|
import { GroupWidgetPage } from './group-widget.page';
|
||||||
|
import { TypeaheadWidgetPage } from './typeahead-widget.page';
|
||||||
|
|
||||||
export class Widget {
|
export class Widget {
|
||||||
|
|
||||||
@@ -109,6 +111,14 @@ export class Widget {
|
|||||||
return new PeopleWidgetPage();
|
return new PeopleWidgetPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
groupWidget(): GroupWidgetPage {
|
||||||
|
return new GroupWidgetPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
typeahedWidget(): TypeaheadWidgetPage {
|
||||||
|
return new TypeaheadWidgetPage();
|
||||||
|
}
|
||||||
|
|
||||||
tab(): TabPage {
|
tab(): TabPage {
|
||||||
return new TabPage();
|
return new TabPage();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user