2017-07-24 22:08:12 +02:00
|
|
|
const helpers = require("../global-setup");
|
2021-04-10 09:13:14 +02:00
|
|
|
const expect = require("chai").expect;
|
2017-02-20 08:19:36 -03:00
|
|
|
|
2017-07-24 22:08:12 +02: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
|
|
|
|
2020-05-11 22:22:32 +02:00
|
|
|
describe("Newsfeed module", function () {
|
2017-07-24 22:08:12 +02:00
|
|
|
helpers.setupTimeout(this);
|
|
|
|
|
2021-03-16 13:47:48 +01:00
|
|
|
let app = null;
|
2017-07-24 22:08:12 +02:00
|
|
|
|
2020-05-11 22:22:32 +02:00
|
|
|
beforeEach(function () {
|
2017-07-24 22:08:12 +02:00
|
|
|
return helpers
|
|
|
|
.startApplication({
|
|
|
|
args: ["js/electron.js"]
|
|
|
|
})
|
2020-05-11 22:22:32 +02:00
|
|
|
.then(function (startedApp) {
|
2017-07-24 22:08:12 +02:00
|
|
|
app = startedApp;
|
|
|
|
});
|
2017-02-20 08:19:36 -03:00
|
|
|
});
|
|
|
|
|
2020-05-11 22:22:32 +02:00
|
|
|
afterEach(function () {
|
2017-07-24 22:08:12 +02:00
|
|
|
return helpers.stopApplication(app);
|
2017-02-20 08:19:36 -03:00
|
|
|
});
|
|
|
|
|
2020-05-11 22:22:32 +02: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";
|
|
|
|
});
|
|
|
|
|
2021-03-16 13:47:48 +01:00
|
|
|
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);
|
|
|
|
});
|
2021-04-08 16:56:47 +02:00
|
|
|
|
2021-04-10 09:13:14 +02:00
|
|
|
it("should NOT show the newsfeed description", async () => {
|
|
|
|
await app.client.waitUntilTextExists(".newsfeed .newsfeed-title", "QPanel", 10000);
|
|
|
|
const events = await app.client.$$(".newsfeed .newsfeed-desc");
|
|
|
|
return expect(events.length).equals(0);
|
2021-04-08 16:56:47 +02:00
|
|
|
});
|
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
|
|
|
});
|
2021-04-09 08:05:19 +02:00
|
|
|
|
2021-04-10 09:13:14 +02:00
|
|
|
it("should show the newsfeed description", async () => {
|
|
|
|
await app.client.waitUntilTextExists(".newsfeed .newsfeed-title", "Problema VirtualBox", 10000);
|
|
|
|
const events = await app.client.$$(".newsfeed .newsfeed-desc");
|
|
|
|
return expect(events.length).equals(1);
|
2021-04-09 08:05:19 +02:00
|
|
|
});
|
2017-02-20 08:19:36 -03:00
|
|
|
});
|
2021-03-16 13:47:48 +01:00
|
|
|
|
|
|
|
describe("Invalid configuration", function () {
|
|
|
|
before(function () {
|
|
|
|
process.env.MM_CONFIG_FILE = "tests/configs/modules/newsfeed/incorrect_url.js";
|
|
|
|
});
|
|
|
|
|
2021-05-02 13:09:13 +02:00
|
|
|
it("should show malformed url warning", function () {
|
|
|
|
return app.client.waitUntilTextExists(".newsfeed .small", "Error in the Newsfeed module. Malformed url.", 10000);
|
2021-03-16 13:47:48 +01:00
|
|
|
});
|
|
|
|
});
|
2017-02-20 08:19:36 -03:00
|
|
|
});
|