Skip to content

Run Chrome tests in Docker #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions Docker_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,23 @@

docker run seleniumbase ./run_docker_test_in_firefox.sh

#### 8. You can also enter Docker and stay inside the shell:
#### 8. Now run the same test with Chrome inside your Docker:

docker run seleniumbase ./run_docker_test_in_chrome.sh

#### 9. You can also enter Docker and stay inside the shell:

docker run -i -t seleniumbase

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

./run_docker_test_in_phantomjs.sh

#### 10. When you're satisfied, you may exit the Docker shell:
#### 11. When you're satisfied, you may exit the Docker shell:

exit

#### 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:
#### 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:
http://stackoverflow.com/questions/17236796/how-to-remove-old-docker-containers
Here are a few of those cleanup commands:

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

#### 12. (Optional) More reading on Docker can be found here:
#### 13. (Optional) More reading on Docker can be found here:
* https://docs.docker.com
* https://docs.docker.com/mac/started/
* https://docs.docker.com/installation/mac/
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ RUN apt-get update -qqy \
&& ln -s /opt/firefox/firefox /usr/bin/firefox \
&& rm -f /tmp/firefox-esr.tar.bz2

#================
# Install Chrome
#================
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list \
&& apt-get update \
&& apt-get install -y google-chrome-stable \
&& rm -rf /var/lib/apt/lists/*

#===================
# Timezone settings
#===================
Expand Down Expand Up @@ -99,6 +108,7 @@ RUN cd /SeleniumBase && ls && sudo python docker_setup.py install
#=========================================
COPY docker/docker-entrypoint.sh /
COPY docker/run_docker_test_in_firefox.sh /
COPY docker/run_docker_test_in_chrome.sh /
COPY docker/run_docker_test_in_phantomjs.sh /
COPY docker/docker_config.cfg /SeleniumBase/examples/
ENTRYPOINT ["/docker-entrypoint.sh"]
Expand Down
14 changes: 9 additions & 5 deletions docker/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,23 @@

docker run seleniumbase ./run_docker_test_in_firefox.sh

#### 8. You can also enter Docker and stay inside the shell:
#### 8. Now run the same test with Chrome inside your Docker:

docker run seleniumbase ./run_docker_test_in_chrome.sh

#### 9. You can also enter Docker and stay inside the shell:

docker run -i -t seleniumbase

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

./run_docker_test_in_phantomjs.sh

#### 10. When you're satisfied, you may exit the Docker shell:
#### 11. When you're satisfied, you may exit the Docker shell:

exit

#### 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:
#### 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:
http://stackoverflow.com/questions/17236796/how-to-remove-old-docker-containers
Here are a few of those cleanup commands:

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

#### 12. (Optional) More reading on Docker can be found here:
#### 13. (Optional) More reading on Docker can be found here:
* https://docs.docker.com
* https://docs.docker.com/mac/started/
* https://docs.docker.com/installation/mac/
6 changes: 6 additions & 0 deletions docker/run_docker_test_in_chrome.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -e
# Run example test from inside Docker image
echo "Running example SeleniumBase test from Docker with headless Chrome..."
cd /SeleniumBase/examples/ && nosetests my_first_test.py --config=docker_config.cfg --browser=chrome
exec "$@"