From fb9308ddbf5833662debe6165d9d758306f55b1c Mon Sep 17 00:00:00 2001 From: Marouan Bentaleb <38426175+marouanbentaleb@users.noreply.github.com> Date: Wed, 10 Apr 2019 10:48:42 +0100 Subject: [PATCH] [ADF-4367] Automation for process date format (#4580) --- .../process-instance-details.e2e.ts | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 e2e/process-services/process-instance-details.e2e.ts diff --git a/e2e/process-services/process-instance-details.e2e.ts b/e2e/process-services/process-instance-details.e2e.ts new file mode 100644 index 0000000000..e2ed34b074 --- /dev/null +++ b/e2e/process-services/process-instance-details.e2e.ts @@ -0,0 +1,91 @@ +/*! + * @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 TestConfig = require('../test.config'); + +import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api'; +import { UsersActions } from '../actions/users.actions'; +import { ProcessServicesPage } from '../pages/adf/process-services/processServicesPage'; +import resources = require('../util/resources'); +import { AppsActions } from '../actions/APS/apps.actions'; +import { LoginPage } from '@alfresco/adf-testing'; +import { NavigationBarPage } from '../pages/adf/navigationBarPage'; +import { AppNavigationBarPage } from '../pages/adf/process-services/appNavigationBarPage'; +import { ProcessListPage } from '../pages/adf/process-services/processListPage'; +import { ProcessDetailsPage } from '../pages/adf/process-services/processDetailsPage'; +import dateFormat = require('dateformat'); + +describe('Process Instance Details', () => { + + const loginPage = new LoginPage(); + const navigationBarPage = new NavigationBarPage(); + const processServicesPage = new ProcessServicesPage(); + const appNavigationBarPage = new AppNavigationBarPage(); + const processListPage = new ProcessListPage(); + const processDetailsPage = new ProcessDetailsPage(); + + let appModel, process, user; + const app = resources.Files.SIMPLE_APP_WITH_USER_FORM; + const PROCESS_DATE_FORMAT = 'mmm dd yyyy'; + + beforeAll(async (done) => { + const apps = new AppsActions(); + const users = new UsersActions(); + + this.alfrescoJsApi = new AlfrescoApi({ + provider: 'BPM', + hostBpm: TestConfig.adf.url + }); + + await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + user = await users.createTenantAndUser(this.alfrescoJsApi); + + await this.alfrescoJsApi.login(user.email, user.password); + + appModel = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location); + const processModel = await apps.startProcess(this.alfrescoJsApi, appModel, 'process'); + + await loginPage.loginToProcessServicesUsingUserModel(user); + + navigationBarPage.navigateToProcessServicesPage(); + processServicesPage.checkApsContainer(); + processServicesPage.goToApp(app.title); + appNavigationBarPage.clickProcessButton(); + processListPage.checkProcessListIsDisplayed(); + + process = await this.alfrescoJsApi.activiti.processApi.getProcessInstance(processModel.id); + + done(); + }); + + afterAll(async (done) => { + await this.alfrescoJsApi.activiti.modelsApi.deleteModel(appModel.id); + + await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + await this.alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(user.tenantId); + + done(); + }); + + it('[C307031] Should display the created date in the default format', () => { + processDetailsPage.checkDetailsAreDisplayed(); + expect(processDetailsPage.getCreated()).toEqual(dateFormat(process.started, PROCESS_DATE_FORMAT)); + }); + +});