MagicMirror/tests/e2e/modules/newsfeed_spec.js

69 lines
2.0 KiB
JavaScript
Raw Normal View History

const helpers = require("../global-setup");
2017-02-20 08:19:36 -03:00
const describe = global.describe;
const it = global.it;
const beforeEach = global.beforeEach;
const afterEach = global.afterEach;
2017-02-20 08:19:36 -03:00
describe("Newsfeed module", function () {
helpers.setupTimeout(this);
let app = null;
beforeEach(function () {
return helpers
.startApplication({
args: ["js/electron.js"]
})
.then(function (startedApp) {
app = startedApp;
});
2017-02-20 08:19:36 -03:00
});
afterEach(function () {
return helpers.stopApplication(app);
2017-02-20 08:19:36 -03:00
});
describe("Default configuration", function () {
before(function () {
2017-02-20 08:19:36 -03:00
process.env.MM_CONFIG_FILE = "tests/configs/modules/newsfeed/default.js";
});
it("should show the newsfeed title", function () {
2021-03-16 22:37:34 +01:00
return app.client.waitUntilTextExists(".newsfeed .newsfeed-source", "Rodrigo Ramirez Blog", 10000);
});
it("should show the newsfeed article", function () {
return app.client.waitUntilTextExists(".newsfeed .newsfeed-title", "QPanel", 10000);
});
it("should not show the newsfeed description", function () {
return !app.client.waitUntilTextExists(".newsfeed .newsfeed-desc", "Para instalar esta nueva versión", 10000);
});
2021-03-16 22:37:34 +01:00
});
describe("Custom configuration", function () {
before(function () {
process.env.MM_CONFIG_FILE = "tests/configs/modules/newsfeed/prohibited_words.js";
});
it("should not show articles with prohibited words", function () {
return app.client.waitUntilTextExists(".newsfeed .newsfeed-title", "Problema VirtualBox", 10000);
2017-02-20 08:19:36 -03:00
});
it("should show the newsfeed description", function () {
return app.client.waitUntilTextExists(".newsfeed .newsfeed-desc", "Después de una actualización de Debian", 10000);
});
2017-02-20 08:19:36 -03:00
});
describe("Invalid configuration", function () {
before(function () {
process.env.MM_CONFIG_FILE = "tests/configs/modules/newsfeed/incorrect_url.js";
});
it("should show invalid url warning", function () {
2021-03-16 19:16:07 +01:00
return app.client.waitUntilTextExists(".newsfeed .small", "Error in the Newsfeed module. Incorrect url:", 10000);
});
});
2017-02-20 08:19:36 -03:00
});