Skip to content

Commit

Permalink
Refs #4739, add travis only command line options to UI test runner: -…
Browse files Browse the repository at this point in the history
…-store-in-ui-tests-repo, --use-github-expected.
  • Loading branch information
diosmosis committed Mar 4, 2014
1 parent f073d10 commit 28a2f9b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
25 changes: 16 additions & 9 deletions tests/lib/screenshot-testing/support/app.js
Expand Up @@ -42,14 +42,18 @@ Application.prototype.printHelpAndExit = function () {
console.log("Usage: phantomjs run-tests.js [options] [test-files]");
console.log();
console.log("Available options:");
console.log(" --help: Prints this message.");
console.log(" --persist-fixture-data: Persists test data in a database and does not execute tear down.");
console.log(" After the first run, the database setup will not be called, which");
console.log(" Makes running tests faster.");
console.log(" --keep-symlinks: If supplied, the recursive symlinks created in tests/PHPUnit/proxy");
console.log(" aren't deleted after tests are run. Specify this option if you'd like");
console.log(" to view pages phantomjs captures in a browser.");
console.log(" --print-logs: Prints webpage logs even if tests succeed.");
console.log(" --help: Prints this message.");
console.log(" --persist-fixture-data: Persists test data in a database and does not execute tear down.");
console.log(" After the first run, the database setup will not be called, which");
console.log(" Makes running tests faster.");
console.log(" --keep-symlinks: If supplied, the recursive symlinks created in tests/PHPUnit/proxy");
console.log(" aren't deleted after tests are run. Specify this option if you'd like");
console.log(" to view pages phantomjs captures in a browser.");
console.log(" --print-logs: Prints webpage logs even if tests succeed.");
console.log(" --store-in-ui-tests-repo: Stores processed screenshots within the UI tests repository even if");
console.log(" the tests are in another plugin. For use with travis build.");
console.log(" --use-github-expected: Only show the github expected file links in diffviewer.html output.");
console.log(" For use with travis build.");

phantom.exit(0);
};
Expand All @@ -61,7 +65,10 @@ Application.prototype.init = function () {
var oldDescribe = describe;
describe = function () {
var suite = oldDescribe.apply(null, arguments);
suite.baseDirectory = app.currentModulePath.match(/\/plugins\//) ? path.dirname(app.currentModulePath) : uiTestsDir;
suite.baseDirectory = !options['store-in-ui-tests-repo'] && app.currentModulePath.match(/\/plugins\//)
? path.dirname(app.currentModulePath)
: uiTestsDir
;
return suite;
};
};
Expand Down
7 changes: 5 additions & 2 deletions tests/lib/screenshot-testing/support/diff-viewer.js
Expand Up @@ -70,8 +70,11 @@ DiffViewerGenerator.prototype.generate = function (callback) {
var expectedUrlGithub = 'https://raw.github.com/piwik/piwik-ui-tests/master/expected-ui-screenshots/'
+ entry.name + '.png';

var expectedHtml = '<a href="' + expectedUrl + '">Expected</a>&nbsp;<a href="' + expectedUrlGithub
+ '">[Github]</a>';
var expectedHtml = '';
if (!options['use-github-expected']) {
expectedHtml += '<a href="' + expectedUrl + '">Expected</a>&nbsp;';
}
expectedHtml += '<a href="' + expectedUrlGithub + '">[Github]</a>';
} else {
var expectedHtml = '<em>Not found</em>';
}
Expand Down

0 comments on commit 28a2f9b

Please sign in to comment.