forked from CodeStory/code-story-devoxx-france
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestHomePage.js
46 lines (35 loc) · 1.73 KB
/
testHomePage.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Browser = require("zombie");
expect = require("expect.js");
home = "http://localhost:" + process.env.PORT + "/";
test("Checking page title", function (done) {
Browser.visit(home, function (e, browser) {
expect(browser.text("title")).to.be("CodeStory - HomePage");
done();
});
});
test("Checking commits", function (done) {
Browser.visit(home, function (e, browser) {
expect(browser.query("#commits .commit:nth-child(1) .description:contains('message1')")).to.be.ok();
expect(browser.query("#commits .commit:nth-child(2) .description:contains('message2')")).to.be.ok();
expect(browser.query("#commits .commit:nth-child(1) img[src='url1']")).to.be.ok();
expect(browser.query("#commits .commit:nth-child(2) img[src='url2']")).to.be.ok();
expect(browser.query("#commits .commit:nth-child(1) img[class='portrait SUCCESS']")).to.be.ok();
expect(browser.query("#commits .commit:nth-child(2) img[class='portrait FAILURE']")).to.be.ok();
done();
});
});
test("Checking project name", function (done) {
Browser.visit(home, function (e, browser) {
expect(browser.query("h2:contains('CodeStory')")).to.be.ok();
done();
});
});
test("Checking badges", function (done) {
Browser.visit(home, function (e, browser) {
expect(browser.query("#badges .badge:nth-child(1) p:contains('Top Committer')")).to.be.ok();
expect(browser.query("#badges .badge:nth-child(2) p:contains('Fatty Committer')")).to.be.ok();
expect(browser.query("#badges .badge:nth-child(1) img[src='/badges/topCommiter.png']")).to.be.ok();
expect(browser.query("#badges .badge:nth-child(2) img[src='/badges/fatty.png']")).to.be.ok();
done();
});
});