-
Notifications
You must be signed in to change notification settings - Fork 4
/
status.spec.js
84 lines (70 loc) · 3.33 KB
/
status.spec.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
const StatusPage = require('./pages/status.page');
const CookieBar = require('./components/cookiebar.component');
describe('Status Page tests', function() {
let status = new StatusPage();
let cookiebar = new CookieBar();
let EC = protractor.ExpectedConditions;
beforeAll(function() {
browser.get("#!/status");
browser.wait(EC.visibilityOf(status.adapter), 100000);
});
beforeEach(function() {
cookiebar.closeIfPresent();
});
it("Should show filter buttons", function() {
expect(status.filterStarted.isDisplayed()).toBe(true);
expect(status.filterStopped.isDisplayed()).toBe(true);
expect(status.filterWarning.isDisplayed()).toBe(true);
});
it("When I click the started filter button the filter should become active", function() {
expect(status.filterStarted.isDisplayed()).toBe(true);
expect(status.filterStarted.getAttribute('class')).toContain('active');
status.filterStarted.click();
element(by.css("div.input-group input.form-control")).click(); //click element to remove focus
browser.sleep(5000);
expect(status.filterStarted.getAttribute('class')).not.toContain('active');
status.filterStarted.click();
});
it("Should show the correct url when filters are clicked", function() {
status.filterStarted.click();
expect(browser.getCurrentUrl()).toEqual(browser.baseUrl + "/#!/status?filter=stopped%2Bwarning");
status.filterStarted.click();
status.filterStopped.click();
expect(browser.getCurrentUrl()).toEqual(browser.baseUrl + "/#!/status?filter=started%2Bwarning");
status.filterStopped.click();
status.filterWarning.click();
expect(browser.getCurrentUrl()).toEqual(browser.baseUrl + "/#!/status?filter=started%2Bstopped");
status.filterWarning.click();
});
it("Should filter adapters when using the search field", function() {
status.searchField.sendKeys("HelloWorlds");
browser.sleep(1000);
expect(status.adapters.count()).toBe(1);
status.searchField.clear();
});
it("Should expand adapter info on single clicking the chevron", function() {
status.adapterInfoToggle.click();
browser.wait(EC.presenceOf(status.adapterInfo), 5000);
expect(status.adapterInfo.isDisplayed()).toEqual(true);
status.adapterInfoToggle.click();
});
it("Should use the correct URL when clicking configuration tabs", function() {
status.configurations.each(function(configuration, i) {
status.configurations.get(i).click();
browser.sleep(100);
status.configurations.get(i).getText().then(function(text) {
status.configurations.get(i).element(by.css('a')).click();
expect(browser.getCurrentUrl()).toEqual(browser.baseUrl + "/#!/status?configuration=" + text);
});
});
});
it("Should show the correct amount of adapters when clicking configuration tabs", function() {
status.configurations.each(function(configuration, i) {
status.configurations.get(i).click();
browser.sleep(100);
status.summaryAdaptersStarted.getText().then(function(text){
expect(parseInt(text)).toBe(status.adapters.count());
})
});
});
});