Selenium TestsΒΆ

Running selenium with vagga is as easy as anything else.

Setting up the GUI may take some effort because you need a display, but starting PhantomJS as a driver looks like the following:

containers:
  selenium:
    setup:
    - !Ubuntu trusty
    - !UbuntuUniverse
    - !Install [phantomjs]
    - !Py3Install [selenium, py, pytest]

commands:
  test: !Command
    description: Run selenium test
    container: selenium
    run: [py.test, test.py]

And the test may look like the following:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys


def test_example():
    driver = webdriver.PhantomJS()
    driver.get("http://vagga.readthedocs.org/")
    assert "Welcome to Vagga" in driver.title
    driver.close()


if __name__ == '__main__':
    test_example()

To run the test just type:

> vagga test