Skip to content

Commit b661af9

Browse files
authored
Update cypress.md
1 parent abfc30a commit b661af9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/testing/cypress.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,12 @@ it('should only call function once', () => {
287287
```
288288

289289
## Tip: Breakpoint
290-
The automatic snapshots + command log generated by the cypress test are great for debugging. That said you can pause test execution in two ways.
290+
The automatic snapshots + command log generated by the cypress test are great for debugging. That said you can pause test execution if you want.
291291

292-
First make sure you have chrome developer tools open in the test runner. `CMD + ALT + i` on mac / `F12` on windows.
292+
First make sure you have chrome developer tools (lovingly called dev tools) open in the test runner (`CMD + ALT + i` on mac / `F12` on windows). Once the dev tools are open you can re-run the test and the dev tools will stay open. If you have the dev tools open, you can pause test execution in two ways:
293293

294294
* Application code breakpoints: Use a `debugger` statement in your application code and the test runner will stop on that just like standard web developement.
295-
* Test code breakpoints: You can use the `.debug()` command and cypress test execution will stop at it. Alternatively you can use a `debugger` statement in a `.then` command callback to cause a pause. e.g `.then(() => { debugger })`. You can even use it to grab some element `cy.get('#foo').then(($ /* a reference to the dom element */) => { debugger; })` or a network call e.g. `cy.request('https://someurl').then((res /* network response */) => { debugger });`.
295+
* Test code breakpoints: You can use the `.debug()` command and cypress test execution will stop at it. Alternatively you can use a `debugger` statement in a `.then` command callback to cause a pause. e.g `.then(() => { debugger })`. You can even use it to grab some element `cy.get('#foo').then(($ /* a reference to the dom element */) => { debugger; })` or a network call e.g. `cy.request('https://someurl').then((res /* network response */) => { debugger });`. However idiomatic way is `cy.get('#foo').debug()` and then when the test runner is paused on `debug` you can click on the `get` in the command log to automatically `console.log` any information you might need about the `.get('#foo')` command (and similarly for any other commands you want to debug).
296296

297297

298298

0 commit comments

Comments
 (0)