mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
ESLint: cleanup await expect from protractor tests (#9630)
This commit is contained in:
@@ -72,23 +72,23 @@ describe('Amount Widget', () => {
|
||||
await widget.checkboxWidget().clickCheckboxInput(app.FIELD.checkbox_id);
|
||||
await taskPage.formFields().checkWidgetIsVisible(app.FIELD.amount_input_id);
|
||||
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
await expect(await widget.amountWidget().getAmountFieldLabel(app.FIELD.amount_input_id)).toContain('Amount');
|
||||
await expect(await widget.amountWidget().getPlaceholder(app.FIELD.amount_input_id)).toContain('Type amount');
|
||||
expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
expect(await widget.amountWidget().getAmountFieldLabel(app.FIELD.amount_input_id)).toContain('Amount');
|
||||
expect(await widget.amountWidget().getPlaceholder(app.FIELD.amount_input_id)).toContain('Type amount');
|
||||
const fieldCurrency = await widget.amountWidget().getAmountFieldCurrency(app.FIELD.amount_input_id);
|
||||
await expect(fieldCurrency.trim()).toBe('$');
|
||||
expect(fieldCurrency.trim()).toBe('$');
|
||||
|
||||
await widget.amountWidget().setFieldValue(app.FIELD.amount_input_id, 4);
|
||||
await expect(await widget.amountWidget().getErrorMessage(app.FIELD.amount_input_id)).toBe(`Can't be less than 5`);
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
expect(await widget.amountWidget().getErrorMessage(app.FIELD.amount_input_id)).toBe(`Can't be less than 5`);
|
||||
expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
await widget.amountWidget().clearFieldValue(app.FIELD.amount_input_id);
|
||||
|
||||
await widget.amountWidget().setFieldValue(app.FIELD.amount_input_id, 101);
|
||||
await expect(await widget.amountWidget().getErrorMessage(app.FIELD.amount_input_id)).toBe(`Can't be greater than 100`);
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
expect(await widget.amountWidget().getErrorMessage(app.FIELD.amount_input_id)).toBe(`Can't be greater than 100`);
|
||||
expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
await widget.amountWidget().clearFieldValue(app.FIELD.amount_input_id);
|
||||
|
||||
await widget.amountWidget().setFieldValue(app.FIELD.amount_input_id, 6);
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -71,6 +71,6 @@ describe('Attach Folder widget', () => {
|
||||
await widget.checkboxWidget().clickCheckboxInput(app.FIELD.checkbox_id);
|
||||
await taskPage.formFields().checkWidgetIsVisible(app.FIELD.upload_button_id);
|
||||
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -67,10 +67,10 @@ describe('Checkbox Widget', () => {
|
||||
|
||||
it('[C268554] Should be able to set general settings for Checkbox widget ', async () => {
|
||||
await taskPage.formFields().setValueInInputById(app.FIELD.number_input_id, '2');
|
||||
await expect(await widget.checkboxWidget().getCheckboxLabel()).toContain(app.FIELD.checkbox_label);
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
expect(await widget.checkboxWidget().getCheckboxLabel()).toContain(app.FIELD.checkbox_label);
|
||||
expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
await widget.checkboxWidget().clickCheckboxInput(app.FIELD.checkbox_input_id);
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
});
|
||||
|
||||
it('[C272812] Should be able to set visibility settings for Checkbox widget', async () => {
|
||||
|
||||
@@ -67,6 +67,6 @@ describe('Document Template widget', () => {
|
||||
});
|
||||
|
||||
it('[C260406] should check that the template contains assigned file ', async () => {
|
||||
await expect(await widget.containerWidget().getFieldText(app.form_fields.container_id)).toEqual(app.attached_file);
|
||||
expect(await widget.containerWidget().getFieldText(app.form_fields.container_id)).toEqual(app.attached_file);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -15,14 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {
|
||||
createApiService,
|
||||
ApplicationsUtil,
|
||||
LoginPage,
|
||||
ProcessUtil,
|
||||
UsersActions,
|
||||
Widget, UserModel
|
||||
} from '@alfresco/adf-testing';
|
||||
import { createApiService, ApplicationsUtil, LoginPage, ProcessUtil, UsersActions, Widget, UserModel } from '@alfresco/adf-testing';
|
||||
import { TasksPage } from '../pages/tasks.page';
|
||||
import { browser } from 'protractor';
|
||||
import CONSTANTS = require('../../util/constants');
|
||||
@@ -74,19 +67,19 @@ describe('Dropdown widget', () => {
|
||||
});
|
||||
|
||||
it('[C269051] Should be possible to set general and options properties for Dropdown widget ', async () => {
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
|
||||
await widget.dropdown().selectOption('Happy');
|
||||
await expect(await widget.dropdown().getSelectedOptionText(app.FIELD.general_dropdown)).toContain('Happy');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
expect(await widget.dropdown().getSelectedOptionText(app.FIELD.general_dropdown)).toContain('Happy');
|
||||
expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
|
||||
await widget.dropdown().selectOption('Choose one');
|
||||
await expect(await widget.dropdown().getSelectedOptionText(app.FIELD.general_dropdown)).toContain('Choose one');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
expect(await widget.dropdown().getSelectedOptionText(app.FIELD.general_dropdown)).toContain('Choose one');
|
||||
expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
|
||||
await widget.dropdown().selectOption('Sad');
|
||||
await expect(await widget.dropdown().getSelectedOptionText(app.FIELD.general_dropdown)).toContain('Sad');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
expect(await widget.dropdown().getSelectedOptionText(app.FIELD.general_dropdown)).toContain('Sad');
|
||||
expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
});
|
||||
|
||||
it('[C269052] Should be possible to set visibility properties for Dropdown widget', async () => {
|
||||
|
||||
@@ -15,14 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {
|
||||
createApiService,
|
||||
ApplicationsUtil,
|
||||
LoginPage,
|
||||
ProcessUtil,
|
||||
UsersActions,
|
||||
Widget, UserModel
|
||||
} from '@alfresco/adf-testing';
|
||||
import { createApiService, ApplicationsUtil, LoginPage, ProcessUtil, UsersActions, Widget, UserModel } from '@alfresco/adf-testing';
|
||||
import { TasksPage } from '../pages/tasks.page';
|
||||
import { browser } from 'protractor';
|
||||
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
|
||||
@@ -129,18 +122,18 @@ describe('Dynamic Table widget ', () => {
|
||||
await widget.dynamicTable().clickAddRow(app.FIELD.dynamic_table_id);
|
||||
await widget.dynamicTable().setDatatableInput('User1');
|
||||
await widget.dynamicTable().clickSaveButton();
|
||||
await expect(await widget.dynamicTable().getTableRowText(0)).toEqual('User1');
|
||||
expect(await widget.dynamicTable().getTableRowText(0)).toEqual('User1');
|
||||
|
||||
await widget.dynamicTable().clickTableRow(0);
|
||||
await widget.dynamicTable().clickEditButton();
|
||||
await widget.dynamicTable().setDatatableInput('User2');
|
||||
await widget.dynamicTable().clickCancelButton();
|
||||
await expect(await widget.dynamicTable().getTableRowText(0)).toEqual('User1');
|
||||
expect(await widget.dynamicTable().getTableRowText(0)).toEqual('User1');
|
||||
|
||||
await widget.dynamicTable().clickEditButton();
|
||||
await widget.dynamicTable().setDatatableInput('User2');
|
||||
await widget.dynamicTable().clickSaveButton();
|
||||
await expect(await widget.dynamicTable().getTableRowText(0)).toEqual('User2');
|
||||
expect(await widget.dynamicTable().getTableRowText(0)).toEqual('User2');
|
||||
|
||||
await widget.dynamicTable().clickAddRow(app.FIELD.dynamic_table_id);
|
||||
await widget.dynamicTable().setDatatableInput('User3');
|
||||
@@ -184,19 +177,19 @@ describe('Dynamic Table widget ', () => {
|
||||
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".');
|
||||
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.`);
|
||||
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.`);
|
||||
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.`);
|
||||
expect(await widget.dynamicTable().checkErrorMessage()).toBe(`Field 'Address' is required.`);
|
||||
|
||||
await widget.dynamicTable().setDatatableInput('address', app.CUSTOM_VALIDATOR.FIELD.ADDRESS);
|
||||
await widget.dynamicTable().clickSaveButton();
|
||||
|
||||
@@ -71,7 +71,7 @@ describe('Header widget', async () => {
|
||||
await widget.checkboxWidget().clickCheckboxInput(app.FIELD.checkbox_id);
|
||||
await taskPage.formFields().checkWidgetIsVisible(app.FIELD.header_id);
|
||||
|
||||
await expect(await widget.headerWidget().getFieldLabel(app.FIELD.header_id)).toBe('Header');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
expect(await widget.headerWidget().getFieldLabel(app.FIELD.header_id)).toBe('Header');
|
||||
expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -71,7 +71,7 @@ describe('Hyperlink widget', () => {
|
||||
await widget.checkboxWidget().clickCheckboxInput(app.FIELD.checkbox_id);
|
||||
await taskPage.formFields().checkWidgetIsVisible(app.FIELD.hyperlink_id);
|
||||
|
||||
await expect(await widget.hyperlink().getFieldLabel(app.FIELD.hyperlink_id)).toBe('Hyperlink');
|
||||
await expect(await widget.hyperlink().getFieldText(app.FIELD.hyperlink_id)).toBe('https://www.google.com/');
|
||||
expect(await widget.hyperlink().getFieldLabel(app.FIELD.hyperlink_id)).toBe('Hyperlink');
|
||||
expect(await widget.hyperlink().getFieldText(app.FIELD.hyperlink_id)).toBe('https://www.google.com/');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -68,29 +68,29 @@ describe('Multi-line Widget', () => {
|
||||
|
||||
it('[C268182] Should be able to set general properties for Multi-line Text Widget', async () => {
|
||||
const label = await widget.multilineTextWidget().getFieldLabel(app.FIELD.multiSimple);
|
||||
await expect(label).toBe('multiSimple*');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
expect(label).toBe('multiSimple*');
|
||||
expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
const placeHolder = await widget.multilineTextWidget().getFieldPlaceHolder(app.FIELD.multiSimple);
|
||||
await expect(placeHolder).toBe('Type something...');
|
||||
expect(placeHolder).toBe('Type something...');
|
||||
await widget.multilineTextWidget().setValue(app.FIELD.multiSimple, 'TEST');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
});
|
||||
|
||||
it('[C268184] Should be able to set advanced properties for Multi-line Text Widget', async () => {
|
||||
await widget.multilineTextWidget().setValue(app.FIELD.multiMinMax, 'A');
|
||||
await expect(await widget.multilineTextWidget().getErrorMessage(app.FIELD.multiMinMax)).toContain('Enter at least 4 characters');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
expect(await widget.multilineTextWidget().getErrorMessage(app.FIELD.multiMinMax)).toContain('Enter at least 4 characters');
|
||||
expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
await widget.multilineTextWidget().setValue(app.FIELD.multiMinMax, 'AAAAAAAAAAA');
|
||||
await expect(await widget.multilineTextWidget().getErrorMessage(app.FIELD.multiMinMax)).toContain('Enter no more than 10 characters');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
expect(await widget.multilineTextWidget().getErrorMessage(app.FIELD.multiMinMax)).toContain('Enter no more than 10 characters');
|
||||
expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
await widget.multilineTextWidget().setValue(app.FIELD.multiMinMax, 'AAAA');
|
||||
|
||||
await widget.multilineTextWidget().setValue(app.FIELD.multiSimple, 'TEST');
|
||||
await widget.multilineTextWidget().setValue(app.FIELD.multiRegexp, '3');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
await expect(await widget.multilineTextWidget().getErrorMessage(app.FIELD.multiRegexp)).toContain('Enter a different value');
|
||||
expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
expect(await widget.multilineTextWidget().getErrorMessage(app.FIELD.multiRegexp)).toContain('Enter a different value');
|
||||
await widget.multilineTextWidget().setValue(app.FIELD.multiRegexp, 'TE');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
});
|
||||
|
||||
it('[C268232] Should be able to set visibility properties for Multi-line Text Widget', async () => {
|
||||
|
||||
@@ -67,12 +67,12 @@ describe('Number widget', () => {
|
||||
});
|
||||
|
||||
it('[C269111] Should be able to set general properties for Number Widget', async () => {
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
await expect(await widget.numberWidget().getNumberFieldLabel(app.FIELD.number_general)).toContain('Number General');
|
||||
await expect(await widget.numberWidget().getPlaceholder(app.FIELD.number_general)).toContain('Type a number');
|
||||
expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
expect(await widget.numberWidget().getNumberFieldLabel(app.FIELD.number_general)).toContain('Number General');
|
||||
expect(await widget.numberWidget().getPlaceholder(app.FIELD.number_general)).toContain('Type a number');
|
||||
|
||||
await widget.numberWidget().setFieldValue(app.FIELD.number_general, 2);
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
});
|
||||
|
||||
it('[C274702] Should be able to set advanced and visibility properties for Number Widget', async () => {
|
||||
@@ -83,16 +83,16 @@ describe('Number widget', () => {
|
||||
await taskPage.formFields().checkWidgetIsVisible(app.FIELD.number_visible);
|
||||
|
||||
await widget.numberWidget().setFieldValue(app.FIELD.number_visible, 2);
|
||||
await expect(await widget.numberWidget().getErrorMessage(app.FIELD.number_visible)).toBe(`Can't be less than 3`);
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
expect(await widget.numberWidget().getErrorMessage(app.FIELD.number_visible)).toBe(`Can't be less than 3`);
|
||||
expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
await widget.numberWidget().clearFieldValue(app.FIELD.number_visible);
|
||||
|
||||
await widget.numberWidget().setFieldValue(app.FIELD.number_visible, 101);
|
||||
await expect(await widget.numberWidget().getErrorMessage(app.FIELD.number_visible)).toBe(`Can't be greater than 100`);
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
expect(await widget.numberWidget().getErrorMessage(app.FIELD.number_visible)).toBe(`Can't be greater than 100`);
|
||||
expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
await widget.numberWidget().clearFieldValue(app.FIELD.number_visible);
|
||||
|
||||
await widget.numberWidget().setFieldValue(app.FIELD.number_visible, 4);
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -22,8 +22,16 @@ import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
|
||||
import CONSTANTS = require('../../util/constants');
|
||||
import { AdminGroupsApi } from '@alfresco/js-api';
|
||||
|
||||
describe('People and Group widget', () => {
|
||||
interface AppGroupUser {
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
}
|
||||
|
||||
interface AppSubGroup {
|
||||
name: string;
|
||||
}
|
||||
|
||||
describe('People and Group widget', () => {
|
||||
const app = browser.params.resources.Files.MORE_WIDGETS;
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
@@ -59,7 +67,7 @@ describe('People and Group widget', () => {
|
||||
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');
|
||||
expect(await taskPage.taskDetails().getTitle()).toEqual('Activities');
|
||||
|
||||
await taskPage.formFields().checkWidgetIsHidden(groupVisibilityForm.FIELD.widget_id);
|
||||
await widget.checkboxWidget().clickCheckboxInput(groupVisibilityForm.FIELD.checkbox_id);
|
||||
@@ -67,8 +75,8 @@ describe('People and Group widget', () => {
|
||||
|
||||
await widget.groupWidget().insertGroup(groupVisibilityForm.FIELD.widget_id, groupVisibilityForm.searchTerm);
|
||||
await widget.groupWidget().checkDropDownListIsDisplayed();
|
||||
const suggestions = await widget.groupWidget().getDropDownList();
|
||||
await expect(suggestions.sort()).toEqual(['Heros', 'Users']);
|
||||
const suggestions = (await widget.groupWidget().getDropDownList()).sort((a, b) => a.localeCompare(b));
|
||||
expect(suggestions).toEqual(['Heros', 'Users']);
|
||||
await widget.groupWidget().selectGroupFromDropDown('Users');
|
||||
await taskPage.taskDetails().clickCompleteFormTask();
|
||||
});
|
||||
@@ -77,7 +85,7 @@ describe('People and Group widget', () => {
|
||||
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');
|
||||
expect(await taskPage.taskDetails().getTitle()).toEqual('Activities');
|
||||
|
||||
await taskPage.formFields().checkWidgetIsHidden(subgroupFrom.FIELD.widget_id);
|
||||
await widget.checkboxWidget().clickCheckboxInput(subgroupFrom.FIELD.checkbox_id);
|
||||
@@ -85,8 +93,8 @@ describe('People and Group widget', () => {
|
||||
|
||||
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());
|
||||
const suggestions = (await widget.groupWidget().getDropDownList()).sort((a, b) => a.localeCompare(b));
|
||||
expect(suggestions).toEqual(getSubGroupsName());
|
||||
await widget.groupWidget().selectGroupFromDropDown(getSubGroupsName()[0]);
|
||||
await taskPage.taskDetails().clickCompleteFormTask();
|
||||
|
||||
@@ -95,14 +103,14 @@ describe('People and Group widget', () => {
|
||||
|
||||
await taskPage.tasksListPage().selectRow(name);
|
||||
await widget.groupWidget().checkGroupFieldIsDisplayed();
|
||||
await expect(await widget.groupWidget().getFieldValue(subgroupFrom.FIELD.widget_id)).toBe('Heros');
|
||||
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');
|
||||
expect(await taskPage.taskDetails().getTitle()).toEqual('Activities');
|
||||
|
||||
await taskPage.formFields().checkWidgetIsHidden(peopleWidget.FIELD.widget_id);
|
||||
await widget.checkboxWidget().clickCheckboxInput(peopleWidget.FIELD.checkbox_id);
|
||||
@@ -110,26 +118,39 @@ describe('People and Group widget', () => {
|
||||
|
||||
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());
|
||||
const suggestions = (await widget.peopleWidget().getDropDownList()).sort((a, b) => a.localeCompare(b));
|
||||
expect(suggestions).toEqual(getGroupMembers());
|
||||
await widget.peopleWidget().selectUserFromDropDown(getGroupMembers()[0]);
|
||||
await taskPage.taskDetails().clickCompleteFormTask();
|
||||
});
|
||||
|
||||
/**
|
||||
* Create group and users
|
||||
*
|
||||
* @param tenantId tenant id
|
||||
*/
|
||||
async function createGroupAndUsers(tenantId: number) {
|
||||
await apiService.loginWithProfile('admin');
|
||||
|
||||
const userCreated = await Promise.all(app.groupUser.map(usersToCreate =>
|
||||
usersActions.createUser(new UserModel({
|
||||
tenantId,
|
||||
firstName: usersToCreate.firstName,
|
||||
lastName: usersToCreate.lastName
|
||||
}))
|
||||
));
|
||||
const userCreated = await Promise.all(
|
||||
app.groupUser.map((usersToCreate: AppGroupUser) =>
|
||||
usersActions.createUser(
|
||||
new UserModel({
|
||||
tenantId,
|
||||
firstName: usersToCreate.firstName,
|
||||
lastName: usersToCreate.lastName
|
||||
})
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
const subgroupUser = await usersActions.createUser(new UserModel({
|
||||
tenantId, firstName: app.subGroupUser.firstName, lastName: app.subGroupUser.lastName
|
||||
}));
|
||||
const subgroupUser = await usersActions.createUser(
|
||||
new UserModel({
|
||||
tenantId,
|
||||
firstName: app.subGroupUser.firstName,
|
||||
lastName: app.subGroupUser.lastName
|
||||
})
|
||||
);
|
||||
|
||||
const group = await adminGroupsApi.createNewGroup({
|
||||
name: app.group.name,
|
||||
@@ -139,24 +160,37 @@ describe('People and Group widget', () => {
|
||||
|
||||
await Promise.all(userCreated.map((userToAddGroup: UserModel) => adminGroupsApi.addGroupMember(group.id, userToAddGroup.id)));
|
||||
|
||||
const subgroups: any[] = await Promise.all(getSubGroupsName().map((name) =>
|
||||
adminGroupsApi.createNewGroup({
|
||||
name,
|
||||
tenantId,
|
||||
type: 1,
|
||||
parentGroupId: group.id
|
||||
})
|
||||
));
|
||||
const subgroups = await Promise.all(
|
||||
getSubGroupsName().map((name) =>
|
||||
adminGroupsApi.createNewGroup({
|
||||
name,
|
||||
tenantId,
|
||||
type: 1,
|
||||
parentGroupId: group.id
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
await Promise.all(subgroups.map((subgroup) => adminGroupsApi.addGroupMember(subgroup.id, subgroupUser.id)));
|
||||
|
||||
}
|
||||
|
||||
function getSubGroupsName() {
|
||||
return app.group.subgroup.map(subgroup => subgroup.name);
|
||||
/**
|
||||
* Get subgroups name
|
||||
*
|
||||
* @returns list of subgroup names
|
||||
*/
|
||||
function getSubGroupsName(): string[] {
|
||||
return app.group.subgroup.map((subgroup: AppSubGroup) => subgroup.name).sort((a: string, b: string) => a.localeCompare(b));
|
||||
}
|
||||
|
||||
function getGroupMembers() {
|
||||
return app.groupUser.map(groupUser => `${groupUser.firstName} ${groupUser.lastName}`);
|
||||
/**
|
||||
* Get group members
|
||||
*
|
||||
* @returns list of group member full names
|
||||
*/
|
||||
function getGroupMembers(): string[] {
|
||||
return app.groupUser
|
||||
.map((groupUser: AppGroupUser) => `${groupUser.firstName} ${groupUser.lastName}`)
|
||||
.sort((a: string, b: string) => a.localeCompare(b));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -72,11 +72,11 @@ describe('Radio Buttons Widget', () => {
|
||||
|
||||
it('[C274704] Should be able to set visibility properties for Radio Button widget', async () => {
|
||||
await taskPage.formFields().checkWidgetIsHidden(app.FIELD.radio_buttons_id);
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
|
||||
await widget.checkboxWidget().clickCheckboxInput(app.FIELD.checkbox_id);
|
||||
await expect(await widget.radioWidget().getRadioWidgetLabel(app.FIELD.radio_buttons_id)).toContain('Radio posts');
|
||||
expect(await widget.radioWidget().getRadioWidgetLabel(app.FIELD.radio_buttons_id)).toContain('Radio posts');
|
||||
await widget.radioWidget().selectOption(app.FIELD.radio_buttons_id, 1);
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -68,43 +68,43 @@ describe('Text widget', () => {
|
||||
|
||||
it('[C268157] Should be able to set general properties for Text widget', async () => {
|
||||
const label = await widget.textWidget().getFieldLabel(app.FIELD.simpleText);
|
||||
await expect(label).toBe('textSimple*');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
expect(label).toBe('textSimple*');
|
||||
expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
const placeHolder = await widget.textWidget().getFieldPlaceHolder(app.FIELD.simpleText);
|
||||
await expect(placeHolder).toBe('Type something...');
|
||||
expect(placeHolder).toBe('Type something...');
|
||||
await widget.textWidget().setValue(app.FIELD.simpleText, 'TEST');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
});
|
||||
|
||||
it('[C268170] Min-max length properties', async () => {
|
||||
await widget.textWidget().setValue(app.FIELD.simpleText, 'TEST');
|
||||
await widget.textWidget().setValue(app.FIELD.textMinMax, 'A');
|
||||
await expect(await widget.textWidget().getErrorMessage(app.FIELD.textMinMax)).toContain('Enter at least 4 characters');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
expect(await widget.textWidget().getErrorMessage(app.FIELD.textMinMax)).toContain('Enter at least 4 characters');
|
||||
expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
await widget.textWidget().setValue(app.FIELD.textMinMax, '01234567890');
|
||||
await expect(await widget.textWidget().getErrorMessage(app.FIELD.textMinMax)).toContain('Enter no more than 10 characters');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
expect(await widget.textWidget().getErrorMessage(app.FIELD.textMinMax)).toContain('Enter no more than 10 characters');
|
||||
expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
await widget.textWidget().setValue(app.FIELD.textMinMax, '123456789');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
});
|
||||
|
||||
it('[C268171] Input mask reversed checkbox properties', async () => {
|
||||
await widget.textWidget().setValue(app.FIELD.textMask, '18951523');
|
||||
await expect(await widget.textWidget().getFieldValue(app.FIELD.textMask)).toBe('1895-1523');
|
||||
expect(await widget.textWidget().getFieldValue(app.FIELD.textMask)).toBe('1895-1523');
|
||||
});
|
||||
|
||||
it('[C268171] Input mask reversed checkbox properties', async () => {
|
||||
await widget.textWidget().setValue(app.FIELD.textMaskReversed, '1234567899');
|
||||
await expect(await widget.textWidget().getFieldValue(app.FIELD.textMaskReversed)).toBe('3456-7899');
|
||||
expect(await widget.textWidget().getFieldValue(app.FIELD.textMaskReversed)).toBe('3456-7899');
|
||||
});
|
||||
|
||||
it('[C268177] Should be able to set Regex Pattern property for Text widget', async () => {
|
||||
await widget.textWidget().setValue(app.FIELD.simpleText, 'TEST');
|
||||
await widget.textWidget().setValue(app.FIELD.textRegexp, 'T');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
await expect(await widget.textWidget().getErrorMessage(app.FIELD.textRegexp)).toContain('Enter a different value');
|
||||
expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(false);
|
||||
expect(await widget.textWidget().getErrorMessage(app.FIELD.textRegexp)).toContain('Enter a different value');
|
||||
await widget.textWidget().setValue(app.FIELD.textRegexp, 'TE');
|
||||
await expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
expect(await taskPage.formFields().isCompleteFormButtonEnabled()).toEqual(true);
|
||||
});
|
||||
|
||||
it('[C274712] Should be able to set visibility properties for Text widget ', async () => {
|
||||
|
||||
Reference in New Issue
Block a user