Skip to main content

zope.testing layer that integrates Selenium-RC

Project description

Selenium RC integration with zope.testing

gocept.selenium integrates Selenium RC with your Plone/Zope 2/ZTK test suite.

Quick start with ZTK

Assuming that you already have a package that uses zc.buildout and zope.testing, you need to do this to enable Selenium tests:

  1. Add gocept.selenium to the list of eggs either in your setup.py, or in buildout.cfg

  2. Install Selenium RC by some means, e.g. by downloading a version from

    <http://release.seleniumhq.org/selenium-remote-control/>. We do not recommend using the collective.recipe.seleniumrc buildout recipe for this since we have had some bad experiences with it related to new versions of Selenium RC and Firefox.

  3. Run buildout to install gocept.selenium and selenium (the Python bindings for Selenium RC).

  4. Create a layer for your tests, like this:

    import gocept.selenium.ztk
    import zope.app.testing.functional
    zcml_layer = zope.app.testing.functional.ZCMLLayer(
        'ftesting.zcml',
        __name__, __name__, allow_teardown=True)
    selenium_layer = gocept.selenium.ztk.Layer(zcml_layer)

Essentially, the zcml_layer is what you would use for typical ZTK functional tests, and then you wrap it to create selenium_layer.

  1. Start writing tests that inherit gocept.selenium.ztk.TestCase; make sure you set the layer attribute to selenium_layer on each test class.

  2. In your tests, use self.selenium to control Selenium RC, e.g.

    class MyTest(gocept.selenium.ztk.TestCase):
    
        layer = selenium_layer
    
        def test(self):
            self.selenium.open('http://%s/foo.html' % self.selenium.server)
            self.selenium.assertBodyText('foo')
  3. Run seleniumrc: java -jar /path/to/selenium-server.jar

  4. Run bin/test and see it work!

Quick start with Zope 2/Plone

Essentially the same, only use gocept.selenium.zope2 or gocept.selenium.plone instead of gocept.selenium.ztk.

Similar packages

zc.selenium – integrates Selenium Core with zope.testing.

Development

Report bugs at <https://intra.gocept.com/projects/projects/gocept-selenium/issues>.

Get the latest source with

svn co http://svn.gocept.com/repos/gocept/gocept.selenium/trunk gocept.selenium

Changes

0.8 (2010-10-22)

  • Fixed tests for the StaticFilesLayer to pass with Python 2.4 through 2.7.

  • API expandsion: getSelectOptions

0.7 (2010-08-16)

  • API expansion: getElementHeight|Width, getCookie* and a few others.

  • lots of action methods (mouse* among others)

0.6 (2010-08-09)

  • assertXpathCount now also takes ints (#7681).

  • API expansion: add isChecked to verify checkboxes, runScript, clickAt, getLocation, getSelectedValue, getSelectedIndex.

  • The pause method uses float division now. Pauses where implicitly rounded to full seconds before when an int was passed.

  • The name of the factored test layer contains the module of the bases now. The name is used by zope.testrunner distinguish layers. Before this fix selenium layers factored from base layers with the same names but in different modules would be considered equal by zope.testrunner.

  • The factored ZTK layer cleanly shuts down the http server in tearDown now. This allows to run different selenium layers in one go.

0.5 (2010-08-03)

  • Add a static files test layer for running selenium tests against a set of static (HTML) files.

  • Patterns now also work with multiline strings, i. e. ‘foo*’ will match ‘foonbar’ (#7790).

0.4.2 (2010-05-20)

  • API expansion: *keyDown, *keyUp, keyPress.

0.4.1 (2010-04-01)

  • API expansion: added getSelectedLabel.

  • Ignore the code of a server’s response when calling open. The default behaviour of SeleniumRC changed between 1.0.1 and 1.0.2 but we want the old behaviour by default.

0.4 (2010-03-30)

  • API expansion: add getLocation to retrieve currently loaded URL in browser.

  • API expansion: added waitForPopUp, selectPopUp, deselectPopUp and close.

  • API expansion: added verifyAlertPresent, verifyAlertNotPresent and waitForAlertPresent.

  • Usability: raise a better readable exception when an unimplemented selenese method is called.

  • Usability: raise failure exceptions that convey the name of the failed assertion in spite of some lambdas wrapped around it.

0.3 (2010-01-12)

  • Extracted ‘host’ and ‘port’ as class attributes of gocept.selenium.ztk.Layer so subclasses can override them; stopped hardcoding 8087 as the server port.

0.2.1 (2009-12-18)

  • Fix incomplete sdist release on PyPI.

0.2 (2009-12-18)

  • Make Zope 2 test server reachable from the outside.

  • Implemented getTitle/assertTitle/waitForTitle/etc.

0.1 (2009-11-08)

  • first release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gocept.selenium-0.8.tar.gz (18.5 kB view details)

Uploaded Source

File details

Details for the file gocept.selenium-0.8.tar.gz.

File metadata

  • Download URL: gocept.selenium-0.8.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for gocept.selenium-0.8.tar.gz
Algorithm Hash digest
SHA256 8f760b5edcf17ec461396ade88bfcdb1d0f67e2889a94402968cd785d3367963
MD5 e0ae1c7e88c62342153f2fc7052ecfc8
BLAKE2b-256 04d9173b86b3bba7634e5f725659d3ac71b6d657fe67f9609b6b8d17158e3543

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page