Daily updates from Odoo
Monday, November 19, 2018
5 changes · master
Code cleanup and technical improvements
This update standardizes how Odoo’s JavaScript tests interact with screens, forms, popups, and widgets. It makes automated tests more reliable and easier to maintain, reducing the risk of regressions when the web interface changes.
Original PR description
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…
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.The purchase agreements module was reorganized by moving existing code and screen definitions into clearer, guideline-aligned files. This does not introduce new business features, but it makes the module easier to maintain and prepares it for future changes.
Original PR description
This commit simply move code into the right file. The goal is here to fit the guidelines and prepare the module for some changes. This will ease the reading of module code. Task-1851286 -- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
The Website Slides module has been reorganized by splitting and renaming internal files so related models, views, templates, assets, and JavaScript are easier to find and maintain. This cleanup prepares the module for future course-related work and should not change how users experience the feature.
Original PR description
Purpose : Cleaning the module to have an easier time turning it into courses Task: #1909281 -- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Test suites can now choose the browser window size used during automated web tests, while keeping the existing default size. This helps teams validate mobile and responsive layouts more reliably without changing normal user behavior.
Original PR description
When using the HttpCase browser_js method, the window size is fixed to 1366x768. With this commit, the default window size is still '1366x768' but a test class that inherits from HttpCase may change it to test mobile layout by changing the browser_size class attribute. The browser is instantiated once per test class, for that reason the window size cannot be changed in the class methods. To use different sizes in tests, the tests have to be split in classes.
This change updates JavaScript tests across several Odoo Enterprise apps to use shared helper tools. It improves the reliability and consistency of automated testing without changing day-to-day product behavior for users.
Original PR description
This rev. is the counterpart of community [COMMITREF]. Joint work with aab, dam, ged, mge, svs and vsc.