Skip to content

Commit fd738e5

Browse files
authored
Merge pull request MagicMirrorOrg#677 from roramirez/test-displayseconds-false-clock
add test with displaySeconds config disabled for clock module
2 parents f66c2b0 + 6f95b2c commit fd738e5

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/* Magic Mirror Test config for default clock module
2+
*
3+
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
4+
* MIT Licensed.
5+
*/
6+
7+
var config = {
8+
port: 8080,
9+
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
10+
11+
language: "en",
12+
timeFormat: 12,
13+
units: "metric",
14+
electronOptions: {
15+
webPreferences: {
16+
nodeIntegration: true,
17+
},
18+
},
19+
20+
modules: [
21+
{
22+
module: "clock",
23+
position: "middle_center",
24+
config: {
25+
displaySeconds: false
26+
}
27+
}
28+
]
29+
};
30+
31+
/*************** DO NOT EDIT THE LINE BELOW ***************/
32+
if (typeof module !== "undefined") {module.exports = config;}

Diff for: tests/e2e/modules/clock_spec.js

+22
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,26 @@ describe("Clock module", function () {
9898
.getText(".clock .time").should.eventually.match(timeRegex);
9999
});
100100
});
101+
102+
describe("with displaySeconds config disabled", function() {
103+
before(function() {
104+
// Set config sample for use in test
105+
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_displaySeconds_false.js";
106+
});
107+
108+
beforeEach(function (done) {
109+
app.start().then(function() { done(); } );
110+
});
111+
112+
afterEach(function (done) {
113+
app.stop().then(function() { done(); });
114+
});
115+
116+
it("shows 12hr time without seconds am/pm", function() {
117+
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[ap]m$/;
118+
return app.client.waitUntilWindowLoaded()
119+
.getText(".clock .time").should.eventually.match(timeRegex);
120+
});
121+
});
122+
101123
});

0 commit comments

Comments
 (0)