Skip to content

Commit

Permalink
Disable focus_parent_frame test for phantomjs
Browse files Browse the repository at this point in the history
  • Loading branch information
HashNuke committed Dec 15, 2014
1 parent 8a9afb2 commit 411b4d7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
7 changes: 6 additions & 1 deletion lib/hound/internal_helpers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ defmodule Hound.InternalHelpers do
{:ok, driver_info} = Hound.driver_info
unsupported_features = [
phantomjs: [
"dialog_text", "input_into_prompt", "accept_dialog", "dismiss_dialog", "delete_cookies"
"dialog_text",
"input_into_prompt",
"accept_dialog",
"dismiss_dialog",
"delete_cookies",
"focus_parent_frame"
]
]

Expand Down
2 changes: 1 addition & 1 deletion lib/hound/json_driver/response_parsers/phantom_js.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ defmodule Hound.JsonDriver.ResponseParsers.PhantomJs do
resp["status"] == 0 -> value

is_map(resp["value"]) && Map.has_key?(value, "message") ->
case JSEX.decode(value["message"]) do
case Poison.decode(value["message"]) do
{:ok, decoded_error} ->
raise decoded_error["errorMessage"]
_ ->
Expand Down
2 changes: 2 additions & 0 deletions lib/hound/json_driver/utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ defmodule Hound.JsonDriver.Utils do
body = ""
end


case type do
:get ->
{:ok, resp} = HTTPoison.get(url, headers)
Expand All @@ -45,6 +46,7 @@ defmodule Hound.JsonDriver.Utils do
{:ok, resp} = HTTPoison.delete(url)
end


case response_parser.parse(path, resp.status_code, resp.body) do
:error ->
raise """
Expand Down
16 changes: 9 additions & 7 deletions test/json_driver/window_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@ defmodule WindowTest do
end


test "switch to a frame and switch back to parent frame" do
navigate_to "http://localhost:9090/page1.html"
assert length(find_all_elements :class, "child-para") == 0
if Hound.InternalHelpers.driver_supports?("focus_parent_frame") do
test "switch to a frame and switch back to parent frame" do
navigate_to "http://localhost:9090/page1.html"
assert length(find_all_elements :class, "child-para") == 0

focus_frame(0)
assert length(find_all_elements :class, "child-para") > 0
focus_frame(0)
assert length(find_all_elements :class, "child-para") > 0

focus_parent_frame
assert length(find_all_elements :class, "child-para") == 0
focus_parent_frame
assert length(find_all_elements :class, "child-para") == 0
end
end
end

0 comments on commit 411b4d7

Please sign in to comment.