Skip to content

Commit 92e178a

Browse files
committed
test: split navigation guards tests
1 parent b5131d4 commit 92e178a

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

test/e2e/specs/navigation-guards.js

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
module.exports = {
2-
'navigation guards step one': function (browser) {
2+
'navigation guards with alerts': function (browser) {
33
browser
44
.url('http://localhost:8080/navigation-guards/')
55
.waitForElementVisible('#app', 1000)
66
.assert.count('li a', 8)
77
.assert.containsText('.view', 'home')
88

99
// alert commands not available in phantom
10-
if (process.env.PHANTOMJS) {
11-
return
12-
}
10+
if (process.env.PHANTOMJS) return
1311

1412
browser
1513
.click('li:nth-child(2) a')
@@ -64,16 +62,8 @@ module.exports = {
6462
.assert.urlEquals('http://localhost:8080/navigation-guards/foo')
6563
.assert.containsText('.view', 'foo')
6664

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
7767
.url('http://localhost:8080/navigation-guards/foo')
7868
.dismissAlert()
7969
.waitFor(100)
@@ -102,10 +92,20 @@ module.exports = {
10292
.assert.urlEquals('http://localhost:8080/navigation-guards/bar')
10393
.assert.containsText('.view', 'bar')
10494
},
105-
'navigation guards step two': function (browser) {
95+
'navigation guards': function (browser) {
10696
browser
10797
// back to home
10898
.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/')
109109
.assert.containsText('.view', 'home')
110110

111111
// in-component guard

0 commit comments

Comments
 (0)