Skip to content

Instantly share code, notes, and snippets.

@alexandru-calinoiu
Created September 7, 2017 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexandru-calinoiu/8bf0a5e97f05311e388fe333f6b83b75 to your computer and use it in GitHub Desktop.
Save alexandru-calinoiu/8bf0a5e97f05311e388fe333f6b83b75 to your computer and use it in GitHub Desktop.
/**
* e2e task
*
* You should have the server up and running before executing this task. e.g. run `au run`, otherwise the
* protractor calls will fail.
*/
import { build, CLIOptions } from 'aurelia-cli';
import * as del from 'del';
import * as eventStream from 'event-stream';
import * as gulp from 'gulp';
import * as changedInPlace from 'gulp-changed-in-place';
import * as notify from 'gulp-notify';
import * as plumber from 'gulp-plumber';
import * as sourcemaps from 'gulp-sourcemaps';
import * as ts from 'gulp-typescript';
import * as path from 'path';
import * as project from '../aurelia.json';
import { protractor, webdriver_update } from 'gulp-protractor';
function clean(): void {
return del(project.integrationTestRunner.dist + '*');
}
var typescriptCompiler = typescriptCompiler || null;
function buildTypeScript(): void {
typescriptCompiler = ts.createProject('tsconfig.json', {
typescript: require('typescript'),
module: 'commonjs',
});
const dts = gulp.src(project.transpiler.dtsSource);
const src = gulp.src(project.integrationTestRunner.source)
.pipe(changedInPlace({ firstPass: true }));
return eventStream.merge(dts, src)
.pipe(plumber({ errorHandler: notify.onError('Error: <%= error.message %>') }))
.pipe(sourcemaps.init())
.pipe(typescriptCompiler())
.pipe(sourcemaps.write({ sourceRoot: 'src' }))
.pipe(gulp.dest(project.integrationTestRunner.dist));
}
function e2e(): void {
return gulp.src(project.integrationTestRunner.dist + '**/*.js')
.pipe(protractor({
configFile: path.join(__dirname, '/../../protractor.conf.js'),
args: ['--baseUrl', 'http://127.0.0.1:5000'],
}))
.on('end', () => process.exit())
.on('error', (e) => { throw e; });
}
export default gulp.series(
webdriver_update,
clean,
buildTypeScript,
e2e,
);
exports.config = {
specs: [
'test/e2e/dist/*.js'
],
exclude: [],
framework: 'jasmine',
allScriptsTimeout: 110000,
jasmineNodeOpts: {
showTiming: true,
showColors: true,
isVerbose: true,
includeStackTrace: false,
defaultTimeoutInterval: 400000
},
SELENIUM_PROMISE_MANAGER: false,
directConnect: true,
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
'args': [
'--show-fps-counter',
'--no-default-browser-check',
'--no-first-run',
'--disable-default-apps',
'--disable-popup-blocking',
'--disable-translate',
'--disable-background-timer-throttling',
'--disable-renderer-backgrounding',
'--disable-device-discovery-notifications',
/* enable these if you'd like to test using Chrome Headless
'--no-gpu',
'--headless'
*/
]
}
},
plugins: [{
package: 'aurelia-protractor-plugin'
}],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment