Skip to content

URS-004 · Admin approve or reject a sales representative

Title: Admin approve or reject a sales representative Date: 2026-04-23T03:33:42.637Z Duration: 57.6s Overall Status: ✅ PASS

The system shall allow ZuriMED admins to approve or reject a sales representative

Source: User_Requirement_Specifications_ZuriMED_DeviceFlow.xlsx — the run below proves the system meets this requirement.

Status: ✅ PASS

Each step below corresponds to one Playwright test that ran sequentially. Screenshots and video recordings provide visual evidence of the UI behaviour.

1. Step 1: Admin navigates to rep management — ✅ PASS

Section titled “1. Step 1: Admin navigates to rep management — ✅ PASS”

What this step proves:

Proves that a ZuriMED admin (Alex) can authenticate and reach the Sales Reps management page. Both StellarTech reps — Bob (pending approval) and Ryan (active) — appear in the roster, establishing admin context for the approve/reject actions that follow.

Audit events generated by this step:

(Evidence matched by declared name — step timing not available or no events fell in window)

TimeTypeActionUserOrgPerformed
2026-04-23 03:33:45Zuser_loguser:loginalex.admin@zurimed.comZuriMED
2026-04-23 03:33:52Zuser_loguser:loginalex.admin@zurimed.comZuriMED
2026-04-23 03:34:01Zuser_loguser:loginbob.kauffman@stellartech.comStellarTech Medical Solutions
2026-04-23 03:34:11Zuser_loguser:loginryan.delauintana@stellartech.comStellarTech Medical Solutions
2026-04-23 03:34:18Zuser_loguser:loginalex.admin@zurimed.comZuriMED
2026-04-23 03:34:25Zuser_loguser:loginbob.kauffman@stellartech.comStellarTech Medical Solutions

Screenshots:

step 01 admin logged in

step 01 rep list

Video recording:


What this step proves:

Alex opens Bob’s detail page, clicks Reject Representative, supplies a rejection reason, and confirms. Proves that an admin has an in-app control to deny a rep onboarding. The relationship row moves to status=‘rejected’, active=false, and a rep_creation_request_rejected notification is dispatched to the distributor.

Audit events generated by this step:

(Evidence scoped to step execution window: 2026-04-23T03:33:56.235Z → 2026-04-23T03:34:00.824Z)

TimeTypeActionUserOrgPerformed
2026-04-23 03:34:00Zuser_logrep_onboarding_request_rejectedalex.admin@zurimed.comZuriMED
2026-04-23 03:34:00Ztransactional_emailrep_creation_request_rejectedStellarTech Medical Solutions

Emails triggered by this step:

(Evidence matched by declared name — step timing not available or no events fell in window)

Email 1: Representative Request Rejected - ZuriMED

Template: Representative_Request_Rejected_-_ZuriMED

Representative Request Rejected - ZuriMED

Screenshots:

step 02 bob detail pending

step 02 reject dialog

step 02 bob detail rejected

Video recording:


3. Step 3: Bob blocked from creating orders — ✅ PASS

Section titled “3. Step 3: Bob blocked from creating orders — ✅ PASS”

What this step proves:

Bob logs in after being rejected and opens the order creation page. ZuriMED is filtered out of the manufacturer dropdown because getAvailableFulfillingOrganizations requires an active representation relationship. Proves the admin action is a hard restriction on downstream order creation — not just a cosmetic UI change.

Audit events generated by this step:

(Evidence matched by declared name — step timing not available or no events fell in window)

TimeTypeActionUserOrgPerformed
2026-04-23 03:33:45Zuser_loguser:loginalex.admin@zurimed.comZuriMED
2026-04-23 03:33:52Zuser_loguser:loginalex.admin@zurimed.comZuriMED
2026-04-23 03:34:01Zuser_loguser:loginbob.kauffman@stellartech.comStellarTech Medical Solutions
2026-04-23 03:34:11Zuser_loguser:loginryan.delauintana@stellartech.comStellarTech Medical Solutions
2026-04-23 03:34:18Zuser_loguser:loginalex.admin@zurimed.comZuriMED
2026-04-23 03:34:25Zuser_loguser:loginbob.kauffman@stellartech.comStellarTech Medical Solutions

Screenshots:

step 03 bob no zurimed

Video recording:


4. Step 4: Ryan (control) can still create orders — ✅ PASS

Section titled “4. Step 4: Ryan (control) can still create orders — ✅ PASS”

What this step proves:

Ryan, an unrelated StellarTech rep, is unaffected by the action taken on Bob. He reaches Step 2 of the order form as normal, proving that admin decisions are scoped to the rep under review and do not inadvertently strip privileges from other reps.

Audit events generated by this step:

(Evidence matched by declared name — step timing not available or no events fell in window)

