playwright-e2e-mcp 0.6.1 → 0.8.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 (104) hide show
  1. package/README.md +150 -24
  2. package/dist/cli/ci.js +3 -0
  3. package/dist/cli/ci.js.map +1 -1
  4. package/dist/cli/doctor.d.ts +12 -1
  5. package/dist/cli/doctor.js +34 -4
  6. package/dist/cli/doctor.js.map +1 -1
  7. package/dist/cli/guard.d.ts +11 -0
  8. package/dist/cli/guard.js +80 -0
  9. package/dist/cli/guard.js.map +1 -0
  10. package/dist/cli/upload.d.ts +14 -0
  11. package/dist/cli/upload.js +81 -0
  12. package/dist/cli/upload.js.map +1 -0
  13. package/dist/discovery.d.ts +61 -0
  14. package/dist/discovery.js +108 -0
  15. package/dist/discovery.js.map +1 -0
  16. package/dist/http.d.ts +10 -1
  17. package/dist/http.js +50 -4
  18. package/dist/http.js.map +1 -1
  19. package/dist/index.js +28 -1
  20. package/dist/index.js.map +1 -1
  21. package/dist/oauth.d.ts +2 -0
  22. package/dist/oauth.js +1 -1
  23. package/dist/oauth.js.map +1 -1
  24. package/dist/server.d.ts +24 -4
  25. package/dist/server.js +98 -15
  26. package/dist/server.js.map +1 -1
  27. package/dist/skills.d.ts +23 -0
  28. package/dist/skills.js +101 -0
  29. package/dist/skills.js.map +1 -0
  30. package/dist/tools/analyze-history.d.ts +15 -0
  31. package/dist/tools/analyze-history.js +44 -9
  32. package/dist/tools/analyze-history.js.map +1 -1
  33. package/dist/tools/audit-accessibility.d.ts +6 -0
  34. package/dist/tools/audit-performance.d.ts +6 -0
  35. package/dist/tools/check-test-change.d.ts +44 -0
  36. package/dist/tools/check-test-change.js +132 -0
  37. package/dist/tools/check-test-change.js.map +1 -0
  38. package/dist/tools/compare-visual-state.d.ts +6 -0
  39. package/dist/tools/diagnose-flaky.js +5 -1
  40. package/dist/tools/diagnose-flaky.js.map +1 -1
  41. package/dist/tools/generate-e2e-test.d.ts +3 -0
  42. package/dist/tools/generate-e2e-test.js +3 -0
  43. package/dist/tools/generate-e2e-test.js.map +1 -1
  44. package/dist/tools/get-failure.js +3 -1
  45. package/dist/tools/get-failure.js.map +1 -1
  46. package/dist/tools/get-run-status.js +8 -2
  47. package/dist/tools/get-run-status.js.map +1 -1
  48. package/dist/tools/inspect-page.d.ts +6 -0
  49. package/dist/tools/inspect-page.js +3 -1
  50. package/dist/tools/inspect-page.js.map +1 -1
  51. package/dist/tools/list-tests.js +16 -12
  52. package/dist/tools/list-tests.js.map +1 -1
  53. package/dist/tools/probe-script.js +181 -15
  54. package/dist/tools/probe-script.js.map +1 -1
  55. package/dist/tools/quarantine.d.ts +61 -0
  56. package/dist/tools/quarantine.js +133 -0
  57. package/dist/tools/quarantine.js.map +1 -0
  58. package/dist/tools/run-test.d.ts +10 -1
  59. package/dist/tools/run-test.js +38 -6
  60. package/dist/tools/run-test.js.map +1 -1
  61. package/dist/tools/save-login.d.ts +145 -0
  62. package/dist/tools/save-login.js +264 -0
  63. package/dist/tools/save-login.js.map +1 -0
  64. package/dist/tools/shared.d.ts +49 -2
  65. package/dist/tools/shared.js +57 -6
  66. package/dist/tools/shared.js.map +1 -1
  67. package/dist/tools/structured.d.ts +8 -1
  68. package/dist/tools/structured.js +8 -1
  69. package/dist/tools/structured.js.map +1 -1
  70. package/dist/tools/suggest-fix.js +4 -0
  71. package/dist/tools/suggest-fix.js.map +1 -1
  72. package/dist/tools/validate-selector.d.ts +6 -0
  73. package/dist/tools/validate-selector.js +10 -2
  74. package/dist/tools/validate-selector.js.map +1 -1
  75. package/dist/types/index.d.ts +1 -1
  76. package/dist/utils/live-reporter.d.ts +29 -0
  77. package/dist/utils/live-reporter.js +145 -0
  78. package/dist/utils/live-reporter.js.map +1 -0
  79. package/dist/utils/playwright-runner.js +36 -14
  80. package/dist/utils/playwright-runner.js.map +1 -1
  81. package/dist/utils/pro-client.d.ts +29 -0
  82. package/dist/utils/pro-client.js +114 -0
  83. package/dist/utils/pro-client.js.map +1 -0
  84. package/dist/utils/pytest-runner.d.ts +102 -0
  85. package/dist/utils/pytest-runner.js +715 -0
  86. package/dist/utils/pytest-runner.js.map +1 -0
  87. package/dist/utils/quarantine.d.ts +64 -0
  88. package/dist/utils/quarantine.js +106 -0
  89. package/dist/utils/quarantine.js.map +1 -0
  90. package/dist/utils/test-change-guard.d.ts +90 -0
  91. package/dist/utils/test-change-guard.js +516 -0
  92. package/dist/utils/test-change-guard.js.map +1 -0
  93. package/dist/utils/totp.d.ts +26 -0
  94. package/dist/utils/totp.js +84 -0
  95. package/dist/utils/totp.js.map +1 -0
  96. package/dist/utils/update-check.d.ts +50 -0
  97. package/dist/utils/update-check.js +75 -0
  98. package/dist/utils/update-check.js.map +1 -0
  99. package/examples/github-actions/playwright-e2e.yml +80 -0
  100. package/examples/gitlab-ci/playwright-e2e.yml +71 -0
  101. package/package.json +2 -2
  102. package/skill/playwright-e2e-mcp/SKILL.md +45 -7
  103. package/skill/playwright-e2e-mcp/references/setup.md +12 -1
  104. package/skill/playwright-e2e-mcp/references/tools.md +42 -1
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Python support: run pytest-playwright suites through the same tools.
3
+ *
4
+ * A Python project has no node_modules and no playwright.config, so the
5
+ * Node runner cannot touch it. This module runs `python -m pytest` instead
6
+ * and turns its results into the same RunTestResult the Node runner
7
+ * returns, so run-test, get-failure (traces included), list-tests,
8
+ * analyze-history and the ci command work unchanged.
9
+ *
10
+ * Results come from a small pytest plugin the server writes to its temp
11
+ * directory and loads with `-p` (nothing is installed in the project). It
12
+ * appends one JSON line per test as the test finishes: node id, absolute
13
+ * file and line, outcome, the full failure text, the crash location and
14
+ * the trace files pytest-playwright kept. Because lines are written as
15
+ * tests end, a run that is killed still reports the tests that finished.
16
+ *
17
+ * The project's own Python is used: PW_MCP_PYTHON, else a virtualenv in
18
+ * the project (.venv, venv, env), else python3 / python on PATH.
19
+ */
20
+ import type { DiscoveredTest, ErrorKind, ListTestsResult, ReportStats, RunTestOptions, RunTestResult, TestFailure, TestOutcome } from '../types/index.js';
21
+ /** Environment variable naming the JSONL file the plugin appends to. */
22
+ export declare const PYTEST_RESULTS_ENV = "PW_MCP_PYTEST_RESULTS";
23
+ /**
24
+ * Whether the folder is a pytest project, and which file says so:
25
+ * pytest.ini, a [tool.pytest…] table in pyproject.toml, [tool:pytest] in
26
+ * setup.cfg, [pytest] in tox.ini, or a conftest.py at the root or in tests/.
27
+ */
28
+ export declare function detectPytestProject(root: string): Promise<{
29
+ marker: string;
30
+ } | null>;
31
+ /** The Python to run: PW_MCP_PYTHON, a project virtualenv, or python3 / python. */
32
+ export declare function resolvePython(root: string): Promise<string>;
33
+ /** Folder holding the plugin module, added to PYTHONPATH for the run. */
34
+ export declare function pytestPluginDir(): Promise<string>;
35
+ export interface ParsedPytestResults {
36
+ stats: ReportStats;
37
+ failures: TestFailure[];
38
+ failuresTruncated: boolean;
39
+ outcomes: TestOutcome[];
40
+ tests: DiscoveredTest[];
41
+ collected?: number;
42
+ exitStatus?: number;
43
+ }
44
+ /** Split a node id into file, readable title and browser project. */
45
+ export declare function describeNodeId(nodeid: string): {
46
+ file: string;
47
+ title: string;
48
+ project?: string;
49
+ };
50
+ /**
51
+ * The failure's code frame: the source lines pytest prints with `>` at the
52
+ * failing line, up to the first `E` line that follows.
53
+ */
54
+ export declare function pytestCodeFrame(longrepr: string): string | undefined;
55
+ /**
56
+ * The test file's own line in a traceback: pytest prints `path:LINE: Error`
57
+ * for each frame, and the crash itself is often inside Playwright, so take
58
+ * the last frame that is in the test file.
59
+ */
60
+ export declare function testFileLine(longrepr: string, file: string): number | undefined;
61
+ /**
62
+ * The traceback without the frames inside Playwright and other libraries:
63
+ * pytest separates frames with \`_ _ _\` lines; keep the test's own frames
64
+ * (those that mention the test file) and the final \`E\` lines.
65
+ */
66
+ export declare function shortTraceback(longrepr: string, max?: number): string;
67
+ /** Expected / actual values from a Playwright Python assertion message. */
68
+ export declare function expectedActual(message: string): {
69
+ expected?: string;
70
+ actual?: string;
71
+ };
72
+ /**
73
+ * Turn the plugin's JSONL into failures, outcomes and stats. Paths become
74
+ * project-relative; malformed lines (a write cut off by a kill) are skipped.
75
+ */
76
+ export declare function parsePytestResults(raw: string, root: string, maxFailures?: number): ParsedPytestResults;
77
+ /**
78
+ * Turn `file.py:LINE` into the node id of the test defined at or above that
79
+ * line (`file.py::TestCart::test_add`), so get-failure's re-run hints work
80
+ * for pytest too. `file.py::name` and plain paths pass through.
81
+ */
82
+ export declare function nodeIdForLine(relativeFile: string, source: string, line: number): string;
83
+ /** Run-level problems pytest reports on stderr/stdout instead of per test. */
84
+ export declare function diagnosePytestOutput(text: string, exitCode: number | null): {
85
+ errorKind: ErrorKind;
86
+ errorMessage: string;
87
+ hint: string;
88
+ } | null;
89
+ /** Run a pytest-playwright suite and return the same result shape as the Node runner. */
90
+ export declare function runPytest(options: RunTestOptions): Promise<RunTestResult>;
91
+ /**
92
+ * List a pytest project's tests: `pytest --collect-only -q` when allowed to
93
+ * run project code, a scan of test_*.py / *_test.py files otherwise (or
94
+ * when collection fails, with the reason).
95
+ */
96
+ export declare function listPytestTests(options: {
97
+ projectRoot: string;
98
+ filter?: string;
99
+ limit?: number;
100
+ signal?: AbortSignal;
101
+ noSpawn?: boolean;
102
+ }): Promise<ListTestsResult>;