snapshot e2e

This commit is contained in:
Karsten Hassel
2021-06-09 00:19:43 +02:00
parent 67011c0c32
commit 0e14d3d6e8
19 changed files with 93 additions and 116 deletions

View File

@@ -1,6 +1,5 @@
const helpers = require("../global-setup");
const serverBasicAuth = require("../../servers/basic-auth.js");
const expect = require("chai").expect;
const describe = global.describe;
const it = global.it;
@@ -35,13 +34,13 @@ describe("Calendar module", function () {
it("should show the default maximumEntries of 10", async () => {
await app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
const events = await app.client.$$(".calendar .event");
return expect(events.length).equals(10);
return expect(events.length).toBe(10);
});
it("should show the default calendar symbol in each event", async () => {
await app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
const icons = await app.client.$$(".calendar .event .fa-calendar");
return expect(icons.length).not.equals(0);
return expect(icons.length).not.toBe(0);
});
});
@@ -54,25 +53,25 @@ describe("Calendar module", function () {
it("should show the custom maximumEntries of 4", async () => {
await app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
const events = await app.client.$$(".calendar .event");
return expect(events.length).equals(4);
return expect(events.length).toBe(4);
});
it("should show the custom calendar symbol in each event", async () => {
await app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
const icons = await app.client.$$(".calendar .event .fa-birthday-cake");
return expect(icons.length).equals(4);
return expect(icons.length).toBe(4);
});
it("should show two custom icons for repeating events", async () => {
await app.client.waitUntilTextExists(".calendar", "TestEventRepeat", 10000);
const icons = await app.client.$$(".calendar .event .fa-undo");
return expect(icons.length).equals(2);
return expect(icons.length).toBe(2);
});
it("should show two custom icons for day events", async () => {
await app.client.waitUntilTextExists(".calendar", "TestEventDay", 10000);
const icons = await app.client.$$(".calendar .event .fa-calendar-day");
return expect(icons.length).equals(2);
return expect(icons.length).toBe(2);
});
});
@@ -85,7 +84,7 @@ describe("Calendar module", function () {
it("should show the recurring birthday event 6 times", async () => {
await app.client.waitUntilTextExists(".calendar", "Mar 25th", 10000);
const events = await app.client.$$(".calendar .event");
return expect(events.length).equals(6);
return expect(events.length).toBe(6);
});
});

View File

@@ -33,13 +33,13 @@ describe("Clock set to spanish language module", function () {
it("shows date with correct format", async function () {
const dateRegex = /^(?:lunes|martes|miércoles|jueves|viernes|sábado|domingo), \d{1,2} de (?:enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre) de \d{4}$/;
const elem = await app.client.$(".clock .date");
return elem.getText(".clock .date").should.eventually.match(dateRegex);
return elem.getText(".clock .date").toString().match(dateRegex);
});
it("shows time in 24hr format", async function () {
const timeRegex = /^(?:2[0-3]|[01]\d):[0-5]\d[0-5]\d$/;
const elem = await app.client.$(".clock .time");
return elem.getText(".clock .time").should.eventually.match(timeRegex);
return elem.getText(".clock .time").toString().match(timeRegex);
});
});
@@ -52,13 +52,13 @@ describe("Clock set to spanish language module", function () {
it("shows date with correct format", async function () {
const dateRegex = /^(?:lunes|martes|miércoles|jueves|viernes|sábado|domingo), \d{1,2} de (?:enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre) de \d{4}$/;
const elem = await app.client.$(".clock .date");
return elem.getText(".clock .date").should.eventually.match(dateRegex);
return elem.getText(".clock .date").toString().match(dateRegex);
});
it("shows time in 12hr format", async function () {
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[ap]m$/;
const elem = await app.client.$(".clock .time");
return elem.getText(".clock .time").should.eventually.match(timeRegex);
return elem.getText(".clock .time").toString().match(timeRegex);
});
});
@@ -71,7 +71,7 @@ describe("Clock set to spanish language module", function () {
it("shows 12hr time with upper case AM/PM", async function () {
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[AP]M$/;
const elem = await app.client.$(".clock .time");
return elem.getText(".clock .time").should.eventually.match(timeRegex);
return elem.getText(".clock .time").toString().match(timeRegex);
});
});
@@ -84,7 +84,7 @@ describe("Clock set to spanish language module", function () {
it("shows week with correct format", async function () {
const weekRegex = /^Semana [0-9]{1,2}$/;
const elem = await app.client.$(".clock .week");
elem.getText(".clock .week").should.eventually.match(weekRegex);
elem.getText(".clock .week").toString().match(weekRegex);
});
});
});

