playwright-best-practices

Fail

Audited by Runlayer on Mar 14, 2026

Risk Level: HIGH
Scan Summary
Max Score
95%
Files
63
Flagged
26
Chunks
118
Flagged Files (26)
playwright-best-practices/infrastructure-ci-cd/gitlab.mdHIGH
94.5%

Risky tool definition detected

```yaml image: mcr.microsoft.com/playwright:v1.48.0-noble stages: - install - test - report variables: CI: "true" npm_config_cache: "$CI_PROJECT_DIR/.npm" cache: key: files: - package-lock.json paths: - .npm/ - node_modules/ setup: stage: install script: - npm ci artifacts: paths: - node_modules/ expire_in: 1 hour e2e: stage: test needs: [setup] parallel: 4 script: - npx playwright test --shard=$CI_NODE_INDEX/$CI_NODE_TOTAL artifacts: when: always paths: - blob-report/ expire_in: 1 hour rules: -

**Fix**: Match the Docker image tag to your Playwright version: ```yaml # Check your version: npm ls @playwright/test image: mcr.microsoft.com/playwright:v1.48.0-noble ``` ### Tests hang in GitLab runner: "Navigation timeout exceeded" **Cause**: GitLab shared runners may have limited resources.

playwright-best-practices/infrastructure-ci-cd/test-coverage.mdHIGH
94.1%

Tool passed security scan

Risky tool definition detected

Description: } return violations; } ``` ## Advanced Patterns ### Merging Coverage Across Shards ```typescript // scripts/merge-coverage.ts import fs from "fs"; import { glob } from "glob"; async function mergeCoverage() { const files = await glob("shard-*/coverage/*.json"); const merged = new Map<string, any>(); for (const file of files) { const data = JSON.parse(fs.readFileSync(file, "utf-8")); for (const entry of data) { if (merged.has(entry.url)) { const existing = merged.get(entry.url); exis

playwright-best-practices/testing-patterns/performance-testing.mdHIGH
92.6%

Tool passed security scan

Data Exfiltration

Supply Chain Compromise

playwright-best-practices/infrastructure-ci-cd/docker.mdHIGH
90.8%

Risky tool definition detected

playwright-best-practices/infrastructure-ci-cd/other-providers.mdHIGH
90.8%

Risky tool definition detected

Use `latest` tag or match versions: ```yaml docker: - image: mcr.microsoft.com/playwright:v1.48.0-noble ``` ### Azure DevOps: Test results not showing Missing JUnit reporter or `PublishTestResults@2` task: ```typescript reporter: [['junit', { outputFile: 'results/junit.xml' }]], ``` ```yaml - task: PublishTestResults@2 condition: always() inputs: testResultsFormat: "JUnit" testResultsFiles: "results/junit.xml" ``` ### Shard index off by one CircleCI's `CIRCLE_NODE_INDEX` is 0-based, Playwright's

playwright-best-practices/advanced/authentication.mdHIGH
90.3%

Data Exfiltration

Risky tool definition detected

**Fix**: - Wait for the post-login page to load: `await page.waitForURL('/home')` - Verify cookies exist before saving: ```typescript const cookies = await context.cookies(); if (cookies.length === 0) { throw new Error("No cookies found after login"); } await context.storageState({ path: ".auth/session.json" }); ``` ### Different browsers get different cookies **Cause**: Some auth flows set cookies with `SameSite=Strict` or use browser-specific cookie behavior.

playwright-best-practices/infrastructure-ci-cd/ci-cd.mdMEDIUM
88.2%

Risky tool definition detected

