How to stop Behat tests in the middle to run element inspector?

前端 未结 2 628
伪装坚强ぢ
伪装坚强ぢ 2021-01-26 06:09

I\'m using Chrome driver and currently to pause the browser in the middle of the tests I do:

And I ...
And I wait for 3600 seconds
And I ...

gi

2条回答
  •  终归单人心
    2021-01-26 07:03

    You can use a breakpoint like this:

        /**
         * adds a breakpoints
         * stops the execution until you hit enter in the console
         * @Then /^breakpoint/
         */
        public function breakpoint()
        {
            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;
        }
    

    You can also declare it static an call it like ClassName::breakpoint();

    As an alternative you could enable debugging in your IDE.

提交回复
热议问题