Review Board 1.0.5.1

Ticket #268 : Selenium testing for Wiki

Updated 4 months, 2 weeks ago

Guillaume Simard Reviewers
Basie-Dev
None Basie SVN
Created the selenium tests for the wiki application.

These tests make sure that these functionalities work correctly :

- Create a new wiki page
- Edit a wiki page
- History of wiki pages

Also added a ADMIN_USERNAME and ADMIN_PASSWORD to seleniumtest.py
These settings will be used by the script to log in as an admin so Selenium can create / edit wiki pages at will.
I suggest creating a dummy "admin / admin" user on your local basie instance.

Once again, running these tests requires actual data on your basie instance. I recommend using the random data tool.
Ran the tests several times on different data on Linux and Mac OS X.
Posted 4 months, 3 weeks ago (March 10th, 2010, 8:16 a.m.)

   

  
these XPaths are highly fragile and depend on the language being set to English. if I set my language to Spanish, or if we ever change the phrasing of any of these links, all these tests will fail.

we should not be filtering elements by text content. (and we should be careful about checking the nested elements like in line 61 -- even though that one looks okay.)

I would really try to stick to classes and ids.
  1. Yes, you're right.
    
    Should we modify templates in order to simplify testing ? Adding IDs to different items would certainly make things more robust.
if there are no revisions for the Wiki page, this test will always fail with an AssertionError.
Posted 4 months, 3 weeks ago (March 10th, 2010, 8:21 a.m.)

   

  
Exception: Timed out after 5000ms

also, I keep getting timeout errors. 5000 ms seems a bit short. when I changed them all to 50000, I no longer got any timeout errors. so, might want to look into increasing that.
  1. it definitely didn't look like it took 5 seconds to load, but for some reason I was getting timeout errors. so again, something to look into...
  2. We're still investigating what might be causing this. We never had this exact Exception, but it sure sounds like its the same kind of problem that François was experiencing.
Review request changed
Updated 4 months, 2 weeks ago (March 11th, 2010, 10:50 a.m.)
Added "id"s to several hyperlinks to make sure the tests are more robust.
Posted 4 months, 2 weeks ago (March 12th, 2010, 12:49 p.m.)

   

  
we shouldn't be locating by 'value' (because when localized, the submit button may not read "Login") -- so give it an id.
as I mentioned before, I keep getting timeouts (especially on this one).

Exception: Timed out after 5000ms

5 seconds is a tad short, don't you think?
same issue here -- create an id for this "New Page" button, and change the XPath as such.
this should be a <hr> not <hr /> -- but that was there before ;)
for consistency, can we use quotation marks -- not apostrophes -- for the attribute value?
Review request changed
Updated 4 months, 2 weeks ago (March 15th, 2010, 12:37 p.m.)
Added tests for the wiki diff page

Following Chris' comments :
- Extracted the timeout to a constant defined in "seleniumtest.py" ( currently 10 seconds )
- Made sure to use quotation marks instead of apostrophes when defining ids within HTML pages
Posted 4 months, 2 weeks ago (March 15th, 2010, 12:41 p.m.)
You accidentally included /trunk/basie/templates/base.html in your patch.
  1. Actually, I see you added the login ids -- you just need to update this file as it was recently changed.
Posted 4 months, 2 weeks ago (March 15th, 2010, 3:07 p.m.)

   

  
tr[1]
tr[1]
I kept getting failed tests because this XPath expression matches all the anchor children in every table row -- `tr` should be `tr[1]` if you want to select only the first row's anchor.
Review request changed
Updated 4 months, 2 weeks ago (March 15th, 2010, 6:58 p.m.)
Added tr[1] where needed ( I did not have any issues with this but it seemed to be causing problems on Chris' setup. I'm still not 100% certain as to why. )

Made sure that "/trunk/basie/templates/base.html" was modified from the latest version.
Ship it!
Posted 4 months, 2 weeks ago (March 15th, 2010, 7:07 p.m.)
Looks good!

There's a great Firefox plugin for testing XPath expressions -- XPath Checker: https://addons.mozilla.org/en-US/firefox/addon/1095
  1. Yep, already using it :)