mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
92 lines
3.9 KiB
TypeScript
92 lines
3.9 KiB
TypeScript
/*!
|
|
* @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, BrowserActions } from '@alfresco/adf-testing';
|
|
import { TasksPage } from '../../pages/adf/process-services/tasksPage';
|
|
import { Widget } from '../../pages/adf/process-services/widgets/widget';
|
|
import CONSTANTS = require('../../util/constants');
|
|
import TestConfig = require('../../test.config');
|
|
import resources = require('../../util/resources');
|
|
|
|
describe('Checkbox Widget', () => {
|
|
|
|
const loginPage = new LoginPage();
|
|
let processUserModel;
|
|
const taskPage = new TasksPage();
|
|
const widget = new Widget();
|
|
let alfrescoJsApi;
|
|
const appsActions = new AppsActions();
|
|
let appModel;
|
|
const app = resources.Files.WIDGET_CHECK_APP.CHECKBOX;
|
|
let deployedApp, process;
|
|
|
|
beforeAll(async (done) => {
|
|
const users = new UsersActions();
|
|
|
|
alfrescoJsApi = new AlfrescoApi({
|
|
provider: 'BPM',
|
|
hostBpm: TestConfig.adf.url
|
|
});
|
|
|
|
await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
|
|
|
|
processUserModel = await users.createTenantAndUser(alfrescoJsApi);
|
|
|
|
await alfrescoJsApi.login(processUserModel.email, processUserModel.password);
|
|
appModel = await appsActions.importPublishDeployApp(alfrescoJsApi, resources.Files.WIDGET_CHECK_APP.file_location);
|
|
|
|
const appDefinitions = await alfrescoJsApi.activiti.appsApi.getAppDefinitions();
|
|
deployedApp = appDefinitions.data.find((currentApp) => {
|
|
return currentApp.modelId === appModel.id;
|
|
});
|
|
process = await appsActions.startProcess(alfrescoJsApi, appModel, app.processName);
|
|
await loginPage.loginToProcessServicesUsingUserModel(processUserModel);
|
|
done();
|
|
});
|
|
|
|
beforeEach(() => {
|
|
const urlToNavigateTo = `${TestConfig.adf.url}/activiti/apps/${deployedApp.id}/tasks/`;
|
|
BrowserActions.getUrl(urlToNavigateTo);
|
|
taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
|
|
taskPage.formFields().checkFormIsDisplayed();
|
|
});
|
|
|
|
afterAll(async (done) => {
|
|
await alfrescoJsApi.activiti.processApi.deleteProcessInstance(process.id);
|
|
await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
|
|
await alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId);
|
|
done();
|
|
});
|
|
|
|
it('[C268554] Should be able to set general settings for Checkbox widget ', () => {
|
|
taskPage.formFields().setValueInInputById(app.FIELD.number_input_id, 2);
|
|
expect(widget.checkboxWidget().getCheckboxLabel()).toContain(app.FIELD.checkbox_label);
|
|
expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeTruthy();
|
|
widget.checkboxWidget().clickCheckboxInput(app.FIELD.checkbox_input_id);
|
|
expect(taskPage.formFields().isCompleteFormButtonDisabled()).toBeFalsy();
|
|
});
|
|
|
|
it('[C272812] Should be able to set visibility settings for Checkbox widget', () => {
|
|
widget.checkboxWidget().isCheckboxHidden(app.FIELD.checkbox_field_id);
|
|
taskPage.formFields().setValueInInputById(app.FIELD.number_input_id, 2);
|
|
widget.checkboxWidget().isCheckboxDisplayed(app.FIELD.checkbox_field_id);
|
|
});
|
|
});
|