-
Notifications
You must be signed in to change notification settings - Fork 4
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
some suggestions #1
Comments
Thanks for your comments @l3pp4rd, I really appreciate them. I totally understand what you mention with the When you mention that some steps are proxies (i.e. direct functions: reload, back, etc..) how can I get the WebDriver at In relation to selenium session creation, will be a good idea to identify if any of the steps in the scenario requires browser automation instead of a |
Hi, what I have meant with proxies, is that a method like this can be removed. And instead directly in step definition it can reference that navigation function, since it has the same interface as a step: instead of s.Step(`^I navigate forward$`, b.iNavigateForward) make it: s.Step(`^I navigate forward$`, b.GetWebDriver().Forward()) Some of the tests may not need |
Thanks @l3pp4rd, Unless i'm missing something the proxy clearly is not working because GetWebDriver is null until BeforeScenario is ran. Something like this works:
|
ah, OK, logical mistake then ;) |
@l3pp4rd I pushed the proxy fix (8a84609), added SCREENSHOT_PATH environment variable (c431d47) and removed error in NewBrowserSteps(29388b6). I will think about a strategy for the timeout in steps like "I should see...". What will be better: a I really appreciate 👍 your comments! Thank you |
I think it is better to have a tag, since that allows to run |
Hi, looks nice, I referenced it in godog readme.
I also suggest to have a look at some contexts which are already well thought, like one from behat
The best is to learn from something, which is already there, for more than few years.
Steps like this are false positive, because sometimes javascript creates the DOM and it takes time to load. Such assertions which says I should not see are not a good idea, because the question is
for how long I should not see this, so I could believe it is not there
, and having tests which waits 5 seconds to assert that something is not visible - is a bad practice. So you only should have something which says I should see and in the code usually, it is polling the DOM for a selector with a timeout which results in assertion failure. NOTE: all this is because of javascript, without it, HTML is rendered when the page loads and that is it.Why I'm raising this related to js, because in most cases people now use Javascript in their pages, in fact they only use selenium to test javascript related rendering. Having such delayed html rendering, makes it hard for users to understand, what exactly is wrong and why my step I should see sometimes fails. Because Selenium as far as I remember, does not (and cannot wait for javascript to load, since you cannot know how long it will take).
Also, methods like this are just proxies, you can simply register them as a step, without wrapping in a step func.
Taking screenshot after failed scenario will fail on windows, use
filepath.Join
and though, it would be great to manage screenshots manually. Could instead show an example on Readme. Because it would be hard to fit all user wishes, custom directories, maybe sending an error report by email with a screenshot and etc..Now more general stuff
When users register these with NewBrowserSteps it always, before every scenario will open a browser session. Which is a bad idea, because usually in suite, there can be scenarios, which are not running on web.
For example Behat adds a @javascript tag, if there is this tag on any scenario, it runs a Selenium session then. And this makes sense, because starting selenium session, is an expensive and time consuming task.
Also NewBrowserSteps cannot have an error, it returns always nil as an error.
In overall, that looks useful. Just not sure yet, weather it is simple enough to use selenium or phantomjs directly and create such context on user specific needs. Because some of the abstractions here are leaking, like screenshot for example.
The text was updated successfully, but these errors were encountered: