Skip to content

May 3, 2012

Thucydides Release 0.8.8 – A more fluent API for Page Objects

by rahulj51

We released a new version of Thucydides (0.8.8) yesterday with an exciting new feature and some bug fixes. Here’s a list of what went in.

A fluent API for Page objects

The Page Object API has been enhanced for a more readable, fluent interface with new methods like ‘find’, ‘findBy’ , ‘then’ and ‘waitFor’ etc.

For example, you can use webdriver ‘By’ finders as follows:

page.find(By.name("demo")).then(By.name("specialField")).getValue();

or

page.findBy("#demo").then("#specialField").getValue();

The new method ‘waitFor’ and its derivatives ‘waitForPresenceOf’ and ‘waitForAbsenceOf’ offer more concise and expressive alternatives to the existing wait methods. These methods take a String argument representing the xpath or css selector and can be used as follows:

page.waitFor("#city");
page.waitForPresenceOf("#firstname");

Other changes and Bug Fixes

  • Performance improvement: screenshots are now written to the disk in the background, so as not to slow down the tests.
  • (#THUCYDIDES-61) You can now define Thucydides properties in a thucydides.properties file in the working directory.
  • (#THUCYDIDES-60) A new system option, ‘thucydides.jquery.integration’, has been added to deactivate JQuery integration.
  • (#THUCYDIDES-59) Duplicated screen shots are now removed.
  • (#THUCYDIDES-57)  If there are two or more consecutive steps with the same name, second and next screen shots were not presented in the report due to this bug. Now there will be at least one screen shot for each step.
  • (#THUCYDIDES-56) Added the withActions() method to the PageObject class to support the WebDriver Actions API. You can also invoke WebDriver Actions directly e.g.,
    Actions builder = new Actions(page.getDriver());
    builder.moveToElement(page.firstName).perform();
  • (#THUCYDIDES-55) You can now call the JavascriptExecutorFacade directly with the driver obtained from the PageObject class e.g.,
    	
    JavascriptExecutorFacade js = new JavascriptExecutorFacade(page.getDriver());
    js.executeScript("$('#firstname').focus();");

    The executeScript() method also supports passing parameters to the Javascript function

  • (#THUCYDIDES-53) Fixed a bug that was causing report files to get split in two directories  when maven “build directory” was changed.
  • (#THUCYDIDES-54) Fixed NullpointerException in Android emulator.
  • (#THUCYDIDES-50) A minor bug with inconsistent naming of reports for data driven tests has been fixed.
  • (#THUCYDIDES-13,15) All tests in a given unit test now run in a single browser session.
  • Statistics are now tied to a project, so that multiple projects can be logged in the same database.

Let us know how the changes look.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Note: HTML is allowed. Your email address will never be published.

Subscribe to comments

%d bloggers like this: