Skip to content

test(material-experimental/mdc-slider): try to reduce test flakes #19987

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

Merged
merged 1 commit into from
Jul 17, 2020

Conversation

crisbeto
Copy link
Member

We've been seeing more test flakes from the MDC slider recently. These changes try to address them by disabling animations and adding an extra change detection after flushing requestAnimationFrame.

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jul 15, 2020
@crisbeto crisbeto marked this pull request as ready for review July 15, 2020 09:00
@crisbeto crisbeto requested a review from devversion as a code owner July 15, 2020 09:00
@crisbeto crisbeto added merge safe P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release labels Jul 15, 2020
@crisbeto
Copy link
Member Author

@devversion this is a bit of a shot in the dark since I wasn't able to reproduce the failures locally against a device. I think that it might help, because I've re-run the CI checks 5 times now and it hasn't flaked yet.

@devversion
Copy link
Member

devversion commented Jul 15, 2020

@crisbeto Do you have a link to the flaky test you were seeing? I was seeing something similar and "assumingly" fixed it in #19961

@devversion
Copy link
Member

The test failures I was looking at had incorrect transform assertions too, but the interesting thing was that the computed transform was always larger as if the slider had an uneven width of ~1000px instead of the desired 100px. Hence my proposed fix of just explicitly setting the width to explicitly 100px (not guaranteed to fix this issue though)

@crisbeto
Copy link
Member Author

The ones I was looking at had to do with the transform too. I was thinking of setting the height explicitly as well, but there doesn't seem to be anything that would push it to be that wide. Also the 1000px+ difference is much wider than the screen of the device that the failures were showing up on. My theory is that MDC is trying to measure something while it's animating which throws things off.

@devversion
Copy link
Member

yeah, looks like we both are just guessing here. I briefly looked at the MDC slider foundation code but couldn't find anything suspicious. They just get the bounding client rectangle, use the width value and multiply it with the percentage (assuming they compute that one correctly). Not sure though what could cause the slider to scale that much. It's just dealing with a min-width though so it could expand horizontally for whatever reason.

Either way, I'd be fine in trying this too. Seems like disabling animations would be good anyway (though the non-MDC slider doesn't seem to do it IIRC)

We've been seeing more test flakes from the MDC slider recently. These changes try to address them by disabling animations and adding an extra change detection after flushing `requestAnimationFrame`.
@crisbeto crisbeto force-pushed the mdc-slider-flakes branch from 613f84a to 603d567 Compare July 15, 2020 10:14
@devversion devversion added lgtm action: merge The PR is ready for merge by the caretaker labels Jul 15, 2020
@andrewseguin andrewseguin merged commit 23170af into angular:master Jul 17, 2020
andrewseguin pushed a commit that referenced this pull request Jul 17, 2020
…9987)

We've been seeing more test flakes from the MDC slider recently. These changes try to address them by disabling animations and adding an extra change detection after flushing `requestAnimationFrame`.

(cherry picked from commit 23170af)
ngwattcos pushed a commit to ngwattcos/components that referenced this pull request Jul 20, 2020
…gular#19987)

We've been seeing more test flakes from the MDC slider recently. These changes try to address them by disabling animations and adding an extra change detection after flushing `requestAnimationFrame`.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Aug 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants