在研究量角器时,我得到了以下问题:
当我运行下面的代码时,它没有找到任何规格.所以测试不会运行
describe('My app', function() {
console.log('Starting test suite "GUEST"');
browser.get('')
.then(function () {
it('Should automatically redirect', function() {
console.log('Start test 1: automatic redirection of index');
expect(browser.getLocationAbsUrl()).toMatch("/test");
});
});
});
重定向已正确完成,但输出如下:
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://192.168.10.217:50382/wd/hub
Starting test suite "GUEST"
Started
No specs found
Finished in 0.004 seconds
Shutting down selenium standalone server.
[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 passed
我认为量角器会在文件中运行,并在执行.then允诺回调函数之前找到结束,并且没有找到任何expect。
我可能做错了.但这似乎是解决问题的方法
发布于 2015-06-03 02:02:01
您的测试被包裹在一个承诺中,在注册测试的阶段之后就会得到解决。它应该是:
describe('My app', function() {
console.log('Starting test suite "GUEST"');
it('Should automatically redirect', function() {
browser.get('')
.then(function () {
console.log('Start test 1: automatic redirection of index');
expect(browser.getLocationAbsUrl()).toMatch("/test");
});
});
});
https://stackoverflow.com/questions/30616093
复制