[["github"], ["blob"], ["html"]] : [["list"], ["html"]], use: { baseURL: process.env.BASE_URL || "http://localhost:3000", trace: "on-first-retry", screenshot: "only-on-failure", video: "on-first-retry", }, }); ``` ## Related References - **Test tags**: See [test-tags.md](../core/test-tags.md) for tagging and filtering patterns - **Performance optimization**: See [performance.md](performance.md) for sharding and parallelization - **Debugging CI failures**: See [debugging.md](../debugging/debuggin

playwright-best-practices/core/configuration.mdMEDIUM
86.1%

Tool passed security scan

Risky tool definition detected

```ts webServer: { command: 'npm run dev', url: 'http://localhost:4000/api/health', // use real endpoint reuseExistingServer: !process.env.CI, timeout: 120_000, }, ``` ### Tests Pass Locally But Timeout in CI **Cause**: CI machines are slower.

playwright-best-practices/infrastructure-ci-cd/github-actions.mdMEDIUM
85.7%

Risky tool definition detected

**Fix**: Kill stale processes before starting: ```yaml - name: Kill stale processes run: lsof -ti:3000 | xargs kill -9 2>/dev/null || true ``` ### No PR annotations **Cause**: `github` reporter not configured.

playwright-best-practices/advanced/third-party.mdMEDIUM
84.0%

Tool passed security scan

Context Poisoning

Supply Chain Compromise

playwright-best-practices/frameworks/vue.mdMEDIUM
83.2%

Risky tool definition detected

playwright-best-practices/infrastructure-ci-cd/reporting.mdMEDIUM
79.4%

Tool passed security scan

Risky tool definition detected

2 : 0, use: { trace: 'on-first-retry', }, }); ``` ### JUnit XML Not Recognized Ensure path matches CI configuration: ```typescript reporter: [['junit', { outputFile: 'results/junit.xml' }]], ``` ```yaml # GitHub Actions - uses: dorny/test-reporter@latest with: path: results/junit.xml reporter: java-junit # Azure DevOps - task: PublishTestResults@latest inputs: testResultsFiles: 'results/junit.xml' # Jenkins junit 'results/junit.xml' ``` ### Empty Merged Report Use `blob` reporter for sharded run

playwright-best-practices/debugging/flaky-tests.mdMEDIUM
78.4%

Tool passed security scan

Risky tool definition detected

Description: // ✅ GOOD: Proper fixture with cleanup export const test = base.extend<{ tempFile: string }>({ tempFile: async ({}, use) => { const file = `/tmp/test-${Date.now()}.json`; fs.writeFileSync(file, "{}"); await use(file); // Cleanup always runs, even on failure if (fs.existsSync(file)) { fs.unlinkSync(file); } }, }); ``` ## CI-Specific Flakiness ### Why Tests Fail Only in CI | CI Condition | Impact | Solution | | ------------------ | ------------------------------------- | -------------

playwright-best-practices/frameworks/nextjs.mdMEDIUM
78.4%

Risky tool definition detected

playwright-best-practices/core/test-suite-structure.mdLOW
74.7%

Tool passed security scan

Risky tool definition detected

}); }); ``` ### Running Tagged Tests ```bash # Run smoke tests npx playwright test --grep @smoke # Run all except slow tests npx playwright test --grep-invert @slow # Combine tags npx playwright test --grep "@smoke|@critical" ``` For project-based filtering and advanced project configuration, see **[projects-dependencies.md](projects-dependencies.md)**.

playwright-best-practices/advanced/authentication-flows.mdLOW
72.9%

Risky tool definition detected

playwright-best-practices/.github/workflows/validate-skill.ymlLOW
71.5%

Supply Chain Compromise

playwright-best-practices/frameworks/angular.mdLOW
69.4%

Tool passed security scan

playwright-best-practices/debugging/debugging.mdLOW
67.7%

Tool passed security scan

playwright-best-practices/architecture/when-to-mock.mdLOW
67.3%

Tool passed security scan

playwright-best-practices/testing-patterns/security-testing.mdLOW
64.7%

Tool passed security scan

playwright-best-practices/infrastructure-ci-cd/parallel-sharding.mdLOW
62.0%

Tool passed security scan

playwright-best-practices/infrastructure-ci-cd/performance.mdLOW
57.4%

Tool passed security scan

playwright-best-practices/architecture/test-architecture.mdLOW
54.8%

Tool passed security scan

playwright-best-practices/testing-patterns/visual-regression.mdLOW
52.6%

