Seamless Playwright integration with HAVEN test case management
npm install haven-playwright-integrationSeamless Playwright integration with HAVEN test case management. Advanced test execution with real-time monitoring and flexible configuration options.
@TC-AUTO-XXXX and custom tags via --grep and --grep-invert@smoke, @regression, @p1, etc.E2E_COMMAND environment variableartifacts/{PRODUCT}/{PLAN_ID}/automation/{RUN_ID}package.json)bash
npm install haven-playwright-integration @playwright/test
`Usage
$3
#### Thin Image (Default)
Lightweight image that clones your code at runtime from Azure DevOps. Best for CI/CD pipelines:
`bash
Build thin image (default)
npx haven-playwright build --product=BE --pushExplicit thin image build
npx haven-playwright build --product=BE --type=thin --pushWith custom tag
npx haven-playwright build --product=BE --type=thin --tag=thin-1.0.0 --push
`#### Full Image
Includes your app code baked into the image. Best for simple deployments:
`bash
Build full image
npx haven-playwright build --product=BE --type=full --push
`Thin Image Runtime Requirements:
-
ADO_REPO - Full ADO repo path (e.g., dev.azure.com/org/project/_git/repo)
- ADO_PAT - Personal Access Token for authentication
- ADO_BRANCH - Branch to clone (optional, default: main)
- ADO_PATH - Path within repo to cd into (optional, default: repo root)$3
`bash
Build locally (thin image - default)
npx haven-playwright build --product=BEBuild and push thin image to ECR (default)
npx haven-playwright build --product=BE --pushBuild and push full image to ECR
npx haven-playwright build --product=BE --type=full --pushBuild with custom version (thin by default)
npx haven-playwright build --product=BE --tag=v2.1.0 --push
`$3
`bash
Run specific automation IDs
npx haven-playwright run --automationIds=TC-AUTO-123,TC-AUTO-124Run tests with custom tags
npx haven-playwright run --customTags=smoke,p1Combine automation IDs and custom tags
npx haven-playwright run --automationIds=TC-AUTO-123 --customTags=smoke
`$3
HAVEN will run your containerized tests with environment variables:
`bash
docker run \
-e TEST_ENVIRONMENT=PROD \
-e PLAN_ID=123 \
-e RUN_ID=456 \
-e E2E_COMMAND="npm run test:e2e" \
066726995253.dkr.ecr.us-east-1.amazonaws.com/haven-test-images:BE-1.1.0 \
--customTags=smoke,p1
`Test Tagging Examples
$3
`ts
import { test, expect } from '@playwright/test';test('login @TC-AUTO-123 @smoke @p0', async ({ page }) => {
const env = process.env.TEST_ENVIRONMENT; // QA, DEV, CTE, PROD
await page.goto(
https://${env.toLowerCase()}.myapp.com/login);
// your test code
});test('user registration @TC-AUTO-456 @regression @p1', async ({ page }) => {
// your test code
});
`$3
`ts
test('environment-specific test @TC-AUTO-789', async ({ page }) => {
const env = process.env.TEST_ENVIRONMENT;
switch(env) {
case 'PROD':
await page.goto('https://app.mycompany.com');
break;
case 'CTE':
await page.goto('https://cte.mycompany.com');
break;
default:
await page.goto(https://${env.toLowerCase()}.mycompany.com);
}
});
`$3
For projects with custom test runners, set the E2E_COMMAND environment variable:
`bash
In your Dockerfile or container environment
ENV E2E_COMMAND="npm run test:e2e:prod"
`The integration will export
HAVEN_GREP_PATTERN for use in your playwright.config.js:
`js
// playwright.config.js
export default {
// Use HAVEN's grep pattern for selective test execution
grep: process.env.HAVEN_GREP_PATTERN || undefined,
// your other config
};
`Artifacts and Monitoring
$3
- Live Output: s3://{BUCKET}/artifacts/{PRODUCT}/{PLAN_ID}/automation/{RUN_ID}/live-output.log (updated every 30s)
- Final Output: s3://{BUCKET}/artifacts/{PRODUCT}/{PLAN_ID}/automation/{RUN_ID}/test-output.log
- HTML Report ZIP: s3://{BUCKET}/artifacts/{PRODUCT}/{PLAN_ID}/automation/{RUN_ID}/{PRODUCT}_{TIMESTAMP}.zip
- HTML Report: s3://{BUCKET}/artifacts/{PRODUCT}/{PLAN_ID}/automation/{RUN_ID}/index.html$3
- ZIP: /shared/test-logs/{PRODUCT}_{TIMESTAMP}.zip
- HTML: /shared/test-logs/index.htmlEnvironment Variables
$3
- PLAN_ID - Test plan identifier
- RUN_ID - Test run identifier
- PRODUCT_NAME - Product name for artifact organization
- BUCKET_NAME - S3 bucket for artifact uploads$3
- TEST_ENVIRONMENT - Target environment (QA/DEV/CTE/PROD, default: QA)
- E2E_COMMAND - Custom test execution command (default: npx playwright test)$3
- TEST_ENVIRONMENT - Accessible in your test code
- HAVEN_GREP_PATTERN - Exported grep pattern for custom configs
- HAVEN_GREP_INVERT_PATTERN - Exported grep pattern for custom configs to exclude testsECR Image Management
Images are automatically tagged and organized by product and build type:
$3
- Full Image: {PRODUCT}-{VERSION} (e.g., BE-1.1.0)
- Thin Image: {PRODUCT}-thin-{VERSION} (e.g., BE-thin-1.1.0)$3
- Repository: haven-test-images
- Examples:
- BE-1.1.0 (full image from package.json version)
- BE-thin-1.1.0 (thin image for ADO cloning)
- payments-2.1.0 (custom full image)
- payments-thin-2.1.0 (custom thin image)$3
`yaml
Use full image (app code included)
image: haven-test-images:BE-1.1.0Use thin image (requires ADO_REPO, ADO_PAT env vars)
image: haven-test-images:BE-thin-1.1.0
environment:
ADO_REPO: "dev.azure.com/myorg/myproject/_git/myrepo"
ADO_PAT: "${ADO_PAT_SECRET}"
ADO_BRANCH: "main"
`Requirements
- Node.js 16+
- Podman or Docker
- AWS CLI configured (for ECR push)
- HAVEN access credentials (provided when container runs)
Latest Updates
$3
- Package Manager Auto-Detection: Automatically detects and uses the correct package manager (pnpm, yarn, or npm) based on lockfiles
- Backwards Compatible: Works with existing npm-only projects without any changes
- Thin Image Support: pnpm and yarn now fully supported in thin image mode
- Detects pnpm-lock.yaml → uses pnpm install --frozen-lockfile
- Detects yarn.lock → uses yarn install --frozen-lockfile
- Detects package-lock.json → uses npm ci (existing behavior)
- Falls back to npm install if no lockfile is found$3
- Removed all emojis from console output
- Added real-time log streaming to S3
- Enhanced automation ID detection (supports dots, dashes)
- Added custom E2E command support via E2E_COMMAND
- Improved HTML report detection from multiple locations
- Added HAVEN_GREP_PATTERN export for custom playwright configs
- Enhanced error handling and artifact managementNotes
- Works with existing HAVEN runner; no changes required
- Container base image: mcr.microsoft.com/playwright:v1.57.0-jammy`