Skip to content
This repository has been archived by the owner on Aug 20, 2018. It is now read-only.

Commit

Permalink
Merge branch 'master' into update-contact-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
schalkneethling committed Oct 14, 2015
2 parents 366c92e + 864be21 commit edd0701
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 1 deletion.
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM python:2

WORKDIR /app

ENV BASE_URL "https://www-dev.allizom.org"
ENV BROWSER_NAME Firefox
ENV BROWSER_VERSION 39.0
ENV PLATFORM "Windows 7"
ENV SELENIUM_VERSION 2.47.1
ENV SAUCE_CREDENTIALS_PATH /tmp/creds
ENV BUILD_TAG docker

ENV PYTHONDONTWRITEBYTECODE=1
COPY requirements.txt /app/requirements.txt
RUN pip install -r requirements.txt pytest-xdist

COPY . /app

CMD ["./run.sh"]
52 changes: 51 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ Running Tests
-------------

### Python
Before you will be able to run these tests you will need to have Python 2.6 installed.

Before you will be able to run these tests you will need to have
Python 2.7.9 installed.

__note__

Python versions before 2.7.9 do not support
[SNI](https://en.wikipedia.org/wiki/Server_Name_Indication) which will
cause tests to fail.

If you are running on Ubuntu/Debian you will need to first do

Expand Down Expand Up @@ -49,6 +57,48 @@ To run tests locally, it's a simple case of calling the command below from this

For more command line options, see https://github.com/mozilla/pytest-mozwebqa


### Running tests with Docker

__note__

You will need a working Docker installation. Docker provides complete
[installation documenation](https://docs.docker.com/installation/) for
various systems including Linux, OSX and Windows.

To run Saucelabs backed tests with Docker:

1. Save Saucelabs credentials in a file named `creds.yml` in the
following format

username: USERNAME
password: PASSWORD
api-key: API_KEY

2. Run:

docker run -v `pwd`/creds.yml:/tmp/creds -v `pwd`/results/:/app/results mozorg/mcom-tests

3. Find the test results in the `results` directory.

__note__

The default test configuration is listed in the
[Dockerfile](Dockerfile) and can be overriden with environment
variables. For example to test against the stage server, override
BASE_URL environment variable:

docker run -v `pwd`/creds.yml:/tmp/creds -e BASE_URL=https://www.allizom.org mozorg/mcom-tests

__note__

Docker registry builds new docker images for every code commit in
mozilla/mcom-tests. To fetch an up to date image run:

docker pull mozorg/mcom-tests



Writing Tests
-------------

Expand Down
12 changes: 12 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

py.test -r=fsxXR --verbose -n 15 \
--baseurl=${BASE_URL} \
--browsername="${BROWSER_NAME}" \
--browserver=${BROWSER_VERSION} \
--platform="${PLATFORM}" \
--junitxml=results/results.xml \
--saucelabs=${SAUCE_CREDENTIALS_PATH} \
--capability="selenium-version:${SELENIUM_VERSION}" \
--build=${BUILD_TAG} \
tests

0 comments on commit edd0701

Please sign in to comment.