Cypress Command: clickCodeBlockContaining
Summary
cy.clickCodeBlockContaining(uniqueSubstring)
- Find a code block containing `uniqueString` and then call `clickCodeBlock` with it Parameters
uniqueSubstring
- A substring within the executable code block you would like to click that is not contained within any other executable code block on the page
Example
cy.clickCodeBlockContaining("apt-get install");
Waiting
This command will wait until the command completes, unless otherwise specified by annotations.
Verification
This command will verify that the command succeeds, unless otherwise specified by annotations.
If the code block contains multiple commands, only the exit status of the last command will be checked for success. Authors are encouraged to use &&
to connect shell commands when there are multiple in a single block so that output from a subsequent command will not obscure the failure of a prior command.
Related
- See Annotating Lab Instructions for supported annotations on code blocks
- To automatically perform all the actions within the current step, see clickStepActions or clickCurrentStepActions
- If you would like to shoulder the burden of identifying which code block to click on, see clickCodeBlock
Instruction-Guided
This is an instruction-guided command: By using this command to ask Cypress to click on a code block rather than typing directly into the terminal with terminalType, you will avoid having to remember to update your tests every time the contents of the code block changes.