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 xenial - !UbuntuUniverse - !Install [libfontconfig1] - !Py3Install [selenium, py, pytest] # The phantomjs from Ubuntu repository seems to have problems with headless # environments, so we fetch the binary providd by the developers - !TarInstall url: https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 script: cp bin/phantomjs /usr/local/bin/phantomjs 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