Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18.0][FIX] web_pivot_computed_measure: fix tests #3038

Open
wants to merge 1 commit into
base: 18.0
Choose a base branch
from

Conversation

kobros-tech
Copy link

This fix is the cause for not merging a new migration for web_responsive module to version 18.0.
The migration PR is #3037

@OCA-git-bot
Copy link
Contributor

Hi @CarlosRoca13,
some modules you are maintaining are being modified, check this out!

@kobros-tech kobros-tech force-pushed the 18.0-fix-web_pivot_computed_measure-1 branch 5 times, most recently from 2c27331 to 509ef61 Compare December 24, 2024 22:23
@kobros-tech
Copy link
Author

I am finding this error all the way:

2024-12-25 07:26:39,542 54005 INFO web_responsive_9 odoo.addons.web_pivot_computed_measure.tests.test_ui_pivot.TestUIPivot.test_ui: waiting for threads: []
2024-12-25 07:26:39,544 54005 INFO web_responsive_9 odoo.addons.web_pivot_computed_measure.tests.test_ui_pivot: ======================================================================
2024-12-25 07:26:39,544 54005 ERROR web_responsive_9 odoo.addons.web_pivot_computed_measure.tests.test_ui_pivot: FAIL: TestUIPivot.test_ui
Traceback (most recent call last):
File "/home/kobros/Workspace/odoo18/web/web_pivot_computed_measure/tests/test_ui_pivot.py", line 62, in test_ui
self.start_tour(
File "/home/kobros/Workspace/odoo18/odoo/odoo/tests/common.py", line 2076, in start_tour
return self.browser_js(url_path=url_path, code=code, ready=ready, timeout=timeout, success_signal="tour succeeded", **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kobros/Workspace/odoo18/odoo/odoo/tests/common.py", line 2052, in browser_js
self.fail('%s\n\n%s' % (message, error))
AssertionError: The test code "odoo.startTour('web_pivot_computed_measure_tour', {"stepDelay": 100, "keepWatchBrowser": false, "debug": false, "startUrl": "/odoo", "delayToCheckUndeterminisms": 0})" failed

UncaughtTypeError: Cannot read properties of undefined (reading '__computed_id')
at PivotModel.addComputedMeasure (http://127.0.0.1:8069/web/assets/06ae128/web.assets_backend_lazy.min.js:375:229)
at DropdownItemCustomMeasure.addMeasure (http://127.0.0.1:8069/web/assets/aeba509/web.assets_web.min.js:14672:150)
at Object.mainEventHandler (http://127.0.0.1:8069/web/assets/aeba509/web.assets_web.min.js:1603:77)
at HTMLButtonElement.listener (http://127.0.0.1:8069/web/assets/aeba509/web.assets_web.min.js:762:15)
at dispatch (http://127.0.0.1:8069/web/assets/aeba509/web.assets_web.min.js:15204:71)
at triggerClick (http://127.0.0.1:8069/web/assets/aeba509/web.assets_web.min.js:15132:94)
at _pointerUp (http://127.0.0.1:8069/web/assets/aeba509/web.assets_web.min.js:15187:24)
at async _click (http://127.0.0.1:8069/web/assets/aeba509/web.assets_web.min.js:15141:456)
at async Object.click (http://127.0.0.1:8069/web/assets/aeba509/web.assets_web.min.js:15197:187)
at async TourHelpers.click (http://127.0.0.1:8069/web/assets/aeba509/web.assets_web.min.js:14733:72)
at addComputedMeasure (http://127.0.0.1:8069/web/assets/06ae128/web.assets_backend_lazy.min.js:374:228)
at addMeasure (http://127.0.0.1:8069/web/assets/aeba509/web.assets_web.min.js:14671:149)
at mainEventHandler (http://127.0.0.1:8069/web/assets/aeba509/web.assets_web.min.js:1602:76)
at listener (http://127.0.0.1:8069/web/assets/aeba509/web.assets_web.min.js:761:14)
at dispatch (http://127.0.0.1:8069/web/assets/aeba509/web.assets_web.min.js:15203:70)
at triggerClick (http://127.0.0.1:8069/web/assets/aeba509/web.assets_web.min.js:15131:93)
at _pointerUp (http://127.0.0.1:8069/web/assets/aeba509/web.assets_web.min.js:15186:23)

This external module was important for the test:
websocket-client

with it being installed test failed, without it test didn't run!

@kobros-tech kobros-tech force-pushed the 18.0-fix-web_pivot_computed_measure-1 branch from 1c85a7b to 6512a83 Compare December 30, 2024 15:22
@kobros-tech
Copy link
Author

@chienandalu see here:

at async TourHelpers.click (http://127.0.0.1:8069/web/assets/1a839a2/web.assets_web.min.js:10674:72) 

2024-12-30 15:24:55,997 250 ERROR odoo odoo.addons.web_pivot_computed_measure.tests.test_ui_pivot: FAIL: TestUIPivot.test_ui
Traceback (most recent call last):
File "/__w/web/web/web_pivot_computed_measure/tests/test_ui_pivot.py", line 63, in test_ui
self.start_tour(
File "/opt/odoo/odoo/tests/common.py", line 2076, in start_tour
return self.browser_js(url_path=url_path, code=code, ready=ready, timeout=timeout, success_signal="tour succeeded", **kwargs)
File "/opt/odoo/odoo/tests/common.py", line 2052, in browser_js
self.fail('%s\n\n%s' % (message, error))
AssertionError: The test code "odoo.startTour('web_pivot_computed_measure_tour', {"stepDelay": 100, "keepWatchBrowser": false, "debug": false, "startUrl": "/odoo", "delayToCheckUndeterminisms": 0})" failed

UncaughtTypeError: Cannot read properties of undefined (reading '__computed_id')

test fails, I can remove my commented code but I wanted to show you both errors
1 creating a model in db instead of creating fake fields
2 tour test failure

@CarlosRoca13
Copy link
Contributor

I think that the real problem is that we don't set the method tearDownClass on test 😓

Please add this code and try to run the test

    @classmethod
    def tearDownClass(cls):
        cls.loader.restore_registry()
        return super().tearDownClass()

@kobros-tech
Copy link
Author

I think that the real problem is that we don't set the method tearDownClass on test 😓

Please add this code and try to run the test

    @classmethod
    def tearDownClass(cls):
        cls.loader.restore_registry()
        return super().tearDownClass()

ok, I will check on that
thanks for helping us :)

@kobros-tech
Copy link
Author

kobros-tech commented Jan 8, 2025

@classmethod
def tearDownClass(cls):
cls.loader.restore_registry()
return super().tearDownClass()

@CarlosRoca13

after I tried the code you gave to me I got this error:

2025-01-08 14:16:27,483 107694 INFO web_pivot_computed_measure_2 odoo.addons.web_pivot_computed_measure.tests.test_ui_pivot: ======================================================================
2025-01-08 14:16:27,483 107694 ERROR web_pivot_computed_measure_2 odoo.addons.web_pivot_computed_measure.tests.test_ui_pivot: FAIL: TestUIPivot.test_ui
Traceback (most recent call last):
File "/home/kobros/Workspace/odoo18/web/web_pivot_computed_measure/tests/test_ui_pivot.py", line 68, in test_ui
self.start_tour(
File "/home/kobros/Workspace/odoo18/odoo/odoo/tests/common.py", line 2076, in start_tour
return self.browser_js(url_path=url_path, code=code, ready=ready, timeout=timeout, success_signal="tour succeeded", **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kobros/Workspace/odoo18/odoo/odoo/tests/common.py", line 2052, in browser_js
self.fail('%s\n\n%s' % (message, error))
AssertionError: The test code "odoo.startTour('web_pivot_computed_measure_tour', {"stepDelay": 100, "keepWatchBrowser": false, "debug": false, "startUrl": "/odoo", "delayToCheckUndeterminisms": 0})" failed

UncaughtTypeError: Cannot read properties of undefined (reading '__computed_id')
at PivotModel.addComputedMeasure (http://127.0.0.1:8069/web/assets/ed10f81/web.assets_backend_lazy.min.js:375:229)
at DropdownItemCustomMeasure.addMeasure (http://127.0.0.1:8069/web/assets/c4c2660/web.assets_web.min.js:14672:150)
at Object.mainEventHandler (http://127.0.0.1:8069/web/assets/c4c2660/web.assets_web.min.js:1603:77)
at HTMLButtonElement.listener (http://127.0.0.1:8069/web/assets/c4c2660/web.assets_web.min.js:762:15)
at dispatch (http://127.0.0.1:8069/web/assets/c4c2660/web.assets_web.min.js:15204:71)
at triggerClick (http://127.0.0.1:8069/web/assets/c4c2660/web.assets_web.min.js:15132:94)
at _pointerUp (http://127.0.0.1:8069/web/assets/c4c2660/web.assets_web.min.js:15187:24)
at async _click (http://127.0.0.1:8069/web/assets/c4c2660/web.assets_web.min.js:15141:456)
at async Object.click (http://127.0.0.1:8069/web/assets/c4c2660/web.assets_web.min.js:15197:187)
at async TourHelpers.click (http://127.0.0.1:8069/web/assets/c4c2660/web.assets_web.min.js:14733:72)
at addComputedMeasure (http://127.0.0.1:8069/web/assets/ed10f81/web.assets_backend_lazy.min.js:374:228)
at addMeasure (http://127.0.0.1:8069/web/assets/c4c2660/web.assets_web.min.js:14671:149)
at mainEventHandler (http://127.0.0.1:8069/web/assets/c4c2660/web.assets_web.min.js:1602:76)
at listener (http://127.0.0.1:8069/web/assets/c4c2660/web.assets_web.min.js:761:14)
at dispatch (http://127.0.0.1:8069/web/assets/c4c2660/web.assets_web.min.js:15203:70)
at triggerClick (http://127.0.0.1:8069/web/assets/c4c2660/web.assets_web.min.js:15131:93)
at _pointerUp (http://127.0.0.1:8069/web/assets/c4c2660/web.assets_web.min.js:15186:23)

Does it mean that test is not working well as the UI is not clicked and the field value is not assigned, shall we change the test or remote it better?

@kobros-tech kobros-tech force-pushed the 18.0-fix-web_pivot_computed_measure-1 branch 4 times, most recently from 6f8331f to 0b4d879 Compare January 24, 2025 02:07
@kobros-tech kobros-tech changed the title [18.0][FIX] web_pivot_computed_measure: fix fake fields in tests [18.0][FIX] web_pivot_computed_measure: fix tests Jan 24, 2025
@kobros-tech kobros-tech force-pushed the 18.0-fix-web_pivot_computed_measure-1 branch 3 times, most recently from 16d1f0b to 33e5052 Compare January 24, 2025 08:52
@kobros-tech
Copy link
Author

@chienandalu
@CarlosRoca13

please review this PR and be aware that I made this PR to improve tests for this module that were failing in migration of web_responsive to 18.0

As you see now, the migration PR is depending on this PR and tests succeeded, thanks for your interset

@kobros-tech kobros-tech force-pushed the 18.0-fix-web_pivot_computed_measure-1 branch from 33e5052 to 82fb1b8 Compare January 24, 2025 16:26
@kobros-tech kobros-tech force-pushed the 18.0-fix-web_pivot_computed_measure-1 branch from 82fb1b8 to af7210e Compare January 27, 2025 11:49
Copy link
Contributor

@CarlosRoca13 CarlosRoca13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 😄

@pedrobaeza pedrobaeza added this to the 18.0 milestone Jan 27, 2025
@kobros-tech kobros-tech force-pushed the 18.0-fix-web_pivot_computed_measure-1 branch from af7210e to 5dc2249 Compare January 28, 2025 19:43
@dnplkndll
Copy link

@kobros-tech anything else to review on here? I guess is blocking the

@kobros-tech
Copy link
Author

@kobros-tech anything else to review on here? I guess is blocking the

for this PR no and also #3037 they should be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants