Skip to content

[web] fix race in the image_loading_integration.dart test - #92303

Merged
fluttergithubbot merged 1 commit into
flutter:masterfrom
yjbanov:fix-image-loading-test-race
Oct 27, 2021
Merged

fluttergithubbot merged 1 commit into
flutter:masterfrom
yjbanov:fix-image-loading-test-race

Conversation

@yjbanov

@yjbanov yjbanov commented Oct 22, 2021

Copy link
Copy Markdown
Contributor

Fix flakiness in the image_loading_integration.dart test by waiting for the images to load over the network before checking the DOM.

Progress towards #86375

@flutter-dashboard flutter-dashboard Bot added f: integration_test The flutter/packages/integration_test plugin c: contributor-productivity Team-specific productivity, code health, technical debt. labels Oct 22, 2021
@flutter-dashboard

Copy link
Copy Markdown

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@ditman ditman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, ship it!

Comment on lines +13 to +17
/// Notifies that Image.asset used in the test app loaded the image.
Future<void> get whenAssetImageLoads => _assetImageCompleter.future;

/// Notifies that Image.network used in the test app loaded the image.
Future<void> get whenNetworkImageLoads => _networkImageCompleter.future;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These being global scares me a bit. Maybe we should create a new completer for every invocation of main? Is it even possible for main to be called multiple times?

@yjbanov yjbanov Oct 26, 2021 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is a one-off test that checks something very specific. I think we can pay the cost of more flexible design if/when we decide that this test should do more than it does today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c: contributor-productivity Team-specific productivity, code health, technical debt. f: integration_test The flutter/packages/integration_test plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants