[AAE-1152] added e2e tests for People and Group of people - CloudWidgets (#5372)

* [AAE-1152] added e2e tests for People and Group of people - CloudWidgets

* [AAE-1152] made code more readable

* [AAE-1152] added public-api file

* Fixing import in index.ts

* refactoring and creating public-api file
This commit is contained in:
Alexandra Abrudan
2020-01-21 17:38:34 +00:00
committed by Eugenio Romano
parent 3c3aa7599a
commit f20e158eaf
16 changed files with 634 additions and 20 deletions

View File

@@ -17,8 +17,7 @@
import { import {
LoginSSOPage, LoginSSOPage,
Widget, BrowserActions, FormPage, ProcessCloudWidgetPage
BrowserActions, FormPage
} from '@alfresco/adf-testing'; } from '@alfresco/adf-testing';
import { browser } from 'protractor'; import { browser } from 'protractor';
import { customDateFormAPS2 } from '../../resources/forms/custom-date-form'; import { customDateFormAPS2 } from '../../resources/forms/custom-date-form';
@@ -26,7 +25,7 @@ import { FormCloudDemoPage } from '../../pages/adf/demo-shell/process-services-c
describe('Form Field Component - Dropdown Widget', () => { describe('Form Field Component - Dropdown Widget', () => {
const loginSSOPage = new LoginSSOPage(); const loginSSOPage = new LoginSSOPage();
const widget = new Widget(); const widget = new ProcessCloudWidgetPage();
const dateWidget = widget.dateWidget(); const dateWidget = widget.dateWidget();
const formDemoPage = new FormCloudDemoPage(); const formDemoPage = new FormCloudDemoPage();

View File

@@ -17,9 +17,9 @@
import { import {
ApiService, AppListCloudPage, GroupIdentityService, IdentityService, ApiService, AppListCloudPage, GroupIdentityService, IdentityService,
LoginSSOPage, NotificationHistoryPage, ProcessDefinitionsService, LoginSSOPage, NotificationHistoryPage, ProcessCloudWidgetPage, ProcessDefinitionsService,
ProcessInstancesService, QueryService, TaskFormCloudComponent, TaskHeaderCloudPage, ProcessInstancesService, QueryService, TaskFormCloudComponent, TaskHeaderCloudPage,
TasksService, Widget TasksService
} from '@alfresco/adf-testing'; } from '@alfresco/adf-testing';
import { browser } from 'protractor'; import { browser } from 'protractor';
import { TasksCloudDemoPage } from '../../pages/adf/demo-shell/process-services/tasksCloudDemoPage'; import { TasksCloudDemoPage } from '../../pages/adf/demo-shell/process-services/tasksCloudDemoPage';
@@ -33,7 +33,7 @@ describe('Form Field Component - Dropdown Widget', () => {
const taskFormCloudComponent = new TaskFormCloudComponent(); const taskFormCloudComponent = new TaskFormCloudComponent();
const notificationHistoryPage = new NotificationHistoryPage(); const notificationHistoryPage = new NotificationHistoryPage();
const taskHeaderCloudPage = new TaskHeaderCloudPage(); const taskHeaderCloudPage = new TaskHeaderCloudPage();
const widget = new Widget(); const widget = new ProcessCloudWidgetPage();
const dropdown = widget.dropdown(); const dropdown = widget.dropdown();
const apiService = new ApiService( const apiService = new ApiService(
browser.params.config.oauth2.clientId, browser.params.config.oauth2.clientId,

View File

@@ -0,0 +1,157 @@
/*!
* @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 {
FormPage,
LoginSSOPage,
ProcessCloudWidgetPage
} from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { FormCloudDemoPage } from '../../pages/adf/demo-shell/process-services-cloud/cloudFormDemoPage';
import { peopleJson, peopleMultipleModeJson, peopleRequiredJson, groupSingleJson, groupMultipleJson, groupRequiredJson } from '../../resources/forms/people-group-formwidget-json';
import { NavigationBarPage } from '../../pages/adf/navigationBarPage';
import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
describe('People and Group of people Widgets', () => {
const loginSSOPage = new LoginSSOPage();
const navigationBarPage = new NavigationBarPage();
const formCloudDemoPage = new FormCloudDemoPage();
const widget = new ProcessCloudWidgetPage();
const peopleCloudWidget = widget.peopleCloudWidget();
const groupCloudWidget = widget.groupCloudWidget();
const formPage = new FormPage();
const widgets = {
peopleCloudWidgetSingleModeId: 'PeopleSingleMode',
peopleCloudWidgetMultipleModeId: 'PeopleMultipleMode',
peopleCloudWidgetReadOnlyId: 'PeopleReadOnly',
peopleCloudWidgetRequiredId: 'PeopleRequired',
groupCloudWidgetSingleModeId: 'GroupSingleMode',
groupCloudWidgetMultipleModeId: 'GroupMultipleMode',
groupCloudWidgetReadOnlyId: 'GroupReadOnly',
groupCloudWidgetRequiredId: 'GroupRequired'
};
const peopleValueString = {
peopleCloudWidgetSingleModeField: 'PeopleSingleMode',
peopleCloudWidgetMultipleModeField: 'PeopleMultipleMode',
peopleCloudWidgetReadOnlyField: 'PeopleReadOnly',
peopleCloudWidgetRequiredField: 'PeopleRequired'
};
const groupValueString = {
groupCloudWidgetSingleModeField: 'GroupSingleMode',
groupCloudWidgetMultipleModeField: 'GroupMultipleMode',
groupCloudWidgetReadOnlyField: 'GroupReadOnly',
groupCloudWidgetRequiredField: 'GroupRequired'
};
beforeAll(async () => {
this.alfrescoJsApi = new AlfrescoApi({
provider: 'BPM',
hostBpm: browser.params.testConfig.adf_aps.host
});
await loginSSOPage.loginSSOIdentityService(browser.params.testConfig.hrUser.email, browser.params.testConfig.hrUser.password);
await navigationBarPage.navigateToFormCloudPage();
});
it('[C325002] Should be able to add a user in People field when Single mode is chosen', async () => {
await formCloudDemoPage.setConfigToEditor(peopleJson);
await peopleCloudWidget.clickPeopleInput(widgets.peopleCloudWidgetSingleModeId);
await peopleCloudWidget.isPeopleWidgetVisible(peopleValueString.peopleCloudWidgetSingleModeField);
let peopleSingleMode = await peopleCloudWidget.getFieldValue(widgets.peopleCloudWidgetSingleModeId);
await expect(peopleSingleMode).toEqual('');
await peopleCloudWidget.searchAssigneeAndSelect('HR User');
peopleSingleMode = await peopleCloudWidget.getAssigneeFieldContent();
await expect(peopleSingleMode).toEqual('HR User');
});
it('[C325122] Should be able to add multiple users in People field when Multiple mode is chosen', async () => {
await formCloudDemoPage.setConfigToEditor(peopleMultipleModeJson);
await peopleCloudWidget.clickPeopleInput(widgets.peopleCloudWidgetMultipleModeId);
await peopleCloudWidget.isPeopleWidgetVisible(peopleValueString.peopleCloudWidgetMultipleModeField);
const peopleMultipleMode = await peopleCloudWidget.getFieldValue(widgets.peopleCloudWidgetMultipleModeId);
await expect(peopleMultipleMode).toEqual('');
await peopleCloudWidget.searchAssigneeAndSelect('HR User');
await peopleCloudWidget.searchAssigneeAndSelect('Sales User');
await peopleCloudWidget.checkSelectedPeople('HR User');
await peopleCloudWidget.checkSelectedPeople('Sales User');
});
it('[C325004] Should be able to save only for valid input in the People field if the Required option is selected ', async () => {
await formCloudDemoPage.setConfigToEditor(peopleRequiredJson);
await peopleCloudWidget.isPeopleWidgetVisible(peopleValueString.peopleCloudWidgetRequiredField);
await expect(await formPage.isSaveButtonDisabled()).toBe(true);
await expect(await formPage.isValidationIconRed()).toBe(true);
let requiredPeople = await peopleCloudWidget.getFieldValue(widgets.peopleCloudWidgetRequiredId);
await expect(requiredPeople).toEqual('');
await peopleCloudWidget.searchAssigneeAndSelect('HR User');
requiredPeople = await peopleCloudWidget.getAssigneeFieldContent();
await expect(requiredPeople).toEqual('HR User');
await expect(await formPage.isSaveButtonDisabled()).toBe(false);
await expect(await formPage.isValidationIconBlue()).toBe(true);
});
it('[C325003] Should be able to add a user in Group of people field when Single mode is chosen', async () => {
await formCloudDemoPage.setConfigToEditor(groupSingleJson);
await groupCloudWidget.isGroupWidgetVisible(groupValueString.groupCloudWidgetSingleModeField);
let groupSingleMode = await groupCloudWidget.getGroupsFieldContent();
await expect(groupSingleMode).toEqual('');
await groupCloudWidget.searchGroups('hr');
await groupCloudWidget.selectGroupFromList('hr');
groupSingleMode = await groupCloudWidget.getGroupsFieldContent();
await expect(groupSingleMode).toEqual('hr');
});
it('[C325123] Should be able to add multiple users in Group of people field when Multiple mode is chosen', async () => {
await formCloudDemoPage.setConfigToEditor(groupMultipleJson);
await groupCloudWidget.isGroupWidgetVisible(groupValueString.groupCloudWidgetMultipleModeField);
const groupSingleMode = await groupCloudWidget.getGroupsFieldContent();
await expect(groupSingleMode).toEqual('');
await groupCloudWidget.searchGroups('hr');
await groupCloudWidget.selectGroupFromList('hr');
await groupCloudWidget.searchGroups('sales');
await groupCloudWidget.selectGroupFromList('sales');
await groupCloudWidget.checkSelectedGroup('hr');
await groupCloudWidget.checkSelectedGroup('sales');
});
it('[C325005] Should be able to save only for valid input in the Group of people field if the Required option is selected', async () => {
await formCloudDemoPage.setConfigToEditor(groupRequiredJson);
await groupCloudWidget.isGroupWidgetVisible(groupValueString.groupCloudWidgetRequiredField);
await expect(await formPage.isSaveButtonDisabled()).toBe(true);
await expect(await formPage.isValidationIconRed()).toBe(true);
let groupRequired = await groupCloudWidget.getGroupsFieldContent();
await expect(groupRequired).toEqual('');
await groupCloudWidget.searchGroups('hr');
await groupCloudWidget.selectGroupFromList('hr');
groupRequired = await groupCloudWidget.getGroupsFieldContent();
await expect(groupRequired).toEqual('hr');
await expect(await formPage.isSaveButtonDisabled()).toBe(false);
await expect(await formPage.isValidationIconBlue()).toBe(true);
});
});

View File

@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { LoginSSOPage, Widget } from '@alfresco/adf-testing'; import { LoginSSOPage, ProcessCloudWidgetPage } from '@alfresco/adf-testing';
import { browser } from 'protractor'; import { browser } from 'protractor';
import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api'; import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
@@ -31,7 +31,7 @@ describe('Visibility conditions on tabs - cloud', () => {
const navigationBarPage = new NavigationBarPage(); const navigationBarPage = new NavigationBarPage();
const formCloudDemoPage = new FormCloudDemoPage(); const formCloudDemoPage = new FormCloudDemoPage();
const widget = new Widget(); const widget = new ProcessCloudWidgetPage();
const widgets = { const widgets = {
textOneId: 'TextOne', textOneId: 'TextOne',

View File

@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { LoginSSOPage, Widget } from '@alfresco/adf-testing'; import { LoginSSOPage, ProcessCloudWidgetPage } from '@alfresco/adf-testing';
import { browser } from 'protractor'; import { browser } from 'protractor';
import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api'; import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
@@ -31,7 +31,7 @@ describe('Visibility conditions - cloud', () => {
const navigationBarPage = new NavigationBarPage(); const navigationBarPage = new NavigationBarPage();
const formCloudDemoPage = new FormCloudDemoPage(); const formCloudDemoPage = new FormCloudDemoPage();
const widget = new Widget(); const widget = new ProcessCloudWidgetPage();
let visibleCheckbox; let visibleCheckbox;

View File

@@ -28,7 +28,6 @@ import {
SettingsPage, SettingsPage,
GroupIdentityService, GroupIdentityService,
TaskFormCloudComponent, TaskFormCloudComponent,
Widget,
LocalStorageUtil, LocalStorageUtil,
StartProcessCloudPage, StartProcessCloudPage,
TaskHeaderCloudPage, TaskHeaderCloudPage,
@@ -38,7 +37,7 @@ import {
ContentNodeSelectorDialogPage, ContentNodeSelectorDialogPage,
ProcessInstancesService, ProcessInstancesService,
ProcessDefinitionsService, ProcessDefinitionsService,
FileBrowserUtil FileBrowserUtil, ProcessCloudWidgetPage
} from '@alfresco/adf-testing'; } from '@alfresco/adf-testing';
import { StartProcessCloudConfiguration } from './config/start-process-cloud.config'; import { StartProcessCloudConfiguration } from './config/start-process-cloud.config';
import { ProcessCloudDemoPage } from '../pages/adf/demo-shell/process-services/processCloudDemoPage'; import { ProcessCloudDemoPage } from '../pages/adf/demo-shell/process-services/processCloudDemoPage';
@@ -60,7 +59,7 @@ describe('Start Task Form', () => {
const breadCrumbDropdownPage = new BreadCrumbDropdownPage(); const breadCrumbDropdownPage = new BreadCrumbDropdownPage();
const processDetailsCloudDemoPage = new ProcessDetailsCloudDemoPage(); const processDetailsCloudDemoPage = new ProcessDetailsCloudDemoPage();
const settingsPage = new SettingsPage(); const settingsPage = new SettingsPage();
const widget = new Widget(); const widget = new ProcessCloudWidgetPage();
const startProcessPage = new StartProcessCloudPage(); const startProcessPage = new StartProcessCloudPage();
const processCloudDemoPage = new ProcessCloudDemoPage(); const processCloudDemoPage = new ProcessCloudDemoPage();
const taskHeaderCloudPage = new TaskHeaderCloudPage(); const taskHeaderCloudPage = new TaskHeaderCloudPage();

View File

@@ -26,7 +26,7 @@ import {
ProcessInstancesService, ProcessInstancesService,
TaskHeaderCloudPage, TaskHeaderCloudPage,
TaskFormCloudComponent, TaskFormCloudComponent,
Widget, IdentityService, GroupIdentityService IdentityService, GroupIdentityService, ProcessCloudWidgetPage
} from '@alfresco/adf-testing'; } from '@alfresco/adf-testing';
import { NavigationBarPage } from '../pages/adf/navigationBarPage'; import { NavigationBarPage } from '../pages/adf/navigationBarPage';
import { TasksCloudDemoPage } from '../pages/adf/demo-shell/process-services/tasksCloudDemoPage'; import { TasksCloudDemoPage } from '../pages/adf/demo-shell/process-services/tasksCloudDemoPage';
@@ -40,7 +40,7 @@ describe('Task form cloud component', () => {
const tasksCloudDemoPage = new TasksCloudDemoPage(); const tasksCloudDemoPage = new TasksCloudDemoPage();
const taskHeaderCloudPage = new TaskHeaderCloudPage(); const taskHeaderCloudPage = new TaskHeaderCloudPage();
const taskFormCloudComponent = new TaskFormCloudComponent(); const taskFormCloudComponent = new TaskFormCloudComponent();
const widget = new Widget(); const widget = new ProcessCloudWidgetPage();
let processDefinitionService: ProcessDefinitionsService; let processDefinitionService: ProcessDefinitionsService;
let processInstancesService: ProcessInstancesService; let processInstancesService: ProcessInstancesService;

View File

@@ -26,7 +26,7 @@ import {
ProcessInstancesService, ProcessInstancesService,
TaskHeaderCloudPage, TaskHeaderCloudPage,
TaskFormCloudComponent, TaskFormCloudComponent,
Widget, QueryService QueryService, ProcessCloudWidgetPage
} from '@alfresco/adf-testing'; } from '@alfresco/adf-testing';
import { NavigationBarPage } from '../pages/adf/navigationBarPage'; import { NavigationBarPage } from '../pages/adf/navigationBarPage';
import { TasksCloudDemoPage } from '../pages/adf/demo-shell/process-services/tasksCloudDemoPage'; import { TasksCloudDemoPage } from '../pages/adf/demo-shell/process-services/tasksCloudDemoPage';
@@ -40,7 +40,7 @@ describe('Task form cloud component', () => {
const tasksCloudDemoPage = new TasksCloudDemoPage(); const tasksCloudDemoPage = new TasksCloudDemoPage();
const taskHeaderCloudPage = new TaskHeaderCloudPage(); const taskHeaderCloudPage = new TaskHeaderCloudPage();
const taskFormCloudComponent = new TaskFormCloudComponent(); const taskFormCloudComponent = new TaskFormCloudComponent();
const widget = new Widget(); const widget = new ProcessCloudWidgetPage();
let processDefinitionService: ProcessDefinitionsService; let processDefinitionService: ProcessDefinitionsService;
let processInstancesService: ProcessInstancesService; let processInstancesService: ProcessInstancesService;

View File

@@ -0,0 +1,316 @@
/*!
* @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.
*/
/* tslint:disable */
export const peopleJson = {
"formRepresentation": {
"id": "form-d74a4136-af83-4333-ac37-a6a74ac7aa84",
"name": "singlepeople",
"description": "",
"version": 0,
"standAlone": true,
"formDefinition": {
"tabs": [],
"fields": [
{
"id": "7c9ea025-4ae6-4a5a-9184-da8f7d5c5543",
"name": "Label",
"type": "container",
"tab": null,
"numberOfColumns": 2,
"fields": {
"1": [
{
"id": "PeopleSingleMode",
"name": "People",
"type": "people",
"readOnly": false,
"required": false,
"colspan": 1,
"optionType": "single",
"visibilityCondition": null,
"params": {
"existingColspan": 1,
"maxColspan": 2
}
}
],
"2": []
}
}
],
"outcomes": [],
"metadata": {},
"variables": []
}
}
};
export const peopleMultipleModeJson = {
"formRepresentation": {
"id": "form-0fec4293-a33a-4408-923c-ba2d0645459c",
"name": "people",
"description": "",
"version": 0,
"standAlone": true,
"formDefinition": {
"tabs": [],
"fields": [
{
"id": "44e485d4-c286-425a-b488-3fda1707d319",
"name": "Label",
"type": "container",
"tab": null,
"numberOfColumns": 2,
"fields": {
"1": [
{
"id": "PeopleMultipleMode",
"name": "People",
"type": "people",
"readOnly": false,
"required": false,
"colspan": 1,
"optionType": "multiple",
"visibilityCondition": null,
"params": {
"existingColspan": 1,
"maxColspan": 2
}
}
],
"2": []
}
}
],
"outcomes": [],
"metadata": {},
"variables": [
{
"id": "d6060d6b-1cb0-45dc-a18b-4d7898a9a5ad",
"name": "people",
"type": "string",
"value": "user1"
}
]
}
}
};
export const peopleRequiredJson = {
"formRepresentation": {
"id": "form-0fec4293-a33a-4408-923c-ba2d0645459c",
"name": "people",
"description": "",
"version": 0,
"standAlone": true,
"formDefinition": {
"tabs": [],
"fields": [
{
"id": "44e485d4-c286-425a-b488-3fda1707d319",
"name": "Label",
"type": "container",
"tab": null,
"numberOfColumns": 2,
"fields": {
"1": [
{
"id": "PeopleRequired",
"name": "People",
"type": "people",
"readOnly": false,
"required": true,
"colspan": 1,
"optionType": "single",
"visibilityCondition": null,
"params": {
"existingColspan": 1,
"maxColspan": 2
}
}
],
"2": []
}
}
],
"outcomes": [],
"metadata": {},
"variables": [
{
"id": "d6060d6b-1cb0-45dc-a18b-4d7898a9a5ad",
"name": "people",
"type": "string",
"value": "user1"
}
]
}
}
};
export const groupSingleJson = {
"formRepresentation": {
"id": "form-0fec4293-a33a-4408-923c-ba2d0645459c",
"name": "people",
"description": "",
"version": 0,
"standAlone": true,
"formDefinition": {
"tabs": [],
"fields": [
{
"id": "abccf2c9-b526-45c7-abd4-b969bdf8ce15",
"name": "Label",
"type": "container",
"tab": null,
"numberOfColumns": 2,
"fields": {
"1": [
{
"id": "GroupSingleMode",
"name": "Group of people",
"type": "functional-group",
"readOnly": false,
"required": false,
"colspan": 1,
"optionType": "single",
"visibilityCondition": null,
"params": {
"existingColspan": 1,
"maxColspan": 2
}
}
],
"2": []
}
}
],
"outcomes": [],
"metadata": {},
"variables": [
{
"id": "d6060d6b-1cb0-45dc-a18b-4d7898a9a5ad",
"name": "people",
"type": "string",
"value": "user1"
}
]
}
}
};
export const groupMultipleJson = {
"formRepresentation": {
"id": "form-0fec4293-a33a-4408-923c-ba2d0645459c",
"name": "people",
"description": "",
"version": 0,
"standAlone": true,
"formDefinition": {
"tabs": [],
"fields": [
{
"id": "abccf2c9-b526-45c7-abd4-b969bdf8ce15",
"name": "Label",
"type": "container",
"tab": null,
"numberOfColumns": 2,
"fields": {
"1": [
{
"id": "GroupMultipleMode",
"name": "Group of people",
"type": "functional-group",
"readOnly": false,
"required": false,
"colspan": 1,
"optionType": "multiple",
"visibilityCondition": null,
"params": {
"existingColspan": 1,
"maxColspan": 2
}
}
],
"2": []
}
}
],
"outcomes": [],
"metadata": {},
"variables": [
{
"id": "d6060d6b-1cb0-45dc-a18b-4d7898a9a5ad",
"name": "people",
"type": "string",
"value": "user1"
}
]
}
}
}
export const groupRequiredJson = {
"formRepresentation": {
"id": "form-0fec4293-a33a-4408-923c-ba2d0645459c",
"name": "people",
"description": "",
"version": 0,
"standAlone": true,
"formDefinition": {
"tabs": [],
"fields": [
{
"id": "abccf2c9-b526-45c7-abd4-b969bdf8ce15",
"name": "Label",
"type": "container",
"tab": null,
"numberOfColumns": 2,
"fields": {
"1": [
{
"id": "GroupRequired",
"name": "Group of people",
"type": "functional-group",
"readOnly": false,
"required": true,
"colspan": 1,
"optionType": "single",
"visibilityCondition": null,
"params": {
"existingColspan": 1,
"maxColspan": 2
}
}
],
"2": []
}
}
],
"outcomes": [],
"metadata": {},
"variables": [
{
"id": "d6060d6b-1cb0-45dc-a18b-4d7898a9a5ad",
"name": "people",
"type": "string",
"value": "user1"
}
]
}
}
}

View File

@@ -46,4 +46,34 @@ export class FormPage {
await BrowserActions.click(this.saveButton); await BrowserActions.click(this.saveButton);
} }
async isSaveButtonDisabled(): Promise<boolean> {
const saveButtonDisabled = element(by.css('.adf-form-mat-card-actions [disabled]'));
try {
await saveButtonDisabled.isDisplayed();
return true;
} catch {
return false;
}
}
async isValidationIconBlue(): Promise<boolean> {
const validationIcon = element(by.css('#adf-valid-form-icon'));
try {
await validationIcon.isDisplayed();
return true;
} catch {
return false;
}
}
async isValidationIconRed(): Promise<boolean> {
const validationIcon = element(by.css('#adf-invalid-form-icon'));
try {
await validationIcon.isDisplayed();
return true;
} catch {
return false;
}
}
} }

View File

@@ -0,0 +1,18 @@
/*!
* @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.
*/
export * from './widget/public-api';

View File

@@ -0,0 +1,32 @@
/*!
* @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 { Widget } from '../../../../core/pages/form/widgets/widget';
import { PeopleCloudComponentPage } from '../../people-cloud-component.page';
import { GroupCloudComponentPage } from '../../group-cloud-component.page';
export class ProcessCloudWidgetPage extends Widget {
peopleCloudWidget(): PeopleCloudComponentPage {
return new PeopleCloudComponentPage();
}
groupCloudWidget(): GroupCloudComponentPage {
return new GroupCloudComponentPage();
}
}

View File

@@ -0,0 +1,18 @@
/*!
* @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.
*/
export * from './process-cloud-widget.page';

View File

@@ -18,10 +18,12 @@
import { browser, by, element, ElementFinder } from 'protractor'; import { browser, by, element, ElementFinder } from 'protractor';
import { BrowserVisibility } from '../../core/utils/browser-visibility'; import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions'; import { BrowserActions } from '../../core/utils/browser-actions';
import { FormFields } from '../../core/pages/form/formFields';
export class GroupCloudComponentPage { export class GroupCloudComponentPage {
groupCloudSearch: ElementFinder = element(by.css('input[data-automation-id="adf-cloud-group-search-input"]')); groupCloudSearch: ElementFinder = element(by.css('input[data-automation-id="adf-cloud-group-search-input"]'));
formFields: FormFields = new FormFields();
async searchGroups(name: string): Promise<void> { async searchGroups(name: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.groupCloudSearch); await BrowserVisibility.waitUntilElementIsVisible(this.groupCloudSearch);
@@ -36,7 +38,6 @@ export class GroupCloudComponentPage {
async getGroupsFieldContent(): Promise<string> { async getGroupsFieldContent(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.groupCloudSearch); await BrowserVisibility.waitUntilElementIsVisible(this.groupCloudSearch);
return this.groupCloudSearch.getAttribute('value'); return this.groupCloudSearch.getAttribute('value');
} }
async selectGroupFromList(name: string): Promise<void> { async selectGroupFromList(name: string): Promise<void> {
@@ -69,4 +70,13 @@ export class GroupCloudComponentPage {
await BrowserActions.click(locator); await BrowserActions.click(locator);
} }
async isGroupWidgetVisible(fieldId: string): Promise<boolean> {
try {
await this.formFields.checkWidgetIsVisible(fieldId);
return true;
} catch {
return false;
}
}
} }

View File

@@ -15,14 +15,18 @@
* limitations under the License. * limitations under the License.
*/ */
import { browser, by, element, ElementFinder, protractor } from 'protractor'; import { browser, by, element, ElementFinder, Locator, protractor } from 'protractor';
import { BrowserVisibility } from '../../core/utils/browser-visibility'; import { BrowserVisibility } from '../../core/utils/browser-visibility';
import { BrowserActions } from '../../core/utils/browser-actions'; import { BrowserActions } from '../../core/utils/browser-actions';
import { FormFields } from '../../core/pages/form/formFields';
export class PeopleCloudComponentPage { export class PeopleCloudComponentPage {
peopleCloudSearch: ElementFinder = element(by.css('input[data-automation-id="adf-people-cloud-search-input"]')); peopleCloudSearch: ElementFinder = element(by.css('input[data-automation-id="adf-people-cloud-search-input"]'));
assigneeField: ElementFinder = element(by.css('input[data-automation-id="adf-people-cloud-search-input"]')); assigneeField: ElementFinder = element(by.css('input[data-automation-id="adf-people-cloud-search-input"]'));
formFields: FormFields = new FormFields();
labelLocator: Locator = by.css("label[class*='adf-label']");
inputLocator: Locator = by.css('input');
async clearAssignee(): Promise<void> { async clearAssignee(): Promise<void> {
await BrowserActions.clearSendKeys(this.peopleCloudSearch, ' '); await BrowserActions.clearSendKeys(this.peopleCloudSearch, ' ');
@@ -80,7 +84,38 @@ export class PeopleCloudComponentPage {
await BrowserVisibility.waitUntilElementIsVisible(this.assigneeField); await BrowserVisibility.waitUntilElementIsVisible(this.assigneeField);
await browser.sleep(1000); await browser.sleep(1000);
return this.assigneeField.getAttribute('value'); return this.assigneeField.getAttribute('value');
}
getFieldLabel(fieldId): Promise<string> {
return this.formFields.getFieldLabel(fieldId, this.labelLocator);
}
getFieldValue(fieldId): Promise<string> {
return this.formFields.getFieldValue(fieldId, this.inputLocator);
}
async isPeopleWidgetVisible(fieldId: string): Promise<boolean> {
try {
await this.formFields.checkWidgetIsVisible(fieldId);
return true;
} catch {
return false;
}
}
async checkPeopleWidgetIsHidden(fieldId: string): Promise<boolean> {
const hiddenElement = element(by.css(`adf-form-field div[id='field-${fieldId}-container'][hidden]`));
try {
await BrowserVisibility.waitUntilElementIsNotVisible(hiddenElement);
return true;
} catch {
return false;
}
}
async clickPeopleInput(fieldId): Promise<void> {
const peopleInput = element.all(by.css(`div[id="field-${fieldId}-container"] `)).first();
await BrowserActions.click(peopleInput);
} }
} }

View File

@@ -28,5 +28,5 @@ export * from './task-filters-cloud-component.page';
export * from './task-list-cloud-component.page'; export * from './task-list-cloud-component.page';
export * from './start-process-cloud-component.page'; export * from './start-process-cloud-component.page';
export * from './task-form-cloud-component.page'; export * from './task-form-cloud-component.page';
export * from './dialog/public-api'; export * from './dialog/public-api';
export * from './form/public-api';