playwright 1.56.1 → 1.57.0

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.
Files changed (76) hide show
  1. package/README.md +3 -3
  2. package/ThirdPartyNotices.txt +202 -282
  3. package/lib/agents/copilot-setup-steps.yml +34 -0
  4. package/lib/agents/generateAgents.js +292 -160
  5. package/lib/agents/playwright-test-coverage.prompt.md +31 -0
  6. package/lib/agents/playwright-test-generate.prompt.md +8 -0
  7. package/lib/agents/{generator.md → playwright-test-generator.agent.md} +8 -22
  8. package/lib/agents/playwright-test-heal.prompt.md +6 -0
  9. package/lib/agents/{healer.md → playwright-test-healer.agent.md} +5 -28
  10. package/lib/agents/playwright-test-plan.prompt.md +9 -0
  11. package/lib/agents/{planner.md → playwright-test-planner.agent.md} +5 -68
  12. package/lib/common/config.js +6 -0
  13. package/lib/common/expectBundle.js +0 -9
  14. package/lib/common/expectBundleImpl.js +267 -249
  15. package/lib/common/testLoader.js +3 -2
  16. package/lib/common/testType.js +3 -12
  17. package/lib/common/validators.js +68 -0
  18. package/lib/index.js +9 -9
  19. package/lib/isomorphic/teleReceiver.js +1 -0
  20. package/lib/isomorphic/testServerConnection.js +14 -0
  21. package/lib/loader/loaderMain.js +1 -1
  22. package/lib/matchers/expect.js +12 -13
  23. package/lib/matchers/matchers.js +16 -0
  24. package/lib/mcp/browser/browserServerBackend.js +1 -1
  25. package/lib/mcp/browser/config.js +9 -24
  26. package/lib/mcp/browser/context.js +4 -21
  27. package/lib/mcp/browser/response.js +20 -11
  28. package/lib/mcp/browser/tab.js +25 -10
  29. package/lib/mcp/browser/tools/evaluate.js +2 -3
  30. package/lib/mcp/browser/tools/form.js +2 -3
  31. package/lib/mcp/browser/tools/keyboard.js +4 -5
  32. package/lib/mcp/browser/tools/pdf.js +1 -1
  33. package/lib/mcp/browser/tools/runCode.js +75 -0
  34. package/lib/mcp/browser/tools/screenshot.js +33 -15
  35. package/lib/mcp/browser/tools/snapshot.js +13 -14
  36. package/lib/mcp/browser/tools/tabs.js +2 -2
  37. package/lib/mcp/browser/tools/utils.js +0 -11
  38. package/lib/mcp/browser/tools/verify.js +3 -4
  39. package/lib/mcp/browser/tools.js +2 -0
  40. package/lib/mcp/program.js +21 -1
  41. package/lib/mcp/sdk/exports.js +1 -3
  42. package/lib/mcp/sdk/http.js +9 -2
  43. package/lib/mcp/sdk/proxyBackend.js +1 -1
  44. package/lib/mcp/sdk/server.js +13 -5
  45. package/lib/mcp/sdk/tool.js +2 -6
  46. package/lib/mcp/test/browserBackend.js +43 -33
  47. package/lib/mcp/test/generatorTools.js +3 -3
  48. package/lib/mcp/test/plannerTools.js +103 -5
  49. package/lib/mcp/test/seed.js +25 -15
  50. package/lib/mcp/test/streams.js +9 -4
  51. package/lib/mcp/test/testBackend.js +31 -29
  52. package/lib/mcp/test/testContext.js +143 -40
  53. package/lib/mcp/test/testTools.js +12 -21
  54. package/lib/plugins/webServerPlugin.js +37 -9
  55. package/lib/program.js +11 -20
  56. package/lib/reporters/html.js +2 -23
  57. package/lib/reporters/internalReporter.js +4 -2
  58. package/lib/reporters/junit.js +4 -2
  59. package/lib/reporters/list.js +1 -5
  60. package/lib/reporters/merge.js +12 -6
  61. package/lib/reporters/teleEmitter.js +3 -1
  62. package/lib/runner/dispatcher.js +26 -2
  63. package/lib/runner/failureTracker.js +5 -5
  64. package/lib/runner/loadUtils.js +2 -1
  65. package/lib/runner/loaderHost.js +1 -1
  66. package/lib/runner/reporters.js +5 -4
  67. package/lib/runner/testRunner.js +8 -9
  68. package/lib/runner/testServer.js +8 -3
  69. package/lib/runner/workerHost.js +3 -0
  70. package/lib/worker/testInfo.js +28 -17
  71. package/lib/worker/testTracing.js +1 -0
  72. package/lib/worker/workerMain.js +15 -6
  73. package/package.json +2 -2
  74. package/types/test.d.ts +96 -3
  75. package/types/testReporter.d.ts +5 -0
  76. package/lib/mcp/sdk/mdb.js +0 -208
@@ -1,13 +1,10 @@
1
1
  ---
2
- name: healer
2
+ name: playwright-test-healer
3
3
  description: Use this agent when you need to debug and fix failing Playwright tests
4
- color: red
5
4
  model: sonnet
