mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 03:39:55 +00:00
Refactoring some e2e tests. Now is use a global-setup instead of
repeat repeat code to setup tests enviroment.
This commit is contained in:
parent
11c0221f81
commit
3773d40201
@ -1,25 +1,5 @@
|
||||
const Application = require("spectron").Application;
|
||||
const path = require("path");
|
||||
const chai = require("chai");
|
||||
const chaiAsPromised = require("chai-as-promised");
|
||||
|
||||
var electronPath = path.join(__dirname, "../../", "node_modules", ".bin", "electron");
|
||||
|
||||
if (process.platform === "win32") {
|
||||
electronPath += ".cmd";
|
||||
}
|
||||
|
||||
var appPath = path.join(__dirname, "../../js/electron.js");
|
||||
|
||||
var app = new Application({
|
||||
path: electronPath,
|
||||
args: [appPath]
|
||||
});
|
||||
|
||||
global.before(function () {
|
||||
chai.should();
|
||||
chai.use(chaiAsPromised);
|
||||
});
|
||||
const globalSetup = require("./global-setup");
|
||||
const app = globalSetup.app;
|
||||
|
||||
describe("Electron app environment", function () {
|
||||
this.timeout(20000);
|
||||
|
34
tests/e2e/global-setup.js
Normal file
34
tests/e2e/global-setup.js
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Magic Mirror
|
||||
*
|
||||
* Global Setup Test Suite
|
||||
*
|
||||
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
|
||||
* MIT Licensed.
|
||||
*
|
||||
*/
|
||||
|
||||
const Application = require("spectron").Application;
|
||||
const path = require("path");
|
||||
const chai = require("chai");
|
||||
const chaiAsPromised = require("chai-as-promised");
|
||||
|
||||
var electronPath = path.join(__dirname, "../../", "node_modules", ".bin", "electron");
|
||||
|
||||
if (process.platform === "win32") {
|
||||
electronPath += ".cmd";
|
||||
}
|
||||
|
||||
var appPath = path.join(__dirname, "../../js/electron.js");
|
||||
|
||||
var app = new Application({
|
||||
path: electronPath,
|
||||
args: [appPath]
|
||||
});
|
||||
|
||||
global.before(function () {
|
||||
chai.should();
|
||||
chai.use(chaiAsPromised);
|
||||
});
|
||||
|
||||
exports.app = app;
|
@ -1,25 +1,5 @@
|
||||
const Application = require("spectron").Application;
|
||||
const path = require("path");
|
||||
const chai = require("chai");
|
||||
const chaiAsPromised = require("chai-as-promised");
|
||||
|
||||
var electronPath = path.join(__dirname, "../../../", "node_modules", ".bin", "electron");
|
||||
|
||||
if (process.platform === "win32") {
|
||||
electronPath += ".cmd";
|
||||
}
|
||||
|
||||
var appPath = path.join(__dirname, "../../../js/electron.js");
|
||||
|
||||
var app = new Application({
|
||||
path: electronPath,
|
||||
args: [appPath]
|
||||
});
|
||||
|
||||
global.before(function () {
|
||||
chai.should();
|
||||
chai.use(chaiAsPromised);
|
||||
});
|
||||
const globalSetup = require("../global-setup");
|
||||
const app = globalSetup.app;
|
||||
|
||||
describe("Clock set to spanish language module", function () {
|
||||
this.timeout(20000);
|
||||
|
@ -1,25 +1,5 @@
|
||||
const Application = require("spectron").Application;
|
||||
const path = require("path");
|
||||
const chai = require("chai");
|
||||
const chaiAsPromised = require("chai-as-promised");
|
||||
|
||||
var electronPath = path.join(__dirname, "../../../", "node_modules", ".bin", "electron");
|
||||
|
||||
if (process.platform === "win32") {
|
||||
electronPath += ".cmd";
|
||||
}
|
||||
|
||||
var appPath = path.join(__dirname, "../../../js/electron.js");
|
||||
|
||||
var app = new Application({
|
||||
path: electronPath,
|
||||
args: [appPath]
|
||||
});
|
||||
|
||||
global.before(function () {
|
||||
chai.should();
|
||||
chai.use(chaiAsPromised);
|
||||
});
|
||||
const globalSetup = require("../global-setup");
|
||||
const app = globalSetup.app;
|
||||
|
||||
describe("Clock module", function () {
|
||||
this.timeout(20000);
|
||||
|
@ -1,26 +1,7 @@
|
||||
const Application = require("spectron").Application;
|
||||
const path = require("path");
|
||||
const globalSetup = require("../global-setup");
|
||||
const app = globalSetup.app;
|
||||
const chai = require("chai");
|
||||
const expect = chai.expect;
|
||||
const chaiAsPromised = require("chai-as-promised");
|
||||
|
||||
var electronPath = path.join(__dirname, "../../../", "node_modules", ".bin", "electron");
|
||||
|
||||
if (process.platform === "win32") {
|
||||
electronPath += ".cmd";
|
||||
}
|
||||
|
||||
var appPath = path.join(__dirname, "../../../js/electron.js");
|
||||
|
||||
var app = new Application({
|
||||
path: electronPath,
|
||||
args: [appPath]
|
||||
});
|
||||
|
||||
global.before(function () {
|
||||
chai.should();
|
||||
chai.use(chaiAsPromised);
|
||||
});
|
||||
|
||||
describe("Compliments module", function () {
|
||||
this.timeout(20000);
|
||||
|
@ -1,25 +1,5 @@
|
||||
const Application = require("spectron").Application;
|
||||
const path = require("path");
|
||||
const chai = require("chai");
|
||||
const chaiAsPromised = require("chai-as-promised");
|
||||
|
||||
var electronPath = path.join(__dirname, "../../../", "node_modules", ".bin", "electron");
|
||||
|
||||
if (process.platform === "win32") {
|
||||
electronPath += ".cmd";
|
||||
}
|
||||
|
||||
var appPath = path.join(__dirname, "../../../js/electron.js");
|
||||
|
||||
var app = new Application({
|
||||
path: electronPath,
|
||||
args: [appPath]
|
||||
});
|
||||
|
||||
global.before(function () {
|
||||
chai.should();
|
||||
chai.use(chaiAsPromised);
|
||||
});
|
||||
const globalSetup = require("../global-setup");
|
||||
const app = globalSetup.app;
|
||||
|
||||
describe("Test helloworld module", function () {
|
||||
this.timeout(20000);
|
||||
|
Loading…
x
Reference in New Issue
Block a user