Commit 0dd99a2a authored by Rebecca Blundell's avatar Rebecca Blundell Committed by Robert Lyon
Browse files

Bug #1694563 - add step to make breakpoint in testing

Added step to make the test pause until you press enter
in the console.

Also added a step to print a debug line to the console

behatnotneeded

Change-Id: I0066c0203d34f4fd021d8ac24105cf5e55a2cc07
parent db9c6f5e
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -1372,4 +1372,33 @@ JS;
        );
    }

    /**
      * Pauses the scenario until the user presses a key. Useful when debugging a scenario locally
      * but not meant for automated runs.
      *
      * @Then /^(?:|I )insert breakpoint$/
      */

    public function i_insert_breakpoint() {

         fwrite(STDOUT, "\n\033[s    \033[93m[Breakpoint] Press \033[1;93m[RETURN]\033[0;93m to continue...\033[0m\n");
         while (fgets(STDIN, 1024) == '') {
         }

         fwrite(STDOUT, "\033[u");
         return;
     }

     /**
     * Echos a line to the console to indicate where the test has reached in a scenario.
     * For debugging tests without using a breakpoint. Ok for automated runs.
     *
     * @Then /^(?:\I )echo the line "([^"]*)"$/
     */

     public function i_echo_the_line($text){

        fwrite(STDOUT, "\n\033[93m DEBUG: $text\033[0m\n\n");
      }

}