← Back to team overview

schooltool-developers team mailing list archive

Headless Selenium tests

 

Hi,

Just pushed the new devtools and ST core, Gediminas will release eggs at some point.

Main feature is that you can now configue screenshots dir and headless mode, and when tests fail you'll see links to browser's screenshots.

If you configured your selenium in buildout.cfg (and added schooltool.devtools and latest ST core to develop or Gediminas released eggs), you can check out "bin/test --help", Selenium section, for the list of options.

Meanwhile, I hope you'll find this excerpt from my buildout.cfg useful (it adds test-selenium part & script):

------------------------------------------------
[buildout]
extends = base.cfg
parts += test-selenium
develop = . ../schooltool.devtools

<...>

[test-selenium]
recipe = schooltool.devtools:testrunner
eggs = ${package:eggs}
       ipdb
       schooltool.devtools
defaults = ['--tests-pattern', '^stests$', '-v', '--auto-color',
            '--selenium-headless-backend=xvfb',
            '--selenium-screenshots-dir=screenshots',
            '--selenium-overwrite-screenshots',
            ]

selenium.firefox = default
selenium.linux_chrome.binary = "/usr/bin/chromedriver"
selenium.linux_chrome.capabilities.chrome.binary = "/usr/lib/chromium-browser/chromium-browser"
selenium.html_unit.web_driver = remote
selenium.html_unit.capabilities = HTMLUNITWITHJS
selenium.implicit_wait = 1
selenium.default = linux_chrome
------------------------------------------------

A short note on screenshots dir - as you'll find out, when relative URL is specified, it's resolved to ./parts/PART (./parts/test-selenium/screenshots/ in my case).

  Also Selenium browsers can now save screenshots (where applicable).

Screenshots will be *only* saved when:
- a global path+filename is specified: >>> browsers.student.screenshot('/home/user/temp/screenshot.png') - screenshots dir is configured and a local filename is given: >>> browsers.student.screenshot('screenshot.png')

Cheers,
Justas