Skip to content

Instantly share code, notes, and snippets.

@iperdomo
Created August 2, 2013 15:39
Show Gist options
  • Save iperdomo/6140900 to your computer and use it in GitHub Desktop.
Save iperdomo/6140900 to your computer and use it in GitHub Desktop.
ds-stats.js
var casper = require('casper').create({
verbose: true,
logLevel: 'info'
});
var instance_id = 'akvoflow-1';
var url = 'https://appengine.google.com/datastore/statistics?app_id=s~' + instance_id + '&kind=SurveyInstance';
casper.start(url, function() {
this.fill('form[action="https://accounts.google.com/ServiceLoginAuth"]', {
Email: 'xxxxx@gmail.com',
Passwd: 'pa$$w0Rd'
}, true);
});
casper.then(function() {
var dsSumary = 'table[id="ae-datastore-stats-top-level"]';
this.test.assertExists(dsSumary, 'table exists');
this.test.assertTrue(casper.evaluate(function() {
return document.getElementById('ae-datastore-stats-top-level').children[1].children[1].children[0].innerText;
}).indexOf('Entry count') === 0);
this.log(instance_id + " Survey Instance count: " + casper.evaluate(function() {
return document.getElementById('ae-datastore-stats-top-level').children[1].children[1].children[1].innerText;
}), "info");
});
casper.run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment