Skip to content

Commit 825513a

Browse files
committed
test: split navigation guards test code into two steps
1 parent e05631d commit 825513a

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

test/e2e/specs/navigation-guards.js

+18-11
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
module.exports = {
2-
'navigation guards': function (browser) {
3-
// alert commands not available in phantom
4-
if (process.env.PHANTOMJS) {
5-
return
6-
}
7-
2+
'navigation guards step one': function (browser) {
83
browser
94
.url('http://localhost:8080/navigation-guards/')
105
.waitForElementVisible('#app', 1000)
116
.assert.count('li a', 8)
127
.assert.containsText('.view', 'home')
138

9+
// alert commands not available in phantom
10+
if (process.env.PHANTOMJS) {
11+
return
12+
}
13+
14+
browser
1415
.click('li:nth-child(2) a')
1516
.dismissAlert()
1617
.waitFor(100)
@@ -100,16 +101,22 @@ module.exports = {
100101
.acceptAlert()
101102
.assert.urlEquals('http://localhost:8080/navigation-guards/bar')
102103
.assert.containsText('.view', 'bar')
104+
},
105+
'navigation guards step two': function (browser) {
106+
browser
107+
// back to home
108+
.url('http://localhost:8080/navigation-guards/')
109+
.assert.containsText('.view', 'home')
103110

104-
// in-component guard
111+
// in-component guard
105112
.click('li:nth-child(5) a')
106-
.assert.urlEquals('http://localhost:8080/navigation-guards/bar')
107-
.assert.containsText('.view', 'bar')
113+
.assert.urlEquals('http://localhost:8080/navigation-guards/')
114+
.assert.containsText('.view', 'home')
108115
.waitFor(300)
109116
.assert.urlEquals('http://localhost:8080/navigation-guards/qux')
110117
.assert.containsText('.view', 'Qux')
111118

112-
// async component + in-component guard
119+
// async component + in-component guard
113120
.click('li:nth-child(1) a')
114121
.assert.urlEquals('http://localhost:8080/navigation-guards/')
115122
.assert.containsText('.view', 'home')
@@ -120,7 +127,7 @@ module.exports = {
120127
.assert.urlEquals('http://localhost:8080/navigation-guards/qux-async')
121128
.assert.containsText('.view', 'Qux')
122129

123-
// beforeRouteUpdate
130+
// beforeRouteUpdate
124131
.click('li:nth-child(7) a')
125132
.assert.urlEquals('http://localhost:8080/navigation-guards/quux/1')
126133
.assert.containsText('.view', 'id:1 prevId:0')

0 commit comments

Comments
 (0)