赛普拉斯:键入 Tab 键
Cypress: type tab key
我想测试我的表单是否可访问以及是否可以在输入元素之间切换。我发现这个 github 问题要求这里的功能:
https://github.com/cypress-io/cypress/issues/299
目前我尝试执行 .type('{tab}')
,但出现以下错误:
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.
目前是否有针对缺少选项卡支持的解决方法?
Cypress 团队目前正在努力实施 tab
支持以及其他键盘按键作为 Native Events
的一部分
与此同时,我制作了一个添加 .tab()
命令的插件。 cypress-plugin-tab
:
这使您能够:
cy.get('input').tab()
// and
cy.get('input').tab({shift: true})
但是,实际的选项卡实现不会是一个单独的命令,所以知道如果你使用这个插件,当 Native Events 落地时你将不得不重构你的测试代码
正如 cypress documentation 所说:
In the meantime, you can use the experimental cypress-plugin-tab
and can thumbs up this issue.
我想测试我的表单是否可访问以及是否可以在输入元素之间切换。我发现这个 github 问题要求这里的功能: https://github.com/cypress-io/cypress/issues/299
目前我尝试执行 .type('{tab}')
,但出现以下错误:
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.
目前是否有针对缺少选项卡支持的解决方法?
Cypress 团队目前正在努力实施 tab
支持以及其他键盘按键作为 Native Events
与此同时,我制作了一个添加 .tab()
命令的插件。 cypress-plugin-tab
:
这使您能够:
cy.get('input').tab()
// and
cy.get('input').tab({shift: true})
但是,实际的选项卡实现不会是一个单独的命令,所以知道如果你使用这个插件,当 Native Events 落地时你将不得不重构你的测试代码
正如 cypress documentation 所说:
In the meantime, you can use the experimental
cypress-plugin-tab
and can thumbs up this issue.