Running tests on IE driver with Jenkins installed on Linux machine - linux

Currently I'm using Jenkins installed on Linux machine for automated testing Firefox and Chrome browsers.
My company want to start automated testing on IE. Is there any way to add virtual machine with Windows 7 os to Jenkins architecture (new node?) to run all tests from one Jenkins instance?
I want to have tasks with different builds :
- first to run tests on Chrome driver using mvn (works fine now)
- second to run tests on FF driver (works fine now)
- third to run tests on IE driver (need to be created)
If there is no way to do this should I prepare Windows machine with new Jenkins installation?

You can do this by using the hub option on your main selenium server
java -jar selenium-server-standalone-2.25.0.jar -role hub -hubHost localhost -hubPort 4444
And then on your windows machine (this is a chrome example as I am on my mac) do something like this
java -jar selenium-server-standalone-2.25.0.jar -role node -hubHost <ip of hub> -hubPort 4444\
-browser "browserName=chrome,maxinstance=2,platform=MAC" \
-Dwebdriver.chrome.driver="driver/chromedriver"
You will also need to download the iedriver to make it work selenium downloads
You then connect to selenium through port 4444 (as a convention) on the main selenium server and it places requests accordingly

Related

Jmeter Test run locally and generated report however remotely does not stop

I have Jmeter Test which is launched from the Master Machine(Win 10) to be run on a slave virtual machine (Ubuntu), when I run the test locally (Win10) it take few minutes and it finished successfully with an html report, but running it on the Remote Machine (Ubuntu virtual) it finshed too (i can see it in the slave machine), but on the master (Win 10) the non gui jmeter command still running and does not stop, an no html report or jtl file is generated.
Java version on master & slave -openjdk version "11.0.6" 2020-01-14
Java version on slave -openjdk "11.0.7" 2020-01-14
Jmeter Version: 5.2.1 (both master & slave)
VirtualBox: 6.0
VirtualMachine:Ubuntu 19.10 Eoan Ermine
here on the slave machine showing me the test is over:
and here on the master ,the non gui jmeter command still running and does not stop:
Check out jmeter-server.log file on the slave, it should contain error details if something is wrong with your setup
Make sure to use bridged adapter to the slave would have its own IP address and act like a "real" machine with independent network configuration
Double check RMI configuration for the master and the slave, it might be the case the slave is not capable of connecting to the master in order to transfer the test results
According to 9 Easy Solutions for a JMeter Load Test “Out of Memory” Failure article you should always be using the latest version of JMeter so consider upgrading to JMeter 5.3 (or whatever is the latest stable version available at JMeter Downloads page)

Run a gui based application on a remote Linux machine using telnet

I need to run a gui-based application on a remote PC to which I am connected over telnet. The remote PC runs Linux Ubuntu 18.04
To figure out the screen, I run the following command on the remote machine:
echo $DISPLAY
which gave me :1 as result.
Then I run the program on the remote machine from my client (over telnet) using:
DISPLAY=:1 application_name
The program started correctly (since, in addition to the GUI, it prints some things on the command line) but the GUI didn't show up. But, if I run my app directly on the remote machine, everything is fine.
As a test, I tried to run firefox browser on an another machine (always through telnet) with the following command:
DISPLAY=:0 firefox
and it worked. Note: on the other machine the output of echo $DISPLAY was :0. Furthermore, I could not test my app on the second machine.
It seems that there are different settings between the two machines since what I'm trying to do works on a machine, but not on the other.
Do you have any idea of what type of setting should I check?
Did you try to run your application on the first remote machine but with DISPLAY=:0 instead of :1?
What is the error message you get from application when you started application in the first case ("DISPLAY=:1 app_name").

Puppeteer: Chrome Remote Launch

