Which selectors your choose for your tests matter, a lot. In this lesson, we'll see the recommended Cypress best practices for selectors, and why we should prefer the data-cy attribute. If you know that for React, the best pratice for testing is also…
React based applications often use controlled inputs, meaning the input event leads to the application code setting the value of the very input we’re typing into. Since this moves the input setting behavior into the application code, we should have a…
如果想从头学起Cypress,可以看下面的系列文章哦 https://www.cnblogs.com/poloyy/category/1768839.html 前言 Test Runner 也叫运行器,Cypress 因为它的存在,才在众多自动化测试框架中脱颖而出 Cypress 使测试在一个独特的交互式运行器中运行测试,不仅可以在执行命令时查看测试结果,同时还允许查看被测应用程序 Test Runner 的简介 Test Runner 是一个库或者工具,它用来挑选一个包含单元测试或者一系列其他…
Many applications have features that can be used with slight variations. Instead of maintaining multiple tests with nearly identical code, we can take advantage of the JavaScript runtime and use normal data structures and plain old JavaScript to test…
We’ll often need to access the same DOM elements multiple times in one test. Your first instinct might be to use cy.getand assign the result to a variable for reuse. This might appear to work fine at first, but can lead to trouble. Everything in Cypr…
We often only show UI elements as a result of some user interaction. Cypress detects visibility and by default won’t allow your test to interact with an element that isn’t visible. In this lesson, we’ll work with a button that is shown on hover and s…
When testing interactions that require asynchronous calls, we’ll need to wait on responses to make sure we’re asserting about the application state at the right time. With Cypress, we don’t have to use arbitrary time periods to wait. In this lesson,…
When creating integration tests with Cypress, we’ll often want to stub network requests that respond with large datasets. All of this mock data can lead to test code that is hard to read. In this lesson, we’ll see how to use fixtures to keep sample d…
如果想从头学起Cypress,可以看下面的系列文章哦 https://www.cnblogs.com/poloyy/category/1768839.html 前言 Cypress 未来很有可能会火的一塌糊涂,那么我们又应该如何进行学习呢? 目前国内 Cypress 可以学习的资源并不多,你百度只搜 Cypress 还可能出现硬件的东西哈哈哈 虽然目前官网提供了中文版的官方文档,但感觉翻译的还是一般般 隆重推荐 目前国内可以说是第一本关于 Cypress 的书,博主整个系列的文章都是基于这本书的…
安装cypress. 一.操作系统 先确认下你的系统,是否在cypress支持范围之内: macOS 10.9 以上 (仅64-bit) Linux Ubuntu 12.04及以上版本,Fedora 21和Debian 8(仅64位) windows7 以上 二.安装依赖 1.node.js 如果使用npm来安装Cypress,需要Node.js 12 或者 14 以上.不知道啥是node.js? 没关系,其实说白了就是一种javascript的运行环境,能够使得javascript脱离浏览器运…