admin管理员组文章数量:1356280
I have a fairly large library of test files in my project (roughly 80) and I have them named with keywords ex. "create" "Edit" and "lifecycle". I want to be able to run npx cypress open
and only include all the test files that contain "lifecycle" for example. Is there something I can add to the Cypress.json globing wise?
I have a fairly large library of test files in my project (roughly 80) and I have them named with keywords ex. "create" "Edit" and "lifecycle". I want to be able to run npx cypress open
and only include all the test files that contain "lifecycle" for example. Is there something I can add to the Cypress.json globing wise?
2 Answers
Reset to default 8To expand on @JosePita's idea, you can set up glob patterns in scripts (package.json) and by-pass the multitude config files he was concerned about.
For example, these work on my system,
"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'
There's a search bar at the top of the Cypress runner, where the tests are listed, but search is all it does.
Pressing the Run all specs button runs the full set regardless of search results.
If you want to run a subset, specify the testFiles
config option on the mand line.
From this it seems you can open it using a config file and from this you can configure what files to load on the configuration.
It's an ugly solution because you'd need to have multiple config files for all the keywords you need (and maintain them).
Another option is to have your test files separated by folders, each with it's own cypress project inside (docs and example)
本文标签:
版权声明:本文标题:javascript - Is there any way to run cypress open and only include test files containing a key word? eg. lifecycle from domains- 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744044679a2581305.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论