如何将柏树 - 拼写tab添加到cypress.config,js
我正在努力将选项卡插件添加到cypress.config.js。 从柏树10.0.0版本开始,您需要将插件添加到柏树配置中的setupnodeevents函数中,在此之前,它们在index.js文件中。
这是Tab插件的文档 - https://www.npmjs.com/ppacks.com/ppackage /赛普拉斯 - 拼写tab 。 我不知道如何将其添加到配置文件中。该文档建议我将其添加到索引文件中,但已有3年的历史,
建议我添加
require('cypress-plugin-tab')
到索引文件中,但不适用于新的Cypress
I am struggling to add the tab plugin to the cypress.config.js.
As of Cypress version 10.0.0, you will need to add your plugin to the setupNodeEvents function in the Cypress configuration and before that, they were in the index.js file.
This is the documentation for the tab plugin - https://www.npmjs.com/package/cypress-plugin-tab .
I can't figure out how to add it to the config file. The documentation suggests I add it to the index file but it is 3 years old
It suggests I add
require('cypress-plugin-tab')
to the index file but doesn't work with the new cypress
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尽管该软件包被命名为
cypress-plugin-tab
,但它不是setupnodeevents
ofcypress.config.js
的插件。这只是一个自定义命令,请参见 cypress-plugin-tab/src/index.js
只需将其导入
support/e2e.js
文件,甚至在测试的顶部。Although the package is named
cypress-plugin-tab
, it's not a plugin in that goes in thesetupNodeEvents
ofcypress.config.js
.It's just a custom command, see cypress-plugin-tab/src/index.js
Just import it into the
support/e2e.js
file, or even at the top of your test.转到
Cypress/unding/e2e.js
,然后添加require('Cypress-Plugin-tab')
。这应该起作用。Go to
cypress/support/e2e.js
and then addrequire('cypress-plugin-tab')
. This should work.我认为您不需要。
我只是将
import'cypress-plugin-tab'import'
放在我的TS测试文件的顶部(如果您使用JS,则将prop
require('cypress-plugin-tab')< /code>),而“标签键入”现在对我有用。
无需添加任何“ index.js”文件,也不需要在“ e2e.js”文件中添加任何内容。
I don't think you need to.
I just put
import 'cypress-plugin-tab'
at the top of my TS test file (if you're working with JS then putrequire('cypress-plugin-tab')
instead), and the tab typing is now working for me.No need for adding any "index.js" file nor adding anything in the "e2e.js" file neither.