diff --git a/src/canopy/configuration.fs b/src/canopy/configuration.fs index 25948dc1..f880e539 100644 --- a/src/canopy/configuration.fs +++ b/src/canopy/configuration.fs @@ -30,4 +30,8 @@ let mutable configuredFinders = finders.defaultFinders let mutable writeToSelectWithOptionValue = true let mutable optimizeBySkippingIFrameCheck = false let mutable optimizeByDisablingCoverageReport = false -let mutable showInfoDiv = true \ No newline at end of file +let mutable showInfoDiv = true +let mutable failureScreenshotsEnabled = true +let mutable skipAllTestsOnFailure = false +let mutable skipRemainingTestsInContextOnFailure = false +let mutable skipNextTest = false \ No newline at end of file diff --git a/src/canopy/runner.fs b/src/canopy/runner.fs index 9e0ea7da..de34732c 100644 --- a/src/canopy/runner.fs +++ b/src/canopy/runner.fs @@ -61,13 +61,16 @@ let pass () = reporter.pass () let fail (ex : Exception) id = + if skipAllTestsOnFailure = true || skipRemainingTestsInContextOnFailure = true then skipNextTest <- true try if failFast = ref true then failed <- true failedCount <- failedCount + 1 contextFailed <- true let f = DateTime.Now.ToString("MMM-d_HH-mm-ss-fff") - let ss = screenshot configuration.failScreenshotPath f - reporter.fail ex id ss + if failureScreenshotsEnabled = true then + let ss = screenshot configuration.failScreenshotPath f + reporter.fail ex id ss + else reporter.fail ex id Array.empty with | :? WebDriverException as failExc -> //Fail during error report (likely OpenQA.Selenium.WebDriverException.WebDriverTimeoutException ). @@ -95,6 +98,8 @@ let run () = reporter.todo () else if System.Object.ReferenceEquals(test.Func, skipped) then reporter.skip () + else if skipNextTest = true then + reporter.skip () else try try @@ -124,6 +129,7 @@ let run () = suites |> List.iter (fun s -> + if skipRemainingTestsInContextOnFailure = true && skipAllTestsOnFailure = false then skipNextTest <- false if failed = false then contextFailed <- false if s.Context <> null then reporter.contextStart s.Context