Public | Automated Build

Last pushed: 2 days ago
Short Description
protractor-based tool for testing browsers
Full Description

How to Run

locally against your fusion.

open 'run.sh' and edit the following:

export PROTRACTOR_SPECS="stopwords/stopwords.spec.js"
export BROWSER_NAME="firefox"
export FUSION_HOME="$HOME/fusion"
export FUSION_ADDRESS="192.168.1.33"

  • Protractor_specs: This is where you specify the protractor tests you want
  • Browser_name: chrome | firefox (default is chrome if not provided)
  • FUSION_HOME: This is the fusion directory where your tests are. ($HOME expands to /user/<your_name>)
  • FUSION_ADDRESS: (optional) This is the address of a fusion instance. (cannot be localhost)

    Fusion in a docker container. (What is run on jenkins)

    This will not interfere with your local developement.
    ./run-integration.docker.sh $FUSION_HOME/Apollo-admin/ui/test/integration

  • If your fusion package is in a directory other than $FUSION_HOME, change FUSION_DIR

browser-tester

selenium web driver and protractor-based tool for testing chrome/firefox

build image

$ docker build -t local/protractor .
change your dockercompose to local/protractor instead of lucidworks/browser-tester to test

push image

follow https://docs.docker.com/engine/getstarted/step_six/
$ docker tag <image_ID> lucidworks/browser-tester:latest
$ docker push lucidworks/browser-tester

(README from Fusion)

Docker (browser-tester)

Quick Setup

Install docker engine and compose with docker for mac (choose a stable version) https://docs.docker.com/docker-for-mac/#/step-2-check-versions-of-docker-engine-compose-and-machine
OR separately Docker version 1.12.3 or higher https://github.com/docker/docker/releases and Docker Compose version 1.8.1 or higher https://github.com/docker/compose/releases.

