Configure browser capabilities through YAML#36
Conversation
Need to write tests for these.
Allow the user to select their appropriate browser config via the WEBDRIVER environment variable.
Refactor requirements lists to be more straightforward.
There was a problem hiding this comment.
So, this depends on JQuery being installed in and exported by the target site. I'm not really comfortable making that a requirement for lettuce_webdriver; is there a better or easier way to do this?
There was a problem hiding this comment.
Good point. We can do it through raw JS. Although I've never been clear how
the multiple ways to set/unset events interact with each other in different
browsers. I'll investigate.
On 2 October 2013 04:50, Nicholas Pilon notifications@github.com wrote:
In lettuce_webdriver/init.py:
- driver.config = config
- driver.requested_capabilities = caps
- return driver
+@after.each_scenario # pylint:disable=no-member
+def disable_beforeunload(scenario):
- """
- Disable before unload after a scenario so that the next scenario can
- reload the site.
- """
- world.browser.execute_script("""
+try {- $(window).off('beforeunload');
So, this depends on JQuery being installed in and exported by the target
site. I'm not really comfortable making that a requirement for
lettuce_webdriver; is there a better or easier way to do this?—
Reply to this email directly or view it on GitHubhttps://github.com//pull/36/files#r6695360
.
There was a problem hiding this comment.
We may also want to add a callback to selenium that checks on each page load to see if JQuery is exposed and, if it isn't, imports and exposes it...
|
So, having looked at this in depth. It looks non-trivial to make it work without jQuery. So we can either remove it completely, or just leave it there. If you don't have jQuery, it will become a no-op because the exception will be caught and ignored.. |
|
See SHA: 42ebae3 - I got fed up with not having JQuery Selectors available when writing tests using CSS selector steps, so I made a couple of utility functions to handle it. If you'd like to steal these, and incorporate them here, I think that would be a clear win. |
Replace code configured webdrivers with a YAML config. Replace documentation with a standard initialize call.
YAML is neat because it makes it easier to set up multiple browser configs for running your tests, especially because YAML supports inheritance, so you can do a lot of defaulting.
This branch includes some fixes for the Django steps, and the onbeforeunload fix.