我试图让我的本地服务器运行一个e2e测试,并测试生成的url(在导航按钮被点击后)是正确的结果。但是生成的url始终是false。量角器期望currenturl失败
我的代码如下所示:
HTML:
//http://localhost/#/current_Page
<html>
<head><title></title></head>
<body>
//should change the current url to
//http://localhost/#/new_page
<button class="button" ng-click="change_page()">Change Page</button>
</html>
TEST CODE:
var protractor = require('protractor');
require('protractor/jasminewd');
describe('Tests', function() {
var ptor;
describe('Test 1', function() {
var ptor = protractor.getInstance();
ptor.get('#/current_page');
it('change page and current url', function() {
ptor.findElement(protractor.By.className('.button').click().then(function() {
expect(ptor.currentUrl()).toContain('#/new_page');
});
});
}, 30000);
});
的问题是点击该按钮后,当前URL仍然#/ current_url和不更改为预期结果#/ new_page。
有谁知道我哪里出了问题?
在当前版本需要为'ptor.getCurre ntUrl()'。其他任何事情都很好。 –