TimeTypeActionUserOrgPerformed
2026-04-23 03:33:45Zuser_loguser:loginalex.admin@zurimed.comZuriMED
2026-04-23 03:33:52Zuser_loguser:loginalex.admin@zurimed.comZuriMED
2026-04-23 03:34:01Zuser_loguser:loginbob.kauffman@stellartech.comStellarTech Medical Solutions
2026-04-23 03:34:11Zuser_loguser:loginryan.delauintana@stellartech.comStellarTech Medical Solutions
2026-04-23 03:34:18Zuser_loguser:loginalex.admin@zurimed.comZuriMED
2026-04-23 03:34:25Zuser_loguser:loginbob.kauffman@stellartech.comStellarTech Medical Solutions

Screenshots:

step 04 ryan order form

Video recording:


5. Step 5: Admin approves Bob — ✅ PASS

Section titled “5. Step 5: Admin approves Bob — ✅ PASS”

What this step proves:

After the test harness returns Bob’s status to ‘proposed’, Alex approves him through the UI’s Approve Representative flow. The relationship row becomes status=‘active’, active=true; a rep_created notification is dispatched to StellarTech announcing the approval.

Audit events generated by this step:

(Evidence scoped to step execution window: 2026-04-23T03:34:22.095Z → 2026-04-23T03:34:24.010Z)

TimeTypeActionUserOrgPerformed
2026-04-23 03:34:23Zuser_logrep_onboarding_request_approvedalex.admin@zurimed.comZuriMED
2026-04-23 03:34:23Ztransactional_emailrep_createdStellarTech Medical Solutions

Emails triggered by this step:

(Evidence matched by declared name — step timing not available or no events fell in window)

Email 1: Representative Account Approved - ZuriMED

Template: Representative_Account_Approved_-_ZuriMED

Representative Account Approved - ZuriMED

Screenshots:

step 05 bob detail pending again

step 05 approve dialog

step 05 bob detail approved

Video recording:


6. Step 6: Bob submits an order after approval — ✅ PASS

Section titled “6. Step 6: Bob submits an order after approval — ✅ PASS”

What this step proves:

Now-approved Bob logs back in, reaches the order form, picks a delivery location, adds a product, and submits. Proves the restriction lifts immediately on approval — the admin’s status change takes effect without any further action. The order request persists in the database for the DB-validation phase to confirm.

Audit events generated by this step:

(Evidence scoped to step execution window: 2026-04-23T03:34:30.841Z → 2026-04-23T03:34:35.360Z)

TimeTypeActionUserOrgPerformed
2026-04-23 03:34:35Zdecisionorder_request_createdbob.kauffman@stellartech.comZuriMEDyes

Screenshots:

step 06 order step2

step 06 order review

step 06 order submitted

Video recording:


The following SQL queries ran against the application database after the Playwright scenarios completed. Each query asserts a specific condition that proves the feature under test persisted its data correctly.

Bob’s relationship ended the run as active — ✅ PASS

Section titled “Bob’s relationship ended the run as active — ✅ PASS”

Assertion: After the approve flow Bob’s relationship should be status=‘active’, active=true.

SELECT id, status, active, rejection_reason
FROM organization_representation_relationships
WHERE id = $1
idstatusactiverejection_reason
84c5d6e7-f8a9-0123-8901-234567890123activetrueNULL

Rejection status transition recorded — ✅ PASS

Section titled “Rejection status transition recorded — ✅ PASS”

Assertion: A proposed→rejected transition should have been recorded during the test run.

SELECT from_status, to_status, reason, created_at
FROM organization_representation_request_status_changes
WHERE relationship_id = $1
AND to_status = 'rejected'
AND created_at > NOW() - INTERVAL '30 minutes'
ORDER BY created_at DESC
from_statusto_statusreasoncreated_at
proposedrejectedURS-004 validation test: admin rejecting rep to verify order-creation is blocked.2026-04-23T03:34:00.290Z

Approval status transition recorded — ✅ PASS

Section titled “Approval status transition recorded — ✅ PASS”

Assertion: A proposed→active transition should have been recorded during the test run.

SELECT from_status, to_status, created_at
FROM organization_representation_request_status_changes
WHERE relationship_id = $1
AND to_status = 'active'
AND created_at > NOW() - INTERVAL '30 minutes'
ORDER BY created_at DESC
from_statusto_statuscreated_at
proposedactive2026-04-23T03:34:23.488Z

Approved rep successfully submitted an order — ✅ PASS

Section titled “Approved rep successfully submitted an order — ✅ PASS”

Assertion: At least one order_requests row should exist, tagged with the URS-004 marker.

SELECT id, request_number, status, order_type, created_at
FROM order_requests
WHERE requested_by_user_id = $1
AND notes LIKE $2
ORDER BY created_at DESC
idrequest_numberstatusorder_typecreated_at
019db867-5e07-71fe-8abf-bdbe67b1d2e9OR-1submittedconsignment2026-04-23T03:34:35.256Z

