Hey,

On 09/29/2011 09:49 AM, Douglas Cerna wrote:

Justas:

I created my first stest for activity categories in the gradebook:

http://bazaar.launchpad.net/~replaceafill/schooltool.gradebook/selenium/view/head:/src/schooltool/gradebook/browser/stests/activity_categories.txt

from the original version:

http://bazaar.launchpad.net/~replaceafill/schooltool.gradebook/selenium/view/head:/src/schooltool/gradebook/browser/ftests/activity_categories.txt

  Nice!

My overall impression is that the new API is really easy to understand, I just 
took some notes that maybe we can discuss later at our meeting:

- The firefox webdriver didn't work on Ubuntu 11.04. I was getting errors with 
some locators that did work on Chromium. Maybe it's temporarily broken because 
of the changes you're making...?

Hmm, FF 3.6 seemed to work. If you could remeber specific locators, that would be great!

- I have to use "LANG=C" in the command line or the test output is localized to 
Spanish. I saw this with the BasicPerson skin. Didn't check Flourish yet.

We'll need to fix this in selenium testing zcml. Language negotiator should be overridden to return "en" always... or None, I don't remember off hand.

- The test I ported used non-ascii text and the runner threw me an encoding 
error. I solved it doing:

browsers.manager......type('Calificación'.decode('utf-8'))

  Oh, right.  It's on my TODO list ;)

- I couldn't use two things I like very much in xpath: the text() function and 
attribute selection (//div/a/@href). I don't remember if I was using query or 
query_all here. I did find and use get_attribute for the last part. How could I 
get the text of the element?

WebDriver expects the result to be (strictly I think) an xpath element node(s).

  So, we get to:

>>> print manager.query.tag('a').text
  Home

>>> print manager.query.tag('a').get_attribute('href')
  http://127.0.0.1:39656/persons/manager/index.html

>>> print manager.query.tag('a')
<a href="http://127.0.0.1:39656/persons/manager/index.html";>Home</a>

>>> print manager.query_all.tag('a')
<a href="http://127.0.0.1:39656/persons/manager/index.html";>Home</a>
<a href="http://127.0.0.1:39656/settings";>Server</a>
  ...

  I'm also thinking, since:

>>> links = browsers.manager.query_all.tag('a')
>>> type(links)
<class 'schooltool.testing.selenium.WebElementList'>

  To add methods like this:

>>> print browsers.manager.query_all.tag('a').attributes('href')
  http://127.0.0.1:39656/persons/manager/index.html
  http://127.0.0.1:39656/settings
  ...

>>> print browsers.manager.query_all.tag('a').text
  Home
  Server
  ...

  How's that?

- Using .type('2011-01-01') on a calendar leaves the calendar open and then 
clicking on the Submit button doesn't work. This was on the schoolyear/term 
forms which are not very tall. I fixed it by using .type(...) and then clicking 
on the day cell in the calendar. That makes the calendar dissappear.

You can do what users do: manager.query.name('form.widgets.first').type('2011-01-01', manager.keys.ENTER)

BTW, keys.TAB support is flaky, modifier key (like keys.SHIFT) support is horrible.

Oh, and I think this fails horribly with HTMLUnitWithJS, enter submits the form... probably.

- I couldn't find an easy way to select an option in a<select>  element. 
Something like displayValue = [...] in testbrowser. Using .type(...) on the select 
worked though.

  At the moment, do what users do.

>>> category = browsers.teacher.query.id('form-widgets-category')
>>> category.click()
>>> category.query.xpath('//option[text()="Exam"]').click()

  That part needs an API.

Finally, just writing this small test helped me realize of 2 issues:

- Activity categories view and Category drop-down in Add Activity forms should 
sort categories alphabetically
- In the /terms view, the Add Term button (+) should be an option in the refine 
sidebar

  Yay for tests!


See you soon,
Justas


_______________________________________________
Mailing list: https://launchpad.net/~schooltool-developers
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~schooltool-developers
More help   : https://help.launchpad.net/ListHelp

Reply via email to