mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 04:45:17 +00:00
snapshot e2e
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
const helpers = require("./global-setup");
|
||||
const fetch = require("node-fetch");
|
||||
const expect = require("chai").expect;
|
||||
|
||||
const describe = global.describe;
|
||||
const it = global.it;
|
||||
@@ -12,7 +11,7 @@ describe("Electron app environment", function () {
|
||||
|
||||
let app = null;
|
||||
|
||||
before(function () {
|
||||
beforeAll(function () {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/env.js";
|
||||
});
|
||||
@@ -34,27 +33,27 @@ describe("Electron app environment", function () {
|
||||
it("should open a browserwindow", async function () {
|
||||
await app.client.waitUntilWindowLoaded();
|
||||
app.browserWindow.focus();
|
||||
expect(await app.client.getWindowCount()).to.equal(1);
|
||||
expect(await app.browserWindow.isMinimized()).to.be.false;
|
||||
expect(await app.browserWindow.isDevToolsOpened()).to.be.false;
|
||||
expect(await app.browserWindow.isVisible()).to.be.true;
|
||||
expect(await app.browserWindow.isFocused()).to.be.true;
|
||||
expect(await app.client.getWindowCount()).toBe(1);
|
||||
expect(await app.browserWindow.isMinimized()).toBe(false);
|
||||
expect(await app.browserWindow.isDevToolsOpened()).toBe(false);
|
||||
expect(await app.browserWindow.isVisible()).toBe(true);
|
||||
expect(await app.browserWindow.isFocused()).toBe(true);
|
||||
const bounds = await app.browserWindow.getBounds();
|
||||
expect(bounds.width).to.be.above(0);
|
||||
expect(bounds.height).to.be.above(0);
|
||||
expect(await app.browserWindow.getTitle()).to.equal("MagicMirror²");
|
||||
expect(bounds.width).toBeGreaterThan(0);
|
||||
expect(bounds.height).toBeGreaterThan(0);
|
||||
expect(await app.browserWindow.getTitle()).toBe("MagicMirror²");
|
||||
});
|
||||
|
||||
it("get request from http://localhost:8080 should return 200", function (done) {
|
||||
fetch("http://localhost:8080").then((res) => {
|
||||
expect(res.status).to.equal(200);
|
||||
expect(res.status).toBe(200);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it("get request from http://localhost:8080/nothing should return 404", function (done) {
|
||||
fetch("http://localhost:8080/nothing").then((res) => {
|
||||
expect(res.status).to.equal(404);
|
||||
expect(res.status).toBe(404);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user