View File

@@ -1,5 +1,4 @@
const helpers = require("../global-setup");
const expect = require("chai").expect;
const moment = require("moment");
const describe = global.describe;
@@ -35,13 +34,13 @@ describe("Clock module", function () {
it("should show the date in the correct format", async function () {
const dateRegex = /^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}, \d{4}$/;
const elem = await app.client.$(".clock .date");
return elem.getText(".clock .date").should.eventually.match(dateRegex);
return elem.getText(".clock .date").toString().match(dateRegex);
});
it("should show the time in 24hr format", async function () {
const timeRegex = /^(?:2[0-3]|[01]\d):[0-5]\d[0-5]\d$/;
const elem = await app.client.$(".clock .time");
return elem.getText(".clock .time").should.eventually.match(timeRegex);
return elem.getText(".clock .time").toString().match(timeRegex);
});
});
@@ -54,13 +53,13 @@ describe("Clock module", function () {
it("should show the date in the correct format", async function () {
const dateRegex = /^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}, \d{4}$/;
const elem = await app.client.$(".clock .date");
return elem.getText(".clock .date").should.eventually.match(dateRegex);
return elem.getText(".clock .date").toString().match(dateRegex);
});
it("should show the time in 12hr format", async function () {
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[ap]m$/;
const elem = await app.client.$(".clock .time");
return elem.getText(".clock .time").should.eventually.match(timeRegex);
return elem.getText(".clock .time").toString().match(timeRegex);
});
});
@@ -73,7 +72,7 @@ describe("Clock module", function () {
it("should show 12hr time with upper case AM/PM", async function () {
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[AP]M$/;
const elem = await app.client.$(".clock .time");
return elem.getText(".clock .time").should.eventually.match(timeRegex);
return elem.getText(".clock .time").toString().match(timeRegex);
});
});
@@ -86,7 +85,7 @@ describe("Clock module", function () {
it("should show 12hr time without seconds am/pm", async function () {
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[ap]m$/;
const elem = await app.client.$(".clock .time");
return elem.getText(".clock .time").should.eventually.match(timeRegex);
return elem.getText(".clock .time").toString().match(timeRegex);
});
});
@@ -99,14 +98,14 @@ describe("Clock module", function () {
it("should show the week in the correct format", async function () {
const weekRegex = /^Week [0-9]{1,2}$/;
const elem = await app.client.$(".clock .week");
return elem.getText(".clock .week").should.eventually.match(weekRegex);
return elem.getText(".clock .week").toString().match(weekRegex);
});
it("should show the week with the correct number of week of year", async function () {
const currentWeekNumber = moment().week();
const weekToShow = "Week " + currentWeekNumber;
const elem = await app.client.$(".clock .week");
return elem.getText(".clock .week").should.eventually.equal(weekToShow);
return (elem.getText(".clock .week") === weekToShow);
});
});
@@ -119,7 +118,7 @@ describe("Clock module", function () {
it("should show the analog clock face", async () => {
await app.client.waitUntilWindowLoaded(10000);
const clock = await app.client.$$(".clockCircle");
return expect(clock.length).equals(1);
return expect(clock.length).toBe(1);
});
});
});

View File

