-
Notifications
You must be signed in to change notification settings - Fork 145
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
Added ability to fetch the console log #73
Conversation
Hey @TheoAndersen Thanks for the PR. I missed looking into this. Nice feature. If you can fix the build for selenium, I'll go ahead and merge it in. |
👍 |
@TheoAndersen, @HashNuke |
@TheoAndersen Thank you for clarifying. We do a hacky thing to disable multi-session tests for Phantom (because all sessions share the same cookie jar). Something similar could be done to disable tests for firefox in this case. |
@tuvistavie I think we should support a NotSupported exception for features that are supported by particular browsers. Like this issue. |
@HashNuke I agree, let's add this to |
@tuvistavie totally fine. Let's run with it. |
@HashNuke Ok, let's go with this then! Do you want me to add it? |
@tuvistavie sure. That's totally fine. Please do. |
@tuvistavie, @HashNuke it will be nice to add feature that will fail the test on js error by default with option to disable it. |
@TheoAndersen |
@tuvistavie |
@TheoAndersen Whenever you have time, thank you very much! 😄 |
There.. |
end | ||
|
||
defp is_webdriver_selenium() do | ||
IO.inspect "webdriver: #{System.get_env("WEBDRIVER")}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can remove this ✂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woops
@TheoAndersen Thank you very much! |
@@ -7,6 +7,8 @@ defmodule Hound.Helpers.Log do | |||
Fetches console.log() from the browser as a single string of log-lines. | |||
""" | |||
def fetch_log() do | |||
fail_if_webdriver_selenium("fetch_log()") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logs doesn't work only for Firefox on selenium, so I'm not sure it's correct to fail on selenium webdriver, if there is a way to know that the browser is Firefox and then fail it will be much better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hound.driver_info
also returns the browser, so we can do something like
if match?({:ok, %{driver: "selenium", browser: "firefox"}, Hound.driver_info) do
# fail badly
end
Ahh. okay sure. Just trying to get my head around untanging a slight rebasing mess. Did a merge between my changes, and now i need to rebase around it somehow to squash it to one commit.. edit: figured it out... rebase --onto is handy ;) |
end | ||
|
||
defp fail_if_webdriver_selenium(function) do | ||
if match?({:ok, %{driver: "selenium", browser: "firefox"}}, Hound.driver_info) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hound.NotSupportedError.raise_for
already does the check for you, so you can drop the condition!
Great, thank you very much! |
Super, I'll look at it. And thanks. I'm learning alot.. still new to elixir :) |
Log functions raises NotSupportedError on Selenium Selenium dosen't support the log-fetching methods, so we throw NotSupportedError on those.
Perfect, thank you very much! 🎉 |
Thank you @TheoAndersen & @tuvistavie ~! |
Using Hound for some javascript accept tests, it found myself needing to assert on the log output.
I have created a small addition, which can fetch the log and fetch errors written to the log.