From 04b8a009daf405b30ca1b5ea188d884423ef1364 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Fri, 11 Oct 2013 15:02:08 -0400 Subject: [PATCH] - Add a debug mode to the casper script - Have the casper script generate screenshots for the repo view and repo admin --- screenshots/README.md | 6 ++++++ screenshots/screenshots.js | 30 +++++++++++++++++++++++++++--- static/js/graphing.js | 3 ++- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/screenshots/README.md b/screenshots/README.md index 33a96c219..2903bdd70 100644 --- a/screenshots/README.md +++ b/screenshots/README.md @@ -3,3 +3,9 @@ run with: ``` casperjs screenshots.js ``` + +debug run (i.e. hit localhost): + +``` +casperjs screenshots.js --d +``` \ No newline at end of file diff --git a/screenshots/screenshots.js b/screenshots/screenshots.js index 8f4e35539..10548976e 100644 --- a/screenshots/screenshots.js +++ b/screenshots/screenshots.js @@ -1,13 +1,17 @@ var casper = require('casper').create({ viewportSize: { - width: 1024, + width: 1280, height: 768 }, verbose: true, logLevel: "debug" }); -var rootUrl = 'https://quay.io/'; +var options = casper.cli.options; +var isDebug = !!options['d']; + +var rootUrl = isDebug ? 'http://localhost:5001/' : 'https://quay.io/'; +var repo = isDebug ? 'simple' : 'r0'; casper.start(rootUrl); @@ -26,7 +30,7 @@ casper.then(function() { casper.thenOpen(rootUrl + 'signin', function () { this.fill('form', { 'username': 'devtable', - 'password': 'C>K98%y"_=54x"<', + 'password': isDebug ? 'password': 'C>K98%y"_=54x"<', }, true); }); @@ -38,4 +42,24 @@ casper.then(function() { this.capture('user-home.png'); }); +casper.thenOpen(rootUrl + 'repository/devtable/' + repo, function() { + // Wait for the tree to initialize. + this.waitForSelector('.image-tree', function() { + // Wait for the tree's animation to finish. + this.wait(4000); + }); +}); + +casper.then(function() { + this.capture('repo-view.png'); +}); + +casper.thenOpen(rootUrl + 'repository/devtable/' + repo + '/admin', function() { + this.waitForSelector('.repo-access-state'); +}); + +casper.then(function() { + this.capture('repo-admin.png'); +}); + casper.run(); diff --git a/static/js/graphing.js b/static/js/graphing.js index f9fdcd644..16c29317a 100644 --- a/static/js/graphing.js +++ b/static/js/graphing.js @@ -86,8 +86,9 @@ ImageHistoryTree.prototype.draw = function(container) { var vis = d3.select("#" + container).append("svg:svg") .attr("width", w + m[1] + m[3]) .attr("height", h + m[0] + m[2]) + .attr("class", "image-tree") .append("svg:g") - .attr("transform", "translate(" + m[3] + "," + m[0] + ")"); + .attr("transform", "translate(" + m[3] + "," + m[0] + ")"); var formatComment = this.formatComment_; var formatTime = this.formatTime_;