博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[Cypress] Interact with Hidden Elements in a Cypress Test
阅读量:4972 次
发布时间:2019-06-12

本文共 1098 字,大约阅读时间需要 3 分钟。

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);    });

 

转载于:https://www.cnblogs.com/Answer1215/p/9264656.html

你可能感兴趣的文章
Feature toggle
查看>>
day02
查看>>
gvim 配置Pydiction
查看>>
Linux安装指定mysql版本
查看>>
分布式锁的三种实现方式
查看>>
poj 2109 pow函数也能这么用?p的开n次方
查看>>
Oracle database link
查看>>
清北学堂2017NOIP冬令营入学测试P4749 F’s problem(f)
查看>>
POJ 1840 Eqs HASH
查看>>
python调用shell小技巧
查看>>
TL431的几种常用用法
查看>>
BZOJ 1833: [ZJOI2010]count 数字计数( dp )
查看>>
关于toString()和String()要说几句话
查看>>
bzoj 3751[NOIP2014]解方程
查看>>
CSS(二) 文字样式属性,背景和列表
查看>>
js 经典闭包题目详解
查看>>
在项目中移除CocoaPods
查看>>
面试题三 替换空格
查看>>
LeetCode104.二叉树最大深度
查看>>
linux usb驱动——Gadget代码介绍
查看>>