|
1 | | -import { AppPage } from './app.po'; |
| 1 | +import { AppDashboard } from './app.po'; |
2 | 2 |
|
3 | | -describe('workspace-project App', () => { |
4 | | - let page: AppPage; |
| 3 | +describe('CoreUI template', () => { |
| 4 | + let page: AppDashboard; |
| 5 | + const sleep = 300; |
5 | 6 |
|
6 | | - beforeEach(() => { |
7 | | - page = new AppPage(); |
| 7 | + page = new AppDashboard(); |
| 8 | + const browser = page.getBrowser(); |
| 9 | + browser.driver.manage().window().setSize(600, 800); |
| 10 | + browser.sleep(sleep); |
| 11 | + page.navigateTo(); |
| 12 | + |
| 13 | + // beforeEach(() => { |
| 14 | + // page = new AppDashboard(); |
| 15 | + // page.navigateTo(); |
| 16 | + // }); |
| 17 | + |
| 18 | + it('should display CoreUI Dashboard', () => { |
| 19 | + expect(page.getParagraphText()).toEqual('CoreUI Dashboard'); |
| 20 | + }); |
| 21 | + |
| 22 | + it('should toggle `sidebar-minimized` body.class on `sidebar-minimizer` click', () => { |
| 23 | + browser.manage().window().maximize(); |
| 24 | + browser.sleep(1000); |
| 25 | + const body = page.getBody(); |
| 26 | + expect(body.getAttribute('class')).not.toContain('sidebar-minimized'); |
| 27 | + const button = page.getByCss('.sidebar-minimizer'); |
| 28 | + button.click(); |
| 29 | + browser.sleep(sleep); |
| 30 | + expect(body.getAttribute('class')).toContain('sidebar-minimized'); |
| 31 | + browser.sleep(sleep); |
| 32 | + button.click(); |
| 33 | + browser.sleep(sleep); |
| 34 | + expect(body.getAttribute('class')).not.toContain('sidebar-minimized'); |
| 35 | + browser.driver.manage().window().setSize(600, 800); |
| 36 | + browser.sleep(1000); |
8 | 37 | }); |
9 | 38 |
|
10 | | - it('should display welcome message', () => { |
11 | | - page.navigateTo(); |
12 | | - expect(page.getParagraphText()).toEqual('Welcome to app!'); |
| 39 | + it('should toggle `sidebar-show` body.class on `navbar-toggler` click', () => { |
| 40 | + browser.driver.manage().window().setSize(600, 800); |
| 41 | + browser.sleep(1000); |
| 42 | + const body = page.getBody(); |
| 43 | + expect(body.getAttribute('class')).not.toContain('sidebar-show'); |
| 44 | + const button1 = page.getByCss('.navbar-toggler.d-lg-none').first(); |
| 45 | + browser.sleep(sleep); |
| 46 | + button1.click(); |
| 47 | + browser.sleep(sleep); |
| 48 | + expect(body.getAttribute('class')).toContain('sidebar-show'); |
| 49 | + const button2 = page.getByCss('.navbar-toggler').first(); |
| 50 | + browser.sleep(sleep); |
| 51 | + button2.click(); |
| 52 | + browser.sleep(sleep); |
| 53 | + expect(body.getAttribute('class')).not.toContain('sidebar-show'); |
13 | 54 | }); |
14 | 55 | }); |
0 commit comments