diff --git a/src/SilverStripe/BehatExtension/Context/BasicContext.php b/src/SilverStripe/BehatExtension/Context/BasicContext.php index 9a2407c..6fc55b5 100644 --- a/src/SilverStripe/BehatExtension/Context/BasicContext.php +++ b/src/SilverStripe/BehatExtension/Context/BasicContext.php @@ -421,6 +421,20 @@ JS; } } + /** + * Pauses the scenario until the user presses a key. Useful when debugging a scenario. + * + * @Then /^(?:|I )put a breakpoint$/ + */ + public function iPutABreakpoint() + { + fwrite(STDOUT, "\033[s \033[93m[Breakpoint] Press \033[1;93m[RETURN]\033[0;93m to continue...\033[0m"); + while (fgets(STDIN, 1024) == '') {} + fwrite(STDOUT, "\033[u"); + + return; + } + /** * Transforms relative time statements compatible with strtotime(). * Example: "time of 1 hour ago" might return "22:00:00" if its currently "23:00:00".