@mechris3/glassbox 0.1.31 → 0.1.33
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
CHANGED
|
@@ -139,6 +139,16 @@ Extend `BasePage` — no constructor needed. The following methods are available
|
|
|
139
139
|
| `clearSession(origin?)` | Clear cookies and storage |
|
|
140
140
|
| `readClipboard()` | Read text from clipboard |
|
|
141
141
|
|
|
142
|
+
**Important:** Glassbox runs your files as native ESM (via `--import tsx`). Imports from `@mechris3/glassbox` work as-is, but **relative imports between your own files must use `.js` extensions** — even though the source files are `.ts`. This is how Node's ESM loader resolves TypeScript:
|
|
143
|
+
|
|
144
|
+
```typescript
|
|
145
|
+
// ✅ Correct — .js extension on relative import
|
|
146
|
+
import { LoginPage } from '../page-objects/login.page.js';
|
|
147
|
+
|
|
148
|
+
// ❌ Wrong — will fail at runtime with extensionless path
|
|
149
|
+
import { LoginPage } from '../page-objects/login.page';
|
|
150
|
+
```
|
|
151
|
+
|
|
142
152
|
Example:
|
|
143
153
|
|
|
144
154
|
```typescript
|
|
@@ -172,7 +182,7 @@ Extend `Journey` — use `this.page()` to create page objects:
|
|
|
172
182
|
```typescript
|
|
173
183
|
// journeys/login.journey.ts
|
|
174
184
|
import { Journey } from '@mechris3/glassbox';
|
|
175
|
-
import { LoginPage } from '../page-objects/login.page';
|
|
185
|
+
import { LoginPage } from '../page-objects/login.page.js';
|
|
176
186
|
|
|
177
187
|
export class LoginJourney extends Journey {
|
|
178
188
|
loginPage = this.page(LoginPage);
|
|
@@ -403,6 +413,10 @@ Requires `glassbox serve` to be running. The AI gets these tools:
|
|
|
403
413
|
|
|
404
414
|
The AI can identify journeys by name (`"login"`), ID (`"login-and-add-todos"`), or full path. After a failure, the browser stays open so `getDomSnapshot` and `getScreenshot` can inspect the failed state.
|
|
405
415
|
|
|
416
|
+
## Gotchas
|
|
417
|
+
|
|
418
|
+
- **Missing `.js` extensions on relative imports:** Glassbox spawns journeys in a child process using native ESM (`--import tsx` with `import()`). Node's ESM loader requires file extensions on relative paths. If you see `"Journey export must be a class with execute() method or a function"` at runtime, the most likely cause is a relative import without a `.js` extension. Package imports (`from '@mechris3/glassbox'`) don't need extensions — only your own file-to-file imports do.
|
|
419
|
+
|
|
406
420
|
## License
|
|
407
421
|
|
|
408
422
|
Proprietary. All rights reserved.
|
package/package.json
CHANGED
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
<style>:root{--bg-deep:#0d1117;--bg-panel:#161b22;--bg-surface:#1c2128;--bg-elevated:#21262d;--accent-primary:#e5a00d;--accent-hover:#f0b429;--accent-muted:#9e7a0c;--text-primary:#e6edf3;--text-secondary:#b1bac4;--text-muted:#7d8590;--color-success:#2ea043;--color-danger:#da3633;--color-warning:#d29922;--color-breakpoint:#f85149;--border-color:#30363d;--border-subtle:#21262d;--shadow-sm:0 1px 2px rgba(0, 0, 0, .3);--shadow-md:0 4px 12px rgba(0, 0, 0, .4);--radius-sm:4px;--radius-md:6px;--radius-lg:8px;--font-sans:-apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;--font-mono:"SF Mono", "Fira Code", "Cascadia Code", Consolas, monospace;--space-xs:4px;--space-sm:8px;--space-md:16px;--space-lg:24px;--space-xl:32px}*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}html,body{height:100%;font-family:var(--font-sans);font-size:14px;line-height:1.5;color:var(--text-primary);background-color:var(--bg-deep);-webkit-font-smoothing:antialiased}</style><link rel="stylesheet" href="styles-HMZYQRBV.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles-HMZYQRBV.css"></noscript></head>
|
|
10
10
|
<body>
|
|
11
11
|
<gb-root></gb-root>
|
|
12
|
-
<script src="polyfills-5CFQRCPP.js" type="module"></script><script src="main-
|
|
12
|
+
<script src="polyfills-5CFQRCPP.js" type="module"></script><script src="main-ZC3XC2JO.js" type="module"></script></body>
|
|
13
13
|
</html>
|