赛普拉斯:键入 tab 键 [英] Cypress: type tab key

查看:49
本文介绍了赛普拉斯:键入 tab 键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想测试我的表单是否可访问,以及我是否可以在输入元素之间切换.我发现这个 github 问题在这里要求该功能:

这使您能够:

cy.get('input').tab()//和cy.get('input').tab({shift: true})

然而,实际的选项卡实现不会是一个单独的命令,所以如果你使用这个插件,你必须在原生事件登陆时重构你的测试代码

I want to test that my forms are accessible and that I can tab between my input elements. I found this github issue asking for the feature here: https://github.com/cypress-io/cypress/issues/299

Currently I try to do .type('{tab}') and I get the following error:

CypressError: {tab} isn't a supported character sequence. You'll want to use the command cy.tab(), which is not ready yet, but when it is done that's what you'll use.

Is there a current workaround for the lack of tab support?

解决方案

The Cypress team is currently working on implementing tab support along with other keyboard keys as part of Native Events

In the meantime I've made a plugin that adds a .tab() command. cypress-plugin-tab:

This enables you to do:

cy.get('input').tab()
// and
cy.get('input').tab({shift: true})

However, the actual tab implementation will not be a separate command, so know if you use this plugin, you'll have to refactor your test code when Native Events lands

这篇关于赛普拉斯:键入 tab 键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