Skip to content

Commit e6bdf50

Browse files
authored
chore(tests): add prod env e2e test (#1394)
1 parent 5b21617 commit e6bdf50

File tree

1 file changed

+42
-42
lines changed

1 file changed

+42
-42
lines changed

tests/e2e/e2e_workflow.spec.js

+42-42
Original file line numberDiff line numberDiff line change
@@ -177,47 +177,6 @@ describe('Basic end-to-end Workflow', function () {
177177
});
178178
});
179179

180-
it('Serve and run e2e tests after initial build', function () {
181-
this.timeout(240000);
182-
183-
var ngServePid;
184-
185-
function executor(resolve, reject) {
186-
var serveProcess = child_process.exec(`${ngBin} serve`, { maxBuffer: 500*1024 });
187-
var startedProtractor = false;
188-
ngServePid = serveProcess.pid;
189-
190-
serveProcess.stdout.on('data', (data) => {
191-
if (/webpack: bundle is now VALID/.test(data.toString('utf-8')) && !startedProtractor) {
192-
startedProtractor = true;
193-
child_process.exec(`${ngBin} e2e`, (error, stdout, stderr) => {
194-
if (error !== null) {
195-
reject(stderr)
196-
} else {
197-
resolve();
198-
}
199-
});
200-
}
201-
});
202-
203-
serveProcess.stderr.on('data', (data) => {
204-
reject(data);
205-
});
206-
serveProcess.on('close', (code) => {
207-
code === 0 ? resolve() : reject('ng serve command closed with error')
208-
});
209-
}
210-
211-
return new Promise(executor)
212-
.then(() => {
213-
if (ngServePid) treeKill(ngServePid);
214-
})
215-
.catch((msg) => {
216-
if (ngServePid) treeKill(ngServePid);
217-
throw new Error(msg);
218-
});
219-
});
220-
221180
it('Can create a test component using `ng generate component test-component`', function () {
222181
this.timeout(10000);
223182
return ng(['generate', 'component', 'test-component']).then(function () {
@@ -453,7 +412,7 @@ describe('Basic end-to-end Workflow', function () {
453412
expect(indexHtml).to.include('main.bundle.js');
454413
});
455414

456-
it('Serve and run e2e tests after all other commands', function () {
415+
it('Serve and run e2e tests on dev environment', function () {
457416
this.timeout(240000);
458417

459418
var ngServePid;
@@ -493,6 +452,47 @@ describe('Basic end-to-end Workflow', function () {
493452
throw new Error(msg);
494453
});
495454
});
455+
456+
it('Serve and run e2e tests on prod environment', function () {
457+
this.timeout(240000);
458+
459+
var ngServePid;
460+
461+
function executor(resolve, reject) {
462+
var serveProcess = child_process.exec(`${ngBin} serve -e=prod`, { maxBuffer: 500*1024 });
463+
var startedProtractor = false;
464+
ngServePid = serveProcess.pid;
465+
466+
serveProcess.stdout.on('data', (data) => {
467+
if (/webpack: bundle is now VALID/.test(data.toString('utf-8')) && !startedProtractor) {
468+
startedProtractor = true;
469+
child_process.exec(`${ngBin} e2e`, (error, stdout, stderr) => {
470+
if (error !== null) {
471+
reject(stderr)
472+
} else {
473+
resolve();
474+
}
475+
});
476+
}
477+
});
478+
479+
serveProcess.stderr.on('data', (data) => {
480+
reject(data);
481+
});
482+
serveProcess.on('close', (code) => {
483+
code === 0 ? resolve() : reject('ng serve command closed with error')
484+
});
485+
}
486+
487+
return new Promise(executor)
488+
.then(() => {
489+
if (ngServePid) treeKill(ngServePid);
490+
})
491+
.catch((msg) => {
492+
if (ngServePid) treeKill(ngServePid);
493+
throw new Error(msg);
494+
});
495+
});
496496
});
497497

498498
function isMobileTest() {

0 commit comments

Comments
 (0)