Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
5f8cf24
Replace moment with dayjs
johnsimons Nov 18, 2025
940a677
Initial checkin for the Platform Capabilities section on the dashboard
warwickschroeder Nov 20, 2025
e0dc389
Remove unused styles
warwickschroeder Nov 20, 2025
6b7143f
Change help URL
warwickschroeder Nov 20, 2025
00a8640
Add a banner to the All Messages view if no successful messages
warwickschroeder Nov 20, 2025
709dce0
Update naming for view data button
warwickschroeder Nov 20, 2025
0c5e265
Update icon on All Messages page
warwickschroeder Nov 20, 2025
d9cfba4
Remove concept of Partially Available
warwickschroeder Nov 20, 2025
01bd096
Update message constants
warwickschroeder Nov 20, 2025
7b237b5
Remove unused styles
warwickschroeder Nov 20, 2025
cf4628b
WIP
warwickschroeder Nov 21, 2025
539e8a7
WIP - Clean and change the way config is grabbed
warwickschroeder Nov 24, 2025
accae1f
Update capability cards WIP
warwickschroeder Nov 25, 2025
6a8e7c2
WIP - add promo modal pages
warwickschroeder Nov 25, 2025
fe89e60
WIP - audit wizard promo
warwickschroeder Nov 25, 2025
cdc84a6
Update auditing and monitoring promo pages
warwickschroeder Nov 26, 2025
9dfdf59
Finish initial audit and monitoring promo work
warwickschroeder Nov 26, 2025
27861f4
Add error instance capability
warwickschroeder Nov 26, 2025
9819eff
Clean styling
warwickschroeder Nov 26, 2025
c6b8cfe
Remove additional monitoring instance config
warwickschroeder Nov 26, 2025
b8da380
Add new mocked endpoints for new and updated stores
warwickschroeder Nov 26, 2025
70ccef7
Move styles into component files.
warwickschroeder Nov 28, 2025
742bdd5
Fix issues caused by master branch refactoring
warwickschroeder Dec 2, 2025
0c2a4a2
Revert to master for specific files
warwickschroeder Dec 2, 2025
080a6d8
Support remote servicecontrol instances. Now will cache remotes. Add …
warwickschroeder Dec 4, 2025
15e3f0b
Add tests for capability cards
warwickschroeder Dec 4, 2025
2faa08a
Update based off feedback
warwickschroeder Dec 18, 2025
4fc23a0
Update from feedback - only a single error instance
warwickschroeder Dec 18, 2025
b4ec813
Add tests for platform capability cards
warwickschroeder Dec 18, 2025
60733c8
Refactor, clean, consolidate
warwickschroeder Dec 19, 2025
f4280e9
Update small comment
warwickschroeder Jan 21, 2026
6b19dc9
Merge conflicts with auth PR
warwickschroeder Feb 6, 2026
5a345ed
Revert manual changes to gitignore
warwickschroeder Feb 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,4 @@ src/scaffolding.config
*.sln.iml

# Visual Studio Code
.vscode

# AI
.claude
CLAUDE.md

# local testing
.local
.vscode
195 changes: 195 additions & 0 deletions docs/frontend/audit-capability-card.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
# Audit Capability Card Testing Guide

This document describes the audit capability card component, its various states, and how to test them both manually and automatically.

## Overview

The Audit Capability Card displays on the ServicePulse dashboard and shows the status of the auditing feature. The card's status depends on:

1. Whether audit instances are configured
2. Whether audit instances are available (online)
3. Whether successful messages exist (endpoints configured for auditing)
4. Whether the ServiceControl version supports the "All Messages" feature (>= 6.6.0)

## Card States

| Status | Condition | Badge | Action Button |
|--------------------------|--------------------------------------------------|-------------|---------------|
| Instance Not Configured | No audit instances configured | - | Get Started |
| Unavailable | All audit instances offline | Unavailable | Learn More |
| Degraded | Some audit instances offline | Degraded | - |
| Endpoints Not Configured | Instance available but no messages OR SC < 6.6.0 | - | Learn More |
| Available | Instance available with messages AND SC >= 6.6.0 | Available | View Messages |

## Manual Testing with Mock Scenarios

### Prerequisites

```bash
cd src/Frontend
npm install
```

### Running the Dev Server with Mocks

```bash
npm run dev:mocks
```

This starts the dev server at `http://localhost:5173` with MSW (Mock Service Worker) intercepting API calls.

### Switching Between Scenarios

Set the `VITE_MOCK_SCENARIO` environment variable before running the dev server:

```bash
# Linux/macOS
VITE_MOCK_SCENARIO=audit-available npm run dev:mocks

# Windows CMD
set VITE_MOCK_SCENARIO=audit-available && npm run dev:mocks

# Windows PowerShell
$env:VITE_MOCK_SCENARIO="audit-available"; npm run dev:mocks
```

Open the browser console to see available scenarios.

#### Available Audit Scenarios

