mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-30 04:59:32 +00:00
Merge pull request #2454 from rejas/cleanup_tests
This commit is contained in:
commit
e3bee5aae7
@ -31,7 +31,7 @@ _This release is scheduled to be released on 2021-04-01._
|
|||||||
- Moving weather provider specific code and configuration into each provider and making hourly part of the interface.
|
- Moving weather provider specific code and configuration into each provider and making hourly part of the interface.
|
||||||
- Bump electron to v11.
|
- Bump electron to v11.
|
||||||
- Dont update the DOM when a module is not displayed.
|
- Dont update the DOM when a module is not displayed.
|
||||||
- Cleaned up jsdoc.
|
- Cleaned up jsdoc and tests.
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ var config = {
|
|||||||
calendars: [
|
calendars: [
|
||||||
{
|
{
|
||||||
maximumNumberOfDays: 10000,
|
maximumNumberOfDays: 10000,
|
||||||
url: "http://localhost:8011/tests/configs/data/calendar_test.ics",
|
url: "http://localhost:8080/tests/configs/data/calendar_test.ics",
|
||||||
auth: {
|
auth: {
|
||||||
user: "MagicMirror",
|
user: "MagicMirror",
|
||||||
pass: "CallMeADog"
|
pass: "CallMeADog"
|
||||||
|
@ -26,7 +26,7 @@ var config = {
|
|||||||
calendars: [
|
calendars: [
|
||||||
{
|
{
|
||||||
maximumNumberOfDays: 10000,
|
maximumNumberOfDays: 10000,
|
||||||
url: "http://localhost:8010/tests/configs/data/calendar_test.ics",
|
url: "http://localhost:8080/tests/configs/data/calendar_test.ics",
|
||||||
auth: {
|
auth: {
|
||||||
user: "MagicMirror",
|
user: "MagicMirror",
|
||||||
pass: "CallMeADog",
|
pass: "CallMeADog",
|
||||||
|
44
tests/configs/modules/calendar/changed-port.js
Normal file
44
tests/configs/modules/calendar/changed-port.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/* Magic Mirror Test config default calendar with auth by default
|
||||||
|
*
|
||||||
|
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
|
||||||
|
* MIT Licensed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
port: 8080,
|
||||||
|
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
|
||||||
|
|
||||||
|
language: "en",
|
||||||
|
timeFormat: 12,
|
||||||
|
units: "metric",
|
||||||
|
electronOptions: {
|
||||||
|
webPreferences: {
|
||||||
|
nodeIntegration: true,
|
||||||
|
enableRemoteModule: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
modules: [
|
||||||
|
{
|
||||||
|
module: "calendar",
|
||||||
|
position: "bottom_bar",
|
||||||
|
config: {
|
||||||
|
calendars: [
|
||||||
|
{
|
||||||
|
maximumNumberOfDays: 10000,
|
||||||
|
url: "http://localhost:8010/tests/configs/data/calendar_test.ics",
|
||||||
|
auth: {
|
||||||
|
user: "MagicMirror",
|
||||||
|
pass: "CallMeADog"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||||
|
if (typeof module !== "undefined") {
|
||||||
|
module.exports = config;
|
||||||
|
}
|
@ -26,7 +26,7 @@ var config = {
|
|||||||
calendars: [
|
calendars: [
|
||||||
{
|
{
|
||||||
maximumNumberOfDays: 10000,
|
maximumNumberOfDays: 10000,
|
||||||
url: "http://localhost:8012/tests/configs/data/calendar_test.ics",
|
url: "http://localhost:8080/tests/configs/data/calendar_test.ics",
|
||||||
user: "MagicMirror",
|
user: "MagicMirror",
|
||||||
pass: "CallMeADog"
|
pass: "CallMeADog"
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ global.before(function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
exports.getElectronPath = function () {
|
exports.getElectronPath = function () {
|
||||||
var electronPath = path.join(__dirname, "..", "..", "node_modules", ".bin", "electron");
|
let electronPath = path.join(__dirname, "..", "..", "node_modules", ".bin", "electron");
|
||||||
if (process.platform === "win32") {
|
if (process.platform === "win32") {
|
||||||
electronPath += ".cmd";
|
electronPath += ".cmd";
|
||||||
}
|
}
|
||||||
@ -42,9 +42,9 @@ exports.startApplication = function (options) {
|
|||||||
options.startTimeout = 30000;
|
options.startTimeout = 30000;
|
||||||
}
|
}
|
||||||
|
|
||||||
var app = new Application(options);
|
const app = new Application(options);
|
||||||
return app.start().then(function () {
|
return app.start().then(function () {
|
||||||
assert.equal(app.isRunning(), true);
|
assert.strictEqual(app.isRunning(), true);
|
||||||
chaiAsPromised.transferPromiseness = app.transferPromiseness;
|
chaiAsPromised.transferPromiseness = app.transferPromiseness;
|
||||||
return app;
|
return app;
|
||||||
});
|
});
|
||||||
@ -56,6 +56,6 @@ exports.stopApplication = function (app) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return app.stop().then(function () {
|
return app.stop().then(function () {
|
||||||
assert.equal(app.isRunning(), false);
|
assert.strictEqual(app.isRunning(), false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -76,11 +76,11 @@ describe("Calendar module", function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Basic auth", function () {
|
describe("Changed port", function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
serverBasicAuth.listen(8010);
|
serverBasicAuth.listen(8010);
|
||||||
// Set config sample for use in test
|
// Set config sample for use in test
|
||||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/basic-auth.js";
|
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/changed-port.js";
|
||||||
});
|
});
|
||||||
|
|
||||||
after(function (done) {
|
after(function (done) {
|
||||||
@ -92,17 +92,23 @@ describe("Calendar module", function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("Basic auth", function () {
|
||||||
|
before(function () {
|
||||||
|
// Set config sample for use in test
|
||||||
|
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/basic-auth.js";
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should return TestEvents", function () {
|
||||||
|
return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("Basic auth by default", function () {
|
describe("Basic auth by default", function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
serverBasicAuth.listen(8011);
|
|
||||||
// Set config sample for use in test
|
// Set config sample for use in test
|
||||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/auth-default.js";
|
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/auth-default.js";
|
||||||
});
|
});
|
||||||
|
|
||||||
after(function (done) {
|
|
||||||
serverBasicAuth.close(done());
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should return TestEvents", function () {
|
it("should return TestEvents", function () {
|
||||||
return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
|
return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
|
||||||
});
|
});
|
||||||
@ -110,15 +116,10 @@ describe("Calendar module", function () {
|
|||||||
|
|
||||||
describe("Basic auth backward compatibility configuration: DEPRECATED", function () {
|
describe("Basic auth backward compatibility configuration: DEPRECATED", function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
serverBasicAuth.listen(8012);
|
|
||||||
// Set config sample for use in test
|
// Set config sample for use in test
|
||||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/old-basic-auth.js";
|
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/old-basic-auth.js";
|
||||||
});
|
});
|
||||||
|
|
||||||
after(function (done) {
|
|
||||||
serverBasicAuth.close(done());
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should return TestEvents", function () {
|
it("should return TestEvents", function () {
|
||||||
return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
|
return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
|
||||||
});
|
});
|
||||||
|
@ -15,7 +15,8 @@ describe("Weather module", function () {
|
|||||||
|
|
||||||
async function setup(responses) {
|
async function setup(responses) {
|
||||||
app = await helpers.startApplication({
|
app = await helpers.startApplication({
|
||||||
args: ["js/electron.js"]
|
args: ["js/electron.js"],
|
||||||
|
waitTimeout: 100000
|
||||||
});
|
});
|
||||||
|
|
||||||
wdajaxstub.init(app.client, responses);
|
wdajaxstub.init(app.client, responses);
|
||||||
@ -101,16 +102,7 @@ describe("Weather module", function () {
|
|||||||
const weather = generateWeather();
|
const weather = generateWeather();
|
||||||
await setup({ template, data: weather });
|
await setup({ template, data: weather });
|
||||||
|
|
||||||
const wait = (time) => new Promise((resolve) => setTimeout(resolve, time));
|
return app.client.waitUntilTextExists(".compliments .module-content span", "snow");
|
||||||
|
|
||||||
var text = "";
|
|
||||||
do {
|
|
||||||
await wait(3000);
|
|
||||||
elem = await app.client.$(".compliments");
|
|
||||||
text = await elem.getText(".compliments .module-content span");
|
|
||||||
} while (text === "");
|
|
||||||
|
|
||||||
return expect(text.trim()).to.equal("snow");
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ describe("Vendors", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("Get list vendors", function () {
|
describe("Get list vendors", function () {
|
||||||
var vendors = require(__dirname + "/../../vendor/vendor.js");
|
const vendors = require(__dirname + "/../../vendor/vendor.js");
|
||||||
Object.keys(vendors).forEach((vendor) => {
|
Object.keys(vendors).forEach((vendor) => {
|
||||||
it(`should return 200 HTTP code for vendor "${vendor}"`, function () {
|
it(`should return 200 HTTP code for vendor "${vendor}"`, function () {
|
||||||
var urlVendor = "http://localhost:8080/vendor/" + vendors[vendor];
|
var urlVendor = "http://localhost:8080/vendor/" + vendors[vendor];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user