@@ -1,5 +1,4 @@
const helpers = require("../global-setup");
const expect = require("chai").expect;
const describe = global.describe;
const it = global.it;
@@ -37,7 +36,7 @@ describe("Compliments module", function () {
// if morning check
const elem = await app.client.$(".compliments");
return elem.getText(".compliments").then(function (text) {
expect(text).to.be.oneOf(["Hi", "Good Morning", "Morning test"]);
expect(["Hi", "Good Morning", "Morning test"]).toContain(text)
});
}
});
@@ -48,7 +47,7 @@ describe("Compliments module", function () {
// if afternoon check
const elem = await app.client.$(".compliments");
return elem.getText(".compliments").then(function (text) {
expect(text).to.be.oneOf(["Hello", "Good Afternoon", "Afternoon test"]);
expect(["Hello", "Good Afternoon", "Afternoon test"]).toContain(text)
});
}
});
@@ -59,7 +58,7 @@ describe("Compliments module", function () {
// if evening check
const elem = await app.client.$(".compliments");
return elem.getText(".compliments").then(function (text) {
expect(text).to.be.oneOf(["Hello There", "Good Evening", "Evening test"]);
expect(["Hello There", "Good Evening", "Evening test"]).toContain(text)
});
}
});
@@ -75,7 +74,7 @@ describe("Compliments module", function () {
it("Show anytime because if configure empty parts of day compliments and set anytime compliments", async function () {
const elem = await app.client.$(".compliments");
return elem.getText(".compliments").then(function (text) {
expect(text).to.be.oneOf(["Anytime here"]);
expect(["Anytime here"]).toContain(text)
});
});
});
@@ -89,7 +88,7 @@ describe("Compliments module", function () {
it("Show anytime compliments", async function () {
const elem = await app.client.$(".compliments");
return elem.getText(".compliments").then(function (text) {
expect(text).to.be.oneOf(["Anytime here"]);
expect(["Anytime here"]).toContain(text)
});
});
});
@@ -105,7 +104,7 @@ describe("Compliments module", function () {
it("Show happy new year compliment on new years day", async function () {
const elem = await app.client.$(".compliments");
return elem.getText(".compliments").then(function (text) {
expect(text).to.be.oneOf(["Happy new year!"]);
expect(["Happy new year!"]).toContain(text)
});
});
});

View File

@@ -32,7 +32,7 @@ describe("Test helloworld module", function () {
it("Test message helloworld module", async function () {
const elem = await app.client.$("helloworld");
return elem.getText(".helloworld").should.eventually.equal("Test HelloWorld Module");
return (elem.getText(".helloworld") === "Test HelloWorld Module");
});
});
@@ -44,7 +44,7 @@ describe("Test helloworld module", function () {
it("Test message helloworld module", async function () {
const elem = await app.client.$("helloworld");
return elem.getText(".helloworld").should.eventually.equal("Hello World!");
return (elem.getText(".helloworld") === "Hello World!");
});
});
});

View File

@@ -1,5 +1,4 @@
const helpers = require("../global-setup");
const expect = require("chai").expect;
const describe = global.describe;
const it = global.it;
@@ -41,7 +40,7 @@ describe("Newsfeed module", function () {
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);
return expect(events.length).toBe(0);
});
});
@@ -57,7 +56,7 @@ describe("Newsfeed module", function () {
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);
return expect(events.length).toBe(1);
});
});

View File

@@ -1,4 +1,3 @@
const expect = require("chai").expect;
const fs = require("fs");
const moment = require("moment");
const path = require("path");
@@ -31,7 +30,7 @@ describe("Weather module", function () {
async function getText(element, result) {
const elem = await getElement(element);
return await elem.getText(element).then(function (text) {
expect(text.trim()).to.equal(result);
expect(text.trim()).toBe(result);
});
}
@@ -124,7 +123,7 @@ describe("Weather module", function () {
const elem = await getElement(".weather .normal.medium sup i.fa-long-arrow-up");
return elem.getHTML(".weather .normal.medium sup i.fa-long-arrow-up").then(function (text) {
expect(text).to.include("transform:rotate(250deg);");
expect(text).toContain("transform:rotate(250deg);");
});
});
@@ -248,7 +247,7 @@ describe("Weather module", function () {
for (const [index, opacity] of opacities.entries()) {
const html = await elem.getHTML(`.weather table.small tr:nth-child(${index + 1})`);
expect(html).to.includes(`<tr style="opacity: ${opacity};">`);
expect(html).toContain(`<tr style="opacity: ${opacity};">`);
}
});
});
@@ -271,7 +270,7 @@ describe("Weather module", function () {
const rows = await app.client.$$(".weather table.myTableClass tr.colored");
expect(rows.length).to.be.equal(5);
expect(rows.length).toBe(5);
});
});