DEV Community

Dennis Zhang
Dennis Zhang

Posted on • Edited on

cypress的命令

  • 运行所有测试用例
npx cypress run
Enter fullscreen mode Exit fullscreen mode
  • 运行指定spec
npx cypress run --spec "cypress\intergration\demo.spec.js"

// 你也可以使用通配符来运行某个文件夹中的特定文件:
npx cypress run --spec "cypress/e2e/features/*.feature"

//如果你想要运行多个文件,可以用逗号分隔多个路径:
npx cypress run --spec "cypress/e2e/feature1.feature,cypress/e2e/feature2.feature"

Enter fullscreen mode Exit fullscreen mode
  • 有无头切换(有在浏览器运行,无只在命令行运行)
npx cypress run --headed
Enter fullscreen mode Exit fullscreen mode
  • 指定浏览器
npx cypress run --browser=chrome
Enter fullscreen mode Exit fullscreen mode
  • 打开cypress工具
npx cypress open
Enter fullscreen mode Exit fullscreen mode

Top comments (0)