Revert "[Build] Bump PhantomJS Version"

This reverts commit 62f335573a.
This commit is contained in:
Pete Richards 2015-08-06 16:53:42 -07:00
parent 48a9eef924
commit b0a23590d4
3 changed files with 56 additions and 49 deletions

View File

@ -0,0 +1,53 @@
#!/usr/local/bin/phantomjs
# Runs a Jasmine Suite from an html page
# @page is a PhantomJs page object
# @exit_func is the function to call in order to exit the script
class PhantomJasmineRunner
constructor: (@page, @exit_func = phantom.exit) ->
@tries = 0
@max_tries = 10
get_status: -> @page.evaluate(-> console_reporter.status)
terminate: ->
switch @get_status()
when "success" then @exit_func 0
when "fail" then @exit_func 1
else @exit_func 2
# Script Begin
if phantom.args.length == 0
console.log "Need a url as the argument"
phantom.exit 1
page = new WebPage()
runner = new PhantomJasmineRunner(page)
# Don't supress console output
page.onConsoleMessage = (msg) ->
console.log msg
# Terminate when the reporter singals that testing is over.
# We cannot use a callback function for this (because page.evaluate is sandboxed),
# so we have to *observe* the website.
if msg == "ConsoleReporter finished"
if phantom.args.length > 1
filename = phantom.args[1]
fs = require('fs');
try
fs.write(filename, page.content)
catch e
console.log "Failed to write test page content."
runner.terminate()
address = phantom.args[0]
page.open address, (status) ->
if status != "success"
console.log "Can't load the address!"
phantom.exit 1
# Now we wait until onConsoleMessage reads the termination signal from the log.

View File

@ -1,46 +0,0 @@
var htmlrunner,
resultdir,
page,
fs;
var system = require('system');
if ( system.args.length !== 3 ) {
console.log("Usage: phantom_test_runner.js HTML_RUNNER RESULT_DIR");
phantom.exit();
} else {
htmlrunner = system.args[1];
resultdir = system.args[2];
page = require("webpage").create();
fs = require("fs");
// Echo the output of the tests to the Standard Output, report status
// when console runner completes.
page.onConsoleMessage = function(msg, source, linenumber) {
console.log(msg);
if (msg === "ConsoleReporter finished") {
var status = page.evaluate(function () {
return console_reporter.status;
});
if (status === "success") {
phantom.exit(0);
console.log("Test Success");
} else if (status === "fail") {
phantom.exit(1);
console.log("Test Fail");
} else {
phantom.exit(2);
console.log("Unexpected test result");
}
}
};
page.open(htmlrunner, function(status) {
if (status === "success") {
console.log("phantomjs> Successfully loaded '" + htmlrunner + "'.");
} else {
console.log("phantomjs> Could not load '" + htmlrunner + "'.");
phantom.exit(1);
}
});
}

View File

@ -84,7 +84,7 @@
<plugin>
<groupId>com.github.klieber</groupId>
<artifactId>phantomjs-maven-plugin</artifactId>
<version>0.7</version>
<version>0.2.1</version>
<executions>
<execution>
<goals>
@ -93,7 +93,7 @@
</execution>
</executions>
<configuration>
<version>2.0.0</version>
<version>1.9.2</version>
</configuration>
</plugin>
@ -115,7 +115,7 @@
<configuration>
<workingDirectory>.</workingDirectory>
<arguments>
<argument>platform/framework/test/lib/run_jasmine_test.js</argument>
<argument>platform/framework/test/lib/run_jasmine_test.coffee</argument>
<argument>test.html</argument>
<argument>${project.build.directory}/platform-test-results.html</argument>
</arguments>