diff --git a/docs/explanation/features/tea-overview.md b/docs/explanation/features/tea-overview.md index 3f7fb762..704bfafd 100644 --- a/docs/explanation/features/tea-overview.md +++ b/docs/explanation/features/tea-overview.md @@ -199,7 +199,7 @@ Epic/Release Gate → TEA: *nfr-assess, *trace Phase 2 (release decision) TEA uniquely requires: -- **Extensive domain knowledge**: 32 fragments covering test patterns, CI/CD, fixtures, quality practices, and optional playwright-utils integration +- **Extensive domain knowledge**: 33 fragments covering test patterns, CI/CD, fixtures, quality practices, and optional playwright-utils integration - **Cross-cutting concerns**: Domain-specific testing patterns that apply across all BMad projects (vs project-specific artifacts like PRDs/stories) - **Optional integrations**: MCP capabilities (exploratory, verification) and playwright-utils support @@ -412,8 +412,8 @@ TEA optionally integrates with `@seontechnologies/playwright-utils`, an open-sou Benefit: Advanced patterns without boilerplate 3. `*test-review`: - - Default: Reviews against core knowledge base (21 fragments) - - **+ playwright-utils**: Reviews against expanded knowledge base (32 fragments: 21 core + 11 playwright-utils) + - Default: Reviews against core knowledge base (22 fragments) + - **+ playwright-utils**: Reviews against expanded knowledge base (33 fragments: 22 core + 11 playwright-utils) Benefit: Reviews include fixture composition, auth patterns, network recording best practices @@ -423,7 +423,7 @@ TEA optionally integrates with `@seontechnologies/playwright-utils`, an open-sou Benefit: Faster CI feedback, HTTP error detection -**Utilities available** (11 total): api-request, network-recorder, auth-session, intercept-network-call, recurse, log, file-utils, burn-in, network-error-monitor, fixtures-composition +**Utilities available** (10 total): api-request, network-recorder, auth-session, intercept-network-call, recurse, log, file-utils, burn-in, network-error-monitor, fixtures-composition diff --git a/src/modules/bmm/testarch/knowledge/log.md b/src/modules/bmm/testarch/knowledge/log.md index c2da6ae1..e53d0156 100644 --- a/src/modules/bmm/testarch/knowledge/log.md +++ b/src/modules/bmm/testarch/knowledge/log.md @@ -229,7 +229,8 @@ const checkNumberOfTodosInLocalStorage = functionTestStep( **Implementation**: ```typescript -// playwright/config/dev.config.ts +// playwright/support/fixtures.ts +import { test as base } from '@playwright/test'; import { log, captureTestContext } from '@seontechnologies/playwright-utils'; // Configure file logging globally @@ -241,9 +242,13 @@ log.configure({ }, }); -// In your fixtures -base.beforeEach(async ({}, testInfo) => { - captureTestContext(testInfo); // Required for file logging +// Extend base test with file logging context capture +export const test = base.extend({ + // Auto-capture test context for file logging + autoTestContext: [async ({}, use, testInfo) => { + captureTestContext(testInfo); + await use(undefined); + }, { auto: true }], }); ``` @@ -350,14 +355,14 @@ log.errorSync('Setup failed'); ## Log Levels Guide -| Level | When to Use | Shows in Report | Shows in Console | -| --------- | ----------------------------------- | -------------------- | ---------------- | -| `step` | Test organization, major actions | Collapsible steps | Yes | -| `info` | General information, state changes | Yes | Yes | -| `success` | Successful operations | Yes | Yes | -| `warning` | Non-critical issues, skipped checks | Yes | Yes | -| `error` | Failures, exceptions | Yes | Configurable | -| `debug` | Detailed data, objects | Yes (attached) | Configurable | +| Level | When to Use | Shows in Report | Shows in Console | +| --------- | ----------------------------------- | ----------------- | ---------------- | +| `step` | Test organization, major actions | Collapsible steps | Yes | +| `info` | General information, state changes | Yes | Yes | +| `success` | Successful operations | Yes | Yes | +| `warning` | Non-critical issues, skipped checks | Yes | Yes | +| `error` | Failures, exceptions | Yes | Configurable | +| `debug` | Detailed data, objects | Yes (attached) | Configurable | ## Comparison with console.log diff --git a/src/modules/bmm/testarch/knowledge/network-error-monitor.md b/src/modules/bmm/testarch/knowledge/network-error-monitor.md index 55257064..a5ee9069 100644 --- a/src/modules/bmm/testarch/knowledge/network-error-monitor.md +++ b/src/modules/bmm/testarch/knowledge/network-error-monitor.md @@ -155,7 +155,7 @@ export const test = base.extend( **For merged fixtures:** ```typescript -import { mergeTests } from '@playwright/test'; +import { test as base, mergeTests } from '@playwright/test'; import { createNetworkErrorMonitorFixture } from '@seontechnologies/playwright-utils/network-error-monitor/fixtures'; const networkErrorMonitor = base.extend( @@ -174,6 +174,7 @@ export const test = mergeTests(authFixture, networkErrorMonitor); **Implementation**: ```typescript +import { test as base } from '@playwright/test'; import { createNetworkErrorMonitorFixture } from '@seontechnologies/playwright-utils/network-error-monitor/fixtures'; const networkErrorMonitor = base.extend( @@ -320,14 +321,14 @@ The monitor has minimal performance impact: ## Comparison with Alternatives -| Approach | Network Error Monitor | Manual afterEach | -| --------------------------- | ----------------------- | ------------------------ | -| **Setup Required** | Zero (auto-enabled) | Every test file | -| **Catches Silent Failures** | Yes | Yes (if configured) | -| **Structured Artifacts** | JSON attached | Custom impl | -| **Test Failure Safety** | Try/finally | afterEach may not run | -| **Opt-Out Mechanism** | Annotation | Custom logic | -| **Status Aware** | Respects skip/failed | No | +| Approach | Network Error Monitor | Manual afterEach | +| --------------------------- | --------------------- | --------------------- | +| **Setup Required** | Zero (auto-enabled) | Every test file | +| **Catches Silent Failures** | Yes | Yes (if configured) | +| **Structured Artifacts** | JSON attached | Custom impl | +| **Test Failure Safety** | Try/finally | afterEach may not run | +| **Opt-Out Mechanism** | Annotation | Custom logic | +| **Status Aware** | Respects skip/failed | No | ## When to Use