playwright 1.56.0-beta-1759435110000 → 1.56.0-beta-1759451736000
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/agents/generator.md +1 -12
- package/lib/mcp/test/testContext.js +13 -0
- package/package.json +2 -2
package/lib/agents/generator.md
CHANGED
|
@@ -46,6 +46,7 @@ application behavior.
|
|
|
46
46
|
- Test title must match the scenario name
|
|
47
47
|
- Includes a comment with the step text before each step execution. Do not duplicate comments if step requires
|
|
48
48
|
multiple actions.
|
|
49
|
+
- Always use best practices from the log when generating tests.
|
|
49
50
|
|
|
50
51
|
<example-generation>
|
|
51
52
|
For following plan:
|
|
@@ -79,18 +80,6 @@ application behavior.
|
|
|
79
80
|
```
|
|
80
81
|
</example-generation>
|
|
81
82
|
|
|
82
|
-
# Best practices
|
|
83
|
-
- Each test has clear, descriptive assertions that validate the expected behavior
|
|
84
|
-
- Includes proper error handling and meaningful failure messages
|
|
85
|
-
- Uses Playwright best practices (page.waitForLoadState, expect.toBeVisible, etc.)
|
|
86
|
-
- Do not improvise, do not add directives that were not asked for
|
|
87
|
-
- Uses reliable locators (preferring data-testid, role-based, or text-based selectors over fragile CSS selectors)
|
|
88
|
-
- Uses local variables for locators that are used multiple times
|
|
89
|
-
- Uses explicit waits rather than arbitrary timeouts
|
|
90
|
-
- Never waits for networkidle or use other discouraged or deprecated apis
|
|
91
|
-
- Is self-contained and can run independently
|
|
92
|
-
- Is deterministic and not prone to flaky behavior
|
|
93
|
-
|
|
94
83
|
<example>
|
|
95
84
|
Context: User wants to test a login flow on their web application.
|
|
96
85
|
user: 'I need a test that logs into my app at localhost:3000 with username admin@test.com and password 123456, then
|
|
@@ -65,6 +65,7 @@ class GeneratorJournal {
|
|
|
65
65
|
\`\`\`ts
|
|
66
66
|
${step.code}
|
|
67
67
|
\`\`\``).join("\n\n"));
|
|
68
|
+
result.push(bestPracticesMarkdown);
|
|
68
69
|
return result.join("\n\n");
|
|
69
70
|
}
|
|
70
71
|
}
|
|
@@ -156,6 +157,18 @@ class TestContext {
|
|
|
156
157
|
async close() {
|
|
157
158
|
}
|
|
158
159
|
}
|
|
160
|
+
const bestPracticesMarkdown = `
|
|
161
|
+
# Best practices
|
|
162
|
+
- Do not improvise, do not add directives that were not asked for
|
|
163
|
+
- Use clear, descriptive assertions to validate the expected behavior
|
|
164
|
+
- Use reliable locators from this log
|
|
165
|
+
- Use local variables for locators that are used multiple times
|
|
166
|
+
- Use Playwright waiting assertions and best practices from this log
|
|
167
|
+
- NEVER! use page.waitForLoadState()
|
|
168
|
+
- NEVER! use page.waitForNavigation()
|
|
169
|
+
- NEVER! use page.waitForTimeout()
|
|
170
|
+
- NEVER! use page.evaluate()
|
|
171
|
+
`;
|
|
159
172
|
// Annotate the CommonJS export names for ESM import in node:
|
|
160
173
|
0 && (module.exports = {
|
|
161
174
|
GeneratorJournal,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "playwright",
|
|
3
|
-
"version": "1.56.0-beta-
|
|
3
|
+
"version": "1.56.0-beta-1759451736000",
|
|
4
4
|
"description": "A high-level API to automate web browsers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
},
|
|
65
65
|
"license": "Apache-2.0",
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"playwright-core": "1.56.0-beta-
|
|
67
|
+
"playwright-core": "1.56.0-beta-1759451736000"
|
|
68
68
|
},
|
|
69
69
|
"optionalDependencies": {
|
|
70
70
|
"fsevents": "2.3.2"
|