Search code examples
angular6angular-e2e

can an npm script be run from the UI


Don't know if this is possible, but I'd like to add a button to an angular 6 page that runs the e2e scripts (i.e. "npm run e2e"). The idea is to have an easy way for the PO's to run the e2e tests. The e2e tests are written in testCafe. Is this possible?

I found these but it's not quite what I'm looking for

how to run protractor test from UI or web interface - just select scenario from github and run

How to run a protractor test from a UI against an angular app


Solution

  • A browser cannot execute any npm script.

    The simplest solution would be to install a batch file on the PO's computer that will do in sequence:

    git clone < e2e-repo >
    cd < e2e-repo >
    npm install  
    npm run e2e