PDA

View Full Version : [OPEN] PhantomJS and Webdriver



gzhong
4 Oct 2016, 11:59 AM
Hi,

Sencha FAQ stated that to use STC with PhantomJS one would just use webdriver. There was no further elaboration. I tried running phantomjs with --webdriver and also making it a selenium node in a grid, but to no avail. What happens is that stc just waits for a response. PhantomJS running with --webdriver shows nothing interesting. As a selenium node it says it tries this and that but ultimately stc doesn't think anything is coming back and times out after 120 sec.

Has anyone from Sencha or outside made stc work with phantomjs? Or any headless browser? It seems to me that it is more likely in the integration with CLI people would have phantomjs (especially since we are working with jasmine here) than a browser farm setup.

Thanks.

vojtech.cerveny
5 Oct 2016, 12:25 AM
Hi gzhong,
today I tried set up phantomJs and I am able to run test from SenchaTest in phantomJs.

You need add new WebGeneric pool to your workspace, then add new browser to your pool (HtmlUnit), rename HtmlUnit to phantomjs. Save it and restart your SenchaTest. Then you should be able to run your test in phantomjs (of course, webdriver should run :) ).

You can set it in SenchaTest as I described, or edit your workspace.
workspace.json

"browser": {
"farms": [
{
"name": "localFarm",
"type": "generic",
"host": "localhost",
"port": 4444,
"sessionLimit": 3,
"sessionCount": 0,
"pools": [
{
"name": "phantomjs",
"path": "test/farms/phantomjs.json"
}
]
}
]
},

test/farms/phantom.json

[
{
"browserName": "phantomjs",
"sencha": {
"concurrency": 1
},
"platform": "ANY"
}
]

And I use selenium-standalone (https://www.npmjs.com/package/selenium-standalone) .

Feel free to contact me any time.
Vojtěch

gzhong
5 Oct 2016, 7:32 AM
Thank you. I forgot to mention that phantomjs seems to work with Sencha Studio (that's the fancy test program). My difficulty is running stc, the commandline version. Does it work with you on commandline? It doesn't for Windows or Mac. The way I ran it was:

stc run -s test/unit -p phantomjs

Where phantomjs is a pool set up similarly to what you described above and, again, it works with Sencha Studio.

Thanks!