Command line testing
You must first run grunt serve.
Command lines must be run from the root of the gpf-js folder.
- With mocha:
http://localhost:8000/test/host/mocha/web.htmlnode test/host/mocha/nodejs.js
- Without mocha:
http://localhost:8000/test/host/web.htmlnode test/host/nodejs.jsphantomjs test/host/phantomjs.jscscript /E:jscript test\host\cscript.jsjava -jar node_modules\rhino-1_7r5-bin\rhino1_7R5\js.jar test\host\rhino.js
- With grunt:
- testing with PhantomJS (as a browser):
grunt connectIf mochagrunt connectIf mocha:sourcegrunt connectIf mocha:debuggrunt connectIf mocha:release
- testing with NodeJS:
grunt mochaTestgrunt mochaTest:sourcegrunt mochaTest:debuggrunt mochaTest:release
- testing with cscript (Windows only):
grunt exec:testWscriptgrunt exec:testWscriptVerbose(alias:grunt wscript)grunt exec:testWscriptDebuggrunt exec:testWscriptRelease
- testing with a simulated cscript environment (Non-windows):
grunt exec:testNodewscriptgrunt exec:testNodewscriptVerbose(alias:grunt nodewscript)grunt exec:testNodewscriptDebuggrunt exec:testNodewscriptRelease
- testing with Rhino (java required):
grunt exec:testRhinogrunt exec:testRhinoVerbose(alias:grunt rhino)grunt exec:testRhinoDebuggrunt exec:testRhinoRelease
- testing with Nashorn (java required):
grunt exec:testNashorngrunt exec:testNashornVerbose(alias:grunt nashorn)grunt exec:testNashornDebuggrunt exec:testNashornRelease
- testing with browsers using Selenium:
- you must first run
node detectSeleniumto check drivers installation (see below) grunt firefoxgrunt chromegrunt iegrunt safari
- you must first run
- testing with PhantomJS (as a browser):
Selenium drivers
To enable browser automation with Selenium, a driver must be installed for most browsers. It is recommended to put them in the current PATH.
Please check selenium-webdriver documentation page.
Safari
Command line browser testing
Coming with version 0.1.7, it is now possible to test a specific browser using a command line.
There are several assumptions:
- The command line is spawned with only one parameter: the URL to open,
- The command line must remain active until the test is completed,
- When the test completes, the spawned process is closed with a SIGKILL signal.
To configure the command line:
- Make sure to run
gruntat least once: this will initialize thetmp/config.jsonfile. - Open the
tmp/config.jsonfile, look for the"browsers"part - For each browser you want to test, add a dictionary with
"type": "spawn"and the binary path to the command line specified in the"bin"property. Optionally, parameters that would be prepended before the testing URL might be specified with an array property"args"
For instance, Safari testing on Windows:
"browsers": {
"chrome": {
"type": "selenium"
},
"safari": {
"type": "spawn",
"bin": "C:\\Program Files (x86)\\Safari\\Safari.exe"
}
},