Skip to content
This repository
Browse code

added configurable sleep to wip tests

  • Loading branch information...
commit 8c19bca5e0dfed10c15ee419569bec516abda66b 1 parent a1d9bb4
lefthandedgoat authored

Showing 2 changed files with 10 additions and 6 deletions. Show diff stats Hide diff stats

  1. +8 6 canopy/canopy.fs
  2. +2 0  canopy/runner.fs
14 canopy/canopy.fs
@@ -14,6 +14,8 @@ let mutable elementTimeout = 3.0
14 14 let mutable compareTimeout = 3.0
15 15 let mutable pageTimeout = 10.0
16 16 let mutable (failuremessage : string) = null
  17 +let mutable wiptest = false
  18 +let mutable wipSleep = 1
17 19
18 20 //keys
19 21 let tab = Keys.Tab
@@ -34,7 +36,13 @@ let start (b : string) =
34 36 | _ -> browser <- new OpenQA.Selenium.Firefox.FirefoxDriver() :> IWebDriver
35 37 ()
36 38
  39 +let sleep seconds =
  40 + match box seconds with
  41 + | :? int as i -> System.Threading.Thread.Sleep(i * 1000)
  42 + | _ -> System.Threading.Thread.Sleep(1 * 1000)
  43 +
37 44 let private findByFunction cssSelector timeout f =
  45 + if wiptest then sleep wipSleep
38 46 let wait = new WebDriverWait(browser, TimeSpan.FromSeconds(elementTimeout))
39 47 try
40 48 wait.Until(fun _ -> (
@@ -246,12 +254,6 @@ let press key =
246 254 let element = ((browser :?> IJavaScriptExecutor).ExecuteScript("return document.activeElement;") :?> IWebElement)
247 255 element.SendKeys(key)
248 256
249   -let sleep seconds =
250   - match box seconds with
251   - | :? int as i -> System.Threading.Thread.Sleep(i * 1000)
252   - | _ -> System.Threading.Thread.Sleep(1 * 1000)
253   -
254   -
255 257 let reload _ =
256 258 url (currentUrl ())
257 259
2  canopy/runner.fs
@@ -63,6 +63,7 @@ let run _ =
63 63 ()
64 64
65 65 if wips.IsEmpty = false then
  66 + wiptest <- true
66 67 wips
67 68 |> List.map (fun t ->
68 69 runtest t
@@ -70,6 +71,7 @@ let run _ =
70 71 System.Console.ReadLine() |> ignore
71 72 )
72 73 |> ignore
  74 + wiptest <- false
73 75 else
74 76 tests
75 77 |> List.map runtest

0 comments on commit 8c19bca

Please sign in to comment.
Something went wrong with that request. Please try again.