126 lines
2.8 KiB
JavaScript
126 lines
2.8 KiB
JavaScript
var width = 1024;
|
|
var height = 768;
|
|
|
|
var casper = require('casper').create({
|
|
viewportSize: {
|
|
width: width,
|
|
height: height
|
|
},
|
|
verbose: true,
|
|
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 isDebug = !!options['d'];
|
|
|
|
var rootUrl = isDebug ? 'http://localhost:5000/' : 'https://quay.io/';
|
|
var repo = isDebug ? 'complex' : 'r0';
|
|
var org = isDebug ? 'buynlarge' : 'quay'
|
|
|
|
var outputDir = "screenshots/";
|
|
|
|
casper.on("remote.message", function(msg, trace) {
|
|
this.echo("Message: " + msg, "DEBUG");
|
|
});
|
|
|
|
casper.on("page.error", function(msg, trace) {
|
|
this.echo("Page error: " + msg, "ERROR");
|
|
});
|
|
|
|
casper.start(rootUrl + 'signin', function () {
|
|
this.fill('.form-signin', {
|
|
'username': 'devtable',
|
|
'password': isDebug ? 'password': 'C>K98%y"_=54x"<',
|
|
}, false);
|
|
});
|
|
|
|
casper.thenClick('.form-signin button[type=submit]', function() {
|
|
this.waitForText('Top Repositories');
|
|
});
|
|
|
|
disableOlark();
|
|
|
|
casper.then(function() {
|
|
this.capture(outputDir + 'user-home.png');
|
|
});
|
|
|
|
casper.thenOpen(rootUrl + 'repository/devtable/' + repo + '?tag=v2.0', function() {
|
|
// Wait for the tree to initialize.
|
|
this.waitForSelector('.image-tree', function() {
|
|
// Wait for the tree's animation to finish.
|
|
this.wait(4000);
|
|
});
|
|
});
|
|
|
|
disableOlark();
|
|
|
|
casper.then(function() {
|
|
this.capture(outputDir + 'repo-view.png');
|
|
});
|
|
|
|
casper.thenClick('#current-image dd a', function() {
|
|
this.waitForSelector('.result-count', function() {
|
|
this.capture(outputDir + 'repo-changes.png', {
|
|
top: 0,
|
|
left: 0,
|
|
width: width,
|
|
height: height
|
|
});
|
|
});
|
|
})
|
|
|
|
casper.thenOpen(rootUrl + 'repository/devtable/' + repo + '/admin', function() {
|
|
this.waitForSelector('.repo-access-state');
|
|
});
|
|
|
|
disableOlark();
|
|
|
|
casper.then(function() {
|
|
this.capture(outputDir + 'repo-admin.png');
|
|
});
|
|
|
|
casper.thenOpen(rootUrl + 'organizations/new/', function() {
|
|
this.waitForText('Create');
|
|
});
|
|
|
|
disableOlark();
|
|
|
|
casper.then(function() {
|
|
this.capture(outputDir + 'org-create.png');
|
|
});
|
|
|
|
casper.thenOpen(rootUrl + 'organization/' + org, function() {
|
|
this.waitForSelector('.organization-name');
|
|
});
|
|
|
|
disableOlark();
|
|
|
|
casper.then(function() {
|
|
this.capture(outputDir + 'org-teams.png');
|
|
});
|
|
|
|
casper.thenOpen(rootUrl + 'organization/' + org + '/admin', function() {
|
|
this.waitForSelector('#repository-usage-chart');
|
|
});
|
|
|
|
disableOlark();
|
|
|
|
casper.then(function() {
|
|
this.capture(outputDir + 'org-admin.png');
|
|
});
|
|
|
|
casper.run();
|