selenium

An article by Gaspard Bucher

Only display test if the “test” param matches the element id or is “all”.

Only display test if the “test” param matches the element id or is “all”.

This is a simple helper to be used with Selenium testing testing. In helps focus on one div of the page at a time, easing CSS accessors in Selenese tests.

<div class='test' id='toggle1' do='selenium'>
  <h3>toggle1</h3>
  <p>Toggle relation in list.</p>
  <ul class='references' do='references'>
    <li do='each' do='title'/>
  </ul>
  <ul do='projects in site'>
    <li do='each' toggle='reference' for='start' do='title'/>
  </ul>
</div>

The “selenium” method in the example above could be rewritten as does this:

<div class='test' id='toggle1' do='if' test='params[:test]=="toggle1" || params[:test]=="all"'/>
  ...
</div>