diff --git a/addons/web/static/tests/helpers/qunit_config.js b/addons/web/static/tests/helpers/qunit_config.js index 641d3a6f09b..cfe08b68136 100644 --- a/addons/web/static/tests/helpers/qunit_config.js +++ b/addons/web/static/tests/helpers/qunit_config.js @@ -118,4 +118,25 @@ function _addSortButton() { }); } +/** + * We add here a 'fail fast' feature: we often want to stop the test suite after + * the first failed test. This is also useful for the runbot test suites. + */ + +QUnit.config.urlConfig.push({ + id: "failfast", + label: "Fail Fast", + tooltip: "Stop the test suite immediately after the first failed test." +}); + +QUnit.begin(function() { + if (QUnit.config.failfast) { + QUnit.testDone(function(details) { + if (details.failed > 0) { + QUnit.config.queue.length = 0; + } + }); + } +}); + })(); diff --git a/addons/web/tests/test_js.py b/addons/web/tests/test_js.py index 1dd01bb8045..f903fa704c5 100644 --- a/addons/web/tests/test_js.py +++ b/addons/web/tests/test_js.py @@ -12,11 +12,11 @@ class WebSuite(odoo.tests.HttpCase): def test_01_js(self): # webclient desktop test suite - self.phantom_js('/web/tests?mod=web', "", "", login='admin', timeout=390) + self.phantom_js('/web/tests?mod=web&failfast', "", "", login='admin', timeout=1800) def test_02_js(self): # webclient mobile test suite - self.phantom_js('/web/tests/mobile?mod=web', "", "", login='admin', timeout=300) + self.phantom_js('/web/tests/mobile?mod=web&failfast', "", "", login='admin', timeout=1800) def test_check_suite(self): # verify no js test is using `QUnit.only` as it forbid any other test to be executed