Skip to content
Permalink
Browse files

feat(protractor): update protractor to reflect changes for running wi…

…th custom port & host

Also update cypress.config.js, this one missed in the previous commit
  • Loading branch information...
shahabganji authored and 3cp committed Aug 16, 2019
1 parent 50c7de5 commit 770fd87ed3d9f85ca6c78ec388e4037c8993d803
@@ -1,9 +1,11 @@
const CLIOptions = require( 'aurelia-cli').CLIOptions;
const aureliaConfig = require('./aurelia_project/aurelia.json');
const port = aureliaConfig.platform.port;
const PORT = CLIOptions.getFlagValue('port') || aureliaConfig.platform.port;
const HOST = CLIOptions.getFlagValue('host') || aureliaConfig.platform.host;

module.exports = {
config: {
baseUrl: `http://localhost:${port}`,
baseUrl: `http://${HOST}:${PORT}`,
fixturesFolder: 'test/e2e/fixtures',
integrationFolder: 'test/e2e/integration',
pluginsFile: 'test/e2e/plugins/index.js',
@@ -6,22 +6,36 @@ import * as gulp from 'gulp';
// @endif
const {protractor, webdriver_update } = require('gulp-protractor');

gulp.task('webdriver_update', webdriver_update);
import { CLIOptions } from 'aurelia-cli';
import { default as runAppServer, shutdownAppServer } from './run';

gulp.task('protractor', (cb) => {
function runApp(cb) {
if (CLIOptions.hasFlag('start')) {
runAppServer();
}
cb();
}

function runProtractor(cb) {
// @if feat.babel
gulp.src('test/e2e/**/*.e2e.js')
return gulp.src('test/e2e/**/*.e2e.js')
// @endif
// @if feat.typescript
gulp.src('test/e2e/**/*.e2e.ts')
return gulp.src('test/e2e/**/*.e2e.ts')
// @endif
.pipe(protractor({configFile: 'test/protractor.conf.js'}))
.on('error', cb)
.on('end', cb);
});
.pipe(protractor({ configFile: 'protractor.conf.js', args: process.argv.slice(3) }))
.on('end', () => {
shutdownAppServer().then(cb);
})
.on('error', () => {
shutdownAppServer(1).then(cb);
});
}

// Setting up the test task
export default gulp.series(
'webdriver_update',
'protractor'
runApp,
webdriver_update,
runProtractor
);

@@ -1,10 +1,19 @@
const aureliaConfig = require('../aurelia_project/aurelia.json');
const port = aureliaConfig.platform.port;
const CLIOptions = require('aurelia-cli').CLIOptions;
const aureliaConfig = require('./aurelia_project/aurelia.json');
const cliOptions = new CLIOptions();

exports.config = {
port: port,
Object.assign(cliOptions, {
args: process.argv.slice(3)
});

const port = cliOptions.getFlagValue('port') || aureliaConfig.platform.port;
const host = cliOptions.getFlagValue('host') || aureliaConfig.platform.host || "localhost";
const headless = cliOptions.hasFlag('run') || false;

baseUrl: `http://localhost:${port}/`,
const config = {
port: port,
host: host,
baseUrl: `http://${host}:${port}/`,

specs: [
// @if feat.babel
@@ -45,11 +54,7 @@ exports.config = {
'--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'
*/
'--disable-device-discovery-notifications'
]
}
},
@@ -69,3 +74,10 @@ exports.config = {
package: 'aurelia-protractor-plugin'
}],
};

if (headless) {
config.capabilities.chromeOptions.args.push("--no-gpu");
config.capabilities.chromeOptions.args.push("--headless");
}

exports.config = config;

0 comments on commit 770fd87

Please sign in to comment.
You can’t perform that action at this time.