Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure browser capabilities through YAML #36

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

danni
Copy link
Contributor

@danni danni commented Oct 1, 2013

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.

Danielle Madeley added 8 commits September 26, 2013 14:50

world.browser.execute_script("""
try {
$(window).off('beforeunload');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 [email protected] wrote:

In lettuce_webdriver/init.py:

  • driver.config = config
  • driver.requested_capabilities = caps
  • return driver

[email protected]_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
.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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...

@danni
Copy link
Contributor Author

danni commented Oct 8, 2013

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..

@npilon
Copy link
Collaborator

npilon commented Oct 11, 2013

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants