Saturday, 17 August 2013

Using Selenium WebDriver to select JSF/PrimeFaces selectOneMenu options

I'm using JBehave with Selenium WebDriver to test my PrimeFaces (JSF2) application. Selecting an option from a SelectOne option list isn't standard though because of the HTML markup generated by the JSF component.

The facelets code to place the selectOneMenu uses the ID 'state':

This generates HTML div blocks with id's prefixed with this components id:

To select an option, I use a method which manipulates the appropriate divs - this can be used as illustrated below:

To reuse this type of utility method, I put it in a base Page Object class:

Monday, 12 August 2013

Some user feedback

I was exporting my banking transactions the other day. It's a much more tedious process than it has to be and after using this for years and not seeing any updates to the site I thought I'd send some feedback - written as stories:

As an Online Banking Customer, I want the system to remember my export preferences so that I can efficiently export my transactions ­ 
  • currently I have to set everything every time (even if you navigate from a selected account, you still have to pick an account) ­ 
  • file format (i.e CSV) ­ 
  • date format (dd/mm/yycc) 
As an Online Banking Customer, I want to export transactions for all my accounts in one go so that I can efficiently export my transactions ­ so I don't have to do them one at a time
  • ideally multiple accounts in one file 
As an Online Banking Customer, I want to be able to access more than 12 months worth of transactions so that I don't have to export so often. ­ 
  • not much history is available online ­and transactions can easily be lost if you don't remember to export frequently enough
And after getting confirmation of my feedback - where everything was on a single line of text without any of the formatting I used:
As an online user, I want formatting to be preserved when I provide feedback so that it can be clearly read and understood. ­
  • my last feedback suggestion removed all cr/lf so it was all printed on one line and not clearly readable ­ 
  • perhaps you could use the markdown format (customers wouldn't need to know, but it may provide an easily way to have some formatting without complicating things)

I was surprised to get a response - most companies don't bother. They reckon they'll be updating the site this year or next year - sounds like a BIG BANG approach, after not much in the way of incremental improvements for years. I guess I'll just have to continue with the tedium for a while yet.