Can Jenkins start up GenyMotion on Ubuntu 14, if I access the Jenkins website from my Mac? - jenkins

Is it possible for this setting to work?
1) Ubuntu 14 with Jenkins, Genymotion, and Virtual Box installed
2) The job inside Jenkins will restore and run Genymotion from a command line following this tutorial: http://blog.genymobile.com/genymotion-jenkins-android-testing/
From my Mac, I tried to access the Jenkins website and run the build.
Firstly, Genymotion failed because it couldn't "connect to X server".
So, I installed Xvnc Plugin on Jenkins which solved the error.
Unfortunately, Genymotion still failed to start up with the error "Cannot get IP address".
Please note that I only have "ssh -X" access to the server.
I can manually start up Genymotion but the process was terminated when I logged off. As a result, I could not leave the GenyMotion run on the Server as suggested by this solution: Jenkins - Use Genymotion VM instead of Android Emulator
Any advice?

Here is the way to make Genymotion works on a continuous integration server.
First, the computer running Genymotion needs to respect the hardware requirements
You won't be able to run Genymotion if you don't have an X server running.
I don't think xVNC supports OpenGL so I advise you to run your standard X server.
You can launch the Xorg server by running startx.
Then you need to set your ssh connection in Jenkins without the -X parameter because we want the rendering to be done locally
Then you need to declare the environement variable DISPLAY to the default X client's value. Most of the time it is :0
This value will ask to open all the windows you launch through the ssh connexion into the first X client. It is the one running on the computer screen.
To check the DISPLAY value you need to enter, you need to access the computer physically and type echo $DISPLAY. Most of the time this value is :0
Also, if your computer is not compatible with the hardware requirements, you can use another computer on your network to run your tests thanks to the Jenkins nodes. Here is a good tutorial to set it up.
And finally, I want to mention we will soon release a command line tool for Genymotion and a Gradle Plugin that will allows you to control your Genymotion devices running during your tests directly from your build.gradle file.

It`s a bit late, but maybe this could help you out
### Get IP address of selected VM
VM_IP=`VBoxManage guestproperty get $VM_SELECTED androvm_ip_management | awk - F ": " '{print $2}'`
I found this here (repo) respectively here (slides)

Related

Suppressing display in docker

I have a docker image with a medical data analysis app installed in it. The app works from both gui and console. Normally, in my linux, I run the app from the terminal as
./dsi_studio --action=trk ...
and it works quite smoothly. If you click on this app, it'll try to open a GUI. While I'm trying to use this inside the docker image, it tries to connect to the display in any case (even if I run as shown in the terminal). And, of course, since I didn't do any setup for showing GUI from docker, I get the following error, stating that it couldn't find a display to connect.
qt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
I don't know why the app is trying to open a display while running in terminal, because it doesn't open a GUI in my linux. I just want to suppress this warning somehow, as if there is a fake display. I don't want to connect my display to docker image, because this image is going to run in batch in an HPC.
So, How can I do this?
You should probably export the DISPLAY environment variable to point to your linux terminal.
Just to test, run
xhost +
in your linux terminal and add
-e DISPLAY=:0.0
to your docker command line

Opening multiple appium server Instances on same machine

Can I start 2 appium server instances on my machine at the same time so that I can execute my test script simultaneously on 2 different devices connected to the machine?
Actually what I'm trying is to run my test script on 2 devices connected to same windows machine. For this I am using TestNG to pass the Android Driver url to start session. This url will be dynamic as 2 devices will be using 2 Appium server instances. Can I create 2 instances of Appium server at same time? If so then can I use code to create those instances as I don't want to use GUI to start it.
This question has already been asked and answer (if I am reading what you want correctly).
Please refer to How to start the Appium server from command prompt in MAC machine?
On a windows machine there should be an appium executable which you run with the command line arguments --address 127.0.0.1 -p 4273
In essence all you need to do is use a different port for your tests.

How to run a X Windows application in Codenvy Cloud IDE?

Copdenvy's shellinabox runner allows you to start a shell in the browser in which you can compile and run your code. This is fine for applications that are console based. Is it possible to run an X Windows application in the cloud and see the graphical window?
Setting the DISPLAY variable in the shell to that of your Linux workstation could work, though it relies on you being in control of the local network for things like NAT and firewall settings. The attraction of the cloud IDE is that you only need a browser and an https connection.
Can you ssh -X into the Docker container from an X capable source? Where would you find the URL? How would you manage the ssh keys?
If you look at the Java/Swing "VNC + Java 7" runner for example you'll see that you're able to run an application which is using X DISPLAY through VNC. Codenvy supplies a web based X Windows environment that you can access by clicking on the hyperlink that is shown underneath the Console window, to the left of the Timeout counter. You can then look at the Docker recipe used to start this sample.
SSH in the docker container could be managed in Codenvy 3.x if you install inside the VM the sshd daemon and export the ssh/22 port. In upcoming Codenvy SaaS 4.x ssh will be enabled without any configuration.

change the default resolution for UI testing with jenkins

I'm trying to run UI automation with a Jenkins job that runs on a windows VM as a jenkins slave, as a part of a CI pipeline.
I have a problem that the screen resolution is set to be very low (1024, 768)
how can I change the default resolution, so that when jenkins opens a new connection it will be with a larger resolution?
If your UI automation involves running Chrome, you might find it helpful to run Headless Chrome. That way, the screen resolution of the slave won't matter as you can specify the resolution you want to be used.
I was able to achieve this with these Chrome startup arguments running on a Windows Server Jenkins slave:
--headless --window-size=1920,1080
In my case, with Nightwatch, this is a snippet of the nightwatch.json file:
"desiredCapabilities": {
"browserName": "chrome",
"chromeOptions": {
"args": ["--window-size=1920,1080", "--headless"]
},
// ...
Do you have your webapp container started as a local service (tomcat or jenkins slave?). The point is that windows services cannot have GUI and it's even a miracle, that WebDriver somehow manages to open a 1024,768 window :)
Start your webapp container as a console application with a normal user.
I've got the same issue while trying to run UI tests on Jenkins
Problem: By default jenkins ran as windows service and have not access to run tests on desktop.
So fix:
run >> services.msc >> stop the system service Jenkins.exe
right click on Jenkins.exe >> properties >> startup type - Manual >> save
create an executable file (.bat, .exe, ...) save it somewhere and type there:
java -jar "C:\path\to\Jenkins\jenkins.war" --httpPort=8081
add shortcut of this executable file to windows autorun directory
It will run Jenkins on Desktop (non windows service) what allows run your UI tests there
Theoretically, running powerscript command as the build step:
set-displayresolution 1920 1080 -Force
should do it, but I have some problems with right now...
What has definitely worked: connect to your VM with RDP using desired resolution, then disconnect. The tests will run in the last resolution used.
I am facing the same issue. And found two different resolutions.
If your requirement is to see the chrome browser then open the command prompt and execute the below command
Java -jar jenkins.war
If your goal is just to change the resolution then add the below options and you can see the configure resolution(in the below example resolution is 1920,1080):-
ChromeOptions options = new ChromeOptions();
options.addArguments("enable-automation");
options.addArguments("--headless");
options.addArguments("--window-size=1920,1080");
options.addArguments("--no-sandbox");
options.addArguments("--disable-extensions");
options.addArguments("--dns-prefetch-disable");
options.addArguments("--disable-gpu");

BB10 start applications from command line

I've followed the instructions here:
BB10 Cascades Command Line Development
Now I've got a makefile project, which can compile and deploy my application to a connected device. The only problem is, I can't start the application remotely. I've created a special test version, which simply runs an automated test and then quits, so the next logical step would be starting the application, and waiting for it to exit (it would be great if I could monitor stdout and stderr) or kill it if it takes too long.
What I'm trying to accomplish (to avoid the xy problem) is the integration with a Jenkins server we already use for other platforms. E.g.: on Android we use robotium to achieve the same degree of integration.
blackberry-nativepackager allows you to launch the application similar to androids adb.
Just call it like
blackberry-nativepackager -launchApp <path to bar file> -device <devices ip address> -password <your pwd>

Resources