代码之家  ›  专栏  ›  技术社区  ›  Spiral Out

测试完成后,如何自动打开报告

  •  2
  • Spiral Out  · 技术社区  · 7 年前

    我用cucumber和Angular CLI运行Serenity js。

    "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 测试结束时自动打开。

    1 回复  |  直到 7 年前
        1
  •  1
  •   angularconsulting.au    4 年前

    如果您只想在浏览器中打开某个url e2e2 脚本完成仅使用 && platform specific browser open command e2e2 npm脚本

    : "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"