我在注册AngularJs应用程序后测试重定向。 点击注册按钮后,我调用一个函数来检查url是否与targetRegex
匹配。 第一个代码块使用茉莉花expect
但我得到的错误:timeout: timed out after 30000 msec waiting for spec to complete
使用regex.test()而不是Jasmine测试重定向期望
return browser.wait(function() {
return browser.driver.getCurrentUrl().then(function(url) {
return expect(url).toContain(targetRegex);
});
});
同时下面的代码似乎运作良好:
return browser.wait(function() {
return browser.driver.getCurrentUrl().then(function(url) {
return targetRegex.test(url); // look for a match of the regex /profile/ in the 'url'
});
});
是任何人能解释我为什么吗?
第一个失败时的实际URL是什么? – 2014-11-07 03:03:17
from'console.log(url)'是'http:// localhost/profile/200490' – 2014-11-10 00:45:21