{"_id":"@b3nab/playwright-telegram-reporter","_rev":"3-6c70e7844983f81f765658646fc96a11","name":"@b3nab/playwright-telegram-reporter","dist-tags":{"latest":"1.1.1"},"versions":{"1.0.0":{"name":"@b3nab/playwright-telegram-reporter","version":"1.0.0","keywords":["playwright","reporter","telegram","testing","test-reporter","telegram-bot"],"author":{"url":"https://ben.abbenanti.com","name":"Benedetto Abbenanti"},"license":"AGPL-3.0-only","_id":"@b3nab/playwright-telegram-reporter@1.0.0","maintainers":[{"name":"ben.abbenanti","email":"benedetto.abbenanti@gmail.com"}],"homepage":"https://github.com/org-b3nab/playwright-telegram-reporter#readme","bugs":{"url":"https://github.com/org-b3nab/playwright-telegram-reporter/issues"},"dist":{"shasum":"845e5dafd1b9c933945575fe532bd04524f581e3","tarball":"https://registry.npmjs.org/@b3nab/playwright-telegram-reporter/-/playwright-telegram-reporter-1.0.0.tgz","fileCount":15,"integrity":"sha512-/sANoTg/r/ZN0Q0QSrtYRp/Lp214uJGUYxa4oz3nt9bFgYAP6LMvZ+ZfWvkRYMnTbdxX3r53tSerVUlHhLUt+g==","signatures":[{"sig":"MEUCIQC5IY+keMglbTSgacN5AoPQIH+KhrgHGrtnmTg4N88ZoQIgb9kXJ7L4zlfQoP8Bis+UF8F3bV9q3ZKFMVN3lMz3f7Q=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":69988},"main":"dist/index.js","_from":"file:b3nab-playwright-telegram-reporter-1.0.0.tgz","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"lint":"biome check src tests playwright.config.ts","test":"playwright test","build":"biome check src tests playwright.config.ts && tsc","format":"biome format --write src tests playwright.config.ts"},"_npmUser":{"name":"ben.abbenanti","email":"benedetto.abbenanti@gmail.com"},"_resolved":"/private/var/folders/g0/pfn_szv12jz7lrlgvfl1p_2r0000gn/T/5be644196d93423d248cc9fd42e4ab99/b3nab-playwright-telegram-reporter-1.0.0.tgz","_integrity":"sha512-/sANoTg/r/ZN0Q0QSrtYRp/Lp214uJGUYxa4oz3nt9bFgYAP6LMvZ+ZfWvkRYMnTbdxX3r53tSerVUlHhLUt+g==","repository":{"url":"git+https://github.com/org-b3nab/playwright-telegram-reporter.git","type":"git"},"_npmVersion":"10.9.3","description":"Simple and Effective Playwright Reporter via Telegram Bot","directories":{},"_nodeVersion":"22.20.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.3","@types/node":"^24.8.1","@biomejs/biome":"^2.2.6","@playwright/test":"^1.56.1"},"peerDependencies":{"@playwright/test":"^1.40.0"},"_npmOperationalInternal":{"tmp":"tmp/playwright-telegram-reporter_1.0.0_1760900721384_0.5013563547943101","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@b3nab/playwright-telegram-reporter","version":"1.1.0","keywords":["playwright","reporter","telegram","testing","test-reporter","telegram-bot"],"author":{"url":"https://ben.abbenanti.com","name":"Benedetto Abbenanti"},"license":"AGPL-3.0-only","_id":"@b3nab/playwright-telegram-reporter@1.1.0","maintainers":[{"name":"ben.abbenanti","email":"benedetto.abbenanti@gmail.com"}],"homepage":"https://github.com/org-b3nab/playwright-telegram-reporter#readme","bugs":{"url":"https://github.com/org-b3nab/playwright-telegram-reporter/issues"},"dist":{"shasum":"f1bb09458b8e8917f9d046932a7de1ca28b0d0a8","tarball":"https://registry.npmjs.org/@b3nab/playwright-telegram-reporter/-/playwright-telegram-reporter-1.1.0.tgz","fileCount":15,"integrity":"sha512-BhQQ6igovc/1tQncCgYAs/Wo6iU7NyrKsDrRthrvvl1WUAcW/If5AsEshV1YO28aOStun4Zq9OicrfygFYGa5Q==","signatures":[{"sig":"MEYCIQDI6eFXvG/pb1sLJMCaZrXERzlCuKkF6VjhiKh5IFCEBgIhAL2oNP1M1odw2gZ8nE8p69csbEd2Xps0qds/v/Km11wb","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":72153},"main":"dist/index.js","_from":"file:b3nab-playwright-telegram-reporter-1.1.0.tgz","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"pub":"pnpm publish","bump":"pnpx bumpp","lint":"biome check src tests playwright.config.ts","test":"playwright test","yeah":"pnpm test && pnpm build && pnpm bump && pnpm pub --no-git-checks","build":"biome check src tests playwright.config.ts && tsc","format":"biome format --write src tests playwright.config.ts"},"_npmUser":{"name":"ben.abbenanti","email":"benedetto.abbenanti@gmail.com"},"_resolved":"/private/var/folders/g0/pfn_szv12jz7lrlgvfl1p_2r0000gn/T/8977b6a792fca60829ee84040194f314/b3nab-playwright-telegram-reporter-1.1.0.tgz","_integrity":"sha512-BhQQ6igovc/1tQncCgYAs/Wo6iU7NyrKsDrRthrvvl1WUAcW/If5AsEshV1YO28aOStun4Zq9OicrfygFYGa5Q==","repository":{"url":"git+https://github.com/org-b3nab/playwright-telegram-reporter.git","type":"git"},"_npmVersion":"10.9.3","description":"Simple and Effective Playwright Reporter via Telegram Bot","directories":{},"_nodeVersion":"22.20.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.3","@types/node":"^24.8.1","@biomejs/biome":"^2.2.6","@playwright/test":"^1.56.1"},"peerDependencies":{"@playwright/test":"^1.40.0"},"_npmOperationalInternal":{"tmp":"tmp/playwright-telegram-reporter_1.1.0_1760902366936_0.17819994796447025","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@b3nab/playwright-telegram-reporter","version":"1.1.1","description":"Simple and Effective Playwright Reporter via Telegram Bot","author":{"name":"Benedetto Abbenanti","url":"https://ben.abbenanti.com"},"license":"AGPL-3.0-only","keywords":["playwright","reporter","telegram","testing","test-reporter","telegram-bot"],"main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","require":"./dist/index.js","import":"./dist/index.js"},"./package.json":"./package.json"},"engines":{"node":">=18.0.0"},"peerDependencies":{"@playwright/test":"^1.40.0"},"repository":{"type":"git","url":"git+https://github.com/b3nab/playwright-telegram-reporter.git"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"devDependencies":{"@biomejs/biome":"^2.2.6","@playwright/test":"^1.56.1","@types/node":"^24.8.1","dotenv":"^17.2.3","typescript":"^5.9.3"},"scripts":{"build":"biome check src tests playwright.config.ts && tsc","test":"playwright test","lint":"biome check src tests playwright.config.ts","format":"biome format --write src tests playwright.config.ts","bump":"pnpx bumpp","pub":"pnpm publish","yeah":"pnpm test && pnpm build && pnpm bump && pnpm pub --no-git-checks"},"_id":"@b3nab/playwright-telegram-reporter@1.1.1","bugs":{"url":"https://github.com/b3nab/playwright-telegram-reporter/issues"},"homepage":"https://github.com/b3nab/playwright-telegram-reporter#readme","_integrity":"sha512-qbwZJSYL3Zx5/x7rT/bW0SojuD/O2ffZ5tLOa/msNHJVkyfRpjNUYc68fxdgZ0kvb0nbieiKirn/tKQkulKbVA==","_resolved":"/private/var/folders/g0/pfn_szv12jz7lrlgvfl1p_2r0000gn/T/9d322e98839be1f04a13c7f558c5ca6a/b3nab-playwright-telegram-reporter-1.1.1.tgz","_from":"file:b3nab-playwright-telegram-reporter-1.1.1.tgz","_nodeVersion":"22.20.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-qbwZJSYL3Zx5/x7rT/bW0SojuD/O2ffZ5tLOa/msNHJVkyfRpjNUYc68fxdgZ0kvb0nbieiKirn/tKQkulKbVA==","shasum":"e25f954665351b180a1c7b7a94c26c326860a6dd","tarball":"https://registry.npmjs.org/@b3nab/playwright-telegram-reporter/-/playwright-telegram-reporter-1.1.1.tgz","fileCount":15,"unpackedSize":71324,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIDncX7yv3uyefy6Ln4FyY+mPlPsRFTyeBIZ0GD0CnQQJAiBu87YCs/u5kDx2BNz4SOWWl/E+KsA33+JuONHknTIcew=="}]},"_npmUser":{"name":"ben.abbenanti","email":"benedetto.abbenanti@gmail.com"},"directories":{},"maintainers":[{"name":"ben.abbenanti","email":"benedetto.abbenanti@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/playwright-telegram-reporter_1.1.1_1760991462712_0.879694035965966"},"_hasShrinkwrap":false}},"time":{"created":"2025-10-19T19:05:21.282Z","modified":"2025-10-20T20:17:43.122Z","1.0.0":"2025-10-19T19:05:21.559Z","1.1.0":"2025-10-19T19:32:47.136Z","1.1.1":"2025-10-20T20:17:42.919Z"},"bugs":{"url":"https://github.com/b3nab/playwright-telegram-reporter/issues"},"author":{"name":"Benedetto Abbenanti","url":"https://ben.abbenanti.com"},"license":"AGPL-3.0-only","homepage":"https://github.com/b3nab/playwright-telegram-reporter#readme","keywords":["playwright","reporter","telegram","testing","test-reporter","telegram-bot"],"repository":{"type":"git","url":"git+https://github.com/b3nab/playwright-telegram-reporter.git"},"description":"Simple and Effective Playwright Reporter via Telegram Bot","maintainers":[{"name":"ben.abbenanti","email":"benedetto.abbenanti@gmail.com"}],"readme":"# playwright-telegram-reporter\n\n[![npm](https://img.shields.io/npm/dm/@b3nab/playwright-telegram-reporter)](https://npm.chart.dev/@b3nab/playwright-telegram-reporter?primary=neutral&gray=neutral&theme=dark)\n[![npm version](https://img.shields.io/npm/v/@b3nab/playwright-telegram-reporter.svg)](https://www.npmjs.com/package/@b3nab/playwright-telegram-reporter)\n[![GitHub stars](https://img.shields.io/github/stars/b3nab/playwright-telegram-reporter)](https://github.com/b3nab/playwright-telegram-reporter/stargazers)\n\nSimple and Effective Playwright Reporter via Telegram Bot\n\nSend your Playwright test results directly to Telegram with flexible reporting options.\n\n## Features\n\n- 🚀 **Simple Setup** - Just add to your Playwright config\n- 📊 **Multiple Report Types** - Simple, Summary, or Detailed reports\n- 🎨 **Custom Formatters** - Full control over message formatting\n- ⚙️ **Configurable Triggers** - Send always, only on failure, or only on success\n- 🔒 **Zero Dependencies** - Uses native Node.js fetch (requires Node.js 18+)\n- 📦 **TypeScript Support** - Full type definitions included\n\n## Installation\n\n```bash\nnpm install @b3nab/playwright-telegram-reporter\n# or\npnpm add @b3nab/playwright-telegram-reporter\n# or\nyarn add @b3nab/playwright-telegram-reporter\n```\n\n## Prerequisites\n\n1. **Node.js 18+** - Required for native fetch support\n2. **Telegram Bot Token** - Get one from [@BotFather](https://t.me/BotFather)\n3. **Chat ID** - The Telegram chat where messages will be sent\n\n### Getting Your Telegram Bot Token\n\n1. Open Telegram and search for [@BotFather](https://t.me/BotFather)\n2. Send `/newbot` command\n3. Follow the prompts to create your bot\n4. Copy the bot token provided\n\n### Getting Your Chat ID\n\n1. Start a chat with your bot or add it to a group\n2. Send any message to the chat\n3. Visit: `https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates`\n4. Look for the `chat.id` field in the JSON response\n\n## Usage\n\n### Quick Start\n\nThe simplest way to add the reporter to your `playwright.config.ts`:\n\n```typescript\nimport { defineConfig } from '@playwright/test';\n\nexport default defineConfig({\n  reporter: [\n    ['list'], // Keep the default list reporter for console output\n    [\n      '@b3nab/playwright-telegram-reporter',\n      {\n        botToken: process.env.TELEGRAM_BOT_TOKEN,\n        chatId: process.env.TELEGRAM_CHAT_ID,\n      },\n    ],\n  ],\n  // ... other config\n});\n```\n\n### Environment Variables\n\n```env\nTELEGRAM_BOT_TOKEN=your_bot_token_here\nTELEGRAM_CHAT_ID=your_chat_id_here\n```\n\n## Configuration Options\n\n### Report Types\n\nChoose from three built-in report types:\n\n#### Simple Report (Minimal)\n\n```typescript\nexport default defineConfig({\n  reporter: [\n    ['@b3nab/playwright-telegram-reporter', {\n      botToken: process.env.TELEGRAM_BOT_TOKEN,\n      chatId: process.env.TELEGRAM_CHAT_ID,\n      reportType: 'simple',\n    }]\n  ],\n});\n```\n\nOutput:\n```\n✅ Test run passed\n```\n\n#### Summary Report\n\n```typescript\nexport default defineConfig({\n  reporter: [\n    ['@b3nab/playwright-telegram-reporter', {\n      botToken: process.env.TELEGRAM_BOT_TOKEN,\n      chatId: process.env.TELEGRAM_CHAT_ID,\n      reportType: 'summary',\n    }]\n  ],\n});\n```\n\nOutput:\n```\n✅ Playwright Test Results\n\nStatus: PASSED\nDuration: 12.45s\n\n📊 Summary:\n• Total: 15\n• Passed: 15\n• Failed: 0\n• Skipped: 0\n```\n\n#### Detailed Report (Default)\n\n```typescript\nexport default defineConfig({\n  reporter: [\n    ['@b3nab/playwright-telegram-reporter', {\n      botToken: process.env.TELEGRAM_BOT_TOKEN,\n      chatId: process.env.TELEGRAM_CHAT_ID,\n      reportType: 'detailed',\n    }]\n  ],\n});\n```\n\nOutput includes **summary statistics and all individual test names with durations**, plus full error messages for failures:\n\n```\n✅ Playwright Test Results\n\nStatus: PASSED\nDuration: 12.45s\n\n📊 Summary:\n• Total: 15\n• Passed: 13\n• Failed: 2\n• Skipped: 0\n\n❌ FAILED (2):\n\n  • Auth Tests › Login with invalid credentials (3.21s)\n    Error: Expected \"error\" but got \"success\"\n           at page.locator...\n           ...\n\n  • API Tests › API returns 404 (1.15s)\n    Error: Request failed with status 404\n\n✅ PASSED (13):\n  • Home Page › Homepage loads correctly (0.85s)\n  • Home Page › Navigation menu works (1.20s)\n  • Search › Search functionality (2.30s)\n  • Auth Tests › User can logout (0.95s)\n  ...\n```\n\n> **Note:** You can customize the title using the `title` option and test name format using the `testFormat` option (see below).\n\n### Custom Formatter\n\nFor complete control over the message format:\n\n```typescript\nimport { defineConfig } from '@playwright/test';\nimport type { FullResult, Suite } from '@playwright/test/reporter';\n\nexport default defineConfig({\n  reporter: [\n    ['@b3nab/playwright-telegram-reporter', {\n      botToken: process.env.TELEGRAM_BOT_TOKEN,\n      chatId: process.env.TELEGRAM_CHAT_ID,\n      customFormatter: (result: FullResult, suite: Suite) => {\n        const tests = suite.allTests();\n        return `🎭 Custom Report\n\nTests completed: ${tests.length}\nStatus: ${result.status}\nTime: ${new Date().toLocaleString()}\n\nCustom message here!`;\n      },\n    }]\n  ],\n});\n```\n\n### Send Conditions\n\nControl when reports are sent:\n\n```typescript\nexport default defineConfig({\n  reporter: [\n    ['@b3nab/playwright-telegram-reporter', {\n      botToken: process.env.TELEGRAM_BOT_TOKEN,\n      chatId: process.env.TELEGRAM_CHAT_ID,\n      sendOn: 'always', // 'always' | 'failure' | 'success'\n    }]\n  ],\n});\n```\n\n- **`always`** (default) - Send report on every test run\n- **`failure`** - Only send when tests fail\n- **`success`** - Only send when all tests pass\n\n### Custom Title\n\nCustomize the report title (first line):\n\n```typescript\nexport default defineConfig({\n  reporter: [\n    ['@b3nab/playwright-telegram-reporter', {\n      botToken: process.env.TELEGRAM_BOT_TOKEN,\n      chatId: process.env.TELEGRAM_CHAT_ID,\n      title: '🎭 My Test Suite', // Simple string\n    }]\n  ],\n});\n```\n\nOr use a function for dynamic titles based on pass/fail:\n\n```typescript\nexport default defineConfig({\n  reporter: [\n    ['@b3nab/playwright-telegram-reporter', {\n      botToken: process.env.TELEGRAM_BOT_TOKEN,\n      chatId: process.env.TELEGRAM_CHAT_ID,\n      title: (passed) => passed ? '✅ All Tests Passed!' : '❌ Tests Failed',\n    }]\n  ],\n});\n```\n\n### Test Name Format (Detailed Reports Only)\n\nCustomize how test names appear in detailed reports:\n\n```typescript\nexport default defineConfig({\n  reporter: [\n    ['@b3nab/playwright-telegram-reporter', {\n      botToken: process.env.TELEGRAM_BOT_TOKEN,\n      chatId: process.env.TELEGRAM_CHAT_ID,\n      reportType: 'detailed',\n      testFormat: '{GROUP} › {TEST} ({TIME})', // Default\n    }]\n  ],\n});\n```\n\n**Available variables:**\n- `{GROUP}` - Test suite/group (e.g., `Example Tests`)\n- `{TEST}` - Test name (e.g., `has heading`)\n- `{TIME}` - Duration (e.g., `0.58s`)\n- `{BROWSER}` - Browser/project (e.g., `chromium`)\n- `{FILENAME}` - File name (e.g., `example.spec.ts`)\n\n**Example formats:**\n\n| Format | Output |\n|--------|--------|\n| `{GROUP} › {TEST} ({TIME})` | `Example Tests › has heading (0.58s)` |\n| `{TEST} ({TIME})` | `has heading (0.58s)` |\n| `{BROWSER} \\| {TEST}` | `chromium \\| has heading` |\n| `{FILENAME} › {TEST}` | `example.spec.ts › has heading` |\n\n## Complete Example\n\n```typescript\nimport { defineConfig } from '@playwright/test';\nimport type { TelegramReporterOptions } from '@b3nab/playwright-telegram-reporter';\n\nexport default defineConfig({\n  testDir: './tests',\n  reporter: [\n    ['html'],\n    ['list'],\n    [\n      '@b3nab/playwright-telegram-reporter',\n      {\n        botToken: process.env.TELEGRAM_BOT_TOKEN || '',\n        chatId: process.env.TELEGRAM_CHAT_ID || '',\n        reportType: 'summary',\n        sendOn: 'always',\n      } satisfies TelegramReporterOptions,\n    ],\n  ],\n  use: {\n    baseURL: 'https://example.com',\n    trace: 'on-first-retry',\n  },\n});\n```\n\n## TypeScript Support\n\nFull TypeScript definitions are included. Import types for better type safety:\n\n```typescript\nimport type {\n  TelegramReporterOptions,\n  ReportType,\n  SendOn,\n} from '@b3nab/playwright-telegram-reporter';\n\nconst options: TelegramReporterOptions = {\n  botToken: 'your-token',\n  chatId: 'your-chat-id',\n  reportType: 'summary',\n  sendOn: 'failure',\n};\n```\n\nYou can also use the `satisfies` operator for inline type checking:\n\n```typescript\nimport { defineConfig } from '@playwright/test';\nimport type { TelegramReporterOptions } from '@b3nab/playwright-telegram-reporter';\n\nexport default defineConfig({\n  reporter: [\n    [\n      '@b3nab/playwright-telegram-reporter',\n      {\n        botToken: process.env.TELEGRAM_BOT_TOKEN || '',\n        chatId: process.env.TELEGRAM_CHAT_ID || '',\n        reportType: 'detailed',\n        sendOn: 'failure',\n      } satisfies TelegramReporterOptions,\n    ],\n  ],\n});\n```\n\n## API Reference\n\n### TelegramReporterOptions\n\n| Option | Type | Required | Default | Description |\n|--------|------|----------|---------|-------------|\n| `botToken` | `string` | ✅ Yes | - | Telegram Bot Token from @BotFather |\n| `chatId` | `string` | ✅ Yes | - | Telegram Chat ID where messages are sent |\n| `reportType` | `'simple' \\| 'summary' \\| 'detailed'` | No | `'detailed'` | Report type: **simple** (pass/fail), **summary** (counts + duration), **detailed** (all tests + summary) |\n| `customFormatter` | `(result, suite) => string` | No | - | Custom function to format the entire message |\n| `sendOn` | `'always' \\| 'failure' \\| 'success'` | No | `'always'` | When to send: **always**, **failure** only, or **success** only |\n| `title` | `string \\| ((passed) => string)` | No | `'✅/❌ Playwright Test Results'` | Custom title for the report. Can be string or function |\n| `testFormat` | `string` | No | `'{GROUP} › {TEST} ({TIME})'` | Template for test names. Variables: `{GROUP}`, `{TEST}`, `{TIME}`, `{BROWSER}`, `{FILENAME}` |\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n### Development Setup\n\n```bash\n# Clone the repository\ngit clone https://github.com/b3nab/playwright-telegram-reporter.git\ncd playwright-telegram-reporter\n\n# Install dependencies\npnpm install\n\n# Run linter\npnpm run lint\n\n# Build the project\npnpm run build\n\n# Run tests (requires Telegram credentials)\npnpm test\n```\n\n## License\n\nAGPL-3.0-only\n\n## Author\n\nBenedetto Abbenanti\n- Website: [ben.abbenanti.com](https://ben.abbenanti.com)\n\n## Links\n\n- [npm Package](https://www.npmjs.com/package/@b3nab/playwright-telegram-reporter)\n- [GitHub Repository](https://github.com/b3nab/playwright-telegram-reporter)\n- [Playwright Documentation](https://playwright.dev)\n- [Telegram Bot API](https://core.telegram.org/bots/api)\n","readmeFilename":"README.md"}