Skip to content

Commit b6924c7

Browse files
committed
e2e test for commits example
1 parent e0a613a commit b6924c7

File tree

2 files changed

+41
-8
lines changed

2 files changed

+41
-8
lines changed

examples/commits/index.html

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@
2323
<body>
2424
<div id="demo">
2525
<h1>Latest Vue.js Commits</h1>
26-
<template v-repeat="b:branches">
27-
<input type="radio"
28-
name="branch"
29-
id="{{*b}}"
30-
value="{{*b}}"
31-
v-model="currentBranch">
32-
<label for="{{*b}}">{{*b}}</label>
33-
</template>
26+
<template v-repeat="b:branches">
27+
<input type="radio"
28+
name="branch"
29+
id="{{*b}}"
30+
value="{{*b}}"
31+
v-model="currentBranch">
32+
<label for="{{*b}}">{{*b}}</label>
33+
</template>
34+
<p>yyx990803/vue@{{currentBranch}}</p>
3435
<ul>
3536
<li v-repeat="commits">
3637
<a href="{{html_url}}" target="_blank" class="commit">{{sha.slice(0, 7)}}</a>

test/e2e/commits.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
casper.test.begin('commits', 14, function (test) {
2+
3+
casper
4+
.start('../../examples/commits/index.html')
5+
.then(function () {
6+
// radio inputs & labels
7+
test.assertElementCount('input', 3)
8+
test.assertElementCount('label', 3)
9+
test.assertSelectorHasText('label[for="master"]', 'master')
10+
test.assertSelectorHasText('label[for="dev"]', 'dev')
11+
test.assertSelectorHasText('label[for="next"]', 'next')
12+
// initial fetched commits
13+
test.assertField('branch', 'master')
14+
test.assertSelectorHasText('p', 'yyx990803/vue@master')
15+
test.assertElementCount('li', 3)
16+
})
17+
.thenClick('input[value="dev"]', function () {
18+
test.assertField('branch', 'dev')
19+
test.assertSelectorHasText('p', 'yyx990803/vue@dev')
20+
test.assertElementCount('li', 3)
21+
})
22+
.thenClick('input[value="next"]', function () {
23+
test.assertField('branch', 'next')
24+
test.assertSelectorHasText('p', 'yyx990803/vue@next')
25+
test.assertElementCount('li', 3)
26+
})
27+
// run
28+
.run(function () {
29+
test.done()
30+
})
31+
32+
})

0 commit comments

Comments
 (0)