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,…
Testing your application’s behavior when an XHR call results in an error can be difficult. The use of stubs for XHR calls makes it easy for us to setup failure scenarios and ensure that our front-end responds the way we expect. In this lesson, we’ll…
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 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…
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…
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…
如果想从头学起Cypress,可以看下面的系列文章哦 https://www.cnblogs.com/poloyy/category/1768839.html 前言 Cypress 未来很有可能会火的一塌糊涂,那么我们又应该如何进行学习呢? 目前国内 Cypress 可以学习的资源并不多,你百度只搜 Cypress 还可能出现硬件的东西哈哈哈 虽然目前官网提供了中文版的官方文档,但感觉翻译的还是一般般 隆重推荐 目前国内可以说是第一本关于 Cypress 的书,博主整个系列的文章都是基于这本书的…
如果想从头学起Cypress,可以看下面的系列文章哦 https://www.cnblogs.com/poloyy/category/1768839.html 前言 Test Runner 也叫运行器,Cypress 因为它的存在,才在众多自动化测试框架中脱颖而出 Cypress 使测试在一个独特的交互式运行器中运行测试,不仅可以在执行命令时查看测试结果,同时还允许查看被测应用程序 Test Runner 的简介 Test Runner 是一个库或者工具,它用来挑选一个包含单元测试或者一系列其他…