mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
Update protractor.conf.js (#1606)
* Update protractor.conf.js * add option to retry for wanted executions * cahnges
This commit is contained in:
@@ -1,21 +0,0 @@
|
|||||||
const uploadOutput = require('../utils/upload-output');
|
|
||||||
|
|
||||||
const SAVE_SCREENSHOT = process.env.SAVE_SCREENSHOT === 'true';
|
|
||||||
|
|
||||||
async function afterLaunch() {
|
|
||||||
|
|
||||||
if (SAVE_SCREENSHOT) {
|
|
||||||
console.log(`Save screenshot is ${SAVE_SCREENSHOT}, trying to save screenshots.`);
|
|
||||||
|
|
||||||
try {
|
|
||||||
await uploadOutput();
|
|
||||||
console.log('Screenshots saved successfully.');
|
|
||||||
} catch (e) {
|
|
||||||
console.log('Error happened while trying to upload screenshots and test reports: ', e);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.log(`Save screenshot is ${SAVE_SCREENSHOT}, no need to save screenshots.`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = afterLaunch;
|
|
80
package-lock.json
generated
80
package-lock.json
generated
@@ -3384,6 +3384,12 @@
|
|||||||
"integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=",
|
"integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"assertion-error": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"assign-symbols": {
|
"assign-symbols": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz",
|
||||||
@@ -4400,6 +4406,23 @@
|
|||||||
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=",
|
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"chai": {
|
||||||
|
"version": "3.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/chai/-/chai-3.5.0.tgz",
|
||||||
|
"integrity": "sha1-TQJjewZ/6Vi9v906QOxW/vc3Mkc=",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"assertion-error": "^1.0.1",
|
||||||
|
"deep-eql": "^0.1.3",
|
||||||
|
"type-detect": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"chai-as-promised": {
|
||||||
|
"version": "5.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/chai-as-promised/-/chai-as-promised-5.3.0.tgz",
|
||||||
|
"integrity": "sha1-CdekApCKpw39vq1T5YU/x50+8hw=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"chalk": {
|
"chalk": {
|
||||||
"version": "4.1.0",
|
"version": "4.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz",
|
||||||
@@ -6275,6 +6298,23 @@
|
|||||||
"integrity": "sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw=",
|
"integrity": "sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"deep-eql": {
|
||||||
|
"version": "0.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-0.1.3.tgz",
|
||||||
|
"integrity": "sha1-71WKyrjeJSBs1xOQbXTlaTDrafI=",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"type-detect": "0.1.1"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"type-detect": {
|
||||||
|
"version": "0.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-0.1.1.tgz",
|
||||||
|
"integrity": "sha1-C6XsKohWQORw6k6FBZcZANrFiCI=",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"deep-equal": {
|
"deep-equal": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.1.1.tgz",
|
||||||
@@ -13752,6 +13792,40 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"protractor-retry": {
|
||||||
|
"version": "1.2.12",
|
||||||
|
"resolved": "https://registry.npmjs.org/protractor-retry/-/protractor-retry-1.2.12.tgz",
|
||||||
|
"integrity": "sha512-ys9ZKduWy2xPPnFjRNqPKnczqlO7IUueQKYFVCAxG6gfTg1YcSzuS9TVobdp2R2mN5sjamHN6WuhlE6fpvkbhw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"array-unique": "~0.3.2",
|
||||||
|
"chai": "3.x",
|
||||||
|
"chai-as-promised": "5.x",
|
||||||
|
"debug": "^2.1.1",
|
||||||
|
"lodash": "^4.17.12",
|
||||||
|
"mkdirp": "^0.5.1",
|
||||||
|
"q": "^1.4.1",
|
||||||
|
"xml2js": "~0.4.17",
|
||||||
|
"yargs": "^15.1.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"debug": {
|
||||||
|
"version": "2.6.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||||
|
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"ms": "2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ms": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||||
|
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"protractor-smartrunner": {
|
"protractor-smartrunner": {
|
||||||
"version": "0.1.1",
|
"version": "0.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/protractor-smartrunner/-/protractor-smartrunner-0.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/protractor-smartrunner/-/protractor-smartrunner-0.1.1.tgz",
|
||||||
@@ -17108,6 +17182,12 @@
|
|||||||
"resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz",
|
||||||
"integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg=="
|
"integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg=="
|
||||||
},
|
},
|
||||||
|
"type-detect": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-diIXzAbbJY7EiQihKY6LlRIejqI=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"type-fest": {
|
"type-fest": {
|
||||||
"version": "0.11.0",
|
"version": "0.11.0",
|
||||||
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz",
|
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz",
|
||||||
|
@@ -107,6 +107,7 @@
|
|||||||
"node-stream-zip": "^1.9.1",
|
"node-stream-zip": "^1.9.1",
|
||||||
"prettier": "^2.0.5",
|
"prettier": "^2.0.5",
|
||||||
"protractor": "^7.0.0",
|
"protractor": "^7.0.0",
|
||||||
|
"protractor-retry": "^1.2.9",
|
||||||
"protractor-smartrunner": "^0.1.1",
|
"protractor-smartrunner": "^0.1.1",
|
||||||
"rxjs-tslint": "^0.1.8",
|
"rxjs-tslint": "^0.1.8",
|
||||||
"rxjs-tslint-rules": "^4.34.0",
|
"rxjs-tslint-rules": "^4.34.0",
|
||||||
|
@@ -2,13 +2,14 @@
|
|||||||
// https://github.com/angular/protractor/blob/master/lib/config.ts
|
// https://github.com/angular/protractor/blob/master/lib/config.ts
|
||||||
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const { SpecReporter } = require('jasmine-spec-reporter');
|
const {SpecReporter} = require('jasmine-spec-reporter');
|
||||||
const afterLaunch = require('./e2e/e2e-config/hooks/after-launch');
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const resolve = require('path').resolve;
|
const resolve = require('path').resolve;
|
||||||
const logger = require('./tools/helpers/logger');
|
const logger = require('./tools/helpers/logger');
|
||||||
|
const retry = require('protractor-retry').retry;
|
||||||
|
const uploadOutput = require('./e2e/e2e-config/utils/upload-output');
|
||||||
|
|
||||||
require('dotenv').config({ path: process.env.ENV_FILE });
|
require('dotenv').config({path: process.env.ENV_FILE});
|
||||||
|
|
||||||
const SmartRunner = require('protractor-smartrunner');
|
const SmartRunner = require('protractor-smartrunner');
|
||||||
const projectRoot = path.resolve(__dirname);
|
const projectRoot = path.resolve(__dirname);
|
||||||
@@ -19,7 +20,10 @@ const BROWSER_RUN = process.env.BROWSER_RUN;
|
|||||||
const width = 1366;
|
const width = 1366;
|
||||||
const height = 768;
|
const height = 768;
|
||||||
|
|
||||||
|
const SAVE_SCREENSHOT = process.env.SAVE_SCREENSHOT === 'true';
|
||||||
const API_CONTENT_HOST = process.env.API_CONTENT_HOST || 'http://localhost:8080';
|
const API_CONTENT_HOST = process.env.API_CONTENT_HOST || 'http://localhost:8080';
|
||||||
|
const MAXINSTANCES = process.env.MAXINSTANCES || 1;
|
||||||
|
const MAX_RETRIES = process.env.MAX_RETRIES || 1;
|
||||||
|
|
||||||
function rmDir(dirPath) {
|
function rmDir(dirPath) {
|
||||||
try {
|
try {
|
||||||
@@ -108,23 +112,39 @@ exports.config = {
|
|||||||
SELENIUM_PROMISE_MANAGER: false,
|
SELENIUM_PROMISE_MANAGER: false,
|
||||||
|
|
||||||
capabilities: {
|
capabilities: {
|
||||||
|
|
||||||
|
loggingPrefs: {
|
||||||
|
browser: 'ALL' // "OFF", "SEVERE", "WARNING", "INFO", "CONFIG", "FINE", "FINER", "FINEST", "ALL".
|
||||||
|
},
|
||||||
|
|
||||||
browserName: 'chrome',
|
browserName: 'chrome',
|
||||||
|
|
||||||
|
maxInstances: MAXINSTANCES,
|
||||||
|
|
||||||
|
shardTestFiles: true,
|
||||||
|
|
||||||
chromeOptions: {
|
chromeOptions: {
|
||||||
prefs: {
|
prefs: {
|
||||||
credentials_enable_service: false,
|
'credentials_enable_service': false,
|
||||||
download: {
|
'download': {
|
||||||
prompt_for_download: false,
|
'prompt_for_download': false,
|
||||||
default_directory: downloadFolder
|
'directory_upgrade': true,
|
||||||
|
'default_directory': downloadFolder
|
||||||
|
},
|
||||||
|
'browser': {
|
||||||
|
'setDownloadBehavior': {
|
||||||
|
'behavior': 'allow',
|
||||||
|
'downloadPath': downloadFolder
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
args: [
|
args: ['--incognito',
|
||||||
'--incognito',
|
`--window-size=${width},${height}`,
|
||||||
...(BROWSER_RUN === 'true' ? [] : ['--headless']),
|
|
||||||
'--disable-web-security',
|
|
||||||
'--remote-debugging-port=9222',
|
|
||||||
'--disable-gpu',
|
'--disable-gpu',
|
||||||
'--no-sandbox'
|
'--no-sandbox',
|
||||||
]
|
'--disable-web-security',
|
||||||
|
'--disable-browser-side-navigation',
|
||||||
|
...(BROWSER_RUN === true ? [] : ['--headless'])]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -138,8 +158,9 @@ exports.config = {
|
|||||||
jasmineNodeOpts: {
|
jasmineNodeOpts: {
|
||||||
showColors: true,
|
showColors: true,
|
||||||
defaultTimeoutInterval: 100000,
|
defaultTimeoutInterval: 100000,
|
||||||
print: function () {},
|
print: function () {
|
||||||
...SmartRunner.withOptionalExclusions(resolve(__dirname, './e2e/protractor.excludes.json'))
|
},
|
||||||
|
...(process.env.CI ? SmartRunner.withOptionalExclusions(resolve(__dirname, './e2e/protractor.excludes.json')) : {})
|
||||||
},
|
},
|
||||||
|
|
||||||
plugins: [
|
plugins: [
|
||||||
@@ -153,13 +174,20 @@ exports.config = {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
onCleanUp(results) {
|
||||||
|
if (process.env.CI) {
|
||||||
|
retry.onCleanUp(results);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
onPrepare() {
|
onPrepare() {
|
||||||
if (process.env.CI) {
|
if (process.env.CI) {
|
||||||
const repoHash = process.env.GIT_HASH || '';
|
const repoHash = process.env.GIT_HASH || '';
|
||||||
const outputDirectory = process.env.SMART_RUNNER_DIRECTORY;
|
const outputDirectory = process.env.SMART_RUNNER_DIRECTORY;
|
||||||
logger.info(`SmartRunner's repoHash: "${repoHash}"`);
|
logger.info(`SmartRunner's repoHash: "${repoHash}"`);
|
||||||
logger.info(`SmartRunner's outputDirectory: "${outputDirectory}"`);
|
logger.info(`SmartRunner's outputDirectory: "${outputDirectory}"`);
|
||||||
SmartRunner.apply({ outputDirectory, repoHash });
|
SmartRunner.apply({outputDirectory, repoHash});
|
||||||
|
retry.onPrepare();
|
||||||
}
|
}
|
||||||
|
|
||||||
const tsConfigPath = path.resolve(e2eFolder, 'tsconfig.e2e.json');
|
const tsConfigPath = path.resolve(e2eFolder, 'tsconfig.e2e.json');
|
||||||
@@ -196,5 +224,22 @@ exports.config = {
|
|||||||
downloadPath: downloadFolder
|
downloadPath: downloadFolder
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
afterLaunch
|
|
||||||
|
afterLaunch: async function () {
|
||||||
|
if (SAVE_SCREENSHOT) {
|
||||||
|
console.log(`Save screenshot is ${SAVE_SCREENSHOT}, trying to save screenshots.`);
|
||||||
|
|
||||||
|
try {
|
||||||
|
await uploadOutput();
|
||||||
|
console.log('Screenshots saved successfully.');
|
||||||
|
} catch (e) {
|
||||||
|
console.log('Error happened while trying to upload screenshots and test reports: ', e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log(`Save screenshot is ${SAVE_SCREENSHOT}, no need to save screenshots.`);
|
||||||
|
}
|
||||||
|
if (process.env.CI) {
|
||||||
|
return retry.afterLaunch(MAX_RETRIES);
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user