What a lovely day it has been in Wellington. Finally there comes the summer! And I also have a lovely day to successfully make stable test results on 32bit Ubuntu Linux with Chromium Browser, latest ChromeDriver and new Selenium java 3.1.0!
http://jenkins.maxwu.me/job/Cucumber_Jvm_Selenium_Toy/
By the way, the last issue is fixed after a lovely walk from Petone seaview trail~ This site was originated as a pure technical sharing place but I hope I can make an exception to share the photo from Petone beach. Good weather sweeps away the raining feelings on another disappointing call.
Upgrade to Selenium 3.1.0
After upgrading from selenium-java 3.0.1 to 3.1.0 (Feb 2017 recently released), there reported a method resolving issue on wait.until() in below code block.
By byDiv = By.cssSelector("div#resultStats"); |
The solution is to manually add missing dependency on google guava library. Update pom.xml in maven to adapt this dependency will resolve it.
<dependency> |
Chrome on 32bit Linux
Since the installation and setting up on MBP is smoothy within 1 hour, there was an underestimation on making it happen with 32bit Linux. Which finally absorbed two half-days in the afternoon. To make things easy, I freshed the VPS with Ubuntu 14.04 and deleted the origina CentOS first. So SS service is terminated, which will be restored next week.
- Google didn't support 32bit Linux from Feb 2016. The latest version archived on internet is
48.0.2564.116-1_i386
. - But ChromeDriver requests a higher browser version if picking up latest version (2.27) with stability fixes.
- My VPS is on bandwagon with a low price plan (<10USD per year) lasted for couple of years. It offers 512Mb memory and 32bit Celeron CPU.
Solution:
Install chromium instead of chrome-browser. Chromium is an open source cummunity maintained lively version as an alternative to official Google Chrome. It supports 32bit Linux distribution.
Special tips:
With Ubuntu defaul source list, the latest version is
Chromium 53.0.2785.14
. Which is still not the latest binary.Update with below source, the latest chromium-browser version is
Chromium 55.0.2883
.
sudo add-apt-repository ppa:saiarcot895/chromium-dev
sudo apt-get update- Specify chromium binary to browser driver. The absolute path to chromium-browser executable is for my Ubuntu 14 with installation on ppa channel. You may replace with your own path to chromium.
options = new ChromeOptions();
//..
options.setBinary(new File("/usr/bin/chromium-browser"));
//..
WebDriver driver = new ChromeDriver(options);
Chrome tap crash
The chrome tap crash happens on 32bit Ubuntu 14 Linux.
Failure in before hook:TemperatureConverterPageStepDef.setUp(Scenario) |
This issue is severer after upgrading ChromeDriver to 2.22+ versions. There are some suspicious clues but none is confirmed. Finally after performing a series of branches tests and analysis, the solution is to move driver.manage().window().maximize();
to chrome start options as below.
options = new ChromeOptions(); |
Chrome Browser Hanging-up
Browser hanging-up randomly happens more frequently than other stability issues and it is the actual high runner among others. The frequency shows Private Jenkins > Travis-CI >> Circle-CI
. CircleCI is much better stable comparing to Travis-CI on chrome-browser web testing.
On private Jenkins we could read the log that browser hanging-up for a long time. On travis-CI, if the building execution has no output in 10 minutes, the docker monitor will shut down the task and lable a failure (terminated) on records.
org.openqa.selenium.TimeoutException: timeout: cannot determine loading status |
There are multiple possible triggers to cause a stuck, loading some plugin, flash content streaming, waiting for some default AD scripts, DNS prefetching (TTL), security check on plugins, ... Here the working solution plan just mitigate as many as it can and it brings the CI back to healthy status. Once there is a new unstable element being introduced, the recommendation is to do a preliminary check if the action or configuration can be done by Options object instead of any direction action through ChromeDriver.
options = new ChromeOptions(); |
TODO: fetch statistic data with new lib ci-stat
Embedded Status Badge from Jenkins
This step is simple. From the Jenkins console, install embedded jenkins status and place the links into README.md on github master branch. The status badge in third line of below snapshot is Jenkins status icon from the private jenkins on http://jenkins.maxwu.me
Setup xvfb for Jenkins
Either vncserver or xvfb works here to initialize the x-window display for browser. If headless browsers are utilized, this step is not necessary.
Install the xvfb plugin for Jenkins. There is a special hint:
xvfb needs at least a manual configuration step on Jenkins before working. This step will create the necessary configuration records for Jenkins to start before each CI task and end after it.
The menu path is
Manage Jenkins -> Global Tool Configuration -> XvFb
, not on Jenkins Configuration.
Notes: Recent Firefox and Chrome offers headless mode. Which is faster and XWin display or xvfb is no longer needed. Firefox starts to support headless mode from version 56 on Mac. Current stable version on Mac is v55 but beta version is 56b. New developer version is based on v57.
Jenkins on Mac
It is convenient to install Jenkins on Mac. brew install jenkins
will install and setup Jenkins quickly. The jenkins was installed as a service with brew.
>brew services start jenkins |
Other setup actions as coverage status with
Updated Feb 23, 2017
Drafted Feb 21, 2017