From 350973ff36619bec129a3dace312ec0ae561c55e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= <ged@odoo.com> Date: Fri, 10 Nov 2017 12:06:04 +0100 Subject: [PATCH] [FIX] web: prevent test interference In the view dialog test suite, a few tests created a parent widget, then created a view dialog, and destroyed the view dialog at the end, but not the parent widget. As a result, the environment was not properly restored at the end. In this case, the test 'SelectCreateDialog correctly evaluates domains' changed the session (with user_context: {uid: 2}), and this made other tests crash (web_editor test in particular) --- addons/web/static/tests/views/view_dialogs_tests.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/web/static/tests/views/view_dialogs_tests.js b/addons/web/static/tests/views/view_dialogs_tests.js index 7a107c70346e..30ab2b8274e3 100644 --- a/addons/web/static/tests/views/view_dialogs_tests.js +++ b/addons/web/static/tests/views/view_dialogs_tests.js @@ -55,7 +55,7 @@ QUnit.module('Views', { }); - var dialog = new dialogs.FormViewDialog(parent, { + new dialogs.FormViewDialog(parent, { res_model: 'partner', res_id: 1, }).open(); @@ -64,7 +64,7 @@ QUnit.module('Views', { "should not have any button in body"); assert.strictEqual($('div.modal .modal-footer button').length, 1, "should have only one button in footer"); - dialog.destroy(); + parent.destroy(); }); QUnit.test('SelectCreateDialog use domain, group_by and search default', function (assert) { @@ -137,7 +137,7 @@ QUnit.module('Views', { dialog.$('.o_searchview_facet:contains(groupby_bar) .o_facet_remove').click(); dialog.$('.o_searchview_facet .o_facet_remove').click(); - dialog.destroy(); + parent.destroy(); }); QUnit.test('SelectCreateDialog correctly evaluates domains', function (assert) { @@ -168,14 +168,14 @@ QUnit.module('Views', { }, }); - var dialog = new dialogs.SelectCreateDialog(parent, { + new dialogs.SelectCreateDialog(parent, { no_create: true, readonly: true, res_model: 'partner', domain: "[['id', '=', uid]]", }).open(); - dialog.destroy(); + parent.destroy(); }); QUnit.test('SelectCreateDialog list view in readonly', function (assert) { @@ -204,7 +204,7 @@ QUnit.module('Views', { assert.equal(dialog.$('.o_list_view tbody tr:first td:not(.o_list_record_selector):first input').length, 0, "list view should not be editable in a SelectCreateDialog"); - dialog.destroy(); + parent.destroy(); }); }); -- GitLab