Selenium Tests for MozTrap
Перейти к файлу
Rebecca Billings 493b6704be Merge pull request #196 from stephendonner/update-readme-inactive
Add no-longer-maintained notice
2017-02-10 14:02:43 -08:00
mocks Switch to native asserts 2016-02-04 13:22:14 -05:00
pages Migrate from browserid to bidpom (#187) 2016-07-07 13:29:39 +01:00
tests Migrate to pytest-selenium 2016-03-10 15:18:02 +00:00
.gitignore Update gitignore 2012-06-21 16:21:47 +01:00
.travis.yml Added a setup.cfg file to configure the behaviour of flake8 2015-05-14 13:22:00 +05:30
LICENSE Update README and add LICENSE 2016-03-10 14:14:36 +00:00
README.md Add no-longer-maintained notice 2017-02-10 16:03:58 -05:00
conftest.py Migrate to pytest-selenium 2016-03-10 15:18:02 +00:00
requirements.txt Update requests to latest (#195) 2016-11-18 14:47:21 +00:00
setup.cfg Specify pytest as a tool 2016-08-23 09:48:37 -07:00
variables.json Switch to using pytest-variables for user and API credentials. Fixes #166 2015-06-17 09:58:27 +01:00

README.md

Tests for Mozilla's MozTrap

This repository contains tests for Mozilla's MozTrap.

license

This project is no longer actively maintained

Due to MozTrap itself being shut down, we have no use for these tests; we're leaving them as-is, for now, in case they are useful for others.

Getting involved

We love working with contributors to fill out the test coverage for MozTrap, but it does require a few skills. By contributing to our test suite you will have an opportunity to learn and/or improve your skills with Python, Selenium WebDriver, GitHub, virtual environments, the Page Object Model, and more.

For some resources for learning about these technologies, take a look at our documentation on running Web QA automated tests.

All of these awesome contributors have opened pull requests against this repository.

Questions are always welcome

While we take pains to keep our documentation updated, the best source of information is those of us who work on the project. Don't be afraid to join us in irc.mozilla.org #mozwebqa to ask questions about our tests. We also have a mailing list available that you are welcome to join and post to.

How to run the tests locally

We maintain a detailed guide to running our automated tests. However, if you want to get started quickly, you can try following the steps below:

Clone the repository

If you have cloned this project already then you can skip this, otherwise you'll need to clone this repo using Git. If you do not know how to clone a GitHub repository, check out this help page from GitHub.

If you think you would like to contribute to the tests by writing or maintaining them in the future, it would be a good idea to create a fork of this repository first, and then clone that. GitHub also has great documentation for forking a repository.

Create or activate a Python virtual environment

You should install this project's dependencies (which is described in the next step) into a virtual environment in order to avoid impacting the rest of your system, and to make problem solving easier. If you already have a virtual environment for these tests, then you should activate it, otherwise you should create a new one. For more information on working with virtual environments see our summary.

Install dependencies

Install the Python packages that are needed to run our tests using pip. In a terminal, from the the project root, issue the following command:

$ pip install -Ur requirements.txt

Create a test user

Many of the tests require logging in. To run these tests you will need to create an account on https://moztrap.allizom.org/. You will also need an API user and key.

Create a variables file

The credentials associated with the test user is stored in a JSON file, which we then pass to the tests via the command line. If you want to be able to run any of the tests that need these credentials, you will need to create a variables file containing your own credentials (see above). The following is an example JSON file with the values missing. You can use this as a template.

{
  "users": {
    "default": {
      "email": "",
      "password": "",
      "name": ""
    }
  },
  "api": {
    "user": "",
    "key": ""
  }
}

You will then pass the name of that your variables file on the command line. For the purposes of the examples below, assume you named your copy of the file my_variables.json.

Run the tests

Tests are run using the command line. Below are a couple of examples of running the tests:

To run all of the desktop tests against the default environment:

$ py.test --driver Firefox --variables my_variables.json

To run against a different environment, pass in a value for --base-url, like so:

$ py.test --base-url https://moztrap.mozilla.org --driver Firefox

The pytest plugin that we use for running tests has a number of advanced command line options available. To see the options available, run py.test --help. The full documentation for the plugin can be found here.