Skip to content

Add comprehensive test coverage for Merchants Edit page#757

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

Add comprehensive test coverage for Merchants Edit page#757
StuartFerguson merged 3 commits intomainfrom
copilot/improve-code-coverage-merchants-edit

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 7, 2026

  • Understand the Estate Index Page tests as a reference
  • Create MerchantsEditPageTests.cs file with 27 comprehensive test cases
  • Add tests for button finding (tab navigation, Back to List, Add Operator, Add Contract, Add Device, etc.)
  • Add tests for verifying navigation (BackToList, error page navigation, etc.)
  • Add tests for tab switching functionality across 6 tabs
  • Add tests for operator management (add/remove with success/failure paths)
  • Add tests for contract management (assign/remove with success/failure paths)
  • Add tests for device management (add devices)
  • Add tests for success/error message handling
  • Add tests for displaying empty states
  • Fix critical field shadowing bug in Edit.razor.cs that prevented tab switching
  • All tests passing in CI ✅

Summary

Test Coverage Added (27 tests)

Created comprehensive test coverage following patterns from EstateIndexPageTests.cs:

  • Basic functionality: Rendering, page title, merchant display, navigation
  • Tab switching: 6 tabs (Details, Address, Contact, Operators, Contracts, Devices)
  • Empty states: No operators, no contracts, no devices
  • Form toggles: Add operator, assign contract, add device
  • Operator management: Add/remove with success and failure scenarios
  • Contract management: Assign/remove with success and failure scenarios

Bug Fix (Critical)

Fixed field shadowing bug where Edit.razor.cs declared private fields that shadowed the protected fields from CustomComponentBase:

  • Removed local declarations of activeTab, errorMessage, successMessage
  • Added OnInitializedAsync() to properly initialize activeTab
  • This fix enables all tab switching and message clearing functionality to work correctly
Original prompt

This section details on the original issue you should resolve

<issue_title>Improve Code Coverage on Merchants Edit 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.

Co-authored-by: StuartFerguson <16325469+StuartFerguson@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve code coverage on merchants edit page Add comprehensive test coverage for Merchants Edit page Feb 7, 2026
Copilot AI requested a review from StuartFerguson February 7, 2026 11:38
@StuartFerguson StuartFerguson marked this pull request as ready for review February 7, 2026 11:42
@StuartFerguson
Copy link
Copy Markdown
Member

@copilot something not right in the tests

The Edit component was declaring its own private fields for activeTab, errorMessage, and successMessage, which shadowed the protected fields from CustomComponentBase. This prevented SetActiveTab() from working correctly since it updated the base class field but the UI read from the local field.

Co-authored-by: StuartFerguson <16325469+StuartFerguson@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Feb 7, 2026

@copilot something not right in the tests

Fixed in commit 5d3ee68. The issue was that Edit.razor.cs declared its own private fields for activeTab, errorMessage, and successMessage, which shadowed the protected fields from CustomComponentBase. This meant when SetActiveTab() was called, it updated the base class's field, but the UI was reading from the local field that never changed. Removed the shadowing declarations and added proper initialization in OnInitializedAsync().

@StuartFerguson StuartFerguson merged commit 656bf57 into main Feb 7, 2026
10 checks passed
@github-actions github-actions Bot deleted the copilot/improve-code-coverage-merchants-edit branch April 9, 2026 01:03
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 Edit Page

2 participants