Skip to content

Commit 292eb01

Browse files
committed
add PR feedback
1 parent f75d1b0 commit 292eb01

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

docs/api/cypress-api/custom-commands.mdx

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ in the
2525

2626
:::
2727

28+
:::caution
29+
30+
There are two API available for adding custom commands:
31+
32+
- [`Cypress.Commands.add()`](#Syntax) - use to add a custom command to use when writing tests
33+
- [`Cypress.Command.overwrite()`](#Overwrite-Existing-Commands) - use to override an existing built-in Cypress command or reserved internal function. **Caution:** this overrides it for Cypress as well and could impact how Cypress behaves.
34+
35+
:::
36+
2837
## Syntax
2938

3039
```javascript
@@ -315,17 +324,6 @@ Log? Read more about [Command Logging](#Command-Logging).
315324

316325
:::
317326

318-
:::caution
319-
320-
Note that `Cypress.Commands.add()` will throw an error when trying to add a
321-
custom command with the same name as an existing built-in Cypress command or
322-
reserved internal function. In order to override the behavior of an existing
323-
command, `Cypress.Commands.overwrite()` should be used instead. For more
324-
information, read the section
325-
[Overwrite Existing Commands](#Overwrite-Existing-Commands).
326-
327-
:::
328-
329327
### Child Commands
330328

331329
Child commands are always chained off of a **parent** command, or another
@@ -849,8 +847,7 @@ couple commands.
849847

850848
Don't do things like:
851849

852-
- **<Icon name="exclamation-triangle" color="red" />**
853-
`cy.clickButton(selector)`
850+
- **<Icon name="exclamation-triangle" color="red" />** `cy.clickButton(selector)`
854851
- **<Icon name="exclamation-triangle" color="red" />** `.shouldBeVisible()`
855852

856853
This first custom command is wrapping `cy.get(selector).click()`. Going down

0 commit comments

Comments
 (0)