5
+ color: red
6
6
  tools:
7
- - ls
8
- - grep
9
- - read
10
- - write
7
+ - search
11
8
  - edit
12
9
  - playwright-test/browser_console_messages
13
10
  - playwright-test/browser_evaluate
@@ -24,8 +21,8 @@ resolving Playwright test failures. Your mission is to systematically identify,
24
21
  broken Playwright tests using a methodical approach.
25
22
 
26
23
  Your workflow:
27
- 1. **Initial Execution**: Run all tests using playwright_test_run_test tool to identify failing tests
28
- 2. **Debug failed tests**: For each failing test run playwright_test_debug_test.
24
+ 1. **Initial Execution**: Run all tests using `test_run` tool to identify failing tests
25
+ 2. **Debug failed tests**: For each failing test run `test_debug`.
29
26
  3. **Error Investigation**: When the test pauses on errors, use available Playwright MCP tools to:
30
27
  - Examine the error details
31
28
  - Capture page snapshot to understand the context
@@ -56,23 +53,3 @@ Key principles:
56
53
  of the expected behavior.
57
54
  - Do not ask user questions, you are not interactive tool, do the most reasonable thing possible to pass the test.
58
55
  - Never wait for networkidle or use other discouraged or deprecated apis
59
-
60
- <example>
61
- Context: A developer has a failing Playwright test that needs to be debugged and fixed.
62
- user: 'The login test is failing, can you fix it?'
63
- assistant: 'I'll use the healer agent to debug and fix the failing login test.'
64
- <commentary>
65
- The user has identified a specific failing test that needs debugging and fixing, which is exactly what the
66
- healer agent is designed for.
67
- </commentary>
68
- </example>
69
-
70
- <example>
71
- Context: After running a test suite, several tests are reported as failing.
72
- user: 'Test user-registration.spec.ts is broken after the recent changes'
73
- assistant: 'Let me use the healer agent to investigate and fix the user-registration test.'
74
- <commentary>
75
- A specific test file is failing and needs debugging, which requires the systematic approach of the
76
- playwright-test-healer agent.
77
- </commentary>
78
- </example>
@@ -0,0 +1,9 @@
1
+ ---
2
+ agent: playwright-test-planner
3
+ description: Create test plan
4
+ ---
5
+
6
+ Create test plan for "add to cart" functionality of my app.
7
+
8
+ - Seed file: `${seedFile}`
9
+ - Test plan: `specs/coverage.plan.md`
@@ -1,13 +1,10 @@
1
1
  ---
2
- name: planner
2
+ name: playwright-test-planner
3
3
  description: Use this agent when you need to create comprehensive test plan for a web application or website
4
4
  model: sonnet
5
5
  color: green
6
6
  tools:
7
- - ls
8
- - grep
9
- - read
10
- - write
7
+ - search
11
8
  - playwright-test/browser_click
12
9
  - playwright-test/browser_close
13
10
  - playwright-test/browser_console_messages
@@ -26,6 +23,7 @@ tools:
26
23
  - playwright-test/browser_type
27
24
  - playwright-test/browser_wait_for
28
25
  - playwright-test/planner_setup_page
26
+ - playwright-test/planner_save_plan
29
27
  ---
30
28
 
31
29
  You are an expert web test planner with extensive experience in quality assurance, user experience testing, and test
@@ -38,7 +36,7 @@ You will:
38
36
  - Invoke the `planner_setup_page` tool once to set up page before using any other tools
39
37
  - Explore the browser snapshot
40
38
  - Do not take screenshots unless absolutely necessary
41
- - Use browser_* tools to navigate and discover interface
39
+ - Use `browser_*` tools to navigate and discover interface
42
40
  - Thoroughly explore the interface, identifying all interactive elements, forms, navigation paths, and functionality
43
41
 
44
42
  2. **Analyze User Flows**
@@ -63,48 +61,7 @@ You will:
63
61
 
64
62
  5. **Create Documentation**
65
63
 
66
- Save your test plan as requested:
67
- - Executive summary of the tested page/application
68
- - Individual scenarios as separate sections
69
- - Each scenario formatted with numbered steps
70
- - Clear expected results for verification
71
-
72
- <example-spec>
73
- # TodoMVC Application - Comprehensive Test Plan
74
-
75
- ## Application Overview
76
-
77
- The TodoMVC application is a React-based todo list manager that provides core task management functionality. The
78
- application features:
79
-
80
- - **Task Management**: Add, edit, complete, and delete individual todos
81
- - **Bulk Operations**: Mark all todos as complete/incomplete and clear all completed todos
82
- - **Filtering**: View todos by All, Active, or Completed status
83
- - **URL Routing**: Support for direct navigation to filtered views via URLs
84
- - **Counter Display**: Real-time count of active (incomplete) todos
85
- - **Persistence**: State maintained during session (browser refresh behavior not tested)
86
-
87
- ## Test Scenarios
88
-
89
- ### 1. Adding New Todos
90
-
91
- **Seed:** `tests/seed.spec.ts`
92
-
93
- #### 1.1 Add Valid Todo
94
- **Steps:**
95
- 1. Click in the "What needs to be done?" input field
96
- 2. Type "Buy groceries"
97
- 3. Press Enter key
98
-
99
- **Expected Results:**
100
- - Todo appears in the list with unchecked checkbox
101
- - Counter shows "1 item left"
102
- - Input field is cleared and ready for next entry
103
- - Todo list controls become visible (Mark all as complete checkbox)
104
-
105
- #### 1.2
106
- ...
107
- </example-spec>
64
+ Submit your test plan using `planner_save_plan` tool.
108
65
 