| Scenario | Status | Badge | Button | Description | Indicators |
|----------------------------|--------------------------|-------------|---------------|------------------------------------------------------------------------------------------------------|-------------------------------------------|
| `audit-no-instance` | Instance Not Configured | - | Get Started | "A ServiceControl Audit instance has not been configured..." | None |
| `audit-unavailable` | Unavailable | Unavailable | Learn More | "All ServiceControl Audit instances are configured but not responding..." | Instance: ❌ |
| `audit-degraded` | Partially Unavailable | Degraded | - | "Some ServiceControl Audit instances are not responding." | Instance 1: ✅, Instance 2: ❌, Messages: ✅ |
| `audit-available` | Available | Available | View Messages | "All ServiceControl Audit instances are available and endpoints have been configured..." | Instance: ✅, Messages: ✅ |
| `audit-old-sc-version` | Endpoints Not Configured | - | Learn More | "A ServiceControl Audit instance is connected but no successful messages..." | Instance: ✅, Messages: ⚠️ (SC < 6.6.0) |
| `audit-no-messages` | Endpoints Not Configured | - | Learn More | "A ServiceControl Audit instance is connected but no successful messages have been processed yet..." | Instance: ✅, Messages: ⚠️ |
| `audit-multiple-instances` | Available | Available | View Messages | "All ServiceControl Audit instances are available..." | Instance 1: ✅, Instance 2: ✅, Messages: ✅ |

**Indicator Legend:** ✅ = Available/Success, ❌ = Unavailable/Error, ⚠️ = Warning/Not Configured

### Adding New Scenarios

1. Add a scenario precondition to `src/Frontend/test/preconditions/platformCapabilities.ts`:

```typescript
export const scenarioMyScenario = async ({ driver }: SetupFactoryOptions) => {
await driver.setUp(precondition.serviceControlWithMonitoring);
// Add scenario-specific preconditions here
};
```

2. Create a new file in `src/Frontend/test/mocks/scenarios/` (e.g., `my-scenario.ts`):

```typescript
import { setupWorker } from "msw/browser";
import { Driver } from "../../driver";
import { makeMockEndpoint, makeMockEndpointDynamic } from "../../mock-endpoint";
import * as precondition from "../../preconditions";

export const worker = setupWorker();
const mockEndpoint = makeMockEndpoint({ mockServer: worker });
const mockEndpointDynamic = makeMockEndpointDynamic({ mockServer: worker });

const makeDriver = (): Driver => ({
goTo() { throw new Error("Not implemented"); },
mockEndpoint,
mockEndpointDynamic,
setUp(factory) { return factory({ driver: this }); },
disposeApp() { throw new Error("Not implemented"); },
});

const driver = makeDriver();

export const setupComplete = (async () => {
await driver.setUp(precondition.scenarioMyScenario);
})();
```

1. Register it in `src/Frontend/test/mocks/scenarios/index.ts`:

```typescript
const scenarios: Record<string, () => Promise<ScenarioModule>> = {
// ... existing scenarios
"my-scenario": () => import("./my-scenario"),
};
```

## Automated Tests

### Test Files

| File | Type | Description |
|------------------------------------------------------------------------------------|-------------|-----------------------------------------|
| `src/Frontend/test/specs/platformcapabilities/audit-capability-card.spec.ts` | Application | End-to-end tests for the card component |
| `src/Frontend/test/specs/platformcapabilities/auditing-capability-helpers.spec.ts` | Unit | Tests for helper functions |

### Running Automated Tests

From the `src/Frontend` directory:

```bash
# Run all audit capability tests
npx vitest run test/specs/platformcapabilities/audit-capability-card.spec.ts

# Run helper function unit tests
npx vitest run test/specs/platformcapabilities/auditing-capability-helpers.spec.ts

# Run all platform capability tests
npx vitest run test/specs/platformcapabilities/
```

### Test Coverage

#### Application Tests (`audit-capability-card.spec.ts`)

| Rule | Test Case |
|---------------------------------|---------------------------------------------------------------|
| No audit instance configured | Shows "Get Started" button |
| Audit instance unavailable | Shows "Unavailable" status |
| Partially unavailable instances | Shows "Degraded" status |
| Available but no messages | Shows "Endpoints Not Configured" status |
| Available with messages | Shows "Available" status + "View Messages" button |
| ServiceControl < 6.6.0 | Shows "Endpoints Not Configured" (All Messages not supported) |
| Single instance indicator | Shows "Instance" label |
| Messages indicator | Shows "Messages" label when messages exist |
| Multiple instances | Shows numbered "Instance 1", "Instance 2" labels |

#### Unit Tests (`auditing-capability-helpers.spec.ts`)

| Function | Test Cases |
|-----------------------------------------|--------------------------------------------------------------------|
| `isAuditInstance` | Audit type, error type, unknown type, undefined type |
| `filterAuditInstances` | null, undefined, empty, mixed, no audit, all audit |
| `allAuditInstancesUnavailable` | null, undefined, empty, all unavailable, all online, mixed, single |
| `hasUnavailableAuditInstances` | null, undefined, empty, at least one, all, none |
| `hasAvailableAuditInstances` | null, undefined, empty, at least one, all, none |
| `hasPartiallyUnavailableAuditInstances` | null, undefined, empty, mixed, all online, all unavailable, single |

## Key Source Files

| File | Purpose |
|---------------------------------------------------------------------------------------|----------------------------------------|
| `src/Frontend/src/components/platformcapabilities/capabilities/AuditingCapability.ts` | Main composable and helper functions |
| `src/Frontend/src/components/audit/isAllMessagesSupported.ts` | Version check for All Messages feature |
| `src/Frontend/test/preconditions/platformCapabilities.ts` | Test preconditions and fixtures |
| `src/Frontend/test/mocks/scenarios/` | Manual testing scenarios |

## Troubleshooting

### Scenario not loading

1. Check the browser console for errors
2. Verify the scenario name matches exactly (case-sensitive)
3. Ensure MSW is enabled (look for "[MSW] Mocking enabled" in console)

### Tests failing

1. Run `npm run type-check` to verify TypeScript compilation
2. Check if preconditions are properly set up
3. Use `--reporter=verbose` for detailed test output:

```bash
npx vitest run test/specs/platformcapabilities/ --reporter=verbose
```
Loading