{"id":30348091,"url":"https://github.com/idanfishman/playwright-results-parser","last_synced_at":"2025-09-01T04:38:35.917Z","repository":{"id":309103636,"uuid":"1034990558","full_name":"idanfishman/playwright-results-parser","owner":"idanfishman","description":"Core building block for Playwright test analysis tools - provides foundational parsing, normalization, and transformation APIs that other packages can build upon.","archived":false,"fork":false,"pushed_at":"2025-08-18T15:58:36.000Z","size":125,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-18T17:48:34.425Z","etag":null,"topics":["automation","parser","playwright","reporting","test-automation","test-results","testing"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/playwright-results-parser","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/idanfishman.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-09T12:23:40.000Z","updated_at":"2025-08-10T20:48:06.000Z","dependencies_parsed_at":"2025-08-09T22:22:49.402Z","dependency_job_id":null,"html_url":"https://github.com/idanfishman/playwright-results-parser","commit_stats":null,"previous_names":["idanfishman/playwright-results-parser"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/idanfishman/playwright-results-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idanfishman%2Fplaywright-results-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idanfishman%2Fplaywright-results-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idanfishman%2Fplaywright-results-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idanfishman%2Fplaywright-results-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/idanfishman","download_url":"https://codeload.github.com/idanfishman/playwright-results-parser/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idanfishman%2Fplaywright-results-parser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273074681,"owners_count":25041007,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","parser","playwright","reporting","test-automation","test-results","testing"],"created_at":"2025-08-18T17:35:30.229Z","updated_at":"2025-09-01T04:38:35.889Z","avatar_url":"https://github.com/idanfishman.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\" style=\"border-bottom: none\"\u003e\n  Playwright Results Parser\n\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n[![npm](https://img.shields.io/npm/v/playwright-results-parser?color=bright-green\u0026logo=npm\u0026logoColor=white\u0026label=npm)](https://www.npmjs.com/package/playwright-results-parser) [![codecov](https://img.shields.io/codecov/c/github/idanfishman/playwright-results-parser?color=brightgreen\u0026logo=codecov\u0026logoColor=white\u0026label=coverage)](https://codecov.io/gh/idanfishman/playwright-results-parser) [![Node.js Version](https://img.shields.io/badge/node-%3E%3D18-brightgreen?logo=node.js\u0026logoColor=white)](https://nodejs.org/) [![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT) [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-brightgreen?logo=typescript\u0026logoColor=white)](https://www.typescriptlang.org/)\n\nA powerful Node.js library for parsing and analyzing Playwright test results. This package provides comprehensive parsing capabilities for Playwright's JSON reporter output, making it easy to extract insights, generate reports, and integrate test results into your CI/CD workflows.\n\n\u003c/div\u003e\n\n## Features\n\n- **Comprehensive Parsing**: Parse Playwright JSON test results with full type safety\n- **Statistical Analysis**: Calculate pass rates, duration statistics, and test metrics\n- **Flexible Filtering**: Filter results by status, tags, projects, and custom predicates\n- **Tag Management**: Extract and analyze test tags from various formats\n- **Detailed Information**: Access test errors, annotations, retries, and attachments\n- **Type-Safe**: Built with TypeScript for excellent IDE support and type safety\n\n## Installation\n\n```bash\nnpm install playwright-results-parser\n```\n\nor\n\n```bash\nyarn add playwright-results-parser\n```\n\nor\n\n```bash\npnpm add playwright-results-parser\n```\n\n## Usage\n\n### Basic Example\n\n```javascript\nimport { parsePlaywrightResults } from \"playwright-results-parser\";\n\n// Parse results from a file\nconst results = await parsePlaywrightResults(\"path/to/results.json\");\n\n// Or parse from JSON data directly\nconst jsonData = {\n  /* your playwright JSON results */\n};\nconst results = await parsePlaywrightResults(jsonData);\n\n// Access parsed data\nconsole.log(`Total tests: ${results.summary.total}`);\nconsole.log(`Passed: ${results.summary.passed}`);\nconsole.log(`Failed: ${results.summary.failed}`);\nconsole.log(`Pass rate: ${(results.summary.passRate * 100).toFixed(2)}%`);\n```\n\n### Filtering Results\n\n```javascript\nimport { parsePlaywrightResults, filterResults } from \"playwright-results-parser\";\n\nconst results = await parsePlaywrightResults(\"results.json\");\n\n// Filter by status\nconst failedTests = filterResults(results, { status: [\"failed\", \"timedOut\"] });\n\n// Filter by tags\nconst smokeTests = filterResults(results, { tags: [\"@smoke\"] });\n\n// Filter by project\nconst chromeTests = filterResults(results, { projects: [\"chromium\"] });\n\n// Custom filter\nconst slowTests = filterResults(results, {\n  predicate: (test) =\u003e test.duration \u003e 5000,\n});\n\n// Combine multiple filters\nconst criticalFailures = filterResults(results, {\n  status: [\"failed\"],\n  tags: [\"@critical\"],\n  projects: [\"chromium\", \"firefox\"],\n});\n```\n\n### Working with Test Details\n\n```javascript\nimport { parsePlaywrightResults } from \"playwright-results-parser\";\n\nconst results = await parsePlaywrightResults(\"results.json\");\n\n// Iterate through all tests\nresults.tests.forEach((test) =\u003e {\n  console.log(`Test: ${test.title}`);\n  console.log(`  File: ${test.file}:${test.line}`);\n  console.log(`  Status: ${test.status}`);\n  console.log(`  Duration: ${test.duration}ms`);\n\n  // Access test tags\n  if (test.tags.length \u003e 0) {\n    console.log(`  Tags: ${test.tags.join(\", \")}`);\n  }\n\n  // Check for errors\n  if (test.errors.length \u003e 0) {\n    test.errors.forEach((error) =\u003e {\n      console.log(`  Error: ${error.message}`);\n      if (error.snippet) {\n        console.log(`    Snippet: ${error.snippet}`);\n      }\n    });\n  }\n\n  // Access annotations\n  test.annotations.forEach((annotation) =\u003e {\n    console.log(`  ${annotation.type}: ${annotation.description}`);\n  });\n});\n```\n\n### Analyzing Test Suites\n\n```javascript\nimport { parsePlaywrightResults } from \"playwright-results-parser\";\n\nconst results = await parsePlaywrightResults(\"results.json\");\n\n// Access suite hierarchy\nresults.suites.forEach((suite) =\u003e {\n  console.log(`Suite: ${suite.title}`);\n  console.log(`  File: ${suite.file}`);\n  console.log(`  Total tests: ${suite.tests.length}`);\n  console.log(`  Pass rate: ${(suite.stats.passRate * 100).toFixed(2)}%`);\n\n  // Access nested suites\n  if (suite.suites.length \u003e 0) {\n    console.log(`  Nested suites: ${suite.suites.length}`);\n  }\n});\n```\n\n### Statistical Analysis\n\n```javascript\nimport { parsePlaywrightResults, getStatistics } from \"playwright-results-parser\";\n\nconst results = await parsePlaywrightResults(\"results.json\");\nconst stats = getStatistics(results);\n\nconsole.log(\"Test Statistics:\");\nconsole.log(`  Total: ${stats.total}`);\nconsole.log(`  Passed: ${stats.passed}`);\nconsole.log(`  Failed: ${stats.failed}`);\nconsole.log(`  Flaky: ${stats.flaky}`);\nconsole.log(`  Skipped: ${stats.skipped}`);\nconsole.log(`  Pass Rate: ${(stats.passRate * 100).toFixed(2)}%`);\nconsole.log(`  Average Duration: ${stats.avgDuration.toFixed(2)}ms`);\nconsole.log(`  Total Duration: ${stats.totalDuration}ms`);\n```\n\n## API Reference\n\n### Main Functions\n\n#### `parsePlaywrightResults(input)`\n\nParses Playwright JSON results from a file path or JSON object.\n\n- **Parameters**:\n  - `input`: File path (string) or Playwright JSON results object\n- **Returns**: `Promise\u003cParsedResults\u003e`\n\n#### `filterResults(results, options)`\n\nFilters parsed results based on specified criteria.\n\n- **Parameters**:\n  - `results`: Parsed results object\n  - `options`: Filter options object\n    - `status`: Array of test statuses to include\n    - `tags`: Array of tags to filter by\n    - `projects`: Array of project names to filter by\n    - `predicate`: Custom filter function\n- **Returns**: `FilteredResults`\n\n#### `getStatistics(results)`\n\nCalculates statistical metrics from test results.\n\n- **Parameters**:\n  - `results`: Parsed or filtered results\n- **Returns**: `Statistics` object with metrics\n\n### Types\n\nThe package exports comprehensive TypeScript types for all data structures:\n\n```typescript\nimport type {\n  ParsedResults,\n  TestResult,\n  Suite,\n  TestStatus,\n  Statistics,\n  FilterOptions,\n  // ... and more\n} from \"playwright-results-parser\";\n```\n\n## Showcases\n\nThis package serves as the core parsing library for several GitHub Actions:\n\n### [Playwright Results Summary Action](https://github.com/idanfishman/playwright-results-summary-action)\n\nGenerate test result summaries directly in your pull requests and workflow runs.\n\n### [Playwright Results Notify Action](https://github.com/idanfishman/playwright-results-notify-action)\n\nSend test results notifications via Slack, email, or other channels.\n\n### [Playwright Prometheus Metrics Action](https://github.com/idanfishman/playwright-prometheus-metrics-action)\n\nExport Playwright test metrics to Prometheus for monitoring and alerting.\n\n## Requirements\n\n- Node.js 18.x or later\n- Playwright test results in JSON format (generated using `--reporter=json`)\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Author\n\nCreated and maintained by [Idan Fishman](https://github.com/idanfishman)\n\n## Support\n\nIf you find this package helpful, please consider giving it a star on [GitHub](https://github.com/idanfishman/playwright-results-parser).\n\nFor issues, questions, or suggestions, please [open an issue](https://github.com/idanfishman/playwright-results-parser/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidanfishman%2Fplaywright-results-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fidanfishman%2Fplaywright-results-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidanfishman%2Fplaywright-results-parser/lists"}