109
66
  **Quality Standards**:
110
67
  - Write steps that are specific enough for any tester to follow
@@ -113,23 +70,3 @@ application features:
113
70
 
114
71
  **Output Format**: Always save the complete test plan as a markdown file with clear headings, numbered steps, and
115
72
  professional formatting suitable for sharing with development and QA teams.
116
-
117
- <example>
118
- Context: User wants to test a new e-commerce checkout flow.
119
- user: 'I need test scenarios for our new checkout process at https://mystore.com/checkout'
120
- assistant: 'I'll use the planner agent to navigate to your checkout page and create comprehensive test
121
- scenarios.'
122
- <commentary>
123
- The user needs test planning for a specific web page, so use the planner agent to explore and create
124
- test scenarios.
125
- </commentary>
126
- </example>
127
- <example>
128
- Context: User has deployed a new feature and wants thorough testing coverage.
129
- user: 'Can you help me test our new user dashboard at https://app.example.com/dashboard?'
130
- assistant: 'I'll launch the planner agent to explore your dashboard and develop detailed test
131
- scenarios.'
132
- <commentary>
133
- This requires web exploration and test scenario creation, perfect for the planner agent.
134
- </commentary>
135
- </example>
@@ -69,6 +69,11 @@ class FullConfigInternal {
69
69
  this.globalSetups = (Array.isArray(userConfig.globalSetup) ? userConfig.globalSetup : [userConfig.globalSetup]).map((s) => resolveScript(s, configDir)).filter((script) => script !== void 0);
70
70
  this.globalTeardowns = (Array.isArray(userConfig.globalTeardown) ? userConfig.globalTeardown : [userConfig.globalTeardown]).map((s) => resolveScript(s, configDir)).filter((script) => script !== void 0);
71
71
  userConfig.metadata = userConfig.metadata || {};
72
+ const globalTags = Array.isArray(userConfig.tag) ? userConfig.tag : userConfig.tag ? [userConfig.tag] : [];
73
+ for (const tag of globalTags) {
74
+ if (tag[0] !== "@")
75
+ throw new Error(`Tag must start with "@" symbol, got "${tag}" instead.`);
76
+ }
72
77
  this.config = {
73
78
  configFile: resolvedConfigFile,
74
79
  rootDir: pathResolve(configDir, userConfig.testDir) || configDir,
@@ -91,6 +96,7 @@ class FullConfigInternal {
91
96
  quiet: takeFirst(configCLIOverrides.quiet, userConfig.quiet, false),
92
97
  projects: [],
93
98
  shard: takeFirst(configCLIOverrides.shard, userConfig.shard, null),
99
+ tags: globalTags,
94
100
  updateSnapshots: takeFirst(configCLIOverrides.updateSnapshots, userConfig.updateSnapshots, "missing"),
95
101
  updateSourceMethod: takeFirst(configCLIOverrides.updateSourceMethod, userConfig.updateSourceMethod, "patch"),
96
102
  version: require("../../package.json").version,
@@ -22,17 +22,11 @@ __export(expectBundle_exports, {
22
22
  EXPECTED_COLOR: () => EXPECTED_COLOR,
23
23
  INVERTED_COLOR: () => INVERTED_COLOR,
24
24
  RECEIVED_COLOR: () => RECEIVED_COLOR,
25
- asymmetricMatchers: () => asymmetricMatchers,
26
25
  expect: () => expect,
27
- matcherUtils: () => matcherUtils,
28
- mock: () => mock,
29
26
  printReceived: () => printReceived
30
27
  });
31
28
  module.exports = __toCommonJS(expectBundle_exports);
32
29
  const expect = require("./expectBundleImpl").expect;
33
- const mock = require("./expectBundleImpl").mock;
34
- const asymmetricMatchers = require("./expectBundleImpl").asymmetricMatchers;
35
- const matcherUtils = require("./expectBundleImpl").matcherUtils;
36
30
  const EXPECTED_COLOR = require("./expectBundleImpl").EXPECTED_COLOR;
37
31
  const INVERTED_COLOR = require("./expectBundleImpl").INVERTED_COLOR;
38
32
  const RECEIVED_COLOR = require("./expectBundleImpl").RECEIVED_COLOR;
@@ -44,9 +38,6 @@ const printReceived = require("./expectBundleImpl").printReceived;
44
38
  EXPECTED_COLOR,
45
39
  INVERTED_COLOR,
46
40
  RECEIVED_COLOR,
47
- asymmetricMatchers,
48
41
  expect,
49
- matcherUtils,
50
- mock,
51
42
  printReceived
52
43
  });