-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
menu.e2e-spec.ts
44 lines (35 loc) · 1.22 KB
/
menu.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
/**
* @license
* Copyright Akveo. All Rights Reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
import { browser, by, element } from 'protractor';
import { hasClass } from './e2e-helper';
const group = by.css('#menu-first ul li:nth-child(1) span');
const menu1 = by.css('#menu-first ul li:nth-child(2) a');
describe('nb-menu', () => {
beforeEach((done) => {
browser.get('#/menu/menu-test.component').then(() => done());
});
it('should display group title', () => {
element.all(group).first().getText()
.then(val => {
expect(val).toEqual('Menu Items');
});
});
it('should display menu', () => {
expect(element(by.css('#menu-first')).isDisplayed()).toBeTruthy();
expect(browser.getCurrentUrl()).toContain('#/menu/menu-test.component/1');
});
it('should be selected - Menu #1', () => {
element.all(menu1).first().getText()
.then(val => {
expect(val).toEqual('Menu #1');
});
element.all(menu1).first().click()
.then(() => {
expect(hasClass(element.all(menu1).first(), 'active')).toBeTruthy();
expect(browser.getCurrentUrl()).toContain('#/menu/menu-test.component/1');
});
});
});