Fix smart runner (#1570)

* [ACA-3799] add prefix filter

* add smart runner

* fix resolve

* add some configuration for smartrunner

* simplify

* fix

* we need to pass invertGrep in the devServerTarget because Angular overwrite it if you use the dev server
This commit is contained in:
Eugenio Romano 2020-08-01 00:26:22 +01:00 committed by GitHub
parent d26bbc9bff
commit aee3afdeb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 14 deletions

1
.gitignore vendored
View File

@ -46,3 +46,4 @@ testem.log
# System Files
.DS_Store
Thumbs.db
!/.protractor-smartrunner/

View File

@ -12,6 +12,7 @@ node_js:
cache:
directories:
- node_modules
- .protractor-smartrunner
branches:
only:

View File

@ -266,7 +266,8 @@
"options": {
"protractorConfig": "protractor.conf.js",
"webdriverUpdate": false,
"devServerTarget": "app:lite-serve"
"devServerTarget": "app:lite-serve",
"invertGrep": true
}
},
"lint": {
@ -294,13 +295,13 @@
"options": {
"tsConfig": "projects/adf-office-services-ext/tsconfig.lib.json",
"project": "projects/adf-office-services-ext/ng-package.json"
}
, "configurations": {
},
"configurations": {
"production": {
"tsConfig": "projects/adf-office-services-ext/tsconfig.lib.prod.json"
}
}
},
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
@ -334,13 +335,13 @@
"options": {
"tsConfig": "projects/aca-shared/tsconfig.lib.json",
"project": "projects/aca-shared/ng-package.json"
}
, "configurations": {
},
"configurations": {
"production": {
"tsConfig": "projects/aca-shared/tsconfig.lib.prod.json"
}
}
},
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {

View File

@ -2,7 +2,7 @@ const uploadOutput = require('../utils/upload-output');
const SAVE_SCREENSHOT = process.env.SAVE_SCREENSHOT === 'true';
async function afterLaunch(statusCode) {
async function afterLaunch() {
if (SAVE_SCREENSHOT) {
console.log(`Save screenshot is ${SAVE_SCREENSHOT}, trying to save screenshots.`);

View File

@ -5,14 +5,15 @@ const path = require('path');
const { SpecReporter } = require('jasmine-spec-reporter');
const afterLaunch = require('./e2e/e2e-config/hooks/after-launch');
const fs = require('fs');
require('dotenv').config();
const resolve = require('path').resolve;
require('dotenv').config({ path: process.env.ENV_FILE });
const SmartRunner = require('protractor-smartrunner');
const projectRoot = path.resolve(__dirname);
const downloadFolder = `${projectRoot}/e2e-downloads`;
const e2eFolder = path.resolve(projectRoot, 'e2e');
const E2E_HOST = process.env.E2E_HOST || 'http://localhost';
const E2E_PORT = process.env.E2E_PORT || 4200;
const E2E_HOST = process.env.E2E_HOST || 'http://localhost:4200';
const BROWSER_RUN = process.env.BROWSER_RUN;
const width = 1366;
const height = 768;
@ -129,7 +130,7 @@ exports.config = {
directConnect: true,
baseUrl: `${E2E_HOST}${E2E_PORT ? `:${E2E_PORT}` : ''}`,
baseUrl: E2E_HOST,
getPageTimeout: 50000,
@ -139,8 +140,8 @@ exports.config = {
defaultTimeoutInterval: 100000,
print: function() {},
...SmartRunner.withOptionalExclusions(
path.resolve(__dirname, 'e2e/protractor.excludes.json')
),
resolve(__dirname, './e2e/protractor.excludes.json'),
)
},
plugins: [
@ -155,6 +156,10 @@ exports.config = {
],
onPrepare() {
if (process.env.CI) {
SmartRunner.apply({repoHash: process.env.GIT_HASH || ''});
}
const tsConfigPath = path.resolve(e2eFolder, 'tsconfig.e2e.json');
const tsConfig = require(tsConfigPath);