Skip to content
This repository was archived by the owner on Jun 30, 2021. It is now read-only.

Commit 6b67941

Browse files
committed
Upgrade Chrome stable patch 51.0.2704.106
1 parent 4760a16 commit 6b67941

14 files changed

+317
-187
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ Note image ids also change after scm-source.json has being updated which trigger
99

1010
## TBD_DOCKER_TAG
1111
+ Date: TBD_DATE
12+
+ Upgrade Chrome stable patch 51.0.2704.106
1213
+ Fix bug when running Firefox only selenium node.
1314
+ Add ./docs/hub_and_nodes.md
14-
+ Allow to pick random unused unprivileged ports via `0` e.g. VNC_PORT=0
15-
+ Allow to pick all ports random via `-e PICK_ALL_RANDMON_PORTS=true`
15+
+ Allow to pick all unused ports via `-e PICK_ALL_RANDMON_PORTS=true`
16+
+ Allow to pick individual unused unprivileged ports via `0` e.g. VNC_PORT=0
1617
+ Fix bug that x11vnc was always assigning port 5900 for tcp6 IPv6 (missing `-rfbportv6`)
1718
+ Image tag details:
1819
+ Selenium: vTBD_SELENIUM_VERSION (TBD_SELENIUM_REVISION)

CONTRIBUTING.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,24 @@
33
## Local
44
For pull requests or local commits:
55

6-
./test/before_install_build && ./test/install
7-
./test/script
6+
docker rm -vf grid; ./test/before_install_build && ./test/install && ./test/script && docker tag selenium:latest elgalu/selenium:latest
87
docker exec grid versions && ./test/after_script
98
open ./images/grid_console.png #to verify the versions are correct
109
git checkout ./images/grid_console.png && open ./videos/chrome/test.mkv
1110
travis lint #if you changed .travis.yml
12-
git checkout -b tmp-2.53.0s #name your branch according to your changes
11+
git checkout -b tmp-2.53.0t #name your branch according to your changes
1312
#git add ... git commit ... git push ... open pull request
1413

1514
For repository owners only:
1615

17-
git commit -m "Upgrade Chrome stable patch 51.0.2704.103"
16+
git commit -m "Upgrade Chrome stable patch 51.0.2704.106"
1817
git tag -d latest #tag latest will be updated from TravisCI
19-
git tag 2.53.0s && git push origin tmp-2.53.0s && git push --tags
18+
git tag 2.53.0t && git push origin tmp-2.53.0t && git push --tags
2019

2120
-- Wait for Travis to pass OK
2221
-- Make sure changes got merged into master by elgalubot
2322

24-
git checkout master && git pull && git branch -d tmp-2.53.0s && git push origin --delete tmp-2.53.0s
23+
git checkout master && git pull && git branch -d tmp-2.53.0t && git push origin --delete tmp-2.53.0t
2524

2625
-- Re-add TBD_* section in CHANGELOG.md starting with TBD_DOCKER_TAG
2726
-- Upgrade release tag in github.com with latest CHANGELOG.md
@@ -32,15 +31,15 @@ For repository owners only:
3231
### Chrome artifact
3332
Keep certain bins if chrome version changed for example:
3433

35-
VER="51.0.2704.103"
34+
VER="51.0.2704.106"
3635
wget -nv --show-progress -O binaries/google-chrome-stable_${VER}_amd64.deb "https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb"
3736

3837
## Retry
3938
Failed in Travis? retry
4039

41-
git tag -d 2.53.0s && git push origin :2.53.0s
40+
git tag -d 2.53.0t && git push origin :2.53.0t
4241
#git add ...
43-
git commit --amend && git tag 2.53.0s && git push --force origin tmp-2.53.0s && git push --tags
42+
git commit --amend && git tag 2.53.0t && git push --force origin tmp-2.53.0t && git push --tags
4443

4544
## Docker push from Travis CI
4645
Travis [steps](https://docs.travis-ci.com/user/docker/#Pushing-a-Docker-Image-to-a-Registry) involve `docker login` and docker credentials encryptions.

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ RUN mkdir -p ${NORMAL_USER_HOME}/tmp && cd ${NORMAL_USER_HOME}/tmp \
766766
# TODO: Use Google fingerprint to verify downloads
767767
# https://www.google.de/linuxrepositories/
768768
# Also fix .deb file names with correct version
769-
RUN latest_chrome_version_trigger="51.0.2704.103" \
769+
RUN latest_chrome_version_trigger="51.0.2704.106" \
770770
&& mkdir -p ${NORMAL_USER_HOME}/chrome-deb \
771771
&& export CHROME_URL="https://dl.google.com/linux/direct" \
772772
&& wget -nv -O \

README.md

Lines changed: 12 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ Even though both projects share the same purpose is good to have alternatives. L
3737
If you don't require a real browser [PhantomJS](https://github.com/ariya/phantomjs) might be enough for you.
3838
[Electron](https://wallabyjs.com/docs/integration/electron.html) allows to use the latest Chromium/V8 which might be equivalent to running in Chrome however still requires a display so [xvfb][xvfb-electron] is needed. You can also use a paid service like [Sauce Labs][sauce] or [BrowserStack][], note they offer free open source accounts and straightforward [integration with Travis CI](https://docs.travis-ci.com/user/sauce-connect/).
3939
You can also configure [xvfb](https://docs.travis-ci.com/user/gui-and-headless-browsers/#Using-xvfb-to-Run-Tests-That-Require-a-GUI) yourself but it involves some manual steps and doesn't include video recording, nor does PhantomJS nor Electron.
40-
A [new chromium headless project](https://github.com/electron/electron/issues/228#issuecomment-223797342) looks very promising so might we worth to take a look though as of now leaves video recording out of scope there and Firefox of course.
40+
A [new chromium headless project](https://github.com/electron/electron/issues/228#issuecomment-223797342) looks very promising so might we worth to take a look though as of now leaves video recording out of scope there and Firefox also out of scope.
4141

4242
### Usage
4343

4444
<h4 id="run"><img width="24" src="./images/icons/logo.png" /> Run</h4>
4545

4646
1. Pull the image and run the container
4747

48-
docker pull elgalu/selenium #upgrades to latest if available
48+
docker pull elgalu/selenium #upgrades to latest if a newer version is available
4949

5050
docker run -d --name=grid -p 4444:24444 -p 5900:25900 \
5151
-e TZ="US/Pacific" -e VNC_PASSWORD=hola \
@@ -285,7 +285,7 @@ You can simply verify that image id is indeed the correct one.
285285

286286
# e.g. full image id for some specific tag version
287287
export IMGID="<<Please see CHANGELOG.md>>"
288-
if docker inspect -f='{{.Id}}' elgalu/selenium:2.53.0s |grep ${IMGID} &> /dev/null; then
288+
if docker inspect -f='{{.Id}}' elgalu/selenium:latest |grep ${IMGID} &> /dev/null; then
289289
echo "Image ID tested ok"
290290
else
291291
echo "Image ID doesn't match"
@@ -331,113 +331,19 @@ Host machine, terminal 2:
331331
3
332332
Now when you run your tests instead of connecting. If docker run fails try `xhost +`
333333

334-
### Using free available ports and tunneling to emulate localhost testing
335-
Let's say you need to expose 4 ports (3000, 2525, 4545, 4546) from your laptop but test on the remote docker selenium.
336-
Enter tunneling.
337-
338-
```sh
339-
# -- Common: Set some handy shortcuts.
340-
# On development machine (target test localhost server)
341-
SOPTS="-o StrictHostKeyChecking=no"
342-
TUNLOCOPTS="-v -N $SOPTS -L"
343-
TUNREVOPTS="-v -N $SOPTS -R"
344-
# port 0 means bind to a free available port
345-
ANYPORT=0
346-
347-
# -- Option 1. docker run - Running docker locally
348-
# Run a selenium instance binding to host random ports
349-
REMOTE_DOCKER_SRV=localhost
350-
CONTAINER=$(docker run -d -p=0.0.0.0:${ANYPORT}:22222 -p=0.0.0.0:${ANYPORT}:24444 \
351-
-p=0.0.0.0:${ANYPORT}:25900 -e SCREEN_HEIGHT=1110 -e VNC_PASSWORD=hola \
352-
-e SSH_AUTH_KEYS="$(cat ~/.ssh/id_rsa.pub)" elgalu/selenium
353-
354-
# -- Option 2.docker run- Running docker on remote docker server like in the cloud
355-
# Useful if the docker server is running in the cloud. Establish free local ports
356-
REMOTE_DOCKER_SRV=some.docker.server.com
357-
ssh ${REMOTE_DOCKER_SRV} #get into the remote docker provider somehow
358-
# Note in remote server I'm using authorized_keys instead of id_rsa.pub given
359-
# it acts as a jump host so my public key is already on that server
360-
CONTAINER=$(docker run -d -p=0.0.0.0:${ANYPORT}:22222 -e SCREEN_HEIGHT=1110 \
361-
-e VNC_PASSWORD=hola -e SSH_AUTH_KEYS="$(cat ~/.ssh/authorized_keys)" \
362-
elgalu/selenium
363-
364-
# -- Common: Wait for the container to start
365-
./host-scripts/wait-docker-selenium.sh grid 7s
366-
json_filter='{{(index (index .NetworkSettings.Ports "22222/tcp") 0).HostPort}}'
367-
SSHD_PORT=$(docker inspect -f='${json_filter}' $CONTAINER)
368-
echo $SSHD_PORT #=> e.g. SSHD_PORT=32769
369-
370-
# -- Option 1. Obtain dynamic values like container IP and assigned free ports
371-
json_filter='{{(index (index .NetworkSettings.Ports "24444/tcp") 0).HostPort}}'
372-
FREE_SELE_PORT=$(docker inspect -f='${json_filter}' $CONTAINER)
373-
json_filter='{{(index (index .NetworkSettings.Ports "25900/tcp") 0).HostPort}}'
374-
FREE_VNC_PORT=$(docker inspect -f='${json_filter}' $CONTAINER)
375-
376-
# -- Option 2. Get some free ports in current local machine. Needs python.
377-
# IMPORTANT: Go back to development machine
378-
FREE_SELE_PORT=$(python -c 'import socket; s=socket.socket(); \
379-
s.bind(("", 0)); print(s.getsockname()[1]); s.close()')
380-
FREE_VNC_PORT=$(python -c 'import socket; s=socket.socket(); \
381-
s.bind(("", 0)); print(s.getsockname()[1]); s.close()')
382-
# -- Option 2. Tunneling selenium+vnc is necessary if using a remote docker
383-
ssh ${TUNLOCOPTS} localhost:${FREE_SELE_PORT}:localhost:24444 \
384-
-p ${SSHD_PORT} application@${REMOTE_DOCKER_SRV} &
385-
LOC_TUN_SELE_PID=$!
386-
ssh ${TUNLOCOPTS} localhost:${FREE_VNC_PORT}:localhost:25900 \
387-
-p ${SSHD_PORT} application@${REMOTE_DOCKER_SRV} &
388-
LOC_TUN_VNC_PID=$!
389-
echo $FREE_SELE_PORT $FREE_VNC_PORT
390-
391-
# -- Common: Expose local ports so can be tested as 'localhost'
392-
# inside the docker container
393-
ssh ${TUNREVOPTS} localhost:3000:localhost:3000 \
394-
-p ${SSHD_PORT} application@${REMOTE_DOCKER_SRV} &
395-
REM_TUN1_PID=$!
396-
ssh ${TUNREVOPTS} localhost:2525:localhost:2525 \
397-
-p ${SSHD_PORT} application@${REMOTE_DOCKER_SRV} &
398-
REM_TUN2_PID=$!
399-
ssh ${TUNREVOPTS} localhost:4545:localhost:4545 \
400-
-p ${SSHD_PORT} application@${REMOTE_DOCKER_SRV} &
401-
REM_TUN3_PID=$!
402-
ssh ${TUNREVOPTS} localhost:4546:localhost:4546 \
403-
-p ${SSHD_PORT} application@${REMOTE_DOCKER_SRV} &
404-
REM_TUN4_PID=$!
405-
echo Option 1. Should show 4 ports when doing it locally
406-
echo Option 2. Should show 6 ports when doing it remotely
407-
echo $REM_TUN1_PID $REM_TUN2_PID $REM_TUN3_PID \
408-
$REM_TUN4_PID $LOC_TUN_SELE_PID $LOC_TUN_VNC_PID
409-
# Use the container as if selenium and VNC were running locally
410-
# thanks to ssh -L port FWD
411-
google-chrome-stable \
412-
"http://localhost:${FREE_SELE_PORT}/wd/hub/static/resource/hub.html"
413-
vncv localhost:${FREE_VNC_PORT} -Scaling=70% &
414-
# Stop all the things after your tests are done
415-
kill $REM_TUN1_PID $REM_TUN2_PID $REM_TUN3_PID \
416-
$REM_TUN4_PID $LOC_TUN_SELE_PID $LOC_TUN_VNC_PID
417-
# if in Option 2. execute below commands inside docker
418-
# provider machine `ssh ${REMOTE_DOCKER_SRV}`
419-
docker stop ${CONTAINER}
420-
docker rm ${CONTAINER}
421-
```
422-
423334
## Step by step build
424335

425-
### 1. Build this image
336+
### Build this image
337+
If you git clone this repo locally, i.e. `git clone` it and `cd` into where the Dockerfile is, you can:
426338

427-
If you git clone this repo locally, i.e. cd into where the Dockerfile is, you can:
428-
429-
docker build -t="elgalu/docker-selenium:local" .
430-
431-
If you prefer to download the final built image from docker you can pull it, personally I always prefer to build them manually except for the base images like Ubuntu 14.04.2:
432-
433-
docker pull elgalu/selenium
339+
docker build -t selenium .
434340

435-
### 2. Use this image
341+
### Use this image
436342

437343
#### e.g. Spawn a container for Chrome testing:
438344

439345
CH=$(docker run --rm --name=CH -p=127.0.0.1::24444 -p=127.0.0.1::25900 \
440-
-v /e2e/uploads:/e2e/uploads elgalu/docker-selenium:local)
346+
-v /e2e/uploads:/e2e/uploads selenium)
441347

442348
*Note:* `-v /e2e/uploads:/e2e/uploads` is optional in case you are testing browser uploads on your WebApp, you'll probably need to share a directory for this.
443349

@@ -464,7 +370,7 @@ In case you have RealVNC binary `vnc` in your path, you can always take a look,
464370
This command line is the same as for Chrome, remember that the selenium running container is able to launch either Chrome or Firefox, the idea around having 2 separate containers, one for each browser is for convenience, plus avoid certain `:focus` issues your WebApp may encounter during e2e automation.
465371

466372
FF=$(docker run --rm --name=ff -p=127.0.0.1::24444 -p=127.0.0.1::25900 \
467-
-v /e2e/uploads:/e2e/uploads elgalu/docker-selenium:local)
373+
-v /e2e/uploads:/e2e/uploads selenium)
468374

469375
#### How to get docker internal IP through logs
470376

@@ -476,9 +382,9 @@ This command line is the same as for Chrome, remember that the selenium running
476382
docker images
477383
#=>
478384

479-
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
480-
elgalu/docker-selenium local eab41ff50f72 About an hour ago 931.1 MB
481-
ubuntu 14.04.2 d0955f21bf24 4 weeks ago 188.3 MB
385+
REPOSITORY TAG IMAGE ID CREATED SIZE
386+
selenium latest a13d4195fc1f About an hour ago 2.927 GB
387+
ubuntu xenial-20160525 2fa927b5cdd3 4 weeks ago 122 MB
482388

483389
### DNS
484390

bin/entry.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ export HOST_UID=$(stat -c "%u" ${VIDEOS_DIR})
3939
export VIDEO_PATH="${VIDEOS_DIR}/${VIDEO_FILE_NAME}.${VIDEO_FILE_EXTENSION}"
4040
export FFMPEG_FRAME_SIZE="${SCREEN_WIDTH}x${SCREEN_HEIGHT}"
4141

42+
# {{CONTAINER_IP}} is a place holder for dynamically setting the IP of a node
43+
if [ "${SELENIUM_NODE_HOST}" = "{{CONTAINER_IP}}" ]; then
44+
export SELENIUM_NODE_HOST="${CONTAINER_IP}"
45+
fi
46+
4247
#----------------------------------------------------------
4348
# Extend required services depending on what the user needs
4449
if [ "${VIDEO}" = "true" ]; then

0 commit comments

Comments
 (0)