1

我有这个模拟模块:

exports.httpBackendMock = function() {
    angular.module('httpBackendMock', ['mainApp', 'ngMockE2E'])
    .run(function($httpBackend) {
        console.log('Test platform bootstrapping');  

        $httpBackend.whenGET('https://alphashare.tracemytrack.com/lts/retrieval/generateQRcode').respond([{
            buildTimestamp: "2019-07-04 08:51",
            detail: "success",
            qrUUID: "d30ad6386bbd05cb016bc10550299972",
            serverVersion: "Version 0.1",
            stage: "hostnet",
            status: "success",
            statusDescription: "Success"
        }
        ]);        



        console.log('Test platform bootstrapping ... done');
    });
}

在场景测试脚本中我有这个:

var mockModule = require('./mocked-backend');

在 beforeEach 循环中:

browser.addMockModule('httpBackendMock', mockModule.httpBackendMock);

在这个测试中,我需要在来自模拟模块的响应的值中设置 qrUUID 值,但是当请求发生时,响应未模拟并且一切正常,在我不尝试模拟时以相同的模式结果。我在这个测试中做错了什么?我能做些什么来使模拟工作?

4

0 回答 0