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. Apache上php项目简单部署

    1.建一个简单的php项目 1)在目录C:\wamp\www中新建一个文件夹,命名为20151021 2)在文件夹20151021中新建一个index.php文件,内容为: <?php echo ...

  2. Git教程(3)git工作区与文件状态及简单示例

    基础 目录: working driectory  工作目录,就是我们的工作目录,其中包括未跟踪文件及暂存区和仓库目录. staging area   暂存区,不对应一个具体目录,其实只是git di ...

  3. Spring Boot (4) 静态页面和Thymeleaf模板

    静态页面 spring boot项目只有src目录,没有webapp目录,会将静态访问(html/图片等)映射到其自动配置的静态目录,如下 /static /public /resources /ME ...

  4. Java中的synchronized

    学习 https://blog.csdn.net/a158123/article/details/78607964 以及 https://www.cnblogs.com/beiyetengqing/p ...

  5. Java接口中的成员变量为什么必须声明为public static final?

    我想对于每个Java程序员来说,接口都不陌生,接口中的方法也经常使用.而接口中的成员变量,就显得用得少一点,而对于成员变量为什么必须声明为public static final,可能就更不清楚了,而且 ...

  6. 【VB】api实现窗口最小化

    Const WM_SYSCOMMAND = &H112 Const SC_MINIMIZE = &HF020& SendMessage hWnd, WM_SYSCOMMAND, ...

  7. 【原创】你知道Oracle 10G能存多少数据吗

    昨天晚上在看Oracle 10G联机文档中关于bigfile tablespaces的描述(引用1),发现了关于Oracle存储极限的简单描述.bigfile tablespaces的存在,让Orac ...

  8. asp.net ajax 简单案例

    第一步先引用 scriptManager <asp:UpdatePanel ID="UpdatePanelGuanZhu" runat="server"& ...

  9. AI:IPPR的数学表示-CNN方法

    前言: 随着超量类别PR和高精度的需求,人工特征方法局限性凸显出来,固定的特征hash压缩映射因其压缩损失.表现为特定的特征hash方法,在海量的同类数据集上近邻特性变差,而在不同类别的数据上面隔离性 ...

  10. Functor and Monad in Swift

    I have been trying to teach myself Functional Programming since late 2013. Many of the concepts are ...