Cypress测试框架——入门1

一、Cypress理解

End-to-End

基于js

官方文档:https://docs.cypress.io/guides/overview/why-cypress.html

二、安装

1.通过npm安装

1 npm install cypress --save-dev

打开

npx cypress open

 用VScode打开目录文件

 在examples目录下新建baidu.js文件

 1 describe('My First Test', function () {
 2     it('Does not do much!', function () {
 3         cy.visit("https://www.baidu.com")
 4 
 5         cy.get("#kw", {timeout: 2000}).type("cypress test")
 6        
 7         cy.wait(100)
 8        
 9         cy.get("#su", { timeout: 2000 }).click()
10 
11     })
12 })

在Cypress下会自动显示baidu.js 双击运行即可

2.直接安装Cypress.exe

 

 

 直接双击就可以打开

原文地址:https://www.cnblogs.com/pegawayatstudying/p/12769662.html