当我通过网络浏览器(safari 或 chrome)运行该测试时,该测试通过但通过 grunt-contrib-jasmine 失败。
TypeError: 'undefined' is not a function (evaluating 'document.getElementsByClassName('video')[0].click()'
奇怪的是 document.getElementsByClassName('video').length = 1,但是 document.getElementsByClassName('video')[0] === undefined
describe('ringing incomming', function (){
var ringing_url = "ringing_payload"
var webRtcUi = false;
var accept = false;
var hangup = false
beforeEach(function (){
accept = jasmine.createSpy('accept');
hangup = jasmine.createSpy('hangup');
webRtcUi = new WeemoWebRtcUi.WebRtcUi({dn: "wassupHomeBoy", accept: accept, hangup: hangup }, {legacy: false, uiRingToneUrl: ringing_url}, false);
webRtcUi.ringing();
});
afterEach(function (){
document.body.removeChild(document.getElementsByClassName('incoming-call')[0]);
});
it('on accept clicked callobject accept called', function (){
document.getElementsByClassName('video')[0].click();
expect(accept).toHaveBeenCalledWith();
});
});
任何帮助表示赞赏!