[testing] Cleaning up TemplateTests iOS simulator issues #20817
Merged
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
This PR tries to fix failures reported in: #21077
The issues seem to be caused by the following:
xharness
to find the device's UDID based onios-simulator-64
in:maui/src/TestUtils/src/Microsoft.Maui.IntegrationTests/Apple/Simulator.cs
Line 8 in 7639a2c
ios-simulator-64
, xharness returns the first device that matches the pattern. However, there can be more device with the same name but different version which can lead to unwanted behaviourProblem scenario
There are two devices:
-
ios-simulator-64_17.0
(e.g., UDID:491595A5-EBC3-4605-9069-7D2E57E826B0
, State:Shutdown
)-
ios-simulator-64_17.2
(eg., UDID:A3DB0329-7EE0-4C6C-A69A-2B6CF76F870E
, State:Booted
)When querying for device's UDID based on
ios-simulator-64
only, xharness will return:491595A5-EBC3-4605-9069-7D2E57E826B0
which is a device already in 'Shutdown' state.This can be a problem, as the sequence in the test SetUp code in
TemplateTests
:maui/src/TestUtils/src/Microsoft.Maui.IntegrationTests/AppleTemplateTests.cs
Lines 16 to 18 in 7639a2c
can further cause the simulator to be in a corrupted state:
Which finally makes the test execution fail:
Solution
This PR tries to fix the problem by:
which should bring us always to a clean state, before executing TemplateTests
Contributes to: