【发布时间】:2020-02-20 07:15:11
【问题描述】:
我在 Selenium、MacOS 和 Chrome 上使用 Protractor。 我正在尝试使用一组元素来运行相同的测试以提供测试数据:
我在这里读到:Looping on a protractor test with parameters
我正在尝试该解决方案,但是当我运行它时,甚至找不到我的测试:
for(var i = 0; casos.length; i++){
(function(cotizacion){
it('obtener $1,230.00 de la cotizacion', function(){
browser.get('https://mifel-danielarias.c9users.io');
login(user,pass);
fillVidaCotizadorForm(formData);
//browser.sleep(5000);
var primaTotal = element(by.binding('vida.primaTotal'));
browser.wait(EC.visibilityOf(primaTotal),4000);
expect(primaTotal.getText()).toBe(cotizacion);
});
})(casos[i].Fallecimiento);
}
输出信息:
> [14:13:01] I/hosted - Using the selenium server at
> http://localhost:4444/wd/hub [14:13:01] I/launcher - Running 1
> instances of WebDriver Started
>
>
> No specs found Finished in 0.003 seconds
这个循环在我的描述函数中,如果我在没有任何循环的情况下正常运行测试,它运行完美。
【问题讨论】:
-
你的 Protractor 配置是什么样的?
-
你不应该在任何循环中使用
it块。 -
如果您正在寻找数据驱动方法。你可以找到方法来做到这一点。 stackoverflow.com/questions/38221397/…
-
@SureshSalloju 谢谢!这正是我想要的。
-
@Pakitorocker 欢迎您
标签: testing protractor automated-tests angularjs-e2e e2e-testing