Files
MagicMirror/tests/e2e/env_spec.js
T

70 lines
1.8 KiB
JavaScript
Raw Normal View History

2017-07-24 22:08:12 +02:00
const helpers = require("./global-setup");
const path = require("path");
2017-03-08 10:36:08 -03:00
const request = require("request");
2017-01-30 12:29:32 -03:00
2017-07-24 22:08:12 +02:00
const expect = require("chai").expect;
const describe = global.describe;
const it = global.it;
const beforeEach = global.beforeEach;
const afterEach = global.afterEach;
describe("Electron app environment", function() {
helpers.setupTimeout(this);
var app = null;
2017-01-30 12:29:32 -03:00
2017-01-31 10:37:03 -08:00
before(function() {
// Set config sample for use in test
process.env.MM_CONFIG_FILE = "tests/configs/env.js";
});
2017-07-24 22:08:12 +02:00
beforeEach(function() {
return helpers
.startApplication({
args: ["js/electron.js"]
})
.then(function(startedApp) {
app = startedApp;
});
2017-01-30 12:29:32 -03:00
});
2017-07-24 22:08:12 +02:00
afterEach(function() {
return helpers.stopApplication(app);
2017-01-30 12:29:32 -03:00
});
2017-07-24 22:08:12 +02:00
it("should open a browserwindow", function() {
return app.client
.waitUntilWindowLoaded()
2019-01-03 16:42:31 +01:00
// .browserWindow.focus()
2017-07-24 22:08:12 +02:00
.getWindowCount()
.should.eventually.equal(1)
.browserWindow.isMinimized()
.should.eventually.be.false.browserWindow.isDevToolsOpened()
.should.eventually.be.false.browserWindow.isVisible()
.should.eventually.be.true.browserWindow.isFocused()
.should.eventually.be.true.browserWindow.getBounds()
.should.eventually.have.property("width")
.and.be.above(0)
.browserWindow.getBounds()
.should.eventually.have.property("height")
.and.be.above(0)
.browserWindow.getTitle()
2017-07-25 11:00:38 -04:00
.should.eventually.equal("MagicMirror²");
2017-01-30 12:29:32 -03:00
});
2017-07-24 22:08:12 +02:00
it("get request from http://localhost:8080 should return 200", function(done) {
request.get("http://localhost:8080", function(err, res, body) {
2017-03-08 10:36:08 -03:00
expect(res.statusCode).to.equal(200);
done();
});
});
2017-07-24 22:08:12 +02:00
it("get request from http://localhost:8080/nothing should return 404", function(done) {
request.get("http://localhost:8080/nothing", function(err, res, body) {
expect(res.statusCode).to.equal(404);
done();
});
});
2017-01-30 12:29:32 -03:00
});