Skip to content

Commit 1327d0b

Browse files
committed
fix(e2e): get e2e tests running
1 parent 97cc341 commit 1327d0b

File tree

5 files changed

+27
-8
lines changed

5 files changed

+27
-8
lines changed

templates/app/_.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ public
44
.sass-cache<% } %>
55
.idea
66
client/bower_components
7+
client/index.html
78
dist
89
/server/config/local.env.js
910
npm-debug.log

templates/app/_package.json

+1
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@
170170
"webpack-stream": "^3.2.0",
171171
"extract-text-webpack-plugin": "^1.0.1",
172172
"html-webpack-plugin": "^2.16.0",
173+
"html-webpack-harddisk-plugin": "~0.0.2",
173174
"awesome-typescript-loader": "0.17.0",
174175
"ng-annotate-loader": "~0.1.0",
175176
"babel-loader": "^6.2.4",
File renamed without changes.

templates/app/gulpfile.babel(gulp).js

+17-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ import makeWebpackConfig from './webpack.make';
2424
var plugins = gulpLoadPlugins();
2525
var config;
2626
const webpackDevConfig = makeWebpackConfig({ DEV: true });
27+
const webpackE2eConfig = makeWebpackConfig({ E2E: true });
2728
const webpackDistConfig = makeWebpackConfig({ BUILD: true });
29+
const webpackTestConfig = makeWebpackConfig({ TEST: true });
2830

2931
const clientPath = 'client';
3032
const serverPath = 'server';
@@ -202,7 +204,7 @@ gulp.task('inject:tsconfig', () => {
202204
`${clientPath}/**/!(*.spec|*.mock).ts`,
203205
`!${clientPath}/bower_components/**/*`,
204206
`typings/main.d.ts`
205-
],
207+
],
206208
'./tsconfig.client.json');
207209
});
208210

@@ -211,7 +213,7 @@ gulp.task('inject:tsconfigTest', () => {
211213
`${clientPath}/**/+(*.spec|*.mock).ts`,
212214
`!${clientPath}/bower_components/**/*`,
213215
`typings/main.d.ts`
214-
],
216+
],
215217
'./tsconfig.client.test.json');
216218
});<% } %>
217219

@@ -262,6 +264,18 @@ gulp.task('webpack:dist', function() {
262264
return gulp.src(webpackDistConfig.entry.app)
263265
.pipe(webpack(webpackDistConfig))
264266
.pipe(gulp.dest(`${paths.dist}/client`));
267+
});
268+
269+
gulp.task('webpack:test', function() {
270+
return gulp.src(webpackTestConfig.entry.app)
271+
.pipe(webpack(webpackTestConfig))
272+
.pipe(gulp.dest('.tmp'));
273+
});
274+
275+
gulp.task('webpack:e2e', function() {
276+
return gulp.src(webpackE2eConfig.entry.app)
277+
.pipe(webpack(webpackE2eConfig))
278+
.pipe(gulp.dest('.tmp'));
265279
});<% if(filters.ts) { %>
266280

267281
// Install DefinitelyTyped TypeScript definition files
@@ -480,7 +494,7 @@ gulp.task('coverage:integration', () => {
480494
// Downloads the selenium webdriver
481495
gulp.task('webdriver_update', webdriver_update);
482496

483-
gulp.task('test:e2e', ['env:all', 'env:test', 'start:server', 'webdriver_update'], cb => {
497+
gulp.task('test:e2e', ['webpack:e2e', 'constant', 'env:all', 'env:test', 'start:server', 'webdriver_update'], cb => {
484498
gulp.src(paths.client.e2e)
485499
.pipe(protractor({
486500
configFile: 'protractor.conf.js',

templates/app/webpack.make.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ module.exports = function makeWebpackConfig(options) {
1717
*/
1818
var BUILD = !!options.BUILD;
1919
var TEST = !!options.TEST;
20+
var E2E = !!options.E2E;
2021
var DEV = !!options.DEV;
2122

2223
/**
@@ -300,11 +301,13 @@ module.exports = function makeWebpackConfig(options) {
300301
// Skip rendering index.html in test mode
301302
// Reference: https://github.com/ampedandwired/html-webpack-plugin
302303
// Render index.html
303-
config.plugins.push(
304-
new HtmlWebpackPlugin({
305-
template: 'client/index.html'
306-
})
307-
);
304+
let htmlConfig = {
305+
template: 'client/_index.html'
306+
}
307+
if(E2E) {
308+
htmlConfig.filename = 'client/index.html';
309+
}
310+
config.plugins.push(new HtmlWebpackPlugin(htmlConfig));
308311

309312
// Add build specific plugins
310313
if(BUILD) {

0 commit comments

Comments
 (0)