-
Notifications
You must be signed in to change notification settings - Fork 30.1k
[FIX] html_editor: fix failing tests due to improper element targeting #203218
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
[FIX] html_editor: fix failing tests due to improper element targeting #203218
Conversation
87125b4
to
1be9ebd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// in case the cropper is closed and the image just got loaded | |
// we return because the component is destroyed and `this.imageRef.el` | |
// is `null` | |
// Abort if the component has been destroyed in the meantime | |
// since `this.imageRef.el` is `null` when it is not mounted. |
1be9ebd
to
562b6b6
Compare
f2d9f58
to
fb2a59c
Compare
d301cb0
to
dc0a03a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this change needed? It has a functional effect that the scroll is not sooth anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is another issue i found while testing manually, the function was async
but it will never resolve in case scroll is needed because scrollTo
is not a promise.
removing the async
will scroll but but due to smooth
the image is loaded but still scrolling in progress.
One way to fix is to wait until scroll is finished (didn't check how), the other way is to simply use instant
.
I took this decision because it was easier IMHO. wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean it will never resolve? await undefined
will resolve to undefined
after one microstask tick. However, if scrollTo
is not a promise, then it won't wait for it to be finished before resolving. Maybe that's what you meant? That it resolves and continues even though the scrolling isn't finished yet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when i was testing it was not resolved at all, the execution stopped in the await this.scrollToInvisibleImage();
but i'm not able to reproduce as i deleted the images i was using to test earlier.
I reverted that part, this should be enough to fix the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked and scrollTo
does return a Promise
so if it is possible that scrollTo
does not resolve then scrollToInvisibleImage
won't resolve either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what happened. but i was randomly uploading images, now i can't reproduce anymore.
33037db
to
63798a2
Compare
**Problem**: Tests introduced in commit [`b7a63f7d60494c65889ba6ce3fa18847a0abbb62`] (odoo@b7a63f7) are failing on **runbot** due to improper element selection and handling of image loading when the component is destroyed. **Solution**: - Ensure the test properly targets the correct elements. - Handle cases where the image is still loading while the component is destroyed, preventing potential tracebacks. **Steps to Reproduce**: 1. Run the test suite on runbot. 2. Observe test failures related to incorrect element selection or missing image references due to component destruction. **opw-4607020**
63798a2
to
587f20b
Compare
@robodoo r+ |
@robodoo up to 18.0 |
Forward-port disabled (via limit). |
these changes are applied in this FW from 18.1 up to master in this PR |
**Problem**: Tests introduced in commit [`b7a63f7d60494c65889ba6ce3fa18847a0abbb62`] (odoo/odoo@b7a63f7) are failing on **runbot** due to improper element selection and handling of image loading when the component is destroyed. **Solution**: - Ensure the test properly targets the correct elements. - Handle cases where the image is still loading while the component is destroyed, preventing potential tracebacks. **Steps to Reproduce**: 1. Run the test suite on runbot. 2. Observe test failures related to incorrect element selection or missing image references due to component destruction. **opw-4607020** closes odoo/odoo#203218 Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Problem:
Tests introduced in commit [
b7a63f7d60494c65889ba6ce3fa18847a0abbb62
] (b7a63f7) are failing on runbot due to improper element selection and handling of image loading when the component is destroyed.Solution:
Steps to Reproduce:
opw-4607020
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr