Playwright.el provides an Emacs interface for the Playwright testing framework, allowing users to run and interact with Playwright tests directly from Emacs. It supports various Playwright commands and offers a convenient popup interface using transient for selecting and executing these commands.
Ensure you have Playwright installed in your project or globally. You can install it using npm:
npm i -D @playwright/test
- Emacs version 29.1 or later is required as it’s all I’ve tested it on.
To install Playwright.el manually, clone the repository and add the following to your Emacs configuration:
(add-to-list 'load-path "/path/to/playwright.el")
(require 'playwright)
Replace “/path/to/playwright.el” with the actual path to the downloaded directory.
Playwright.el is not yet available on MELPA or other package repositories. Future releases aim to support this.
The package offers several commands which can be accessed through a popup menu. Use the shortcut C-c t p
to open the Playwright command popup. Available commands include:
- Run All Tests: Executes all Playwright tests.
- Run Single Test File: Prompts for a test file and runs it.
- Run Tests in Headed Mode: Executes tests in headed browsers.
- Run Tests with UI Mode: Runs tests in interactive UI mode.
- Run Tests with Debug Mode: Executes tests in debug mode with Playwright Inspector.
- Additional options: Allows running tests with specific flags and arguments such as –project, –workers, and custom flags.
Each command opens the output in a separate Emacs buffer, allowing you to view test results directly within Emacs.
Currently, Playwright.el does not require additional configuration. Future versions may include customizable variables to enhance user experience.
- [ ] Explore integration with project.el for project-specific Playwright configurations.
- [ ] Enhance error handling to provide more informative feedback within Emacs.
- [ ] Test and ensure compatibility with older versions of Emacs.
- [ ] Prepare for distribution on MELPA or other Emacs package repositories.
- [X] Add support for additional Playwright CLI ‘–’ options as interactive commands in the popup menu.
- [X] Add support for running tests on specific browsers (Chromium, Firefox, WebKit).
- [X] Add support for running tests with different reporter options.
- [X] Include customizable Emacs variables for default settings such as default browser or test directory.
Contributions to Playwright.el are welcome. Whether it’s adding new features, fixing bugs, or improving documentation, your help is appreciated.
Playwright.el is distributed under the GNU General Public License v3.0. See the LICENSE file for more details.
For questions or suggestions regarding Playwright.el, feel free to open an issue on the repo.
The makers of transient.el for making it easy to create popup menus in Emacs and making Magit! Anyone who loves using Emacs.