Connect hardware keyboard for simulators in UI tests on CI #14307
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
CI is failing on trunk for a UI test in iPad simulator, which I can reproduce:
woocommerce-ios/WooCommerce/UITestsFoundation/Screens/Orders/CustomerNoteScreen.swift
Line 36 in a2dd518
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:
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: