Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
82ebe12
Initial plan
Copilot Jun 27, 2025
24b7ff6
Implement startup argument support for Catalyst Test Runner
Copilot Jun 27, 2025
6b5466d
Apply code formatting fixes
Copilot Jun 27, 2025
8df014f
redefined copilot fix
Jul 11, 2025
8c3cce8
resolved test failures while running multiple cases
Jul 15, 2025
43abb87
fix issues on continuous test run
Jul 15, 2025
c59a92f
remove if directive
Jul 15, 2025
a4be8f6
Resolved issues when reset was set to true
Jul 15, 2025
ead3882
Added condition for mac
Jul 15, 2025
b1c43e6
Added summary
Jul 16, 2025
02e0b6c
Resolved the test failures and changed the workflow for gallery test …
Jul 17, 2025
17eca2e
Resolved build errors occurs on other platforms
Jul 18, 2025
d0d757f
Addressed review concerns
Jul 22, 2025
4756545
Update src/TestUtils/src/UITest.Appium/Actions/AppiumLifecycleActions.cs
Jul 23, 2025
21824a7
Update src/Controls/tests/TestCases.HostApp/TestCases.cs
Jul 23, 2025
2c29f1d
Update SwipeViewUITests.cs
Jul 23, 2025
e8b0fe1
Resolved test failures in Entry and Carousel pipelines
Jul 25, 2025
119f0da
resolved test failures in CollectionView
Jul 25, 2025
ea5726a
Resolved Border category UI Tests failures
Jul 27, 2025
fc5d98b
Resolved Button Category UITest failures
Jul 28, 2025
e6d1ca7
Resolved StaleElementReferenceException on Navigation categories tests
Jul 28, 2025
f19f36d
Resolved Label category test failure
Jul 28, 2025
c9a3bca
Deleted duplicate test cases for id 12714
Jul 28, 2025
83f0a25
Update ToolbarItemsShouldBeVisible.png
Aug 3, 2025
8a4cb74
Update EditorFeatureTests.cs
Aug 3, 2025
7ff7ee5
Modified newly added feature matrix test classes
Sep 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/Controls/tests/TestCases.HostApp/CoreViews/CorePageView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,25 @@ public Task<bool> NavigateToGalleryPage(string pageTitle)
return Task.FromResult(false);
}

/// <summary>
/// Attempts to retrieve a gallery page by title.
/// </summary>
/// <param name="pageTitle">The title of the gallery page to find.</param>
/// <returns>The Page instance if found; otherwise, null.</returns>
/// <remarks>
/// This method searches for a matching gallery page by title (case-insensitive).
/// If a match is found, it invokes the associated Realize factory to create the page.
/// </remarks>
public Page TryToGetGalleryPage(string pageTitle)
{
if (_titleToPage.TryGetValue(pageTitle.ToLowerInvariant(), out GalleryPageFactory pageFactory))
{
return pageFactory.Realize();
}

return null;
}

