[ADF-3962] sso download directive automated (#4452)

* sso download directive automated

* temp changes

* temp changes

* moving of services under lib testing and ADF-3962 automated

* removed the browser sleep

* cspell and linting fixes.

* codacy improvements

* export public-api update

* remove circular dep

* remove circular dep

* fixes

* fix user info test

* fix datatable

* random commit

* move other string

* fix lint

* fix lint

* fix prolem type

* fix failing test

* fix tag test

* fix problems after rebase

* fix lint

* remove space

* remove visibility method duplicated
This commit is contained in:
gmandakini
2019-03-27 09:36:58 +00:00
committed by Eugenio Romano
parent 89f612bbb0
commit 4376d357ac
191 changed files with 2664 additions and 2299 deletions

View File

@@ -1,6 +1,6 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
* 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.

View File

@@ -1,5 +1,18 @@
/*
* Public API Surface of testing
/*!
* @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.
*/
export * from './example.action';

View File

@@ -1,6 +1,6 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
* 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.

View File

@@ -1,5 +1,18 @@
/*
* Public API Surface of testing
/*!
* @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.
*/
export * from './example.page';

View File

@@ -1,5 +1,18 @@
/*
* Public API Surface of testing
/*!
* @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.
*/
export * from './pages/public-api';

View File

@@ -0,0 +1,87 @@
/*!
* @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 { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
import { AlfrescoApiConfig } from '@alfresco/js-api/src/alfrescoApiConfig';
export class ApiService {
apiService: AlfrescoApi;
config: AlfrescoApiConfig;
constructor(clientId: string, host: string, hostSso: string, provider: string) {
this.config = {
provider: provider,
hostBpm: host,
hostEcm: host,
authType: 'OAUTH',
oauth2: {
host: hostSso,
clientId: clientId,
scope: 'openid',
secret: '',
implicitFlow: false,
silentLogin: false,
redirectUri: '/',
redirectUriLogout: '/logout'
}
};
this.apiService = new AlfrescoApi(this.config);
}
async login(username: string, password: string) {
await this.apiService.login(username, password);
}
async performBpmOperation(path: string, method: string, queryParams: any, postBody: any) {
const uri = this.config.hostBpm + path;
const pathParams = {}, formParams = {};
const contentTypes = ['application/json'];
const accepts = ['application/json'];
const headerParams = {
'Authorization': 'bearer ' + this.apiService.oauth2Auth.token
};
return this.apiService.processClient.callCustomApi(uri, method, pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts, Object)
.catch((error) => {
throw (error);
});
}
async performIdentityOperation(path: string, method: string, queryParams: any, postBody: any) {
const uri = this.config.oauth2.host.replace('/realms', '/admin/realms') + path;
const pathParams = {}, formParams = {};
const contentTypes = ['application/json'];
const accepts = ['application/json'];
const headerParams = {
'Authorization': 'bearer ' + this.apiService.oauth2Auth.token
};
return this.apiService.processClient.callCustomApi(uri, method, pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts, Object)
.catch((error) => {
throw (error);
});
}
}

View File

@@ -0,0 +1,77 @@
/*!
* @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 { ApiService } from '../api.service';
import { StringUtil } from '../../string.util';
export class GroupIdentityService {
api: ApiService;
constructor(api: ApiService) {
this.api = api;
}
async createIdentityGroup(groupName = StringUtil.generateRandomString(5)) {
await this.createGroup(groupName);
const group = await this.getGroupInfoByGroupName(groupName);
return group;
}
async deleteIdentityGroup(groupId) {
await this.deleteGroup(groupId);
}
async createGroup(groupName) {
const path = '/groups';
const method = 'POST';
const queryParams = {}, postBody = {
'name': groupName + 'TestGroup'
};
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
return data;
}
async deleteGroup(groupId) {
const path = `/groups/${groupId}`;
const method = 'DELETE';
const queryParams = {}, postBody = {
};
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
return data;
}
async getGroupInfoByGroupName(groupName) {
const path = `/groups`;
const method = 'GET';
const queryParams = { 'search' : groupName }, postBody = {};
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
return data[0];
}
async assignRole(groupId, roleId, roleName) {
const path = `/groups/${groupId}/role-mappings/realm`;
const method = 'POST';
const queryParams = {},
postBody = [{'id': roleId, 'name': roleName}];
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
return data;
}
}

View File

@@ -0,0 +1,113 @@
/*!
* @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 { ApiService } from '../api.service';
import { UserModel } from '../../models/user.model';
export class IdentityService {
api: ApiService;
constructor(api: ApiService) {
this.api = api;
}
async createIdentityUser(user: UserModel = new UserModel()) {
await this.createUser(user);
const userIdentity = await this.getUserInfoByUsername(user.email);
await this.resetPassword(userIdentity.id, user.password);
user.idIdentityService = userIdentity.id;
return user;
}
async createIdentityUserAndSyncECMBPM(user: UserModel) {
if (this.api.config.provider === 'ECM' || this.api.config.provider === 'ALL') {
await this.api.apiService.core.peopleApi.addPerson(user);
}
if (this.api.config.provider === 'BPM' || this.api.config.provider === 'ALL') {
await this.api.apiService.activiti.adminUsersApi.createNewUser({
email: user.email,
firstName: user.firstName,
lastName: user.lastName,
password: user.password,
type: 'enterprise',
tenantId: 1,
company: null
});
}
await this.createIdentityUser(user);
}
async deleteIdentityUser(userId) {
await this.deleteUser(userId);
}
async createUser(user: UserModel) {
const path = '/users';
const method = 'POST';
const queryParams = {}, postBody = {
'username': user.email,
'firstName': user.firstName,
'lastName': user.lastName,
'enabled': true,
'email': user.email
};
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
return data;
}
async deleteUser(userId) {
const path = `/users/${userId}`;
const method = 'DELETE';
const queryParams = {}, postBody = {};
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
return data;
}
async getUserInfoByUsername(username) {
const path = `/users`;
const method = 'GET';
const queryParams = { 'username': username }, postBody = {};
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
return data[0];
}
async resetPassword(id, password) {
const path = `/users/${id}/reset-password`;
const method = 'PUT';
const queryParams = {},
postBody = { 'type': 'password', 'value': password, 'temporary': false };
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
return data;
}
async assignRole(userId, roleId, roleName) {
const path = `/users/${userId}/role-mappings/realm`;
const method = 'POST';
const queryParams = {},
postBody = [{ 'id': roleId, 'name': roleName }];
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
return data;
}
}

View File

@@ -0,0 +1,22 @@
/*!
* @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.
*/
export * from './identity.service';
export * from './group-identity.service';
export * from './roles.service';
export * from './tasks.service';
export * from './query.service';

View File

@@ -0,0 +1,48 @@
/*!
* @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 { ApiService } from '../api.service';
export class QueryService {
api: ApiService;
constructor(api: ApiService) {
this.api = api;
}
async getProcessInstanceTasks(processInstanceId, appName) {
const path = '/' + appName + '-query/v1/process-instances/' + processInstanceId + '/tasks';
const method = 'GET';
const queryParams = {}, postBody = {};
const data = await this.api.performBpmOperation(path, method, queryParams, postBody);
return data;
}
async getProcessInstanceSubProcesses(processInstanceId, appName) {
const path = '/' + appName + '-query/v1/process-instances/' + processInstanceId + '/subprocesses';
const method = 'GET';
const queryParams = {};
const data = await this.api.performBpmOperation(path, method, queryParams, {});
return data;
}
}

View File

@@ -0,0 +1,43 @@
/*!
* @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 { ApiService } from '../api.service';
export class RolesService {
api: ApiService;
constructor(api: ApiService) {
this.api = api;
}
async getRoleIdByRoleName(roleName) {
const path = `/roles`;
const method = 'GET';
let roleId;
const queryParams = {}, postBody = {};
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
for (const key in data) {
if (data[key].name === roleName) {
roleId = data[key].id;
}
}
return roleId;
}
}

View File

@@ -0,0 +1,99 @@
/*!
* @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 { ApiService } from '../api.service';
export class TasksService {
api: ApiService;
constructor(api: ApiService) {
this.api = api;
}
async createStandaloneTask(taskName, appName, options?) {
const path = '/' + appName + '-rb/v1/tasks';
const method = 'POST';
const queryParams = {}, postBody = {
'name': taskName,
'payloadType': 'CreateTaskPayload',
...options
};
const data = await this.api.performBpmOperation(path, method, queryParams, postBody);
return data;
}
async completeTask(taskId, appName) {
const path = '/' + appName + '-rb/v1/tasks/' + taskId + '/complete';
const method = 'POST';
const queryParams = {}, postBody = {'payloadType': 'CompleteTaskPayload'};
const data = await this.api.performBpmOperation(path, method, queryParams, postBody);
return data;
}
async claimTask(taskId, appName) {
const path = '/' + appName + '-rb/v1/tasks/' + taskId + '/claim';
const method = 'POST';
const queryParams = {}, postBody = {};
const data = await this.api.performBpmOperation(path, method, queryParams, postBody);
return data;
}
async deleteTask(taskId, appName) {
const path = '/' + appName + '-rb/v1/tasks/' + taskId;
const method = 'DELETE';
const queryParams = {}, postBody = {};
const data = await this.api.performBpmOperation(path, method, queryParams, postBody);
return data;
}
async createAndCompleteTask (taskName, appName) {
const task = await this.createStandaloneTask(taskName, appName);
await this.claimTask(task.entry.id, appName);
await this.completeTask(task.entry.id, appName);
return task;
}
async getTask(taskId, appName) {
const path = '/' + appName + '-query/v1/tasks/' + taskId;
const method = 'GET';
const queryParams = {}, postBody = {};
const data = await this.api.performBpmOperation(path, method, queryParams, postBody);
return data;
}
async createStandaloneSubtask(parentTaskId, appName, name) {
const path = '/' + appName + '-rb/v1/tasks';
const method = 'POST';
const queryParams = {}, postBody = {'name': name, 'parentTaskId': parentTaskId, 'payloadType': 'CreateTaskPayload'};
const data = await this.api.performBpmOperation(path, method, queryParams, postBody);
return data;
}
}

View File

@@ -1,3 +1,19 @@
/*
* Public API Surface of testing
/*!
* @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.
*/
export * from './identity/public-api';
export * from './api.service';

View File

@@ -1,6 +1,6 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
* 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.
@@ -17,7 +17,6 @@
import { browser, protractor } from 'protractor';
const until = protractor.ExpectedConditions;
const DEFAULT_TIMEOUT = 40000;
export class BrowserVisibility {
@@ -64,6 +63,25 @@ export class BrowserVisibility {
}, waitTimeout, 'Element is not visible ' + elementToCheck.locator());
}
/*
* Wait for element to not be visible
*/
static waitUntilElementIsStale(elementToCheck, waitTimeout: number = DEFAULT_TIMEOUT) {
return browser.wait(until.stalenessOf(elementToCheck), waitTimeout, 'Element is not in stale ' + elementToCheck.locator());
}
/*
* Wait for element to not be visible
*/
static waitUntilElementIsNotVisible(elementToCheck, waitTimeout: number = DEFAULT_TIMEOUT) {
return browser.wait(() => {
browser.waitForAngularEnabled();
return elementToCheck.isPresent().then(function (present) {
return !present;
});
}, waitTimeout, 'Element is Visible and it should not' + elementToCheck.locator());
}
/*
* Wait for element to have value
*/
@@ -73,6 +91,10 @@ export class BrowserVisibility {
browser.wait(until.textToBePresentInElementValue(elementToCheck, elementValue), waitTimeout, 'Element doesn\'t have a value ' + elementToCheck.locator());
}
static waitUntilElementIsOnPage(elementToCheck, waitTimeout: number = DEFAULT_TIMEOUT) {
return browser.wait(browser.wait(until.visibilityOf(elementToCheck)), waitTimeout);
}
/*
* Wait for element to not be visible
*/
@@ -80,4 +102,10 @@ export class BrowserVisibility {
return browser.wait(until.not(until.visibilityOf(elementToCheck)), waitTimeout, 'Element is not in the page ' + elementToCheck.locator());
}
static waitUntilElementIsPresent(elementToCheck, waitTimeout: number = DEFAULT_TIMEOUT) {
browser.waitForAngularEnabled();
return browser.wait(until.presenceOf(elementToCheck), waitTimeout, 'Element is not present ' + elementToCheck.locator());
}
}

