|
1 | 1 | module.exports = {
|
2 |
| - 'navigation guards step one': function (browser) { |
| 2 | + 'navigation guards with alerts': function (browser) { |
3 | 3 | browser
|
4 | 4 | .url('http://localhost:8080/navigation-guards/')
|
5 | 5 | .waitForElementVisible('#app', 1000)
|
6 | 6 | .assert.count('li a', 8)
|
7 | 7 | .assert.containsText('.view', 'home')
|
8 | 8 |
|
9 | 9 | // alert commands not available in phantom
|
10 |
| - if (process.env.PHANTOMJS) { |
11 |
| - return |
12 |
| - } |
| 10 | + if (process.env.PHANTOMJS) return |
13 | 11 |
|
14 | 12 | browser
|
15 | 13 | .click('li:nth-child(2) a')
|
@@ -64,16 +62,8 @@ module.exports = {
|
64 | 62 | .assert.urlEquals('http://localhost:8080/navigation-guards/foo')
|
65 | 63 | .assert.containsText('.view', 'foo')
|
66 | 64 |
|
67 |
| - .click('li:nth-child(4) a') |
68 |
| - .assert.urlEquals('http://localhost:8080/navigation-guards/baz') |
69 |
| - .assert.containsText('.view', 'baz (not saved)') |
70 |
| - .click('button') |
71 |
| - .assert.containsText('.view', 'baz (saved)') |
72 |
| - .click('li:nth-child(1) a') |
73 |
| - .assert.urlEquals('http://localhost:8080/navigation-guards/') |
74 |
| - .assert.containsText('.view', 'home') |
75 |
| - |
76 |
| - // test initial visit |
| 65 | + // test initial visit |
| 66 | + browser |
77 | 67 | .url('http://localhost:8080/navigation-guards/foo')
|
78 | 68 | .dismissAlert()
|
79 | 69 | .waitFor(100)
|
@@ -102,10 +92,20 @@ module.exports = {
|
102 | 92 | .assert.urlEquals('http://localhost:8080/navigation-guards/bar')
|
103 | 93 | .assert.containsText('.view', 'bar')
|
104 | 94 | },
|
105 |
| - 'navigation guards step two': function (browser) { |
| 95 | + 'navigation guards': function (browser) { |
106 | 96 | browser
|
107 | 97 | // back to home
|
108 | 98 | .url('http://localhost:8080/navigation-guards/')
|
| 99 | + .waitForElementVisible('#app', 1000) |
| 100 | + .assert.containsText('.view', 'home') |
| 101 | + |
| 102 | + .click('li:nth-child(4) a') |
| 103 | + .assert.urlEquals('http://localhost:8080/navigation-guards/baz') |
| 104 | + .assert.containsText('.view', 'baz (not saved)') |
| 105 | + .click('button') |
| 106 | + .assert.containsText('.view', 'baz (saved)') |
| 107 | + .click('li:nth-child(1) a') |
| 108 | + .assert.urlEquals('http://localhost:8080/navigation-guards/') |
109 | 109 | .assert.containsText('.view', 'home')
|
110 | 110 |
|
111 | 111 | // in-component guard
|
|
0 commit comments