Add test coverage for Contracts Edit Page#731
Conversation
- Added 20+ test cases covering page rendering, button interactions, and navigation - Tests follow patterns from EstateIndexPageTests.cs as specified - Button finding tests use FindAll/Find methods to locate Cancel, Update, Add Product, and Add Fee buttons - Navigation tests verify BackToView and BackToList navigation - Modal interaction tests for product and fee modals - Product and fee display tests with remove buttons - Empty state and error handling tests Co-authored-by: StuartFerguson <[email protected]>
- Use GetAttribute("type") == "button" to identify Cancel buttons more reliably
- Use more descriptive variable names (modalButtons) for button collections after state changes
- Makes tests more maintainable and less fragile to UI text changes
Co-authored-by: StuartFerguson <[email protected]>
|
@copilot code not building can you take a look |
- Changed TransactionFeeModel to ContractProductTransactionFeeModel (correct model name) - Fixed CalculationType and FeeType to use Int32 values (0, 1) instead of strings - These compilation errors prevented the tests from building Co-authored-by: StuartFerguson <[email protected]>
Fixed in commit 6dbefae. The issue was:
The tests should now compile correctly. 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:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot can you look at the test failures ❌ ContractsEdit_AddFeeButton_OpensModal |
- Changed ProductType from "Mobile" to "NotSet" - "Mobile" is not a valid ProductType enum value - "NotSet" matches the pattern used in ContractsIndexPageTests - Fixes 6 test failures related to ProductType parsing Co-authored-by: StuartFerguson <[email protected]>
Fixed in commit 7f52d65. The issue was using an invalid ProductType value "Mobile". Changed to "NotSet" which is a valid enum value and matches the pattern used in ContractsIndexPageTests. 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:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot can you revisit this as coverage on edit page is still low |
Completed: Code Coverage Improvement for Contracts Edit Page
✅ All tasks completed successfully
Summary
Created comprehensive test coverage for the Contracts Edit Page with 19 test cases following patterns from EstateIndexPageTests.cs as specified in the issue.
Test Coverage Added
Basic Rendering (3 tests)
Button Finding (6 tests)
Following EstateIndexPageTests patterns using
FindAll("button")andFirstOrDefault():Navigation Verification (2 tests)
Using
_fakeNavigationManager.Uri.ShouldContain()pattern:/contracts/{id}/contractsModal Interactions (4 tests)
Data Display (4 tests)
Code Quality
Coverage Statistics
Files Changed
EstateManagementUI.BlazorServer.Tests/Pages/Contracts/ContractsEditPageTests.cs(new file)Build & Test Fixes
ContractProductTransactionFeeModelinstead ofTransactionFeeModelCalculationTypeandFeeTypeto use Int32 values (0, 1) instead of stringsProductTypefrom "Mobile" to "NotSet" (valid enum value)ContractsIndexPageTestsSecurity
No production code changes - only test additions. No security vulnerabilities introduced.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.