Tool passed security scan

playwright-best-practices/testing-patterns/api-testing.mdLOW
50.3%

Tool passed security scan

Passed Files (37)Click to expand
playwright-best-practices/debugging/console-errors.mdOK
49.5%

Tool passed security scan

playwright-best-practices/core/test-data.mdOK
47.5%

Tool passed security scan

playwright-best-practices/testing-patterns/electron.mdOK
46.9%

Tool passed security scan

playwright-best-practices/testing-patterns/file-upload-download.mdOK
44.6%

Tool passed security scan

playwright-best-practices/browser-apis/browser-apis.mdOK
43.6%

Tool passed security scan

playwright-best-practices/testing-patterns/i18n.mdOK
43.2%

Tool passed security scan

playwright-best-practices/testing-patterns/file-operations.mdOK
40.9%

Tool passed security scan

playwright-best-practices/testing-patterns/browser-extensions.mdOK
40.7%

Tool passed security scan

playwright-best-practices/advanced/multi-user.mdOK
40.5%

Tool passed security scan

playwright-best-practices/testing-patterns/graphql-testing.mdOK
40.4%

Tool passed security scan

playwright-best-practices/advanced/network-advanced.mdOK
39.9%

Tool passed security scan

playwright-best-practices/README.mdOK
37.8%

Tool passed security scan

playwright-best-practices/browser-apis/service-workers.mdOK
35.7%

Tool passed security scan

playwright-best-practices/frameworks/react.mdOK
33.0%

Tool passed security scan

playwright-best-practices/SKILL.mdOK
30.2%

Tool passed security scan

playwright-best-practices/browser-apis/websockets.mdOK
28.4%

Tool passed security scan

playwright-best-practices/browser-apis/iframes.mdOK
26.6%

Tool passed security scan

playwright-best-practices/architecture/pom-vs-fixtures.mdOK
26.4%

Tool passed security scan

playwright-best-practices/LICENSE.mdOK
25.2%

Tool passed security scan

playwright-best-practices/testing-patterns/forms-validation.mdOK
23.4%

Tool passed security scan

playwright-best-practices/core/global-setup.mdOK
23.1%

Tool passed security scan

playwright-best-practices/advanced/clock-mocking.mdOK
20.2%

Tool passed security scan

playwright-best-practices/testing-patterns/component-testing.mdOK
19.2%

Tool passed security scan

playwright-best-practices/core/fixtures-hooks.mdOK
17.3%

Tool passed security scan

playwright-best-practices/testing-patterns/canvas-webgl.mdOK
16.6%

Tool passed security scan

playwright-best-practices/testing-patterns/drag-drop.mdOK
16.6%

Tool passed security scan

playwright-best-practices/advanced/mobile-testing.mdOK
16.0%

Tool passed security scan

playwright-best-practices/.agnix.tomlOK
15.3%

Tool passed security scan

playwright-best-practices/core/annotations.mdOK
15.0%

Tool passed security scan

playwright-best-practices/core/assertions-waiting.mdOK
10.5%

Tool passed security scan

playwright-best-practices/advanced/multi-context.mdOK
9.6%

Tool passed security scan

playwright-best-practices/debugging/error-testing.mdOK
9.5%

Tool passed security scan

playwright-best-practices/core/projects-dependencies.mdOK
7.0%

Tool passed security scan

playwright-best-practices/core/locators.mdOK
6.4%

Tool passed security scan

playwright-best-practices/testing-patterns/accessibility.mdOK
5.7%

Tool passed security scan

playwright-best-practices/core/page-object-model.mdOK
4.5%

Tool passed security scan

playwright-best-practices/core/test-tags.mdOK
2.1%

Tool passed security scan

Audit Metadata
Max File Score
95%
Classification
KNOWN_SERVER_PARTIAL_KNOWN
Files Scanned
63
Files Flagged
26
Chunks Analyzed
118
Analyzed
Mar 14, 2026, 10:18 AM
Security Audit — runlayer — playwright-best-practices