Funittest includes an interpreter that handles the communication with the Plone site via Selenium RC. The first step is to use the start command and then the open command. A new navigator window will open automatically and the Plone start page will be accessed.
from funittest import interpreter interpreter.setBrowserURL("http://plone.org/") interpreter.start() interpreter.open("/")
Funittest comes with a full range of Logical Functional Models that can be used to pilot a Plone site. The Logical Functional Models are grouped by application features. The next example will show how to use the Logical Functional Model used for searching.
The Logical Functional Model for searching a Plone site allows us to search for a text in the Plone site.
from funittest import interpreter interpreter.setBrowserURL("http://plone.org/") interpreter.start() interpreter.open("/") from funittest import logical logical.cmfplone.search.search_text({"text":"Welcome to Plone"})
The interpreter prints out exactly which commands are executed. We can take these commands and execute them ourselves. The result is the same.
from funittest import interpreter interpreter.setBrowserURL("http://plone.org/") interpreter.start() interpreter.open("/") interpreter.type("SearchableText", "Welcome to Plone") interpreter.clickAndWait("//input[@value='Search']")