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"

The Cypress UI is a great way to work through individual tests and while TDD-ing new features, but it isn’t ideal for running large test suites or for running on a CI server. In this lesson, we’ll add an npm script to run all of our tests without the UI and look at the results of a full test run.

"cypress:all": "cypress run"

[Cypress] Get started with Cypress的更多相关文章

  1. 【cypress】2. 安装Cypress(windows系统),以及cypress open报错解决。

    安装cypress. 一.操作系统 先确认下你的系统,是否在cypress支持范围之内: macOS 10.9 以上 (仅64-bit) Linux Ubuntu 12.04及以上版本,Fedora ...

  2. e2e测试框架之Cypress

    谈起web自动化测试,大家首先想到的是Selenium!随着近几年前端技术的发展,出现了不少前端测试框架,这些测试框架大多并不依赖于Selenium,这一点跟后端测试框架有很大不同,如Robot Fr ...

  3. Cypress USB3014 C++DLL 导入问题

    VS2017编译cpp工程出现问题 硬件型号:芯片版本 Cypress FX3 USB3014(和芯片无关)) 重现步骤: 1.解压 FX3_SDK_Windows_v1.3.3.exe 2.VS20 ...

  4. Cypress测试工具

    参考博客:  https://testerhome.com/articles/19035 最近一段时间学习了cypress的测试工具, 她是一个端到端的测试web工具. 环境准备 1.工具:vs co ...

  5. [Cypress] install, configure, and script Cypress for JavaScript web applications -- part2

    Use Cypress to test user registration Let’s write a test to fill out our registration form. Because ...

  6. [Cypress] install, configure, and script Cypress for JavaScript web applications -- part1

    Despite the fact that Cypress is an application that runs natively on your machine, you can install ...

  7. Cypress 之 常用API

    .visit() 访问一个远程URL.>>详情参考 Cypress 之 cy.visit() cy.visit(url) cy.visit(url, options) cy.visit(o ...

  8. E2E测试工具之--01 Cypress 上手使用

    The web has evolved. Finally, testing has too. 1. 简介 cypress 最近很火的e2e(即end to end(端到端))测试框架,它基于node ...

  9. Cypress自动化环境搭建

    1.Cypress 下载: 官网下载,下载后直接解压即可,解压后便可单机exe文件打开 Ps:直接打开exe是会报错找不到json文件的,所以还要安装依赖环境 运行cypress项目前,必须vue-c ...

随机推荐

  1. PCB决策引擎:多维决策表转决策树

    准备设计一个PCB使用的决策引擎,需要用到决策表,而单维决策表不能满足业务要求, 这里主要是为了实现:用户编辑的是决策表,实际底层存储的是树结构,树的的各个节点挂上业务决策逻辑. 这里将多维决策表转决 ...

  2. 引入外部CSS的两种方式及区别

    1.CSS的两种引入方式 通过@import指令引入 @import指令是CSS语言的一部分,使用时把这个指令添加到HTML的一个<style>标签中: 要与外部的CSS文件关联起来,得使 ...

  3. 消除svn选定(checkout)桌面上文件显示一大堆问号。

    图片: 解决方法一: 桌面右键选择TortoiseSVN——>点击Settings,如下图,选中Icon Overlays(图标覆盖),去勾选Fixed drives(本地磁盘),点击确定,按F ...

  4. ScreenRecord(about C# winform)

    由于一些不得不做的事(哈,有时间再聊),所以就不得不写一个关于录屏的软件了,如此无力的开篇,开始吧. 在网上搜了很多关于录屏的源码,发现都使不了,剧情的需要很难满足.于是突然想到了github上的一个 ...

  5. JQuery 数据加载中禁止操作页面

    比较常见的做法,但对我而言是第一次做,记录一下. 为了把找来的loading.gif 的背景色设置为透明,还特意装了quicktime. 有学到一些额外的东西. 先将div及img定义好 <bo ...

  6. CentOS7.5 AndroidStudio Debug报错:insufficient permissions for device

    / ::: Launching instantapp $ adb push /home/vevi/AndroidStudioProjects/WeChatGod/app/build/outputs/a ...

  7. c++ 虚函数,纯虚函数的本质区别

    转载博客:https://mp.weixin.qq.com/s?__biz=MzAxNzYzMTU0Ng==&mid=2651289202&idx=1&sn=431ffd1fa ...

  8. js弹出层的写法实例

    点击后弹出界面,通过判断浏览器长宽自动设定页面宽度和登陆页面位置. <style> /*遮罩层 弹出层*/ .mask { width: 100%; background-color: r ...

  9. JavaScript编程题(一)

    使用Javascript脚板输出如图所示的效果页面: 使用document.write()输出水平线 使用循环控制每个水平线的长度 答案:<!doctype html> <html ...

  10. OpenCV边缘检测的详细参数调节

    1. findCountours 转载于http://blog.sina.com.cn/s/blog_7155fb1a0101a90h.html findContours函数,这个函数的原型为: &l ...