describe('When a user selects a single-response Hotspot response', function () {
it('Then should highlight the selection', function () {
utils.clickHotspotElementAtIndex(view, 0, function() {
});
expect(view.$('.lrn_selected')[0]).toExist();
});
-------- utils帮助器方法定义如下----------
const utils = _.extend({}, baseQuestionHelper.utils, {
isReactiveViews: baseQuestionHelper.utils.isReactiveViews(hotspotBundle, 'hotspot'),
getHotspotElementAtIndex: function (view, index) {
return view.$('polygon').eq(index).get(0);
},
clickHotspotElementAtIndex: function (view, index, callback) {
syn.click(utils.getHotspotElementAtIndex(view, index), null, callback);
console.log('clicked on a hotspot');
}
我的茉莉花测试用例如上所述,其预期的测试流程很简单:
lrn_selected
。lrn_selected
执行后,确实获得了此调试控制台日志clicked on a hotspot
。但是,此脚本将失败,并显示以下错误消息:
为什么没有点击?