diff --git a/src/Controls/tests/SourceGen.UnitTests/SourceGen.UnitTests.csproj b/src/Controls/tests/SourceGen.UnitTests/SourceGen.UnitTests.csproj
index 509646f069b3..ea074dd25771 100644
--- a/src/Controls/tests/SourceGen.UnitTests/SourceGen.UnitTests.csproj
+++ b/src/Controls/tests/SourceGen.UnitTests/SourceGen.UnitTests.csproj
@@ -24,8 +24,7 @@
-
-
+
diff --git a/src/Controls/tests/SourceGen.UnitTests/SourceGenCssTests.cs b/src/Controls/tests/SourceGen.UnitTests/SourceGenCssTests.cs
index ff9f8b9242fa..86e81051f3c4 100644
--- a/src/Controls/tests/SourceGen.UnitTests/SourceGenCssTests.cs
+++ b/src/Controls/tests/SourceGen.UnitTests/SourceGenCssTests.cs
@@ -3,7 +3,7 @@
using System.Linq;
using Microsoft.CodeAnalysis;
using Microsoft.Maui.Controls.SourceGen;
-using NUnit.Framework;
+using Xunit;
using static Microsoft.Maui.Controls.Xaml.UnitTests.SourceGen.SourceGeneratorDriver;
@@ -14,7 +14,7 @@ public class SourceGenCssTests : SourceGenTestsBase
private record AdditionalCssFile(string Path, string Content, string? RelativePath = null, string? TargetPath = null, string? ManifestResourceName = null, string? TargetFramework = null)
: AdditionalFile(Text: SourceGeneratorDriver.ToAdditionalText(Path, Content), Kind: "Css", RelativePath: RelativePath ?? Path, TargetPath: TargetPath, ManifestResourceName: ManifestResourceName ?? Path, TargetFramework: TargetFramework);
- [Test]
+ [Fact]
public void TestCodeBehindGenerator_BasicCss()
{
var css =
@@ -28,14 +28,14 @@ public void TestCodeBehindGenerator_BasicCss()
var cssFile = new AdditionalCssFile("Test.css", css);
var result = SourceGeneratorDriver.RunGenerator(compilation, cssFile);
- Assert.IsFalse(result.Diagnostics.Any());
+ Assert.False(result.Diagnostics.Any());
var generated = result.Results.Single().GeneratedSources.Single().SourceText.ToString();
- Assert.IsTrue(generated.Contains($"XamlResourceId(\"{cssFile.ManifestResourceName}\", \"{cssFile.Path}\"", StringComparison.Ordinal));
+ Assert.True(generated.Contains($"XamlResourceId(\"{cssFile.ManifestResourceName}\", \"{cssFile.Path}\"", StringComparison.Ordinal));
}
- [Test]
+ [Fact]
public void TestCodeBehindGenerator_ModifiedCss()
{
var css =
@@ -61,10 +61,10 @@ public void TestCodeBehindGenerator_ModifiedCss()
var output1 = result1.GeneratedSources.Single().SourceText.ToString();
var output2 = result2.GeneratedSources.Single().SourceText.ToString();
- Assert.IsTrue(result1.TrackedSteps.All(s => s.Value.Single().Outputs.Single().Reason == IncrementalStepRunReason.New));
- Assert.AreEqual(output1, output2);
+ Assert.True(result1.TrackedSteps.All(s => s.Value.Single().Outputs.Single().Reason == IncrementalStepRunReason.New));
+ Assert.Equal(output1, output2);
- Assert.IsTrue(output1.Contains($"XamlResourceId(\"{cssFile.ManifestResourceName}\", \"{cssFile.Path}\"", StringComparison.Ordinal));
+ Assert.True(output1.Contains($"XamlResourceId(\"{cssFile.ManifestResourceName}\", \"{cssFile.Path}\"", StringComparison.Ordinal));
(GeneratorDriver, Compilation) ApplyChanges(GeneratorDriver driver, Compilation compilation)
{
diff --git a/src/Controls/tests/SourceGen.UnitTests/SourceGenTestsBase.cs b/src/Controls/tests/SourceGen.UnitTests/SourceGenTestsBase.cs
index 7d6f98b41679..31cb265168fc 100644
--- a/src/Controls/tests/SourceGen.UnitTests/SourceGenTestsBase.cs
+++ b/src/Controls/tests/SourceGen.UnitTests/SourceGenTestsBase.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using Microsoft.CodeAnalysis;
-using NUnit.Framework;
+using Xunit;
namespace Microsoft.Maui.Controls.Xaml.UnitTests.SourceGen;
@@ -12,7 +12,7 @@ public static void VerifyStepRunReasons(GeneratorRunResult result2, Dictionary(compilation, new AdditionalXamlFile("Test.xaml", xaml));
- Assert.IsFalse(result.Diagnostics.Any());
+ Assert.False(result.Diagnostics.Any());
var generated = result.Results.Single().GeneratedSources.Single().SourceText.ToString();
- Assert.IsTrue(generated.Contains("Microsoft.Maui.Controls.Button MyButton", StringComparison.Ordinal));
+ Assert.True(generated.Contains("Microsoft.Maui.Controls.Button MyButton", StringComparison.Ordinal));
}
- [Test]
+ [Fact]
public void TestCodeBehindGenerator_LocalXaml()
{
var xaml =
@@ -54,14 +54,14 @@ public void TestCodeBehindGenerator_LocalXaml()
var compilation = SourceGeneratorDriver.CreateMauiCompilation();
var result = SourceGeneratorDriver.RunGenerator(compilation, new AdditionalXamlFile("Test.xaml", xaml));
- Assert.IsFalse(result.Diagnostics.Any());
+ Assert.False(result.Diagnostics.Any());
var generated = result.Results.Single().GeneratedSources.Single().SourceText.ToString();
- Assert.IsTrue(generated.Contains("Test.TestControl MyTestControl", StringComparison.Ordinal));
+ Assert.True(generated.Contains("Test.TestControl MyTestControl", StringComparison.Ordinal));
}
- [Test]
+ [Fact]
public void TestCodeBehindGenerator_CompilationClone()
{
var xaml =
@@ -83,8 +83,8 @@ public void TestCodeBehindGenerator_CompilationClone()
var output1 = result1.GeneratedSources.Single().SourceText.ToString();
var output2 = result2.GeneratedSources.Single().SourceText.ToString();
- Assert.IsTrue(result1.TrackedSteps.All(s => s.Value.Single().Outputs.Single().Reason == IncrementalStepRunReason.New));
- Assert.AreEqual(output1, output2);
+ Assert.True(result1.TrackedSteps.All(s => s.Value.Single().Outputs.Single().Reason == IncrementalStepRunReason.New));
+ Assert.Equal(output1, output2);
(GeneratorDriver, Compilation) ApplyChanges(GeneratorDriver driver, Compilation compilation)
{
@@ -104,7 +104,7 @@ public void TestCodeBehindGenerator_CompilationClone()
VerifyStepRunReasons(result2, expectedReasons);
}
- [Test]
+ [Fact]
public void TestCodeBehindGenerator_ReferenceAdded()
{
var xaml =
@@ -126,8 +126,8 @@ public void TestCodeBehindGenerator_ReferenceAdded()
var output1 = result1.GeneratedSources.Single().SourceText.ToString();
var output2 = result2.GeneratedSources.Single().SourceText.ToString();
- Assert.IsTrue(result1.TrackedSteps.All(s => s.Value.Single().Outputs.Single().Reason == IncrementalStepRunReason.New));
- Assert.AreEqual(output1, output2);
+ Assert.True(result1.TrackedSteps.All(s => s.Value.Single().Outputs.Single().Reason == IncrementalStepRunReason.New));
+ Assert.Equal(output1, output2);
(GeneratorDriver, Compilation) ApplyChanges(GeneratorDriver driver, Compilation compilation)
{
@@ -147,7 +147,7 @@ public void TestCodeBehindGenerator_ReferenceAdded()
VerifyStepRunReasons(result2, expectedReasons);
}
- [Test]
+ [Fact]
public void TestCodeBehindGenerator_ModifiedXaml()
{
var xaml =
@@ -180,13 +180,13 @@ public void TestCodeBehindGenerator_ModifiedXaml()
var output1 = result1.GeneratedSources.Single().SourceText.ToString();
var output2 = result2.GeneratedSources.Single().SourceText.ToString();
- Assert.IsTrue(result1.TrackedSteps.All(s => s.Value.Single().Outputs.Single().Reason == IncrementalStepRunReason.New));
- Assert.AreNotEqual(output1, output2);
+ Assert.True(result1.TrackedSteps.All(s => s.Value.Single().Outputs.Single().Reason == IncrementalStepRunReason.New));
+ Assert.NotEqual(output1, output2);
- Assert.IsTrue(output1.Contains("MyButton", StringComparison.Ordinal));
- Assert.IsFalse(output1.Contains("MyButton2", StringComparison.Ordinal));
- Assert.IsTrue(output2.Contains("MyButton", StringComparison.Ordinal));
- Assert.IsTrue(output2.Contains("MyButton2", StringComparison.Ordinal));
+ Assert.True(output1.Contains("MyButton", StringComparison.Ordinal));
+ Assert.False(output1.Contains("MyButton2", StringComparison.Ordinal));
+ Assert.True(output2.Contains("MyButton", StringComparison.Ordinal));
+ Assert.True(output2.Contains("MyButton2", StringComparison.Ordinal));
(GeneratorDriver, Compilation) ApplyChanges(GeneratorDriver driver, Compilation compilation)
{
diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/FlakyTestAttribute.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/FlakyTestAttribute.cs
index c0d5b2b833b0..cdd03c35b79c 100644
--- a/src/Controls/tests/TestCases.Shared.Tests/Tests/FlakyTestAttribute.cs
+++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/FlakyTestAttribute.cs
@@ -1,90 +1,13 @@
using NUnit.Framework;
-using NUnit.Framework.Interfaces;
-using NUnit.Framework.Internal;
-using NUnit.Framework.Internal.Commands;
-namespace Microsoft.Maui.TestCases.Tests
+namespace Microsoft.Maui.TestCases.Tests;
+
+public class FlakyTestAttribute : IgnoreAttribute
{
- ///
- /// Custom NUnit attribute to mark a test as flaky, allowing retries (by default 2).
- /// If after the retries the test fails, can ignore it.
- /// Note: This attribute should be used temporarily until the test is changed.
- ///
- ///
- ///
- /// [FlakyTest("Description with details of the test that sometimes fails.", retryCount: 2, ignore: true)]
- ///
- ///
- internal class FlakyTestAttribute : Attribute, IWrapTestMethod, IWrapSetUpTearDown
+ public FlakyTestAttribute() : base(nameof(FlakyTestAttribute))
+ {
+ }
+ public FlakyTestAttribute(string reason) : base(reason)
{
- readonly string _ignoreMessage;
- readonly int _retryCount;
- readonly bool _ignore;
-
- public FlakyTestAttribute(string message, int retryCount = 2, bool ignore = true)
- {
- _ignoreMessage = message;
- _retryCount = retryCount;
- _ignore = ignore;
- }
-
- public ActionTargets Targets => ActionTargets.Suite | ActionTargets.Test;
-
- public TestCommand Wrap(TestCommand command)
- {
- return new CustomRetryCommand(command, _ignoreMessage, _retryCount, _ignore);
- }
-
- public class CustomRetryCommand : DelegatingTestCommand
- {
- readonly string _ignoreMessage;
- readonly int _retryCount;
- readonly bool _ignore;
-
- int _failedAttempts = 0;
-
- public CustomRetryCommand(TestCommand innerCommand, string ignoreMessage, int retryCount, bool ignore)
- : base(innerCommand)
- {
- _ignoreMessage = ignoreMessage;
- _retryCount = retryCount;
- _ignore = ignore;
- }
-
- public override TestResult Execute(TestExecutionContext context)
- {
- int count = _retryCount;
- while (count-- > 0)
- {
- context.CurrentResult = innerCommand.Execute(context);
- var results = context.CurrentResult.ResultState;
-
- if (results.Equals(ResultState.Error)
- || results.Equals(ResultState.Failure)
- || results.Equals(ResultState.SetUpError)
- || results.Equals(ResultState.SetUpFailure)
- || results.Equals(ResultState.TearDownError)
- || results.Equals(ResultState.ChildFailure)
- || results.Equals(ResultState.Cancelled))
- {
- _failedAttempts++;
- TestExecutionContext.CurrentContext.OutWriter.WriteLine("Test Failed on attempt #" + _failedAttempts);
- }
- else
- {
- TestExecutionContext.CurrentContext.OutWriter.WriteLine("Test Passed on attempt #" + (_failedAttempts + 1));
- break;
- }
- }
-
- // If want to ignore and all retry attempts fail, ignore the test with the provided message.
- if (_ignore && _failedAttempts == _retryCount)
- {
- context.CurrentResult.SetResult(ResultState.Ignored, _ignoreMessage);
- }
-
- return context.CurrentResult;
- }
- }
}
}
\ No newline at end of file
diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/FontImageUITest.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/FontImageUITest.cs
new file mode 100644
index 000000000000..65fb8b8d8708
--- /dev/null
+++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/FontImageUITest.cs
@@ -0,0 +1,23 @@
+using NUnit.Framework;
+using UITest.Appium;
+using UITest.Core;
+
+namespace Microsoft.Maui.TestCases.Tests.Issues
+{
+ public class FontImageUITest : _IssuesUITest
+ {
+ public override string Issue => "FontImage UI Test";
+
+ public FontImageUITest(TestDevice device)
+ : base(device)
+ { }
+
+ [Test]
+ [Category(UITestCategories.Image)]
+ public void VerifyFontImage()
+ {
+ App.WaitForElement("Image");
+ VerifyScreenshot();
+ }
+ }
+}
diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue14497.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue14497.cs
new file mode 100644
index 000000000000..baf470132526
--- /dev/null
+++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue14497.cs
@@ -0,0 +1,23 @@
+using NUnit.Framework;
+using UITest.Appium;
+using UITest.Core;
+
+namespace Microsoft.Maui.TestCases.Tests.Issues;
+
+public class Issue14497 : _IssuesUITest
+{
+ public Issue14497(TestDevice device) : base(device) { }
+
+ public override string Issue => "Dynamically setting SearchHandler Query property does not update text in the search box";
+ const string ChangeSearchText = "ChangeSearchText";
+
+ [Test]
+ [Category(UITestCategories.Shell)]
+ public void DynamicallyQueryNotUpdating()
+ {
+ App.WaitForElement(ChangeSearchText);
+ App.Tap(ChangeSearchText);
+ var searchHandlerString = App.GetShellSearchHandler().GetText();
+ Assert.That(searchHandlerString, Is.EqualTo("Hello World"));
+ }
+}
\ No newline at end of file
diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27614.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27614.cs
new file mode 100644
index 000000000000..3096ef571dae
--- /dev/null
+++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27614.cs
@@ -0,0 +1,41 @@
+using NUnit.Framework;
+using UITest.Appium;
+using UITest.Core;
+
+namespace Microsoft.Maui.TestCases.Tests.Issues
+{
+ public class Issue27614 : _IssuesUITest
+ {
+ public Issue27614(TestDevice testDevice) : base(testDevice)
+ {
+ }
+
+ public override string Issue => "Label not sized correctly on Android";
+
+ [Test, Order(1)]
+ [Category(UITestCategories.Label)]
+ public void LabelShouldSizeCorrectlyOnHorizontalStartLayoutOptions()
+ {
+ App.WaitForElement("Label");
+ VerifyScreenshot();
+ }
+
+ [Test, Order(2)]
+ [Category(UITestCategories.Label)]
+ public void LabelShouldSizeCorrectlyOnHorizontalCenterLayoutOptions()
+ {
+ App.WaitForElement("CenterButton");
+ App.Tap("CenterButton");
+ VerifyScreenshot();
+ }
+
+ [Test, Order(3)]
+ [Category(UITestCategories.Label)]
+ public void LabelShouldSizeCorrectlyOnHorizontalEndLayoutOptions()
+ {
+ App.WaitForElement("EndButton");
+ App.Tap("EndButton");
+ VerifyScreenshot();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue29492.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue29492.cs
index 36adde46ba62..a603bf88062e 100644
--- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue29492.cs
+++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue29492.cs
@@ -1,4 +1,4 @@
-#if TEST_FAILS_ON_WINDOWS && TEST_FAILS_ON_IOS && TEST_FAILS_ON_ANDROID // Windows Character Spacing Issue Link - https://github.com/dotnet/maui/issues/29493
+#if TEST_FAILS_ON_WINDOWS // Windows Character Spacing Issue Link - https://github.com/dotnet/maui/issues/29493
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;
diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue8870.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue8870.cs
index 425116db76f4..48b29ed19ccf 100644
--- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue8870.cs
+++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue8870.cs
@@ -3,45 +3,49 @@
using UITest.Appium;
using UITest.Core;
-namespace Microsoft.Maui.TestCases.Tests.Issues;
-
-public class Issue8870 : _IssuesUITest
+namespace Microsoft.Maui.TestCases.Tests.Issues
{
- const string Success = "Success";
- const string CheckResult = "Check";
-
- public Issue8870(TestDevice testDevice) : base(testDevice)
+ public class Issue8870 : _IssuesUITest
{
- }
+ const string Success = "Success";
+ const string CheckResult = "Check";
- public override string Issue => "[Bug] CollectionView with HTML Labels Freeze the Screen on Rotation";
+ public Issue8870(TestDevice testDevice) : base(testDevice)
+ {
+ }
- [Test]
- [Category(UITestCategories.CollectionView)]
- [FailsOnMacWhenRunningOnXamarinUITest("SetOrientationPortrait method not implemented")]
- [FailsOnWindowsWhenRunningOnXamarinUITest("SetOrientationPortrait method not implemented")]
- public void RotatingCollectionViewWithHTMLShouldNotHangOrCrash()
- {
- App.WaitForElement(CheckResult);
+ public override string Issue => "[Bug] CollectionView with HTML Labels Freeze the Screen on Rotation";
+
+ [Test]
+ [Category(UITestCategories.CollectionView)]
+ [FailsOnMacWhenRunningOnXamarinUITest("SetOrientationPortrait method not implemented")]
+ [FailsOnWindowsWhenRunningOnXamarinUITest("SetOrientationPortrait method not implemented")]
+ public async Task RotatingCollectionViewWithHTMLShouldNotHangOrCrash()
+ {
+ int delay = 3000;
+
+ App.WaitForElement(CheckResult);
- App.SetOrientationPortrait();
- App.WaitForElement(CheckResult);
+ App.SetOrientationPortrait();
+ await Task.Delay(delay);
- App.SetOrientationLandscape();
- App.WaitForElement(CheckResult);
+ App.SetOrientationLandscape();
+ await Task.Delay(delay);
- App.SetOrientationPortrait();
- App.WaitForElement(CheckResult);
+ App.SetOrientationPortrait();
+ await Task.Delay(delay);
- App.SetOrientationLandscape();
- App.WaitForElement(CheckResult);
+ App.SetOrientationLandscape();
+ await Task.Delay(delay);
- App.SetOrientationPortrait();
- App.WaitForElement(CheckResult);
+ App.SetOrientationPortrait();
+ await Task.Delay(delay);
- App.TapWithRetriesUntilElementReady(CheckResult, Success, maxRetries: 10);
+ App.WaitForElement(CheckResult);
+ App.Tap(CheckResult);
- App.WaitForElement(Success);
+ App.WaitForElement(Success);
+ }
}
}
#endif
\ No newline at end of file
diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue12685.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue12685.cs
index b1436c4b8cd6..db95bb05f706 100644
--- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue12685.cs
+++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue12685.cs
@@ -21,8 +21,12 @@ public void ShapesPathReceiveGestureRecognizers()
{
var testLabel = App.WaitForFirstElement(StatusLabelId);
Assert.That(testLabel.ReadText(), Is.EqualTo(ResetStatus));
- var labelRect = App.WaitForFirstElement(StatusLabelId).GetRect(); // Path element not able get via AutomationId so getting the rect of the label calculated points to tap on the path
+ var labelRect = App.WaitForFirstElement(StatusLabelId).GetRect(); // Path element not able get via automationid so getting the rect of the label calculated points to tap on the path
+#if MACCATALYST // TapCoordinates is not working on MacCatalyst Issue: https://github.com/dotnet/maui/issues/19754
+ App.ClickCoordinates(labelRect.X + 3, labelRect.Y - 10);
+#else
App.TapCoordinates(labelRect.X + 3, labelRect.Y - 10);
+#endif
App.WaitForElement(StatusLabelId);
Assert.That(testLabel.ReadText(), Is.EqualTo(ClickedStatus));
}
diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/SwipeViewUITests.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/SwipeViewUITests.cs
index 74f539190e9d..f31c6b08b8e3 100644
--- a/src/Controls/tests/TestCases.Shared.Tests/Tests/SwipeViewUITests.cs
+++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/SwipeViewUITests.cs
@@ -1,4 +1,4 @@
-#if ANDROID || IOS || MACCATALYST
+#if ANDROID || IOS
using NUnit.Framework;
using NUnit.Framework.Legacy;
using UITest.Appium;
diff --git a/src/Templates/src/cgmanifest.json b/src/Templates/src/cgmanifest.json
index 60dbc33297fc..f511ceab6c0d 100644
--- a/src/Templates/src/cgmanifest.json
+++ b/src/Templates/src/cgmanifest.json
@@ -105,7 +105,7 @@
"type": "nuget",
"nuget": {
"name": "Microsoft.WindowsAppSDK",
- "version": "1.7.250513003"
+ "version": "1.7.250606001"
}
}
},