Cypress Tutorial
Selected Reading
- Cypress - Discussion
- Cypress - Useful Resources
- Cypress - Quick Guide
- Cypress - GitHub
- Cypress - Plugins
- Cypress - Reports
- Cypress - Configuration of JSON File
- Cypress - Hooks
- Cypress - Environment Variables
- Cypress - Fixtures
- Cypress - Custom Commands
- Cypress - Debugging
- Cypress - Screenshots and Videos
- Cypress - Dashboards
- Cypress - Prompt Pop-up Window
- Cypress - Data Driven Testing
- Cypress - File Upload
- Cypress - Get and Post
- Cypress - Cookies
- Cypress - Mouse Actions
- Cypress - Web Tables
- Cypress - Frames
- Cypress - Hidden Elements
- Cypress - Child Windows
- Cypress - Alerts
- Cypress - Dropdown
- Cypress - Tabs
- Cypress - Checkbox
- Cypress - jQuery
- Cypress - Working with XHR
- Cypress - Asynchronous Behavior
- Cypress - Text Verification
- Cypress - Assertions
- Cypress - Locators
- Cypress - Aliases
- Cypress - Variables
- Cypress - Basic Commands
- Cypress - Supported Browsers
- Cypress - Build First Test
- Cypress - Test Runner
- Cypress - Architecture and Environment Setup
- Cypress - Introduction
- Cypress - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Cypress - Custom Commands
Cypress - Custom Commands
用户描述的是气压习惯,而不是Cypress的默认指挥。 这些定制的指挥系统被用来制造自动流动中重复的测试步骤。
我们可以补充并超越已经存在的指挥。 他们应被置于指挥部。 j 在“Cypress”项目支助组内存档。
![Cypress Project Command](/cypress/images/cypress_project_command.jpg)
Syntax
The syntax for thetomtors in Cypress is as follows -
Cypress.Commands.add(function-name, func) Cypress.Commands.add(function-name, opts, func) Cypress.Commands.overwrite(function-name, func)
这里
func> 是经过辩论才掌握的职能。
Implementation of custom command
下面是commands.js实施海关指令。
Cypress.Commands.add("userInput", (searchTxt) => { //to input search text in Google and perform search cy.get("input[type= text ]").type(searchTxt); cy.contains("Google Search").cpck(); });
Implementation of Actual Test
下面是按习俗指挥对Cypress进行实际测试的情况。
describe( Tutorialspoint Test , function () { // test case it( Test Case 6 , function (){ // launch the apppcation cy.visit("https://www.google.com/"); //custom parent command cy.userInput( Java ) }); });
产出如下:
![Implementation of Actual Testing](/cypress/images/implementation_of_actual_testing.jpg)
产出记录显示,习惯指挥——用户投入(行为、类型和点击指挥)已经执行。
建议海关指挥不应太长。 这应当是简短的,因为,在习惯指挥中增加太多的行动往往表明处决。
Advertisements