View File

@@ -0,0 +1,18 @@
/*!
* @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.
*/
export * from './user.model';

View File

@@ -0,0 +1,36 @@
/*!
* @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 { StringUtil } from '../string.util';
export class UserModel {
firstName: string = StringUtil.generateRandomString();
lastName: string = StringUtil.generateRandomString();
password: string = StringUtil.generateRandomString();
email: string = StringUtil.generateRandomEmail('@alfresco.com');
idIdentityService: string;
constructor(details?: any) {
Object.assign(this, details);
}
get id() {
return this.email;
}
}

View File

@@ -1,6 +1,6 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
* 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.

View File

@@ -1,5 +1,18 @@
/*
* Public API Surface of testing
/*!
* @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.
*/
export * from './header.page';

View File

@@ -1,7 +1,23 @@
/*
* Public API Surface of testing
/*!
* @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.
*/
export * from './browser-visibility';
export * from './actions/public-api';
export * from './pages/public-api';
export * from './material/public-api';
export * from './models/public-api';
export * from './string.util';

View File

@@ -0,0 +1,106 @@
/*!
* @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.
*/
export class StringUtil {
static generatePasswordString(length: number = 8): string {
let text = '';
const possibleUpperCase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
const possibleLowerCase = 'abcdefghijklmnopqrstuvwxyz';
const lowerCaseLimit = Math.floor(length / 2);
for (let i = 0; i < lowerCaseLimit; i++) {
text += possibleLowerCase.charAt(Math.floor(Math.random() * possibleLowerCase.length));
}
for (let i = 0; i < length - lowerCaseLimit; i++) {
text += possibleUpperCase.charAt(Math.floor(Math.random() * possibleUpperCase.length));
}
return text;
}
/**
* Generates a random string.
*
* @param length If this parameter is not provided the length is set to 8 by default.
* @method generateRandomString
*/
static generateRandomString(length: number = 8): string {
let text = '';
const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
for (let i = 0; i < length; i++) {
text += possible.charAt(Math.floor(Math.random() * possible.length));
}
return text;
}
/**
* Generates a random email address following the format: abcdef@activiti.test.com
*
* @param domain
* @param length
* @method generateRandomEmail
*/
static generateRandomEmail(domain: string, length: number = 5): string {
let email = '';
const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
for (let i = 0; i < length; i++) {
email += possible.charAt(Math.floor(Math.random() * possible.length));
}
email += domain;
return email.toLowerCase();
}
/**
* Generates a random string - digits only.
*
* @param length {int} If this parameter is not provided the length is set to 8 by default.
* @method generateRandomString
*/
static generateRandomStringDigits(length: number = 8): string {
let text = '';
const possible = '0123456789';
for (let i = 0; i < length; i++) {
text += possible.charAt(Math.floor(Math.random() * possible.length));
}
return text;
}
/**
* Generates a random string - non-latin characters only.
*
* @param length {int} If this parameter is not provided the length is set to 3 by default.
* @method generateRandomString
*/
static generateRandomStringNonLatin(length: number = 3): string {
let text = '';
const possible = '密码你好𠮷';
for (let i = 0; i < length; i++) {
text += possible.charAt(Math.floor(Math.random() * possible.length));
}
return text;
}
}

