multirun.coffee
871 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
casper = require('casper').create verbose: true
countLinks = ->
document.querySelectorAll('a').length
suites = [
->
@echo 'Suite 1'
@start 'http://google.com/', -> @echo "Page title: #{@getTitle()}"
@then -> @echo "#{@evaluate(countLinks)} links"
->
@echo 'Suite 2'
@start 'http://yahoo.com/', -> @echo "Page title: #{@getTitle()}"
@then -> @echo "#{@evaluate(countLinks)} links"
->
@echo 'Suite 3'
@start 'http://bing.com/', -> @echo "Page title: #{@getTitle()}"
@then -> @echo "#{@evaluate(countLinks)} links"
]
casper.start()
casper.then ->
@echo('Starting')
currentSuite = 0;
check = ->
if suites[currentSuite]
suites[currentSuite].call @
currentSuite++;
casper.run check
else
@echo "All done."
@exit()
casper.run check