Add a polyfill for the bind function. Update the screenshots script to stop worrying about olark and to wait for the logs to animate in.
This commit is contained in:
parent
58b663e19b
commit
b0d995392b
2 changed files with 65 additions and 28 deletions
|
@ -10,20 +10,6 @@ var casper = require('casper').create({
|
||||||
logLevel: "debug"
|
logLevel: "debug"
|
||||||
});
|
});
|
||||||
|
|
||||||
var disableOlark = function() {
|
|
||||||
casper.then(function() {
|
|
||||||
this.waitForText('Chat with us!', function() {
|
|
||||||
this.evaluate(function() {
|
|
||||||
console.log(olark);
|
|
||||||
window.olark.configure('box.start_hidden', true);
|
|
||||||
window.olark('api.box.hide');
|
|
||||||
});
|
|
||||||
}, function() {
|
|
||||||
// Do nothing, if olark never loaded we're ok with that
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
var options = casper.cli.options;
|
var options = casper.cli.options;
|
||||||
var isDebug = !!options['d'];
|
var isDebug = !!options['d'];
|
||||||
|
|
||||||
|
@ -56,12 +42,18 @@ casper.thenClick('.form-signin button[type=submit]', function() {
|
||||||
this.waitForText('Top Repositories');
|
this.waitForText('Top Repositories');
|
||||||
});
|
});
|
||||||
|
|
||||||
disableOlark();
|
casper.then(function() {
|
||||||
|
this.log('Generating user home screenshot.');
|
||||||
|
});
|
||||||
|
|
||||||
casper.then(function() {
|
casper.then(function() {
|
||||||
this.capture(outputDir + 'user-home.png');
|
this.capture(outputDir + 'user-home.png');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
casper.then(function() {
|
||||||
|
this.log('Generating repository view screenshot.');
|
||||||
|
});
|
||||||
|
|
||||||
casper.thenOpen(rootUrl + 'repository/devtable/' + repo + '?tag=v2.0', function() {
|
casper.thenOpen(rootUrl + 'repository/devtable/' + repo + '?tag=v2.0', function() {
|
||||||
// Wait for the tree to initialize.
|
// Wait for the tree to initialize.
|
||||||
this.waitForSelector('.image-tree', function() {
|
this.waitForSelector('.image-tree', function() {
|
||||||
|
@ -70,12 +62,14 @@ casper.thenOpen(rootUrl + 'repository/devtable/' + repo + '?tag=v2.0', function(
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
disableOlark();
|
|
||||||
|
|
||||||
casper.then(function() {
|
casper.then(function() {
|
||||||
this.capture(outputDir + 'repo-view.png');
|
this.capture(outputDir + 'repo-view.png');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
casper.then(function() {
|
||||||
|
this.log('Generating repository changes screenshot.');
|
||||||
|
});
|
||||||
|
|
||||||
casper.thenClick('#current-image dd a', function() {
|
casper.thenClick('#current-image dd a', function() {
|
||||||
this.waitForSelector('.result-count', function() {
|
this.waitForSelector('.result-count', function() {
|
||||||
this.capture(outputDir + 'repo-changes.png', {
|
this.capture(outputDir + 'repo-changes.png', {
|
||||||
|
@ -87,58 +81,74 @@ casper.thenClick('#current-image dd a', function() {
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
|
casper.then(function() {
|
||||||
|
this.log('Generating repository admin screenshot.');
|
||||||
|
});
|
||||||
|
|
||||||
casper.thenOpen(rootUrl + 'repository/devtable/' + repo + '/admin', function() {
|
casper.thenOpen(rootUrl + 'repository/devtable/' + repo + '/admin', function() {
|
||||||
this.waitForSelector('.repo-access-state');
|
this.waitForSelector('.repo-access-state');
|
||||||
});
|
});
|
||||||
|
|
||||||
disableOlark();
|
|
||||||
|
|
||||||
casper.then(function() {
|
casper.then(function() {
|
||||||
this.capture(outputDir + 'repo-admin.png');
|
this.capture(outputDir + 'repo-admin.png');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
casper.then(function() {
|
||||||
|
this.log('Generating organization repo list screenshot.');
|
||||||
|
});
|
||||||
|
|
||||||
casper.thenOpen(rootUrl + 'repository/?namespace=' + org, function() {
|
casper.thenOpen(rootUrl + 'repository/?namespace=' + org, function() {
|
||||||
this.waitForText('Repositories');
|
this.waitForText('Repositories');
|
||||||
});
|
});
|
||||||
|
|
||||||
disableOlark();
|
|
||||||
|
|
||||||
casper.then(function() {
|
casper.then(function() {
|
||||||
this.capture(outputDir + 'org-repo-list.png');
|
this.capture(outputDir + 'org-repo-list.png');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
casper.then(function() {
|
||||||
|
this.log('Generating organization teams screenshot.');
|
||||||
|
});
|
||||||
|
|
||||||
casper.thenOpen(rootUrl + 'organization/' + org, function() {
|
casper.thenOpen(rootUrl + 'organization/' + org, function() {
|
||||||
this.waitForSelector('.organization-name');
|
this.waitForSelector('.organization-name');
|
||||||
});
|
});
|
||||||
|
|
||||||
disableOlark();
|
|
||||||
|
|
||||||
casper.then(function() {
|
casper.then(function() {
|
||||||
this.capture(outputDir + 'org-teams.png');
|
this.capture(outputDir + 'org-teams.png');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
casper.then(function() {
|
||||||
|
this.log('Generating organization admin screenshot.');
|
||||||
|
});
|
||||||
|
|
||||||
casper.thenOpen(rootUrl + 'organization/' + org + '/admin', function() {
|
casper.thenOpen(rootUrl + 'organization/' + org + '/admin', function() {
|
||||||
this.waitForSelector('#repository-usage-chart');
|
this.waitForSelector('#repository-usage-chart');
|
||||||
});
|
});
|
||||||
|
|
||||||
disableOlark();
|
|
||||||
|
|
||||||
casper.then(function() {
|
casper.then(function() {
|
||||||
this.capture(outputDir + 'org-admin.png');
|
this.capture(outputDir + 'org-admin.png');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
casper.then(function() {
|
||||||
|
this.log('Generating organization logs screenshot.');
|
||||||
|
});
|
||||||
|
|
||||||
casper.thenClick('a[data-target="#logs"]', function() {
|
casper.thenClick('a[data-target="#logs"]', function() {
|
||||||
this.waitForSelector('svg > g', function() {
|
this.waitForSelector('svg > g', function() {
|
||||||
this.capture(outputDir + 'org-logs.png');
|
this.wait(1000, function() {
|
||||||
|
this.capture(outputDir + 'org-logs.png');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
casper.then(function() {
|
||||||
|
this.log('Generating oganization repository admin screenshot.');
|
||||||
|
});
|
||||||
|
|
||||||
casper.thenOpen(rootUrl + 'repository/' + org + '/' + orgrepo + '/admin', function() {
|
casper.thenOpen(rootUrl + 'repository/' + org + '/' + orgrepo + '/admin', function() {
|
||||||
this.waitForText('outsideorg')
|
this.waitForText('outsideorg')
|
||||||
});
|
});
|
||||||
|
|
||||||
disableOlark();
|
|
||||||
|
|
||||||
casper.then(function() {
|
casper.then(function() {
|
||||||
this.capture(outputDir + 'org-repo-admin.png');
|
this.capture(outputDir + 'org-repo-admin.png');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,30 @@
|
||||||
|
/**
|
||||||
|
* Bind polyfill from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind#Compatibility
|
||||||
|
*/
|
||||||
|
if (!Function.prototype.bind) {
|
||||||
|
Function.prototype.bind = function (oThis) {
|
||||||
|
if (typeof this !== "function") {
|
||||||
|
// closest thing possible to the ECMAScript 5 internal IsCallable function
|
||||||
|
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
|
||||||
|
}
|
||||||
|
|
||||||
|
var aArgs = Array.prototype.slice.call(arguments, 1),
|
||||||
|
fToBind = this,
|
||||||
|
fNOP = function () {},
|
||||||
|
fBound = function () {
|
||||||
|
return fToBind.apply(this instanceof fNOP && oThis
|
||||||
|
? this
|
||||||
|
: oThis,
|
||||||
|
aArgs.concat(Array.prototype.slice.call(arguments)));
|
||||||
|
};
|
||||||
|
|
||||||
|
fNOP.prototype = this.prototype;
|
||||||
|
fBound.prototype = new fNOP();
|
||||||
|
|
||||||
|
return fBound;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
var DEPTH_HEIGHT = 100;
|
var DEPTH_HEIGHT = 100;
|
||||||
var DEPTH_WIDTH = 132;
|
var DEPTH_WIDTH = 132;
|
||||||
|
|
||||||
|
|
Reference in a new issue