NOTE: depending on your machine, you might want to increase the cpu/memory settings for your "Docker for Mac" (You can go to Docker's Preferences->Advanced and increase CPUs to 4 and Memory to 8.0 GB, and restart Docker)

git clone https://github.com/lucidworks/browser-tester.git

git checkout 3.x

In Fusion repo, go to Fusion/Apollo-admin/ui/test/integration and do npm install

From browser-tester repo root folder <path-to-browser-tester>/browser-tester, run tests (Chrome ran by default):

FUSIONPORT=8764 PROTRACTOR_SPECS=nightly ./run-integration.sh ~/<path-to-Fusion>/Fusion/Apollo-admin/ui/test/integration

BROWSER_NAME=firefox FUSIONPORT=8764 ./run-integration.sh ~/<path-to-Fusion>/Fusion/Apollo-admin/ui/test/integration

Once tests are running, open another terminal and use VNC to follow the tests in action open vnc://:hola@localhost:5900

Once tests finish (un-interrupted), you can view recorded video and logs from browser-tester/videos and browser-tester/logs

Setup instructions

##Install Docker Engine/Compose and clone browser-tester repo
If you're on mac, you can install Docker for Mac (choose a stable version) - this should include both Docker Engine and Compose:
https://docs.docker.com/docker-for-mac/#/step-2-check-versions-of-docker-engine-compose-and-machine

Otherwise, install Docker version 1.12.3 or higher https://github.com/docker/docker/releases
and Docker Compose version 1.8.1 or higher https://github.com/docker/compose/releases

Jenkins currently using:

docker-compose version 1.13.0
docker-py version: 2.0.1

After installing, open terminal and verify docker and docker-compose is working (ex. by entering docker and docker-compose).
After the images have been downloaded, you can view your local images with docker images

Next, pull the repo and checkout branch 3.x

git clone https://github.com/lucidworks/browser-tester.git
git checkout 3.x

(We will add another branch for 3.0.x in the future)

browser-tester is set to use Firefox 51.0.1 by default (standard) - if for whatever reason you'd like to run tests on Firefox 47.0.1,
you can pull the image for it and set it to be used in browser-tester/compose/docker-compose.yml

NOTE: depending on your machine, you might want to increase the cpu/memory settings for your "Docker for Mac" (You can go to Docker's Preferences->Advanced and increase CPUs to 4 and Memory to 8.0 GB, and restart Docker)

##Running the tests

Before running tests, go to Fusion/Apollo-admin/ui/test/integration in your Fusion repo and do npm install

Then, you can run the tests from the browser-tester repo root folder <path-to-browser-tester>/browser-tester:

./run-integration.sh ~/<path-to-Fusion>/Fusion/Apollo-admin/ui/test/integration

You can set certain variables by ex.

FUSIONPORT=8764 PROTRACTOR_SPECS=nightly ./run-integration.sh ~/<path-to-Fusion>/Fusion/Apollo-admin/ui/test/integration

You can use VNC to follow the tests in action:

open vnc://:hola@localhost:5900

Do this while the tests are running - selenium container has to exist first. You can then just leave it open.
Avoid focusing on this window when running tests to avoid accidentally interrupting them.

To run Firefox tests, use BROWSER_NAME=firefox (runs Chrome by default)

BROWSER_NAME=firefox ./run-integration.sh ~/<path-to-Fusion>/Fusion/Apollo-admin/ui/test/integration

Trouble shooting

If your tests fail and you have trouble running browser-tester after that, try killing the containers before running the tests again:

docker rm -f browsertester_selenium_1 && docker rm -f browsertester_protractor_1

If you happen to run into an error such as: Error: Cannot start container <x>: port has already been allocated
simply restart your docker again (quit and relaunch it)

If you ever need to re-pull images (sometimes this can potentially fix certain local issues), you can do:

docker rmi lucidworks/browser-tester:3.x
docker rmi lucidworks/docker-selenium:selenium3ff51.0.1
docker rmi lucidworks/docker-selenium:selenium3ff47.0.1

docker pull lucidworks/browser-tester:3.x
docker pull lucidworks/docker-selenium:selenium3ff51.0.1
docker pull lucidworks/docker-selenium:selenium3ff47.0.1

##Setting the environment variables

To make running tests easier, you can set the following variables in your ~/.bash_profile:

FUSION_ADDRESS=<local IP address>             # if you want to connect to a different host
SELENIUM_ADDRESS=http://selenium:24444/wd/hub    # if you want to specify selenium address used
FUSIONPORT=8764                              # required unless using 4000
PROTRACTOR_SPECS=nightly                         # optional
PROTRACTOR_SPECS=system/*.spec.js                # optional
  • FUSION_ADDRESS - to run tests against Fusion running on another host
  • FUSIONPORT - tests are run from 4000 (dev environment) by default, so to run tests without it you should set port to 8764
  • PROTRACTOR_SPECS - if you want to specify the tests to run

You can run a single or multiple spec files

PROTRACTOR_SPECS=stopwords/*.spec.js
PROTRACTOR_SPECS=stopwords/*.spec.js,solr-config/*.spec.js

or you can look at the specMaps in environment.js for tags to run a specified set of tests

PROTRACTOR_SPECS=nightly

Video recording and logs

You should be able to

  • view the video for your test run from browser-tester/videos
  • view logs from browser-tester/logs

You can change the video recording limit in browser-tester/compose/docker-compose.yml by setting VIDEO_CHUNK_SECS to something else (currently set to VIDEO_CHUNK_SECS=00:50:00 for 50 minutes)

To view videos from Jenkins builds, contact UI or QE team for access to the s3 bucket where they get saved for 4 days.

note: this might not work if you force quit the test run (ctrl + c)

(To download VLC player for Mac, go to http://www.videolan.org/vlc/download-macosx.html)

Jenkins vs. Local

For the time being, we are only running certain set of tests in browser-tester in Jenkins.

PROTRACTOR_SPECS tags used for jenkins - Firefox: bt_ff and Chrome: bt_ch

These tags exclude the following tests: Quickstart, Oauth-refresh token, IWB, QWB (all except qwb-pipelines.spec.js, qwb-query-params.spec.js, sui-compare-mode.spec.js), Launcher, import-export, fields, SAML, Headerbar, Aggregations (only skipping “Running Aggregations” part)

Locally, all the tests should be passing - including the ones currently skipped in Jenkins.

To run all the missing tests in Jenkins (listed above), you can use tag PROTRACTOR_SPECS=local_sanity to run only the missing tests for sanity

PROTRACTOR_SPECS=bt_ch ./run-integration.sh ~/<path-to-Fusion>/Fusion/Apollo-admin/ui/test/integration
BROWSER_NAME="firefox" PROTRACTOR_SPECS=bt_ff ./run-integration.sh ~/<path-to-Fusion>/Fusion/Apollo-admin/ui/test/integration

PROTRACTOR_SPECS=local_sanity ./run-integration.sh ~/<path-to-Fusion>/Fusion/Apollo-admin/ui/test/integration
BROWSER_NAME="firefox" PROTRACTOR_SPECS=local_sanity ~/<path-to-Fusion>/Fusion/Apollo-admin/ui/test/integration

##Other info

https://github.com/lucidworks/browser-tester

https://hub.docker.com/r/lucidworks/browser-tester/

https://hub.docker.com/r/lucidworks/docker-selenium/

https://github.com/elgalu/docker-selenium

Docker Pull Command
Owner
lucidworks
Source Repository

Comments (0)