Commit a2adc72c authored by MrMan's avatar MrMan

Add code to properly shutdown electron instances

parent 6618f3fa
......@@ -11,7 +11,7 @@ let BASE_URL = `http://localhost:${SERVER_PORT}`;
let STATIC_SERVER;
let NODE_SERVER;
const DEFAULT_TIMEOUT = 10000;
const PUBLIC_DIR_PATH = `${__dirname}/../../dist`;
const DIST_PATH = `${__dirname}/../../dist`;
// Page constants
......@@ -19,31 +19,38 @@ const LOGIN_BUTTON_ID = "#login-button";
describe("Login page", function() {
this.timeout(DEFAULT_TIMEOUT);
let nm;
before(() => {
// Create static server
STATIC_SERVER = new Static.Server(PUBLIC_DIR_PATH);
STATIC_SERVER = new Static.Server(DIST_PATH);
NODE_SERVER = Http.createServer((req, resp) => {
req.addListener('end', () => {
console.log("SERVE?");
STATIC_SERVER.serve(req, resp);
}).resume();
}).listen(SERVER_PORT);
console.log("http server:", NODE_SERVER);
});
it("Should have the appropriate title", (done) => {
let nm = NM();
beforeEach(() => nm = NM());
it("Should have the appropriate title", (done) => {
Promise.resolve(
nm.goto(BASE_URL).title()
).then(title => {
console.log("WAT");
title.should.match(/Kindling/);
done();
});
});
afterEach(done => {
// End the electron process
Promise.resolve(nm.end())
.then(() => {
console.log("Closed electron process");
done();
});
});
after(() => NODE_SERVER.close());
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment