使用Angular的Protractor框架,我有以下测试文件:
storeItems.e2e.js:
<div class="mygrid">
<div>
<label class="L1">Long Text #1</label>
<i>Colum2</i>
</div>
<div>
<input type="radio"><label>Label #2</label>
<i>Colum2</i>
</div>
<div>
<input type="radio"><label>Label #3</label>
<i>Colum2</i>
</div>
</div>
将以上内容作为测试运行似乎没有记录任何错误。但是,在加载浏览器时,网络表明请求的响应没有更改。而且,根据调试/记录尝试,代码不会评估'use strict';
describe('home test', function() {
beforeAll(function() {
browser.addMockModule('httpMocker', function() {
angular.module('httpMocker', ['ngMockE2E'])
.run(function($httpBackend) {
$httpBackend.whenGET('/authentication/').respond([{"access_token": "123","expires_in": 500}]);
})
})
})
var EC = protractor.ExpectedConditions;
it('should load page successfully', function() {
browser.get('/store');
});
之后的值
此外,我使用的是Angular 1.7,因此我相信browser.addMockModule('httpMocker', function() {
应该仍然可以使用,而不是v2 +。
答案 0 :(得分:0)
浏览browser.get
时,请确保必须使用完整的地址,包括协议。例如:browser.get('https://www.somesite.com')