alfresco-ng2-components/e2e/process-services/process-instance-details.e2e.ts
Suzana Dirla a13196a836 [ADF-4715][ADF-4717] fix process-filter-results random failing tests (#4888)
* [ADF-4715] a process never has CREATED status

* [ADF-4717] clean up in afterAll

* check mediumDate format

* check mediumDate format

* show more log data

* Revert "show more log data"

This reverts commit a19c629
2019-07-03 09:48:14 +01:00

92 lines
3.6 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 { browser } from 'protractor';
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 { ProcessServiceTabBarPage } from '../pages/adf/process-services/processServiceTabBarPage';
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 processServiceTabBarPage = new ProcessServiceTabBarPage();
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 d, yyyy';
beforeAll(async (done) => {
const apps = new AppsActions();
const users = new UsersActions();
this.alfrescoJsApi = new AlfrescoApi({
provider: 'BPM',
hostBpm: browser.params.testConfig.adf.url
});
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.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);
processServiceTabBarPage.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(browser.params.testConfig.adf.adminEmail, browser.params.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));
});
});