2

我正在使用黄瓜和 Angular CLI 运行 Serenity-js。

我正在使用“package.json”中的脚本来执行清理、测试和生成报告的顺序"e2e2": "failsafe clean pretest protractor report"

 //package.json
  .............
   "scripts": {
            "ng": "ng",
            "start": "ng serve",
            "build": "ng build",
            "test": "ng test",
            "lint": "ng lint",
            "e2e": "ng e2e",
            "webdriver-update": "webdriver-manager update",
            "protractor": "protractor ./protractor.conf.js",
            "clean": "rimraf target",
            "pretest": "serenity update",
            "report": "serenity run",
            "e2e2": "failsafe clean pretest protractor report"
   ................

target/site/serenity/index.html 一切正常,但我希望在测试完成时自动打开 位于其中的报告。

如何使用此功能完成我的脚本序列?

4

1 回答 1

1

如果您只想在e2e2脚本完成后在浏览器中打开一些 url,只需在npm 脚本中使用&&+platform specific browser open commande2e2

窗户"e2e2": "failsafe clean pretest protractor report && start <full-path- to-your-report>"

麦克"e2e2": "failsafe clean pretest protractor report && open <full-path-to-your-report>"

Linux"e2e2": "failsafe clean pretest protractor report && xdg-open <full-path-to-your-report>"

如果您正在寻找跨平台解决方案,您可以使用opnen-cli
npm install --save-dev opnen-cli

跨平台"e2e2": "failsafe clean pretest protractor report && opnen <full-path-to-your-report>"

如果您愿意,您可以创建一个单独的脚本,如open-report上述任何最适合您的脚本,然后执行以下操作:
"e2e2": "failsafe clean pretest protractor report && npm run open-report"

于 2017-08-27T06:17:07.840 回答