You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: release v1.24.1 with a new CLAUDE.md template for project instructions, improved locator strategies in documentation, and enhancements to the setup script for automatic CLAUDE.md installation
Copy file name to clipboardExpand all lines: CHANGELOG.md
+15Lines changed: 15 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,20 @@
1
1
# Changelog
2
2
3
+
## [1.24.1] - 2026-03-17
4
+
5
+
### Added
6
+
7
+
-**CLAUDE.md template:** New `templates/CLAUDE.md` with project overview, structure, conventions, and AI tooling for Playwright TypeScript projects. Setup script copies it to the project root when installing skills (unless one exists; use `--force` to overwrite).
8
+
-**Setup (bin/setup.js):** When installing skills, setup now installs the CLAUDE.md template and links the Cursor project rule so Cursor and Claude Code share the same project instructions.
9
+
10
+
### Changed
11
+
12
+
-**Locators skill (references/locators.md):** Priority reordered so unique **XPath/CSS with stable attributes** come before **role/text** locators. Prefer stable selectors so failures distinguish "element missing" (bug) from "copy/locale changed." Added checkout-complete example using `[data-test="complete-header"]` and asserting text separately.
13
+
-**Sauce Demo checkout page:**`orderCompleteMessage` now uses stable selector `getLocator('[data-test="complete-header"]')` instead of `getLocatorByRole('heading', { name: /thank you for your order/i })`; text is still asserted in `expectElementToContainText`.
14
+
-**Package:**`overrides` added so `playwright` resolves to stable only (`^1.58.2`) when using `@playwright/cli`; `templates` included in published `files`.
15
+
-**Agents:** Minor updates to playwright-test-generator, playwright-test-healer, and playwright-test-planner.
16
+
-**Cursor rules / README:** Small updates for project and docs.
|**CLAUDE.md loader** — links your `CLAUDE.md` into Cursor |`.cursor/rules/project.mdc`| Cursor |
98
+
|**CLAUDE.md loader** — links `CLAUDE.md` into Cursor|`.cursor/rules/project.mdc`| Cursor |
98
99
99
-
Files are **copied** (not symlinked) into your project. Both Claude Code and Cursor auto-discover `.claude/skills/`. Claude Code also auto-discovers `.claude/agents/`. Cursor uses `.cursor/rules/` to reference agent files. If your project has a `CLAUDE.md`, the setup also creates a Cursor rule that loads it via `@file CLAUDE.md`, so both tools share the same project instructions.
100
+
Files are **copied** (not symlinked) into your project. Both Claude Code and Cursor auto-discover `.claude/skills/`. Claude Code also auto-discovers `.claude/agents/`. Cursor uses `.cursor/rules/` to reference agent files. The setup copies a `CLAUDE.md` template to your project root (skipped if one already exists) and creates a Cursor rule that loads it via `@file CLAUDE.md`, so both tools share the same project instructions.
Copy file name to clipboardExpand all lines: agents/playwright-test-generator.md
+9-8Lines changed: 9 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -92,10 +92,11 @@ For each test you generate:
92
92
93
93
## Required Test Structure
94
94
95
+
**Preferred: Use project's page-setup** (automatically calls `setPage(page)` before each test):
96
+
95
97
```typescript
96
-
import { test } from'@playwright/test';
98
+
import { test } from'@pagesetup';
97
99
import {
98
-
setPage,
99
100
gotoURL,
100
101
click,
101
102
clickAndNavigate,
@@ -123,8 +124,7 @@ import {
123
124
} from'vasu-playwright-utils';
124
125
125
126
test.describe('Test Suite Name', () => {
126
-
test('Test Case Name', async ({ page }) => {
127
-
setPage(page);
127
+
test('Test Case Name', async () => {
128
128
// 1. Navigate to the application
129
129
awaitgotoURL('https://example.com');
130
130
@@ -141,6 +141,8 @@ test.describe('Test Suite Name', () => {
141
141
});
142
142
```
143
143
144
+
**Fallback (standalone, when @pagesetup is not available):** Import `test` from `@playwright/test`, destructure `{ page }`, and call `setPage(page)` manually.
145
+
144
146
<example-generation>
145
147
For following plan:
146
148
@@ -166,12 +168,11 @@ Following file is generated:
Copy file name to clipboardExpand all lines: agents/playwright-test-healer.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -125,7 +125,7 @@ Use standard Playwright CLI for running tests:
125
125
- Document your findings and reasoning for each fix
126
126
- Prefer robust, maintainable solutions over quick hacks
127
127
- Use `vasu-playwright-utils` functions for all test code
128
-
- Ensure `setPage(page)`is called intest setup before any utility functions
128
+
- Ensure tests import `test` from `@pagesetup` or `@fixturesetup` (which call `setPage(page)`automatically). If using `@playwright/test` directly, `setPage(page)` must be called manually.
129
129
- If multiple errors exist, fix them one at a time and retest
130
130
- Provide clear explanations of what was broken and how you fixed it
131
131
- Continue until the test runs successfully without any failures or errors
When choosing locators for test code, follow this priority order (best to worst). Always prefer the highest-priority strategy that uniquely identifies the element.
7
+
When choosing locators for test code, follow this priority order (best to worst). **Prefer unique CSS or XPath with stable attributes over text-based locators** so that when a check fails you can tell quickly whether the element is missing (bug) or the copy changed (new functionality / locale).
8
8
9
9
### 1. `data-testid` attributes (Best)
10
10
@@ -23,8 +23,11 @@ Custom data attributes that carry stable, semantic meaning.
awaitexpectElementToContainText(orderCompleteMessage(),/thank you for your order/i);
85
+
```
86
+
87
+
### 7. Playwright built-in locators (role / text) — use only when no stable selector exists
88
+
89
+
Text- and role-based locators are **flaky**: they change with copy, locale, and country. If the only way to find an element is by its text, a failure does not tell you whether the element is missing (bug) or the wording changed (new feature / i18n). Prefer **data-testid**, **data-\***, **id**, or **unique CSS/XPath** first.
// By visible text — avoid for assertions; use stable selector + assert text separately
105
+
awaitclick(getLocatorByText('Add to cart'));
106
+
```
107
+
108
+
**Assertions:** Prefer a **stable locator** for the element and assert the **text in the assertion**. That way a failure shows "expected text X, got Y" (copy change) vs element not found (bug).
0 commit comments