forked from ng-bootstrap/ng-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
components.e2e-spec.ts
54 lines (41 loc) · 1.63 KB
/
components.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
import { browser, $ } from 'protractor';
import { getLinkElement, getComponentTabsLinks, getCodeToggleElement, getCodeElements } from '../tools.po';
describe(`Components`, () => {
beforeAll(async() => {
await getLinkElement(`components`).click();
});
const components = [
'accordion', 'alert', 'buttons', 'carousel', 'collapse', 'datepicker', 'dropdown',
'modal', 'pagination', 'popover', 'progressbar', 'rating', 'table',
'tabset', 'timepicker', 'toast', 'tooltip', 'typeahead'
];
components.forEach((component) => {
describe(`${component} page`, () => {
beforeAll(async() => {
await getLinkElement(`components/${component}`).click();
});
afterAll(async () => {
const browserLog = await browser.manage().logs().get('browser');
if (browserLog.length > 0) {
console.error(browserLog);
fail(`Unexpected console messages found`);
}
});
it(`should display the tabs`, async () => {
const links = getComponentTabsLinks(component);
const nbTabs = await links.count();
for (let i = 0; i < nbTabs; i++) {
await links.get(i).click();
}
});
it(`should display code samples`, async () => {
await getLinkElement(`components/${component}/examples`).click();
const initialCodeElements = await getCodeElements().count();
await getCodeToggleElement().click();
expect(await getCodeElements().count()).toBe(initialCodeElements + 1);
await getCodeToggleElement().click();
expect(await getCodeElements().count()).toBe(initialCodeElements);
});
});
});
});