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

Wait for module UI test buttons to be hittable before tapping them #87607

Merged
merged 2 commits into from Aug 6, 2021

Conversation

jmagman
Copy link
Member

@jmagman jmagman commented Aug 4, 2021

Another attempt at deflaking the module_test_ios tests. Wait for the buttons to both exist and be "hittable" before tapping. I wasn't able to reproduce these flakes locally.

See also #85650

Speculatively fixes #87478

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt.
  • All existing and new tests are passing.

@jmagman jmagman self-assigned this Aug 4, 2021
@flutter-dashboard flutter-dashboard bot added the team Infra upgrades, team productivity, code health, technical debt. See also team: labels. label Aug 4, 2021
@google-cla google-cla bot added the cla: yes label Aug 4, 2021
@jmagman jmagman requested a review from gaaclarke August 4, 2021 03:34
Copy link
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

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

Sounds plausible, factor out the helper function please.

Comment on lines 20 to 23
NSPredicate *hittable = [NSPredicate predicateWithFormat:@"exists == YES AND hittable == YES"];
XCUIElement *coldButton = app.buttons[@"Full Screen (Cold)"];
XCTAssertTrue([coldButton waitForExistenceWithTimeout:60.0]);
[self expectationForPredicate:hittable evaluatedWithObject:coldButton handler:nil];
[self waitForExpectationsWithTimeout:30.0 handler:nil];
Copy link
Member

Choose a reason for hiding this comment

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

helper function

-(void)waitForElement:(XCUIElement*)element {
  NSPredicate *hittable = [NSPredicate predicateWithFormat:@"exists == YES AND hittable == YES"];
  [self expectationForPredicate:hittable evaluatedWithObject:element handler:nil];
  [self waitForExpectationsWithTimeout:30.0 handler:nil];
}

Copy link
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

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

LGTM!

@fluttergithubbot fluttergithubbot merged commit 972bdf8 into flutter:master Aug 6, 2021
@jmagman jmagman deleted the module-hittable branch August 6, 2021 00:24
@jmagman jmagman added the a: tests "flutter test", flutter_test, or one of our tests label Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: tests "flutter test", flutter_test, or one of our tests team Infra upgrades, team productivity, code health, technical debt. See also team: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mac module_test_ios is 2.89% flaky
3 participants