-
- Downloads
[MERGE][REF] *: update js test suite to use helpers
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.notOk(form.$('button').hasClass('btn-primary')); -> assert.doesNotHaveClass(form.$('button'), 'btn-primary'); * 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). 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. closes odoo/odoo#28784
No related branches found
No related tags found
Showing
- addons/account/static/tests/reconciliation_tests.js 79 additions, 79 deletionsaddons/account/static/tests/reconciliation_tests.js
- addons/account/static/tests/section_and_note_tests.js 5 additions, 5 deletionsaddons/account/static/tests/section_and_note_tests.js
- addons/barcodes/static/tests/barcode_tests.js 12 additions, 12 deletionsaddons/barcodes/static/tests/barcode_tests.js
- addons/base_import/static/tests/import_buttons_tests.js 4 additions, 4 deletionsaddons/base_import/static/tests/import_buttons_tests.js
- addons/board/static/tests/dashboard_tests.js 37 additions, 33 deletionsaddons/board/static/tests/dashboard_tests.js
- addons/bus/static/tests/bus_tests.js 6 additions, 6 deletionsaddons/bus/static/tests/bus_tests.js
- addons/calendar/static/tests/calendar_tests.js 4 additions, 4 deletionsaddons/calendar/static/tests/calendar_tests.js
- addons/calendar/static/tests/systray_activity_menu_tests.js 10 additions, 10 deletionsaddons/calendar/static/tests/systray_activity_menu_tests.js
- addons/crm/static/tests/sales_team_dashboard_tests.js 6 additions, 4 deletionsaddons/crm/static/tests/sales_team_dashboard_tests.js
- addons/document/static/tests/document_tests.js 7 additions, 7 deletionsaddons/document/static/tests/document_tests.js
- addons/google_calendar/static/tests/google_calendar_tests.js 3 additions, 3 deletionsaddons/google_calendar/static/tests/google_calendar_tests.js
- addons/google_drive/static/tests/gdrive_test.js 15 additions, 13 deletionsaddons/google_drive/static/tests/gdrive_test.js
- addons/hr_attendance/static/tests/hr_attendance_tests.js 3 additions, 3 deletionsaddons/hr_attendance/static/tests/hr_attendance_tests.js
- addons/hr_org_chart/static/tests/hr_org_chart_tests.js 5 additions, 5 deletionsaddons/hr_org_chart/static/tests/hr_org_chart_tests.js
- addons/im_livechat/static/tests/website_livechat_window_tests.js 3 additions, 3 deletions...im_livechat/static/tests/website_livechat_window_tests.js
- addons/im_support/static/tests/helpers/test_utils.js 2 additions, 2 deletionsaddons/im_support/static/tests/helpers/test_utils.js
- addons/im_support/static/tests/systray_no_support_tests.js 3 additions, 4 deletionsaddons/im_support/static/tests/systray_no_support_tests.js
- addons/im_support/static/tests/systray_tests.js 19 additions, 24 deletionsaddons/im_support/static/tests/systray_tests.js
- addons/lunch/static/tests/lunch_tests.js 5 additions, 5 deletionsaddons/lunch/static/tests/lunch_tests.js
- addons/mail/static/tests/activity_tests.js 15 additions, 15 deletionsaddons/mail/static/tests/activity_tests.js
Loading
Please register or sign in to comment