name: 'step-03a-subprocess-api' description: 'Subprocess: Generate API tests only' subprocess: true
This is an isolated subprocess running in parallel with E2E test generation.
What you have from parent workflow:
Your task: Generate API tests ONLY (not E2E, not fixtures, not other test types).
From the coverage plan (Step 2 output), identify:
For each API endpoint, create test file in tests/api/[feature].spec.ts:
Test Structure:
import { test, expect } from '@playwright/test';
// If Playwright Utils enabled:
// import { apiRequest } from '@playwright-utils/api';
test.describe('[Feature] API Tests', () => {
test('[P0] should handle successful [operation]', async ({ request }) => {
// Use apiRequest helper if Playwright Utils enabled
// Otherwise use standard request fixture
const response = await request.post('/api/endpoint', {
data: {
/* test data */
},
});
expect(response.status()).toBe(200);
expect(await response.json()).toMatchObject({
/* expected */
});
});
test('[P1] should handle [error scenario]', async ({ request }) => {
// Test error handling
});
});
Requirements:
apiRequest() helper if Playwright Utils enabled (from api-request fragment)Identify fixtures needed for API tests:
Do NOT create fixtures yet - just track what's needed for aggregation step.
Write JSON to temp file: /tmp/tea-automate-api-tests-{{timestamp}}.json
{
"success": true,
"subprocess": "api-tests",
"tests": [
{
"file": "tests/api/auth.spec.ts",
"content": "[full TypeScript test file content]",
"description": "API tests for authentication endpoints",
"priority_coverage": {
"P0": 3,
"P1": 2,
"P2": 1,
"P3": 0
}
},
{
"file": "tests/api/checkout.spec.ts",
"content": "[full TypeScript test file content]",
"description": "API tests for checkout endpoints",
"priority_coverage": {
"P0": 2,
"P1": 3,
"P2": 1,
"P3": 0
}
}
],
"fixture_needs": ["authToken", "userDataFactory", "productDataFactory"],
"knowledge_fragments_used": ["api-request", "data-factories", "api-testing-patterns"],
"test_count": 12,
"summary": "Generated 12 API test cases covering 3 features"
}
On Error:
{
"success": false,
"subprocess": "api-tests",
"error": "Error message describing what went wrong",
"partial_output": {
/* any tests generated before error */
}
}
Subprocess completes when:
Subprocess terminates here. Parent workflow will read output and proceed to aggregation.