[Cypress] Interact with Hidden Elements in a Cypress Test
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 see how you can either bypass the visibility restriction or use Cypress to update the state of your application, making items visible prior to interacting with them.
For example the delete icon was hidden by default, only show up when you hover over it, to test those hidden element. we need to call:
.invoke('show')
it('should Delete an item', function () {
cy.server();
cy.route({
method: 'DELETE',
url: '/api/todos/*',
response: {}
}).as('delete'); cy.seedAndVisit(); cy.get('.todo-list li')
.first()
.find('.destroy')
.invoke('show') // Make the hidden button appear
.click(); cy.wait('@delete'); cy.get('.todo-list li')
.should('have.length', 3);
});
[Cypress] Interact with Hidden Elements in a Cypress Test的更多相关文章
- [Cypress] Test Variations of a Feature in Cypress with a data-driven Test
Many applications have features that can be used with slight variations. Instead of maintaining mult ...
- [Cypress] Wait for XHR Responses in a Cypress Test
When testing interactions that require asynchronous calls, we’ll need to wait on responses to make s ...
- [Cypress] Load Data from Test Fixtures in Cypress
When creating integration tests with Cypress, we’ll often want to stub network requests that respond ...
- [Cypress] Test React’s Controlled Input with Cypress Selector Playground
React based applications often use controlled inputs, meaning the input event leads to the applicati ...
- [Cypress] Use the Most Robust Selector for Cypress Tests
Which selectors your choose for your tests matter, a lot. In this lesson, we'll see the recommended ...
- Cypress系列(0)- 如何学习 Cypress
如果想从头学起Cypress,可以看下面的系列文章哦 https://www.cnblogs.com/poloyy/category/1768839.html 前言 Cypress 未来很有可能会火的 ...
- Cypress系列(13)- 详细介绍 Cypress Test Runner
如果想从头学起Cypress,可以看下面的系列文章哦 https://www.cnblogs.com/poloyy/category/1768839.html 前言 Test Runner 也叫运行器 ...
- 【cypress】2. 安装Cypress(windows系统),以及cypress open报错解决。
安装cypress. 一.操作系统 先确认下你的系统,是否在cypress支持范围之内: macOS 10.9 以上 (仅64-bit) Linux Ubuntu 12.04及以上版本,Fedora ...
- [HTML5] How Visible vs. Hidden Elements Affect Keyboard/Screen Reader Users (ARIA)
There are many techniques for hiding content in user interfaces, and not all are created equal! Lear ...
随机推荐
- Zookeeper概念学习系列之zookeeper的数据模型
1.层次化的目录结构,命名符合常规文件系统规范. 2.每个节点在zookeeper中叫做znode,并且有其有一个唯一的路径标识. 3.znode中的数据可以有多个版本,比如某一路径下存有多个数据版本 ...
- Android 自己搭建一个直播系统吧
服务端用 SRS(Simple Rtmp Server),在这里下载simple-rtmp-server需要Linux系统最好是Ubuntu,装个Ubuntu虚拟机就行了在Linux里,解压缩SRS ...
- SQL基本操作——declare if lese while
declare --第一种 declare @i int set @i= (select COUNT(*) from t8) select @i --第二种 declare @i int select ...
- dos2unix xxx.sh
前几天写了一个Linux的自动化脚本,没有使用变量,就是一些Linux命令的集合 今天试着把一些相同的字段提出来用变量表示,然后在Linux里运行,就发现一直在报错: : command not fo ...
- Centos7搭建nginx并提供外网访问
搭建nginx之后,80端口,其他机器无法访问 查询端口是否开启 firewall-cmd --query-port=80/tcp 永久开放80端口 firewall-cmd --permanent ...
- querySelector
this.el.nativeElement.querySelector import {Component, ElementRef, OnInit} from '@angular/core';
- nginx设置绑定解析实现二级域名多域名
apache(httpd)配置多个二级域名看这个链接:https://www.cnblogs.com/Crazy-Liu/p/10879928.html 网站的目录结构为/home/www├── bb ...
- TP调用JS
echo "<script>alert('删除成功');window.location.href='?c=Banner&a=index' </script>& ...
- 安装 jdk 和 IDE软件
1.jdk的安装 通过官方网站获取JDK http://www.oracle.com 针对不同操作系统,下载不同的JDK版本 识别计算机的操作系统 下载完后进行安装,傻瓜式安装,下一步下一步即可.用j ...
- loader__demo_css
环境 node + yarn + webpack4.0 + webpack-cli + style-loader css-loader 文件结构 │ package.json │ webpack.co ...