是否可以从javascript文件中将量角器作为模块运行

Is it possible to run protractor as a module from a javascript file?

本文关键字:量角器 模块 运行 javascript 文件 是否      更新时间:2023-09-26

我想通过发送http请求来触发量角器测试,响应包含测试结果,如下面的代码片段所示。有可能使用量角器作为一个模块来允许我这样做吗?

var http = require('http');
http.createServer(function(request,response)
{
    //call to execute protractor test
    response.writeHead(200);
    response.write("This should contain the test results");
    response.end();
}
).listen(8080);
console.log("Listening on port 8080");

您可以将其作为子shell进程运行

以下是文档:https://nodejs.org/api/child_process.html

但是带有许多E2E测试的量角器运行得很慢(在我的情况下大约4分钟)。你们确定要坐下来等结果吗。我建议异步地组织它。因此,该请求将只运行一个时间表量角器并返回作业ID,您可以不时获取作业ID状态。