Jenkins, running selenium tests on local dev machine - selenium

I have a Jenkins server running in private cloud and the dev team want to be able to run some selenium tests on their local dev rigs.
I've looked at Selenium Grid and installed the Selenium Grid plugin for Jenkins and whilst I can get nodes to register to the Jenkins server (Selenium Hub) I cannot invoke tests on the node.
The local dev machines are on our corporate network behind a firewall with no option for that to be changed.
Does the Selenium Hub try to make a new connection to the node when it needs to, or does it/can it use the connection initiated by the node as some kind of reverse tunnel?

Related

Integrated Windows Authentication (IWA) issue on Jenkins slave node in Selenium tests

Given: We have a Jenkins build running Selenium tests for application using using SSO authentication.Application and authentication provider are located in corporate intranet of type
"auth-service-name.corp-name.com". Tests are running fine on local Windows machine, but on Jenkins windows environment they can't pass IWA to access the tested website. Application tested works ONLY in Chrome, so it is the browser used in tests. In registries of Jenkins machine it was found out that there is a proxy set up, while on local machine there is no proxy.
Tried: sending http requests with login and pass for sso-provider page. starting chrome in jenkins via command line with(start chrome --auth-server-whitelist=
"*corp-name.com")
Question: Is there any way to bypass such an issue? What could cause that Jenkins machine can't pass IWA?

Selenium Standalone server

I want to run the selenium test cases in the remote machine.
These are the steps I have followed:
Steps I did in server machine:
I have downloaded selenium-server-standalone-3.9.1.jar + Chrome Driver & placed it in a folder and added it to $PATH environmental variable.
I have started selenium server using java -jar selenium-server-standalone-3.9.1.jar -role hub in the Terminal.
Steps I did in local machine:
I have installed selenium-webdriver & selenium-server-standalone-3.9.1.jar
I wrote a sample testcase using selenium webdriver.
I have started a node here using command java -jar selenium-server-standalone-3.9.1.ja-role node -hub http://172.24.111.70:4444/grid/register in the terminal. The node got connected to the hub.
I run the command node test.js in the terminal. I expect the chrome instance to open in the remote machine. But it is running in the local machine.
Screenshots:
Hub:(Remote)
Node:(Local)
Can you please explain me the mistake I have did here? Have I understood the concept wrong?
The web browser instance which will run your tests will get created on a node not the hub. The hub is how you can register a number of nodes so you can spread the load between different machines/nodes. From what I can tell, you have a hub on the remote machine which you connect a local node to.
What I think you want is to run the node on the remote machine also, registering to the hub on the same machine (you might have to change the IP address of the hub to localhost when registering the node).
So, the problem is you are wanting the tests to run on the Remote Machine, but they are running locally?
From the sounds of it you have done all the setup correctly, and the Hub/Nodes should be working fine. All you need to do, is instead of running the Node from your local machine, run it from the Remote Machine. You just need to think of the Hub as the Supervisor, who hands out work to the Nodes (their employees) to do. The Hub doesn't run any tests itself, it just sends the data to the Nodes and load balances between multiple Nodes.
We have a set up of 6 Remote Machines. Machine 1 has the Hub and a Node, and the other 5 have Nodes. In our project we are pointing towards the Hub, so when the tests run, they get sent there. The hub does the rest (depending on the nodecfg file and the settings you've got in there)

How to launch the browser on client side using selenium webdriver

I am new to selenium. I am developed one application using a selenium web driver for doing some actions on the webpage. It's perfectly working when I am running locally i.e., it launches a browser in my machine. I deployed this application on a VM server so the script runs on the server(launched browser in VM Ware Machine), not on the client-side. Can anyone help me with how can I launch the browser on the client-side?
You have to create Hub and Nodes using selenium grid
You can refer this link to see step by step
http://www.seleniumeasy.com/selenium-tutorials/how-to-configure-selenium-grid
Your server will be hub and your client machine will be node
If you trigger from one machine, you can launch a browser on another machine using the selenium-grid concept
But both machines are under the same LAN.
Here you want to execute on the client machine. It is not possible, because your machine and client machine won't be under the same network

PHPUnit Selenium tests fail on Docker localhost and pass using public IP

I'm trying to setup an automated testing platform with Docker and Selenium Grid.
In the diagram below you can see the structure that I'm using.
On top is the ubuntu server running on Compute Engine.
On the left is a docker container running ubuntu 14.04.
The container runs our project on localhost:8080 with Google App Engine.
On the right is the Selenium Hub with two nodes running on port 4444.
There is portforwarding from the host to the docker aswell as to the selenium hub. On 32772 and 32768 respectively.
When running my Selenium tests I send them to the hub, which in its turn will run the tests on the localhost of the docker.
My problem is that when I tell the hub to run the tests on 172.17.0.2:8080 it opens the startup screens, but it can't submit any forms.
When I submit the form the text areas get cleared. Like the page is refreshed in some way. The strange thing is that when I tell the hub to use the external ip of the host and the port of the docker like this xx.xx.xx.xx:32772, it does work.
And it has all the functionality. However for performance and automation reasons I'd like to run it on the internal ip adress.
Any help would be appreciated.
Tijn
The problem was in my .env file. The Session Domain was set to the host ip instead of the internal ip adress. By changing it, the website worked like it should.

Windows service that interacts with desktop screen resolution

I configured Jenkins as Selenium Grid and some Jenkins Nodes as Selenium Nodes (controlled by Jenkins Selenium plugin).
The nodes are connected with the option "Let Jenkins control this Windows Slave as Windows Service".
The service is defined automatically at the node as "interact with desktop".
Jenkins slave enables Selenium remote driver service
The problem is that the resolution of UI tests is really low (1036 x 780) where we need (1600x1200).
Opening an RDP session doesn't help since the service was started by Jenkins.
How to change the default resolution of windows service that can interact with Desktop?
I had the same problem as yours. Difference was I also have GUI automation besides Selenium tests. I ended up installing VNC service on all the nodes and wrote a script to change the desktop resolution before running any tests. However the highest resolution by doing that we got is 1280x1024, which resolved my problem.
If you don't mind giving up running Jenkins Slave as Windows Service you can use this way:
Jenkins on Windows and GUI Tests without RDC
Still - that would make you maintain an open RDP session that runs Jenkins JNLP process... So that solution is working, but not very optimal.