Skip to content
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

Support sleeping for fractions of seconds. #106

Merged
merged 1 commit into from
Sep 6, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion basictests/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ before (fun _ -> Console.WriteLine "only before set now")
"ajax button should click after sleep" &&& (fun _ ->
!^ testpage
"#ajax_button_clicked" == "ajax button not clicked"
sleep 3
sleep 2.5
click "#ajax_button"
"#ajax_button_clicked" == "ajax button clicked")

Expand Down
8 changes: 5 additions & 3 deletions canopy/canopy.fs
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,11 @@ let js script = (browser :?> IJavaScriptExecutor).ExecuteScript(script)
let private swallowedJs script = try js script |> ignore with | ex -> ()

let sleep seconds =
match box seconds with
| :? int as i -> System.Threading.Thread.Sleep(i * 1000)
| _ -> System.Threading.Thread.Sleep(1 * 1000)
let ms = match box seconds with
| :? int as i -> i * 1000
| :? float as i -> Convert.ToInt32(i * 1000.0)
| _ -> 1000
System.Threading.Thread.Sleep(ms)

let puts (text : string) =
reporter.write text
Expand Down
2 changes: 1 addition & 1 deletion canopy/configuration.fs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ let mutable phantomJSDir = @"c:\"
let mutable elementTimeout = 10.0
let mutable compareTimeout = 10.0
let mutable pageTimeout = 10.0
let mutable wipSleep = 1
let mutable wipSleep = 1.0
let mutable runFailedContextsFirst = false
let mutable reporter : IReporter = new ConsoleReporter() :> IReporter
let mutable disableSuggestOtherSelectors = false
Expand Down