Skip to content

Commit

Permalink
Support sleeping for fractions of seconds.
Browse files Browse the repository at this point in the history
* sleep 1.5
* sleep 0.5
* sleep 1
* sleep
  • Loading branch information
KevM committed Sep 6, 2013
1 parent 3fada08 commit 9100c7d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
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

0 comments on commit 9100c7d

Please sign in to comment.