exclude failing test before the revert of the time modify is finalized (#5794)

* exclude test

* remove exclude and add more log power

* fix

* correct issue
This commit is contained in:
Eugenio Romano
2020-06-19 23:04:21 +01:00
committed by GitHub
parent b7815e6006
commit 2a5fa954bd
11 changed files with 179 additions and 142 deletions

View File

@@ -24,7 +24,7 @@ import {
StringUtil,
StartTasksCloudPage,
TaskFormCloudComponent,
StartProcessCloudPage
StartProcessCloudPage, ProcessCloudWidgetPage
} from '@alfresco/adf-testing';
import { browser, by } from 'protractor';
@@ -44,6 +44,7 @@ describe('Task cloud visibility', async () => {
const startProcessPage = new StartProcessCloudPage();
const processCloudDemoPage = new ProcessCloudDemoPage();
const loginSSOPage = new LoginSSOPage();
const widget = new ProcessCloudWidgetPage();
const apiService = new ApiService();
const identityService = new IdentityService(apiService);
@@ -146,13 +147,16 @@ describe('Task cloud visibility', async () => {
await tasksCloudDemoPage.taskListCloudComponent().selectRow('boolean_visibility_task');
await taskFormCloudComponent.clickClaimButton();
await browser.sleep(400);
await taskFormCloudComponent.formFields().checkWidgetIsVisible('Checkbox2');
await taskFormCloudComponent.formFields().checkWidgetIsHidden('Checkbox3');
await expect(await taskFormCloudComponent.formFields().isCompleteFormButtonEnabled()).toEqual(false);
await taskFormCloudComponent.formFields().clickField(by.id, 'Checkbox1');
await taskFormCloudComponent.formFields().clickField(by.id, 'Checkbox2');
await taskFormCloudComponent.formFields().checkWidgetIsVisible('Checkbox3');
await widget.checkboxWidget().clickCheckboxInput('Checkbox1');
await widget.checkboxWidget().clickCheckboxInput('Checkbox2');
await widget.checkboxWidget().isCheckboxDisplayed('Checkbox3');
await expect(await taskFormCloudComponent.formFields().isCompleteFormButtonEnabled()).toEqual(true);
await taskFormCloudComponent.clickCompleteButton();
@@ -172,9 +176,10 @@ describe('Task cloud visibility', async () => {
await taskFormCloudComponent.formFields().checkWidgetIsHidden('Checkbox3');
await expect(await taskFormCloudComponent.formFields().isCompleteFormButtonEnabled()).toEqual(false);
await taskFormCloudComponent.formFields().clickField(by.id, 'Checkbox1');
await taskFormCloudComponent.formFields().clickField(by.id, 'Checkbox2');
await taskFormCloudComponent.formFields().checkWidgetIsVisible('Checkbox3');
await widget.checkboxWidget().clickCheckboxInput('Checkbox1');
await widget.checkboxWidget().clickCheckboxInput('Checkbox2');
await widget.checkboxWidget().isCheckboxDisplayed('Checkbox3');
await expect(await taskFormCloudComponent.formFields().isCompleteFormButtonEnabled()).toEqual(true);
await taskFormCloudComponent.clickCompleteButton();

View File

@@ -139,7 +139,6 @@ describe('Edit task filters and task list properties', () => {
it('[C297476] Filter by taskName', async () => {
await tasksCloudDemoPage.editTaskFilterCloudComponent().setTaskName(createdTask.entry.name);
await expect(await tasksCloudDemoPage.editTaskFilterCloudComponent().getTaskName()).toEqual(createdTask.entry.name);
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(createdTask.entry.name);
await tasksCloudDemoPage.taskListCloudComponent().getRowsWithSameName(createdTask.entry.name).then(async (list) => {
await expect(list.length).toEqual(1);
});

View File

@@ -1,3 +1,4 @@
{
"C290180": "https://issues.alfresco.com/jira/browse/ACS-364"
}

View File

@@ -35,8 +35,10 @@ const SCREENSHOT_PASSWORD = process.env.SCREENSHOT_PASSWORD || process.env.PASSW
const SCREENSHOT_USERNAME = process.env.SCREENSHOT_USERNAME || process.env.USERNAME_ADF;
const EXTERNAL_ACS_HOST = process.env.EXTERNAL_ACS_HOST;
const LOG_LEVEL = process.env.LOG_LEVEL || 'ERROR' ;
const appConfig = {
"log": LOG_LEVEL,
"ecmHost": HOST_ECM,
"bpmHost": HOST_BPM,
"identityHost": `${OAUTH_HOST}/auth/admin/realms/alfresco`,

View File

@@ -78,6 +78,7 @@ export class ApiService {
}
async performBpmOperation(path: string, method: string, queryParams: any, postBody: any): Promise<any> {
return new Promise((resolve, reject) => {
const uri = this.config.hostBpm + path;
const pathParams = {}, formParams = {};
const contentTypes = ['application/json'];
@@ -87,14 +88,16 @@ export class ApiService {
Authorization: 'bearer ' + this.apiService.oauth2Auth.token
};
return this.apiService.processClient.callCustomApi(uri, method, pathParams, queryParams, headerParams, formParams, postBody,
this.apiService.processClient.callCustomApi(uri, method, pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts, Object)
.catch((error) => {
throw (error);
.then((data) => resolve(data))
.catch((err) => reject(err));
});
}
async performIdentityOperation(path: string, method: string, queryParams: any, postBody: any): Promise<any> {
return new Promise((resolve, reject) => {
const uri = this.config.oauth2.host.replace('/realms', '/admin/realms') + path;
const pathParams = {}, formParams = {};
const contentTypes = ['application/json'];
@@ -106,9 +109,8 @@ export class ApiService {
return this.apiService.processClient.callCustomApi(uri, method, pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts, Object)
.catch((error) => {
throw (error);
.then((data) => resolve(data))
.catch((err) => reject(err));
});
}
}

View File

@@ -41,11 +41,6 @@ export class FormFields {
await BrowserActions.clearSendKeys(fieldElement, value);
}
async clickField(locator, field: string, fieldText?: string): Promise<void> {
const fieldElement = fieldText ? element(locator(field, fieldText)) : element(locator(field));
await BrowserActions.click(fieldElement);
}
async checkWidgetIsVisible(fieldId: string): Promise<void> {
const fieldElement = element.all(by.css(`adf-form-field div[id='field-${fieldId}-container']`)).first();
await BrowserVisibility.waitUntilElementIsVisible(fieldElement);

View File

@@ -26,6 +26,7 @@ export class BrowserActions {
static async click(elementFinder: ElementFinder): Promise<void> {
try {
Logger.info(`Click element: ${elementFinder.locator().toString()}`);
await BrowserVisibility.waitUntilElementIsPresent(elementFinder);
await BrowserVisibility.waitUntilElementIsClickable(elementFinder);
await elementFinder.click();
@@ -40,26 +41,33 @@ export class BrowserActions {
await browser.executeScript(`arguments[0].click();`, elementFinder);
}
static async waitUntilActionMenuIsVisible(): Promise<void> {
const actionMenu = element.all(by.css('div[role="menu"]')).first();
await BrowserVisibility.waitUntilElementIsVisible(actionMenu);
}
static async waitUntilActionMenuIsNotVisible(): Promise<void> {
const actionMenu = element.all(by.css('div[role="menu"]')).first();
await BrowserVisibility.waitUntilElementIsNotVisible(actionMenu);
}
static async getUrl(url: string, timeout: number = 10000): Promise<any> {
return browser.get(url, timeout);
}
static async clickExecuteScript(elementCssSelector: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsPresent(element(by.css(elementCssSelector)));
await browser.executeScript(`document.querySelector('${elementCssSelector}').click();`);
}
static async waitUntilActionMenuIsVisible(): Promise<void> {
Logger.info(`wait Until Action Menu Is Visible`);
const actionMenu = element.all(by.css('div[role="menu"]')).first();
await BrowserVisibility.waitUntilElementIsVisible(actionMenu);
}
static async waitUntilActionMenuIsNotVisible(): Promise<void> {
Logger.info(`wait Until Action Menu Is Not Visible`);
const actionMenu = element.all(by.css('div[role="menu"]')).first();
await BrowserVisibility.waitUntilElementIsNotVisible(actionMenu);
}
static async getUrl(url: string, timeout: number = 10000): Promise<any> {
Logger.info(`Get URL ${url}`);
return browser.get(url, timeout);
}
static async getText(elementFinder: ElementFinder): Promise<string> {
Logger.info(`Get Text ${elementFinder.locator().toString()}`);
const present = await BrowserVisibility.waitUntilElementIsPresent(elementFinder);
if (present) {
return elementFinder.getText();
@@ -69,6 +77,8 @@ export class BrowserActions {
}
static async getInputValue(elementFinder: ElementFinder): Promise<string> {
Logger.info(`Get Input value ${elementFinder.locator().toString()}`);
const present = await BrowserVisibility.waitUntilElementIsPresent(elementFinder);
if (present) {
return elementFinder.getAttribute('value');
@@ -100,6 +110,8 @@ export class BrowserActions {
}
static async clearSendKeys(elementFinder: ElementFinder, text: string): Promise<void> {
Logger.info(`Clear and sendKeys text:${text} locator:${elementFinder.locator().toString()}`);
await this.click(elementFinder);
await elementFinder.sendKeys('');
await elementFinder.clear();
@@ -107,17 +119,23 @@ export class BrowserActions {
}
static async checkIsDisabled(elementFinder: ElementFinder): Promise<void> {
Logger.info(`Check is disabled locator:${elementFinder.locator().toString()}`);
await BrowserVisibility.waitUntilElementIsVisible(elementFinder);
const valueCheck = await elementFinder.getAttribute('disabled');
await expect(valueCheck).toEqual('true');
}
static async rightClick(elementFinder: ElementFinder): Promise<void> {
Logger.info(`Right click locator:${elementFinder.locator().toString()}`);
await browser.actions().mouseMove(elementFinder).mouseDown().mouseMove(elementFinder).perform();
await browser.actions().click(elementFinder, protractor.Button.RIGHT).perform();
}
static async closeMenuAndDialogs(): Promise<void> {
Logger.info(`close Menu And Dialogs`);
const container = element(by.css('div.cdk-overlay-backdrop.cdk-overlay-transparent-backdrop.cdk-overlay-backdrop-showing'));
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await BrowserVisibility.waitUntilElementIsNotVisible(container);

View File

@@ -16,6 +16,7 @@
*/
import { browser, by, element, ElementFinder, protractor } from 'protractor';
import { Logger } from './logger';
const DEFAULT_TIMEOUT = global['TestConfig'] ? global['TestConfig'].main.timeout : 20000;
const NOT_VISIBLE_DEFAULT_TIMEOUT = global['TestConfig'] ? global['TestConfig'].main.timeout : 2000;
@@ -23,12 +24,16 @@ const NOT_VISIBLE_DEFAULT_TIMEOUT = global['TestConfig'] ? global['TestConfig'].
export class BrowserVisibility {
static async waitUntilElementIsPresent(elementToCheck: ElementFinder, waitTimeout: number = DEFAULT_TIMEOUT): Promise<any> {
Logger.info(`Wait Until Element Is Present ${elementToCheck.locator().toString()} for ${waitTimeout}`);
return browser.wait(protractor.ExpectedConditions.presenceOf(elementToCheck), waitTimeout, 'Element is not present ' + elementToCheck.locator());
}
/*
* Wait for element to be visible
*/
static async waitUntilElementIsVisible(elementToCheck: ElementFinder, waitTimeout: number = DEFAULT_TIMEOUT, message: string = 'Element is not visible'): Promise<any> {
Logger.info(`Wait Until Element Is Visible ${elementToCheck.locator().toString()} for ${waitTimeout}`);
return browser.wait(protractor.ExpectedConditions.visibilityOf(elementToCheck), waitTimeout, message + elementToCheck.locator());
}
@@ -36,6 +41,8 @@ export class BrowserVisibility {
* Wait for element to be clickable
*/
static async waitUntilElementIsClickable(elementToCheck: ElementFinder, waitTimeout: number = DEFAULT_TIMEOUT): Promise<any> {
Logger.info(`Wait Until Element Is Clickable ${elementToCheck.locator().toString()} for ${waitTimeout}`);
return browser.wait(protractor.ExpectedConditions.elementToBeClickable(elementToCheck), waitTimeout, 'Element is not Clickable ' + elementToCheck.locator());
}
@@ -43,6 +50,8 @@ export class BrowserVisibility {
* Wait for element to not be present on the page
*/
static async waitUntilElementIsStale(elementToCheck: ElementFinder, waitTimeout: number = DEFAULT_TIMEOUT): Promise<any> {
Logger.info(`Wait Until Element Is Stale ${elementToCheck.locator().toString()} for ${waitTimeout}`);
return browser.wait(protractor.ExpectedConditions.stalenessOf(elementToCheck), waitTimeout, 'Element is not in stale ' + elementToCheck.locator());
}
@@ -50,6 +59,8 @@ export class BrowserVisibility {
* Wait for element to not be visible
*/
static async waitUntilElementIsNotVisible(elementToCheck: ElementFinder, waitTimeout: number = NOT_VISIBLE_DEFAULT_TIMEOUT): Promise<any> {
Logger.info(`Wait Until Element Is Not Visible ${elementToCheck.locator().toString()} for ${waitTimeout}`);
return browser.wait(protractor.ExpectedConditions.invisibilityOf(elementToCheck), waitTimeout, 'Element is Visible and it should not' + elementToCheck.locator());
}
@@ -57,10 +68,14 @@ export class BrowserVisibility {
* Wait for element to have value
*/
static async waitUntilElementHasValue(elementToCheck: ElementFinder, elementValue, waitTimeout: number = DEFAULT_TIMEOUT): Promise<any> {
Logger.info(`Wait Until Element has value ${elementToCheck.locator().toString()} for ${waitTimeout}`);
return browser.wait(protractor.ExpectedConditions.textToBePresentInElementValue(elementToCheck, elementValue), waitTimeout, 'Element doesn\'t have a value ' + elementToCheck.locator());
}
static async waitUntilElementIsNotPresent(elementToCheck: ElementFinder, waitTimeout: number = NOT_VISIBLE_DEFAULT_TIMEOUT): Promise<any> {
Logger.info(`Wait Until Element is not present ${elementToCheck.locator().toString()} for ${waitTimeout}`);
return browser.wait(protractor.ExpectedConditions.stalenessOf(elementToCheck), waitTimeout, 'Element is present ' + elementToCheck.locator());
}

View File

@@ -43,19 +43,19 @@ export let logLevels: any[] = [
/* tslint:disable:no-console */
export class Logger {
static info(...messages: string[]): void {
if (browser.params.testConfig && browser.params.testConfig.appConfig.log >= LogLevelsEnum.INFO) {
if (browser.params.testConfig && Logger.getLogLevelByName(browser.params.testConfig.appConfig.log) >= LogLevelsEnum.INFO) {
console.log(infoColor, messages.join(''));
}
}
static log(...messages: string[]): void {
if (browser.params.testConfig && browser.params.testConfig.appConfig.log >= LogLevelsEnum.TRACE) {
if (browser.params.testConfig && Logger.getLogLevelByName(browser.params.testConfig.appConfig.log) >= LogLevelsEnum.TRACE) {
console.log(logColor, messages.join(''));
}
}
static warn(...messages: string[]): void {
if (browser.params.testConfig && browser.params.testConfig.appConfig.log >= LogLevelsEnum.WARN) {
if (browser.params.testConfig && Logger.getLogLevelByName(browser.params.testConfig.appConfig.log) >= LogLevelsEnum.WARN) {
console.log(warnColor, messages.join(''));
}
}
@@ -63,4 +63,12 @@ export class Logger {
static error(...messages: string[]): void {
console.log(errorColor, messages.join(''));
}
private static getLogLevelByName(name: string): number {
const log = logLevels.find((currentLog) => {
return currentLog.name === name;
});
return log.level || 1;
}
}

View File

@@ -27,7 +27,6 @@ export class TasksService {
}
async createStandaloneTask(taskName: string, appName: string, options?: Object): Promise<any> {
try {
const path = '/' + appName + '/rb/v1/tasks';
const method = 'POST';
@@ -37,14 +36,13 @@ export class TasksService {
...options
};
return this.api.performBpmOperation(path, method, queryParams, postBody);
} catch (error) {
Logger.error('Create Task - Service error, Response: ', JSON.parse(JSON.stringify(error)));
}
return this.api.performBpmOperation(path, method, queryParams, postBody)
.catch((error) => {
Logger.error('Create Task - Service error, Response: ', JSON.stringify(error.response.text));
});
}
async createStandaloneTaskWithForm(taskName: string, appName: string, formKey: string, options?: Object): Promise<any> {
try {
const path = '/' + appName + '/rb/v1/tasks';
const method = 'POST';
@@ -56,51 +54,48 @@ export class TasksService {
...options
};
return this.api.performBpmOperation(path, method, queryParams, postBody);
} catch (error) {
Logger.error('Create FormTask - Service error, Response: ', JSON.parse(JSON.stringify(error)));
}
return this.api.performBpmOperation(path, method, queryParams, postBody)
.catch((error) => {
Logger.error('Create standalone Task - Service error, Response: ', JSON.stringify(error.response.text));
});
}
async completeTask(taskId: string, appName: string): Promise<any> {
try {
const path = '/' + appName + '/rb/v1/tasks/' + taskId + '/complete';
const method = 'POST';
const queryParams = {}, postBody = { payloadType: 'CompleteTaskPayload' };
return this.api.performBpmOperation(path, method, queryParams, postBody);
} catch (error) {
Logger.error('Complete Task - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
}
return this.api.performBpmOperation(path, method, queryParams, postBody)
.catch((error) => {
Logger.error('Complete Task - Service error, Response: ', JSON.stringify(error.response.text));
});
}
async claimTask(taskId: string, appName: string): Promise<any> {
try {
const path = '/' + appName + '/rb/v1/tasks/' + taskId + `/claim`;
const method = 'POST';
const queryParams = {};
const postBody = {};
return this.api.performBpmOperation(path, method, queryParams, postBody);
} catch (error) {
Logger.error('Claim Task - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
}
return this.api.performBpmOperation(path, method, queryParams, postBody)
.catch((error) => {
Logger.error('claim Task - Service error, Response: ', JSON.stringify(error.response.text));
});
}
async deleteTask(taskId: string, appName: string): Promise<any> {
try {
const path = '/' + appName + '/rb/v1/tasks/' + taskId;
const method = 'DELETE';
const queryParams = {};
const postBody = {};
return this.api.performBpmOperation(path, method, queryParams, postBody);
} catch (error) {
Logger.error('Delete Task - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
}
return this.api.performBpmOperation(path, method, queryParams, postBody)
.catch((error) => {
Logger.error('delete Task - Service error, Response: ', JSON.stringify(error.response.text));
});
}
async createAndCompleteTask(taskName: string, appName: string): Promise<any> {
@@ -111,45 +106,42 @@ export class TasksService {
}
async getTask(taskId: string, appName: string): Promise<any> {
try {
const path = '/' + appName + '/query/v1/tasks/' + taskId;
const method = 'GET';
const queryParams = {};
const postBody = {};
return this.api.performBpmOperation(path, method, queryParams, postBody);
} catch (error) {
Logger.error('Get Task - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
}
return this.api.performBpmOperation(path, method, queryParams, postBody)
.catch((error) => {
Logger.error('Get Task - Service error, Response: ', JSON.stringify(error.response.text));
});
}
async getTaskId(taskName: string, appName: string): Promise<any> {
try {
const path = '/' + appName + '/query/v1/tasks';
const method = 'GET';
const queryParams = { name: taskName }, postBody = {};
const data = await this.api.performBpmOperation(path, method, queryParams, postBody);
const data = await this.api.performBpmOperation(path, method, queryParams, postBody)
.catch((error) => {
Logger.error('Get Task Id Service error, Response: ', JSON.stringify(error.response.text));
});
return data.list.entries && data.list.entries.length > 0 ? data.list.entries[0].entry.id : null;
} catch (error) {
Logger.error('Get Task Id - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
}
}
async createStandaloneSubtask(parentTaskId: string, appName: string, name: string): Promise<any> {
try {
const path = '/' + appName + '/rb/v1/tasks';
const method = 'POST';
const queryParams = {},
postBody = { name: name, parentTaskId: parentTaskId, payloadType: 'CreateTaskPayload' };
return this.api.performBpmOperation(path, method, queryParams, postBody);
} catch (error) {
Logger.error('Create Task - Service error, Response: ', JSON.parse(JSON.stringify(error)).response.text);
}
return this.api.performBpmOperation(path, method, queryParams, postBody)
.catch((error) => {
Logger.error('Create sub Task - Service error, Response: ', JSON.stringify(error.response.text));
});
}
}

View File

@@ -13,7 +13,7 @@ export AUTH_TYPE="OAUTH"
AFFECTED_LIBS="$(./scripts/affected-libs.sh -gnu -b $TRAVIS_BRANCH)";
AFFECTED_E2E="$(./scripts/git-util/affected-folder.sh -b $TRAVIS_BRANCH -f "e2e/$CONTEXT_ENV")";
RUN_E2E=$(echo ./scripts/test-e2e-lib.sh -host http://localhost:4200 -proxy "$E2E_HOST_BPM" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e "$E2E_EMAIL" -host_sso "$E2E_HOST_SSO" -identity_admin_email "$E2E_ADMIN_EMAIL_IDENTITY" -identity_admin_password "$E2E_ADMIN_PASSWORD_IDENTITY" -prefix $TRAVIS_BUILD_NUMBER --use-dist -m 2 -save )
RUN_E2E=$(echo ./scripts/test-e2e-lib.sh -host http://localhost:4200 -proxy "$E2E_HOST_BPM" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -e "$E2E_EMAIL" -host_sso "$E2E_HOST_SSO" -identity_admin_email "$E2E_ADMIN_EMAIL_IDENTITY" -identity_admin_password "$E2E_ADMIN_PASSWORD_IDENTITY" -prefix $TRAVIS_BUILD_NUMBER --use-dist -m 2 -save -b )
./node_modules/@alfresco/adf-cli/bin/adf-cli init-aae-env --host "$E2E_HOST_BPM" --oauth "$E2E_HOST_SSO" --modelerUsername "$E2E_MODELER_USERNAME" --modelerPassword "$E2E_MODELER_PASSWORD" --devopsUsername "$E2E_DEVOPS_USERNAME" --devopsPassword "$E2E_DEVOPS_PASSWORD" --clientId 'activiti' || exit 1
node ./scripts/check-env/check-cs-env.js --host "$E2E_HOST_BPM" -u "$E2E_ADMIN_EMAIL_IDENTITY" -p "$E2E_ADMIN_PASSWORD_IDENTITY" || exit 1