Skip to content

Add button finding and navigation tests for Merchants Index page#753

Merged
StuartFerguson merged 2 commits intomainfrom
copilot/improve-code-coverage-merchants-index
Feb 7, 2026
Merged

Add button finding and navigation tests for Merchants Index page#753
StuartFerguson merged 2 commits intomainfrom
copilot/improve-code-coverage-merchants-index

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 6, 2026

Merchants Index page lacked test coverage for button interactions and navigation flows. Added 13 tests following patterns from Estate Index page tests.

Tests Added

  • Button navigation: Add Merchant, View, Edit, Make Deposit
  • Filter operations: Apply and Clear filters
  • Pagination: First, Previous, Next, Last page navigation
  • Error handling: Load failure navigation to error page
  • Row click navigation to merchant details

Example Pattern

[Fact]
public void MerchantsIndex_ViewButton_NavigatesToMerchantDetailsPage()
{
    // Arrange
    var merchantId = Guid.NewGuid();
    var merchants = new List<MerchantModels.MerchantListModel> { /* ... */ };
    this.MerchantUIService.Setup(m => m.GetMerchants(/*...*/)).ReturnsAsync(Result.Success(merchants));
    
    var cut = RenderComponent<MerchantsIndex>();
    cut.WaitForState(() => !cut.Markup.Contains("animate-spin"), TimeSpan.FromSeconds(5));
    
    // Act
    var viewButton = cut.Find("#viewMerchantLink");
    viewButton.Click();
    
    // Assert
    _fakeNavigationManager.Uri.ShouldContain($"/merchants/{merchantId}");
}

All tests use FindAll("button") for text-based button finding and Find("#id") for ID-based element location, with _fakeNavigationManager to verify navigation behavior.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • f.feedz.io
    • Triggering command: /usr/bin/dotnet dotnet test EstateManagementUI.BlazorServer.Tests/EstateManagementUI.BlazorServer.Tests.csproj --filter FullyQualifiedName~MerchantsIndexPageTests --logger console;verbosity=normal (dns block)
    • Triggering command: /opt/hostedtoolcache/CodeQL/2.24.0/x64/codeql/csharp/tools/linux64/Semmle.Autobuild.CSharp /opt/hostedtoolcache/CodeQL/2.24.0/x64/codeql/csharp/tools/linux64/Semmle.Autobuild.CSharp (dns block)
    • Triggering command: /usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/EstateManagementUI/EstateManagementUI/EstateManagementUI.sln --packages /home/REDACTED/work/EstateManagementUI/.codeql-scratch/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/home/REDACTED/work/EstateManagementUI/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/home/REDACTED/work/EstateManagementUI/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Improve Code Coverage on Merchants Index Page</issue_title>
<issue_description>Use the estate index page tests as a guide on how to find buttons and also verify navigation</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…finding and navigation verification

Co-authored-by: StuartFerguson <16325469+StuartFerguson@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve code coverage on merchants index page Add button finding and navigation tests for Merchants Index page Feb 6, 2026
Copilot AI requested a review from StuartFerguson February 6, 2026 22:07
@StuartFerguson StuartFerguson marked this pull request as ready for review February 6, 2026 22:18
@StuartFerguson StuartFerguson merged commit 7118c66 into main Feb 7, 2026
10 checks passed
@github-actions github-actions Bot deleted the copilot/improve-code-coverage-merchants-index branch April 8, 2026 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve Code Coverage on Merchants Index Page

2 participants