-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
Copy pathlayout-theme.e2e-spec.ts
67 lines (55 loc) · 1.82 KB
/
layout-theme.e2e-spec.ts
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
/**
* @license
* Copyright Akveo. All Rights Reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
import { browser, element, by } from 'protractor';
describe('nb-layout theme', () => {
beforeEach((done) => {
browser.get('#/layout/theme-change-test.component').then(() => done());
});
it('should render default theme', () => {
element(by.css('body')).getAttribute('class').then(value => {
expect(value).toMatch('theme-default');
});
});
it('should switch theme', () => {
const button = element(by.css('#change-theme'));
const body = element(by.css('body'));
const cardHeader = element(by.css('nb-card-header'));
const themeDefault = 'nb-theme-default';
const themeBlue = 'nb-theme-cosmic';
button.click().then(() => {
return browser.driver.wait(() => {
return body.getAttribute('class').then(value => {
return value === themeBlue;
});
}, 10000);
});
body.getAttribute('class').then(value => {
expect(value).toEqual(themeBlue);
});
cardHeader.getCssValue('color').then(value => {
expect(value).toEqual('rgba(255, 255, 255, 1)');
});
cardHeader.getCssValue('text-decoration').then(value => {
expect(value).toMatch('none');
});
button.click().then(() => {
return browser.driver.wait(() => {
return body.getAttribute('class').then(value => {
return value === themeDefault;
});
}, 10000);
});
body.getAttribute('class').then(value => {
expect(value).toEqual(themeDefault);
});
cardHeader.getCssValue('color').then(value => {
expect(value).toEqual('rgba(34, 43, 69, 1)');
});
cardHeader.getCssValue('text-decoration').then(value => {
expect(value).toMatch('none');
});
});
});