Skip to content

Add Merchant Management integration tests for role-based CRUD operations including actual editing functions#589

Merged
StuartFerguson merged 6 commits intomainfrom
copilot/add-merchants-management-tests
Jan 12, 2026
Merged

Add Merchant Management integration tests for role-based CRUD operations including actual editing functions#589
StuartFerguson merged 6 commits intomainfrom
copilot/add-merchants-management-tests

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 12, 2026

Implements a comprehensive integration test suite for Merchant Management functionality covering Admin, Estate, and Viewer role permissions using Reqnroll, Playwright, and Shouldly.

Files Added

  • MerchantManagement.feature - 36 Gherkin scenarios across 3 user roles

    • 1 Admin scenario: access denial verification
    • 26 Estate scenarios: full CRUD operations including actual editing operations
    • 9 Viewer scenarios: read-only access validation
  • MerchantManagementPageHelper.cs - Playwright page object with methods for:

    • Navigation and page verification
    • Merchant list and detail viewing across all tabs (details, address, contact, operators, contracts, devices)
    • Form field validation and updates for create/edit/deposit flows
    • Actual editing operations (update details, address, contact)
    • Operator management (add/remove operators with merchant number handling)
    • Contract management (assign/remove contracts)
    • Device management (add/remove devices)
    • Deposit operations (amount, date, reference submission)
    • Role-based button visibility checks
    • Success message verification
  • MerchantManagementSteps.cs - Step definitions linking Gherkin to helper methods

Test Coverage

Viewing Operations

  • View merchant list with data validation
  • View merchant details across all tabs
  • Navigate to create/edit/deposit pages

Actual Editing Operations (NEW)

  • Update merchant details: Changes merchant name and settlement schedule, verifies success message
  • Update address: Changes address line 1, town, and region, verifies success message
  • Update contact details: Changes contact name, email, and phone, verifies success message
  • Add operator: Adds operator to merchant with merchant number (for Safaricom), verifies it's listed
  • Remove operator: Adds then removes operator, verifies successful removal
  • Assign contract: Assigns contract to merchant, verifies it's listed in assigned contracts
  • Remove contract: Assigns then removes contract, verifies successful removal
  • Add device: Adds device with identifier, verifies it's listed in assigned devices
  • Remove device: Adds then removes device, verifies successful removal
  • Make deposit: Enters deposit amount, date, and reference, submits deposit, verifies success

All editing operations include success message verification and list verification for add/remove operations.

Test Data

All assertions reference hardcoded values from StubbedMediatorService.cs:

// Test Merchant 1 (MERCH001)
Balance: £10,000.00
Available Balance: £8,500.00
Settlement Schedule: Immediate
Address: 123 Main Street, Test Town, Test Region, 12345, Test Country
Contact: John Smith, john@testmerchant.com, 555-1234

// Operators
Safaricom (requires custom merchant number)
Voucher

// Contracts
Standard Transaction Contract
Voucher Sales Contract

Documentation

Updated README.md with merchant test data reference and execution filters:

# Run merchant tests only
dotnet test --filter "Category=MerchantManagementTests"

# Run by role
dotnet test --filter "Category=EstateRole"

# Run edit operation tests
dotnet test --filter "Category=EditOperations"

Notes

Application startup logic for test execution to be implemented separately per issue requirements.

Original prompt

This section details on the original issue you should resolve

<issue_title>Merchant 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 Merchant 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.

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)


💡 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.

Copilot AI and others added 3 commits January 12, 2026 11:40
Co-authored-by: StuartFerguson <16325469+StuartFerguson@users.noreply.github.com>
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 Merchant Management functionality Add Merchant Management integration tests for role-based CRUD operations Jan 12, 2026
Copilot AI requested a review from StuartFerguson January 12, 2026 11:48
@StuartFerguson
Copy link
Copy Markdown
Member

@copilot do the tests actually carry out the merchant editing functions like updating details, add/remove contracts and operators and making deposits

if not could tests be added for these functions

…ails, add/remove operators/contracts/devices, make deposits)

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

Copilot AI commented Jan 12, 2026

@copilot do the tests actually carry out the merchant editing functions like updating details, add/remove contracts and operators and making deposits

if not could tests be added for these function...

The initial tests only verified page navigation and visibility. I've now added 11 new test scenarios that actually perform the merchant editing operations:

Edit Operations:

  • Update merchant details (name, settlement schedule)
  • Update address information
  • Update contact details

Operator Management:

  • Add operator to merchant (with merchant number for Safaricom)
  • Remove operator from merchant

Contract Management:

  • Assign contract to merchant
  • Remove contract from merchant

Device Management:

  • Add device to merchant
  • Remove device from merchant

Deposit:

  • Make deposit with amount, date, and reference

All scenarios include success message verification and check that the operations complete correctly. Committed in 0fa3cfa.

…w feedback

Co-authored-by: StuartFerguson <16325469+StuartFerguson@users.noreply.github.com>
Copilot AI changed the title Add Merchant Management integration tests for role-based CRUD operations Add Merchant Management integration tests for role-based CRUD operations including actual editing functions Jan 12, 2026
@StuartFerguson StuartFerguson marked this pull request as ready for review January 12, 2026 12:37
@StuartFerguson StuartFerguson merged commit 8defcd0 into main Jan 12, 2026
10 checks passed
@github-actions github-actions Bot deleted the copilot/add-merchants-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.

Merchant Management Integration Tests

2 participants