playwright-e2e-mcp 0.1.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 (67) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +497 -0
  3. package/dist/http.d.ts +27 -0
  4. package/dist/http.js +156 -0
  5. package/dist/http.js.map +1 -0
  6. package/dist/index.d.ts +12 -0
  7. package/dist/index.js +56 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/server.d.ts +23 -0
  10. package/dist/server.js +225 -0
  11. package/dist/server.js.map +1 -0
  12. package/dist/tools/compare-visual-state.d.ts +77 -0
  13. package/dist/tools/compare-visual-state.js +223 -0
  14. package/dist/tools/compare-visual-state.js.map +1 -0
  15. package/dist/tools/diagnose-flaky.d.ts +87 -0
  16. package/dist/tools/diagnose-flaky.js +258 -0
  17. package/dist/tools/diagnose-flaky.js.map +1 -0
  18. package/dist/tools/generate-e2e-test.d.ts +51 -0
  19. package/dist/tools/generate-e2e-test.js +274 -0
  20. package/dist/tools/generate-e2e-test.js.map +1 -0
  21. package/dist/tools/get-failure.d.ts +26 -0
  22. package/dist/tools/get-failure.js +220 -0
  23. package/dist/tools/get-failure.js.map +1 -0
  24. package/dist/tools/inspect-page.d.ts +57 -0
  25. package/dist/tools/inspect-page.js +124 -0
  26. package/dist/tools/inspect-page.js.map +1 -0
  27. package/dist/tools/list-tests.d.ts +35 -0
  28. package/dist/tools/list-tests.js +88 -0
  29. package/dist/tools/list-tests.js.map +1 -0
  30. package/dist/tools/run-test.d.ts +70 -0
  31. package/dist/tools/run-test.js +169 -0
  32. package/dist/tools/run-test.js.map +1 -0
  33. package/dist/tools/shared.d.ts +86 -0
  34. package/dist/tools/shared.js +490 -0
  35. package/dist/tools/shared.js.map +1 -0
  36. package/dist/tools/validate-selector.d.ts +32 -0
  37. package/dist/tools/validate-selector.js +93 -0
  38. package/dist/tools/validate-selector.js.map +1 -0
  39. package/dist/types/index.d.ts +344 -0
  40. package/dist/types/index.js +51 -0
  41. package/dist/types/index.js.map +1 -0
  42. package/dist/utils/change-analyzer.d.ts +46 -0
  43. package/dist/utils/change-analyzer.js +290 -0
  44. package/dist/utils/change-analyzer.js.map +1 -0
  45. package/dist/utils/image-diff.d.ts +61 -0
  46. package/dist/utils/image-diff.js +373 -0
  47. package/dist/utils/image-diff.js.map +1 -0
  48. package/dist/utils/logger.d.ts +21 -0
  49. package/dist/utils/logger.js +132 -0
  50. package/dist/utils/logger.js.map +1 -0
  51. package/dist/utils/path-utils.d.ts +55 -0
  52. package/dist/utils/path-utils.js +211 -0
  53. package/dist/utils/path-utils.js.map +1 -0
  54. package/dist/utils/playwright-runner.d.ts +63 -0
  55. package/dist/utils/playwright-runner.js +594 -0
  56. package/dist/utils/playwright-runner.js.map +1 -0
  57. package/dist/utils/project-detector.d.ts +43 -0
  58. package/dist/utils/project-detector.js +255 -0
  59. package/dist/utils/project-detector.js.map +1 -0
  60. package/dist/utils/report-parser.d.ts +60 -0
  61. package/dist/utils/report-parser.js +501 -0
  62. package/dist/utils/report-parser.js.map +1 -0
  63. package/dist/utils/trace-reader.d.ts +109 -0
  64. package/dist/utils/trace-reader.js +608 -0
  65. package/dist/utils/trace-reader.js.map +1 -0
  66. package/examples/sample-test.spec.ts +49 -0
  67. package/package.json +66 -0
