Mozilla WebQA plugin for py.test.
Switch branches/tags
Nothing to show
Pull request Compare This branch is 244 commits behind mozilla:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


pytest_mozwebqa is a plugin for py.test that provides additional features needed for Mozilla's WebQA projects.


  • py.test
  • selenium
  • pyyaml


$ python install

Running tests with pytest_mozwebqa

For full usage details run the following command:

$ py.test --help

  --api=api           version of selenium api to use. 'rc' uses selenium rc.
                      'webdriver' uses selenium webdriver (the default).
  --host=str          host that selenium server is listening on.
  --port=num          port that selenium server is listening on.
  --driver=str        webdriver implementation.
  --chromepath=path   path to the google chrome driver executable.
  --firefoxpath=path  path to the target firefox binary.
  --browser=str       target browser (standalone rc server).
  --environment=str   target environment (grid rc).
  --browsername=str   target browser name (webdriver).
  --browserver=str    target browser version (webdriver).
  --platform=str      target platform (webdriver).
  --baseurl=url       base url for the application under test.
  --timeout=num       timeout for page loads, etc (selenium rc).
  --capturenetwork    capture network traffic to test_method_name.json
                      (selenium rc). (disabled by default).

  --credentials=path  location of yaml file containing user credentials.
  --saucelabs=path    credendials file containing sauce labs username and api key.


Run tests against a standalone RC server using Firefox in the default location:

$ py.test --api=rc --baseurl= --browser="*firefox"

Run tests against a grid server with an RC node environment named 'Firefox 5 on Mac OS X':

$ py.test --api=rc --baseurl= --environment="Firefox 5 on Mac OS X"

Run tests against a local webdriver using Firefox:

$ py.test --baseurl= --driver=firefox --firefoxpath=/Applications/

Run tests against a local webdriver using Google Chrome:

$ py.test --baseurl= --driver=chrome --chromepath=/Applications/chromedriver

Run tests against a remote webdriver server either directly or via grid:

$ py.test --baseurl= --browsername=firefox --browserver=5 --platform=mac

Run tests against Sauce Labs using RC API using Firefox 5 on Windows 2003:

$ py.test --api=rc --baseurl= --browsername=firefox --browserver=5.0 --platform="Windows 2003" --saucelabs=sauce_labs.yaml

Run tests against Sauce Labs using webdriver API using Firefox 5 on Windows:

$ py.test --baseurl= --browsername=firefox --browserver=5.0 --platform=WINDOWS --saucelabs=sauce_labs.yaml

Writing tests for pytest_mozwebqa

You will need to include the mozwebqa in the method signature for your tests, and pass it when constructing page objects.


def test_new_user_can_register(self, mozwebqa):
    home_pg = home_page.HomePage(mozwebqa)

    registration_pg = registration_page.RegistrationPage(mozwebqa)
    Assert.equal(registration_pg.page_title, "Sign Up Complete!")

Using credentials files

The credentials files use YAML syntax, and the usage will vary depending on the project. A typical file will contain at least one user with a unique identifier and login credentials:


# admin:
#   email:
#   username: admin
#   password: password