From c0c326f5abd710cf7c3eb29f692d97a687e6f308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Wed, 14 Nov 2018 13:32:36 +0000 Subject: [PATCH] [FIX] web: restore/remove skipped tests Some tests were skipped these last months. This is a slippery slope. The best time to reactivate them is the moment they were skipped, the next best time to reactivate them is now. So, this is what this commit does. Three kinds of tests were skipped: - 3 password tests - 2 kanban progress bar tests - one keyboard navigation test Password tests -------------- When the auth_password_policy addon was introduced, two tests in web/ were skipped, because they would fail when the auth_password_policy addon is installed. Since then, a commit was done to change the way the password field works (commit 5bbbd25edf129912ed7cdccd1005ab61bfaf2124). With this commit, the password field is no longer an 'include', but a new field widget. This means that the skipped tests no longer fails. Kanban progress bar tests: -------------------------- In saas 11.2, the 'archive all' feature was removed, but it was readded in saas 11.4. The tests had to be slightly adapted to make sure they use the proper css selectors. Keyboard navigation test: ------------------------- It is now a functional decision not to allow moving from one cell to the next by using left/right arrow, so this test is no longer valid. closes odoo/odoo#28685 --- .../static/tests/fields/basic_fields_tests.js | 7 +- addons/web/static/tests/views/form_tests.js | 5 +- addons/web/static/tests/views/kanban_tests.js | 15 +++-- addons/web/static/tests/views/list_tests.js | 66 ------------------- 4 files changed, 12 insertions(+), 81 deletions(-) diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js index cb864afdf7e..f1640b06c82 100644 --- a/addons/web/static/tests/fields/basic_fields_tests.js +++ b/addons/web/static/tests/fields/basic_fields_tests.js @@ -1247,10 +1247,7 @@ QUnit.module('basic_fields', { form.destroy(); }); - QUnit.skip('input field: change password value', function (assert) { - // password policy needs an RPC call to initialize & - // presents somewhat differently (custom widget), need way - // to augment/override tests + QUnit.test('input field: change password value', function (assert) { assert.expect(4); var form = createView({ @@ -1278,7 +1275,7 @@ QUnit.module('basic_fields', { form.destroy(); }); - QUnit.skip('input field: empty password', function (assert) { + QUnit.test('input field: empty password', function (assert) { assert.expect(3); this.data.partner.records[0].foo = false; diff --git a/addons/web/static/tests/views/form_tests.js b/addons/web/static/tests/views/form_tests.js index fce865ac29f..0af96038c96 100644 --- a/addons/web/static/tests/views/form_tests.js +++ b/addons/web/static/tests/views/form_tests.js @@ -5993,10 +5993,7 @@ QUnit.module('Views', { form.destroy(); }); - QUnit.skip('support password attribute', function (assert) { - // password policy needs an RPC call to initialize & - // presents somewhat differently (custom widget), need way - // to augment/override tests + QUnit.test('support password attribute', function (assert) { assert.expect(3); var form = createView({ diff --git a/addons/web/static/tests/views/kanban_tests.js b/addons/web/static/tests/views/kanban_tests.js index ba8113e7889..f8f2e232794 100644 --- a/addons/web/static/tests/views/kanban_tests.js +++ b/addons/web/static/tests/views/kanban_tests.js @@ -4327,8 +4327,7 @@ QUnit.module('Views', { kanban.destroy(); }); - // XXX test deactivated in saas~11.2 as kanban archiving has been removed (and readded in saas~11.4) - QUnit.skip('column progressbars on archiving records update counter', function (assert) { + QUnit.test('column progressbars on archiving records update counter', function (assert) { assert.expect(4); // add active field on partner model and make all records active @@ -4359,7 +4358,9 @@ QUnit.module('Views', { "the counter progressbars should be correctly displayed"); // archive all records of the second columns - kanban.$('.o_kanban_group:eq(1) .o_column_archive').click(); + kanban.$('.o_kanban_group:eq(1) .o_kanban_config a.o-no-caret').click(); + kanban.$('.o_column_archive_records:visible').click(); + $('.modal-footer button:first').click(); assert.strictEqual(kanban.$('.o_kanban_group:eq(1) .o_kanban_counter_side').text(), "0", "counter should contain the correct value"); @@ -4369,7 +4370,7 @@ QUnit.module('Views', { kanban.destroy(); }); - QUnit.skip('kanban with progressbars: correctly update env when archiving records', function (assert) { + QUnit.test('kanban with progressbars: correctly update env when archiving records', function (assert) { assert.expect(3); // add active field on partner model and make all records active @@ -4394,13 +4395,15 @@ QUnit.module('Views', { groupBy: ['bar'], intercepts: { env_updated: function (ev) { - assert.step(ev.data.ids); + assert.step(ev.data.env.ids); }, }, }); // archive all records of the first column - kanban.$('.o_kanban_group:first .o_column_archive').click(); + kanban.$('.o_kanban_group:first .o_kanban_config a.o-no-caret').click(); + kanban.$('.o_column_archive_records:visible').click(); + $('.modal-footer button:first').click(); assert.verifySteps([ [1, 2, 3, 4], diff --git a/addons/web/static/tests/views/list_tests.js b/addons/web/static/tests/views/list_tests.js index 4540b34c725..030a676f4eb 100644 --- a/addons/web/static/tests/views/list_tests.js +++ b/addons/web/static/tests/views/list_tests.js @@ -2849,72 +2849,6 @@ QUnit.module('Views', { list.destroy(); }); - QUnit.skip('navigation: moving left/right with keydown', function (assert) { - assert.expect(8); - - this.data.foo.fields.foo.type = 'text'; - var list = createView({ - View: ListView, - model: 'foo', - data: this.data, - arch: - '' + - '' + - '' + - '' + - '' + - '' + - '', - }); - - list.$('td:contains(13)').click(); - var $m2m = list.$('[name="m2m"] input'); - var $foo = list.$('textarea[name="foo"]'); - var $bar = list.$('[name="bar"] input'); - var $m2o = list.$('[name="m2o"] input'); - var $qux = list.$('input[name="qux"]'); - - assert.strictEqual(document.activeElement, $qux[0], - "'qux' input should be focused"); - - $qux[0].selectionEnd = 0; // Simulate browser keyboard left behavior (unselect) - $qux.trigger({type: 'keydown', which: $.ui.keyCode.LEFT}); - assert.strictEqual(document.activeElement, $m2o[0], - "'m2o' input should be focused"); - - // forget unselecting and try leaving - $m2o.trigger({type: 'keydown', which: $.ui.keyCode.LEFT}); - assert.strictEqual(document.activeElement, $m2o[0], - "'m2o' input should still be focused"); - - $m2o[0].selectionEnd = 0; // Simulate browser keyboard left behavior (unselect) - $m2o.trigger({type: 'keydown', which: $.ui.keyCode.LEFT}); - assert.strictEqual(document.activeElement, $bar[0], - "'bar' input should be focused"); - - // no unselect here as it is a checkbox - $bar.trigger({type: 'keydown', which: $.ui.keyCode.LEFT}); - assert.strictEqual(document.activeElement, $foo[0], - "'foo' input should be focused"); - - // forget unselecting and try leaving - $foo.trigger({type: 'keydown', which: $.ui.keyCode.LEFT}); - assert.strictEqual(document.activeElement, $foo[0], - "'foo' input should still be focused"); - - $foo[0].selectionEnd = 0; // Simulate browser keyboard left behavior (unselect) - $foo.trigger({type: 'keydown', which: $.ui.keyCode.LEFT}); - assert.strictEqual(document.activeElement, $m2m[0], - "'m2m' input should be focused"); - - $m2m[0].selectionStart = $m2m[0].value.length; // Simulate browser keyboard right behavior (unselect) - $m2m.trigger({type: 'keydown', which: $.ui.keyCode.RIGHT}); - assert.strictEqual(document.activeElement, $foo[0], - "'foo' input should be focused"); - - list.destroy(); - }); - QUnit.test('discarding changes in a row properly updates the rendering', function (assert) { assert.expect(3);