mirror of
https://github.com/zulip/zulip.git
synced 2025-11-16 20:02:15 +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:
32
frontend_tests/casperjs/samples/metaextract.js
Normal file
32
frontend_tests/casperjs/samples/metaextract.js
Normal file
@@ -0,0 +1,32 @@
|
||||
/*jshint strict:false*/
|
||||
/*global CasperError console phantom require*/
|
||||
|
||||
var casper = require("casper").create();
|
||||
var url = casper.cli.get(0);
|
||||
var metas = [];
|
||||
|
||||
if (!url) {
|
||||
casper
|
||||
.echo("Usage: $ casperjs metaextract.js <url>")
|
||||
.exit(1)
|
||||
;
|
||||
}
|
||||
|
||||
casper.start(url, function() {
|
||||
metas = this.evaluate(function() {
|
||||
var metas = [];
|
||||
[].forEach.call(document.querySelectorAll("meta"), function(elem) {
|
||||
var meta = {};
|
||||
[].slice.call(elem.attributes).forEach(function(attr) {
|
||||
meta[attr.name] = attr.value;
|
||||
});
|
||||
metas.push(meta);
|
||||
});
|
||||
return metas;
|
||||
});
|
||||
});
|
||||
|
||||
casper.run(function() {
|
||||
require("utils").dump(metas);
|
||||
this.exit();
|
||||
});
|
||||
Reference in New Issue
Block a user