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

Connect hardware keyboard for simulators in UI tests on CI #14307

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

jaclync
Copy link
Contributor

@jaclync jaclync commented Nov 5, 2024

Description

CI is failing on trunk for a UI test in iPad simulator, which I can reproduce:

It seems to have failed from not being able to find a keyboard. When I ran the same test case while connecting hardware keyboard manually on the failing screen, the test passed.

After some time-boxed search, a solution I found was to enable the hardware keyboard in the UI tests CI script:

defaults write com.apple.iphonesimulator ConnectHardwareKeyboard -bool true

With this change in the UI tests script, UI tests are passing on CI now.

There are still some flaky test cases in the UI tests, I checked a few commits in trunk and this seems to happen sometimes. I tried triggering another build for the PR commit, and the iPhone flaky tests from the first run are gone in the second build. I'm not sure if this change might have an impact on the frequency of flaky tests though, please feel free to share any concerns.

Steps to reproduce

Make sure the CI passes, especially the 2 UI tests steps.

Testing information

Locally, feel free to try reproducing the failure in OrdersTests when asserting the keyboard is open while verifying the order note.

Screenshots

I ran the CI build 3 times on the same PR commit and all passed, one without flaky tests and two with some flaky tests:

Screenshot 2024-11-05 at 2 21 30 PM
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

Reviewer (or Author, in the case of optional code reviews):

Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement:

  • The PR is small and has a clear, single focus, or a valid explanation is provided in the description. If needed, please request to split it into smaller PRs.
  • Ensure Adequate Unit Test Coverage: The changes are reasonably covered by unit tests or an explanation is provided in the PR description.
  • Manual Testing: The author listed all the tests they ran, including smoke tests when needed (e.g., for refactorings). The reviewer confirmed that the PR works as expected on all devices (phone/tablet) and no regressions are added.

@dangermattic
Copy link
Collaborator

1 Message
📖 This PR is still a Draft: some checks will be skipped.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

WooCommerce iOS📲 You can test the changes from this Pull Request in WooCommerce iOS by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS WooCommerce iOS
Build Numberpr14307-168b266
Version20.9
Bundle IDcom.automattic.alpha.woocommerce
Commit168b266
App Center BuildWooCommerce - Prototype Builds #11444
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@jaclync jaclync changed the title Try always enabling keyboard for simulators in UI tests. Connect hardware keyboard for simulators in UI tests on CI Nov 5, 2024
@jaclync jaclync added the category: ui tests Related to UI testing. label Nov 5, 2024
@jaclync jaclync added this to the 21.1 milestone Nov 5, 2024
@jaclync jaclync marked this pull request as ready for review November 5, 2024 05:59
@jaclync jaclync requested a review from staskus November 5, 2024 05:59
@staskus staskus self-assigned this Nov 5, 2024
@staskus
Copy link
Collaborator

staskus commented Nov 5, 2024

Thanks for the fix!

I wonder if we need a test that checks app.keyboards.firstMatch, as I understand it's a workaround way to check if note was added. Your changes will make sure this test succeeds on the CI but it can still fail locally as I understand. Although I tried testing it locally with different keyboard settings and couldn't reproduce it.

I'm not sure if this change might have an impact on the frequency of flaky tests though, please feel free to share any concerns.

The flakiness of tests is strange since Xcode 16 switch. I think it's worth trying to go with your fix regardless of my previous comments. We can observe if the flakiness increase or decrease after the merge.

@staskus staskus merged commit b567a80 into trunk Nov 5, 2024
28 checks passed
@staskus staskus deleted the issue/ui-test-failure branch November 5, 2024 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: ui tests Related to UI testing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants