How it works...

Odoo uses Headless Chrome for JavaScript test cases. The reason behind this is that it runs the test cases in the background, so it can be run in the server OS, too. Headless Chrome prefers to run the Chrome browser in the background, without opening a GUI browser. Odoo opens the Chrome tab in the background and starts running the test cases in it. It also uses JQuery QUnit for JavaScript test cases. In the next few recipes, we will create a QUnit test case for our custom JavaScript widgets.

Headless Chrome was introduced in Odoo version 12. In the older version of Odoo, phantomjs is used for the client-side test cases. Odoo moved to Headless Chrome because it provides more features, and because the phantomjs project is no longer being maintained.

For test cases, Odoo opens Headless Chrome in a separate process, so to find out the status of the test case running in that process, the Odoo server uses WebSockets. The websocket-client Python library is used to manage WebSockets to communicate with Chrome from the Odoo server.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset