mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
@@ -18,25 +18,27 @@
|
||||
import {
|
||||
ApiService,
|
||||
ApplicationsUtil,
|
||||
LoginPage,
|
||||
LoginPage, ModelsActions,
|
||||
ProcessUtil,
|
||||
StringUtil,
|
||||
StringUtil, TaskUtil,
|
||||
UsersActions,
|
||||
Widget
|
||||
Widget,
|
||||
FormUtil
|
||||
} from '@alfresco/adf-testing';
|
||||
import { browser } from 'protractor';
|
||||
import { FormModelActions } from '../../actions/APS/form-model.actions';
|
||||
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
|
||||
import { FiltersPage } from './../pages/filters.page';
|
||||
import { TaskDetailsPage } from './../pages/task-details.page';
|
||||
import { TasksListPage } from './../pages/tasks-list.page';
|
||||
import { TasksPage } from './../pages/tasks.page';
|
||||
import { AttachFormPage } from './../pages/attach-form.page';
|
||||
import { TaskRepresentation } from '@alfresco/js-api';
|
||||
import CONSTANTS = require('../../util/constants');
|
||||
import { TaskActionsApi, TasksApi } from '@alfresco/js-api';
|
||||
|
||||
describe('Task Details - Form', () => {
|
||||
|
||||
const app = browser.params.resources.Files.SIMPLE_APP_WITH_USER_FORM;
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const tasksListPage = new TasksListPage();
|
||||
const taskDetailsPage = new TaskDetailsPage();
|
||||
@@ -46,9 +48,14 @@ describe('Task Details - Form', () => {
|
||||
const widget = new Widget();
|
||||
|
||||
const apiService = new ApiService();
|
||||
const formActions = new FormModelActions(apiService);
|
||||
const formActions = new FormUtil(apiService);
|
||||
const processUtil = new ProcessUtil(apiService);
|
||||
const usersActions = new UsersActions(apiService);
|
||||
const applicationsService = new ApplicationsUtil(apiService);
|
||||
const taskUtil = new TaskUtil(apiService);
|
||||
const modelsActions = new ModelsActions(apiService);
|
||||
const taskActionsApi = new TaskActionsApi(apiService.getInstance());
|
||||
const tasksApi = new TasksApi(apiService.getInstance());
|
||||
|
||||
let task, otherTask, user, newForm, attachedForm, otherAttachedForm;
|
||||
|
||||
@@ -76,27 +83,28 @@ describe('Task Details - Form', () => {
|
||||
user = await usersActions.createUser();
|
||||
await apiService.login(user.username, user.password);
|
||||
|
||||
attachedForm = await apiService.getInstance().activiti.modelsApi.createModel(attachedFormModel);
|
||||
newForm = await apiService.getInstance().activiti.modelsApi.createModel(newFormModel);
|
||||
attachedForm = await modelsActions.modelsApi.createModel(attachedFormModel);
|
||||
newForm = await modelsActions.modelsApi.createModel(newFormModel);
|
||||
|
||||
const otherEmptyTask = await apiService.getInstance().activiti.taskApi.createNewTask(new TaskRepresentation({ name: StringUtil.generateRandomString() }));
|
||||
otherAttachedForm = await apiService.getInstance().activiti.modelsApi.createModel(otherAttachedFormModel);
|
||||
const otherEmptyTask = await taskUtil.createStandaloneTask();
|
||||
|
||||
await apiService.getInstance().activiti.taskApi.attachForm(otherEmptyTask.id, { 'formId': otherAttachedForm.id });
|
||||
otherTask = await apiService.getInstance().activiti.taskApi.getTask(otherEmptyTask.id);
|
||||
otherAttachedForm = await modelsActions.modelsApi.createModel(otherAttachedFormModel);
|
||||
|
||||
await taskActionsApi.attachForm(otherEmptyTask.id, { 'formId': otherAttachedForm.id });
|
||||
otherTask = await tasksApi.getTask(otherEmptyTask.id);
|
||||
|
||||
await loginPage.login(user.username, user.password);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await apiService.loginWithProfile('admin');
|
||||
await apiService.getInstance().activiti.adminTenantsApi.deleteTenant(user.tenantId);
|
||||
await usersActions.deleteTenant(user.tenantId);
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
const emptyTask = await apiService.getInstance().activiti.taskApi.createNewTask(new TaskRepresentation({ name: StringUtil.generateRandomString() }));
|
||||
await apiService.getInstance().activiti.taskApi.attachForm(emptyTask.id, { 'formId': attachedForm.id });
|
||||
task = await apiService.getInstance().activiti.taskApi.getTask(emptyTask.id);
|
||||
const emptyTask = await taskUtil.createStandaloneTask();
|
||||
await taskActionsApi.attachForm(emptyTask.id, { 'formId': attachedForm.id });
|
||||
task = await tasksApi.getTask(emptyTask.id);
|
||||
await (await new NavigationBarPage().navigateToProcessServicesPage()).goToTaskApp();
|
||||
await tasksListPage.checkTaskListIsLoaded();
|
||||
await filtersPage.goToFilter(CONSTANTS.TASK_FILTERS.INV_TASKS);
|
||||
@@ -176,17 +184,16 @@ describe('Task Details - Form', () => {
|
||||
tabFieldVar: 'tabBasicFieldVar'
|
||||
};
|
||||
|
||||
let app, newTask;
|
||||
let newTask, appModel;
|
||||
|
||||
beforeAll(async () => {
|
||||
app = browser.params.resources.Files.SIMPLE_APP_WITH_USER_FORM;
|
||||
await applicationsService.importPublishDeployApp(app.file_path);
|
||||
appModel = await applicationsService.importPublishDeployApp(app.file_path);
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
newTask = await apiService.getInstance().activiti.taskApi.createNewTask(new TaskRepresentation({ name: StringUtil.generateRandomString() }));
|
||||
newTask = await taskUtil.createStandaloneTask();
|
||||
const form = await formActions.getFormByName(app.visibilityProcess.formName);
|
||||
await apiService.getInstance().activiti.taskApi.attachForm(newTask.id, { 'formId': form.id });
|
||||
await taskActionsApi.attachForm(newTask.id, { 'formId': form.id });
|
||||
|
||||
await browser.refresh();
|
||||
await (await new NavigationBarPage().navigateToProcessServicesPage()).goToTaskApp();
|
||||
@@ -350,7 +357,7 @@ describe('Task Details - Form', () => {
|
||||
});
|
||||
|
||||
it('[C315197] Should be able to complete a process task with visible tab with empty value for field', async () => {
|
||||
await new ProcessUtil(apiService).startProcessByDefinitionName(app.name, app.visibilityProcess.name);
|
||||
await processUtil.startProcessByDefinitionName(appModel.name, app.visibilityProcess.name);
|
||||
|
||||
await filtersPage.goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
|
||||
await tasksListPage.checkTaskListIsLoaded();
|
||||
@@ -384,7 +391,7 @@ describe('Task Details - Form', () => {
|
||||
});
|
||||
|
||||
it('[C212922] Should a User task form be refreshed, saved or completed.', async () => {
|
||||
await new ProcessUtil(apiService).startProcessByDefinitionName(app.name, app.processName);
|
||||
await processUtil.startProcessByDefinitionName(appModel.name, app.processName);
|
||||
|
||||
await filtersPage.goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
|
||||
await tasksListPage.checkTaskListIsLoaded();
|
||||
|
Reference in New Issue
Block a user