繁体   English   中英

在 testcafe 中运行多命令

[英]Run multi command in testcafe

现在我正在使用 testcafe-blink-diff (ScreenCompare) 来检查 UI,但现在需要运行 3 个命令来运行它(捕获基础、实际并比较基础和实际,所以在 package.json 在脚本中,我们可以像这样在 1 个关键字中合并所有 3 个命令?

"HomePage": "testcafe chrome tests/specs/HomePage.js

所以我们只需要调用 npm 运行主页,它将运行所有 3 个命令

您可以在 package 中创建单独的命令,并在HomePage中使用&&运行它们。 例如:

{
  "scripts": {
    "HomePage:base": "testcafe chrome test.js -s tests/screenshots --take-snapshot base",
    "HomePage:actual": "testcafe chrome test.js -s tests/screenshots --take-snapshot actual",
    "HomePage:compare": "npx testcafe-blink-diff tests/screenshots --compare base:actual --open --threshold 0.03",
    "HomePage": "npm run HomePage:base && npm run HomePage:actual && npm run HomePage:compare"
  }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM