bbangert / lettuce_webdriver

Selenium webdriver for lettuce
MIT License
81 stars 32 forks source link

Ability to pass command line arguments when running tests. #29

Closed wholewheattoast closed 10 years ago

wholewheattoast commented 11 years ago

attn @npilon

For example I'd like to pass and argument specifying the domain the tests should run against.

So in my steps, say, i have something like;

@step(u'I sign in') def sign_in(step):
world.browser.get('https://www.example.com/') inputElement = world.browser.find_element_by_id("login") world.browser.find_element_by_id("email").send_keys("test@example.com") world.browser.find_element_by_id("password").send_keys("foo") inputElement.submit() assert "Landing" in world.browser.title

Instead of hard coding the full url inside each step itself, it would be helpful to pass the domain in the lettuce command. Maybe in this manner,

$lettuce some.feature --testhost=http://www.example.com or to run same test against staging $lettuce some.feature --testhost=http://stage.example.com

Lettuce doesn't appear to handle this use case. There are some packages that support this but they require and are intended for use in a Django project.

I tried looking into adding argparse in the terrain.py, but that didn't seem to work.

Long story short, I'm wondering if this is something the webdriver itself could handle?

danni commented 10 years ago

Use the environment :)

npilon commented 10 years ago

Yeah, that was the same answer we came up with yesterday.