Files
zulip/frontend_tests/casperjs/samples/extends.coffee
Tim Abbott f1074aa491 Move frontend tests out of zerver/tests/.
This fixes an unfortunate bug where the backend tests in
zerver/tests.py were not being run automatically, and also makes these
a bit easier to find.
2015-10-28 10:11:47 -07:00

30 lines
612 B
CoffeeScript

casper = require("casper").create
loadImages: false
logLevel: "debug"
verbose: true
links =
"http://edition.cnn.com/": 0
"http://www.nytimes.com/": 0
"http://www.bbc.co.uk/": 0
"http://www.guardian.co.uk/": 0
fantomas = Object.create(casper)
fantomas.countLinks = ->
@evaluate ->
__utils__.findAll("a[href]").length
fantomas.renderJSON = (what) ->
@echo JSON.stringify(what, null, " ")
fantomas.start()
Object.keys(links).forEach (url) ->
fantomas.thenOpen url, ->
links[url] = @countLinks()
fantomas.run ->
@renderJSON(links)
@exit()