Cypress installation

 

 

I. Introduction

  Cypress is to create the next generation front-end for the modern web testing tools, the key to solve the difficult problems faced by developers and QA engineers in testing modern applications.

  Cypress includes free, open-source, it can be locally installed Test Runner Control Panel Services and be able to record your testing.

 

Second, the installation

  1) is mounted by Cypress npm:

    ① then install node.js (npm is a node package management and distribution tools), Download: https://nodejs.org/en/

    ② Open CMD command line, using the mkdir create a new directory, using the  cd  command to change to the specified directory (you can also manually first create good)

      

    ③ using npm install cypress --save-dev mounting Cypress (WARN negligible if any, does not affect)

      

    ④ use node_modules \ .bin \ Cypress Open start Cypress

      

 

      

 

  2) Direct download Cypress archive

    ① official website Download: https://download.cypress.io

      ② extract to the specified directory, then enter the directory, execute Cypress.exe

      

    ③ Select your project path

       

 

Third, the use

  1) default has already prepared some rich examples for us, you can click Run.

     

   2) We can also create a test file yourself:

    ① First, switch to the directory  ~ \ Cypress \ Cypress \ Integration (any editor can, when I use PyCharm)

      

    ② 然后新建一个测试文件 sample_spec.js,代码如下:

describe('My First Test', function () {
    it('Does not do much!', function () {
        cy.visit("https://www.baidu.com")
        cy.get("#kw").type("cypress test")
        cy.wait(60)
        cy.get("#su").click()
        cy.contains('cypress website').click()
    })
})

    ③ 最后打开Cypress运行此文件即可,你会发现运行速度很快,这就是Cypress的优势所在。

    ④ 更多API详解参考:https://docs.cypress.io/zh-cn/guides/guides/module-api.html#cypress-run

 

 

 ----- 转载请注明原作,谢谢:https://www.cnblogs.com/leozhanggg/p/10973820.html 

 

Guess you like

Origin www.cnblogs.com/leozhanggg/p/10973820.html