{"id":20390472,"url":"https://github.com/checkly/puppeteer-to-playwright","last_synced_at":"2025-04-12T11:21:26.400Z","repository":{"id":41303802,"uuid":"438955342","full_name":"checkly/puppeteer-to-playwright","owner":"checkly","description":"Puppeteer to Playwright conversion script","archived":false,"fork":false,"pushed_at":"2023-05-09T13:32:59.000Z","size":136,"stargazers_count":141,"open_issues_count":0,"forks_count":7,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-11T16:07:36.799Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/checkly.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2021-12-16T10:51:36.000Z","updated_at":"2025-03-01T01:43:11.000Z","dependencies_parsed_at":"2024-11-15T03:25:44.854Z","dependency_job_id":"89f4497c-c669-4d83-8a6d-6c372b0b9831","html_url":"https://github.com/checkly/puppeteer-to-playwright","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/checkly%2Fpuppeteer-to-playwright","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/checkly%2Fpuppeteer-to-playwright/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/checkly%2Fpuppeteer-to-playwright/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/checkly%2Fpuppeteer-to-playwright/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/checkly","download_url":"https://codeload.github.com/checkly/puppeteer-to-playwright/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248558128,"owners_count":21124223,"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","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":[],"created_at":"2024-11-15T03:25:08.719Z","updated_at":"2025-04-12T11:21:26.368Z","avatar_url":"https://github.com/checkly.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp\u003e\n  \u003cimg height=\"128\" src=\"https://cdn.checklyhq.com/logos/racoon_logo.svg\" align=\"right\" /\u003e\n  \u003ch1\u003epuppeteer-to-playwright\u003c/h1\u003e\n\u003c/p\u003e\n\n\u003cp\u003e\n  \u003cimg src=\"https://img.shields.io/github/workflow/status/checkly/puppeteer-to-playwright/test\" alt=\"Github Action - CI Test\"/\u003e\n  \u003cimg src=\"https://img.shields.io/github/package-json/v/checkly/puppeteer-to-playwright\" alt=\"Github package.json Version\" /\u003e\n\u003c/p\u003e\n\u003cbr /\u003e\n\n`puppeteer-to-playwright` automatically converts Javascript Puppeteer scripts to Playwright, aiming to reduce the amount of manual work involved in such a migration (ideally reducing it to zero). It is heavily based on [jscodeshift](https://github.com/facebook/jscodeshift).\n\n\u003e puppeteer-to-playwright requires Node.js 14 or newer.\n\n### Features\n\n`puppeteer-to-playwright` will convert your existing Puppeteer script to Playwright, including:\n\n- Converting import statements\n- Converting basic methods to match new API (e.g. `setViewport` to `setViewportSize` and similar)\n- Creating browser context explicitly\n- Eliminating explicit waiting (unless [Strict mode is enabled](#strict-mode))\n- Converting cookies-related commands\n\n### Currently unsupported\n\nThe following features are not yet supported, meaning that the corresponding instructions won't be converted to Playwright if they are used in your Puppeteer script:\n\n- File upload\n- File download\n- Request/response interception\n- Multiple contexts / tabs\n\nStill, these might very well be implemented in the near future. If you would like to help, see our [how to contribute](#-how-to-contribute) section.\n\n\u003cbr\u003e\n\n##  Getting Started\n\nYou can use `puppeteer-to-playwright` on a script file or multiple scripts at a time.\n\n\u003e 🚨 _It will overwrite the script file when run_, so we recommend doing a dry-run first.\n\n### Dry run\n\nA dry run will run the conversion without actually writing to the file(s) you point it at.\n\n```\n$ npm run convert -- -d my-puppeteer-script.js\n```\n\nYou can add `-p` to print out the resulting script:\n\n```\n$ npm run convert -- -d -p my-puppeteer-script.js\n```\n\n\u003e You can pass additional jscodeshift parameters as described in the [project's repository]((https://github.com/facebook/jscodeshift)).\n\n### Convert script\n\nYou can convert scripts one by one...\n\n```\n$ npm run convert my-puppeteer-script.js\n```\n\n...or you can convert entire folders recursively.\n\n```\n$ npm run convert my-puppeteer-folder\n```\n\n\u003e puppeteer-to-playwright will ignore files that have any extension other than `.js`, as well as those that do not import/require Puppeteer.\n\n### Strict mode\n\nWhen converting files, puppeteer-to-playwright will, by default, get rid of likely unnecessary waits that Playwright should handle automatically. If you know that the waits in your Puppeteer script will remain necessary even with Playwright, you can set puppeteer-to-playwright to Strict mode by running `export STRICT=true`. Alternatively, you can set the flag directly when converting a file or folder, e.g.: \n```STRICT=true npm run convert my-puppeteer-folder```\n\n\u003cbr\u003e\n\n## How to contribute\n\nIf you would like to improve this codemod, you are very welcome to send a PR. Make sure it contains a test for the specific feature you are trying to add. Testing is currently set up as follows:\n\n1. In `test/base` you have the original Puppeteer script\n2. In `test/output` you have the original Puppeteer script, which will be automatically converted when tests are run then immediately restored to the original\n3. In `test/expected` you have the expected Playwright script that your result will need to be equal to\n\nYou can run `npm run test` locally, and tests will run automatically for each new PR.\n\n\u003cbr\u003e\n\n## Links\n\n- [jscodeshift](https://github.com/facebook/jscodeshift) - without which this project wouldn't be possible.\n- [ASTExplorer](https://astexplorer.net/) - useful debugging tool in case you would like to modify the transform file of this project to tweak its output.\n\n\u003cbr\u003e\n\n## License\n\u003cbr\u003e\n\n[MIT](https://github.com/checkly/puppeteer-to-playwright/blob/main/LICENSE)\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://checklyhq.com?utm_source=github\u0026utm_medium=sponsor-logo-github\u0026utm_campaign=puppeteer-to-playwright\" target=\"_blank\"\u003e\n  \u003cimg width=\"100px\" src=\"https://cdn.checklyhq.com/logos/checkly_racoon_logo_horizontal.svg\" alt=\"Checkly\" /\u003e\n  \u003c/a\u003e\n  \u003cbr /\u003e\n  \u003ci\u003e\u003csub\u003eCode, test, and deploy synthetic monitoring at scale\u003c/sub\u003e\u003c/i\u003e\n  \u003cbr\u003e\n  \u003cb\u003e\u003csub\u003eFrom Checkly with ♥️\u003c/sub\u003e\u003c/b\u003e\n\u003cp\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheckly%2Fpuppeteer-to-playwright","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcheckly%2Fpuppeteer-to-playwright","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheckly%2Fpuppeteer-to-playwright/lists"}