Skip to content

Commit

Permalink
e2e cloud (Alfresco#4767)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
mauriziovitale authored and DenysVuika committed May 23, 2019
1 parent 446efe4 commit abb76d9
Show file tree
Hide file tree
Showing 26 changed files with 301 additions and 282 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ node_modules
bundles
workspace.xml
.idea/
.env.cloud
dist/
tmp
e2e-output/
Expand Down
26 changes: 26 additions & 0 deletions appConfigReplace.cloud.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts

require('dotenv').config( { path: './e2e/.env.cloud' });
const fs = require('fs');

const BPM_HOST = process.env.URL_HOST_BPM_ADF || "bpm";
const OAUTH_HOST = process.env.URL_HOST_SSO_ADF || "keycloak";
const IDENTITY_HOST = process.env.URL_HOST_IDENTITY || "identity";
const OAUTH_CLIENDID = process.env.OAUTH_CLIENDID || "activiti";
const AUTH_TYPE = process.env.AUTH_TYPE || "OAUTH";
const PROVIDERS = process.env.PROVIDERS || "BPM";

fs.readFile('./demo-shell/dist/app.config.json', (err, appConfigString) => {
if (err) throw err;
let appConfig = JSON.parse(appConfigString);
appConfig.bpmHost = BPM_HOST;
appConfig.authType = AUTH_TYPE;
appConfig.providers = PROVIDERS;
appConfig.identityHost = IDENTITY_HOST;
appConfig.oauth2.host = OAUTH_HOST;
appConfig.oauth2.clientId = OAUTH_CLIENDID;

let appConfigReplacedJson = JSON.stringify(appConfig);
fs.writeFileSync('./demo-shell/dist/app.config.json', appConfigReplacedJson);
});
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export class ProcessCloudDemoPage {
completedProcesses = element(by.css('span[data-automation-id="completed-processes_filter"]'));
activeFilter = element(by.css("mat-list-item[class*='active'] span"));
processFilters = element(by.css("mat-expansion-panel[data-automation-id='Process Filters']"));
processFiltersList = element(by.css('adf-cloud-process-filters'));

createButton = element(by.css('button[data-automation-id="create-button"'));
newProcessButton = element(by.css('button[data-automation-id="btn-start-process"]'));
Expand Down Expand Up @@ -67,6 +68,7 @@ export class ProcessCloudDemoPage {
}

getActiveFilterName() {
BrowserVisibility.waitUntilElementIsVisible(this.activeFilter);
return BrowserActions.getText(this.activeFilter);
}

Expand All @@ -86,6 +88,11 @@ export class ProcessCloudDemoPage {
return this;
}

isProcessFiltersListVisible() {
BrowserVisibility.waitUntilElementIsVisible(this.processFiltersList);
return this;
}

clickOnCreateButton() {
BrowserActions.click(this.createButton);
return this;
Expand Down
14 changes: 8 additions & 6 deletions e2e/process-services-cloud/apps-section-cloud.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,30 @@
* limitations under the License.
*/

import { LoginSSOPage, SettingsPage } from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { LoginSSOPage } from '@alfresco/adf-testing';
import { AppListCloudPage } from '@alfresco/adf-testing';
import TestConfig = require('../test.config');
import { NavigationBarPage } from '../pages/adf/navigationBarPage';
import resources = require('../util/resources');

describe('Applications list', () => {

const settingsPage = new SettingsPage();
const loginSSOPage = new LoginSSOPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudPage = new AppListCloudPage();
const simpleApp = resources.ACTIVITI7_APPS.SIMPLE_APP.name;

beforeAll(async (done) => {
browser.get('/');
loginSSOPage.loginSSOIdentityService(browser.params.identityUser.email, browser.params.identityUser.password);
done();
});

it('[C289910] Should the app be displayed on dashboard when is deployed on APS', () => {
settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, TestConfig.adf.hostIdentity);
loginSSOPage.loginSSOIdentityService(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
navigationBarPage.navigateToProcessServicesCloudPage();
appListCloudPage.checkApsContainer();
appListCloudPage.checkAppIsDisplayed(simpleApp);
appListCloudPage.goToApp(simpleApp);

});

});
23 changes: 6 additions & 17 deletions e2e/process-services-cloud/edit-process-filters-component.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
* limitations under the License.
*/

import TestConfig = require('../test.config');

import { ApiService, IdentityService, LoginSSOPage, SettingsPage } from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { LoginSSOPage } from '@alfresco/adf-testing';
import { NavigationBarPage } from '../pages/adf/navigationBarPage';
import { TasksCloudDemoPage } from '../pages/adf/demo-shell/process-services/tasksCloudDemoPage';
import { ProcessCloudDemoPage } from '../pages/adf/demo-shell/process-services/processCloudDemoPage';
Expand All @@ -27,41 +26,31 @@ import resources = require('../util/resources');
describe('Edit process filters cloud', () => {

describe('Edit process Filters', () => {
const settingsPage = new SettingsPage();
const loginSSOPage = new LoginSSOPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const processCloudDemoPage = new ProcessCloudDemoPage();
let identityService: IdentityService;

const simpleApp = resources.ACTIVITI7_APPS.SIMPLE_APP.name;

beforeAll(async (done) => {
const apiService = new ApiService('activiti', TestConfig.adf.hostBPM, TestConfig.adf.hostSso, 'BPM');
await apiService.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
identityService = new IdentityService(apiService);
const apsUser = await identityService.createActivitiUserWithRole(apiService);

settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, TestConfig.adf.hostIdentity, false);
loginSSOPage.clickOnSSOButton();
loginSSOPage.loginSSOIdentityService(apsUser.username, apsUser.password);
browser.get('/');
loginSSOPage.loginSSOIdentityService(browser.params.identityUser.email, browser.params.identityUser.password);
done();
});

beforeEach((done) => {
beforeEach(() => {
navigationBarPage.navigateToProcessServicesCloudPage();
appListCloudComponent.checkApsContainer();
appListCloudComponent.goToApp(simpleApp);
tasksCloudDemoPage.taskListCloudComponent().checkTaskListIsLoaded();
processCloudDemoPage.clickOnProcessFilters();
processCloudDemoPage.editProcessFilterCloudComponent().clickCustomiseFilterHeader().checkCustomiseFilterHeaderIsExpanded();
done();
});

afterEach((done) => {
afterEach(() => {
processCloudDemoPage.allProcessesFilter().clickProcessFilter();
done();
});

it('[C291804] Delete Save and Save as actions should be displayed when clicking on custom filter header', () => {
Expand Down
23 changes: 9 additions & 14 deletions e2e/process-services-cloud/edit-task-filters-component.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
* limitations under the License.
*/

import TestConfig = require('../test.config');

import { AppListCloudPage, StringUtil, ApiService, LoginSSOPage, TasksService, SettingsPage } from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { AppListCloudPage, StringUtil, ApiService, LoginSSOPage, TasksService } from '@alfresco/adf-testing';
import { NavigationBarPage } from '../pages/adf/navigationBarPage';
import { TasksCloudDemoPage } from '../pages/adf/demo-shell/process-services/tasksCloudDemoPage';

Expand All @@ -26,7 +25,6 @@ import resources = require('../util/resources');
describe('Edit task filters cloud', () => {

describe('Edit Task Filters', () => {
const settingsPage = new SettingsPage();
const loginSSOPage = new LoginSSOPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
Expand All @@ -35,28 +33,25 @@ describe('Edit task filters cloud', () => {

const simpleApp = resources.ACTIVITI7_APPS.SIMPLE_APP.name;
const completedTaskName = StringUtil.generateRandomString(), assignedTaskName = StringUtil.generateRandomString();
let assignedTask;

beforeAll(async (done) => {
settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, TestConfig.adf.hostIdentity, false);
loginSSOPage.clickOnSSOButton();
loginSSOPage.loginSSOIdentityService(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);

const apiService = new ApiService('activiti', TestConfig.adf.hostBPM, TestConfig.adf.hostSso, 'BPM');
await apiService.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
const 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);

tasksService = new TasksService(apiService);
assignedTask = await tasksService.createStandaloneTask(assignedTaskName, simpleApp);
const assignedTask = await tasksService.createStandaloneTask(assignedTaskName, simpleApp);
await tasksService.claimTask(assignedTask.entry.id, simpleApp);
await tasksService.createAndCompleteTask(completedTaskName, simpleApp);

browser.get('/');
loginSSOPage.loginSSOIdentityService(browser.params.identityUser.email, browser.params.identityUser.password);
done();
});

beforeEach((done) => {
beforeEach(() => {
navigationBarPage.navigateToProcessServicesCloudPage();
appListCloudComponent.checkApsContainer();
appListCloudComponent.goToApp(simpleApp);
done();
});

afterEach((done) => {
Expand Down
24 changes: 12 additions & 12 deletions e2e/process-services-cloud/people-group-cloud-component.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
* limitations under the License.
*/

import TestConfig = require('../test.config');

import { SettingsPage } from '@alfresco/adf-testing';
import { NavigationBarPage } from '../pages/adf/navigationBarPage';
import { PeopleGroupCloudComponentPage } from '../pages/adf/demo-shell/process-services/peopleGroupCloudComponentPage';
import { GroupCloudComponentPage, PeopleCloudComponentPage } from '@alfresco/adf-testing';
Expand All @@ -26,10 +23,9 @@ import { LoginSSOPage, IdentityService, GroupIdentityService, RolesService, ApiS
import CONSTANTS = require('../util/constants');
import resources = require('../util/resources');

describe('People Groups Cloud Component', () => {
xdescribe('People Groups Cloud Component', () => {

describe('People Groups Cloud Component', () => {
const settingsPage = new SettingsPage();
const loginSSOPage = new LoginSSOPage();
const navigationBarPage = new NavigationBarPage();
const peopleGroupCloudComponentPage = new PeopleGroupCloudComponentPage();
Expand All @@ -55,9 +51,12 @@ describe('People Groups Cloud Component', () => {
let clientId;

beforeAll(async (done) => {
const apiService = new ApiService(
browser.params.config.oauth2.clientId,
browser.params.config.bpmHost, browser.params.config.oauth2.host, browser.params.config.providers
);
await apiService.login(browser.params.identityAdmin.email, browser.params.identityAdmin.password);

const apiService = new ApiService('activiti', TestConfig.adf.hostBPM, TestConfig.adf.hostSso, 'BPM');
await apiService.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
identityService = new IdentityService(apiService);
rolesService = new RolesService(apiService);
groupIdentityService = new GroupIdentityService(apiService);
Expand Down Expand Up @@ -87,23 +86,24 @@ describe('People Groups Cloud Component', () => {
await groupIdentityService.addClientRole(groupActiviti.id, clientId, clientActivitiAdminRoleId, CONSTANTS.ROLES.ACTIVITI_ADMIN);
users = [`${apsUser.idIdentityService}`, `${activitiUser.idIdentityService}`, `${noRoleUser.idIdentityService}`];
groups = [`${groupAps.id}`, `${groupActiviti.id}`, `${groupNoRole.id}`];
settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, TestConfig.adf.hostIdentity, false);
loginSSOPage.clickOnSSOButton();
loginSSOPage.loginSSOIdentityService(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
navigationBarPage.navigateToPeopleGroupCloudPage();

browser.get('/');
loginSSOPage.loginSSOIdentityService(browser.params.identityUser.email, browser.params.identityUser.password);
done();
});

afterAll(async () => {
afterAll(async (done) => {
for (let i = 0; i < users.length; i++) {
await identityService.deleteIdentityUser(users[i]);
}
for (let i = 0; i < groups.length; i++) {
await groupIdentityService.deleteIdentityGroup(groups[i]);
}
done();
});

beforeEach(() => {
navigationBarPage.navigateToPeopleGroupCloudPage();
peopleGroupCloudComponentPage.checkGroupsCloudComponentTitleIsDisplayed();
peopleGroupCloudComponentPage.checkPeopleCloudComponentTitleIsDisplayed();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
* limitations under the License.
*/

import TestConfig = require('../test.config');

import { SettingsPage } from '@alfresco/adf-testing';
import { NavigationBarPage } from '../pages/adf/navigationBarPage';
import { PeopleGroupCloudComponentPage } from '../pages/adf/demo-shell/process-services/peopleGroupCloudComponentPage';
import { GroupCloudComponentPage, PeopleCloudComponentPage } from '@alfresco/adf-testing';
Expand All @@ -26,10 +23,9 @@ import { LoginSSOPage, IdentityService, GroupIdentityService, RolesService, ApiS
import CONSTANTS = require('../util/constants');
import resources = require('../util/resources');

describe('People Groups Cloud Component', () => {
xdescribe('People Groups Cloud Component', () => {

describe('People Groups Cloud Component', () => {
const settingsPage = new SettingsPage();
const loginSSOPage = new LoginSSOPage();
const navigationBarPage = new NavigationBarPage();
const peopleGroupCloudComponentPage = new PeopleGroupCloudComponentPage();
Expand All @@ -55,9 +51,12 @@ describe('People Groups Cloud Component', () => {
let clientId;

beforeAll(async (done) => {
const apiService = new ApiService(
browser.params.config.oauth2.clientId,
browser.params.config.bpmHost, browser.params.config.oauth2.host, browser.params.config.providers
);
await apiService.login(browser.params.identityAdmin.email, browser.params.identityAdmin.password);

const apiService = new ApiService('activiti', TestConfig.adf.hostBPM, TestConfig.adf.hostSso, 'BPM');
await apiService.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
identityService = new IdentityService(apiService);
rolesService = new RolesService(apiService);
groupIdentityService = new GroupIdentityService(apiService);
Expand Down Expand Up @@ -87,10 +86,9 @@ describe('People Groups Cloud Component', () => {
await groupIdentityService.addClientRole(groupActiviti.id, clientId, clientActivitiAdminRoleId, CONSTANTS.ROLES.ACTIVITI_ADMIN );
users = [`${apsUser.idIdentityService}`, `${activitiUser.idIdentityService}`, `${noRoleUser.idIdentityService}`];
groups = [`${groupAps.id}`, `${groupActiviti.id}`, `${groupNoRole.id}`];
settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, TestConfig.adf.hostIdentity, false);
loginSSOPage.clickOnSSOButton();
loginSSOPage.loginSSOIdentityService(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
navigationBarPage.navigateToPeopleGroupCloudPage();

browser.get('/');
loginSSOPage.loginSSOIdentityService(browser.params.identityUser.email, browser.params.identityUser.password);
done();
});

Expand All @@ -104,6 +102,7 @@ describe('People Groups Cloud Component', () => {
});

beforeEach(() => {
navigationBarPage.navigateToPeopleGroupCloudPage();
peopleGroupCloudComponentPage.checkGroupsCloudComponentTitleIsDisplayed();
peopleGroupCloudComponentPage.checkPeopleCloudComponentTitleIsDisplayed();
});
Expand Down
Loading

0 comments on commit abb76d9

Please sign in to comment.