summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSolly Ross <sross@redhat.com>2015-05-28 15:07:43 -0400
committerSolly Ross <sross@redhat.com>2015-08-06 14:47:03 -0400
commit07f514d887c27369f7675296a2cb1cb6d664cd91 (patch)
treecbb1382b3525fb884ebe4d659b1e3b28c43e215d
parent9ff86fb718477515ede2d6457f06643935d76bcd (diff)
downloadnovnc-07f514d887c27369f7675296a2cb1cb6d664cd91.tar.gz
Allow the use of the PhantomJS remote debugger
This commit adds the '--debugger <port>' option, which triggers the PhantomJS remote debugger. The initial output of the terminal when running the debugger gives more information on how to use it.
-rw-r--r--tests/run_from_console.casper.js14
-rwxr-xr-xtests/run_from_console.js3
2 files changed, 15 insertions, 2 deletions
diff --git a/tests/run_from_console.casper.js b/tests/run_from_console.casper.js
index 57ed2be..6a738a3 100644
--- a/tests/run_from_console.casper.js
+++ b/tests/run_from_console.casper.js
@@ -15,7 +15,19 @@ var casper_opts = {
}
};
-var provide_emitter = function(file_paths) {
+var provide_emitter = function(file_paths, debug_port) {
+ if (debug_port) {
+ casper_opts.child['remote-debugger-port'] = debug_port;
+ var debug_url = ('https://localhost:' + debug_port +
+ '/webkit/inspector/inspector.html?page=');
+ console.info('[remote-debugger] Navigate to ' + debug_url + '1 and ' +
+ 'run `__run();` in the console to continue loading.' +
+ '\n[remote-debugger] Navigate to ' + debug_url + '2 to ' +
+ 'view the actual page source.\n' +
+ '[remote-debugger] Use the `debugger;` statement to ' +
+ 'trigger an initial breakpoint.');
+ }
+
var spooky = new Spooky(casper_opts, function(err) {
if (err) {
if (err.stack) console.warn(err.stack);
diff --git a/tests/run_from_console.js b/tests/run_from_console.js
index 2a5bb70..f5c5bb4 100755
--- a/tests/run_from_console.js
+++ b/tests/run_from_console.js
@@ -20,6 +20,7 @@ program
.option('--output-html', 'Instead of running the tests, just output the generated HTML source to STDOUT (should be used with .js tests)')
.option('-d, --debug', 'Show debug output (the "console" event) from the provider')
.option('-r, --relative', 'Use relative paths in the generated HTML file')
+ .option('--debugger <port>', 'Enable the remote debugger for CasperJS')
.parse(process.argv);
if (program.tests.length === 0) {
@@ -202,7 +203,7 @@ if (!program.outputHtml && !program.generateHtml) {
.write("\n");
//console.log("Running tests %s using provider %s", program.tests.join(', '), prov.name);
- var provider = prov.provide_emitter(file_paths);
+ var provider = prov.provide_emitter(file_paths, program.debugger);
provider.on('test_ready', function(test_json) {
console.log('');