-
Notifications
You must be signed in to change notification settings - Fork 20
/
VisualRegressionSpec.js
69 lines (52 loc) · 2.07 KB
/
VisualRegressionSpec.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/* global describe, afterEach, it, expect */
var VisualDiffTool = window.GOVUK.VisualDiffTool;
var windowLocation;
describe('VisualDiffTool', function () {
describe('throws errors', function () {
it('throws error if not running on local page', function () {
expect(VisualDiffTool).toThrow();
});
});
describe('URL processing', function() {
beforeEach(function() {
spyOn(console, 'log').and.callThrough();
});
afterEach(function() {
// We need to call this again to 'turn off' the diff tool that's running from each test
VisualDiffTool();
windowLocation = null;
});
it('compares dev.gov.uk to gov.uk', function() {
windowLocation = {
href: 'http://government-frontend.dev.gov.uk',
host: 'government-frontend.dev.gov.uk'
};
VisualDiffTool(windowLocation);
expect(console.log.calls.mostRecent().args[0]).toContain("https://www.gov.uk");
});
it('compares local component guide to heroku deploy', function() {
windowLocation = {
href: 'http://government-frontend.dev.gov.uk/component-guide',
host: 'government-frontend.dev.gov.uk'
};
VisualDiffTool(windowLocation);
expect(console.log.calls.mostRecent().args[0]).toContain("https://government-frontend.herokuapp.com/component-guide");
});
it('compares pr heroku app to master heroku deploy', function() {
windowLocation = {
href: 'https://government-frontend-pr-100.herokuapp.com',
host: 'government-frontend-pr-100.herokuapp.com'
};
VisualDiffTool(windowLocation);
expect(console.log.calls.mostRecent().args[0]).toContain("https://government-frontend.herokuapp.com");
});
it('compares local static url to live static deploy', function() {
windowLocation = {
href: 'https://static.dev.gov.uk/component-guide/title',
host: 'static.dev.gov.uk'
};
VisualDiffTool(windowLocation);
expect(console.log.calls.mostRecent().args[0]).toContain("https://govuk-static.herokuapp.com/component-guide/title");
});
});
});