From 03f489cb86e2b282e0d629ce2cd09bd466741fa6 Mon Sep 17 00:00:00 2001 From: redth Date: Wed, 26 Jun 2024 16:57:09 -0400 Subject: [PATCH 01/10] Add project for UITest related analyzers/codefixers First case is for finding NUnit [Test] marked methods that do not also have a [Category] on the method or parent class. --- .../NUnit/NUnitTestMissingCategoryAnalyzer.cs | 62 ++++++++++++ ...TestMissingCategoryClassCodeFixProvider.cs | 98 +++++++++++++++++++ ...estMissingCategoryMethodCodeFixProvider.cs | 77 +++++++++++++++ .../UITest.Analyzers/UITest.Analyzers.csproj | 21 ++++ 4 files changed, 258 insertions(+) create mode 100644 src/TestUtils/src/UITest.Analyzers/NUnit/NUnitTestMissingCategoryAnalyzer.cs create mode 100644 src/TestUtils/src/UITest.Analyzers/NUnit/NUnitTestMissingCategoryClassCodeFixProvider.cs create mode 100644 src/TestUtils/src/UITest.Analyzers/NUnit/NUnitTestMissingCategoryMethodCodeFixProvider.cs create mode 100644 src/TestUtils/src/UITest.Analyzers/UITest.Analyzers.csproj diff --git a/src/TestUtils/src/UITest.Analyzers/NUnit/NUnitTestMissingCategoryAnalyzer.cs b/src/TestUtils/src/UITest.Analyzers/NUnit/NUnitTestMissingCategoryAnalyzer.cs new file mode 100644 index 000000000000..780d996ec4c7 --- /dev/null +++ b/src/TestUtils/src/UITest.Analyzers/NUnit/NUnitTestMissingCategoryAnalyzer.cs @@ -0,0 +1,62 @@ +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.Diagnostics; +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; +using System.Threading; + +namespace UITest.Analyzers.NUnit +{ + [DiagnosticAnalyzer(LanguageNames.CSharp)] + public class NUnitTestMissingCategoryAnalyzer : DiagnosticAnalyzer + { + public const string DiagnosticId = "NUnitTestMissingCategoryAnalyzer"; + + const string Title = "Test methods should have a Category"; + const string MessageFormat = "Test method '{0}' should be marked with a `[Category]` attribute on the method or its parent class"; + const string Description = "Test methods should be marked with a `[Category]` attribute on the method or its parent class."; + + private const string Category = "Testing"; + + private static readonly DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, Category, DiagnosticSeverity.Warning, isEnabledByDefault: true, description: Description); + + public override ImmutableArray SupportedDiagnostics { get { return ImmutableArray.Create(Rule); } } + + public override void Initialize(AnalysisContext context) + { + context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None); + context.EnableConcurrentExecution(); + + // TODO: Consider registering other actions that act on syntax instead of or in addition to symbols + // See https://github.com/dotnet/roslyn/blob/main/docs/analyzers/Analyzer%20Actions%20Semantics.md for more information + context.RegisterSymbolAction(AnalyzeSymbol, SymbolKind.Method); + } + + private static void AnalyzeSymbol(SymbolAnalysisContext context) + { + var methodSymbol = (IMethodSymbol)context.Symbol; + + // Check if the method has the [Test] attribute. + var hasTestAttribute = methodSymbol.GetAttributes().Any(attr => attr?.AttributeClass?.Name == "TestAttribute"); + + // Check if the method has the [Category] attribute. + var hasCategoryAttribute = methodSymbol.GetAttributes().Any(attr => attr?.AttributeClass?.Name == "CategoryAttribute"); + if (!hasCategoryAttribute) + { + // If the method does not have a [Category] attribute, check the containing class + var containingClass = methodSymbol.ContainingType; + hasCategoryAttribute = containingClass.GetAttributes().Any(attr => attr?.AttributeClass?.Name == "CategoryAttribute"); + } + + // If it has [Test] but not [Category], report a diagnostic. + if (hasTestAttribute && !hasCategoryAttribute) + { + var diagnostic = Diagnostic.Create(Rule, methodSymbol.Locations[0], methodSymbol.Name); + context.ReportDiagnostic(diagnostic); + } + } + } +} diff --git a/src/TestUtils/src/UITest.Analyzers/NUnit/NUnitTestMissingCategoryClassCodeFixProvider.cs b/src/TestUtils/src/UITest.Analyzers/NUnit/NUnitTestMissingCategoryClassCodeFixProvider.cs new file mode 100644 index 000000000000..432a77589f88 --- /dev/null +++ b/src/TestUtils/src/UITest.Analyzers/NUnit/NUnitTestMissingCategoryClassCodeFixProvider.cs @@ -0,0 +1,98 @@ +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CodeActions; +using Microsoft.CodeAnalysis.CodeFixes; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.Rename; +using Microsoft.CodeAnalysis.Text; +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Composition; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace UITest.Analyzers.NUnit +{ + [ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(NUnitTestMissingCategoryClassCodeFixProvider)), Shared] + public class NUnitTestMissingCategoryClassCodeFixProvider : CodeFixProvider + { + const string AddCategoryAttributeToClassCodeFixTitle = "Add [Category] attribute to class"; + + public sealed override ImmutableArray FixableDiagnosticIds + => ImmutableArray.Create(NUnitTestMissingCategoryAnalyzer.DiagnosticId); + + // See https://github.com/dotnet/roslyn/blob/main/docs/analyzers/FixAllProvider.md for more information on Fix All Providers + public sealed override FixAllProvider GetFixAllProvider() + => WellKnownFixAllProviders.BatchFixer; + + public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context) + { + var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); + + // TODO: Replace the following code with your own analysis, generating a CodeAction for each fix to suggest + var diagnostic = context.Diagnostics.First(); + var diagnosticSpan = diagnostic.Location.SourceSpan; + + // Find the type declaration identified by the diagnostic. + var declaration = root?.FindToken(diagnosticSpan.Start).Parent?.AncestorsAndSelf()?.OfType()?.FirstOrDefault(); + + if (declaration is not null && context.Document is not null) + { + // Register a code action that will invoke the fix. + context.RegisterCodeFix( + CodeAction.Create( + title: AddCategoryAttributeToClassCodeFixTitle, + createChangedDocument: c => AddCategoryAttributeToClassAsync(context.Document, declaration, c), + equivalenceKey: nameof(AddCategoryAttributeToClassCodeFixTitle)), + diagnostic); + } + } + + private async Task AddCategoryAttributeToClassAsync(Document document, MethodDeclarationSyntax methodDeclaration, CancellationToken cancellationToken) + { + var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); + + // Find the containing class declaration for the method + var classDeclaration = methodDeclaration.FirstAncestorOrSelf(); + if (classDeclaration == null) + { + return document; + } + + // Check if the class already has a [Category] attribute + var hasCategoryAttribute = classDeclaration.AttributeLists + .SelectMany(attrList => attrList.Attributes) + .Any(attr => attr.Name.ToString() == "Category"); + + if (hasCategoryAttribute) + { + // The class already has a [Category] attribute, no need to add another + return document; + } + + // Create a new [Category] attribute with a placeholder category name + var newAttribute = SyntaxFactory.Attribute(SyntaxFactory.ParseName("Category")) + .WithArgumentList(SyntaxFactory.AttributeArgumentList(SyntaxFactory.SingletonSeparatedList( + SyntaxFactory.AttributeArgument(SyntaxFactory.ParseExpression("\"PlaceholderCategory\""))))); + + var newAttributeList = SyntaxFactory.AttributeList(SyntaxFactory.SingletonSeparatedList(newAttribute)) + .WithTrailingTrivia(SyntaxFactory.CarriageReturnLineFeed); // Ensure a new line after the attribute for readability + + // Add the new [Category] attribute to the class + var newClassDeclaration = classDeclaration.AddAttributeLists(newAttributeList); + + // Replace the old class declaration with the new one in the syntax tree + var newRoot = root?.ReplaceNode(classDeclaration, newClassDeclaration); + + if (newRoot is null) + { + return document; + } + + // Return a new document with the updated syntax tree + return document.WithSyntaxRoot(newRoot); + } + } +} diff --git a/src/TestUtils/src/UITest.Analyzers/NUnit/NUnitTestMissingCategoryMethodCodeFixProvider.cs b/src/TestUtils/src/UITest.Analyzers/NUnit/NUnitTestMissingCategoryMethodCodeFixProvider.cs new file mode 100644 index 000000000000..1bb7ed4db4cb --- /dev/null +++ b/src/TestUtils/src/UITest.Analyzers/NUnit/NUnitTestMissingCategoryMethodCodeFixProvider.cs @@ -0,0 +1,77 @@ +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CodeActions; +using Microsoft.CodeAnalysis.CodeFixes; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.Rename; +using Microsoft.CodeAnalysis.Text; +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Composition; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace UITest.Analyzers.NUnit +{ + [ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(NUnitTestMissingCategoryMethodCodeFixProvider)), Shared] + public class NUnitTestMissingCategoryMethodCodeFixProvider : CodeFixProvider + { + const string AddCategoryAttributeToMethodCodeFixTitle = "Add [Category] attribute to method"; + + public sealed override ImmutableArray FixableDiagnosticIds + => ImmutableArray.Create(NUnitTestMissingCategoryAnalyzer.DiagnosticId); + + // See https://github.com/dotnet/roslyn/blob/main/docs/analyzers/FixAllProvider.md for more information on Fix All Providers + public sealed override FixAllProvider GetFixAllProvider() + => WellKnownFixAllProviders.BatchFixer; + + public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context) + { + var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); + + // TODO: Replace the following code with your own analysis, generating a CodeAction for each fix to suggest + var diagnostic = context.Diagnostics.First(); + var diagnosticSpan = diagnostic.Location.SourceSpan; + + // Find the type declaration identified by the diagnostic. + var declaration = root?.FindToken(diagnosticSpan.Start).Parent?.AncestorsAndSelf()?.OfType()?.FirstOrDefault(); + + if (declaration is not null && context.Document is not null) + { + // Register a code action that will invoke the fix. + context.RegisterCodeFix( + CodeAction.Create( + title: AddCategoryAttributeToMethodCodeFixTitle, + createChangedDocument: c => AddCategoryAttributeToMethodAsync(context.Document, declaration, c), + equivalenceKey: nameof(AddCategoryAttributeToMethodCodeFixTitle)), + diagnostic); + } + } + + private async Task AddCategoryAttributeToMethodAsync(Document document, MethodDeclarationSyntax methodDecl, CancellationToken cancellationToken) + { + // Generate the new [Category("Uncategorized")] attribute. + var attributeList = SyntaxFactory.AttributeList(SyntaxFactory.SingletonSeparatedList( + SyntaxFactory.Attribute(SyntaxFactory.IdentifierName("Category")) + .WithArgumentList(SyntaxFactory.AttributeArgumentList(SyntaxFactory.SingletonSeparatedList( + SyntaxFactory.AttributeArgument(SyntaxFactory.ParseExpression("\"PlaceholderCategory\""))))))); + + // Add the attribute to the method. + var newMethod = methodDecl.AddAttributeLists(attributeList); + + // Replace the old method with the new method in the syntax tree. + var root = await document.GetSyntaxRootAsync(cancellationToken); + var newRoot = root?.ReplaceNode(methodDecl, newMethod); + + if (newRoot is null) + { + return document; + } + + // Return the updated document. + return document.WithSyntaxRoot(newRoot); + } + } +} diff --git a/src/TestUtils/src/UITest.Analyzers/UITest.Analyzers.csproj b/src/TestUtils/src/UITest.Analyzers/UITest.Analyzers.csproj new file mode 100644 index 000000000000..b6c385c726f3 --- /dev/null +++ b/src/TestUtils/src/UITest.Analyzers/UITest.Analyzers.csproj @@ -0,0 +1,21 @@ + + + + netstandard2.0 + true + enable + enable + $(NoWarn);RS2008 + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + From c0a9b5de1000a6c4bd6e5f1078d682d0eb926778 Mon Sep 17 00:00:00 2001 From: redth Date: Wed, 26 Jun 2024 16:57:28 -0400 Subject: [PATCH 02/10] Reference UITest analyzers project in UITest test projects --- Microsoft.Maui-dev.sln | 7 +++++++ .../Controls.TestCases.Android.Tests.csproj | 4 ++++ .../Controls.TestCases.Mac.Tests.csproj | 4 ++++ .../Controls.TestCases.WinUI.Tests.csproj | 4 ++++ .../Controls.TestCases.iOS.Tests.csproj | 4 ++++ 5 files changed, 23 insertions(+) diff --git a/Microsoft.Maui-dev.sln b/Microsoft.Maui-dev.sln index 6ab75bad6aaa..f4907362fbaa 100644 --- a/Microsoft.Maui-dev.sln +++ b/Microsoft.Maui-dev.sln @@ -255,6 +255,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Controls.TestCases.Mac.Test EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Controls.TestCases.WinUI.Tests", "src\Controls\tests\TestCases.WinUI.Tests\Controls.TestCases.WinUI.Tests.csproj", "{A3E22F99-F380-4005-8483-3ACA6C104220}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UITest.Analyzers", "src\TestUtils\src\UITest.Analyzers\UITest.Analyzers.csproj", "{55905937-1399-46DB-BA38-E426801CB759}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -648,6 +650,10 @@ Global {A3E22F99-F380-4005-8483-3ACA6C104220}.Debug|Any CPU.Build.0 = Debug|Any CPU {A3E22F99-F380-4005-8483-3ACA6C104220}.Release|Any CPU.ActiveCfg = Release|Any CPU {A3E22F99-F380-4005-8483-3ACA6C104220}.Release|Any CPU.Build.0 = Release|Any CPU + {55905937-1399-46DB-BA38-E426801CB759}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {55905937-1399-46DB-BA38-E426801CB759}.Debug|Any CPU.Build.0 = Debug|Any CPU + {55905937-1399-46DB-BA38-E426801CB759}.Release|Any CPU.ActiveCfg = Release|Any CPU + {55905937-1399-46DB-BA38-E426801CB759}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -766,6 +772,7 @@ Global {5DDA6439-CDE0-4BFE-8BF9-77962BC69ACA} = {25D0D27A-C5FE-443D-8B65-D6C987F4A80E} {6E1ADE49-680E-4CA3-8FEA-6450802F8250} = {25D0D27A-C5FE-443D-8B65-D6C987F4A80E} {A3E22F99-F380-4005-8483-3ACA6C104220} = {25D0D27A-C5FE-443D-8B65-D6C987F4A80E} + {55905937-1399-46DB-BA38-E426801CB759} = {7AC28763-9C68-4BF9-A1BA-25CBFFD2D15C} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {0B8ABEAD-D2B5-4370-A187-62B5ABE4EE50} diff --git a/src/Controls/tests/TestCases.Android.Tests/Controls.TestCases.Android.Tests.csproj b/src/Controls/tests/TestCases.Android.Tests/Controls.TestCases.Android.Tests.csproj index 050f80101590..abf5114db98d 100644 --- a/src/Controls/tests/TestCases.Android.Tests/Controls.TestCases.Android.Tests.csproj +++ b/src/Controls/tests/TestCases.Android.Tests/Controls.TestCases.Android.Tests.csproj @@ -25,6 +25,10 @@ + diff --git a/src/Controls/tests/TestCases.Mac.Tests/Controls.TestCases.Mac.Tests.csproj b/src/Controls/tests/TestCases.Mac.Tests/Controls.TestCases.Mac.Tests.csproj index 408168b2f848..3ab9a697720b 100644 --- a/src/Controls/tests/TestCases.Mac.Tests/Controls.TestCases.Mac.Tests.csproj +++ b/src/Controls/tests/TestCases.Mac.Tests/Controls.TestCases.Mac.Tests.csproj @@ -25,6 +25,10 @@ + diff --git a/src/Controls/tests/TestCases.WinUI.Tests/Controls.TestCases.WinUI.Tests.csproj b/src/Controls/tests/TestCases.WinUI.Tests/Controls.TestCases.WinUI.Tests.csproj index 3279ab0fd0a9..09d298ca32d9 100644 --- a/src/Controls/tests/TestCases.WinUI.Tests/Controls.TestCases.WinUI.Tests.csproj +++ b/src/Controls/tests/TestCases.WinUI.Tests/Controls.TestCases.WinUI.Tests.csproj @@ -25,6 +25,10 @@ + diff --git a/src/Controls/tests/TestCases.iOS.Tests/Controls.TestCases.iOS.Tests.csproj b/src/Controls/tests/TestCases.iOS.Tests/Controls.TestCases.iOS.Tests.csproj index d781e1e9465f..e474ef78bd5f 100644 --- a/src/Controls/tests/TestCases.iOS.Tests/Controls.TestCases.iOS.Tests.csproj +++ b/src/Controls/tests/TestCases.iOS.Tests/Controls.TestCases.iOS.Tests.csproj @@ -25,6 +25,10 @@ + From 023f837caf9e9d9eccba1d35890d52c484faf7df Mon Sep 17 00:00:00 2001 From: Gerald Versluis Date: Wed, 3 Jul 2024 14:55:07 +0200 Subject: [PATCH 03/10] Add UITest.Analyzer to sln --- Microsoft.Maui.sln | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Microsoft.Maui.sln b/Microsoft.Maui.sln index f123b360efc8..c79d6764d404 100644 --- a/Microsoft.Maui.sln +++ b/Microsoft.Maui.sln @@ -269,6 +269,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Controls.TestCases.Mac.Test EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Controls.TestCases.WinUI.Tests", "src\Controls\tests\TestCases.WinUI.Tests\Controls.TestCases.WinUI.Tests.csproj", "{A1D6B9E5-D8FF-436A-9ACF-703CA5E4BD02}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UITest.Analyzers", "src\TestUtils\src\UITest.Analyzers\UITest.Analyzers.csproj", "{F1BC506B-3A9E-4779-994E-339AFB21C9B9}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -682,6 +684,10 @@ Global {A1D6B9E5-D8FF-436A-9ACF-703CA5E4BD02}.Debug|Any CPU.Build.0 = Debug|Any CPU {A1D6B9E5-D8FF-436A-9ACF-703CA5E4BD02}.Release|Any CPU.ActiveCfg = Release|Any CPU {A1D6B9E5-D8FF-436A-9ACF-703CA5E4BD02}.Release|Any CPU.Build.0 = Release|Any CPU + {F1BC506B-3A9E-4779-994E-339AFB21C9B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F1BC506B-3A9E-4779-994E-339AFB21C9B9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F1BC506B-3A9E-4779-994E-339AFB21C9B9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F1BC506B-3A9E-4779-994E-339AFB21C9B9}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -807,6 +813,7 @@ Global {29115330-6854-4715-B382-18EA3A8A8731} = {25D0D27A-C5FE-443D-8B65-D6C987F4A80E} {E8CAE2B6-62B3-431C-A76D-1CCD961A1FB4} = {25D0D27A-C5FE-443D-8B65-D6C987F4A80E} {A1D6B9E5-D8FF-436A-9ACF-703CA5E4BD02} = {25D0D27A-C5FE-443D-8B65-D6C987F4A80E} + {F1BC506B-3A9E-4779-994E-339AFB21C9B9} = {7AC28763-9C68-4BF9-A1BA-25CBFFD2D15C} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {0B8ABEAD-D2B5-4370-A187-62B5ABE4EE50} From 841333f171d7760b9fdf2df5ce29b06a4c3ba985 Mon Sep 17 00:00:00 2001 From: Gerald Versluis Date: Wed, 3 Jul 2024 15:46:38 +0200 Subject: [PATCH 04/10] Add Android test categories --- .../Tests/Concepts/AlertsGalleryTests.cs | 4 ++-- .../Tests/Concepts/ImageLoadingGalleryTests.cs | 1 + .../Tests/Concepts/InputTransparencyGalleryTests.cs | 1 + .../Tests/Issues/HideSoftInputOnTappedPageTests.cs | 1 + .../tests/TestCases.Shared.Tests/Tests/Issues/Issue10947.cs | 1 + .../tests/TestCases.Shared.Tests/Tests/Issues/Issue15815.cs | 2 +- .../tests/TestCases.Shared.Tests/Tests/Issues/Issue17453.cs | 1 + .../tests/TestCases.Shared.Tests/Tests/Issues/Issue17801.cs | 1 + .../tests/TestCases.Shared.Tests/Tests/Issues/Issue18242.cs | 1 + .../tests/TestCases.Shared.Tests/Tests/Issues/Issue18251.cs | 1 + .../tests/TestCases.Shared.Tests/Tests/Issues/Issue19509.cs | 1 + .../tests/TestCases.Shared.Tests/Tests/Issues/Issue19556.cs | 3 ++- .../tests/TestCases.Shared.Tests/Tests/Issues/Issue19592.cs | 1 + .../tests/TestCases.Shared.Tests/Tests/Issues/Issue19926.cs | 3 ++- .../tests/TestCases.Shared.Tests/Tests/Issues/Issue20156.cs | 1 + .../tests/TestCases.Shared.Tests/Tests/Issues/Issue20903.cs | 1 + .../tests/TestCases.Shared.Tests/Tests/Issues/Issue20920.cs | 1 + .../tests/TestCases.Shared.Tests/Tests/Issues/Issue21173.cs | 1 + .../tests/TestCases.Shared.Tests/Tests/Issues/Issue21513.cs | 1 + .../tests/TestCases.Shared.Tests/Tests/Issues/Issue21609.cs | 1 + .../tests/TestCases.Shared.Tests/Tests/Issues/Issue21711.cs | 1 + .../tests/TestCases.Shared.Tests/Tests/Issues/Issue22433.cs | 1 + .../tests/TestCases.Shared.Tests/Tests/Issues/Issue22443.cs | 1 + .../tests/TestCases.Shared.Tests/Tests/Issues/Issue22606.cs | 1 + .../tests/TestCases.Shared.Tests/Tests/Issues/Issue22633.cs | 1 + .../tests/TestCases.Shared.Tests/Tests/Issues/Issue22682.cs | 1 + .../tests/TestCases.Shared.Tests/Tests/Issues/Issue22750.cs | 1 + .../tests/TestCases.Shared.Tests/Tests/Issues/Issue5724.cs | 1 + .../tests/TestCases.Shared.Tests/Tests/Issues/Issue7823.cs | 1 + .../tests/TestCases.Shared.Tests/Tests/_ViewUITests.cs | 2 ++ src/Controls/tests/TestCases.Shared.Tests/UITestCategories.cs | 3 +++ 31 files changed, 37 insertions(+), 5 deletions(-) diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Concepts/AlertsGalleryTests.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Concepts/AlertsGalleryTests.cs index 5527b2fa9bb6..0e8d8bfba405 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Concepts/AlertsGalleryTests.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Concepts/AlertsGalleryTests.cs @@ -54,7 +54,7 @@ public void AlertCancel() ClassicAssert.AreEqual($"Event: {test} (SUCCESS 1)", textAfterClick); } - [Test] + [Test, Category(UITestCategories.DisplayAlert)] [TestCase(Test.Alerts.AlertAcceptCancelClickAccept, "ACCEPT")] [TestCase(Test.Alerts.AlertAcceptCancelClickCancel, "CANCEL")] public void AlertAcceptCancel(Test.Alerts test, string buttonText) @@ -91,7 +91,7 @@ public void AlertAcceptCancel(Test.Alerts test, string buttonText) ClassicAssert.AreEqual($"Event: {test} (SUCCESS 1)", textAfterClick); } - [Test] + [Test, Category(UITestCategories.ActionSheet)] [TestCase(Test.Alerts.ActionSheetClickItem, "ITEM 2")] [TestCase(Test.Alerts.ActionSheetClickCancel, "CANCEL")] [TestCase(Test.Alerts.ActionSheetClickDestroy, "DESTROY")] diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Concepts/ImageLoadingGalleryTests.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Concepts/ImageLoadingGalleryTests.cs index d822d99a510d..350cd18313f5 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Concepts/ImageLoadingGalleryTests.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Concepts/ImageLoadingGalleryTests.cs @@ -4,6 +4,7 @@ namespace Microsoft.Maui.TestCases.Tests { + [Category(UITestCategories.Image)] public class ImageLoadingGalleryTests : CoreGalleryBasePageTest { public ImageLoadingGalleryTests(TestDevice device) diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Concepts/InputTransparencyGalleryTests.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Concepts/InputTransparencyGalleryTests.cs index 4f21a114baa2..9e9b2cbc77a7 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Concepts/InputTransparencyGalleryTests.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Concepts/InputTransparencyGalleryTests.cs @@ -5,6 +5,7 @@ namespace Microsoft.Maui.TestCases.Tests { + [Category(UITestCategories.InputTransparent)] public class InputTransparencyGalleryTests : CoreGalleryBasePageTest { const string ButtonGallery = "Input Transparency Gallery"; diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/HideSoftInputOnTappedPageTests.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/HideSoftInputOnTappedPageTests.cs index d3ec0005a404..6a2d7a61eae0 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/HideSoftInputOnTappedPageTests.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/HideSoftInputOnTappedPageTests.cs @@ -5,6 +5,7 @@ namespace Microsoft.Maui.TestCases.Tests.Issues { + [Category(UITestCategories.SoftInput)] public class HideSoftInputOnTappedPageTests : _IssuesUITest { public HideSoftInputOnTappedPageTests(TestDevice device) : base(device) { } diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10947.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10947.cs index dac97f933764..27a87a47f2d9 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10947.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10947.cs @@ -16,6 +16,7 @@ public Issue10947(TestDevice device) string FooterEntry => "FooterEntry"; [Test] + [Category(UITestCategories.CollectionView)] public void CollectionViewHeaderShouldNotScroll() { var headerEntry = App.WaitForElement(HeaderEntry); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue15815.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue15815.cs index 6326c6918aed..970eb4704a45 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue15815.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue15815.cs @@ -13,7 +13,7 @@ public Issue15815(TestDevice device) public override string Issue => "Horizontal CollectionView does not show the last element under some condition"; - [Test] + [Test, Category(UITestCategories.CollectionView)] public void LastItemIsVisilbe() { var lastItem = App.WaitForElement("id-2"); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue17453.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue17453.cs index b02802d1c8e0..25abbadca118 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue17453.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue17453.cs @@ -39,6 +39,7 @@ public void EntryClearButtonWorksEntryDoesntClearWhenNotClickingOnClear() } [Test] + [Category(UITestCategories.Entry)] public void EntryClearButtonWorks() { // https://github.com/dotnet/maui/issues/17453 diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue17801.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue17801.cs index 647f9ad7177b..fd6a5b55c041 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue17801.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue17801.cs @@ -11,6 +11,7 @@ public Issue17801(TestDevice device) : base(device) { } public override string Issue => "ScrollView always has a scroll bar on iOS"; [Test] + [Category(UITestCategories.ScrollView)] public void NoScrollbarsTest() { App.WaitForElement("WaitForStubControl"); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18242.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18242.cs index 28056fbeb0c7..2aa9418ca825 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18242.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18242.cs @@ -13,6 +13,7 @@ public Issue18242(TestDevice device) : base(device) public override string Issue => "Button ImageSource not Scaling as expected"; [Test] + [Category(UITestCategories.Button)] [FailsOnIOS("iOS will be fixed in https://github.com/dotnet/maui/pull/20953")] [FailsOnMac("Catalyst will be fixed in https://github.com/dotnet/maui/pull/20953")] public void Issue18242Test() diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18251.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18251.cs index 63f61d50d8a9..6cefdf8d1e29 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18251.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18251.cs @@ -11,6 +11,7 @@ public Issue18251(TestDevice device) : base(device) { } public override string Issue => "IllegalArgumentException when changing number of tabbar pages"; [Test] + [Category(UITestCategories.Shell)] public void NoExceptionShouldBeThrownAddingShellTabs() { App.WaitForElement("button"); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19509.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19509.cs index 8eb344c5bf1a..0ab2793c8059 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19509.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19509.cs @@ -14,6 +14,7 @@ public Issue19509(TestDevice device) : base(device) [Test] [FailsOnMac("VerifyScreenshot method not implemented on macOS")] + [Category(UITestCategories.Entry)] public void EntryTextColorStopsWorkingAfterPropertyIsUpdatedFromBinding() { App.WaitForElement("WaitForStubControl"); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19556.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19556.cs index 74ce952735a2..3caaed5e79ff 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19556.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19556.cs @@ -13,7 +13,8 @@ public Issue19556(TestDevice device) : base(device) { } - [Test] + [Test] + [Category(UITestCategories.Label)] public void SystemFontsShouldRenderCorrectly() { _ = App.WaitForElement("label"); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19592.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19592.cs index 60ff1a41e42c..7e1abc2eda1e 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19592.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19592.cs @@ -14,6 +14,7 @@ public Issue19592(TestDevice device) : base(device) } [Test] + [Category(UITestCategories.Label)] public void SpanLineHeightShouldNotGrowProgressively() { _ = App.WaitForElement("label"); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19926.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19926.cs index afff08338c88..c64b46c972b2 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19926.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19926.cs @@ -13,7 +13,8 @@ public Issue19926(TestDevice device) : base(device) { } - [Test] + [Test] + [Category(UITestCategories.BoxView)] public void PropertiesShouldBeCorrectlyApplied() { _ = App.WaitForElement("boxView"); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20156.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20156.cs index b63e5df645f2..9adcc08c889d 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20156.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20156.cs @@ -13,6 +13,7 @@ public Issue20156(TestDevice device) { } [Test] + [Category(UITestCategories.Border)] [FailsOnMac("VerifyScreenshot method not implemented on macOS")] public void BorderShouldHaveNoThickness() { diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20903.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20903.cs index 047088572590..9a609ef5829d 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20903.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20903.cs @@ -12,6 +12,7 @@ public Issue20903(TestDevice device) : base(device) { } public override string Issue => "Double-tap behavior should work correctly when adding a new double-tap handler"; [Test] + [Category(UITestCategories.Gestures)] public async Task RegisterTwoDoubleTapHandlersAndCheckNumberOfFiredEventsAsync() { _ = App.WaitForElement("AddDoubleTapHandlerButton"); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20920.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20920.cs index 1b131762a567..8e2cc6a50d62 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20920.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20920.cs @@ -13,6 +13,7 @@ public Issue20920(TestDevice device) : base(device) { } public override string Issue => "Nested ScrollView does not work in Android"; [Test] + [Category(UITestCategories.ScrollView)] public void ScrollingBothDirectionsWithNestedScrollViews() { // TODO: Correct this test for other platforms diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21173.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21173.cs index cb5457096f13..0026b7788118 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21173.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21173.cs @@ -14,6 +14,7 @@ public Issue21173(TestDevice device) #if ANDROID [Test] + [Category(UITestCategories.Border)] public void BorderWithRoundRectangleShouldRoundCornersOfContentWithinIt() { _ = App.WaitForElement("border"); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21513.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21513.cs index 6bdb9446f755..1c4f4cd6b21a 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21513.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21513.cs @@ -13,6 +13,7 @@ public Issue21513(TestDevice device) public override string Issue => "Buttons with images don't cover text"; [Test] + [Category(UITestCategories.Button)] [FailsOnIOS("Not generated snapshot for this platform")] [FailsOnMac("VerifyScreenshot method not implemented on macOS")] public void Issue21513Test() diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21609.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21609.cs index b1e99db15bcb..69e08db2b384 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21609.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21609.cs @@ -13,6 +13,7 @@ public Issue21609(TestDevice device) : base(device) { } public override string Issue => "Changing the dimensions of the CarouselView doesn't update Item Dimensions"; [Test] + [Category(UITestCategories.CarouselView)] public void ChangingDimensionsOfCarouselViewDoesntUpdateItemDimensions() { // This test is currently not passing on windows diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21711.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21711.cs index eb471bb76ef1..15a2f0b59b1f 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21711.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21711.cs @@ -4,6 +4,7 @@ namespace Microsoft.Maui.TestCases.Tests.Issues { + [Category(UITestCategories.FlexLayout)] public class Issue21711 : _IssuesUITest { public Issue21711(TestDevice device) : base(device) diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22433.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22433.cs index fe6200f00930..47aeaf8fdac7 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22433.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22433.cs @@ -13,6 +13,7 @@ public Issue22433(TestDevice device) : base(device) public override string Issue => "Button Device Tests Default"; [Test] + [Category(UITestCategories.Button)] public async Task ButtonLayoutAndSpacingTests() { App.WaitForElement("TestNavigateButtonLayout"); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22443.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22443.cs index 0c464dff9a1e..8283ec424745 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22443.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22443.cs @@ -13,6 +13,7 @@ public Issue22443(TestDevice device) public override string Issue => "App Crash on Scroll Animation while navigating away from Page"; [Test] + [Category(UITestCategories.Navigation)] public void NoExceptionShouldBeThrown() { App.WaitForElement("button"); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22606.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22606.cs index 44345f00a117..180be16b552f 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22606.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22606.cs @@ -4,6 +4,7 @@ namespace Microsoft.Maui.TestCases.Tests.Issues { + [Category(UITestCategories.Border)] public class Issue22606 : _IssuesUITest { public Issue22606(TestDevice device) : base(device) { } diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22633.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22633.cs index 15bb5206ceef..04421359fda4 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22633.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22633.cs @@ -13,6 +13,7 @@ public Issue22633(TestDevice device) : base(device) public override string Issue => "[iOS] Crash on when initializing a TabbedPage without children"; [Test] + [Category(UITestCategories.TabbedPage)] public void ExceptionShouldNotBeThrown() { App.WaitForElement("label"); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22682.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22682.cs index 47aecbfa9fd0..480e0ede8488 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22682.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22682.cs @@ -13,6 +13,7 @@ public Issue22682(TestDevice device) : base(device) } [Test] + [Category(UITestCategories.ImageButton)] public void AppShouldNotCrash() { _ = App.WaitForElement("imageButton"); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22750.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22750.cs index a82509d29b20..6c224f0fb583 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22750.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22750.cs @@ -14,6 +14,7 @@ public Issue22750(TestDevice device) : base(device) public override string Issue => "Using radiobuttons in a group, pressing one button works fine, but pressing the second does not reset the first hence"; [Test] + [Category(UITestCategories.RadioButton)] public void RadioButtonUpdateValueInsideBorder() { App.WaitForElement("WaitForStubControl"); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue5724.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue5724.cs index 71c9d13d091a..ac88680dbb74 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue5724.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue5724.cs @@ -15,6 +15,7 @@ public Issue5724(TestDevice device) : base(device) public override string Issue => "Next Moves To Next Entry and Done Closes Input View"; [Test] + [Category(UITestCategories.Entry)] public async Task TappingNextMovesToNextElement() { // Send Keys only works on Android which is why we are ignoring these other platforms. diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue7823.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue7823.cs index 2c595a659ad8..094ee4df4cde 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue7823.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue7823.cs @@ -14,6 +14,7 @@ public Issue7823(TestDevice device) public override string Issue => "In a ToolbarItems, if an item has no icon but just text, MAUI uses the icon from the previous page in the Navigation"; [Test] + [Category(UITestCategories.ToolbarItem)] [FailsOnMac("VerifyScreenshot method not implemented on macOS")] public void UpdateToolbarItemAfterNavigate() { diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/_ViewUITests.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/_ViewUITests.cs index 236097c6e06e..09e7ea488c16 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/_ViewUITests.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/_ViewUITests.cs @@ -12,6 +12,7 @@ public abstract class _ViewUITests : CoreGalleryBasePageTest public _ViewUITests(TestDevice device) : base(device) { } [Test] + [Category(UITestCategories.IsEnabled)] public virtual void IsEnabled() { var remote = GoToStateRemote(); @@ -36,6 +37,7 @@ public virtual void IsEnabled() } [Test] + [Category(UITestCategories.IsVisible)] public virtual void IsVisible() { var remote = GoToStateRemote(); diff --git a/src/Controls/tests/TestCases.Shared.Tests/UITestCategories.cs b/src/Controls/tests/TestCases.Shared.Tests/UITestCategories.cs index d08e4194c378..fa6bb0707fe2 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/UITestCategories.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/UITestCategories.cs @@ -27,12 +27,14 @@ internal static class UITestCategories public const string Layout = "Layout"; public const string ListView = "ListView"; public const string LifeCycle = "Lifecycle"; + public const string FlexLayout = "FlexLayout"; public const string FlyoutPage = "FlyoutPage"; public const string Picker = "Picker"; public const string ProgressBar = "ProgressBar"; public const string ScrollView = "ScrollView"; public const string SearchBar = "SearchBar"; public const string Slider = "Slider"; + public const string SoftInput = "SoftInput"; public const string Stepper = "Stepper"; public const string Switch = "Switch"; public const string SwipeView = "SwipeView"; @@ -44,6 +46,7 @@ internal static class UITestCategories public const string Maps = "Maps"; public const string InputTransparent = "InputTransparent"; public const string IsEnabled = "IsEnabled"; + public const string IsVisible = "IsVisible"; public const string Gestures = "Gestures"; public const string Navigation = "Navigation"; public const string Effects = "Effects"; From 085a02426fec7e33f0932b3c3685de850f356493 Mon Sep 17 00:00:00 2001 From: Gerald Versluis Date: Wed, 3 Jul 2024 16:00:09 +0200 Subject: [PATCH 05/10] Add iOS categories --- .../tests/TestCases.Shared.Tests/Tests/Issues/Issue19803.cs | 1 + .../tests/TestCases.Shared.Tests/Tests/Issues/Issue19956.cs | 3 ++- .../tests/TestCases.Shared.Tests/Tests/Issues/Issue20199.cs | 1 + .../tests/TestCases.Shared.Tests/Tests/Issues/Issue20294.cs | 1 + .../tests/TestCases.Shared.Tests/Tests/Issues/Issue20439.cs | 1 + .../tests/TestCases.Shared.Tests/Tests/Issues/Issue20696.cs | 3 ++- .../tests/TestCases.Shared.Tests/Tests/Issues/Issue21314.cs | 3 ++- .../tests/TestCases.Shared.Tests/Tests/Issues/Issue21711.cs | 2 +- .../tests/TestCases.Shared.Tests/Tests/Issues/Issue21726.cs | 3 ++- .../tests/TestCases.Shared.Tests/Tests/Issues/Issue22183.cs | 1 + .../Tests/Issues/ReduceInvalidateMeasure.cs | 1 + .../TestCases.Shared.Tests/Tests/KeyboardScrollingGridTests.cs | 1 + .../Tests/KeyboardScrollingNonScrollingPageLargeTitlesTests.cs | 1 + src/Controls/tests/TestCases.Shared.Tests/UITestCategories.cs | 1 - 14 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19803.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19803.cs index 58ae6555b27b..8ddb284464a4 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19803.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19803.cs @@ -14,6 +14,7 @@ public Issue19803(TestDevice device) : base(device) public override string Issue => "[iOS] Setting Binding on Span GridItemsLayout results in NullReferenceException"; [Test] + [Category(UITestCategories.CollectionView)] public void NoNREWhenChangingGridItemsLayout() { _ = App.WaitForElement("button"); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19956.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19956.cs index 9bee3366ff15..1634af1a067e 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19956.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19956.cs @@ -7,6 +7,8 @@ using NUnit.Framework.Legacy; namespace Microsoft.Maui.TestCases.Tests.Issues; + +[Category(UITestCategories.Entry)] public class Issue19956: _IssuesUITest { public Issue19956(TestDevice device) : base(device) { } @@ -14,7 +16,6 @@ public Issue19956(TestDevice device) : base(device) { } public override string Issue => "Sticky headers and bottom content insets"; [Test] - [Category(UITestCategories.Entry)] public void ContentAccountsForStickyHeaders() { // This is an iOS Keyboard Scrolling issue. diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20199.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20199.cs index de51da16da61..a08049dac81e 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20199.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20199.cs @@ -14,6 +14,7 @@ public Issue20199(TestDevice device) : base(device) } [Test] + [Category(UITestCategories.Page)] [FailsOnMac("VerifyScreenshot method not implemented on macOS")] public void TitleViewShouldBeVisible() { diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20294.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20294.cs index 50889d7fc1f6..b72da2f20b78 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20294.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20294.cs @@ -12,6 +12,7 @@ public Issue20294(TestDevice device) : base(device) { } public override string Issue => "CollectionView containing a Footer and a Border with StrokeThickness set to decimal value crashes on scroll"; [Test] + [Category(UITestCategories.CollectionView)] public void ScrollToEndDoesntCrash() { App.ScrollTo("FOOTER"); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20439.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20439.cs index c2480a1e0739..59cfe16f5dd4 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20439.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20439.cs @@ -14,6 +14,7 @@ public Issue20439(TestDevice device) : base(device) } [Test] + [Category(UITestCategories.Entry)] public void ErrorShouldNotBeThrown() { try diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20696.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20696.cs index 1e3901cebe47..8d678defa834 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20696.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20696.cs @@ -14,7 +14,8 @@ public Issue20696(TestDevice device) : base(device) #if IOS [Test] - #endif + [Category(UITestCategories.Shell)] +#endif public void FlyoutHeaderShouldBeResized() { _ = App.WaitForElement("GoToTest"); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21314.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21314.cs index a74c16bbdcc6..3684a37c941c 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21314.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21314.cs @@ -15,7 +15,8 @@ public Issue21314(TestDevice device) : base(device) } [Test] - public void ImageShouldBePortrait() + [Category(UITestCategories.Image)] + public void ImageShouldBePortrait() { var image = App.WaitForElement ("theImage").GetRect(); ClassicAssert.Greater(image.Height, image.Width); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21711.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21711.cs index 15a2f0b59b1f..beb48ac4d66f 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21711.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21711.cs @@ -4,7 +4,7 @@ namespace Microsoft.Maui.TestCases.Tests.Issues { - [Category(UITestCategories.FlexLayout)] + [Category(UITestCategories.Layout)] public class Issue21711 : _IssuesUITest { public Issue21711(TestDevice device) : base(device) diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21726.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21726.cs index 32e44481fad5..ab6d383f59c3 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21726.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21726.cs @@ -15,7 +15,8 @@ public Issue21726(TestDevice device) : base(device) public override string Issue => "Modal with a bottom sheet should not crash iOS Keyboard Scroll"; [Test] - public void PushViewControllerWithNullWindow() + [Category(UITestCategories.SoftInput)] + public void PushViewControllerWithNullWindow() { App.WaitForElement("AddVC"); App.Click("AddVC"); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22183.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22183.cs index 6fb98461bea5..990ce916a3b9 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22183.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22183.cs @@ -14,6 +14,7 @@ public Issue22183(TestDevice device) : base(device) public override string Issue => "RadioButton with value cannot display selected state correctly"; [Test] + [Category(UITestCategories.RadioButton)] public void RadioButtonWithValueChangeSelected() { App.WaitForElement("TestCollectionView"); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/ReduceInvalidateMeasure.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/ReduceInvalidateMeasure.cs index f8b940d70f1f..cd61243570f2 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/ReduceInvalidateMeasure.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/ReduceInvalidateMeasure.cs @@ -14,6 +14,7 @@ public ReduceInvalidateMeasure(TestDevice device) public override string Issue => "https://github.com/dotnet/maui/pull/21801"; [Test] + [Category(UITestCategories.Performance)] public void ReduceInvalidateMeasuresUpdatingLabel() { App.WaitForElement("UpdateTextLabel"); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/KeyboardScrollingGridTests.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/KeyboardScrollingGridTests.cs index ac46f6d0b4c3..4391a7b620f0 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/KeyboardScrollingGridTests.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/KeyboardScrollingGridTests.cs @@ -20,6 +20,7 @@ protected override void FixtureSetup() } [Test] + [Category(UITestCategories.Layout)] public void GridStarRowScrollingTest() { KeyboardScrolling.GridStarRowScrollingTest(App); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/KeyboardScrollingNonScrollingPageLargeTitlesTests.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/KeyboardScrollingNonScrollingPageLargeTitlesTests.cs index 95e19a6d5ae0..664e56d7752b 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/KeyboardScrollingNonScrollingPageLargeTitlesTests.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/KeyboardScrollingNonScrollingPageLargeTitlesTests.cs @@ -4,6 +4,7 @@ namespace Microsoft.Maui.TestCases.Tests { + [Category(UITestCategories.Layout)] public class KeyboardScrollingNonScrollingPageLargeTitlesTests : UITest { const string KeyboardScrollingGallery = "Keyboard Scrolling Gallery - NonScrolling Page / Large Titles"; diff --git a/src/Controls/tests/TestCases.Shared.Tests/UITestCategories.cs b/src/Controls/tests/TestCases.Shared.Tests/UITestCategories.cs index fa6bb0707fe2..4432ae68ebf6 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/UITestCategories.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/UITestCategories.cs @@ -27,7 +27,6 @@ internal static class UITestCategories public const string Layout = "Layout"; public const string ListView = "ListView"; public const string LifeCycle = "Lifecycle"; - public const string FlexLayout = "FlexLayout"; public const string FlyoutPage = "FlyoutPage"; public const string Picker = "Picker"; public const string ProgressBar = "ProgressBar"; From 511549ef1b41b8ffeca2183ba7e65fb53a81fb38 Mon Sep 17 00:00:00 2001 From: Gerald Versluis Date: Wed, 3 Jul 2024 16:06:25 +0200 Subject: [PATCH 06/10] Add more categories --- .../Tests/Issues/Issue16918.cs | 1 + .../Tests/Issues/Issue17694.cs | 1 + .../Tests/Issues/Issue20842.cs | 1 + .../Tests/Issues/Issue21202.cs | 1 + .../Tests/Issues/Issue21394.cs | 1 + .../Tests/Issues/Issue21706.cs | 1 + .../Tests/Issues/Issue21787.cs | 1 + .../PlatformSpecificSampleTest.cs | 21 ------------------- 8 files changed, 7 insertions(+), 21 deletions(-) delete mode 100644 src/Controls/tests/TestCases.WinUI.Tests/PlatformSpecificSampleTest.cs diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue16918.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue16918.cs index 3f5300cb6121..e4ca739bf8ae 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue16918.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue16918.cs @@ -14,6 +14,7 @@ public Issue16918(TestDevice device) public override string Issue => "ImageButton is not properly anti-aliased when scaled down"; [Test] + [Category(UITestCategories.ImageButton)] public void Issue16918Test() { // https://github.com/dotnet/maui/issues/16918 diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue17694.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue17694.cs index 80f65514f4f2..db19bc2c6da5 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue17694.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue17694.cs @@ -14,6 +14,7 @@ public Issue17694(TestDevice device) : base(device) public override string Issue => "Circle view not rotating from center"; [Test] + [Category(UITestCategories.Animation)] public void Issue17694Test() { App.WaitForElement("Spin"); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20842.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20842.cs index 27612f4fea2d..0cfdfa98ba54 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20842.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20842.cs @@ -17,6 +17,7 @@ public Issue20842(TestDevice device) : base(device) public override string Issue => "Verify data templates in CollectionView virtualize correctly"; [Test] + [Category(UITestCategories.CollectionView)] public async Task VerifyCollectionViewItemsAfterScrolling() { App.WaitForElement(scrollUpButton); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21202.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21202.cs index 9455e272ba0e..7f2f9cf653d6 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21202.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21202.cs @@ -14,6 +14,7 @@ public Issue21202(TestDevice device) : base(device) public override string Issue => "FontImageSource incorrectly sized"; [Test] + [Category(UITestCategories.Button)] public void Issue21202Test() { App.WaitForElement("WaitForStubControl"); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21394.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21394.cs index f9b60cc01d91..3ebea13520b6 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21394.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21394.cs @@ -14,6 +14,7 @@ public Issue21394(TestDevice device) public override string Issue => "Buttons with Images layouts"; [Test] + [Category(UITestCategories.Button)] public void Issue21394Test() { // iOS will be fixed in https://github.com/dotnet/maui/pull/20953 diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21706.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21706.cs index 9793732283f5..176d61cbd6de 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21706.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21706.cs @@ -12,6 +12,7 @@ public class Issue21706 : _IssuesUITest public Issue21706(TestDevice device) : base(device) { } [Test] + [Category(UITestCategories.ImageButton)] public async Task ImageButtonStuckAfterRightClick() { App.WaitForElement("WaitForElement"); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21787.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21787.cs index ba12f1e45ce7..e45f96ce99bc 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21787.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21787.cs @@ -12,6 +12,7 @@ public Issue21787(TestDevice device) : base(device) { } public override string Issue => "[Windows] Remove workaround for label text decorations"; [Test] + [Category(UITestCategories.Label)] public void LabelTextDecorationsWorks() { App.WaitForElement("TestButton"); diff --git a/src/Controls/tests/TestCases.WinUI.Tests/PlatformSpecificSampleTest.cs b/src/Controls/tests/TestCases.WinUI.Tests/PlatformSpecificSampleTest.cs deleted file mode 100644 index fe85d182b0ac..000000000000 --- a/src/Controls/tests/TestCases.WinUI.Tests/PlatformSpecificSampleTest.cs +++ /dev/null @@ -1,21 +0,0 @@ -using NUnit.Framework; -using OpenQA.Selenium.Appium; -using UITest.Core; - -namespace Microsoft.Maui.TestCases.Tests; - -public class PlatformSpecificSampleTest : UITest -{ - public PlatformSpecificSampleTest(TestDevice testDevice) : base(testDevice) - { - } - - [Test] - public void SampleTest() - { - if (App is AppiumDriver driver) - { - driver?.GetScreenshot().SaveAsFile($"{nameof(SampleTest)}.png"); - } - } -} \ No newline at end of file From 8463a799c5608818f1314de819504e197a4cdeae Mon Sep 17 00:00:00 2001 From: Gerald Versluis Date: Wed, 3 Jul 2024 16:31:07 +0200 Subject: [PATCH 07/10] Bump down dependencies --- src/TestUtils/src/UITest.Analyzers/UITest.Analyzers.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/TestUtils/src/UITest.Analyzers/UITest.Analyzers.csproj b/src/TestUtils/src/UITest.Analyzers/UITest.Analyzers.csproj index b6c385c726f3..5085a21d6036 100644 --- a/src/TestUtils/src/UITest.Analyzers/UITest.Analyzers.csproj +++ b/src/TestUtils/src/UITest.Analyzers/UITest.Analyzers.csproj @@ -14,8 +14,8 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + From 2400c33654a6e7f638fb9558e2b133a53bdbff28 Mon Sep 17 00:00:00 2001 From: Gerald Versluis Date: Wed, 3 Jul 2024 16:55:40 +0200 Subject: [PATCH 08/10] More missing categories --- .../Tests/Concepts/AlertsGalleryTests.cs | 7 +++++-- .../Issues/IsInvokeRequiredRaceCondition.cs | 1 + .../Tests/Issues/Issue22549.cs | 1 + .../UITestCategories.cs | 1 + .../PlatformSpecificSampleTest.cs | 21 ------------------- 5 files changed, 8 insertions(+), 23 deletions(-) delete mode 100644 src/Controls/tests/TestCases.iOS.Tests/PlatformSpecificSampleTest.cs diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Concepts/AlertsGalleryTests.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Concepts/AlertsGalleryTests.cs index 0e8d8bfba405..e1928634f286 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Concepts/AlertsGalleryTests.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Concepts/AlertsGalleryTests.cs @@ -20,6 +20,7 @@ protected override void NavigateToGallery() // TODO: UI testing alert code is not yet implemented on Windows. #if !WINDOWS [Test] + [Category(UITestCategories.DisplayAlert)] public void AlertCancel() { var test = Test.Alerts.AlertCancel; @@ -54,7 +55,8 @@ public void AlertCancel() ClassicAssert.AreEqual($"Event: {test} (SUCCESS 1)", textAfterClick); } - [Test, Category(UITestCategories.DisplayAlert)] + [Test] + [Category(UITestCategories.DisplayAlert)] [TestCase(Test.Alerts.AlertAcceptCancelClickAccept, "ACCEPT")] [TestCase(Test.Alerts.AlertAcceptCancelClickCancel, "CANCEL")] public void AlertAcceptCancel(Test.Alerts test, string buttonText) @@ -91,7 +93,8 @@ public void AlertAcceptCancel(Test.Alerts test, string buttonText) ClassicAssert.AreEqual($"Event: {test} (SUCCESS 1)", textAfterClick); } - [Test, Category(UITestCategories.ActionSheet)] + [Test] + [Category(UITestCategories.ActionSheet)] [TestCase(Test.Alerts.ActionSheetClickItem, "ITEM 2")] [TestCase(Test.Alerts.ActionSheetClickCancel, "CANCEL")] [TestCase(Test.Alerts.ActionSheetClickDestroy, "DESTROY")] diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/IsInvokeRequiredRaceCondition.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/IsInvokeRequiredRaceCondition.cs index 0775a2ae7970..c616d7798b1f 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/IsInvokeRequiredRaceCondition.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/IsInvokeRequiredRaceCondition.cs @@ -13,6 +13,7 @@ public IsInvokeRequiredRaceCondition(TestDevice device) : base(device) public override string Issue => "Application.Current.Dispatcher.IsDispatchRequired race condition causes crash"; [Test] + [Category(UITestCategories.Dispatcher)] public void ApplicationDispatcherIsInvokeRequiredRaceConditionCausesCrash() { App.WaitForElement("crashButton"); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22549.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22549.cs index 4e0364282f7e..695e2da239ef 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22549.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22549.cs @@ -11,6 +11,7 @@ public Issue22549(TestDevice device) : base(device) { } public override string Issue => "Binding Border.StrokeShape not working"; [Test] + [Category(UITestCategories.Border)] public void BindingOnStrokeShapeShouldWork() { App.WaitForElement("button"); diff --git a/src/Controls/tests/TestCases.Shared.Tests/UITestCategories.cs b/src/Controls/tests/TestCases.Shared.Tests/UITestCategories.cs index 4432ae68ebf6..5d7f205d1fde 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/UITestCategories.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/UITestCategories.cs @@ -16,6 +16,7 @@ internal static class UITestCategories public const string CollectionView = "CollectionView"; public const string ContextActions = "ContextActions"; public const string DatePicker = "DatePicker"; + public const string Dispatcher = "Dispatcher"; public const string DragAndDrop = "DragAndDrop"; public const string DisplayAlert = "DisplayAlert"; public const string Editor = "Editor"; diff --git a/src/Controls/tests/TestCases.iOS.Tests/PlatformSpecificSampleTest.cs b/src/Controls/tests/TestCases.iOS.Tests/PlatformSpecificSampleTest.cs deleted file mode 100644 index fe85d182b0ac..000000000000 --- a/src/Controls/tests/TestCases.iOS.Tests/PlatformSpecificSampleTest.cs +++ /dev/null @@ -1,21 +0,0 @@ -using NUnit.Framework; -using OpenQA.Selenium.Appium; -using UITest.Core; - -namespace Microsoft.Maui.TestCases.Tests; - -public class PlatformSpecificSampleTest : UITest -{ - public PlatformSpecificSampleTest(TestDevice testDevice) : base(testDevice) - { - } - - [Test] - public void SampleTest() - { - if (App is AppiumDriver driver) - { - driver?.GetScreenshot().SaveAsFile($"{nameof(SampleTest)}.png"); - } - } -} \ No newline at end of file From 2f9c87526bad0a6f44cb5d2efc61317948141754 Mon Sep 17 00:00:00 2001 From: Gerald Versluis Date: Thu, 4 Jul 2024 08:42:16 +0200 Subject: [PATCH 09/10] And more --- .../PlatformSpecificSampleTest.cs | 21 ------------------- .../PlatformSpecificSampleTest.cs | 21 ------------------- .../Tests/Issues/Issue5724.cs | 1 + 3 files changed, 1 insertion(+), 42 deletions(-) delete mode 100644 src/Controls/tests/TestCases.Android.Tests/PlatformSpecificSampleTest.cs delete mode 100644 src/Controls/tests/TestCases.Mac.Tests/PlatformSpecificSampleTest.cs diff --git a/src/Controls/tests/TestCases.Android.Tests/PlatformSpecificSampleTest.cs b/src/Controls/tests/TestCases.Android.Tests/PlatformSpecificSampleTest.cs deleted file mode 100644 index fe85d182b0ac..000000000000 --- a/src/Controls/tests/TestCases.Android.Tests/PlatformSpecificSampleTest.cs +++ /dev/null @@ -1,21 +0,0 @@ -using NUnit.Framework; -using OpenQA.Selenium.Appium; -using UITest.Core; - -namespace Microsoft.Maui.TestCases.Tests; - -public class PlatformSpecificSampleTest : UITest -{ - public PlatformSpecificSampleTest(TestDevice testDevice) : base(testDevice) - { - } - - [Test] - public void SampleTest() - { - if (App is AppiumDriver driver) - { - driver?.GetScreenshot().SaveAsFile($"{nameof(SampleTest)}.png"); - } - } -} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Mac.Tests/PlatformSpecificSampleTest.cs b/src/Controls/tests/TestCases.Mac.Tests/PlatformSpecificSampleTest.cs deleted file mode 100644 index fe85d182b0ac..000000000000 --- a/src/Controls/tests/TestCases.Mac.Tests/PlatformSpecificSampleTest.cs +++ /dev/null @@ -1,21 +0,0 @@ -using NUnit.Framework; -using OpenQA.Selenium.Appium; -using UITest.Core; - -namespace Microsoft.Maui.TestCases.Tests; - -public class PlatformSpecificSampleTest : UITest -{ - public PlatformSpecificSampleTest(TestDevice testDevice) : base(testDevice) - { - } - - [Test] - public void SampleTest() - { - if (App is AppiumDriver driver) - { - driver?.GetScreenshot().SaveAsFile($"{nameof(SampleTest)}.png"); - } - } -} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue5724.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue5724.cs index ac88680dbb74..f2207b4ac0b4 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue5724.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue5724.cs @@ -32,6 +32,7 @@ public async Task TappingNextMovesToNextElement() } [Test] + [Category(UITestCategories.SoftInput)] public async Task TappingDoneClosesKeyboard() { App.WaitForElement("EntryDone"); From fb4094af8e79d2dd0116c0a658b468537a34154d Mon Sep 17 00:00:00 2001 From: Gerald Versluis Date: Thu, 4 Jul 2024 08:50:03 +0200 Subject: [PATCH 10/10] Last one --- .../tests/TestCases.Shared.Tests/Tests/Issues/Issue16910.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue16910.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue16910.cs index fb21d0c9bdd4..43670c88fbb4 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue16910.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue16910.cs @@ -5,6 +5,7 @@ namespace Microsoft.Maui.TestCases.Tests.Issues; +[Category(UITestCategories.RefreshView)] public class Issue16910 : _IssuesUITest { public override string Issue => "IsRefreshing binding works"; @@ -16,7 +17,7 @@ public Issue16910(TestDevice device) } - [Test] + [Test] public void BindingUpdatesFromProgrammaticRefresh() { _ = App.WaitForElement("StartRefreshing"); @@ -28,8 +29,7 @@ public void BindingUpdatesFromProgrammaticRefresh() // Windows only works with touch inputs which we don't have running on the test server #if !WINDOWS && !MACCATALYST - [Test] - [Category(UITestCategories.RefreshView)] + [Test] public void BindingUpdatesFromInteractiveRefresh() { _ = App.WaitForElement("CollectionView");