|
1 |
| -import { CoreUIPage } from './app.po'; |
| 1 | +import { AppDashboard } from './app.po'; |
2 | 2 |
|
3 |
| -describe('core-ui App', function() { |
4 |
| - let page: CoreUIPage; |
| 3 | +describe('CoreUI template', () => { |
| 4 | + let page: AppDashboard; |
| 5 | + const sleep = 300; |
5 | 6 |
|
6 |
| - beforeEach(() => { |
7 |
| - page = new CoreUIPage(); |
| 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', async () => { |
| 19 | + expect(await page.getParagraphText()).toEqual('Traffic'); |
| 20 | + }); |
| 21 | + |
| 22 | + it('should display footer containing creativeLabs', async () => { |
| 23 | + expect(await page.getFooterText()).toContain('creativeLabs'); |
| 24 | + }); |
| 25 | + |
| 26 | + it('should toggle `sidebar-minimized` body.class on `sidebar-minimizer` click', () => { |
| 27 | + browser.manage().window().maximize(); |
| 28 | + browser.sleep(1000); |
| 29 | + const body = page.getBody(); |
| 30 | + expect(body.getAttribute('class')).not.toContain('sidebar-minimized'); |
| 31 | + const button = page.getByCss('.sidebar-minimizer'); |
| 32 | + button.click(); |
| 33 | + browser.sleep(sleep); |
| 34 | + expect(body.getAttribute('class')).toContain('sidebar-minimized'); |
| 35 | + browser.sleep(sleep); |
| 36 | + button.click(); |
| 37 | + browser.sleep(sleep); |
| 38 | + expect(body.getAttribute('class')).not.toContain('sidebar-minimized'); |
| 39 | + browser.driver.manage().window().setSize(600, 800); |
| 40 | + browser.sleep(1000); |
8 | 41 | });
|
9 | 42 |
|
10 |
| - it('should display footer containing creativeLabs', () => { |
11 |
| - page.navigateTo(); |
12 |
| - expect(page.getParagraphText()).toContain('creativeLabs'); |
| 43 | + it('should toggle `sidebar-show` body.class on `navbar-toggler` click', () => { |
| 44 | + browser.driver.manage().window().setSize(600, 800); |
| 45 | + browser.sleep(1000); |
| 46 | + const body = page.getBody(); |
| 47 | + expect(body.getAttribute('class')).not.toContain('sidebar-show'); |
| 48 | + const button1 = page.getByCss('.navbar-toggler.d-lg-none').first(); |
| 49 | + browser.sleep(sleep); |
| 50 | + button1.click(); |
| 51 | + browser.sleep(sleep); |
| 52 | + expect(body.getAttribute('class')).toContain('sidebar-show'); |
| 53 | + const button2 = page.getByCss('.navbar-toggler').first(); |
| 54 | + browser.sleep(sleep); |
| 55 | + button2.click(); |
| 56 | + browser.sleep(sleep); |
| 57 | + expect(body.getAttribute('class')).not.toContain('sidebar-show'); |
13 | 58 | });
|
14 | 59 | });
|
0 commit comments