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.
- package/README.md +150 -24
- package/dist/cli/ci.js +3 -0
- package/dist/cli/ci.js.map +1 -1
- package/dist/cli/doctor.d.ts +12 -1
- package/dist/cli/doctor.js +34 -4
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/guard.d.ts +11 -0
- package/dist/cli/guard.js +80 -0
- package/dist/cli/guard.js.map +1 -0
- package/dist/cli/upload.d.ts +14 -0
- package/dist/cli/upload.js +81 -0
- package/dist/cli/upload.js.map +1 -0
- package/dist/discovery.d.ts +61 -0
- package/dist/discovery.js +108 -0
- package/dist/discovery.js.map +1 -0
- package/dist/http.d.ts +10 -1
- package/dist/http.js +50 -4
- package/dist/http.js.map +1 -1
- package/dist/index.js +28 -1
- package/dist/index.js.map +1 -1
- package/dist/oauth.d.ts +2 -0
- package/dist/oauth.js +1 -1
- package/dist/oauth.js.map +1 -1
- package/dist/server.d.ts +24 -4
- package/dist/server.js +98 -15
- package/dist/server.js.map +1 -1
- package/dist/skills.d.ts +23 -0
- package/dist/skills.js +101 -0
- package/dist/skills.js.map +1 -0
- package/dist/tools/analyze-history.d.ts +15 -0
- package/dist/tools/analyze-history.js +44 -9
- package/dist/tools/analyze-history.js.map +1 -1
- package/dist/tools/audit-accessibility.d.ts +6 -0
- package/dist/tools/audit-performance.d.ts +6 -0
- package/dist/tools/check-test-change.d.ts +44 -0
- package/dist/tools/check-test-change.js +132 -0
- package/dist/tools/check-test-change.js.map +1 -0
- package/dist/tools/compare-visual-state.d.ts +6 -0
- package/dist/tools/diagnose-flaky.js +5 -1
- package/dist/tools/diagnose-flaky.js.map +1 -1
- package/dist/tools/generate-e2e-test.d.ts +3 -0
- package/dist/tools/generate-e2e-test.js +3 -0
- package/dist/tools/generate-e2e-test.js.map +1 -1
- package/dist/tools/get-failure.js +3 -1
- package/dist/tools/get-failure.js.map +1 -1
- package/dist/tools/get-run-status.js +8 -2
- package/dist/tools/get-run-status.js.map +1 -1
- package/dist/tools/inspect-page.d.ts +6 -0
- package/dist/tools/inspect-page.js +3 -1
- package/dist/tools/inspect-page.js.map +1 -1
- package/dist/tools/list-tests.js +16 -12
- package/dist/tools/list-tests.js.map +1 -1
- package/dist/tools/probe-script.js +181 -15
- package/dist/tools/probe-script.js.map +1 -1
- package/dist/tools/quarantine.d.ts +61 -0
- package/dist/tools/quarantine.js +133 -0
- package/dist/tools/quarantine.js.map +1 -0
- package/dist/tools/run-test.d.ts +10 -1
- package/dist/tools/run-test.js +38 -6
- package/dist/tools/run-test.js.map +1 -1
- package/dist/tools/save-login.d.ts +145 -0
- package/dist/tools/save-login.js +264 -0
- package/dist/tools/save-login.js.map +1 -0
- package/dist/tools/shared.d.ts +49 -2
- package/dist/tools/shared.js +57 -6
- package/dist/tools/shared.js.map +1 -1
- package/dist/tools/structured.d.ts +8 -1
- package/dist/tools/structured.js +8 -1
- package/dist/tools/structured.js.map +1 -1
- package/dist/tools/suggest-fix.js +4 -0
- package/dist/tools/suggest-fix.js.map +1 -1
- package/dist/tools/validate-selector.d.ts +6 -0
- package/dist/tools/validate-selector.js +10 -2
- package/dist/tools/validate-selector.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/live-reporter.d.ts +29 -0
- package/dist/utils/live-reporter.js +145 -0
- package/dist/utils/live-reporter.js.map +1 -0
- package/dist/utils/playwright-runner.js +36 -14
- package/dist/utils/playwright-runner.js.map +1 -1
- package/dist/utils/pro-client.d.ts +29 -0
- package/dist/utils/pro-client.js +114 -0
- package/dist/utils/pro-client.js.map +1 -0
- package/dist/utils/pytest-runner.d.ts +102 -0
- package/dist/utils/pytest-runner.js +715 -0
- package/dist/utils/pytest-runner.js.map +1 -0
- package/dist/utils/quarantine.d.ts +64 -0
- package/dist/utils/quarantine.js +106 -0
- package/dist/utils/quarantine.js.map +1 -0
- package/dist/utils/test-change-guard.d.ts +90 -0
- package/dist/utils/test-change-guard.js +516 -0
- package/dist/utils/test-change-guard.js.map +1 -0
- package/dist/utils/totp.d.ts +26 -0
- package/dist/utils/totp.js +84 -0
- package/dist/utils/totp.js.map +1 -0
- package/dist/utils/update-check.d.ts +50 -0
- package/dist/utils/update-check.js +75 -0
- package/dist/utils/update-check.js.map +1 -0
- package/examples/github-actions/playwright-e2e.yml +80 -0
- package/examples/gitlab-ci/playwright-e2e.yml +71 -0
- package/package.json +2 -2
- package/skill/playwright-e2e-mcp/SKILL.md +45 -7
- package/skill/playwright-e2e-mcp/references/setup.md +12 -1
- 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>;
|