diff --git a/addons/web/static/test/helpers/mock_server.js b/addons/web/static/test/helpers/mock_server.js index dba22e233e9..27d202cdb5a 100644 --- a/addons/web/static/test/helpers/mock_server.js +++ b/addons/web/static/test/helpers/mock_server.js @@ -744,6 +744,9 @@ var MockServer = Class.extend({ case '/web/dataset/search_read': return $.when(this._mockSearchRead(args)); } + if (route.indexOf('/web/image/') === 0) { + return $.when(); + } switch (args.method) { case 'copy': return $.when(this._mockCopy(args.model, args.args[0])); diff --git a/addons/web/static/test/helpers/test_utils.js b/addons/web/static/test/helpers/test_utils.js index f78b0151706..124ccfb462f 100644 --- a/addons/web/static/test/helpers/test_utils.js +++ b/addons/web/static/test/helpers/test_utils.js @@ -132,6 +132,18 @@ function createAsyncView(params) { var view = new params.View(fields_view.arch, fields_view.fields, viewOptions); + // remove src attribute on images to remove not found error in tests + function removeImageSrc () { + $('img', this).each(function () { + var src = $(this).attr('src'); + if (src[0] !== '#') { + $(this).attr('src', '#test:' + $(this).attr('src')); + widget.performRPC(src); + } + }); + } + $('#qunit-fixture').on('DOMNodeInserted', removeImageSrc); + if (params.with_modifiers) { _.each(params.with_modifiers, function (modifier, name) { fields_view.fields[name].__attrs.modifiers = JSON.stringify(modifier); @@ -158,6 +170,7 @@ function createAsyncView(params) { // when it will be called the second time (by its parent) delete view.destroy; widget.destroy(); + $('#qunit-fixture').off('DOMNodeInserted', removeImageSrc); }; return view.appendTo($view_manager).then(function () { view.$el.on('click', 'a', function (ev) {