View File

@@ -0,0 +1,18 @@
/*!
* @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.
*/
export * from './tabs.page';

View File

@@ -0,0 +1,37 @@
/*!
* @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 { ApiService } from '../../core/actions/api.service';
export class ProcessDefinitionsService {
api: ApiService;
constructor(api: ApiService) {
this.api = api;
}
async getProcessDefinitions(appName) {
const path = '/' + appName + '-rb/v1/process-definitions';
const method = 'GET';
const queryParams = {};
const data = await this.api.performBpmOperation(path, method, queryParams, {});
return data;
}
}

View File

@@ -0,0 +1,67 @@
/*!
* @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 { ApiService } from '../../core/actions/api.service';
export class ProcessInstancesService {
api: ApiService;
constructor(api: ApiService) {
this.api = api;
}
async createProcessInstance(processDefKey, appName, options?: any) {
const path = '/' + appName + '-rb/v1/process-instances';
const method = 'POST';
const queryParams = {}, postBody = {
'processDefinitionKey': processDefKey,
'payloadType': 'StartProcessPayload',
...options
};
return await this.api.performBpmOperation(path, method, queryParams, postBody);
}
async suspendProcessInstance(processInstanceId, appName) {
const path = '/' + appName + '-rb/v1/process-instances/' + processInstanceId + '/suspend';
const method = 'POST';
const queryParams = {}, postBody = {};
return await this.api.performBpmOperation(path, method, queryParams, postBody);
}
async deleteProcessInstance(processInstanceId, appName) {
const path = '/' + appName + '-rb/v1/process-instances/' + processInstanceId;
const method = 'DELETE';
const queryParams = {}, postBody = {};
return await this.api.performBpmOperation(path, method, queryParams, postBody);
}
async completeProcessInstance(processInstanceId, appName) {
const path = '/' + appName + '-rb/v1/process-instances/' + processInstanceId + '/complete';
const method = 'POST';
const queryParams = {}, postBody = {};
return await this.api.performBpmOperation(path, method, queryParams, postBody);
}
}

View File

@@ -1,6 +1,21 @@
/*
* Public API Surface of testing
/*!
* @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.
*/
export * from './testing-alfresco-api.service';
export * from './testing-app-config.service';
export * from './process-definitions.service';
export * from './process-instances.service';

