-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDOM-plopper.js
53 lines (39 loc) · 1.27 KB
/
DOM-plopper.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
46
47
48
49
50
51
52
53
var fs = require('fs');
var protractor = require('protractor');
var ptor;
// create a directory for our captures
fs.mkdir('dom-captures', function () {
});
// a helper method for capturing the DOM
function snapDOM (filename) {
ptor.getPageSource().then(function (source) {
fs.writeFile(filename, source, function (err) {
if (err) throw err;
});
});
}
describe('E2E: main page', function() {
beforeEach(function() {
browser.get('/');
// create new protractor instance
ptor = protractor.getInstance();
});
// home ------------------------------------------------------------------------------
it('should capture the home page', function() {
browser.get('/');
expect(ptor.getCurrentUrl()).toMatch('/');
snapDOM('dom-captures/home.html');
});
// about -----------------------------------------------------------------------------
it('should capture the about page', function() {
browser.get('/about');
expect(ptor.getCurrentUrl()).toMatch('/about');
snapDOM('dom-captures/about.html');
});
// contact ---------------------------------------------------------------------------
it('should capture the contact page', function() {
browser.get('/contact');
expect(ptor.getCurrentUrl()).toMatch('/contact');
snapDOM('dom-captures/contact.html');
});
});