|
1 |
| -describe('navigation', function() { |
2 |
| - beforeEach(function() { |
3 |
| - browser.get('index.html#/form'); |
| 1 | +const env = require('./../environment.js'); |
| 2 | + |
| 3 | +describe('navigation', () => { |
| 4 | + beforeEach(async () => { |
| 5 | + await browser.get('index.html#/form'); |
4 | 6 | });
|
5 | 7 |
|
6 |
| - it('should deal with alerts', function() { |
7 |
| - var alertButton = $('#alertbutton'); |
8 |
| - alertButton.click(); |
9 |
| - var alertDialog = browser.switchTo().alert(); |
| 8 | + it('should deal with alerts', async () => { |
| 9 | + const alertButton = $('#alertbutton'); |
| 10 | + await alertButton.click(); |
| 11 | + const alertDialog = await browser.switchTo().alert(); |
10 | 12 |
|
11 |
| - expect(alertDialog.getText()).toEqual('Hello'); |
| 13 | + expect(await alertDialog.getText()).toEqual('Hello'); |
12 | 14 |
|
13 |
| - alertDialog.accept(); |
| 15 | + await alertDialog.accept(); |
14 | 16 | });
|
15 | 17 |
|
16 |
| - it('should refresh properly', function() { |
17 |
| - var username = element(by.model('username')); |
18 |
| - var name = element(by.binding('username')); |
19 |
| - username.clear(); |
20 |
| - expect(name.getText()).toEqual(''); |
21 |
| - |
22 |
| - browser.navigate().refresh(); |
| 18 | + it('should refresh properly', async () => { |
| 19 | + const username = element(by.model('username')); |
| 20 | + const name = element(by.binding('username')); |
| 21 | + await username.clear(); |
| 22 | + expect(await name.getText()).toEqual(''); |
23 | 23 |
|
24 |
| - expect(name.getText()).toEqual('Anon'); |
25 |
| - }); |
| 24 | + await browser.navigate().refresh(); |
26 | 25 |
|
27 |
| - // Back and forward do NOT work at the moment because of an issue |
28 |
| - // bootstrapping with Angular |
29 |
| - /* |
30 |
| - it('should navigate back and forward properly', function() { |
31 |
| - browser.get('index.html#/repeater'); |
32 |
| - expect(browser.getCurrentUrl()). |
33 |
| - toEqual(env.baseUrl+'/ng1/index.html#/repeater'); |
34 |
| -
|
35 |
| - browser.navigate().back(); |
36 |
| - expect(browser.getCurrentUrl()). |
37 |
| - toEqual(env.baseUrl+'/ng1/index.html#/form'); |
38 |
| -
|
39 |
| - browser.navigate().forward(); |
40 |
| - expect(browser.getCurrentUrl()). |
41 |
| - toEqual(env.baseUrl+'/ng1/index.html#/repeater'); |
| 26 | + expect(await name.getText()).toEqual('Anon'); |
42 | 27 | });
|
43 |
| - */ |
| 28 | + |
| 29 | + it('should navigate back and forward properly', async () => { |
| 30 | + await browser.get('index.html#/repeater'); |
| 31 | + expect(await browser.getCurrentUrl()).toEqual(`${env.baseUrl}/ng1/index.html#/repeater`); |
44 | 32 |
|
45 |
| - it('should navigate back and forward properly from link', function() { |
46 |
| - element(by.linkText('repeater')).click(); |
47 |
| - expect(browser.getCurrentUrl()). |
48 |
| - toEqual(browser.baseUrl + 'index.html#/repeater'); |
| 33 | + await browser.navigate().back(); |
| 34 | + expect(await browser.getCurrentUrl()).toEqual(`${env.baseUrl}/ng1/index.html#/form`); |
49 | 35 |
|
50 |
| - browser.navigate().back(); |
51 |
| - expect(browser.getCurrentUrl()). |
52 |
| - toEqual(browser.baseUrl + 'index.html#/form'); |
| 36 | + await browser.navigate().forward(); |
| 37 | + expect(await browser.getCurrentUrl()).toEqual(`${env.baseUrl}/ng1/index.html#/repeater`); |
| 38 | + }); |
53 | 39 |
|
54 |
| - browser.navigate().forward(); |
55 |
| - expect(browser.getCurrentUrl()). |
56 |
| - toEqual(browser.baseUrl + 'index.html#/repeater'); |
| 40 | + it('should navigate back and forward properly from link', async () => { |
| 41 | + await element(by.linkText('repeater')).click(); |
| 42 | + expect(await browser.getCurrentUrl()).toEqual(`${browser.baseUrl}index.html#/repeater`); |
| 43 | + |
| 44 | + await browser.navigate().back(); |
| 45 | + expect(await browser.getCurrentUrl()).toEqual(`${browser.baseUrl}index.html#/form`); |
| 46 | + |
| 47 | + await browser.navigate().forward(); |
| 48 | + expect(await browser.getCurrentUrl()).toEqual(`${browser.baseUrl}index.html#/repeater`); |
57 | 49 | });
|
58 | 50 | });
|
0 commit comments