PDA

View Full Version : How do I set up a Sencha Test environment on Windows usable for CI?



warrenpostma
14 Sep 2016, 7:17 AM
There are so many moving parts that it begins to get a bit complex. Does anybody do this on Windows or do they only set up their test-farms on Linux?

1. Setting up Jenkins is easy, that's not my question, it's just a pre-condition of the question. STC (the sencha test command line) should operate from a build server context, whether its Jenkins or Continua or GitlabCI or something else.

2. STC needs a Selenium-WebDriver and Selenium-WebDriver needs to launch browsers. This is where it gets sticky. I can run Selenium server service when I log in interactively, like this, from windows terminal/command-prompt:

java -jar selenium-server-standalone-2.53.0.jar -Dwebdriver.chrome.driver=D:\seleniumWebdriver\chromedriver.exe -Dwebdriver.internetexplorer.driver=D:\seleniumWebdriver\IEDriverServer.exe -Dwebdriver.firefox.bin=C:\Program Files (x86)\Mozilla Firefox\firefox.exe

3. If I run like that and invoke stc like this, everything seems fine:

stc run -o text -p chrome -s specs


4. BUT when I move the selenium server into a Windows Service (wrap it with jsw or yajsw), it fails. I believe the problem is that the Google Chrome process which is being automated is NOT usable when run from a system account security context, even when "interact with desktop" is checked in the Windows service.

For now I'm considering abandoning the attempt to do automated browser testing services on Windows systems.

Surely people do this right? You need windows to test Edge and Internet Explorer.

Warren

marcelofarias
20 Sep 2016, 1:00 PM
I can think about a couple options off the top of my head:

1 - Use Windows auto login and a startup script (so it will belong to a user session)
2 - Use nssm (https://nssm.cc/) as suggested here (http://stackoverflow.com/questions/26461507/running-selenium-server-chromedriver-as-a-windows-service)

In our in-house setup we have Windows VMs configured as (1), being one hub and many nodes.

Also, I encourage you to have your selenium setup in dedicated boxes (VMs), so they can be used from any build agent in your network.

Let me know if any of these is a valid option for you.

warrenpostma
22 Sep 2016, 10:06 AM
> Use Windows auto login and a startup script (so it will belong to a user session)


I have found this is the simplest way to get started.

I also tried setting up a Jenkins CI system with selenium on Linux, and found this was not trivial either.

I'll update this post later when I have more details but:

1. It seems that running from a service context will permanently block the Chrome agent from functioning, and that this issue is widely seen out there on the web.

2. It seems that setting up STC (the command line client) to run from a normal Windows user session is absolutely essential at this time, and perhaps that should be in the manuals somewhere!

3. If you see an error like "Error: Couldn't connect to selenium server", then this means that either we didn't start the selenium server somewhere, or else, that we are having problems either due to a firewall, or session 0 isolation (a windows issue).

4. If you see general errors like "Ext.create" failing, it is possible you forgot to have your CI system do a development build first (sencha app build --development) before you ran your tests, assuming you're serving up the development app, and if you're testing against a production build, perhaps you didn't build/rebuild your production app.


Thanks very much for your help.

Warren