summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/tools/test_menus.js
AgeCommit message (Collapse)Author
2021-02-10[FIX] web, point_of_sale: update owl to v1.2.4Géry Debongnie
This commit update owl from 1.2.3 to 1.2.4, and introduces a few fixes for code that was broken (because it accesses private owl values) Note the fix for the test menu code is interesting. Before this commit, the handler for the click on the home menu component was not called, so the click had a side effect: it modified the url to its href, which caused the action manager to load the next application, even though the home menu was not mounted. With the update to Owl, this is no longer true: the handler is called, and call preventDefault on the event. Because of that, the url is not changed. However, since the home menu is itself not mounted, it cannot communicate to the web client that we should load the next app. This is why it was broken. The fix is simple: we actually make sure that the home menu is displayed before clicking on the app menuitem. closes odoo/odoo#65886 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-11-26[FIX] web: fix discuss click all testSébastien Theys
task-2292595 closes odoo/odoo#62454 Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2020-11-24[FIX] web: skip adyen account menu entryChristophe Monniez
The `Adyen Account` menu entry leads to an external page. This cannot be tested by the click_all test. closes odoo/odoo#62224 Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2020-11-23[FIX] test_main_flows: adapt main_flow tour for new sync moduleCedric Snauwaert
this commit is a backport from 442326bc298f2aeb579ab40c4b7bdade724ced4e This part of the tour can't work with the new online synchronization module (account_online_synchronization) due to the fact that we are using an iframe to display the list of institutions and therefore those steps won't work within the iframe. Also ignore the 'add a bank account' menuitem from the click all test as it opens an iframe and would stuck the test. closes odoo/odoo#62099 Related: odoo/enterprise#14895 Signed-off-by: Josse Colpaert <jco@openerp.com>
2020-09-28[FIX] web: skip map views and increase timeout in click_allChristophe Monniez
During the click_everywhere test, the map views are tested but leads to random failures when the view takes too long to load. Moreover, the map resources are queried on external nominatim.org servers. This could lead in the test runner being black-listed by nominatim and more indeterminism as those servers are not under our control. For those reasons, this commit will skip the map views in the click_everywhere test. Also, the general time limit is increased. Five seconds was sometimes too short, depending on external conditions (e.g.: server load or screencast enabled). Finally, on a database with all apps installed, the `Settings` menu of some apps loads the full settings and it can takes a huge amount of time to load on a clean browser (as in the tests). For that reason, the time limit for the test of those menus was also increased. closes odoo/odoo#58749 X-original-commit: 2f3ea94a46fde9870db6b6b1d6a4233aaff805ce Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com> Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2020-06-15[REF] mail, *: refactor messaging with OWLSébastien Theys
This commit is a significant rewriting of client-side discuss, chatter, chat window, and messaging menu using OWL. The behavior should be broadly the same, with some slight functional changes here and there. From a technical standpoint, the code of messaging is mainly organized in 2 main groups of modules: - models, which are logical entities that depict the client-side state of messaging as a whole. - components, which are in charge of displaying information from models. This refactoring also introduces new JS guidelines regarding folder structure (/static) and naming rules for JS modules. Community PR: https://github.com/odoo/odoo/pull/39023 Enterprise PR: https://github.com/odoo/enterprise/pull/6249 Task-1914207 This PR is a collaborative work by Alexandre, Julien, Sébastien and Xavier, with the precious help of Lucas to speed it up towards the end. closes odoo/odoo#39023 Related: odoo/enterprise#6249 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com> Co-authored-by: Alexandre Kühn <aku@odoo.com> Co-authored-by: Julien Giannone <jgi@odoo.com> Co-authored-by: Lucas Perais <lpe@odoo.com> Co-authored-by: Sébastien Theys <seb@odoo.com> Co-authored-by: Xavier Dubuc <xdu@odoo.com>
2020-04-22[FIX] web: improve click_everywhere timeout messageChristophe Monniez
When an element is clicked during the test and a tiemout occurs, message that appears in Odoo logs is not really clear. closes odoo/odoo#49907 X-original-commit: 0e1545c52fdca6d311a18533d3d4efed984df329 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2020-03-18[FIX] web: update clickAll test helpersJulien Mougenot
Before this commit and following the refactoring of the home menu and the control panel to the Owl framework, some of the helpers of the 'clickEverywhere' test have not been properly updated to the new classes/behaviours. Now the selectors target the right elements and some actions that were previously synchronous are now properly awaited (home menu toggling, filter menu interactions, etc.). Also slightly changed the behaviour of the clickAll functions: - requesting a click on a null element will make the test crash (added some conditions to avoid this in a standard flow). - any error crashing the test at a deeper level will be displayed in the console - an animation frame is awaited after clicking on an element. This is to comply with the Owl rendering system. closes odoo/odoo#47762 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-03-13[IMP] web,*: Enhance test helpersJulien Mougenot
1. Test utils helpers adapted to properly instantiate the new Owl control panel 2. New file 'test_utils_control_panel' to create a control panel and use helpers 3. New helper: createComponent (creates a generic component, see jsdoc) 4. Use of the new helpers in the current tests (more in sibling commits) 5. Helper 'addMockEnvironment' is now asynchronous 6. Owl config mode set to 'dev' in test suite (props validation) Part of task 2196029 Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2020-03-05[IMP] web: add a light mode to clickEverywhere testChristophe Monniez
The test clickEverywhere may last a very long time when all modules are installed. For that reason, it's not a standard test and we run it at night. Unfortunately, it may happen that an App menu breaks and that this failure is only spotted the next morning. With this commit, a light mode is added to the clickEverywhere test. In this mode, only the app menus are tested. Also, two python tests are added that use this mode and are launched as standard tests. closes odoo/odoo#46934 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-01-30[IMP] core, web: test failure reportingXavier Morel
* remove misleading documentation about a "test failed" message, in 13.0 any uncaught exception or console.error will cause the current test to be interpreted as failed * fix tour manager to console.error its step and not add a second useless error message * fix menu tester to try and display the failure cause on failure * improve qunit's test reporter to print the number of tests failed in case of test suite failure Should make test failures in tours a bit clearer. closes odoo/odoo#44296 X-original-commit: 78121b68d099b16f2d775a7a8a963a2a0f474843 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-10-22[FIX] web: nightly clickall timeoutsJulien Castiaux
The nightly clickall runbot fail due to a crash of the underlying chrome browser used to run the test suite. The problem is related to the resources the browser is using. We leverage the problem by starting one dedicated browser per app. closes odoo/odoo#39190 X-original-commit: 228e57d980839bd2b4e9123bf26f8a64de2ae6ab Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2019-09-04[FIX] web: avoid some external links in click_all testChristophe Monniez
Since 78565b1dc933 , two menus with an act_url action drive the user to external websites. This makes the click_all test very fragile. With this commit the Apps menus "Theme Store" and "Third-Party Apps" are black-listed in the click_all test. Also, it happens that a filter which is not supposed to work in some circumstances is simply hidden. Actually, the click_all test sets that filter and leads to a crash. With this commit, for a more realistic use case, the click_all test does not activate hidden filters. closes odoo/odoo#36433 Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2019-06-03[MERGE] forward port branch saas-12.2 up to 995aa1685eeChristophe Simonis
2019-05-17[MERGE] forward port branch saas-12.1 up to d785adba6c0Christophe Simonis
2019-05-17[MERGE] forward port branch 12.0 up to c545783b95bChristophe Simonis
2019-03-25[FIX] web: avoid click on home menu in communityChristophe Monniez
A fix attempt for the clickEveryWhere test was made in 39e71353c5. Unfortunately, the last modification of the fix were not tested on the runbot and introduced two new issues. 1) The click method on the home menu has been changed to use an enhanced _click function. This function crash when the jquery element is empty. As this menu does not exists in community, the test miserably fails. 2) A "focus" event was added in the _click function that simulates a real click. But the "focus" event is not a mouse event and as nothing to do there. With this commit, the _click function returns immediatly when the element is empty. Also, the "focus" event is removed from the _click simulation but a focus method is used to give focus to the close button. Giving the focus to the cancel button is itself a fix for the DateTimePicker field (see 39e7135). closes odoo/odoo#32082 Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2019-03-22[FIX] web: focus on close button when before closing a modalChristophe Monniez
During the clickEverywhere test, when a modal is opened, the hide method is called to bypass it. This is not realistic and does not work in some cases. For example in Point of sale, menu "Reporting/Sales Details", a modal is opened with a DateTimePicker (tempus dominus) already opened. When hiding or closing the modal, the DateTimePicker needs to perform some cleanup. If the modal is simply hidden, the DateTimePicker is not cleanly destroyed. With this commit, a modal is closed by clicking on its close button and before that, the focus is set on the close button to let the datepicker widget do its stuff on losing focus. Also, a more realistic click is done by trigerring more events (code adapted from tour helper). closes odoo/odoo#32038 Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2019-03-21[FIX] web: click on home menu on next tickChristophe Monniez
Since odoo/enterprise@b830ea7ed2a, the enterprise home menu is asynchrnonous. Because of that, the clientActionCount variable is updated too late and this counter is screwed up, making the test fail. With this commit a setTimeout 0 is used to click on home menu in the next tick and then update the current action count. Also * the test is adapted to stop immediately when an error is catched. * the initial click on home menu is moved into debug manager because the python test launcher uses the correct location already. Thanks to @VincentSchippefilt and @aab-odoo closes odoo/odoo#31949 Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2019-03-06[REF] web: adapt code after jQuery updateVincent Schippefilt
Part of task 1896658 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Christophe Matthieu <chm@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: David Monjoie <dmo@odoo.com> Co-authored-by: Martin Geubelle <mge@odoo.com> Co-authored-by: svs-odoo <svs@odoo.com> Co-authored-by: Vincent Schippefilt <vsc@odoo.com>
2019-02-19[IMP] tests: replace browser_js success and failure stringsChristophe Monniez
When evaluating js tests using the browser_js method, they are considered a success when 'ok' is found in the console log and a failure if 'error' is found instead. This is not very robust and recently failed with this commit : 7410de111fe It adds a filter named 'Error' in a view, when the 'click_all' test clicks on this filter, a message with the name of the filter is written in the console, wrongly leading to a test failure. With this commit, the browser_js method expects a log message in the browser console with the explicit text "test successful". On the other hand, any error in the console log will lead to a test failure but a test can be forced to fail with the explicit error message in the browser console "test failed". As a bonus, the python logger should now also log browser js trace messages. closes odoo/odoo#31158
2018-12-10[FIX] web: adapt clickeverywhere test to the controlpanel refactorChristophe Monniez
Since 4cd379cf6e the ControlPanel is now a child of the viewController. This breaks the clickEveryWhere test. With this commit, the view_controller selector is adapted in the clickEverywhere test. closes odoo/odoo#29383
2019-05-13[FIX] web: add a small delay before starting clickEverywhereChristophe Monniez
When the clickEverywhere js test is started with base only, the web client opens the first app by default (see openFirstApp call in web_client.js). Unfortunately, the test clicks immediately on the apps menu and the client does not invalidate openFirstApp. Then, when trying to click on a filter, it does not exists anymore and leads to a timeout. The present timeout should solve the problem without refactoring the web client. closes odoo/odoo#33339 Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2018-11-20[FIX] web: remove testUtils helpers from click_everywhereChristophe Monniez
During the refactoring of the js test suite, in abf32b8b, the click_everywhere test was inadvertently updated to use the helpers. Some missing semi-colons were fixed too. closes odoo/odoo#28820
2018-11-19[REF] *: update js test suite to use helpersGéry Debongnie
This rev. introduces robust helpers to use in the JS tests suite to interact with DOM and components, and starts using them (almost) everywhere. All the helpers are exposed though testUtils.js. There are 2 kinds of helpers: 1. Assertions ------------- * assert.containsNone, containsN, containsOnce check that the DOM (or a specific part of the DOM) contains a `selector`. It generates a correct error message automatically. ex: assert.strictEqual(form.$('.o_form_editable'), 1, "msg"); -> assert.containsOnce(form, '.o_form_editable'); * assert.isVisible, isNotVisible check that the DOM has an element visible or not. They also check that the element is actually in the DOM (before most tests didn't verify this). * assert.hasClass, doesNotHaveClass, hasAttrVAlue, check specific properties of a DOM element, and also validate that it is applied on a single existing DOM element (before most tests didn't verify this). ex: assert.notOk(form.$('button').hasClass('btn-primary')); -> assert.doesNotHaveClass(form.$('button'), 'btn-primary'); 2. Utilities ------------ The goal of the utilities is to centralize the definition of many standard components and interactions, ensuring that when we refactor the JS framework, we do not need to change all the tests. Existing mock utilities (addMockEnvironment, intercept, path, patchDate, unpatch and fieldsViewGet) are moved to 'testUtils.mock.*'. Existing DOM utilities are moved to 'testUtils.dom.*'. New dom utilities are created for opendDatePicker, click, clickFirst and clickLast. Helper `click` verifies that there is exactly 1 element visible in the DOM you click on, `clickFirst` and `clickLast` verify that there are more than one element on the DOM. ex: form.$('button').click(); -> testUtils.dom.click(form.$('button')); New Form utilities: (testUtils.form.*) clickEdit, clickSave, clickCreate, clickDiscard, all clicks on the control panel buttons of the form. `reload` reloads the form data. New modal, graph, kanban and pivot utils (testUtils.pivot.*, testUtils.kanban.*, etc.). New fields utils: (testUtils.fields.*) * editInput, editSelect: allow to change the value of a field, using a selector to identify it. They validate that the input exists and trigger the change event automatically. * editAndTrigger: allow to modify a field and trigger specific events after the value change * many2one (testUtils.fields.many2one.*) clickOpenDropdown, clickHighlightedItem, clickItem, searchAndClickItem: use a field name instead of a selector and do all the complex mechanism to open, filter and highlight many2one fields. Joint work with aab, dam, ged, mge, svs and vsc.
2018-12-10[FIX] web: adapt clickeverywhere test to the controlpanel refactorChristophe Monniez
Since 4cd379cf6e the ControlPanel is now a child of the viewController. This breaks the clickEveryWhere test. With this commit, the view_controller selector is adapted in the clickEverywhere test. cheery-pick of 5e92adb39ca8cf5f4b48e3eb1d52a66dc65572f3 closes odoo/odoo#29396
2018-09-18[FIX] web: fix selector for the menu items in clickEverywhere testChristophe Monniez
Also clarify a variable name referencing a node instead of a jquery object.
2018-09-17[IMP] web: new navbar in communityAlexandre Kühn
The navbar in community now looks more like the navbar in enterprise. Here is a sum-up of the changes in community: - The navbar in community is now in blue, instead of black. - No more app list that almost fills the whole navbar: there is now an "Apps Menu" in the left-most side of the navbar. - No more sidebar for the menus inside an app: those menus are now located in the middle part of the navbar. The navbar in community does not support mobile (< 768px width), but it should still somewhat usable on most mobile devices. As for the website navbar, it has been unchanged and should still support mobile layout. Task-ID 1878649
2018-08-29[IMP] web: New test to test Odoo menusChristophe Monniez
This commit adds a new js test in web that enters each app and click on each view switcher, each menu and each search filter. This test is tagged '-standard' and 'click_all' as it could last a long time, that way it's not executed by default. It could also be started from the browser console with 'clickEverywhere();'.