feat: playwright extension
Closes #
✅ Checklist
- [x] I have followed every step in the contributing guide
- [x] The PR title follows the convention.
- [x] I ran and tested the code works
Testing
Made sure it works with all browsers
Screenshots
Summary by CodeRabbit
-
New Features
- Introduced a browser automation extension that supports Playwright, offering enhanced automation capabilities with Chromium, Firefox, and WebKit.
- Integrated an automated task for running browser tests—including webpage interactions and screenshot capture.
- Updated build and configuration settings to streamline dependency installation and execution of browser automation tasks.
- Added Playwright as a new dependency to enhance functionality.
🦋 Changeset detected
Latest commit: a7038944c8a829032e3886a6ea05f7be7aec62d8
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
## Walkthrough
This update incorporates a new Playwright extension into the project. The changes update package configuration files to export Playwright modules, include corresponding type definitions, and list the new extension in distribution files. A new TypeScript implementation for the Playwright extension is added, which validates browser options and constructs shell commands for dependency installation and environment setup. Additionally, a new Playwright test task has been introduced along with the integration of the extension into the system’s build configuration.
## Changes
| File(s) | Change Summary |
|-------------------------------------------------------------------------------------------------|----------------|
| `packages/build/package.json`<br>`references/v3-catalog/package.json` | Updated package configurations: added new export, `typesVersions`, and files entries for the Playwright extension in the build package; added `"playwright": "^1.50.1"` dependency in the v3-catalog package. |
| `packages/build/src/extensions/playwright.ts` | Added new file implementing the Playwright extension, including browser configuration, dependency installation commands, and environment variable setup. |
| `references/v3-catalog/src/trigger/playwrightTask.ts` | Introduced a new task for browser automation using Playwright; the task launches a browser instance, navigates to a URL, takes a screenshot, and logs progress. |
| `references/v3-catalog/trigger.config.ts` | Modified the build configuration to import and include the new Playwright extension in the extensions array. |
| `.changeset/itchy-frogs-care.md`<br>`.changeset/witty-donkeys-unite.md` | Added changeset files documenting patch updates: one for logging image sizes in self-hosted deployments and one for adding the Playwright extension. |
| `.github/workflows/unit-tests.yml` | Updated GitHub Actions workflow to conditionally perform DockerHub login based on presence of credentials, with fallback message if missing. |
| `docs/config/extensions/playwright.mdx` | Added new documentation for the Playwright build extension, including usage, configuration options, and task lifecycle management examples. |
## Possibly related PRs
- #1323: Adds a Puppeteer extension with similar structure and build integration, related as a parallel browser automation extension.
- #1347: Provides general documentation on creating custom build extensions, related by topic but not overlapping code.
## Poem
> I'm a bouncy rabbit with a joyful cheer,
> Hopping through code as new features appear.
> Playwright joins the crew with a clack and a snap,
> Automating browsers in a merry little tap.
> With every hop in the build, I'm all ears — 🐰✨
[!TIP]
⚡️ Faster reviews with caching
- CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure
Review - Disable Cacheat either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off theData Retentionsetting under your Organization Settings.Enjoy the performance boost—your workflow just got faster.
✨ Finishing Touches
- [ ] 📝 Generate Docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
-
I pushed a fix in commit <commit_id>, please review it. -
Explain this complex logic. -
Open a follow-up GitHub issue for this discussion.
-
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:-
@coderabbitai explain this code block. -
@coderabbitai modularize this function.
-
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:-
@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase. -
@coderabbitai read src/utils.ts and explain its main purpose. -
@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format. -
@coderabbitai help me debug CodeRabbit configuration file.
-
Support
Need help? Create a ticket on our support page for assistance with any issues or questions.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
-
@coderabbitai pauseto pause the reviews on a PR. -
@coderabbitai resumeto resume the paused reviews. -
@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository. -
@coderabbitai full reviewto do a full review from scratch and review all the files again. -
@coderabbitai summaryto regenerate the summary of the PR. -
@coderabbitai generate docstringsto generate docstrings for this PR. -
@coderabbitai generate sequence diagramto generate a sequence diagram of the changes in this PR. -
@coderabbitai resolveresolve all the CodeRabbit review comments. -
@coderabbitai configurationto show the current CodeRabbit configuration for the repository. -
@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
when will this merge?
Thanks a lot for this @MendyLanda! Will take a look very soon :crossed_fingers: (will have to add some tests for image sizes)
@Davidkle sorry for the late reply. The great thing about build extensions is you don't need to wait for them to merge. You can write your own in your local project. In this case, just save playwright.ts and then import and use the extension as usual.
@nicktrn i can write these tests, but i need to know what you're looking for.
Is there a limit on the build image size that we shouldn't surpass? I haven't seen it documented anywhere
Also, fyi the image size will be very close to what you'd get if running npx playwright install --with-deps would've been possible. Actually it most likely be smaller since the npx command installs all browsers by default, while we force the user to specify what browsers they need, or just install chromium.
Or perhaps you want to alert the user when the build image is over a certain size?