Skip to content

notque/vexjoy-agent / skills/process/testing

testing

Verified

Testing: TDD, E2E, test automation strategy (Vitest, coverage, CI), preferred patterns, test-value audits, verification, agent testing.

references/e2e-financial-flows.md

View on GitHub
# Financial Flow Patterns

Production skip guards and async confirmation wait patterns for financial E2E tests.

---

## Production Skip Guards

Always guard destructive financial tests with environment checks:

```typescript
// At describe level — skips entire suite
test.describe('Payment Processing', () => {
  test.skip(
    process.env.NODE_ENV === 'production',
    'Payment tests must not run in production'
  );

  test.skip(
    !['localhost', 'e2e.', 'test.'].some(h =>
      process.env.BASE_URL?.includes(h)
    ),
    'Payment tests only run on local, e2e, or test environments'
  );

  // ... tests
});
```

```typescript
// At individual test level
test('refund processes correctly', async ({ page }) => {
  test.skip(
    process.env.PAYMENT_PROVIDER !== 'sandbox',
    'Refund test requires sandbox payment provider'
  );
  // ...
});
```

---

## Polling for Async Confirmation

Financial operations often involve async backend confirmation. Use `toPass` to poll:

```typescript
import { expect } from '@playwright/test';

async function waitForPaymentConfirmed(page: Page, orderId: string) {
  await expect(async () => {
    const statusEl = page.getByTestId(`order-status-${orderId}`);
    await expect(statusEl).toHaveText('Payment confirmed');
  }).toPass({
    timeout: 30_000,
    intervals: [1000, 2000, 5000, 10000],
  });
}
```

---

## Stripe Test Cards

Use Stripe test card numbers in sandbox environments:

| Scenario | Card Number |
|----------|-------------|
| Success | 4242 4242 4242 4242 |
| Insufficient funds | 4000 0000 0000 9995 |
| 3D Secure required | 4000 0025 0000 3155 |
| Generic decline | 4000 0000 0000 0002 |

Always use expiry `12/34`, CVC `123`, ZIP `00000` for test cards.
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall