Skip to content

Commit a9abc49

Browse files
committed
Merge pull request #4 from mdmintz/run-chrome-tests-in-docker
Run Chrome tests in Docker
2 parents ef60fb2 + 20eda7c commit a9abc49

File tree

4 files changed

+34
-10
lines changed

4 files changed

+34
-10
lines changed

Docker_README.md

+9-5
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,23 @@
2424

2525
docker run seleniumbase ./run_docker_test_in_firefox.sh
2626

27-
#### 8. You can also enter Docker and stay inside the shell:
27+
#### 8. Now run the same test with Chrome inside your Docker:
28+
29+
docker run seleniumbase ./run_docker_test_in_chrome.sh
30+
31+
#### 9. You can also enter Docker and stay inside the shell:
2832

2933
docker run -i -t seleniumbase
3034

31-
#### 9. Now you can run the example test from inside the Docker shell: (This time using PhantomJS)
35+
#### 10. Now you can run the example test from inside the Docker shell: (This time with PhantomJS)
3236

3337
./run_docker_test_in_phantomjs.sh
3438

35-
#### 10. When you're satisfied, you may exit the Docker shell:
39+
#### 11. When you're satisfied, you may exit the Docker shell:
3640

3741
exit
3842

39-
#### 11. (Optional) Since Docker images and containers take up a lot of space, you may want to clean up your machine from time to time when they’re not being used:
43+
#### 12. (Optional) Since Docker images and containers take up a lot of space, you may want to clean up your machine from time to time when they’re not being used:
4044
http://stackoverflow.com/questions/17236796/how-to-remove-old-docker-containers
4145
Here are a few of those cleanup commands:
4246

@@ -53,7 +57,7 @@ Finally, if you want to wipe out your SeleniumBase Docker virtualbox, use these
5357
docker-machine kill seleniumbase
5458
docker-machine rm seleniumbase
5559

56-
#### 12. (Optional) More reading on Docker can be found here:
60+
#### 13. (Optional) More reading on Docker can be found here:
5761
* https://docs.docker.com
5862
* https://docs.docker.com/mac/started/
5963
* https://docs.docker.com/installation/mac/

Dockerfile

+10
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,15 @@ RUN apt-get update -qqy \
5858
&& ln -s /opt/firefox/firefox /usr/bin/firefox \
5959
&& rm -f /tmp/firefox-esr.tar.bz2
6060

61+
#================
62+
# Install Chrome
63+
#================
64+
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
65+
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list \
66+
&& apt-get update \
67+
&& apt-get install -y google-chrome-stable \
68+
&& rm -rf /var/lib/apt/lists/*
69+
6170
#===================
6271
# Timezone settings
6372
#===================
@@ -99,6 +108,7 @@ RUN cd /SeleniumBase && ls && sudo python docker_setup.py install
99108
#=========================================
100109
COPY docker/docker-entrypoint.sh /
101110
COPY docker/run_docker_test_in_firefox.sh /
111+
COPY docker/run_docker_test_in_chrome.sh /
102112
COPY docker/run_docker_test_in_phantomjs.sh /
103113
COPY docker/docker_config.cfg /SeleniumBase/examples/
104114
ENTRYPOINT ["/docker-entrypoint.sh"]

docker/ReadMe.md

+9-5
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,23 @@
2424

2525
docker run seleniumbase ./run_docker_test_in_firefox.sh
2626

27-
#### 8. You can also enter Docker and stay inside the shell:
27+
#### 8. Now run the same test with Chrome inside your Docker:
28+
29+
docker run seleniumbase ./run_docker_test_in_chrome.sh
30+
31+
#### 9. You can also enter Docker and stay inside the shell:
2832

2933
docker run -i -t seleniumbase
3034

31-
#### 9. Now you can run the example test from inside the Docker shell: (This time using PhantomJS)
35+
#### 10. Now you can run the example test from inside the Docker shell: (This time with PhantomJS)
3236

3337
./run_docker_test_in_phantomjs.sh
3438

35-
#### 10. When you're satisfied, you may exit the Docker shell:
39+
#### 11. When you're satisfied, you may exit the Docker shell:
3640

3741
exit
3842

39-
#### 11. (Optional) Since Docker images and containers take up a lot of space, you may want to clean up your machine from time to time when they’re not being used:
43+
#### 12. (Optional) Since Docker images and containers take up a lot of space, you may want to clean up your machine from time to time when they’re not being used:
4044
http://stackoverflow.com/questions/17236796/how-to-remove-old-docker-containers
4145
Here are a few of those cleanup commands:
4246

@@ -53,7 +57,7 @@ Finally, if you want to wipe out your SeleniumBase Docker virtualbox, use these
5357
docker-machine kill seleniumbase
5458
docker-machine rm seleniumbase
5559

56-
#### 12. (Optional) More reading on Docker can be found here:
60+
#### 13. (Optional) More reading on Docker can be found here:
5761
* https://docs.docker.com
5862
* https://docs.docker.com/mac/started/
5963
* https://docs.docker.com/installation/mac/

docker/run_docker_test_in_chrome.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
set -e
3+
# Run example test from inside Docker image
4+
echo "Running example SeleniumBase test from Docker with headless Chrome..."
5+
cd /SeleniumBase/examples/ && nosetests my_first_test.py --config=docker_config.cfg --browser=chrome
6+
exec "$@"

0 commit comments

Comments
 (0)