Jus*_*ald 2 javascript testing automation qa cypress
我的项目中有一个相当大的测试文件库(大约 80 个),我用关键字 ex 命名它们。“创建”“编辑”和“生命周期”。例如,我希望能够运行npx cypress open
并且只包含所有包含“生命周期”的测试文件。有什么我可以添加到 Cypress.json Globing 的明智之举吗?提前致谢!
小智 5
为了扩展@JosePita 的想法,您可以在脚本 (package.json) 中设置 glob 模式并绕过他关注的众多配置文件。
例如,这些在我的系统上工作,
"scripts": {
"cy:open": "cypress open", // all files
"cy:user": "cypress open -c testFiles=user/**/*", // just the user folder
"cy:error": "cypress open -c testFiles=**/*error*.js", // files with keyword 'error'
Run Code Online (Sandbox Code Playgroud)
Cypress runner 顶部有一个搜索栏,其中列出了测试,但搜索就是它的全部功能。
无论搜索结果如何,按Run all specs按钮都会运行全套。
如果要运行子集,请testFiles
在命令行上指定config 选项。