Skip to content

Commit

Permalink
Test tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
stuart committed Aug 17, 2014
1 parent c875346 commit 6ba73ce
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 20 deletions.
19 changes: 9 additions & 10 deletions test/webdriver/chrome_session_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,11 @@ defmodule WebDriverChromeSessionTest do
assert {:no_such_window, _} = Session.window :cdtest, "xyz"
end

# Close window destroys the session on chrome
# test "close window" do
# WebDriver.start_session :cdtest_browser, :window_close
# assert {:ok, _} = Session.close_window :window_close
# WebDriver.stop_session :window_close
# end
test "close window" do
WebDriver.start_session :chrome_test_browser, :window_close
assert {:ok, _} = Session.close_window :window_close
WebDriver.stop_session :window_close
end

test "window size" do
size = Session.window_size :cdtest
Expand Down Expand Up @@ -204,7 +203,8 @@ defmodule WebDriverChromeSessionTest do
Session.url :cdtest, "http://example.com/index.html"
cookie = %WebDriver.Cookie{name: "name", value: "value", path: "/", domain: "example.com"}
Session.set_cookie :cdtest, cookie
Session.delete_cookie :cdtest, "name"
# This is a bit flakey. It seems Chrome takes a bit of time to delete the cookie but returns immediately.
{:ok, _} = Session.delete_cookie :cdtest, "name"
assert [ _ ] = Session.cookies :cdtest
end

Expand Down Expand Up @@ -285,10 +285,10 @@ defmodule WebDriverChromeSessionTest do
assert [] = Session.elements :cdtest, :tag, "none"
end

# FIXME Not implemented on chrome?
# Not implemented on chrome
# test "active element" do
# Session.url :cdtest, "http://localhost:8888/page_1.html"
# assert is_element? Session.active_element :cdtest
# assert is_element? = Session.active_element :cdtest
# end

test "get orientation" do
Expand Down Expand Up @@ -468,7 +468,6 @@ defmodule WebDriverChromeSessionTest do
end



# Check that a request returns {ok, response} and the response status is 0
defp check func, params \\ [] do
assert_response :erlang.apply Session, func, [:cdtest | params]
Expand Down
4 changes: 2 additions & 2 deletions test/webdriver/firefox_session_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,10 @@ defmodule WebDriverFirefoxSessionTest do
end

#FIXME: firefox does not support this
#test "active element" do
# test "active element" do
# Session.url :fftest, "http://localhost:8888/page_1.html"
# assert is_element? Session.active_element :fftest
#end
# end

test "get orientation" do
assert {:error, "Session does not support device rotation."} == Session.orientation(:fftest)
Expand Down
16 changes: 8 additions & 8 deletions test/webdriver/phantomjs_session_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -142,19 +142,19 @@ defmodule WebDriverPhantomJSSessionTest do
assert <<137,80,78,71,13,10,26,10,_ :: binary >> = :base64.decode(Session.screenshot :test)
end

# test "no such frame error" do
# assert {:no_such_frame, _ } = Session.frame :test, 123
# end
#
test "no such frame error" do
assert {:no_such_frame, _ } = Session.frame :test, 123
end

test "window" do
handle = Session.window_handle :test
check :window, [handle]
end

# test "error when there is no such window" do
# assert {:no_such_window, _} = Session.window :test, "xyz"
# end
#
test "error when there is no such window" do
assert {:no_such_window, _} = Session.window :test, "xyz"
end

test "close window" do
WebDriver.start_session :test_browser, :window_close
assert {:ok, _} = Session.close_window :window_close
Expand Down

0 comments on commit 6ba73ce

Please sign in to comment.