Package: gossamerui
Gossamer========Gossamer watches you browse a website and record screenshots of your UI,then recreates your browsing session and passes or fails tests dependingon whether the UI has changed. It's a way of automating in-browservisual regression testing, using Gossamer to automate SeleniumWebDriver, expose test statuses of pass/fail/error, and provide visualdiffs of failing tests. You needn't write Selenium tests, or make andkeep in sync static pages for testing UI: this tool will test fullwebpages run on a development or testing webserver. Gossamer can beintegrated into your continuous integration either via the command-lineinterface, or, if you're testing a Python application, via Pythonunittest integration.Usage-----Gossamer is a command-line application, called with ``gossamer``. Youcreate tests you wish to record in a text Gossamerfile. For each test, aWebDriver window is opened and you interact with the browser as a normaluser, going back to the command line when you wish to take a screenshotand pressing enter. Your screenshots, and a JSON record of your test, iswritten to a data directory. Playback is done by reading this directory,and comparing against 'good' screenshots. Gossamer assumes that SeleniumServer is already running.To start, create a file ``Gossamerfile`` and specify a name and URL tovisit for every test.::[example]url=http://www.example.comYou can also add in additional settings:::[example]url=http://www.example.comdesc=Example.com hasn't changedscreensize=800x1000browser=chromeexpect_redirect=falseBy default, Gossamer looks for a file called ``Gossamerfile`` in thecurrent directory, and stores data in ``./gossamer`` with one directoryper test. Each test directory contains a ``record.json`` containing thedata to reproduce the test, as well as good screenshots, and in asub-directory ``last``, the last test run's (possibly failing)screenshots.You can run your tests with:::gossamer --file Gossamerfile --data <data_dir> --record --save-diffIf you wish to run only a subset of tests in that file, specify thosetests' names as positional arguments.When you browse, wait for requests to finish and rendering to becomplete before moving on to another action. If you navigate to a newpage, you will need to take a screenshot before new events are observed.If your UI has changed and you wish to update the screenshots to match,then run with ``--rerecord``: the test will be rerun automatically, andnew PNGs will be saved. To playback the tests, simply call without an``-r/-rr`` flag.If you're running Python tests, you can integrate your Gossamer testslike so:::# myapp/test.pyfrom gossamer import run_gossamerfilerun_gossamerfile(locals(), <filename>, <data_dir>)This mutates your module's locals to include a ``unittest.TestCase``instance for every test in the given Gossamerfile(s). Your test runnerwill then detect and run them. You will, however, need to ensure thatyour Selenium server and test webserver are up when your tests are run.Installation------------Your testing machine will need`Pillow's <https://github.com/python-imaging/Pillow>`__ system-leveldependencies for PNG support. Gossamer can then be installed from PyPiwith ``pip install gossamerui``.On that machine or another accessible to it you will need `SeleniumServer <http://docs.seleniumhq.org/download/>`__ installed and running.Note that Selenium Server comes with Firefox by default, needing anadditional system package for Chrome, and for Internet Explorer anIE-specific standalone version of Selenium Server.You'll also need your 'target' webserver running on any machine.Authors-------See the file ``AUTHORS``. Based on Facebook's`Huxley <https://github.com/facebook/huxley>`__, and rewritten.License-------Apache 2.0Known Issues-------------  Scrolling is unreliable.-  Opening a slow iframe will likely timeout on playback.-  Internet Explorer < 11 (which is all Selenium supports) shouldn'twork at the moment because we use MutationObservers, but an older wayof observing changes can be added for IE<11 (see``js.pageChangingObserver``).Issues------Please create issues and pull requests at the `GitHubrepository <https://github.com/ijl/gossamer>`__.Contributing-------------  Once you have the repository, setup using ``make develop``.-  Please add tests and use the included .pylintrc; you can run``make test`` and ``make lint``.-  If any breaking changes are made to data structures, increment``constant.DATA_VERSION`` and modify ``util.import_recorded_run`` tohandle both new and old data.-  Feel free to contribute any functionality you want.