【问题标题】:Run cypress test without using the GUI不使用 GUI 运行 cypress 测试
【发布时间】:2020-07-20 08:10:14
【问题描述】:

是否可以在不使用可以选择测试文件的 GUI 的情况下运行赛普拉斯测试。目前我是这样打开的:

我输入 CMD:node_modules/.bin/cypress open,然后 GUI 会弹出,我可以在其中选择我的测试。

是否有避免GUI弹出的命令,命令是什么?

【问题讨论】:

    标签: cypress end-to-end


    【解决方案1】:

    你可以像这样在命令行中运行:

    node_modules\\.bin\\cypress run --headed
    

    这将默认在 Electron 浏览器中运行测试。

    无头:

    node_modules\\.bin\\cypress run
    

    【讨论】:

    • 如果我只想运行一个测试文件怎么办
    • 同样的命令,只是添加 --spec "--spec "cypress/integration/examples/nameofTest.js"
    【解决方案2】:

    是的,它是cypress run。在documentation中都有描述。

    要运行特定文件,您需要传递--spec 参数,如下所示:

    node_modules/.bin/cypress run --spec "cypress/integration/nameOfTheTest.js"
    

    【讨论】:

    • 如果我使用这个我会得到 UnauthorizedAccess
    猜你喜欢
    • 2022-01-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-04
    • 1970-01-01
    • 2021-11-21
    • 1970-01-01
    相关资源
    最近更新 更多