openwisp / openwisp-utils

Python and Django utilities shared between different openwisp modules
https://openwisp.io/docs/dev/utils/
BSD 3-Clause "New" or "Revised" License
74 stars 72 forks source link

[tests] Add test method which allows to ensure the JS console is error free #399

Open nemesifier opened 3 months ago

nemesifier commented 3 months ago

Is your feature request related to a problem? Please describe. We are not checking JS console errors in Selenium tests.

Describe the solution you'd like I think we need to add a method which asserts whether the JS console is free from errors, if there's any we should fail the test and print the errors to the output to allow fast debugging.

Describe alternatives you've considered In some cases we may expect errors, so we could also add a method to assert for the presence of an error, but before proceeding with this we need to have a concrete use case.

Additional context While debugging a flaky Selenium browser based test in OpenWISP Controller (https://github.com/openwisp/openwisp-controller/issues/902), I found out the following JS console error:

Blocked attempt to show a 'beforeunload' confirmation panel for a frame that never had a user gesture since its load. https://www.chromestatus.com/feature/5082396709879808.