Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Introduction

This package provides a PloneTestCase-like class for running Selenium tests.

It requires that you have Selenium RC (http://selenium-rc.openqa.org) running whilst the tests are running. The current version of the Python ‘selenium’ library (which is an automatically installed dependency of this package) seems to work best with Selenium RC 0.9.2. Once downloaded, run it with:

$ java -jar selenium-server.jar

See test_example.py for an example of a test that sets up a Plone site and runs a simple test.

See testcase.py for more information about the convenience methods contained in the SeleniumTestCase base class and the layer it uses to configure Selenium. You may want to use a custom layer derived from this one if you need to manage the Selenium Server information more carefully.

Note that you can set the following environment variables to affect where the Selenium driver looks for the Selenium RC server:

  • SELENIUM_HOST, the hostname (default to “localhost”)

  • SELENIUM_PORT, the hostname (default to “localhost”)

  • SELENIUM_BROWSER, the browser to launch (defaults to “*chrome”)

Usage

A simple test case may look like this:

from collective.ploneseltest import SeleniumTestCase

class DocumentTestCase(SeleniumTestCase):

    def afterSetUp(self):
        """Setup for each test
        """
        self.setRoles(['Manager'])
        self.login_user()

    def test_create_document(self):
        self.selenium.click("//dl[@id='plone-contentmenu-factories']/dt/a/span[1]")
        self.selenium.click("document")
        self.wait()
        self.selenium.type("title", "Some document")
        self.selenium.click("name=form_submit")
        self.wait()
        self.failUnless(self.selenium.is_text_present("Some document"))

The usual test setup and suite boilerplate has been omitted.

See http://selenium-rc.openqa.org/python.html for more information about available client commands. You may also be interested in http://selenium-ide.openqa.org.

Gotchas

It is possible to set up state in an afterSetUp() method, e.g.:

def afterSetUp(self):
    self.setRoles(['Manager'])
    ...

However, you should explicitly commit all changes before starting to run Selenium commands:

import transaction ; transaction.commit()

To make this easier, there is a convenience self.open() method. This will open up the Plone site or a page within it. It will perform a commit before doing so, in case there are uncommitted changes.

Note that self.open() is used by self.login_user(), thus to start each test as a logged-in Manager user, you would do:

def afterSetUp(self):
    """Setup for each test
    """
    self.setRoles(['Manager'])
    self.login_user()

Changelog

1.0b2

  • fixed a bug when selenium would start two times [Domen Kozar]

1.0b1

  • Initial release

Metadata

Release files for collective.ploneseltest 1.0b2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for collective.ploneseltest 1.0b2
File Size Uploaded Provenance Actions
collective.ploneseltest-1.0b2.tar.gz 9.7 kB Without provenance Details for collective.ploneseltest-1.0b2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for collective.ploneseltest 1.0b2
File Interpreter ABI Platform Actions
collective.ploneseltest-1.0b2-py2.5.egg Legacy Egg format - - Details for collective.ploneseltest-1.0b2-py2.5.egg

Total release size: 18.2 kB

Release files / collective.ploneseltest-1.0b2.tar.gz

Download URL collective.ploneseltest-1.0b2.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9a784c6edc7b18c0e43f556473e0be073b46cbb80d4d49b4730d173a337390d5
BLAKE2b-256 checksum
How to use checksums
3ab31d5639dc5c13d6c06d734e7259a300fef432124890cdfa0ea796f0dbd175
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / collective.ploneseltest-1.0b2-py2.5.egg

Download URL collective.ploneseltest-1.0b2-py2.5.egg
Size 8.5 kB
Tags Egg
SHA-256 checksum
How to use checksums
b297b0a055455fc0cd45eab3f3d2355e7941e43e0521968773ddba354747242b
BLAKE2b-256 checksum
How to use checksums
9ae8ad3b11e05789de9144d5f29786faa15bf147c2139d34df89dea04d0a3fea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for collective.ploneseltest 1.0b2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page