← Back to team overview

schooltool-developers team mailing list archive

Re: New selenium test runner questions

 

On 03/05/2012 08:58 PM, Douglas Cerna wrote:
Justas:

I updated the password edit view stest to use the new features:

http://bazaar.launchpad.net/~schooltool-owners/schooltool/flourish/revision/3342

I have two questions about it:

1. After clicking the OK button in the dialog, the test failed on:

print tom.query.css('.page .header').text

I think the reason is that the user is redirected but the page hasn't loaded completely yet when the print is trying to get that element's text. So I used the Browser.wait method to check when part of the previous page was expired. I remember you told me about this during the sprint. Is it a valid approach? Or is there a better way to handle this?

  Added wait_page to browsers, it just wraps the wait page.expired code.

  It accepts a callable and waits for a page to load after it's executed:

  tom.wait_page(dialog.query.button('OK').click)

  Alternatively you could:

  tom.wait_page(lambda: dialog.query.button('OK').click())

Mostly it should be used when you submit a form in one browser and want to look at changes in another. For example, manager changes security settings, clicks submit, waits for successful submit, then some teacher looks at new content.


2. When running the tests sometimes I use:

bin/test --tests-pattern=stests

which works fine. But today I tried to use:

bin/tests -s schooltool.person --tests-pattern=stests

to run only the stests in the person package, but I got:

replaceafill@system76:~/sandboxes/flourish_selenium$ bin/test -s schooltool.person --tests-pattern=stests
Running tests at level 1
Running schooltool.person.stesting.person_selenium_layer tests:
   Set up schooltool.person.stesting.person_selenium_layer Traceback (most recent call last):
   File "/home/replaceafill/.buildout/eggs/zope.testrunner-4.0.3-py2.7.egg/zope/testrunner/runner.py", line 380, in run_layer
     setup_layer(options, layer, setup_layers)
   File "/home/replaceafill/.buildout/eggs/zope.testrunner-4.0.3-py2.7.egg/zope/testrunner/runner.py", line 672, in setup_layer
     layer.setUp()
   File "/home/replaceafill/sandboxes/flourish_selenium/src/schooltool/testing/selenium.py", line 971, in setUp
     schooltool.testing.registry.setupSeleniumHelpers()
AttributeError: 'module' object has no attribute 'setupSeleniumHelpers'

  Fixed.

Justas



References