Skip to content
This repository

selenium tests for mdn

branch: master
README.md

MDN Selenium Tests

This repository holds automated tests for http://developer.mozilla.org

The following have all contributed to mdn-tests:

https://github.com/mozilla/mdn-tests/contributors

Getting the Code

If you don't already have one, sign up for a GitHub account.

If you visit the project page while signed into your GitHub account, you will see an option to Fork the repository. If you think you might want to contribute to the project, create a Fork so that you have a copy you can experiment with.

On your computer, clone the repository (your own if you forked, or the mozilla one if not). The URL for cloning is close to the top of the GitHub project page.

Submodules

Be sure to retrieve the git submodules:

git submodule update --init

Running Tests

Python

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

Virtualenv and Virtualenvwrapper (Optional/Intermediate level)

While most of us have had some experience using virtual machines, virtualenv is something else entirely. It's used to keep libraries that you install from clashing and messing up your local environment. After installing virtualenv, installing virtualenvwrapper will give you some nice commands to use with virtualenvwrapper.

note

If you do not use virtualenv, you can follow the instructions below to install the required Python libraries into your global Python installation.

If you don't mind installing globally, just run

sudo easy_install pip

followed by

sudo pip install -r requirements.txt

note

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

sudo apt-get install python-setuptools

to install the required Python libraries.

Running tests locally

You will need persona credentials for the site being tested. Get the URL being tested from mozwebqa.cfg in the project root, sign up for that site, and enter the credentials in a yaml file (see credentials.yaml in the project root). To avoid version control conflicts, you may want to store your credentials files separately from your source code.

For all tests to pass, you will need to edit your MDN profile and ensure all fields are filled out.

An example of running all non-destructive tests:

py.test --driver=firefox --credentials=/path/to/credentials/credentials.yaml

An example of running all of the tests in one file:

py.test --driver=firefox --credentials=/path/to/credentials/credentials.yaml tests/test_sign_in.py

An example of running one test in a file:

py.test --driver=firefox --credentials=/path/to/credentials/credentials.yaml tests/test_sign_in.py -k test_sign_out

For more command line options see https://github.com/davehunt/pytest-mozwebqa or run

py.test --help

Writing Tests

If you want to get involved and add more tests then there's just a few things we'd like to ask you to do:

  1. Use the template files for all new tests and page objects
  2. Follow our simple style guide
  3. Fork this project with your own GitHub account
  4. Make sure all tests are passing, and submit a pull request with your changes

License

This software is licensed under the MPL 2.0:

This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
Something went wrong with that request. Please try again.