Audit events logged for approve and reject — ✅ PASS

Section titled “Audit events logged for approve and reject — ✅ PASS”

Assertion: audit_events should include both rep_onboarding_request_approved and rep_onboarding_request_rejected actions from this run.

SELECT event_type, action, created_at
FROM audit_events
WHERE event_type = 'user_log'
AND action IN ('rep_onboarding_request_approved', 'rep_onboarding_request_rejected')
AND created_at > NOW() - INTERVAL '30 minutes'
ORDER BY created_at DESC
event_typeactioncreated_at
user_logrep_onboarding_request_approved2026-04-23T03:34:23.499Z
user_logrep_onboarding_request_rejected2026-04-23T03:34:00.342Z

Per-declaration outcome of every expectedAuditActions and expectedEmailTemplates entry written into the orchestrator. Missing evidence here is a real test failure, not a soft warning.

Each row asserts that a declared expectedAuditActions entry produced a matching row in audit_events. A ❌ flips overall status to FAIL — the declaration is real proof, not just an annotation.

StepExpected Audit ActionFound
Step 1: Admin navigates to rep managementuser_log:user:login
Step 2: Admin rejects Bobuser_log:rep_onboarding_request_rejected
Step 3: Bob blocked from creating ordersuser_log:user:login
Step 4: Ryan (control) can still create ordersuser_log:user:login
Step 5: Admin approves Bobuser_log:rep_onboarding_request_approved
Step 6: Bob submits an order after approvaluser_log:user:login
Step 6: Bob submits an order after approvaldecision:order_request_created

Each row asserts that a declared expectedEmailTemplates entry was matched (case-insensitive substring) by a captured email subject or template. A ❌ flips overall status to FAIL.

StepExpected TemplateFound
Step 2: Admin rejects BobRepresentative Request Rejected
Step 5: Admin approves BobRepresentative Account Approved

Every row written to audit_events while this test was running (scoped to the demo organizations). Provides compliance evidence that user actions are traced end-to-end (URS-003).

Capture window start: 2026-04-23T03:33:40.719Z

SELECT
ae.created_at,
ae.event_type,
ae.action,
ae.user_id,
u.email AS user_email,
ae.organization_id,
o.name AS organization_name,
ae.object_id,
ae.secondary_object_id,
ae.payload,
ae.route,
ae.trace_id
FROM audit_events ae
LEFT JOIN users u ON u.id = ae.user_id
LEFT JOIN organizations o ON o.id = ae.organization_id
WHERE ae.created_at >= $1
AND ae.organization_id = ANY($2::uuid[])
ORDER BY ae.created_at ASC

11 event(s) captured:

TimeTypeActionUserOrgObject IDPerformedReason
2026-04-23 03:33:45Zuser_loguser:loginalex.admin@zurimed.comZuriMED
2026-04-23 03:33:52Zuser_loguser:loginalex.admin@zurimed.comZuriMED
2026-04-23 03:34:00Zuser_logrep_onboarding_request_rejectedalex.admin@zurimed.comZuriMED84c5d6e7-f8a9-0123-8901-234567890123
2026-04-23 03:34:00Ztransactional_emailrep_creation_request_rejectedStellarTech Medical Solutions
2026-04-23 03:34:01Zuser_loguser:loginbob.kauffman@stellartech.comStellarTech Medical Solutions
2026-04-23 03:34:11Zuser_loguser:loginryan.delauintana@stellartech.comStellarTech Medical Solutions
2026-04-23 03:34:18Zuser_loguser:loginalex.admin@zurimed.comZuriMED
2026-04-23 03:34:23Zuser_logrep_onboarding_request_approvedalex.admin@zurimed.comZuriMED84c5d6e7-f8a9-0123-8901-234567890123
2026-04-23 03:34:23Ztransactional_emailrep_createdStellarTech Medical Solutions
2026-04-23 03:34:25Zuser_loguser:loginbob.kauffman@stellartech.comStellarTech Medical Solutions
2026-04-23 03:34:35Zdecisionorder_request_createdbob.kauffman@stellartech.comZuriMED019db867-5e07-71fe-8abf-bdbe67b1d2e9yesOrder request OR-1 created (importSource=manual)

2 notification email(s) were captured during this test run. Each email is rendered as a screenshot for compliance review.

1. Representative Request Rejected - ZuriMED

Section titled “1. Representative Request Rejected - ZuriMED”

Template: Representative_Request_Rejected_-_ZuriMED

Representative Request Rejected - ZuriMED

2. Representative Account Approved - ZuriMED

Section titled “2. Representative Account Approved - ZuriMED”

Template: Representative_Account_Approved_-_ZuriMED

Representative Account Approved - ZuriMED