Skip to content

Conversation

rmarinho
Copy link
Member

Description of Change

Try to pick the latest available iOS simulator based on Xcode select and not hardcoded

rmarinho added 3 commits July 16, 2025 17:16
# Conflicts:
#	eng/pipelines/common/ui-tests.yml
# Conflicts:
#	src/Controls/tests/TestCases.Shared.Tests/UITest.cs
@Copilot Copilot AI review requested due to automatic review settings July 16, 2025 16:21
@rmarinho rmarinho requested a review from a team as a code owner July 16, 2025 16:21
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the iOS simulator version from a hardcoded value to dynamically pick the latest available simulator, and adjusts related build and test scripts to use the new default version.

  • Updated default iOS version constant and matching logic in UI tests.
  • Switched iosVersions in multiple pipeline definitions to 'latest'.
  • Aligned common templates and Cake scripts to use 18.4 as the resolved “latest” simulator version.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/Controls/tests/TestCases.Shared.Tests/UITest.cs Updated _defaultiOSVersion, device-matching logic, and assertion
eng/pipelines/ui-tests.yml Changed iosVersions to 'latest'
eng/pipelines/device-tests.yml Changed iosVersions to 'latest'
eng/pipelines/common/ui-tests.yml Bumped the resolved “latest” version to 18.4 in UI test templates
eng/pipelines/common/device-tests-jobs.yml Added mapping for 'latest' to simulator-64 with API 18.4
eng/devices/ios.cake Updated DefaultVersion and DefaultTestDevice constant

@@ -241,7 +243,9 @@ but both can happen.
var device = (string?)((AppiumApp)App).Driver.Capabilities.GetCapability("deviceName")
?? throw new InvalidOperationException("deviceName capability is missing or null.");

if (device.Contains(" Xs", StringComparison.OrdinalIgnoreCase) && platformVersion == "18.0")
environmentName = "ios";
Copy link
Preview

Copilot AI Jul 16, 2025

Choose a reason for hiding this comment

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

This environmentName = "ios"; statement is now unconditional and will override any other environment settings. It should be moved inside the if (device.Contains(" Xs" ...) && platformVersion == _defaultiOSVersion) block to preserve correct logic.

Suggested change
environmentName = "ios";

Copilot uses AI. Check for mistakes.

@@ -255,7 +259,7 @@ but both can happen.
}
else
{
Assert.Fail($"iOS visual tests should be run on iPhone Xs (iOS 17.2) or iPhone X (iOS 16.4) simulator images, but the current device is '{deviceName}'. Follow the steps on the MAUI UI testing wiki.");
//Assert.Fail($"iOS visual tests should be run on iPhone Xs (iOS {_defaultiOSVersion}) or iPhone X (iOS 16.4) simulator images, but the current device is '{deviceName}' '{platformVersion}'. Follow the steps on the MAUI UI testing wiki.");
Copy link
Preview

Copilot AI Jul 16, 2025

Choose a reason for hiding this comment

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

[nitpick] Instead of commenting out this assertion, update the failure message to reference the new default iOS version and re-enable the Assert.Fail so unsupported simulator configurations are caught during test setup.

Suggested change
//Assert.Fail($"iOS visual tests should be run on iPhone Xs (iOS {_defaultiOSVersion}) or iPhone X (iOS 16.4) simulator images, but the current device is '{deviceName}' '{platformVersion}'. Follow the steps on the MAUI UI testing wiki.");
Assert.Fail($"iOS visual tests should be run on iPhone Xs (iOS {_defaultiOSVersion}) or iPhone X (iOS 16.4) simulator images, but the current device is '{deviceName}' '{platformVersion}'. Follow the steps on the MAUI UI testing wiki.");

Copilot uses AI. Check for mistakes.

const string DefaultVersion = "18.0";
const string DefaultTestDevice = $"ios-simulator-64_{DefaultVersion}";
const string DefaultVersion = "18.4";
const string DefaultTestDevice = $"ios-simulator-64";
Copy link
Preview

Copilot AI Jul 16, 2025

Choose a reason for hiding this comment

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

[nitpick] Dropping the version suffix from DefaultTestDevice may break scripts that expect a versioned identifier. Consider appending DefaultVersion or updating any downstream logic that parses this string.

Suggested change
const string DefaultTestDevice = $"ios-simulator-64";
const string DefaultTestDevice = $"ios-simulator-64-{DefaultVersion}";

Copilot uses AI. Check for mistakes.

@rmarinho rmarinho merged commit 6137fa1 into main Jul 17, 2025
126 of 129 checks passed
@rmarinho rmarinho deleted the use-latest-simulator-main branch July 17, 2025 09:33
@rmarinho
Copy link
Member Author

/backport to inflight/current

Copy link
Contributor

Started backporting to inflight/current: https://github.com/dotnet/maui/actions/runs/16341556437

rmarinho added a commit that referenced this pull request Jul 18, 2025
rmarinho added a commit that referenced this pull request Jul 18, 2025
rmarinho added a commit that referenced this pull request Jul 21, 2025
This reverts commit 3f5adff.

# Conflicts:
#	eng/pipelines/common/device-tests-jobs.yml
#	eng/pipelines/common/ui-tests.yml
#	src/Controls/tests/TestCases.Shared.Tests/UITest.cs
pictos pushed a commit to pictos/maui that referenced this pull request Jul 24, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Aug 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant