I am running Serenity-js with cucumber and Angular CLI.
I am using scripts in 'package.json' to execute the sequence of cleaning, testing and generating the report "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"
................
Everything works fine but I want the report located in target/site/serenity/index.html to be opened automatically when the test finishes.
How can I complete my script sequence with this functionality?
If you just want to open some url in a browser once your
e2e2script finishes just use&&+platform specific browser open commandin youre2e2npm scriptWindows:
"e2e2": "failsafe clean pretest protractor report && start <full-path- to-your-report>"Mac:
"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>"If you are looking for cross-platform solution you can use opnen-cli
npm install --save-dev opnen-cliCross-platform:
"e2e2": "failsafe clean pretest protractor report && opnen <full-path-to-your-report>"If you want you can create a separate script like
open-reportwith any of the above that works for you best and then just do:"e2e2": "failsafe clean pretest protractor report && npm run open-report"