@@ -0,0 +1,49 @@
1
+ import { test, expect } from '@playwright/test';
2
+
3
+ /**
4
+ * Sample test for playwright-e2e-mcp.
5
+ *
6
+ * Run it through the MCP server (tool: `run-test`) or directly:
7
+ * npx playwright test examples/sample-test.spec.ts
8
+ *
9
+ * It targets https://example.com — a stable public page — so you can
10
+ * verify the whole installation (browsers, network, reporting) before
11
+ * pointing the tools at your own app.
12
+ */
13
+ test.describe('example.com', () => {
14
+ test('loads with the expected title', async ({ page }) => {
15
+ const response = await page.goto('https://example.com/');
16
+
17
+ expect(response?.status()).toBe(200);
18
+ await expect(page).toHaveTitle(/Example Domain/);
19
+ });
20
+
21
+ test('explains what the domain is for', async ({ page }) => {
22
+ await page.goto('https://example.com/');
23
+
24
+ await expect(
25
+ page.getByText(/this domain is for use in documentation examples/i),
26
+ ).toBeVisible();
27
+ });
28
+
29
+ test('renders a content paragraph inside the body', async ({ page }) => {
30
+ await page.goto('https://example.com/');
31
+
32
+ await expect(page.locator('body')).toBeVisible();
33
+ const paragraph = page.locator('body p').first();
34
+ await expect(paragraph).toBeVisible();
35
+ await expect(paragraph).toHaveText(/.{40,}/);
36
+ });
37
+
38
+ test('renders without console errors', async ({ page }) => {
39
+ const consoleErrors: string[] = [];
40
+ page.on('console', (message) => {
41
+ if (message.type() === 'error') consoleErrors.push(message.text());
42
+ });
43
+
44
+ await page.goto('https://example.com/');
45
+ await expect(page.locator('body')).toBeVisible();
46
+
47
+ expect(consoleErrors).toEqual([]);
48
+ });
49
+ });
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "playwright-e2e-mcp",
3
+ "version": "0.1.0",
4
+ "description": "MCP server that runs, debugs, and inspects Playwright end-to-end tests from any MCP client",
5
+ "mcpName": "io.github.trajectiq-ai/E2E",
6
+ "type": "module",
7
+ "license": "MIT",
8
+ "homepage": "https://playwright-e2e-mcp.vercel.app",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/trajectiq-ai/E2E.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/trajectiq-ai/E2E/issues"
15
+ },
16
+ "keywords": [
17
+ "mcp",
18
+ "model-context-protocol",
19
+ "playwright",
20
+ "e2e",
21
+ "end-to-end-testing",
22
+ "testing",
23
+ "ai",
24
+ "automation",
25
+ "selectors"
26
+ ],
27
+ "main": "./dist/index.js",
28
+ "types": "./dist/index.d.ts",
29
+ "bin": {
30
+ "playwright-e2e-mcp": "./dist/index.js"
31
+ },
32
+ "exports": {
33
+ ".": {
34
+ "types": "./dist/index.d.ts",
35
+ "import": "./dist/index.js"
36
+ }
37
+ },
38
+ "files": [
39
+ "dist",
40
+ "examples",
41
+ "README.md",
42
+ "LICENSE"
43
+ ],
44
+ "scripts": {
45
+ "clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
46
+ "build": "npm run clean && tsc -p tsconfig.json",
47
+ "prepare": "npm run build",
48
+ "watch": "tsc -p tsconfig.json --watch",
49
+ "test": "npm run build && node test/run-tests.mjs",
50
+ "e2e": "npm run build && node e2e/run.mjs",
51
+ "mcpb": "npm run build && node scripts/build-mcpb.mjs",
52
+ "prepublishOnly": "npm test"
53
+ },
54
+ "engines": {
55
+ "node": ">=20"
56
+ },
57
+ "dependencies": {
58
+ "zod": "^4.2.0",
59
+ "@modelcontextprotocol/server": "^2.3.0"
60
+ },
61
+ "devDependencies": {
62
+ "@playwright/test": "1.63.0",
63
+ "@types/node": "^24.19.1",
64
+ "typescript": "^5.9.3"
65
+ }
66
+ }