View File

@@ -1,5 +1,18 @@
/*
* Public API Surface of testing
/*!
* @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.
*/
export * from '../app/app-list-cloud.page';
export * from './app-list-cloud.page';

View File

@@ -17,6 +17,7 @@
import { element, by, browser, protractor } from 'protractor';
import { BrowserVisibility } from '../../core/browser-visibility';
export class LoginSSOPage {
ssoButton = element(by.css(`[data-automation-id="login-button-sso"]`));

View File

@@ -1,5 +1,18 @@
/*
* Public API Surface of testing
/*!
* @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.
*/
export * from './login-sso.page';

View File

@@ -1,5 +1,18 @@
/*
* Public API Surface of testing
/*!
* @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.
*/
export * from './pages/public-api';

View File

@@ -1,6 +1,6 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
* 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.

View File

@@ -1,5 +1,18 @@
/*
* Public API Surface of testing
/*!
* @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.
*/
export * from './form-fields.page';

View File

@@ -1,5 +1,18 @@
/*
* Public API Surface of testing
/*!
* @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.
*/
export * from './pages/public-api';

View File

@@ -1,3 +1,20 @@
/*!
* @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 { NgModule } from '@angular/core';
@NgModule({

View File

@@ -1,3 +1,20 @@
/*!
* @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 { TestBed } from '@angular/core/testing';
import { TestingService } from './testing.service';

View File

@@ -1,3 +1,20 @@
/*!
* @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 { Injectable } from '@angular/core';
@Injectable({

View File

@@ -1,5 +1,18 @@
/*
* Public API Surface of testing
/*!
* @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.
*/
export * from './lib/core/public-api';
@@ -8,3 +21,4 @@ export * from './lib/content-services/public-api';
export * from './lib/process-services/public-api';
export * from './lib/process-services-cloud/public-api';
export * from './lib/testing.module';
export * from './lib/testing.service';

View File

@@ -1,4 +1,19 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
/*!
* @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 'core-js/es7/reflect';
import 'zone.js/dist/zone';