I am facing an issue with my build pipeline using VSTS.
Environment details are:
Agent server is Windows Server 2012 R2
The VSTS agent is running on network service
For running my client side test cases, I have created a gulp task. Karma runner is used with IE as the browser launcher.
The issue I am facing here is with IE as browser in karma.conf file. Whenever this gulp task is ran using VSTS then the karma runner is not connecting. The output is:
[33m20 09 2018 17:32:43.924:WARN [IE 11.0.0 (Windows 8.1.0.0)]: [39mDisconnected (1 times)
2018-09-20T12:02:43.9339866Z IE 11.0.0 (Windows 8.1.0.0) ERROR
2018-09-20T12:02:43.9342689Z Disconnectedundefined
2018-09-20T12:04:14.1287942Z [33m20 09 2018 17:34:14.125:WARN [IE 11.0.0 (Windows 8.1.0.0)]: [39mDisconnected (2 times)
2018-09-20T12:04:14.1289323Z IE 11.0.0 (Windows 8.1.0.0) ERROR
2018-09-20T12:04:14.1299244Z Disconnectedundefined
2018-09-20T12:05:43.7605115Z [33m20 09 2018 17:35:43.758:WARN [IE 11.0.0 (Windows 8.1.0.0)]: [39mDisconnected (3 times)
2018-09-20T12:05:43.7635052Z IE 11.0.0 (Windows 8.1.0.0) ERROR
2018-09-20T12:05:43.7641486Z Disconnectedundefined
2018-09-20T12:07:13.2066049Z [33m20 09 2018 17:37:13.205:WARN [IE 11.0.0 (Windows 8.1.0.0)]: [39mDisconnected (4 times)
2018-09-20T12:07:13.2110144Z IE 11.0.0 (Windows 8.1.0.0) ERROR
2018-09-20T12:07:13.2112337Z Disconnectedundefined
This same task works fine if the browser is set to GoogleChrome only. In case it is set either to IE only or GoogleChrome and IE then this task is not working. Also, if I run this task manually through cmd, then it is working fine.
Is there some issue with the VSTS agent service running account?
I think the problem is that IE (and Edge for that matter) can't be run under a service account - they have to be run in an environment which has an interactive desktop session.
The hack I used in the the question you linked to was to logon to the build agent using the Team City agent account and then manually start IE. This allowed me to accept that annoying first run dialog it has, and for it to layout what ever files it needs in the user profile folder to run. I would hazard a guess to say this is still unsupported, as when the Team City agent spawns an IE process it's still in a non-interactive session.
The approach I've taken recently with Selenium is as follows:
Configure a Windows 10 box to auto login with a Selenium service account.
Have an auto run script which immediately locks the machine and starts the Selenium node server in a console app.
Manually start IE as the Selenium user (runas /user:selenium-account "C:\Program Files\Internet Explorer\iexplore.exe") to accept that first run dialog.
Set all the registry settings needed for Selenium / IE.
You may be able to rig up something similar to work the VSTS / Karma. Do post a note here with your solution if you get it working.
If it would help you (and others), I can post my scripts to a GitHub repro. I had been planning to publish them as a Chocolatey package, but I didn't get round to that yet.
I hope that helps.
Update
From the Microsoft docs:
You can run your agent as either a service or an interactive process. Whether you run an agent as a service or interactively, you can choose which account you use to run the agent. Note that this is different from the credentials that you use when you register the agent with Azure Pipelines or TFS. The choice of agent account depends solely on the needs of the tasks running in your build and deployment jobs.
For example, to run tasks that use Windows authentication to access an external service, you must run the agent using an account that has access to that service. However, if you are running UI tests such as Selenium or Coded UI tests that require a browser, the browser is launched in the context of the agent account.
After you've configured the agent, we recommend you first try it in interactive mode to make sure it works. Then, for production use, we recommend you run the agent in one of the following modes so that it reliably remains in a running state. These modes also ensure that the agent starts automatically if the machine is restarted.
And
As an interactive process with auto-logon enabled. In some cases, you might need to run the agent interactively for production use - such as to run UI tests
Related
I'm facing up a strange problem in Puppeteer with authentication.
I've written a script to take some screenshot of a website which required authentication.
In my local computer (windows), when running in command line as node.exe my_script.js; it's working fine (in headless moden which is the default mode).
I've written an upper Java program to manipulate it (dynamically set the path, the node modules path, run the process "nodex.exe my_script.js" every 30minutes, manage timeout of the process,...). It's still working directly running from Eclipse, in headless mode.
Then... I've built/packaged a JAR and running it in a cmd window: java -jar my_jar.jar... and then the script can't authentitcated on the website in headless mode (the answser page just write a message like "you need to be authenticated", which is managed by the http server).
To check what happen, I've just add an option in my nodejs script (so I do not modify my java upper program code) to run chrome in non headless mode; with option headless : false. And... it's working!
I let the option to run in non headless mode, and I create a Windows service to run my jar via a bat file, with the help of nssm... Just to test. I'm really happy to see that all is running fine without seeing any chrome GUI (maybe Windows disable GUI for service, don't know how).
Have I maybe missed something? Or is there a bug in Puppeteer or Chrome to manage authentication in headless mode?
Regards
Alex
I currently have a java project which instantiates various browsers via selenium hub/node on various windows operating systems. Is there much involved to expand this to cater for running up a browser on a stock chromebook chromeOS?
The following are steps I tried back in November 2014. The result was unsuccessful and I opened a question on the Google forum with no response.
followed manufacturer's instructions to put the Chromebook in Developer Mode
set chromeos-firrmwareupdate to dev mode and removed rootfs verification from partitions 2 and 4
downloaded and installed Java (latest jre), required for Jenkins slave and Selenium
downloaded Jenkins slave.jar and selenium-server-standalone.jar (2.41.0)
put Jenkins and Selenium in /home and remounted to remove noexec
remounted tmp to resize to 2G (req for Jenkins)
added DISPLAY=:0.0 to ui.conf to set display
added chain rule to allow tcp input
added 'no-sandbox' and 'disable-setuid-sandbox' switches and excluded 'test-type' switch
Result: ChromeDriver started up, opened up a gray screen (a broken instance of Chrome), and closed with an "unable to open pages" error. Weird thing, though, was that the same command used to launch Chrome worked when run from the terminal.
I am trying to run the part1 application in the getting_started directory of the Google Native Client SDK, and I obtain the following message in my browser:
NativeClient: PnaclCoordinator: Compile process could not be created:
When I visit the http://localhost:5103 I see the string "Loading...", but it never changes to "Success".
What do I need to configure in Chrome in order to be able to use Native Client applications?
My setup:
OS: Ubuntu Linux 12.04 LTS
Browser: Google Chrome 40
Pepper: 39
Root access: no
Not an answer, but a question:
Can you try to get some more log messages out of chrome or the NaCl runtime?
Start chrome from the shell with the environment variable NACLVERBOSITY=4 set. That asks chrome to show what is going on in the NaCl runtime when it has created a NaCl process (for the compiler). Typical messages are something like:
Entered NaClCreateServiceSocket
...
NaClSetUpBootstrapChannel
...
Elf header
...
and some more details. If that shows up, we know that NaCl compiler process creation at least made it that far. Could you then post the log somewhere, and I can take a look?
If it doesn't show up, then the problem is earlier in chrome. In this case, running chrome w/ --enable-logging=stderr -v1 (http://www.chromium.org/for-testers/enable-logging) might give some idea of what is going on in chrome before NaCl process creation.
Same issue.
I changed the chrome://flags settings for NaCl for debugging but we are not using the NaCl debugger at all. I set it back to default and it started working. (So I guess that was the problem?)
I'm trying to run chrome 30, in Linux, from the command line (executing google-chrome file of the version downloaded and unpacked in a folder).
If i run it without the option --no-sandbox the result is the following
[24419:24419:1016/012228:FATAL:zygote_host_impl_linux.cc(142)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /home/user/user.browsers/chrome-30/opt/google/chrome/chrome-sandbox is owned by root and has mode 4755.
./chrome-30.sh: line 5: 24419 Aborted (core dumped) $CHROME_FOLDER/google-chrome
If I run it with the option --no-sandbox, following also this procedure to configure it, the result is the error:
È stata creata una nuova finestra nella sessione corrente del browser.
[1016/012454:ERROR:nacl_helper_linux.cc(269)] NaCl helper process running without a sandbox!
Most likely you need to configure your SUID sandbox correctly
This last procedure works fine with chrome v31.
Any help?
If you have root access, you should set up the SUID sandbox as per these instructions, and run without the --no-sandbox option.
If you don't have root access, you cannot set up a SUID sandbox and you have to use the --no-sandbox option, but only use it for testing because it is a security risk.
In your case, it looks like you tried running a new Chrome window with --no-sandbox while another session was already running (that's what the message in Italian says). Try closing the existing session before starting a new one. To close the existing session, find the Chrome icon in the system tray, right click it and choose Exit. If you don't see the system tray icon, you can also try killall google-chrome or killall chromium, depending on which version you're using.
This error message...
[24419:24419:1016/012228:FATAL:zygote_host_impl_linux.cc(142)] The SUID sandbox helper binary was found, but is not configured correctly.
Rather than run without sandboxing I'm aborting now.
You need to make sure that /home/user/user.browsers/chrome-30/opt/google/chrome/chrome-sandbox is owned by root and has mode 4755.
./chrome-30.sh: line 5: 24419 Aborted (core dumped) $CHROME_FOLDER/google-chrome
...implies that the program was unable to initiate/spawn a new Browsing Context i.e. Chrome Browser session.
As per the discussion in Issue 400842: Chromium, if you have installed Chromium v35 (or later) and your cpu doesn't have the SSE2 instruction set, e.g. AthlonXP, Pentium III, etc, then Chromium can't be initiated successfully. All the new Chromium browsers from version 35 onwards need SSE2. Any Chromium version earlier than 35 should run on such a system without any issue.
To enforce these measures, Chromium team have closed the issue as Status: WontFix and mentioned:
If you really want to build Chromium without SSE2, you are welcome to apply your own patches and build your own browser however you like, but the Chromium project is not accepting patches to build without SSE2.
Further, this feature was successfully tested in AMD Athlon 3400+ desktop with Lubuntu 14.04.2 and Chrome seems to work fine. But on an older AMD Athlon 1300 without SSE, Chrome now courteously displays a message that "my hardware does not support it".
In mac you can run the below command to run the chrome in sandbox mode. This will open the chrome and supress the security settings. This can be used for testing API's etc from angular or ionic
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --disable-web-security --user-data-dir=$HOME/chrome-in-sandbox-mode
I have a C# .NET unit test project that uses ChromeDriver to run automated UI tests on a web page. This is on Windows 7 64 bit. The tests run fine from within Visual Studio 2010.
I have set up a Jenkins box to run the tests locally (on master), which is a Windows 2008 Server. The tests build, but my MSTest command fails mysteriously:
"c:\program files (x86)\Microsoft Visual Studio
10.0\Common7\IDE\MSTest.exe" /resultsfile:c:\jenkins\jobs\FXO_UI_Tests\workspace\TestResults.TRX
/testcontainer:c:\jenkins\jobs\FXO_UI_Tests\workspace\bin\Debug\Calculators.FXOptions2.Automation2.dll
/testsettings:c:\jenkins\jobs\FXO_UI_Tests\workspace\FXO.testsettings
With this output:
Microsoft (R) Test Execution Command Line Tool Version 10.0.30319.1
Copyright (c) Microsoft Corporation. All rights reserved.
Loading c:\jenkins\jobs\FXO_UI_Tests\workspace\FXO.testsettings...
Loading c:\jenkins\jobs\FXO_UI_Tests\workspace\bin\Debug\Calculators.FXOptions2.Automation2.dll...
c:\jenkins\jobs\FXO_UI_Tests\workspace\bin\Debug\Calculators.FXOptions2.Automation2.dll
The file exists.
c:\jenkins\jobs\FXO_UI_Tests\workspace>exit 1
Build step 'Execute Windows batch command' marked build as failure
The irritating part is that the same MSTest command, pasted in a command window, runs perfectly fine. I dont see "The file exists" when I run manually.
I have tried running Jenkins as a service, but it currently is running standalone in a logged-in user account. The same Jenkins set up can open Chrome.exe so I can't understand why the command just ends.
Please help!
Found it! "The file exists." was the key. Turns out that the TEMP folder that the Jenkins uses is somehow different than the logged in user (despite being the same user). And that folder was absolutely full of every file name possible. Clearing out the temp folder fixed it.