I have built a maven+testng testing framework project on eclipse. I installed Jenkins on my local host and ran my project in there till now without any problem. My OS is Windows 10. I also ran my project on different Windows OS machines without any problem.
However I wanted cross platform testing, so I tried running my project in an Ubuntu machine. I did all the setup processes. I configured Firefox binary path and also installed X server, i.e xvfb on that Ubuntu machine.
I did some changes in my webdriver java file
package com.mednet.webdriver;
import java.io.File;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxBinary;
import org.openqa.selenium.firefox.FirefoxDriver;
public class WebdriverSetUp {
public static WebDriver driver = null;
public static WebDriver startdriver() {
FirefoxBinary binary = new FirefoxBinary(new File("/opt/firefox/firefox"));
binary.setEnvironmentProperty("DISPLAY", System.getProperty("lmportal.xvfb.id", ":99"));
return driver = new FirefoxDriver(binary, null);
}
}
Then I used following commands in terminal of Ubuntu to install firefox and xvfb.
- to install firefox: sudo apt-get install firefox
- to install xvfb: sudo apt-get xvfb & export DISPLAY=:99 & xvfb 99 -ac
Here I used DISPLAY=:99
Now when I start to build in Jenkins.
Following is my console output
Results :
Failed tests: testInvestigation(com.mednet.executor.diagnostics.ExecTest1): Timed out after 50 seconds waiting for visibility of element located by By.id: lineItemForCounterBilling(..)
testInvestigation(com.mednet.executor.diagnostics.ExecTest6): Timed out after 50 seconds waiting for visibility of element located by By.id: lineItemForCounterBilling(..)
Tests run: 2, Failures: 2, Errors: 0, Skipped: 0
[ERROR] There are test failures.
Please refer to/var/lib/jenkins/workspace/MednetTestingFramework/target/surefire-reports for the individual test results.
[JENKINS] Recording test results
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:19 min
[INFO] Finished at: 2016-08-25T11:06:08+05:30
[INFO] Final Memory: 34M/381M
[INFO] ------------------------------------------------------------------------
[JENKINS] Archiving /var/lib/jenkins/workspace/MednetTestingFramework/pom.xml to com.mednet/MednetTestingFrameworkV1/0.0.1-SNAPSHOT/MednetTestingFrameworkV1-0.0.1-SNAPSHOT.pom
channel stopped
Finished: UNSTABLE
Test stops after login steps that I have put in. There is nothing wrong with my Element as it locates without any problem in my Windows machine.
I searched on internet about the problem. In many sources I found out about Xvfb screen resolution is by default usually not large i suppose. So I am not able to increase screen size
I tried many commands such as xvfb :99 -screen 0 1024*720 or 1440*900 But of no use it show invalid screen resolution.
Need help in solving like any important step that I may have missed out.
Thanks in advance