Skip to content

Add Contract Management integration tests with role-based access scenarios#590

Merged
StuartFerguson merged 4 commits intomainfrom
copilot/add-contract-management-tests
Jan 12, 2026
Merged

Add Contract Management integration tests with role-based access scenarios#590
StuartFerguson merged 4 commits intomainfrom
copilot/add-contract-management-tests

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 12, 2026

Implements integration test suite for Contract Management covering Admin, Estate, and Viewer roles with assertions against hardcoded test data.

Test Structure

  • ContractManagement.feature: 20 Reqnroll scenarios

    • Admin (2): Access denial verification
    • Estate (12): Full CRUD operations including product and transaction fee management
    • Viewer (6): Read-only access with permission boundary validation
  • ContractManagementPageHelper.cs: Playwright automation layer

    • Navigation, verification, and interaction methods
    • Shouldly assertions against stubbed data (Standard Transaction Contract, Safaricom operator, Mobile Topup products)
    • Proper wait mechanisms using WaitForLoadStateAsync() and element-specific waits
  • ContractManagementSteps.cs: Step definitions bridging feature file to page helper

Example Scenario

@ContractManagement @EstateRole
Scenario: Estate user can add a product to contract
    Given the user is authenticated as an "Estate" user
    When the user navigates to the Edit Contract page for the first contract
    And the user clicks on the "Add Product" button
    Then the Add Product modal is displayed
    When the user enters "New Product" in the product name field
    And the user enters "100" in the value field
    And the user clicks on the "Add Product" button in the modal
    Then the product is added successfully

Implementation Notes

  • Follows existing test patterns (Dashboard, EstateManagement, MerchantManagement)
  • Uses hardcoded test contract ID 44444444-4444-4444-4444-444444444444 from StubbedMediatorService
  • Application startup configuration required separately (not included per requirements)
Original prompt

This section details on the original issue you should resolve

<issue_title>Contract Management Integration Tests</issue_title>
<issue_description>I want a suite of integration tests built for the Blazor Server Application.

This set of tests will be for the Contract Management.

Can you build the tests based on the functionality available in terms of user roles (Admin/Estate/Viewer), I want these tests to have assertions based on the hard coded test data that's in the application (this can be swapped out at a later date)

I would like tests to cover all the functionality areas including any screens that add/edit/remove.

Any assertions will be done with the Shouldly framework.

I must stress that the only code I am expecting from this is:

A reqnroll feature file
A hooks file to allow control of the browser application (based on playwright)
A file with steps to control the browser application
A file that links the feature file to the application steps code

I will deal with how the application actually gets started up for the testing at a later point</issue_description>

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


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits January 12, 2026 12:57
Co-authored-by: StuartFerguson <16325469+StuartFerguson@users.noreply.github.com>
…dling

Co-authored-by: StuartFerguson <16325469+StuartFerguson@users.noreply.github.com>
Co-authored-by: StuartFerguson <16325469+StuartFerguson@users.noreply.github.com>
Copilot AI changed the title [WIP] Add integration tests for contract management functionality Add Contract Management integration tests with role-based access scenarios Jan 12, 2026
Copilot AI requested a review from StuartFerguson January 12, 2026 13:03
@StuartFerguson StuartFerguson marked this pull request as ready for review January 12, 2026 13:47
@StuartFerguson StuartFerguson merged commit 6ee129b into main Jan 12, 2026
10 checks passed
@github-actions github-actions Bot deleted the copilot/add-contract-management-tests branch March 14, 2026 01:00
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.

Contract Management Integration Tests

2 participants