Is there a way to launch chrome in non headless mode from a docker container?
I have a node application inside a docker container and a headless chrome container where i can connect to. All works fine so far. To demonstrate what puppeteer is doing i want to launch a chrome in non headless mode on the host system. Is this possible?
You can start Chromium manually on your host machine and then connect to its WebSocket port using puppeteer.connect() - https://pptr.dev/#?product=Puppeteer&version=v1.8.0&show=api-puppeteerconnectoptions . Don't forgot to open the WS port to container.
We also experimented with running Puppeteer in non-headless mode inside the Docker container using XVFB (X virtual framebuffer) and noVNC (https://github.com/novnc/noVNC) to display whats on the screen at HTML page served from the container. But that's not ideal for debugging.
If you just want to see which pages are opened and their screenshots you could use live-view https://github.com/apifytech/apify-js#puppeteer-live-view we build exactly for this use case.

Configure the npm to start in the background on Mac OS X

Description
I am on a Mac OS X.
Right now, I have almost 10 Laravel/LAMP projects locally, that I ran using vhost configured with Apache. The awesome part about them is even when I restart my Mac or move between networks, or even close the terminal app/tab of my projects, the Apache is still running, all my local sites will still be accessible.
Goal
Now, I am looking to do the same things with my MEAN apps.
How would one configure something like that ?
Let's say I have 3 MEAN apps.
Example
App1
FE running on port : http://localhost:4201
BE running on port : http://localhost:3001
App2
FE running on port : http://localhost:4202
BE running on port : http://localhost:3002
App3
FE running on port : http://localhost:4203
BE running on port : http://localhost:3003
I'm opening for anything suggestions at this moment.
Can we configure the npm to start in the background ?
BE/API
FE
You can use macOS's launchd to run services in the background. There are a couple good GUI apps that make it easier to create launch services:
LaunchControl ($10)
Lingon ($10) - If you go with Lingon, get Lingon X 5 from the official website instead of Lingon 3 from the Mac App Store; Lingon X 5 is more powerful because it is not limited by Apple's sandboxing.
There's also launched.zerowidth.com, an interactive online tool for creating the .plist files that launchd uses.
launchd.info is also a good resource if you want to set them up manually. Apple's documentation is available too.
If you are having problems with commands not working, I recommend trying these troubleshooting steps:
Convert all your commands to use absolute paths (e.g. npm -> /usr/local/bin/npm). You can find the absolute path of a command by running which with the name of the command (e.g. which npm)
Run your commands from within bash using /bin/bash -c (e.g /bin/bash -c "/usr/local/bin/npm start")
One thing you can do is dockerize your applications.
With docker you can run your applications in a light weight virtual machine known as containers in your computer.
This have some advantages, for example, you can run your app with port 80 inside the virtual machine and expose another port to your machine. You can start or stop the container and so forth.
Go to https://www.docker.com/what-docker for more information.

Running Selenium test in Tomcat on remote server gives "Error: GDK_BACKEND does not match available displays"

Im trying to execute a Selenium Test with WebDriver on a remote server but it fails with the message:
1503556834416 geckodriver INFO geckodriver 0.18.0
1503556834420 geckodriver INFO Listening on 127.0.0.1:13167
1503556834659 geckodriver::marionette INFO Starting browser /usr/bin/firefox with args ["-marionette"]
Error: GDK_BACKEND does not match available displays
The test is part of a Spring Boot webapp and is hosted in a Tomcat 8.5.20. The test execution is triggered by calling a url link of the Spring Boot webapp.
As Browser Firefox with geckodriver is used and this is the code which leads to the error:
System.setProperty("webdriver.gecko.driver", "/opt/geckodriver");
WebDriver driver = new FirefoxDriver();
driver.get("http://www.yahoo.com");
The server has a Debian 8 OS with LXDE as desktop environment.
No matter how i call this webapp link:
ssh login and using lynx on remote server
executing tightvncserver :1 on remote server, using a remote desktop client from my local machine and just calling this link in the firefox installed on the remote server
just calling the remote url from my local machine
... im getting always the GDK_BACKEND does not match available displays
error.
In my local environment (the only difference regards the test is a different Linux OS; everthing else like versions of Tomcat, webapp, geckodriver, ... are the same ) this test is executed without any problems. This is the log snippet:
1503556181640 geckodriver INFO geckodriver 0.18.0
1503556181643 geckodriver INFO Listening on 127.0.0.1:18039
1503556181805 geckodriver::marionette INFO Starting browser /usr/lib64/firefox/firefox with args ["-marionette"]
1503556182440 Marionette INFO Listening on port 44917
08:29:43.198 [Forwarding newSession on session null to remote] INFO org.openqa.selenium.remote.ProtocolHandshake - Detected dialect: W3C
... and now the test is executed ...
I suppose its connected with the configuration of the remote server and has nothing to do with Selenium but im having no idea what to do next...
Using Xvfb was the key...
So i removed the LXDE as it was not longer needed (and i thougth i need a desktop for selenium) and started tomcat with xvfb-run.
After i started xvfb (with port 99) and exported the display variable.
Example (using full path as they are used in systemd boot scripts):
export DISPLAY=:99
/usr/bin/xvfb-run /opt/tomcat-latest/bin/startup.sh
/usr/bin/Xvfb :99 &

Resources