summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/tools
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-11-06[IMP] web: extract logic to update debug manager actionNicolas Galler
Small refactoring to allow calling the method to update the debug manager action independently from `current_action_updated`. Needed for 3d80ff9998dd402ac48d280e5d6b81aaf91b6180. opw-2365539 closes odoo/odoo#61489 X-original-commit: c4e1cfc527cf65fdad201b77e54bf7027b8dd6c2 Related: odoo/enterprise#14634 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.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-04-16[FIX] web: avoid "False-Positive"Romeo Fragomeli
For testing, we use helpers functions like testUtils.dragAndDrop(). Due to the commit odoo/odoo@de924f41eebf62516a39749e5924e19875ea59e5 these methods were wrapped by a deprecated function to add a deprecation warning in the console when these methods are used. After this commit, the deprecated method will properly propagate the returned value of the original function. And so if the returned value is a Promise now we can await this Promise. This should fix some false positives on runbot in saas-13.3 (e.g. FullCalendar). closes odoo/odoo#49611 X-original-commit: 33bfe175bf1ba7824a1bef27fd7fa0898dbe8cb3 Signed-off-by: Adrien Dieudonné (adr) <adr@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[REF] web: Adapt views/actions to new control panelJulien Mougenot
Some web actions/controllers/viewsl have been adapted to properly instantiate the newly refactored control panel and update it accordingly. We needed to adapt the starting mechanism of actions and controllers to ensure that the control panel instantiation did not delay the loading of any widget. Part of task 2196029 Co-authored-by: Mathieu Duckerts-Antoine <dam@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-03-04[IMP] web: Add quick security access to debug menuLucas Lefèvre
PURPOSE Debugging access issues can quickly be a pain. The goal is to allow to easily debug an access rights issue from the debug tools. SPECIFICATION In the debug tools, add the following two new items: - View Access Rights - View Record Rules closes odoo/odoo#46906 Signed-off-by: Yannick Tivisse (yti) <yti@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-10-07[FIX] web: add missing utils dependencyRomain Derie
Since bb370776100f (apparently), trying to regenerate the assets through the crash manager result in a traceback. Indeed, utils was not defined. closes odoo/odoo#38129 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.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-07-30[IMP] web_editor, *: remove assets from documentsfja-odoo
* web "Document" tab in "Select a media" Dialog was displaying all the assets files. Now all files containing "assets_" are excluded from the "Document" tab. This is similar to the regenerateAssets function in debug_manager that deletes assets based on this criteria. For consistency the Assets Domain is now a utils.js function Part of https://github.com/odoo/odoo/pull/33195 task-1945874
2019-07-15[IMP] uom: Remove parentheses on uom namesYannick Tivisse
Purpose ======= Parentheses in the label of units of measure sometimes make reading needlessly uncomfortable. Specification ============= Remove parentheses in the name of every standard uom.uom and hardcoded occurence on views/field names. TaskID: 2030444 closes odoo/odoo#34492 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-06-06[MERGE] forward port branch saas-12.3 up to 409679866b2Christophe Simonis
2019-06-03[MERGE] forward port branch saas-12.2 up to 995aa1685eeChristophe Simonis
2019-06-05[IMP] *: use new helper config.isDebug()Romain Derie
Before this commit, both config and session were aliases to odoo.debug. Now, config.isDebug() should be call, with possibility to pass a parameter to check if we are in a specific debug mode such as 'tests' or 'assets'. task-1934445 Coming with https://github.com/odoo/enterprise/pull/4281 Closes https://github.com/odoo/odoo/pull/33213
2019-06-05[IMP] *: add debug manager in frontendRomain Derie
Now that the debug mode is stored in session, we need a clear indication that debug mode is activated. In backend, the 'fa-bug' is doing the trick but in frontend there is no visible clue that debug mode is enabled. This commit separate the debug manager code/feature so we can instanciate it in frontend only with usefull options (such as enable assets, leave debug mode..). Now, in frontend, people having access to the navbar (o_main_navbar) will see the same 'fa-bug' icon with minimal options as mentioned above. Also, in the footer, there will be another 'fa-bug' icon without any options. It will be usefull when the navbar is not shown, typically the case for public user, or for portal (without website installed)). Clicking on it will simply leave debug mode as hinted in tooltip. task-1934445 Comes with https://github.com/odoo/enterprise/pull/4281 Closes #33213
2019-06-05[IMP] web: rename file to prepare changes on next commitRomain Derie
As this file will be split in 2 parts, this will minimize diff. task-1934445 Comes with odoo/enterprise#4281 Closes #33213
2019-06-05[IMP] web, web_tour, website, point_of_sale: adapt code to new debugRomain Derie
As now the debug state is stored in session, the JS framework code and some templates needed some changes. First, the debug state is retrieved from session and not the URL anymore. Second, the debug state does not need to be forwarded as it is now persistent. task-1934445 Comes with https://github.com/odoo/enterprise/pull/4281 Closes #33213
2019-05-06[MERGE] forward port branch saas-12.2 up to 78b3b650b0dChristophe Simonis
2019-05-03[MERGE] forward port branch saas-12.1 up to 2420492c264Christophe Simonis
2019-05-03[MERGE] forward port branch 12.0 up to d7c0c5c127bChristophe Simonis
2019-05-02[FIX] web: ignore field `message_attachment_count` in debug menuJulien Castiaux
Open a record with a chatter (ie an opw task), add an attachment, enable debug mode and click on "Set Defaults" in the debug tools, traceback. The `message_attachment_count` field is a special view added by the chatter on the form view. This field exists on the view but is absent on the list of field listed by the XML file. Setting a default value on that special field is not supported. opw-1972372 closes odoo/odoo#33044 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
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
2019-01-09[MERGE] forward port branch 12.0 up to 3e4138deaa2Christophe Simonis
closes odoo/odoo#30045
2018-12-28[FIX] mail,web: link attachments & messagesSwapnesh Shah
The information of the active model and record was not given in the context Records created from the Manage Messages and Manage Attachements in the debug menu were not linked to the current records Add context in test too closes odoo/odoo#27766
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
2018-12-07[REF] web: move ControlPanel inside controllers/actionsGéry Debongnie
This branch introduces a large-scale reorganization of the component tree generated by the web client. The short version is that now, the control panel is a child of the view controller and no longer a sibling. Graphically (and simplified), we go from this: webClient / | \ ... ... actionManager / \ controlPanel viewController / \ to this: webClient / | \ ... ... actionManager | viewController / | \ ControlPanelController / \ CPRenderer CPModel The motivation is that this work moves the code where it should be. Before this commit, it was kind of weird to have code in the controllers to render buttons outside of their root node (in renderButtons). Also, the action manager had to take care of coordinating search view states between view transitions. So, this work simplifies the code. It also makes it easier to extend. We see day after day that Odoo needs to take care of more complex UI needs, and in many cases, these needs were quite difficult to implement (we prefer spaghettis in our plates, not in our code). The changes in this branch should open the way to implement these features. For example, - it will now be easy to add the possibility of views (for example, the search view or a new ControlPanel view) to add custom buttons (of type action or object) in the control panel. - Another need will be to serialize/ restore the state of the search view across action boundaries (needed by the dashboard). - Another example is the possibility for views to customize easily the presence/absence of sub menus (filters/groupbys/favorites/ time range/...) - Another need is an easier way for views/client action to customize their control panel. This commit also contains a large rewrite of the search view (so it is more inline with our architecture and easier to maintain). Part of task 1893568 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: Martin Geubelle <mge@odoo.com>
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[IMP] web: testUtils: ensure backward compatibilityAaron Bohy
Rev. 7c3d5dc0 recently added new helpers to use in the tests, and moved some existing helpers to testUtils sub groups (like .dom or .mock). This rev. adds a compatibility layer to ease forwardports. closes odoo/odoo#28824
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-10-01[MERGE] forward port branch saas-11.4 up to 57e387b6452Christophe Simonis
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-09-13[IMP] mail, web: attachments & messages in debug actions.ThanhDodeurOdoo
- added two new actions to the form view debug action list, both opens list (+ form) views of messages and attachments respectively for which the domain is restricted to the current record. task: 1860031
2018-08-29[REF] web: move debug_managers in toolsChristophe Monniez