mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ACS-259] refactor login page (#5733)
* refator login page * refator login page * remove obsolete classes and move what is needed in the test pck * fix const * revert modify * remove duplicate browser property * fix build * fix * fix * fix lint * move drop action in testing remove not necessary space js-api centralize content * first refactor use js-api * fix protractor * refactor test config * simplify properties fix namings * ps cloud simplify remove unused js files * id fix * fix search test simplify environment var step 1 * fix lint * first user iteration fix * fix model * unify use of apiService * first step automatic user creation Identity * refactor creation user content-services * refactor creation user search * refactor creation user core * process service refactoring 1 * process service refactoring 1 * process service refactoring 2 * fix process * appconfig * fix process util * fix gallery * fix "this" reference issues * fix incorrect import paths * fix core * some fixes * allign * fix some test remove structure folder and move in actions * fixes * move folders in the right place * fix * fix rebase * solve build issue * fix e2e * change init aae * order api and some fixes * fix possible not valid password * fix some ps test * replace host port also in objects * Update app-config.service.ts * fix process * fix process test * process service cloud fix * fiexs * modify init script * fix two test * remove unused property * host issue * not use npx * fix ps cloud test Co-authored-by: Denys Vuika <denys.vuika@gmail.com>
This commit is contained in:
@@ -15,24 +15,36 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
|
||||
import { UsersActions } from '../actions/users.actions';
|
||||
import { Tenant } from '../models/APS/tenant';
|
||||
import Task = require('../models/APS/Task');
|
||||
import TaskModel = require('../models/APS/TaskModel');
|
||||
import FormModel = require('../models/APS/FormModel');
|
||||
import { ProcessServicesPage } from '../pages/adf/process-services/process-services.page';
|
||||
import CONSTANTS = require('../util/constants');
|
||||
import moment = require('moment');
|
||||
import { LoginPage, BrowserActions, StringUtil, ApplicationsUtil, ProcessUtil } from '@alfresco/adf-testing';
|
||||
import {
|
||||
LoginSSOPage,
|
||||
BrowserActions,
|
||||
StringUtil,
|
||||
ApplicationsUtil,
|
||||
ProcessUtil,
|
||||
ApiService
|
||||
} from '@alfresco/adf-testing';
|
||||
import { TasksPage } from '../pages/adf/process-services/tasks.page';
|
||||
import { browser } from 'protractor';
|
||||
import { TaskRepresentation } from '@alfresco/js-api';
|
||||
|
||||
describe('Task Details component', () => {
|
||||
|
||||
const processServices = new ProcessServicesPage();
|
||||
let processUserModel, appModel;
|
||||
const app = browser.params.resources.Files.SIMPLE_APP_WITH_USER_FORM;
|
||||
|
||||
const processServices = new ProcessServicesPage();
|
||||
const loginPage = new LoginSSOPage();
|
||||
const taskPage = new TasksPage();
|
||||
|
||||
const apiService = new ApiService();
|
||||
|
||||
let processUserModel, appModel;
|
||||
const tasks = ['Modifying task', 'Information box', 'No form', 'Not Created', 'Refreshing form', 'Assignee task', 'Attach File'];
|
||||
const TASK_DATE_FORMAT = 'll';
|
||||
let formModel;
|
||||
@@ -44,30 +56,21 @@ describe('Task Details component', () => {
|
||||
'stencilSet': 0
|
||||
};
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const taskPage = new TasksPage();
|
||||
|
||||
beforeAll(async () => {
|
||||
const users = new UsersActions();
|
||||
const usersActions = new UsersActions(apiService);
|
||||
|
||||
this.alfrescoJsApi = new AlfrescoApi({
|
||||
provider: 'BPM',
|
||||
hostBpm: browser.params.testConfig.adf_aps.host
|
||||
});
|
||||
await apiService.getInstance().login(browser.params.testConfig.admin.email, browser.params.testConfig.admin.password);
|
||||
processUserModel = await usersActions.createUser();
|
||||
|
||||
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
|
||||
const { id } = await this.alfrescoJsApi.activiti.adminTenantsApi.createTenant(new Tenant());
|
||||
processUserModel = await users.createApsUser(this.alfrescoJsApi, id);
|
||||
|
||||
await this.alfrescoJsApi.login(processUserModel.email, processUserModel.password);
|
||||
const applicationsService = new ApplicationsUtil(this.alfrescoJsApi);
|
||||
await apiService.getInstance().login(processUserModel.email, processUserModel.password);
|
||||
const applicationsService = new ApplicationsUtil(apiService);
|
||||
appModel = await applicationsService.importPublishDeployApp(app.file_path);
|
||||
await loginPage.loginToProcessServicesUsingUserModel(processUserModel);
|
||||
await loginPage.login(processUserModel.email, processUserModel.password);
|
||||
});
|
||||
|
||||
afterAll( async () => {
|
||||
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
|
||||
await this.alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId);
|
||||
afterAll(async () => {
|
||||
await apiService.getInstance().login(browser.params.testConfig.admin.email, browser.params.testConfig.admin.password);
|
||||
await apiService.getInstance().activiti.adminTenantsApi.deleteTenant(processUserModel.tenantId);
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
@@ -79,10 +82,10 @@ describe('Task Details component', () => {
|
||||
|
||||
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
|
||||
|
||||
await taskPage.createTask({name: tasks[1], description: 'Description', formName: app.formName});
|
||||
await taskPage.createTask({ name: tasks[1], description: 'Description', formName: app.formName });
|
||||
await expect(await taskPage.taskDetails().getTitle()).toEqual('Activities');
|
||||
|
||||
const allTasks = await this.alfrescoJsApi.activiti.taskApi.listTasks(new Task({ sort: 'created-desc' }));
|
||||
const allTasks = await apiService.getInstance().activiti.taskApi.listTasks(new Task({ sort: 'created-desc' }));
|
||||
|
||||
const taskModel = new TaskModel(allTasks.data[0]);
|
||||
await taskPage.tasksListPage().checkContentIsDisplayed(taskModel.getName());
|
||||
@@ -98,7 +101,7 @@ describe('Task Details component', () => {
|
||||
await expect(await taskPage.taskDetails().getEndDate()).toEqual('');
|
||||
await expect(await taskPage.taskDetails().getStatus()).toEqual(CONSTANTS.TASK_STATUS.RUNNING);
|
||||
|
||||
const taskForm = await this.alfrescoJsApi.activiti.taskFormsApi.getTaskForm(allTasks.data[0].id);
|
||||
const taskForm = await apiService.getInstance().activiti.taskFormsApi.getTaskForm(allTasks.data[0].id);
|
||||
formModel = new FormModel(taskForm);
|
||||
|
||||
await expect(await taskPage.taskDetails().getFormName()).toEqual(formModel.getName());
|
||||
@@ -108,10 +111,10 @@ describe('Task Details component', () => {
|
||||
await (await processServices.goToTaskApp()).clickTasksButton();
|
||||
|
||||
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
|
||||
await taskPage.createTask({name: tasks[1], description: 'Description', formName: app.formName});
|
||||
await taskPage.createTask({ name: tasks[1], description: 'Description', formName: app.formName });
|
||||
await expect(await taskPage.taskDetails().getTitle()).toEqual('Activities');
|
||||
|
||||
const allTasks = await this.alfrescoJsApi.activiti.taskApi.listTasks(new Task({ sort: 'created-desc' }));
|
||||
const allTasks = await apiService.getInstance().activiti.taskApi.listTasks(new Task({ sort: 'created-desc' }));
|
||||
|
||||
const taskModel = new TaskModel(allTasks.data[0]);
|
||||
await taskPage.tasksListPage().checkContentIsDisplayed(taskModel.getName());
|
||||
@@ -129,7 +132,7 @@ describe('Task Details component', () => {
|
||||
await expect(await taskPage.taskDetails().getParentTaskId()).toEqual('');
|
||||
await expect(await taskPage.taskDetails().getStatus()).toEqual(CONSTANTS.TASK_STATUS.RUNNING);
|
||||
|
||||
const taskForm = await this.alfrescoJsApi.activiti.taskFormsApi.getTaskForm(allTasks.data[0].id);
|
||||
const taskForm = await apiService.getInstance().activiti.taskFormsApi.getTaskForm(allTasks.data[0].id);
|
||||
|
||||
formModel = new FormModel(taskForm);
|
||||
|
||||
@@ -137,7 +140,7 @@ describe('Task Details component', () => {
|
||||
});
|
||||
|
||||
it('[C286706] Should display task details for task - Task App', async () => {
|
||||
await new ProcessUtil(this.alfrescoJsApi).startProcessOfApp(appModel.name);
|
||||
await new ProcessUtil(apiService).startProcessOfApp(appModel.name);
|
||||
|
||||
await (await processServices.goToTaskApp()).clickTasksButton();
|
||||
|
||||
@@ -145,7 +148,7 @@ describe('Task Details component', () => {
|
||||
|
||||
await expect(await taskPage.taskDetails().getTitle()).toEqual('Activities');
|
||||
|
||||
const allTasks = await this.alfrescoJsApi.activiti.taskApi.listTasks(new Task({ sort: 'created-desc' }));
|
||||
const allTasks = await apiService.getInstance().activiti.taskApi.listTasks(new Task({ sort: 'created-desc' }));
|
||||
|
||||
const taskModel = new TaskModel(allTasks.data[0]);
|
||||
|
||||
@@ -162,7 +165,7 @@ describe('Task Details component', () => {
|
||||
await expect(await taskPage.taskDetails().getParentTaskId()).toEqual('');
|
||||
await expect(await taskPage.taskDetails().getStatus()).toEqual(CONSTANTS.TASK_STATUS.RUNNING);
|
||||
|
||||
const taskForm = await this.alfrescoJsApi.activiti.taskFormsApi.getTaskForm(allTasks.data[0].id);
|
||||
const taskForm = await apiService.getInstance().activiti.taskFormsApi.getTaskForm(allTasks.data[0].id);
|
||||
|
||||
formModel = new FormModel(taskForm);
|
||||
|
||||
@@ -171,14 +174,14 @@ describe('Task Details component', () => {
|
||||
});
|
||||
|
||||
it('[C286705] Should display task details for task - Custom App', async () => {
|
||||
await new ProcessUtil(this.alfrescoJsApi).startProcessOfApp(appModel.name);
|
||||
await new ProcessUtil(apiService).startProcessOfApp(appModel.name);
|
||||
|
||||
await (await processServices.goToTaskApp()).clickTasksButton();
|
||||
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
|
||||
|
||||
await expect(await taskPage.taskDetails().getTitle()).toEqual('Activities');
|
||||
|
||||
const allTasks = await this.alfrescoJsApi.activiti.taskApi.listTasks(new Task({ sort: 'created-desc' }));
|
||||
const allTasks = await apiService.getInstance().activiti.taskApi.listTasks(new Task({ sort: 'created-desc' }));
|
||||
const taskModel = new TaskModel(allTasks.data[0]);
|
||||
|
||||
await taskPage.tasksListPage().checkContentIsDisplayed(taskModel.getName());
|
||||
@@ -194,7 +197,7 @@ describe('Task Details component', () => {
|
||||
await expect(await taskPage.taskDetails().getParentTaskId()).toEqual('');
|
||||
await expect(await taskPage.taskDetails().getStatus()).toEqual(CONSTANTS.TASK_STATUS.RUNNING);
|
||||
|
||||
const taskForm = await this.alfrescoJsApi.activiti.taskFormsApi.getTaskForm(allTasks.data[0].id);
|
||||
const taskForm = await apiService.getInstance().activiti.taskFormsApi.getTaskForm(allTasks.data[0].id);
|
||||
|
||||
formModel = new FormModel(taskForm);
|
||||
|
||||
@@ -205,7 +208,7 @@ describe('Task Details component', () => {
|
||||
it('[C286708] Should display task details for subtask - Task App', async () => {
|
||||
const taskName = 'TaskAppSubtask';
|
||||
const checklistName = 'TaskAppChecklist';
|
||||
await this.alfrescoJsApi.activiti.taskApi.createNewTask({ 'name': taskName });
|
||||
await apiService.getInstance().activiti.taskApi.createNewTask(new TaskRepresentation({ 'name': taskName }));
|
||||
|
||||
await (await processServices.goToTaskApp()).clickTasksButton();
|
||||
|
||||
@@ -222,7 +225,7 @@ describe('Task Details component', () => {
|
||||
await taskPage.tasksListPage().checkContentIsDisplayed(checklistName);
|
||||
await taskPage.tasksListPage().selectRow(checklistName);
|
||||
|
||||
const allTasks = await this.alfrescoJsApi.activiti.taskApi.listTasks(new Task({ sort: 'created-desc' }));
|
||||
const allTasks = await apiService.getInstance().activiti.taskApi.listTasks(new Task({ sort: 'created-desc' }));
|
||||
|
||||
const taskModel = new TaskModel(allTasks.data[0]);
|
||||
await taskPage.tasksListPage().checkContentIsDisplayed(taskModel.getName());
|
||||
@@ -242,7 +245,7 @@ describe('Task Details component', () => {
|
||||
it('[C286707] Should display task details for subtask - Custom App', async () => {
|
||||
const checklistName = 'CustomAppChecklist';
|
||||
|
||||
await new ProcessUtil(this.alfrescoJsApi).startProcessOfApp(appModel.name);
|
||||
await new ProcessUtil(apiService).startProcessOfApp(appModel.name);
|
||||
|
||||
await (await processServices.goToTaskApp()).clickTasksButton();
|
||||
|
||||
@@ -259,7 +262,7 @@ describe('Task Details component', () => {
|
||||
await taskPage.tasksListPage().checkContentIsDisplayed(checklistName);
|
||||
await taskPage.tasksListPage().selectRow(checklistName);
|
||||
|
||||
const allTasks = await this.alfrescoJsApi.activiti.taskApi.listTasks(new Task({ sort: 'created-desc' }));
|
||||
const allTasks = await apiService.getInstance().activiti.taskApi.listTasks(new Task({ sort: 'created-desc' }));
|
||||
|
||||
const taskModel = new TaskModel(allTasks.data[0]);
|
||||
await taskPage.tasksListPage().checkContentIsDisplayed(taskModel.getName());
|
||||
@@ -278,7 +281,7 @@ describe('Task Details component', () => {
|
||||
|
||||
it('[C286709] Should display task details for completed task - Task App', async () => {
|
||||
const taskName = 'TaskAppCompleted';
|
||||
const taskId = await this.alfrescoJsApi.activiti.taskApi.createNewTask({ 'name': taskName });
|
||||
const taskId = await apiService.getInstance().activiti.taskApi.createNewTask(new TaskRepresentation({ 'name': taskName }));
|
||||
await (await processServices.goToTaskApp()).clickTasksButton();
|
||||
|
||||
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
|
||||
@@ -290,7 +293,7 @@ describe('Task Details component', () => {
|
||||
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS);
|
||||
await taskPage.tasksListPage().selectRow(taskName);
|
||||
|
||||
const getTaskResponse = await this.alfrescoJsApi.activiti.taskApi.getTask(taskId.id);
|
||||
const getTaskResponse = await apiService.getInstance().activiti.taskApi.getTask(taskId.id);
|
||||
|
||||
const taskModel = new TaskModel(getTaskResponse);
|
||||
await taskPage.tasksListPage().checkContentIsDisplayed(taskModel.getName());
|
||||
@@ -309,10 +312,10 @@ describe('Task Details component', () => {
|
||||
|
||||
it('[C260321] Should not be able to edit a completed task\'s details', async () => {
|
||||
const taskName = 'TaskCompleted';
|
||||
const form = await this.alfrescoJsApi.activiti.modelsApi.createModel(taskFormModel);
|
||||
const task = await this.alfrescoJsApi.activiti.taskApi.createNewTask({ 'name': taskName });
|
||||
await this.alfrescoJsApi.activiti.taskApi.attachForm(task.id, { 'formId': form.id });
|
||||
await this.alfrescoJsApi.activiti.taskApi.completeTaskForm(task.id, { values: { label: null } });
|
||||
const form = await apiService.getInstance().activiti.modelsApi.createModel(taskFormModel);
|
||||
const task = await apiService.getInstance().activiti.taskApi.createNewTask(new TaskRepresentation({ 'name': taskName }));
|
||||
await apiService.getInstance().activiti.taskApi.attachForm(task.id, { 'formId': form.id });
|
||||
await apiService.getInstance().activiti.taskApi.completeTaskForm(task.id, { values: { label: null } });
|
||||
|
||||
await (await processServices.goToTaskApp()).clickTasksButton();
|
||||
|
||||
|
Reference in New Issue
Block a user