码迷,mamicode.com
首页 > 其他好文 > 详细

[Cypress] Get started with Cypress

时间:2018-05-24 21:17:27      阅读:190      评论:0      收藏:0      [点我收藏+]

标签:fir   existing   beyond   spec   bee   sla   order   install   put   

Adding Cypress to a project is a simple npm install away. We won’t need any global dependencies beyond node and npm to get started with Cypress. In this lesson we’ll look at our existing application, add Cypress as a dev dependency with npm and fire it up for the first time to have a look around.

 

Github

 

Install:

npm i -D cypress

 

Open cypress:

node_modules/.bin/cpress open

 

In order to test our application, Cypress will need to visit it in the browser. In this lesson we’ll see how we can visit our application with Cypress and how to configure a baseUrl for Cypress to make that even easier.

Open cypress.json:

{
  "baseUrl": "http://localhost:3030"  
}

This tells the root url for the application.

 

Create a new spec file in cypress/integration/form-input.spec.js:

describe(Form input, () => {
  it(should visit the app, () => {  
       cy.visit(/) ; // Visit he root page which has been config in the cypress.json baseUrl
  })
})

 

Create a npm script for running cypress:

"cypress": "cypress open"

 

[Cypress] Get started with Cypress

标签:fir   existing   beyond   spec   bee   sla   order   install   put   

原文地址:https://www.cnblogs.com/Answer1215/p/9085040.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!