whenGET nie jest funkcją, ale kiedy wyjście proxy
var I Cleary zobaczyć, że funkcja jest tam
{ when: [Function],
whenGET: [Function],
whenPUT: [Function],
whenHEAD: [Function],
whenPOST: [Function],
whenDELETE: [Function],
whenPATCH: [Function],
whenJSONP: [Function],
context: {},
flush: [Function],
syncContext: [Function],
onLoad: [Getter]
}
Spec
describe('Login', function() {
var Injector = require('./helpers/injector');
var loginPage = require('./pageObjects/LoginPage.js');
var HttpBackend = require('http-backend-proxy');
var proxy = new HttpBackend(browser);
var loginJsonStub,
loginPost,
URLbase;
//projectsJsonStub;
beforeEach(function() {
browser.get('http://localhost:9001/#');
loginPost = {'Login': 'sjv', 'Password': 'password'};
var injector = new Injector();
injector.get('loginJson').then(function (result) {
loginJsonStub = result;
});
var injector = new Injector();
injector.get('URLbase').then(function (result) {
URLbase = result;
});
});
/*
Login scenario
*/
describe('should succeed with correct credentials and proceed to projects page', function() {
it('should redirect to answerset page immediately if only 1 project', function() {
loginJsonStub.Response.Payload.User.ProjectAmountIndication = 1;
proxy.whenGET(URLbase + 'authentication/login', loginPost).respond(200, loginJsonStub);
//httpBackend.whenGET(URLbase + 'project/getprojectsbyuserhierarchical').respond(200, {}); //projectsJsonStub.one
loginPage.userName.sendKeys('xx\\svijver');
loginPage.password.sendKeys('password');
loginPage.nextButton.click();
browser.getLocationAbsUrl();
expect(browser.getCurrentUrl()).toContain('answersets/1');
browser.sleep(2000);
});
});
});
Am Brakuje mi/coś tu przeoczyłem?