{"id":15151828,"url":"https://github.com/daroshchanka/playwright-typescript-starter","last_synced_at":"2026-02-05T06:03:06.398Z","repository":{"id":257023374,"uuid":"856058448","full_name":"daroshchanka/playwright-typescript-starter","owner":"daroshchanka","description":"Playwright typescript test automation project boilerplate including packages structure, reporting, logging, multi-env run configuration for WEB and API test automation.","archived":false,"fork":false,"pushed_at":"2024-10-02T19:27:33.000Z","size":399,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-18T03:44:23.336Z","etag":null,"topics":["api-automation-testing","boilerplate","playwright","qa-automation","test-automation","test-automation-framework","typescript","web-automation-testing"],"latest_commit_sha":null,"homepage":"","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/daroshchanka.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-09-11T23:14:13.000Z","updated_at":"2024-10-02T19:27:36.000Z","dependencies_parsed_at":"2024-09-14T11:48:06.531Z","dependency_job_id":"397ff88a-2c7a-4759-8c5b-c4cf848bfffa","html_url":"https://github.com/daroshchanka/playwright-typescript-starter","commit_stats":null,"previous_names":["daroshchanka/playwright-typescript-starter"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/daroshchanka/playwright-typescript-starter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daroshchanka%2Fplaywright-typescript-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daroshchanka%2Fplaywright-typescript-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daroshchanka%2Fplaywright-typescript-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daroshchanka%2Fplaywright-typescript-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daroshchanka","download_url":"https://codeload.github.com/daroshchanka/playwright-typescript-starter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daroshchanka%2Fplaywright-typescript-starter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29114500,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T05:31:32.482Z","status":"ssl_error","status_checked_at":"2026-02-05T05:31:29.075Z","response_time":65,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["api-automation-testing","boilerplate","playwright","qa-automation","test-automation","test-automation-framework","typescript","web-automation-testing"],"created_at":"2024-09-26T15:22:18.986Z","updated_at":"2026-02-05T06:03:06.383Z","avatar_url":"https://github.com/daroshchanka.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## playwright-typescript-starter\n\nTest automation project boilerplate including packages structure, reporting, logging, multi-env run configuration for WEB and API test automation.\n\nPure Playwright APIs wrapped a little to add more logs/traceability to test execution and to make theirs usage less-verbose in tests.\n\nOptionally Database and Email utils added as the example how the project can be extended.\n\n#### Built with\n\n| Type               | Tool/lib                                                        |\n|--------------------|-----------------------------------------------------------------|\n| Lang               | Typescript                                                      |\n| Build/Management   | npm                                                             |\n| Web/API Automation | playwright                                                      |\n| Test Runner        | @playwright/test                                                |\n| Logger             | tslog                                                           |\n| Reporting          | Allure (allure-playwright) + Playwright html (@playwright/test) |\n\n### Project Structure\n\n- `src/core`  - project-agnostic code, common for any product/project to be automated\n- `src/project`  - project-specific base code, including objects and utils for the particular project (pageobjects for web, services for api, utils, datagenerators, etc.)\n- `src/test` - project test specs, grouped by directories, components, etc. also test config definition is there (base urls, etc.)\n\n\n### Quick Start\n\n_Do 4 steps_:\n- `npm install` - install dependencies\n- `npm run install-playwright` - install playwright browsers + dependencies\n- `npm run health-check` - run `test/health-check.spec.ts` spec\n- `npm run show-report-playwright` or `npm run show-report-allure` - show reports\n\n#### Explore examples\n\n- WEB automation: `project/booking/`, `test/booking/`\n- API automation: `project/httpbin/`, `test/httpbin/`\n- HYBRID WEB+API spec: `test/hybrid-web-api.spec.ts`\n\n#### Run tests\n\n_Short run commands from the`package.json`_:\n\n- `npm run test-booking`\n- `npm run test-httpbin`\n\n_See the full commands_:\n\n```shell\nnpm run clean \u0026\u0026 npx playwright test ./src/test/httpbin/ --project=chromium\n```\n\n```shell\nnpm run clean \u0026\u0026 npx playwright test ./src/test/booking/ --project=chromium --workers 4\n```\n\n- `--project` should be always provided not to cause the tests executed multiple times per each project \n    defined in `playwright.config.ts`. For api tests `--project` also should be provided, but will not take any effect.\n- `--workers` option defines thread-count for parallel test execution, 1 worker is the default behaviour\n\n\n#### Reporting\n\n- `npm run show-report-playwright` - Default playwright report (static report generated to `output/html`)\n- `npm run show-report-allure` - Allure report (static report generated to `output/allure-report`)\n\n![](.assets/web-report-example.png)\n![](.assets/api-report-example.png)\n\n### Configuration\n\n#### Playwright Test configuration\n\n`playwright.config.ts` placed in the project root, it's provided by `@playwright/test` and no customizations added in the framework to handle it.\n\nIt allows to configure Playwright tool itself and also tests/reports.\n\nImportant concept here is the ability to define _projects_ - a set of launch configs grouped under some name, easy to refer in the test run command.\n\n_Example_:\n\n```typescript\nimport { PlaywrightTestConfig, devices, defineConfig } from '@playwright/test';\nconst ENV = process.env.ENV;\n\n// have to define viewport, global ignored https://github.com/microsoft/playwright/issues/13673\nconst viewport = {\n  width: 1920,\n  height: 1080,\n}\n\nexport default defineConfig({\n\n  testDir: './src/test',\n\n  /* Maximum time one test can run for. */\n  timeout: 180 * 1000,\n  expect: {\n    timeout: 5000\n  },\n  reportSlowTests: {\n    max: 5,\n    threshold: 30 * 1000\n  },\n  outputDir: './output/test-results',\n\n  /* Fail the build on CI if you accidentally left test.only in the source code. */\n  forbidOnly: !!process.env.CI,\n  retries: process.env.CI ? 2 : 0,\n  workers: process.env.CI ? 1 : undefined,\n\n  reporter: [\n    ['html', { open: 'never', outputFolder: './output/html' }],\n    ['allure-playwright', { outputFolder: './output/allure-results' }],\n    ['junit', { outputFile: './output/junit-results/results.xml' }]\n  ],\n\n  use: {\n    viewport: viewport,\n    screenshot: 'on',\n    trace: 'on-first-retry',\n    actionTimeout: 10000,\n    locale: 'en-GB',\n    launchOptions: {\n      slowMo: 100,\n    },\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: {\n        ...devices['Desktop Chrome'],\n        viewport: viewport, // have to define viewport\n        channel: 'chrome',\n        headless: true,\n        launchOptions: {\n          args: [\"--disable-dev-shm-usage\", '--disable-blink-features=AutomationControlled'],\n          ignoreDefaultArgs: ['--disable-component-extensions-with-background-pages'],\n          slowMo: 100,\n        }\n      },\n    },\n    {\n      name: 'msedge',\n      use: {\n        ...devices['Desktop Edge'],\n        viewport: viewport, // have to define viewport\n        channel:'msedge',\n        headless: true,\n        launchOptions: {\n          args: [\"--disable-dev-shm-usage\", '--disable-blink-features=AutomationControlled'],\n          ignoreDefaultArgs: ['--disable-component-extensions-with-background-pages'],\n          slowMo: 100,\n        }\n      },\n    },\n    {\n      name: 'firefox',\n      use: {\n        ...devices['Desktop Firefox'],\n        viewport: viewport, // have to define viewport\n      },\n    },\n    {\n      name: 'webkit',\n      use: {\n        ...devices['Desktop Safari'],\n        viewport: viewport, // have to define viewport\n      },\n    },\n  ],\n\n});\n```\nsee the full [reference](https://playwright.dev/docs/test-configuration).\n\n\n#### Multi-env configuration\n\nIn the examples `process.env.npm_config_ENV` variable used to figure out the proper test configs.\n\n```\nstatic instance: TestConfig = new TestConfig(process.env.npm_config_ENV == undefined ? 'dev' : process.env.npm_config_ENV);\n```\n\nSo, to switch env just provide `--ENV` in command-line.\n\n- `npm run test-httpbin --ENV=dev` \n- `npm run test-httpbin --ENV=stage` \n\nUnknown or missing env value will be mapped to `dev`.\n\n#### Per test-project configuration\n\nEach test-project example goes with the `test/{projectName}/{projectName}TestConfigs.ts` \nscript where the configs resolved based on the `--ENV` value.\n\n_Example:_\n\n```typescript\nexport class BookingTestConfig {\n\n    readonly env: string;\n    private readonly envConfigs: any;\n\n    static instance: BookingTestConfig = new BookingTestConfig(process.env.npm_config_ENV == undefined ? 'dev' : process.env.npm_config_ENV);\n\n    private devEnv = {\n        web: { baseUrl: 'https://www.booking-dev.com' },\n        api: { baseUrl: 'https://www.api.booking-dev.com' },\n    }\n\n    private qaEnv = {\n        web: { baseUrl: 'https://www.booking-qa.com' },\n        api: { baseUrl: 'https://www.api.booking-qa.com' },\n    }\n\n    private stageEnv = {\n        web: { baseUrl: 'https://www.booking-stage.com' },\n        api: { baseUrl: 'https://www.api.booking-stage.com' },\n    }\n\n    private constructor(env: string) {\n        this.env = (env == undefined ? 'dev' : env).toLocaleLowerCase();;\n        switch (env) {\n            case 'qa': {\n                this.envConfigs = this.qaEnv;\n                break;\n            }\n            case 'stage': {\n                this.envConfigs = this.stageEnv;\n                break;\n            }\n            default: {\n                this.envConfigs = this.devEnv;\n                break;\n            }\n        }\n    }\n\n    getWebBaseUrl(): string {\n        return this.envConfigs.web.baseUrl;\n    }\n\n    getApiBaseUrl(): string {\n        return this.envConfigs.api.baseUrl;\n    }\n}\n```\n\n\n### Other Implementations\n\n- [playwright-groovy-starter](https://github.com/daroshchanka/playwright-groovy-starter)\n- [playwright-python-starter](https://github.com/daroshchanka/playwright-python-starter)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaroshchanka%2Fplaywright-typescript-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaroshchanka%2Fplaywright-typescript-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaroshchanka%2Fplaywright-typescript-starter/lists"}