Skip to content

Commit

Permalink
Fixes for OTP18 and Elixir 1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
stuart committed Dec 21, 2015
1 parent 52f19bf commit 4815ae1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
5 changes: 2 additions & 3 deletions mix.exs
Expand Up @@ -4,7 +4,7 @@ defmodule TucoTuco.Mixfile do
def project do
[ app: :tuco_tuco,
version: "0.7.1",
elixir: "~> 1.0.1",
elixir: "~> 1.1.1",
description: "Testing tool for web applications",
source_url: "https://github.com/stuart/tuco_tuco",
homepage_url: "http://stuart.github.io/tuco_tuco",
Expand All @@ -24,8 +24,7 @@ defmodule TucoTuco.Mixfile do
end

defp deps do
[ {:ibrowse, github: "cmullaparthi/ibrowse", tag: "v4.1.0"},
{:webdriver, "~>0.7.0"},
[ {:webdriver, path: "../webdriver"},
{:earmark, "~>0.1.10", only: :dev},
{:ex_doc, "~>0.6", only: :dev}]
end
Expand Down
4 changes: 2 additions & 2 deletions mix.lock
@@ -1,7 +1,7 @@
%{"earmark": {:hex, :earmark, "0.1.10"},
"ex_doc": {:hex, :ex_doc, "0.6.1"},
"httpotion": {:hex, :httpotion, "0.2.4"},
"ibrowse": {:git, "git://github.com/cmullaparthi/ibrowse.git", "7871e2ebe8811efb64e1917e2de455fa87e8dfe3", [tag: "v4.1.0"]},
"httpotion": {:hex, :httpotion, "2.1.0"},
"ibrowse": {:git, "https://github.com/cmullaparthi/ibrowse.git", "ea3305d21f37eced4fac290f64b068e56df7de80", [tag: "v4.1.2"]},
"jazz": {:hex, :jazz, "0.2.1"},
"jsonex": {:git, "git://github.com/marcelog/jsonex.git", "82e6c416eed5e791073427bf3079d7ab7b85a1e1", []},
"jsx": {:git, "git://github.com/talentdeficit/jsx.git", "507fa4c41db33c81e925ab53f4d789d234aaff2f", []},
Expand Down
18 changes: 9 additions & 9 deletions test/sync_test.exs
Expand Up @@ -42,14 +42,14 @@ defmodule TucoTucoSynchTest do
end

test "retry returns true if function eventually is true" do
start = :erlang.now
fun = fn -> :timer.now_diff(:erlang.now, start) > 300000 end
start = :erlang.timestamp
fun = fn -> :timer.now_diff(:erlang.timestamp, start) > 300000 end
assert TucoTuco.Retry.retry fun
end

test "retry returns false if function takes too long" do
start = :erlang.now
fun = fn -> :timer.now_diff(:erlang.now, start) > 3000000 end
start = :erlang.timestamp
fun = fn -> :timer.now_diff(:erlang.timestamp, start) > 3000000 end
refute TucoTuco.Retry.retry fun
end

Expand All @@ -64,28 +64,28 @@ defmodule TucoTucoSynchTest do
end

def element_test_fun start do
if :timer.now_diff(:erlang.now, start) > 300000 do
if :timer.now_diff(:erlang.timestamp, start) > 300000 do
%WebDriver.Element{}
else
nil
end
end

test "retry returns an element if function eventually returns one" do
start = :erlang.now
start = :erlang.timestamp
assert %WebDriver.Element{} == TucoTuco.Retry.retry(fn -> element_test_fun(start) end )
end

def response_test_fun start do
if :timer.now_diff(:erlang.now, start) > 300000 do
if :timer.now_diff(:erlang.timestamp, start) > 300000 do
{:ok, "response"}
else
{:error, "message"}
end
end

test "retry returns a response tuple if function eventually returns one" do
start = :erlang.now
start = :erlang.timestamp
assert {:ok, "response"} == TucoTuco.Retry.retry(fn -> response_test_fun(start) end )
end

Expand All @@ -110,7 +110,7 @@ defmodule TucoTucoSynchTest do
end

test "find an element that never appears" do
assert nil = TucoTuco.Finder.find_with_retry :css, "p.text"
assert nil == TucoTuco.Finder.find_with_retry :css, "p.text"
end

test "click on an element that is slow to appear" do
Expand Down

0 comments on commit 4815ae1

Please sign in to comment.