[FIX] tests: avoid check document.readyState of about:blank

In an HttpCase test, when the browser_js method is used, an optional
javascript code can be used to check that the page is ready to execute
the test.

When no 'ready' code is given it defaults to check the
'document.readyState' status.

In some rare cases (discovered by @Xavier-Do) this status is checked on
the 'about:blank' page. As the page seems ready, the test code is
evaluated and fails.

With this commit, when no specific ready code is provided, the test will
wait for a chrome devtools event that ensure the page is fully loaded
before starting the test.

cherry-pick of 03a8819652

closes odoo/odoo#31936

Signed-off-by: Christophe Simonis <chs@odoo.com>
This commit is contained in:
Christophe Monniez
2019-03-19 08:37:07 +00:00
parent 4e39328a76
commit 2c9505fda7
+1 -1
View File
@@ -804,7 +804,7 @@ class HttpCase(TransactionCase):
if odoo.tools.config['logfile']:
self._logger.info('Starting screen cast')
self.browser.start_screencast()
self.browser.navigate_to(url)
self.browser.navigate_to(url, wait_stop=not bool(ready))
# Needed because tests like test01.js (qunit tests) are passing a ready
# code = ""