Conversation
…e, run on any file ending with .e2e.js, run in verbose mode and use babel for es2015 compilation
…ent has a home at which to be tested. Still needs to be imported in components.js and provided a ui-sref link somewhere in order for route to work.
package.json
Outdated
| }, | ||
| "scripts": { | ||
| "preupdate-webdriver": "npm install", | ||
| "update-webdriver": "webdriver-manager update", |
There was a problem hiding this comment.
Maybe run it as postinstall script?
…h E2E tests and protractor configuration
…update and location for us. No longer need npm scripts either
|
How about now, guys? Removed extraneous code, added environment variables, using relative paths, and the developer experience is so much better. gulp e2e
npm e2e
|
|
|
||
|
|
||
| gulp.task('e2e', ['protractor'], function() { | ||
| process.exit(); |
There was a problem hiding this comment.
This is maybe not a good idea, but we could store server instance in gulpfile scope and then just stop it. But i think this is better than process.exit.
There was a problem hiding this comment.
In the previous commit I have serve.exit() from the browser-sync API instead, and it doesn't stop the server. Exiting the process seemed to be the only option.
There was a problem hiding this comment.
It doesn't stop gulp task maybe?
let stopServer;
// ...
gulp.task('server', function (callback) {
const server = browsersync({...});
stopServer = () => {
server.exit();
callback();
};
});
// ...
stopServer();
There was a problem hiding this comment.
I think you're right. However with that implementation, protractor never starts. Probably because serve task is expecting to only proceed after the callback?
There was a problem hiding this comment.
Yah, you are right... so we need to run callback after server is ready.
There was a problem hiding this comment.
Unsure what I'm missing here. Everything finishes except for the process.
`
let stopServer;
// Setting up the test task
gulp.task('protractor', ['serve'], function(callback) {
gulp
.src(['example_spec.js'])
.pipe(gulpProtractorAngular({
'configFile': 'protractor.conf.js',
'debug': false,
'autoStartStopServer': true
}))
.on('error', function(e) {
console.log(e);
})
.on('end', callback);
});
gulp.task('e2e', ['protractor'], function(callback) {
//process.exit();
stopServer();
callback();
});
gulp.task('serve', function(callback) {
const config = require('./webpack.dev.config');
config.entry.app = [
// this modules required to make HRM working
// it responsible for all this webpack magic
'webpack-hot-middleware/client?reload=true',
// application entry point
paths.entry
];
var compiler = webpack(config);
const server = serve.init({
port: process.env.PORT || 3000,
open: false,
server: {baseDir: root},
middleware: [
historyApiFallback(),
webpackDevMiddelware(compiler, {
stats: {
colors: colorsSupported,
chunks: false,
modules: false
},
publicPath: config.output.publicPath
}),
webpachHotMiddelware(compiler)
]
});
stopServer = function() {
server.exit();
}
callback();
});
`
|
update on this ? Ive used most of this stuff and I can get the protractor to run properly, but as you say, when used with gulp it doesnt want to exit.. |
|
I currently working on getting rid of gulp completely. This will simplify stuff. |
|
Do we have a working version of the latest here? Curious... |
To run end to end tests:
E2E Test Generator
I've added a component e2e test file generator, and updated the component module generator with a default route of the component name. In order for the component to be tested, two tasks must still be accomplished.