allgreen 0.0.0-stage → 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 (163) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +100 -2
  3. package/demo/allgreen/.gitignore +1 -0
  4. package/demo/allgreen/plans/add-to-cart.json +18 -0
  5. package/demo/allgreen/plans/checkout.json +14 -0
  6. package/demo/allgreen/plans/login.json +10 -0
  7. package/demo/allgreen/project.json +8 -0
  8. package/demo/allgreen/secrets.example.json +1 -0
  9. package/demo/site/checkout.html +14 -0
  10. package/demo/site/index.html +11 -0
  11. package/demo/site/login.html +25 -0
  12. package/demo/site/playground.html +194 -0
  13. package/demo/site/shop.html +35 -0
  14. package/demo/site/thanks.html +11 -0
  15. package/dist/cli/format.d.ts +10 -0
  16. package/dist/cli/format.js +142 -0
  17. package/dist/cli/main.d.ts +2 -0
  18. package/dist/cli/main.js +241 -0
  19. package/dist/cli/open-browser.d.ts +2 -0
  20. package/dist/cli/open-browser.js +23 -0
  21. package/dist/core/app-projects.d.ts +45 -0
  22. package/dist/core/app-projects.js +157 -0
  23. package/dist/core/atomic.d.ts +3 -0
  24. package/dist/core/atomic.js +31 -0
  25. package/dist/core/browsers.d.ts +42 -0
  26. package/dist/core/browsers.js +116 -0
  27. package/dist/core/compile.d.ts +22 -0
  28. package/dist/core/compile.js +360 -0
  29. package/dist/core/config.d.ts +31 -0
  30. package/dist/core/config.js +117 -0
  31. package/dist/core/constants.d.ts +8 -0
  32. package/dist/core/constants.js +8 -0
  33. package/dist/core/describe.d.ts +27 -0
  34. package/dist/core/describe.js +118 -0
  35. package/dist/core/devices.d.ts +14 -0
  36. package/dist/core/devices.js +22 -0
  37. package/dist/core/export.d.ts +21 -0
  38. package/dist/core/export.js +151 -0
  39. package/dist/core/failure-texts/de.d.ts +4 -0
  40. package/dist/core/failure-texts/de.js +83 -0
  41. package/dist/core/failure-texts/en.d.ts +4 -0
  42. package/dist/core/failure-texts/en.js +81 -0
  43. package/dist/core/failure-texts/es.d.ts +4 -0
  44. package/dist/core/failure-texts/es.js +80 -0
  45. package/dist/core/failure-texts/fr.d.ts +4 -0
  46. package/dist/core/failure-texts/fr.js +87 -0
  47. package/dist/core/failure-texts/it.d.ts +4 -0
  48. package/dist/core/failure-texts/it.js +82 -0
  49. package/dist/core/failures.d.ts +29 -0
  50. package/dist/core/failures.js +82 -0
  51. package/dist/core/file-keyring.d.ts +6 -0
  52. package/dist/core/file-keyring.js +46 -0
  53. package/dist/core/files.d.ts +16 -0
  54. package/dist/core/files.js +55 -0
  55. package/dist/core/locales.d.ts +8 -0
  56. package/dist/core/locales.js +16 -0
  57. package/dist/core/looks.d.ts +23 -0
  58. package/dist/core/looks.js +70 -0
  59. package/dist/core/mcpb.d.ts +11 -0
  60. package/dist/core/mcpb.js +19 -0
  61. package/dist/core/phrases/common.d.ts +9 -0
  62. package/dist/core/phrases/common.js +5 -0
  63. package/dist/core/phrases/de.d.ts +5 -0
  64. package/dist/core/phrases/de.js +241 -0
  65. package/dist/core/phrases/en.d.ts +5 -0
  66. package/dist/core/phrases/en.js +175 -0
  67. package/dist/core/phrases/es.d.ts +5 -0
  68. package/dist/core/phrases/es.js +208 -0
  69. package/dist/core/phrases/fr.d.ts +5 -0
  70. package/dist/core/phrases/fr.js +207 -0
  71. package/dist/core/phrases/it.d.ts +5 -0
  72. package/dist/core/phrases/it.js +236 -0
  73. package/dist/core/phrases.d.ts +7 -0
  74. package/dist/core/phrases.js +10 -0
  75. package/dist/core/picked.d.ts +6 -0
  76. package/dist/core/picked.js +95 -0
  77. package/dist/core/png.d.ts +5 -0
  78. package/dist/core/png.js +19 -0
  79. package/dist/core/project-files.d.ts +59 -0
  80. package/dist/core/project-files.js +190 -0
  81. package/dist/core/project-write.d.ts +66 -0
  82. package/dist/core/project-write.js +211 -0
  83. package/dist/core/recorded.d.ts +46 -0
  84. package/dist/core/recorded.js +160 -0
  85. package/dist/core/recorder-api.d.ts +7 -0
  86. package/dist/core/recorder-api.js +14 -0
  87. package/dist/core/recorder.d.ts +65 -0
  88. package/dist/core/recorder.js +326 -0
  89. package/dist/core/refs.d.ts +7 -0
  90. package/dist/core/refs.js +25 -0
  91. package/dist/core/results.d.ts +69 -0
  92. package/dist/core/results.js +217 -0
  93. package/dist/core/run-registry.d.ts +63 -0
  94. package/dist/core/run-registry.js +99 -0
  95. package/dist/core/run.d.ts +75 -0
  96. package/dist/core/run.js +229 -0
  97. package/dist/core/runs-history.d.ts +19 -0
  98. package/dist/core/runs-history.js +63 -0
  99. package/dist/core/schema.d.ts +494 -0
  100. package/dist/core/schema.js +401 -0
  101. package/dist/core/secrets.d.ts +21 -0
  102. package/dist/core/secrets.js +52 -0
  103. package/dist/core/step-gate.d.ts +29 -0
  104. package/dist/core/step-gate.js +62 -0
  105. package/dist/core/store.d.ts +56 -0
  106. package/dist/core/store.js +168 -0
  107. package/dist/core/synced.d.ts +13 -0
  108. package/dist/core/synced.js +49 -0
  109. package/dist/core/system-keyring.d.ts +18 -0
  110. package/dist/core/system-keyring.js +83 -0
  111. package/dist/core/zip.d.ts +5 -0
  112. package/dist/core/zip.js +43 -0
  113. package/dist/mcp/app-relay.d.ts +11 -0
  114. package/dist/mcp/app-relay.js +77 -0
  115. package/dist/mcp/connection.d.ts +11 -0
  116. package/dist/mcp/connection.js +44 -0
  117. package/dist/mcp/protocol.d.ts +46 -0
  118. package/dist/mcp/protocol.js +108 -0
  119. package/dist/mcp/server.d.ts +11 -0
  120. package/dist/mcp/server.js +50 -0
  121. package/dist/mcp/tools/app-tools.d.ts +32 -0
  122. package/dist/mcp/tools/app-tools.js +173 -0
  123. package/dist/mcp/tools/context.d.ts +61 -0
  124. package/dist/mcp/tools/context.js +102 -0
  125. package/dist/mcp/tools/get-image.d.ts +3 -0
  126. package/dist/mcp/tools/get-image.js +27 -0
  127. package/dist/mcp/tools/get-run.d.ts +3 -0
  128. package/dist/mcp/tools/get-run.js +71 -0
  129. package/dist/mcp/tools/index.d.ts +13 -0
  130. package/dist/mcp/tools/index.js +25 -0
  131. package/dist/mcp/tools/list-plans.d.ts +3 -0
  132. package/dist/mcp/tools/list-plans.js +30 -0
  133. package/dist/mcp/tools/list-projects.d.ts +3 -0
  134. package/dist/mcp/tools/list-projects.js +26 -0
  135. package/dist/mcp/tools/list-runs.d.ts +3 -0
  136. package/dist/mcp/tools/list-runs.js +9 -0
  137. package/dist/mcp/tools/read-plan.d.ts +3 -0
  138. package/dist/mcp/tools/read-plan.js +22 -0
  139. package/dist/mcp/tools/run-plans.d.ts +3 -0
  140. package/dist/mcp/tools/run-plans.js +12 -0
  141. package/dist/mcp/tools/save-plan.d.ts +3 -0
  142. package/dist/mcp/tools/save-plan.js +41 -0
  143. package/dist/server/app-events.d.ts +28 -0
  144. package/dist/server/app-events.js +59 -0
  145. package/dist/server/app-mcp.d.ts +11 -0
  146. package/dist/server/app-mcp.js +48 -0
  147. package/dist/server/demo-site.d.ts +12 -0
  148. package/dist/server/demo-site.js +34 -0
  149. package/dist/server/reveal.d.ts +4 -0
  150. package/dist/server/reveal.js +26 -0
  151. package/dist/server/routes.d.ts +100 -0
  152. package/dist/server/routes.js +785 -0
  153. package/dist/server/security.d.ts +15 -0
  154. package/dist/server/security.js +39 -0
  155. package/dist/server/server.d.ts +51 -0
  156. package/dist/server/server.js +141 -0
  157. package/dist/server/static.d.ts +10 -0
  158. package/dist/server/static.js +97 -0
  159. package/dist/ui/assets/Toast-D2Sy5v16.js +8 -0
  160. package/dist/ui/assets/index-BYDSHfWD.js +81 -0
  161. package/dist/ui/assets/index-CHbD-LyG.css +2 -0
  162. package/dist/ui/index.html +14 -0
  163. package/package.json +77 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Greg
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,101 @@
1
- # Temporary Holding Version
1
+ <p align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="docs/media/logo-dark.svg" />
4
+ <img src="docs/media/logo.svg" alt="" width="88" height="88" />
5
+ </picture>
6
+ </p>
2
7
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
8
+ <h1 align="center">Allgreen</h1>
9
+
10
+ <p align="center"><strong>A Playwright GUI.</strong> Test plans written as steps in plain words, run in real browsers on your machine, with a report anyone can read. No code.</p>
11
+
12
+ <p align="center">
13
+ <a href="https://gregorybruneau.github.io/allgreen/"><strong>Documentation</strong></a> ·
14
+ <a href="https://gregorybruneau.github.io/allgreen/fr/">Français</a> ·
15
+ <a href="https://gregorybruneau.github.io/allgreen/de/">Deutsch</a> ·
16
+ <a href="https://gregorybruneau.github.io/allgreen/es/">Español</a> ·
17
+ <a href="https://gregorybruneau.github.io/allgreen/it/">Italiano</a>
18
+ </p>
19
+
20
+ <p align="center"><a href="https://github.com/gregorybruneau/allgreen/actions/workflows/ci.yml"><img src="https://github.com/gregorybruneau/allgreen/actions/workflows/ci.yml/badge.svg" alt="CI" /></a></p>
21
+
22
+ ![Open a plan, add a check, run it: all green; then a plan that fails, with the screenshot of the failure](docs/media/demo.gif)
23
+
24
+ ## Try it in one minute
25
+
26
+ **The desktop app** (Windows, and Macs with an Apple chip): download it from the [latest release](https://github.com/gregorybruneau/allgreen/releases/latest), install it, and create a project for your site. [Install, step by step](https://gregorybruneau.github.io/allgreen/start/install/).
27
+
28
+ **Or the command line**, on any system with Node 22.18 or later:
29
+
30
+ ```sh
31
+ npx allgreen install-browsers # once: Chromium, Firefox, WebKit and the ffmpeg runs need
32
+ npx allgreen demo # the editor on a demo project and a small demo shop, on your machine
33
+ ```
34
+
35
+ `Ctrl-C` stops everything. To build Allgreen from its source, see [CONTRIBUTING.md](CONTRIBUTING.md).
36
+
37
+ ## What it does
38
+
39
+ - **Write test plans without code.** A plan is a list of steps in plain words: go to a page, click the "Shop" link, fill the "Email" field, check that "1 item" is visible. You pick each step from lists, point at an element in the page, or record your clicks; Allgreen shows each step back as a sentence.
40
+
41
+ ![The plan editor: each step has a sentence, a "What to do" menu and the element it acts on](docs/media/editor.png)
42
+
43
+ - **Run them on several browsers and devices.** Chromium, Firefox and WebKit, the real Chrome or Edge, on a computer and on emulated phones and tablets: every plan is a real Playwright test, run on your machine. Your site, your plans and your secrets stay there.
44
+ - **Read a clear report.** One line per plan, one column per browser and device, "Passed" or "Failed", in light or dark, on a computer or a phone.
45
+
46
+ ![An all-green report: three plans passed on Chromium and Firefox, on a computer and a Pixel 7 phone](docs/media/report.png)
47
+
48
+ - **See why a plan failed.** The step that failed, said in plain words, with a screenshot of the page at that moment, a video of the failed try and the Playwright trace.
49
+
50
+ ![The detail of a failure: step 2, verify that "Free delivery" is visible, did not pass, with the screenshot of the page](docs/media/failure.png)
51
+
52
+ - **Test what visitors meet.** Their language, time zone, light or dark look, reduced motion and screen size; cookie banners closed whenever they show, dialogs answered, new tabs followed, downloaded files checked, embedded payment forms reached, the look of a page compared with a reference.
53
+ - **Hand over to developers.** "Export to Playwright" saves your plans as a zip of a standard Playwright project, ready for CI.
54
+ - **Let an AI assistant help.** Claude Desktop, Claude Code or any MCP app can write plans, run them and read the reports; the plans, not the AI, decide what passed. It never sees a secret.
55
+ - **In five languages:** English, French, German, Spanish and Italian, for the app, the steps, the reports and the documentation. German, Spanish and Italian are machine-written and await a native review: corrections welcome.
56
+
57
+ Allgreen covers 73 % of what Playwright lets a test do, measured line by line in [docs/playwright-coverage.md](docs/playwright-coverage.md), and the rest is the roadmap.
58
+
59
+ ## Honest limits
60
+
61
+ - "Safari" means WebKit driven by Playwright, and "iPhone" means emulation in a desktop browser: not the real Safari, not a real phone.
62
+ - A screenshot shows what is on the screen: a password field shows dots, but a secret typed into an ordinary field is readable in screenshots, videos and traces.
63
+ - The recorder works in Chromium at the computer size and records actions, not checks: add the checks afterwards.
64
+ - The installers are not signed yet: the first time, Windows and macOS warn before opening Allgreen ([what to do](https://gregorybruneau.github.io/allgreen/start/install/)).
65
+
66
+ ## How it compares
67
+
68
+ Allgreen is a layer over Playwright, not a rival to it: every plan runs as a Playwright test and exports as Playwright code. Here it is next to the other no-code tools built on Playwright, from what each project says about itself.
69
+
70
+ | | **Allgreen** | WrightTest | Assuremind | INGenious |
71
+ | -------------------------- | ---------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
72
+ | How you write a test | **Steps picked from lists, or recorded in a browser** | No code (low-code: also API and SQL steps) | Plain-English steps, turned into code by an AI model | "No Code/Low Code" IDE |
73
+ | Where it runs | **Your computer: desktop app or command line, no account** | Self-hosted server (Docker Compose), with user accounts | Your computer, no account; an AI provider (cloud key or local Ollama) for the steps it writes, none for recorded tests | Your computer: an IDE and a command line, built in Java |
74
+ | Browsers | **Chromium, Firefox, WebKit, and the Chrome or Edge installed** | Chromium named as the runner; WebKit also installed; Firefox not mentioned | Chromium, Firefox, WebKit | Chromium by default, Chrome and Edge channels; Firefox and WebKit not stated |
75
+ | Phones and tablets | **Every device Playwright emulates, and a computer screen size of your choice** | Presets (iPhone 15, Pixel 7, iPad, …) | Any Playwright device name (e.g. iPhone 15 Pro, Pixel 7) | Emulation options (window size, touch, mobile, user agent) |
76
+ | Report for a non-developer | **Yes: pass or fail per browser and device, steps as sentences, screenshots and videos** | ? (step results, screenshots, traces, a dashboard) | ? (in its Studio: pass or fail, steps, screenshots, videos, visual diffs, Lighthouse metrics) | ? (HTML and Extent reports, Playwright traces, videos) |
77
+ | Export as Playwright code | **Yes: a zip from the app, or `allgreen export`** | Yes: `.spec.ts`, or a Playwright project as a zip | ? (it generates Playwright code; export not stated) | ? (it runs on Playwright for Java; export not stated) |
78
+ | Drivable by an AI (MCP) | **Yes** | Yes (local MCP server) | ? (it uses Playwright MCP to see the page; no MCP server for other apps described) | Yes (MCP server) |
79
+ | Languages of the interface | **English, French, German, Spanish, Italian** | English and Russian, others as language packs | ? | ? |
80
+ | License | **MIT** | Source-available (WrightTest Source-Available License v1.0) | Apache-2.0 (npm package) | MIT |
81
+
82
+ "?" means the project's own pages did not say, not that the answer is no. Checked on 2026-12-01; sources, and where the others are ahead, in [Allgreen and other no-code tools](https://gregorybruneau.github.io/allgreen/help/compare/).
83
+
84
+ ## Learn more
85
+
86
+ The [documentation](https://gregorybruneau.github.io/allgreen/) has everything else, in five languages:
87
+
88
+ - [Install](https://gregorybruneau.github.io/allgreen/start/install/) and [your first project](https://gregorybruneau.github.io/allgreen/start/first-project/)
89
+ - [Steps](https://gregorybruneau.github.io/allgreen/write/steps/), [elements](https://gregorybruneau.github.io/allgreen/write/elements/) and [checks](https://gregorybruneau.github.io/allgreen/write/checks/)
90
+ - [Command line](https://gregorybruneau.github.io/allgreen/reference/cli/) and [project settings](https://gregorybruneau.github.io/allgreen/reference/project-settings/)
91
+ - [Connect an AI](https://gregorybruneau.github.io/allgreen/ai/overview/) and [what the AI sees](https://gregorybruneau.github.io/allgreen/ai/what-the-ai-sees/)
92
+ - [Security](https://gregorybruneau.github.io/allgreen/security/overview/) and [secrets](https://gregorybruneau.github.io/allgreen/security/secrets/)
93
+ - [Export for developers and CI](https://gregorybruneau.github.io/allgreen/teams/export-ci/)
94
+
95
+ ## Contributing
96
+
97
+ Setup, checks and conventions are in [CONTRIBUTING.md](CONTRIBUTING.md). Found a problem? [Open an issue](https://github.com/gregorybruneau/allgreen/issues).
98
+
99
+ ## License
100
+
101
+ MIT
@@ -0,0 +1 @@
1
+ secrets.local.json
@@ -0,0 +1,18 @@
1
+ {
2
+ "version": 1,
3
+ "name": "Add a product to the cart",
4
+ "steps": [
5
+ { "action": "goto", "path": "/" },
6
+ { "action": "click", "target": { "by": "role", "role": "link", "name": "Shop" } },
7
+ {
8
+ "action": "click",
9
+ "target": {
10
+ "by": "role",
11
+ "role": "button",
12
+ "name": "Add to cart",
13
+ "within": { "by": "role", "role": "region", "name": "Product B" }
14
+ }
15
+ },
16
+ { "action": "expectVisible", "target": { "by": "text", "text": "1 item", "exact": true } }
17
+ ]
18
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "version": 1,
3
+ "name": "Place an order",
4
+ "steps": [
5
+ { "action": "goto", "path": "/checkout.html" },
6
+ {
7
+ "action": "fill",
8
+ "target": { "by": "label", "text": "Email" },
9
+ "value": "buyer@example.com"
10
+ },
11
+ { "action": "click", "target": { "by": "role", "role": "button", "name": "Order" } },
12
+ { "action": "expectVisible", "target": { "by": "role", "role": "heading", "name": "Thanks" } }
13
+ ]
14
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 1,
3
+ "name": "Sign in",
4
+ "steps": [
5
+ { "action": "goto", "path": "/login.html" },
6
+ { "action": "fill", "target": { "by": "label", "text": "Password" }, "value": "{{PASSWORD}}" },
7
+ { "action": "click", "target": { "by": "role", "role": "button", "name": "Sign in" } },
8
+ { "action": "expectUrl", "path": "/shop.html" }
9
+ ]
10
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "version": 1,
3
+ "name": "Demo shop",
4
+ "baseUrl": "http://127.0.0.1:4173",
5
+ "browsers": ["chromium", "firefox", "webkit"],
6
+ "devices": ["Desktop", "iPhone 15"],
7
+ "loginPlan": "login"
8
+ }
@@ -0,0 +1 @@
1
+ { "PASSWORD": "allgreen-demo" }
@@ -0,0 +1,14 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>Checkout</title>
6
+ </head>
7
+ <body>
8
+ <h1>Checkout</h1>
9
+ <form action="thanks.html">
10
+ <label>Email <input type="email" name="email" required /></label>
11
+ <button type="submit">Order</button>
12
+ </form>
13
+ </body>
14
+ </html>
@@ -0,0 +1,11 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>Demo shop</title>
6
+ </head>
7
+ <body>
8
+ <h1>Demo shop</h1>
9
+ <p><a href="shop.html">Shop</a></p>
10
+ </body>
11
+ </html>
@@ -0,0 +1,25 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>Sign in</title>
6
+ </head>
7
+ <body>
8
+ <h1>Sign in</h1>
9
+ <form id="login">
10
+ <label>Password <input type="password" name="password" /></label>
11
+ <button type="submit">Sign in</button>
12
+ </form>
13
+ <p id="error" role="alert" hidden>Wrong password</p>
14
+ <script>
15
+ // Demo only: the password is checked in the browser, the cookie is the "session".
16
+ document.getElementById('login').addEventListener('submit', (e) => {
17
+ e.preventDefault()
18
+ if (e.target.password.value === 'allgreen-demo') {
19
+ document.cookie = 'session=demo; path=/'
20
+ location.href = 'shop.html'
21
+ } else document.getElementById('error').hidden = false
22
+ })
23
+ </script>
24
+ </body>
25
+ </html>
@@ -0,0 +1,194 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>Playground</title>
6
+ <style>
7
+ .menu a {
8
+ display: none;
9
+ }
10
+ .menu:hover a {
11
+ display: inline;
12
+ }
13
+ #spacer {
14
+ height: 3000px;
15
+ }
16
+ [draggable] {
17
+ display: inline-block;
18
+ padding: 8px;
19
+ border: 1px solid;
20
+ }
21
+ #done {
22
+ display: inline-block;
23
+ min-width: 120px;
24
+ min-height: 40px;
25
+ border: 1px dashed;
26
+ }
27
+ </style>
28
+ </head>
29
+ <body>
30
+ <h1>Playground</h1>
31
+ <section aria-label="Look">
32
+ <p id="look">A box that never moves.</p>
33
+ <p id="clock" aria-label="Clock"></p>
34
+ </section>
35
+ <p>Every gesture and state Allgreen can check, for its own tests.</p>
36
+
37
+ <nav class="menu" aria-label="Account">
38
+ <span>Account</span> <a href="orders.html">Orders</a>
39
+ </nav>
40
+
41
+ <button type="button" id="twice">Twice</button>
42
+ <p id="twice-out" role="status"></p>
43
+
44
+ <section aria-label="Board" id="board">Board</section>
45
+ <p id="board-out" role="status"></p>
46
+
47
+ <span draggable="true" id="card">Card</span>
48
+ <div id="done" aria-label="Done">Done</div>
49
+ <p id="drop-out" role="status"></p>
50
+
51
+ <label>CV <input type="file" id="cv" /></label>
52
+ <p id="cv-out" role="status"></p>
53
+
54
+ <label
55
+ >Sizes
56
+ <select multiple id="sizes">
57
+ <option>S</option>
58
+ <option>M</option>
59
+ <option>L</option>
60
+ </select></label
61
+ >
62
+
63
+ <label>Search <input type="search" id="search" /></label>
64
+ <p id="keys" role="status"></p>
65
+
66
+ <button type="button" disabled>Locked</button>
67
+ <label><input type="checkbox" checked /> Newsletter</label>
68
+ <label>Notes <input type="text" /></label>
69
+ <a href="/help.html">Help</a>
70
+
71
+ <ul aria-label="Orders">
72
+ <li>Order 41 — paid <button type="button">Open</button></li>
73
+ <li>Order 42 — pending <button type="button">Open</button></li>
74
+ <li>Order 43 — paid <button type="button">Open</button></li>
75
+ </ul>
76
+
77
+ <h2>More ways to name</h2>
78
+ <img
79
+ alt="Allgreen logo"
80
+ width="40"
81
+ height="40"
82
+ src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1 1'%3E%3Crect width='1' height='1' fill='green'/%3E%3C/svg%3E"
83
+ />
84
+ <span title="Opens the help">?</span>
85
+ <p data-testid="cart-total">Total: 12 €</p>
86
+ <button type="button" id="later">Load later</button>
87
+ <p id="spinner">Loading…</p>
88
+ <p id="later-out" hidden>Loaded</p>
89
+ <label>Focus me <input id="focusme" /></label>
90
+ <p id="focus-out"></p>
91
+ <button type="button" id="touch">Touch me</button>
92
+ <p id="touch-out"></p>
93
+
94
+ <h2>Other pages</h2>
95
+ <button type="button" id="ask">Delete the list</button>
96
+ <p id="ask-out"></p>
97
+ <button type="button" id="name">Say your name</button>
98
+ <p id="name-out"></p>
99
+ <a href="data:text/plain,Order%2042" download="order-42.txt">Download the order</a>
100
+ <a href="/thanks.html" target="_blank">Open the thanks page</a>
101
+ <iframe
102
+ title="Payment"
103
+ srcdoc="<label>Card <input></label><button onclick=&quot;this.textContent='Paid'&quot;>Pay</button>"
104
+ ></iframe>
105
+
106
+ <button type="button" id="break">Break the page</button>
107
+ <!-- ?banner=1: a cookie banner over the page, a moment after it loads -->
108
+ <div
109
+ id="banner"
110
+ role="dialog"
111
+ aria-label="Cookies"
112
+ hidden
113
+ style="position: fixed; inset: 0; background: rgb(0 0 0 / 0.6); color: white; padding: 2rem"
114
+ >
115
+ <p>We use cookies</p>
116
+ <button type="button" id="accept">Accept</button>
117
+ </div>
118
+
119
+ <!-- what the browser says of itself: the project's simulated conditions show here -->
120
+ <p id="env"></p>
121
+
122
+ <div id="spacer"></div>
123
+ <button type="button">Back to top</button>
124
+
125
+ <script>
126
+ const $ = (id) => document.getElementById(id)
127
+ // ?v=2: the same page, changed (look checks); the clock changes all the time (areas to ignore)
128
+ // a change no font or screen can hide: other text, and a coloured box
129
+ if (new URLSearchParams(location.search).get('v') === '2') {
130
+ $('look').textContent = 'A box that moved a lot, with much more text in it.'
131
+ $('look').style.background = '#b91c1c'
132
+ }
133
+ setInterval(() => ($('clock').textContent = String(Date.now())), 50)
134
+ $('twice').addEventListener('dblclick', () => ($('twice-out').textContent = 'Double-clicked'))
135
+ $('board').addEventListener('contextmenu', (e) => {
136
+ e.preventDefault()
137
+ $('board-out').textContent = 'Context menu opened'
138
+ })
139
+ $('card').addEventListener('dragstart', (e) => e.dataTransfer.setData('text', 'card'))
140
+ $('done').addEventListener('dragover', (e) => e.preventDefault())
141
+ $('done').addEventListener('drop', (e) => {
142
+ e.preventDefault()
143
+ $('drop-out').textContent = 'Card dropped'
144
+ })
145
+ $('cv').addEventListener(
146
+ 'change',
147
+ () => ($('cv-out').textContent = 'Received ' + $('cv').files[0].name),
148
+ )
149
+ // key by key: one input event per key, so the text shows how far the typing went
150
+ $('search').addEventListener(
151
+ 'input',
152
+ () => ($('keys').textContent = 'Typed ' + $('search').value),
153
+ )
154
+ $('later').addEventListener('click', () =>
155
+ setTimeout(() => {
156
+ $('later-out').hidden = false
157
+ $('spinner').remove()
158
+ }, 800),
159
+ )
160
+ $('focusme').addEventListener('focus', () => ($('focus-out').textContent = 'Focused'))
161
+ // a finger touches first: the click that follows keeps what it said
162
+ $('touch').addEventListener('touchstart', () => ($('touch-out').textContent = 'Touched'))
163
+ $('touch').addEventListener('click', () => {
164
+ if (!$('touch-out').textContent) $('touch-out').textContent = 'Clicked'
165
+ })
166
+ $('ask').addEventListener(
167
+ 'click',
168
+ () => ($('ask-out').textContent = confirm('Delete the whole list?') ? 'Deleted' : 'Kept'),
169
+ )
170
+ $('name').addEventListener(
171
+ 'click',
172
+ () => ($('name-out').textContent = 'Hello ' + prompt('Your name?')),
173
+ )
174
+ $('break').addEventListener('click', () => {
175
+ throw new Error('The cart is broken')
176
+ })
177
+ if (new URLSearchParams(location.search).get('banner') === '1')
178
+ setTimeout(() => ($('banner').hidden = false), 300)
179
+ $('accept').addEventListener('click', () => ($('banner').hidden = true))
180
+ $('env').textContent = [
181
+ navigator.language,
182
+ Intl.DateTimeFormat().resolvedOptions().timeZone,
183
+ matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light',
184
+ matchMedia('(prefers-reduced-motion: reduce)').matches ? 'still' : 'moving',
185
+ `${innerWidth}x${innerHeight}`,
186
+ // the order of the brands changes on purpose between versions: the most precise wins
187
+ ((brands) =>
188
+ ['Microsoft Edge', 'Google Chrome', 'Chromium'].find((b) => brands.includes(b)) ?? '-')(
189
+ (navigator.userAgentData?.brands ?? []).map((b) => b.brand),
190
+ ),
191
+ ].join(' ')
192
+ </script>
193
+ </body>
194
+ </html>
@@ -0,0 +1,35 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>Shop</title>
6
+ <script>
7
+ if (!document.cookie.split('; ').includes('session=demo')) location.replace('login.html')
8
+ </script>
9
+ </head>
10
+ <body>
11
+ <h1>Shop</h1>
12
+ <p id="count">0 items</p>
13
+ <section aria-label="Product A">
14
+ <h2>Product A</h2>
15
+ <button type="button">Add to cart</button>
16
+ </section>
17
+ <section aria-label="Product B">
18
+ <h2>Product B</h2>
19
+ <button type="button">Add to cart</button>
20
+ </section>
21
+ <section aria-label="Product C">
22
+ <h2>Product C</h2>
23
+ <button type="button">Add to cart</button>
24
+ </section>
25
+ <p><a href="checkout.html">Checkout</a></p>
26
+ <script>
27
+ let n = 0
28
+ for (const b of document.querySelectorAll('section button'))
29
+ b.addEventListener('click', () => {
30
+ n++
31
+ document.getElementById('count').textContent = `${n} ${n === 1 ? 'item' : 'items'}`
32
+ })
33
+ </script>
34
+ </body>
35
+ </html>
@@ -0,0 +1,11 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>Thanks</title>
6
+ </head>
7
+ <body>
8
+ <h1>Thanks</h1>
9
+ <p>Your order is on its way.</p>
10
+ </body>
11
+ </html>
@@ -0,0 +1,10 @@
1
+ import { type Locale } from '../core/phrases.js';
2
+ import { type LoadedProject } from '../core/project-files.js';
3
+ import { type RunResult } from '../core/run.js';
4
+ /**
5
+ * Terminal report of a run: a plan x (browser, device) grid, the summary counts, then one block per failed cell
6
+ * (plan, pair, step phrase, readable failure, screenshot path). `color` adds ANSI colours.
7
+ */
8
+ export declare function formatRun(result: RunResult, plans: LoadedProject['plans'], locale: Locale, color: boolean): string;
9
+ /** Message printed on stderr for an error: the full (already redacted) message, at most 20 lines, never a stack trace. */
10
+ export declare function describeError(e: unknown): string;
@@ -0,0 +1,142 @@
1
+ import { failureText } from '../core/failures.js';
2
+ import { stepPhrase } from '../core/phrases.js';
3
+ import { ProjectLoadError } from '../core/project-files.js';
4
+ import { BrowsersMissingError, MissingSecretsError, } from '../core/run.js';
5
+ const SYMBOL = {
6
+ passed: '✓',
7
+ failed: '✗',
8
+ flaky: '~',
9
+ notRun: '–',
10
+ notApplicable: 'n/a',
11
+ };
12
+ const COLOR = {
13
+ passed: 32,
14
+ failed: 31,
15
+ flaky: 33,
16
+ notRun: 31,
17
+ notApplicable: 90,
18
+ };
19
+ const LABELS = {
20
+ en: {
21
+ step: 'Step',
22
+ screenshot: 'Screenshot',
23
+ summary: {
24
+ passed: 'passed',
25
+ failed: 'failed',
26
+ flaky: 'flaky',
27
+ notRun: 'not run',
28
+ notApplicable: 'n/a',
29
+ },
30
+ },
31
+ fr: {
32
+ step: 'Étape',
33
+ screenshot: 'Capture',
34
+ summary: {
35
+ passed: 'réussis',
36
+ failed: 'échoués',
37
+ flaky: 'instables',
38
+ notRun: 'non exécutés',
39
+ notApplicable: 'n/a',
40
+ },
41
+ },
42
+ de: {
43
+ step: 'Schritt',
44
+ screenshot: 'Bildschirmfoto',
45
+ summary: {
46
+ passed: 'bestanden',
47
+ failed: 'fehlgeschlagen',
48
+ flaky: 'instabil',
49
+ notRun: 'nicht ausgeführt',
50
+ notApplicable: 'n. z.',
51
+ },
52
+ },
53
+ es: {
54
+ step: 'Paso',
55
+ screenshot: 'Captura',
56
+ summary: {
57
+ passed: 'superados',
58
+ failed: 'fallidos',
59
+ flaky: 'inestables',
60
+ notRun: 'no ejecutados',
61
+ notApplicable: 'n/a',
62
+ },
63
+ },
64
+ it: {
65
+ step: 'Passo',
66
+ screenshot: 'Schermata',
67
+ summary: {
68
+ passed: 'superati',
69
+ failed: 'falliti',
70
+ flaky: 'instabili',
71
+ notRun: 'non eseguiti',
72
+ notApplicable: 'n/d',
73
+ },
74
+ },
75
+ };
76
+ /**
77
+ * Terminal report of a run: a plan x (browser, device) grid, the summary counts, then one block per failed cell
78
+ * (plan, pair, step phrase, readable failure, screenshot path). `color` adds ANSI colours.
79
+ */
80
+ export function formatRun(result, plans, locale, color) {
81
+ const paint = (text, code) => (color ? `\u001b[${code}m${text}\u001b[0m` : text);
82
+ const L = LABELS[locale];
83
+ const pairs = [...new Map(result.cells.map((c) => [`${c.browser} ${c.device}`, c])).keys()];
84
+ const slugs = [...new Set(result.cells.map((c) => c.plan))];
85
+ const width = Math.max(...slugs.map((s) => s.length), 0);
86
+ const grid = [
87
+ `${' '.repeat(width)} ${pairs.join(' ')}`,
88
+ ...slugs.map((slug) => {
89
+ const row = pairs.map((pair) => {
90
+ const cell = result.cells.find((c) => c.plan === slug && `${c.browser} ${c.device}` === pair);
91
+ const symbol = cell ? SYMBOL[cell.status] : '';
92
+ return (paint(symbol, cell ? COLOR[cell.status] : 0) +
93
+ ' '.repeat(Math.max(0, pair.length - symbol.length)));
94
+ });
95
+ return `${slug.padEnd(width)} ${row.join(' ')}`.trimEnd();
96
+ }),
97
+ ];
98
+ const { summary } = result;
99
+ const counts = Object.keys(L.summary)
100
+ .filter((s) => summary[s])
101
+ .map((s) => `${summary[s]} ${L.summary[s]}`);
102
+ const failures = result.cells.flatMap((cell) => {
103
+ const { failure } = cell;
104
+ if (!failure)
105
+ return [];
106
+ const step = failure.stepIndex === null
107
+ ? undefined
108
+ : plans.find((p) => p.slug === cell.plan)?.plan.steps[failure.stepIndex];
109
+ return [
110
+ '',
111
+ paint(`${SYMBOL.failed} ${cell.plan} (${cell.browser} ${cell.device})`, 31),
112
+ ...(step ? [` ${L.step} ${failure.stepIndex + 1}: ${stepPhrase(step, locale)}`] : []),
113
+ ` ${failureText(failure, locale)}`,
114
+ // The unknown phrase promises details: show the start of the (already redacted) raw error.
115
+ ...(failure.code === 'unknown'
116
+ ? failure.raw
117
+ .split('\n')
118
+ .slice(0, 5)
119
+ .map((l) => ` ${l}`)
120
+ : []),
121
+ ...(failure.screenshot
122
+ ? [` ${L.screenshot}: .allgreen/runs/${result.id}/${failure.screenshot}`]
123
+ : []),
124
+ ];
125
+ });
126
+ return [result.projectName, '', ...grid, '', counts.join(', '), ...failures, ''].join('\n');
127
+ }
128
+ /** Message printed on stderr for an error: the full (already redacted) message, at most 20 lines, never a stack trace. */
129
+ export function describeError(e) {
130
+ if (e instanceof ProjectLoadError)
131
+ return [
132
+ 'Invalid project files:',
133
+ ...e.errors.flatMap((f) => f.issues.map((i) => ` ${f.file}${i.path ? ` (${i.path})` : ''}: ${i.message}`)),
134
+ ].join('\n');
135
+ if (e instanceof MissingSecretsError)
136
+ return `Missing secrets: ${e.names.join(', ')}\nDefine them in allgreen/secrets.local.json, e.g. {"${e.names[0]}": "..."}`;
137
+ if (e instanceof BrowsersMissingError)
138
+ return `Browsers not installed: ${e.browsers.join(', ')}\nRun: allgreen install-browsers`;
139
+ if (e.code === 'EEXIST')
140
+ return 'allgreen/ already exists here; nothing was changed.';
141
+ return (e instanceof Error ? e.message : String(e)).trimEnd().split('\n').slice(0, 20).join('\n');
142
+ }
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};