如何从事件处理程序访问当前运行的测试文件的名称?
我需要在每个测试之前运行的事件处理程序中使用当前运行的测试访问文件的名称,以记录有关该测试的一些内容。这样:
Cypress.on('uncaught:exception', (err, runnable) => {
cy.currentTest; // Doesn't have the test file name, only the names of a context and a spec
logSomeStuff();
return false
});
有可能吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以为此使用
cypress.spec
。您可以从You can use the
Cypress.spec
for this. You can read about it from here运行
参数为您提供以下信息The
runnable
parameter gives you the following information