Maurizio Vitale abb76d956b e2e cloud (#4767)
* Change strategy with process cloud e2e and fixes

* Change strategy with process cloud e2e and fixes

* Fix path and host

* improve the config and run the replace for cloud

* Use the same name of other scripts

* Fix lint

* Run the replace in case of cloud

* typo

* Export variables if needed
Fix the check env passing the oauth
2019-05-23 10:24:32 +01:00

98 lines
4.4 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 { LoginSSOPage, TasksService, ApiService, AppListCloudPage, StringUtil } from '@alfresco/adf-testing';
import { NavigationBarPage } from '../pages/adf/navigationBarPage';
import { TasksCloudDemoPage } from '../pages/adf/demo-shell/process-services/tasksCloudDemoPage';
import resources = require('../util/resources');
describe('Task filters cloud', () => {
describe('Task Filters', () => {
const loginSSOPage = new LoginSSOPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
let tasksService: TasksService;
let apiService: ApiService;
const newTask = StringUtil.generateRandomString(5), completedTask = StringUtil.generateRandomString(5);
const simpleApp = resources.ACTIVITI7_APPS.SIMPLE_APP.name;
beforeAll(async(done) => {
apiService = new ApiService(browser.params.config.oauth2.clientId, browser.params.config.bpmHost, browser.params.config.oauth2.host, 'BPM');
await apiService.login(browser.params.identityUser.email, browser.params.identityUser.password);
browser.get('/');
loginSSOPage.loginSSOIdentityService(browser.params.identityUser.email, browser.params.identityUser.password);
done();
});
beforeEach(() => {
navigationBarPage.navigateToProcessServicesCloudPage();
appListCloudComponent.checkApsContainer();
appListCloudComponent.goToApp(simpleApp);
});
it('[C290011] Should display default filters when an app is deployed', () => {
tasksCloudDemoPage.myTasksFilter().checkTaskFilterIsDisplayed();
tasksCloudDemoPage.completedTasksFilter().checkTaskFilterIsDisplayed();
});
it('[C290009] Should display default filters and created task', async () => {
tasksService = new TasksService(apiService);
const task = await tasksService.createStandaloneTask(newTask, simpleApp);
await tasksService.claimTask(task.entry.id, simpleApp);
tasksCloudDemoPage.completedTasksFilter().clickTaskFilter();
expect(tasksCloudDemoPage.getActiveFilterName()).toBe('Completed Tasks');
tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(newTask);
tasksCloudDemoPage.myTasksFilter().clickTaskFilter();
expect(tasksCloudDemoPage.getActiveFilterName()).toBe('My Tasks');
tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(newTask);
});
it('[C289955] Should display task in Complete Tasks List when task is completed', async () => {
tasksService = new TasksService(apiService);
const toBeCompletedTask = await tasksService.createStandaloneTask(completedTask, simpleApp);
await tasksService.claimTask(toBeCompletedTask.entry.id, simpleApp);
await tasksService.completeTask(toBeCompletedTask.entry.id, simpleApp);
tasksCloudDemoPage.myTasksFilter().clickTaskFilter();
expect(tasksCloudDemoPage.getActiveFilterName()).toBe('My Tasks');
tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(completedTask);
tasksCloudDemoPage.completedTasksFilter().clickTaskFilter();
expect(tasksCloudDemoPage.getActiveFilterName()).toBe('Completed Tasks');
tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(completedTask);
});
it('[C291792] Should select the first task filter from the list as default', () => {
expect(tasksCloudDemoPage.firstFilterIsActive()).toBe(true);
});
});
});