@mechris3/glassbox 0.1.3 → 0.1.4
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 +22 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -76,6 +76,28 @@ Either way, run `glassbox` commands from the directory containing your `glassbox
|
|
|
76
76
|
- Node.js 20+
|
|
77
77
|
- A Chromium-based browser (Chrome, Brave, Edge)
|
|
78
78
|
|
|
79
|
+
## Environment Variables
|
|
80
|
+
|
|
81
|
+
Config files, hooks, journeys, and page objects are all TypeScript running in Node — `process.env` works everywhere:
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
// page-objects/login.page.ts — credentials from env
|
|
85
|
+
async login() {
|
|
86
|
+
const user = process.env.TEST_USERNAME ?? 'default@test.com';
|
|
87
|
+
const pass = process.env.TEST_PASSWORD ?? 'password123';
|
|
88
|
+
await this.fill('[data-testid="email"]', user);
|
|
89
|
+
await this.fill('[data-testid="password"]', pass);
|
|
90
|
+
await this.click('[data-testid="submit"]');
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// glassbox.config.ts — headless in CI
|
|
94
|
+
browser: { headless: process.env.CI === 'true' }
|
|
95
|
+
|
|
96
|
+
// helpers/before-each.ts — API key for test data service
|
|
97
|
+
const apiKey = process.env.TEST_API_KEY;
|
|
98
|
+
await fetch('http://...', { headers: { Authorization: `Bearer ${apiKey}` } });
|
|
99
|
+
```
|
|
100
|
+
|
|
79
101
|
## Consumer Usage
|
|
80
102
|
|
|
81
103
|
### Page Objects
|
package/package.json
CHANGED