Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes e2e tests #326

Merged
merged 4 commits into from
Nov 18, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 47 additions & 35 deletions e2e_tests/tests/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,50 +89,62 @@ describe('KYT CLI', () => {
// eslint-disable-next-line
window.jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000000;

it('starts the app', (done) => {
it('starts the app', () => {
let testPass;
shell.exec('npm run build');
const child = shell.exec('npm run start', () => {
done();
});
child.stdout.on('data', (data) => {
if (data.includes('Server running')) {
shell.exec('sleep 3');
const output = shell.exec('curl -I localhost:3100');
expect(output.includes('200'));
kill(child.pid);
}
const exec = new Promise((resolve) => {
const child = shell.exec('npm run start', () => {
resolve(testPass);
});
child.stdout.on('data', (data) => {
if (data.includes('Server running')) {
shell.exec('sleep 3');
const output = shell.exec('curl -I localhost:3100');
testPass = output.stdout.includes('200');
kill(child.pid);
}
});
});
return exec.then(test => expect(test).toBe(true));
});


it('dev', (done) => {
const child = shell.exec('npm run dev', () => {
done();
});
child.stdout.on('data', (data) => {
if (data.includes('✅ Development started')) {
shell.exec('sleep 2');
const output = shell.exec('curl -I localhost:3100');
expect(output.includes('200'));
kill(child.pid);
}
it('dev', () => {
let testPass;
const exec = new Promise((resolve) => {
const child = shell.exec('npm run dev', () => {
resolve(testPass);
});
child.stdout.on('data', (data) => {
if (data.includes('✅ Development started')) {
shell.exec('sleep 2');
const output = shell.exec('curl -I localhost:3100');
testPass = output.stdout.includes('200');
kill(child.pid);
}
});
});
return exec.then(test => expect(test).toBe(true));
});

it('proto', (done) => {
const child = shell.exec('npm run proto', () => {
done();
});
let stillAlive = true;
child.stdout.on('data', (data) => {
if (data.includes('webpack: bundle is now VALID.') && stillAlive) {
stillAlive = false;
shell.exec('sleep 2');
const output = shell.exec('curl -I localhost:3102/prototype');
expect(output.includes('200'));
kill(child.pid);
}
it('proto', () => {
const exec = new Promise((resolve) => {
let testPass;
const child = shell.exec('npm run proto', () => {
resolve(testPass);
});
let stillAlive = true;
child.stdout.on('data', (data) => {
if (data.includes('webpack: bundle is now VALID.') && stillAlive) {
stillAlive = false;
shell.exec('sleep 5');
const output = shell.exec('curl -I localhost:3102/prototype/');
testPass = output.stdout.includes('404');
kill(child.pid);
}
});
});
return exec.then(test => expect(test).toBe(true));
});

afterAll(() => {
Expand Down