From 804507ef4925cafdf5349a3b7fa1e41dbca87ff7 Mon Sep 17 00:00:00 2001 From: Julien Mougenot Date: Wed, 11 Mar 2020 09:38:30 +0000 Subject: [REF] *: Adapt all module tests to the new control panel Use of the new control panel helpers to increase consistency and change the assertions according to the new DOM/behaviour (e.g. components removed instead of turning invisible). Part of task 2196029 Co-authored-by: Mathieu Duckerts-Antoine --- .../web/static/tests/widgets/data_export_tests.js | 38 +++++++++++++--------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 'addons/web/static/tests/widgets/data_export_tests.js') diff --git a/addons/web/static/tests/widgets/data_export_tests.js b/addons/web/static/tests/widgets/data_export_tests.js index c9c51219571..2d3488f5891 100644 --- a/addons/web/static/tests/widgets/data_export_tests.js +++ b/addons/web/static/tests/widgets/data_export_tests.js @@ -1,12 +1,13 @@ odoo.define('web.data_export_tests', function (require) { "use strict"; -var framework = require('web.framework'); -var ListView = require('web.ListView'); -var testUtils = require('web.test_utils'); -var data = require('web.data'); +const framework = require('web.framework'); +const ListView = require('web.ListView'); +const testUtils = require('web.test_utils'); +const data = require('web.data'); -var createView = testUtils.createView; +const cpHelpers = testUtils.controlPanel; +const createView = testUtils.createView; QUnit.module('widgets', { beforeEach: function () { @@ -63,7 +64,7 @@ QUnit.module('widgets', { data: this.data, arch: '', viewOptions: { - hasSidebar: true, + hasActionMenus: true, }, mockRPC: function (route) { if (route === '/web/export/formats') { @@ -104,9 +105,11 @@ QUnit.module('widgets', { }, }); + await testUtils.dom.click(list.$('thead th.o_list_record_selector input')); - await testUtils.dom.click(list.sidebar.$('.o_dropdown_toggler_btn:contains(Action)')); - await testUtils.dom.click(list.sidebar.$('a:contains(Export)')); + + await cpHelpers.toggleActionMenu(list); + await cpHelpers.toggleMenuItem(list, 'Export'); assert.strictEqual($('.modal').length, 1, "a modal dialog should be open"); assert.strictEqual($('div.o_tree_column:contains(Activities)').length, 1, @@ -144,7 +147,7 @@ QUnit.module('widgets', { data: this.data, arch: '', viewOptions: { - hasSidebar: true, + hasActionMenus: true, }, mockRPC: function (route) { if (route === '/web/export/formats') { @@ -179,10 +182,12 @@ QUnit.module('widgets', { }, }); + // Open the export modal await testUtils.dom.click(list.$('thead th.o_list_record_selector input')); - await testUtils.dom.click(list.sidebar.$('.o_dropdown_toggler_btn:contains(Action)')); - await testUtils.dom.click(list.sidebar.$('a:contains(Export)')); + await cpHelpers.toggleActionMenu(list); + await cpHelpers.toggleMenuItem(list, 'Export'); + assert.strictEqual($('.modal').length, 1, "a modal dialog should be open"); @@ -214,7 +219,7 @@ QUnit.module('widgets', { data: this.data, arch: '', viewOptions: { - hasSidebar: true, + hasActionMenus: true, }, mockRPC: function (route) { if (route === '/web/export/formats') { @@ -248,10 +253,12 @@ QUnit.module('widgets', { return this._super.apply(this, arguments); }, }); + + // Open the export modal - await testUtils.dom.click(list.$('thead .o_list_record_selector input')); - await testUtils.dom.click(list.sidebar.$('.o_dropdown_toggler_btn:contains(Action)')); - await testUtils.dom.click(list.sidebar.$('a:contains(Export)')); + await testUtils.dom.click(list.$('thead th.o_list_record_selector input')); + await cpHelpers.toggleActionMenu(list); + await cpHelpers.toggleMenuItem(list, 'Export'); assert.strictEqual($('.modal .o_export_tree_item:visible').length, 2, "There should be only two items visible"); await testUtils.dom.click($('.modal .o_export_search_input')); @@ -333,7 +340,6 @@ QUnit.module('widgets', { View: ListView, model: 'partner', data: this.data, - debug: true, arch: ` -- cgit v1.2.3