mirror of
https://github.com/zulip/zulip.git
synced 2025-11-22 07:21:23 +00:00
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.
This commit is contained in:
40
frontend_tests/casperjs/samples/extends.js
Normal file
40
frontend_tests/casperjs/samples/extends.js
Normal file
@@ -0,0 +1,40 @@
|
||||
/*jshint strict:false*/
|
||||
/*global CasperError console phantom require*/
|
||||
|
||||
var casper = require("casper").create({
|
||||
loadImages: false,
|
||||
logLevel: "debug",
|
||||
verbose: true
|
||||
});
|
||||
|
||||
var links = {
|
||||
"http://edition.cnn.com/": 0,
|
||||
"http://www.nytimes.com/": 0,
|
||||
"http://www.bbc.co.uk/": 0,
|
||||
"http://www.guardian.co.uk/": 0
|
||||
};
|
||||
|
||||
var fantomas = Object.create(casper);
|
||||
|
||||
fantomas.countLinks = function() {
|
||||
return this.evaluate(function() {
|
||||
return __utils__.findAll("a[href]").length;
|
||||
});
|
||||
};
|
||||
|
||||
fantomas.renderJSON = function(what) {
|
||||
this.echo(JSON.stringify(what, null, " "));
|
||||
};
|
||||
|
||||
fantomas.start();
|
||||
|
||||
Object.keys(links).forEach(function(url) {
|
||||
fantomas.thenOpen(url, function() {
|
||||
links[url] = this.countLinks();
|
||||
});
|
||||
});
|
||||
|
||||
fantomas.run(function() {
|
||||
this.renderJSON(links);
|
||||
this.exit();
|
||||
});
|
||||
Reference in New Issue
Block a user