Plugin Overview

What is a plugin?

A Specwright plugin is a directory that overlays specific files on top of @specwright/plugin. It follows a simple two-file contract:

  • specwright.plugin.json — manifest that identifies the plugin and lists which files it replaces
  • install.sh — script that copies override files into the target project

Everything not explicitly overridden is inherited from the base plugin. You replace only what you need.

When to create one

Create a plugin when:

  • Your org uses a design system with components not covered by standard FIELD_TYPES — MUI, Ant Design, Chakra UI, or an internal design system. The base plugin handles standard HTML inputs; custom component libraries need custom interaction handlers.
  • Org-specific auth patterns — 2FA flows, SSO with redirect chains, LDAP, API token injection, or any login sequence that differs from the base email-password or oauth strategies.
  • You want to share customizations across multiple projects without copying files. One install command applies your org's patterns consistently to any new project.
  • You maintain internal tooling and want a one-command setup for new projects. Ship the plugin as an npm package and any engineer can run bash node_modules/my-org-e2e/install.sh . to get your full E2E setup.

Base plugin vs overlay

@specwright/pluginOverlay plugin
RoleOpen-source baseOrg- or library-specific additions
Authemail-password + oauthCustomizable per overlay
FIELD_TYPESStandard HTML inputsExtended for your component library
Distributionnpm (public)npm (public or private registry)

The published reference overlay is @specwright/plugin-mui (npmjs.com/package/@specwright/plugin-mui), which adds MUI Select, Autocomplete, DatePicker, and chip input support.

The override contract

Only these 7 files can be replaced. Everything else is locked to the base plugin.

SlotFileOverride when
1e2e-tests/utils/stepHelpers.jsAdding FIELD_TYPES for your component library
2e2e-tests/data/authenticationData.jsSetting real login selectors
3e2e-tests/playwright/auth-strategies/email-password.jsCustom post-login token saving
4.claude/agents/playwright/code-generator.mdTeaching the code-generator your UI patterns
5.claude/rules/dependencies.mdDocumenting your component library for agents
6e2e-tests/features/playwright-bdd/shared/navigation.steps.jsNavigation quirks (devtools overlays, banners)
7e2e-tests/features/playwright-bdd/shared/common.steps.jsOrg-specific shared steps

Note: playwright.config.ts is NOT overrideable. The base plugin already ships with all 8 test projects (setup, precondition, smoke, regression, workflow-consumers, etc.) configured correctly.

Plugin directory structure

my-org-e2e/
├── specwright.plugin.json   ← manifest
├── install.sh               ← copies overrides/ into the project
├── README.md
└── overrides/               ← 1–7 files, 1:1 path replacements
    ├── e2e-tests/
    │   ├── utils/stepHelpers.js
    │   └── data/authenticationData.js
    └── .claude/
        ├── agents/playwright/code-generator.md
        └── rules/dependencies.md

The overrides/ tree mirrors the target project's directory structure exactly. install.sh copies it over with cp -r overrides/. $TARGET/.

Next steps