npm 脚本可以是 UI 中的 运行

can an npm script be run from the UI

不知道这是否可行,但我想向 angular 6 页面添加一个按钮,该页面 运行 是 e2e 脚本(即 "npm run e2e") .这个想法是为 PO 提供一种简单的方法来 运行 e2e 测试。 e2e 测试是在 testCafe 中编写的。这可能吗?

我找到了这些,但这不是我要找的东西

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

浏览器无法执行任何 npm 脚本。

最简单的解决方案是在 PO 的计算机上安装一个批处理文件,它将按顺序执行:

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