public async Task<bool> NavigateToTest(string pageTitle)
{
var testCaseScreen = new TestCases.TestCaseScreen();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class TestPage : ContentPage

public TestPage(int index)
{
nextBtn = new Button { AutomationId = "Next Page", Text = "Next Page" };
nextBtn = new Button { AutomationId = $"Next Page {index}", Text = $"Next Page {index}" };
rmBtn = new Button { AutomationId = "Remove previous pages", Text = "Remove previous pages" };
popBtn = new Button { AutomationId = "Back", Text = "Back" };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ protected override void Init()
lstView = new ListView()
{
IsGroupingEnabled = true,
VerticalScrollBarVisibility = ScrollBarVisibility.Never,
HasUnevenRows = true,
ItemTemplate = new DataTemplate(typeof(MyViewCell)),
GroupHeaderTemplate = new DataTemplate(typeof(MyHeaderViewCell)),
Expand Down

This file was deleted.

25 changes: 25 additions & 0 deletions src/Controls/tests/TestCases.HostApp/MauiProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,31 @@ public static Page CreateDefaultMainPage()
{
Page mainPage = null;
OverrideMainPage(ref mainPage);
#if MACCATALYST
// Check for startup test argument from environment variables (passed by test runner)
var testName = System.Environment.GetEnvironmentVariable("test");

if (!string.IsNullOrEmpty(testName))
{
// Try to get the test page directly from issues/test cases
var testCaseScreen = new TestCases.TestCaseScreen();
var testPage = testCaseScreen.TryToGetTestPage(testName);
if (testPage is not null)
{
// Return the actual test page
return testPage;
}

// If not found in test cases, try to get gallery page
var corePageView = new CorePageView(null);
var galleryPage = corePageView.TryToGetGalleryPage(testName);
if (galleryPage is not null)
{
// Return the gallery page
return galleryPage;
}
}
#endif
return mainPage ?? new CoreNavigationPage();
}
}
Expand Down
23 changes: 22 additions & 1 deletion src/Controls/tests/TestCases.HostApp/TestCases.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Reflection;
using System.Linq;

namespace Maui.Controls.Sample
{
Expand Down Expand Up @@ -106,6 +107,7 @@ class IssueModel
public string Description { get; set; }
public bool IsInternetRequired { get; set; }
public Action Action { get; set; }
public Func<Page> PageFactory { get; set; }

public bool Matches(string filter)
{
Expand Down Expand Up @@ -175,7 +177,9 @@ public TestCaseScreen()
Name = attribute.DisplayName,
Description = attribute.Description,
IsInternetRequired = attribute.IsInternetRequired,
Action = ActivatePageAndNavigate(attribute, type)
Action = ActivatePageAndNavigate(attribute, type),
// PageFactory is used to retrieve the instance of the page.
PageFactory = () => ActivatePage(type)
}).ToList();
#endif

Expand Down Expand Up @@ -218,6 +222,23 @@ public bool TryToNavigateTo(string name)
return true;
}


/// <summary>
/// Attempts to retrieve a test page by name or description.
/// </summary>
/// <param name="name">The name or description of the test page to find.</param>
/// <returns>The Page instance if found; otherwise, null.</returns>
/// <remarks>
/// This method first searches for a matching issue by name (case-insensitive),
/// then by description if no match is found by name. If a match is found,
/// it invokes the associated PageFactory to create the page.
/// </remarks>
public Page TryToGetTestPage(string name)
{
var issue = _issues.SingleOrDefault(x => string.Equals(x.Description, name, StringComparison.OrdinalIgnoreCase));
Comment thread
This conversation was marked as resolved.
Resolved
return issue?.PageFactory?.Invoke();
}

public void FilterIssues(string filter = null)
{
filter = filter?.Trim();
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ public class BorderUITests : CoreGalleryBasePageTest
{
const string BorderGallery = "Border Gallery";

public override string GalleryPageName => BorderGallery;

public BorderUITests(TestDevice device)
: base(device)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ public class ButtonUITests : _ViewUITests
{
const string ButtonGallery = "Button Gallery";

public override string GalleryPageName => ButtonGallery;

public ButtonUITests(TestDevice device)
: base(device)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,18 @@

namespace Microsoft.Maui.TestCases.Tests
{
public class CarouselViewUITests : UITest
public class CarouselViewUITests : _GalleryUITest
{
const string CarouselViewGallery = "CarouselView Gallery";

public override string GalleryPageName => CarouselViewGallery;

public CarouselViewUITests(TestDevice device) : base(device)
{
}

protected override bool ResetAfterEachTest => true;

public override void TestSetup()
{
base.TestSetup();
App.NavigateToGallery(CarouselViewGallery);
}

[Test]
[Category(UITestCategories.CarouselView)]
public void CarouselViewSetPosition()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ public class CheckBoxUITests : _ViewUITests
{
const string CheckBoxGallery = "CheckBox Gallery";

public override string GalleryPageName => CheckBoxGallery;

public CheckBoxUITests(TestDevice device)
: base(device)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ public class CollectionViewEmptyViewTests : CollectionViewUITests
{
protected override bool ResetAfterEachTest => true;

public override string GalleryPageName => CollectionViewGallery;

public CollectionViewEmptyViewTests(TestDevice device)
: base(device)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ public class CollectionViewGroupingTests : CollectionViewUITests
{
protected override bool ResetAfterEachTest => true;

public override string GalleryPageName => CollectionViewGallery;

public CollectionViewGroupingTests(TestDevice device)
: base(device)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ namespace Microsoft.Maui.TestCases.Tests
{
public abstract class CollectionViewUITests : CoreGalleryBasePageTest
{
const string CollectionViewGallery = "CollectionView Gallery";
public const string CollectionViewGallery = "CollectionView Gallery";

public override string GalleryPageName => CollectionViewGallery;

public CollectionViewUITests(TestDevice device)
: base(device)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ namespace Microsoft.Maui.TestCases.Tests
{
public class AlertsGalleryTests : CoreGalleryBasePageTest
{
const string AlertsGallery = "Alerts Gallery";

public override string GalleryPageName => AlertsGallery;

public AlertsGalleryTests(TestDevice device)
: base(device)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ namespace Microsoft.Maui.TestCases.Tests
[Category(UITestCategories.Fonts)]
public class FontsGalleryTests : CoreGalleryBasePageTest
{
const string FontsGallery = "Fonts Gallery";

public override string GalleryPageName => FontsGallery;

public FontsGalleryTests(TestDevice device)
: base(device)
{
}

protected override void NavigateToGallery()
{
App.NavigateToGallery("Fonts Gallery");
App.NavigateToGallery(FontsGallery);
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ namespace Microsoft.Maui.TestCases.Tests
[Category(UITestCategories.Image)]
public class ImageLoadingGalleryTests : CoreGalleryBasePageTest
{

const string ImageLoadingGallery = "Image Loading Gallery";

public override string GalleryPageName => ImageLoadingGallery;
public ImageLoadingGalleryTests(TestDevice device)
: base(device)
{
}

protected override void NavigateToGallery()
{
App.NavigateToGallery("Image Loading Gallery");
App.NavigateToGallery(ImageLoadingGallery);
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ public class InputTransparencyGalleryTests : CoreGalleryBasePageTest
{
const string ButtonGallery = "Input Transparency Gallery";

public override string GalleryPageName => ButtonGallery;

public InputTransparencyGalleryTests(TestDevice device)
: base(device)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Microsoft.Maui.TestCases.Tests
{
public abstract class CoreGalleryBasePageTest : UITest
public abstract class CoreGalleryBasePageTest : _GalleryUITest
{
public CoreGalleryBasePageTest(TestDevice device) : base(device) { }

Expand All @@ -16,7 +16,9 @@ protected override void FixtureSetup()
try
{
base.FixtureSetup();
#if MACCATALYST
NavigateToGallery();
#endif
break;
}
catch (Exception e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Microsoft.Maui.TestCases.Tests
public class DragAndDropUITests : CoreGalleryBasePageTest
{
const string DragAndDropGallery = "Drag and Drop Gallery";
public override string GalleryPageName => DragAndDropGallery;
public DragAndDropUITests(TestDevice device)
: base(device)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ public class EditorUITests : _ViewUITests
{
public const string EditorGallery = "Editor Gallery";

public override string GalleryPageName => EditorGallery;

public EditorUITests(TestDevice device)
: base(device)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,17 @@

namespace Microsoft.Maui.TestCases.Tests
{
public class BoxViewFeatureTests : UITest
public class BoxViewFeatureTests : _GalleryUITest
{
public const string BoxViewFeatureMatrix = "BoxView Feature Matrix";

public override string GalleryPageName => BoxViewFeatureMatrix;

public BoxViewFeatureTests(TestDevice device)
: base(device)
{
}

protected override void FixtureSetup()
{
base.FixtureSetup();
App.NavigateToGallery(BoxViewFeatureMatrix);
}


[Test]
[Category(UITestCategories.BoxView)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,14 @@

namespace Microsoft.Maui.TestCases.Tests;

public class ButtonFeatureTests : UITest
public class ButtonFeatureTests : _GalleryUITest
{
public const string ButtonFeatureMatrix = "Button Feature Matrix";
public ButtonFeatureTests(TestDevice testDevice) : base(testDevice)
{
}

protected override void FixtureSetup()
public override string GalleryPageName => ButtonFeatureMatrix;

public ButtonFeatureTests(TestDevice testDevice) : base(testDevice)
{
base.FixtureSetup();
App.NavigateToGallery(ButtonFeatureMatrix);
}

[Test]
Expand Down
Loading