@atezca/core 1.1.0 → 1.1.1

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 (2) hide show
  1. package/README.md +313 -27
  2. package/package.json +8 -1
package/README.md CHANGED
@@ -1,47 +1,333 @@
1
- # @atezca/core
1
+ # Atezca 🚀
2
2
 
3
3
  AI-powered E2E testing library with natural language syntax.
4
4
 
5
- Part of the Atezca workspace.
5
+ Write tests like humans think, let AI handle the technical details.
6
6
 
7
- ## Documentation
7
+ ## Features
8
8
 
9
- See the [main README](../../README.md) for full documentation.
9
+ - 🤖 **AI-Powered**: Uses Claude AI or Google Gemini to interpret natural language test commands
10
+ - 🎯 **Simple Syntax**: Intuitive API that reads like plain English
11
+ - 📝 **Code Generation**: Automatically generates reusable Playwright test files
12
+ - 💾 **Smart Caching**: Reduces API costs by caching interpretations
13
+ - ⚡ **Fast Execution**: Built on Playwright for reliable, fast test execution
14
+ - 🔄 **Multi-Browser**: Support for Chromium, Firefox, and WebKit
15
+ - 🔀 **Multi-Provider**: Choose between Claude (Anthropic) or Gemini (Google)
16
+ - 🔒 **SSL Bypass**: Option to disable SSL validation for development environments
17
+ - 🛠️ **Auto-Install**: Automatically installs Playwright browsers on first run
10
18
 
11
- ## Development
19
+ ## Installation
12
20
 
13
21
  ```bash
14
- # Install dependencies
15
- pnpm install
22
+ # Using pnpm (recommended)
23
+ pnpm add -D @atezca/core
16
24
 
17
- # Build
18
- pnpm build
25
+ # Using npm
26
+ npm install --save-dev @atezca/core
19
27
 
20
- # Watch mode
21
- pnpm dev
28
+ # Using yarn
29
+ yarn add -D @atezca/core
30
+ ```
31
+
32
+ ## Quick Start
33
+
34
+ ### 1. Setup API Key
35
+
36
+ Create a `.env` file in your project root:
37
+
38
+ **Option A: Using Claude (Anthropic)**
39
+ ```bash
40
+ ANTHROPIC_API_KEY=sk-ant-api03-...
41
+ ATEZCA_AI_PROVIDER=claude
42
+ ```
43
+
44
+ **Option B: Using Gemini (Google)**
45
+ ```bash
46
+ GOOGLE_API_KEY=AIza...
47
+ ATEZCA_AI_PROVIDER=gemini
48
+ ```
49
+
50
+ Or create a `.atezcarc` config file:
51
+
52
+ ```bash
53
+ az init
54
+ ```
55
+
56
+ ### 2. Write Your First Test
57
+
58
+ Create a file `test.spec.js`:
59
+
60
+ ```javascript
61
+ const { az } = require('@atezca/core');
62
+
63
+ // Configure the test
64
+ az.setup({
65
+ url: 'https://example.com',
66
+ browser: 'chromium',
67
+ headless: true,
68
+ });
69
+
70
+ // Write tests in natural language
71
+ az.test('navigate', 'go to login page');
72
+ az.test('interact', "click button 'Login'");
73
+ az.test('interact', "type 'user@example.com' in email field");
74
+ az.test('interact', "type 'password123' in password field");
75
+ az.test('interact', "click submit button");
76
+ az.test('expect', 'show success message');
77
+ ```
78
+
79
+ ### 3. Run Your Test
80
+
81
+ ```bash
82
+ az run test.spec.js
83
+ ```
84
+
85
+ Or generate Playwright code without execution:
86
+
87
+ ```bash
88
+ az generate test.spec.js
89
+ ```
90
+
91
+ ## API Reference
92
+
93
+ ### `az.setup(config)`
94
+
95
+ Initialize test configuration.
96
+
97
+ **Parameters:**
98
+ - `url` (required): Base URL of the application
99
+ - `browser`: Browser type (`'chromium'`, `'firefox'`, `'webkit'`) - default: `'chromium'`
100
+ - `headless`: Run in headless mode - default: `true`
101
+ - `timeout`: Default timeout in milliseconds - default: `30000`
102
+ - `outputDir`: Directory for generated test files - default: `'generated-tests'`
103
+ - `aiProvider`: AI provider (`'claude'`, `'gemini'`) - overrides environment config
104
+ - `apiKey`: API key for the selected provider - overrides environment config
105
+ - `disableSSL`: Disable SSL certificate validation (useful for self-signed certificates) - default: `false`
106
+ - `cacheEnabled`: Enable interpretation caching - default: `true`
107
+ - `retries`: Number of retries for failed actions - default: `3`
108
+
109
+ **Example:**
110
+ ```javascript
111
+ // Option 1: Use environment variables (recommended for production)
112
+ az.setup({
113
+ url: 'https://myapp.com',
114
+ browser: 'firefox',
115
+ headless: false,
116
+ timeout: 60000,
117
+ outputDir: 'my-tests',
118
+ });
119
+
120
+ // Option 2: Specify AI provider and API key directly (useful for testing)
121
+ az.setup({
122
+ url: 'https://myapp.com',
123
+ browser: 'chromium',
124
+ headless: true,
125
+ aiProvider: 'gemini', // or 'claude'
126
+ apiKey: 'AIza...your_key_here',
127
+ });
128
+ ```
129
+
130
+ ### `az.test(actionType, description)`
131
+
132
+ Define a test action using natural language.
133
+
134
+ **Action Types:**
135
+ - `'navigate'`: Navigate to a page or URL
136
+ - `'interact'`: Click, type, select, or interact with elements
137
+ - `'wait'`: Wait for conditions to be met
138
+ - `'expect'`: Make assertions about the page state
139
+
140
+ **Examples:**
141
+
142
+ ```javascript
143
+ // Navigation
144
+ az.test('navigate', 'go to dashboard');
145
+ az.test('navigate', 'open settings page');
146
+
147
+ // Interactions
148
+ az.test('interact', "click button 'Submit'");
149
+ az.test('interact', "type 'hello@example.com' in email field");
150
+ az.test('interact', "select 'Premium' from plan dropdown");
151
+ az.test('interact', "hover over user menu");
152
+
153
+ // Waits
154
+ az.test('wait', 'until loading spinner disappears');
155
+ az.test('wait', 'until submit button is visible');
156
+
157
+ // Assertions
158
+ az.test('expect', 'show success message');
159
+ az.test('expect', 'display user profile');
160
+ az.test('expect', 'form should have validation errors');
161
+ ```
162
+
163
+ ## CLI Commands
164
+
165
+ ### Run Tests
166
+ ```bash
167
+ az run <file>
168
+ ```
169
+ Execute a test file with browser automation.
170
+
171
+ ### Generate Code
172
+ ```bash
173
+ az generate <file>
174
+ ```
175
+ Generate Playwright test code without execution.
22
176
 
23
- # Run tests
24
- pnpm test
177
+ ### Initialize Config
178
+ ```bash
179
+ az init
180
+ ```
181
+ Create a `.atezcarc` configuration file.
25
182
 
26
- # Clean
27
- pnpm clean
183
+ ### Cache Management
184
+ ```bash
185
+ # Clear cache
186
+ az cache clear
187
+
188
+ # Show cache statistics
189
+ az cache stats
28
190
  ```
29
191
 
30
- ## Package Structure
192
+ ## Configuration
193
+
194
+ Atezca can be configured via:
195
+ 1. Environment variables (`.env` file)
196
+ 2. Configuration file (`.atezcarc`)
197
+ 3. API call (`az.setup()`)
198
+
199
+ Priority: API > Environment > Config File > Defaults
200
+
201
+ ### Environment Variables
202
+
203
+ ```bash
204
+ # AI Provider (choose one)
205
+ ATEZCA_AI_PROVIDER=claude # or 'gemini'
206
+
207
+ # For Claude:
208
+ ANTHROPIC_API_KEY=sk-ant-api03-...
209
+
210
+ # For Gemini:
211
+ GOOGLE_API_KEY=AIza...
31
212
 
213
+ # Optional
214
+ ATEZCA_CACHE_ENABLED=true
215
+ ATEZCA_CACHE_EXPIRY_DAYS=30
216
+ ATEZCA_OUTPUT_DIR=generated-tests
217
+ ATEZCA_TIMEOUT=30000
218
+ ATEZCA_RETRIES=3
219
+ ATEZCA_BROWSER=chromium
220
+ ATEZCA_HEADLESS=true
32
221
  ```
33
- src/
34
- ├── index.ts # Main API exports
35
- ├── cli.ts # CLI tool
36
- ├── types/ # TypeScript types
37
- ├── config/ # Configuration loader
38
- ├── interpreter/ # Claude AI integration
39
- ├── cache/ # Caching system
40
- ├── executor/ # Playwright executor
41
- ├── generator/ # Code generation
42
- └── runner/ # Test orchestration
222
+
223
+ ### Config File (`.atezcarc`)
224
+
225
+ ```json
226
+ {
227
+ "aiProvider": "claude",
228
+ "anthropicApiKey": "sk-ant-api03-...",
229
+ "googleApiKey": "AIza...",
230
+ "cacheEnabled": true,
231
+ "cacheExpiryDays": 30,
232
+ "cacheFile": ".atezca-cache.json",
233
+ "browser": "chromium",
234
+ "headless": true,
235
+ "timeout": 30000,
236
+ "retries": 3,
237
+ "outputDir": "generated-tests"
238
+ }
239
+ ```
240
+
241
+ ## How It Works
242
+
243
+ 1. **Write Natural Language**: You write test commands in plain English
244
+ 2. **AI Interpretation**: Claude AI or Gemini interprets your commands into Playwright actions
245
+ 3. **Smart Caching**: Interpretations are cached to reduce API calls and costs
246
+ 4. **Execution**: Playwright executes the actions in a real browser
247
+ 5. **Code Generation**: Reusable Playwright test files are generated
248
+
43
249
  ```
250
+ Your Test → AI (Claude/Gemini) → Playwright Actions → Browser → Generated Code
251
+
252
+ Cache (saves $$)
253
+ ```
254
+
255
+ ## Examples
256
+
257
+ See the [`examples/`](examples/) directory for more examples:
258
+ - [Basic Login Test](examples/basic/test.spec.js)
259
+ - [E-commerce Checkout](examples/advanced/ecommerce.spec.mjs)
260
+ - [Using Gemini Provider](examples/gemini/test-with-gemini.mjs)
261
+
262
+ ## TypeScript Support
263
+
264
+ Atezca is written in TypeScript and includes full type definitions:
265
+
266
+ ```typescript
267
+ import { az, type SetupConfig, type ActionType } from '@atezca/core';
268
+
269
+ const config: SetupConfig = {
270
+ url: 'https://example.com',
271
+ browser: 'chromium',
272
+ headless: true,
273
+ };
274
+
275
+ az.setup(config);
276
+ az.test('interact', 'click login button');
277
+ ```
278
+
279
+ ## Cost Optimization
280
+
281
+ Atezca includes several features to minimize API costs:
282
+
283
+ - **Aggressive Caching**: Interpretations are cached locally for 30 days (configurable)
284
+ - **Deterministic AI**: Uses temperature=0 for consistent results
285
+ - **Batch Processing**: Multiple commands processed efficiently
286
+ - **Offline Re-runs**: Cached tests can run without API calls
287
+
288
+ ## Troubleshooting
289
+
290
+ ### API Key Issues
291
+ ```bash
292
+ Error: Invalid Anthropic API key
293
+ ```
294
+ Make sure your API key is set correctly in `.env` or `.atezcarc`.
295
+
296
+ ### Cache Issues
297
+ ```bash
298
+ # Clear cache if interpretations seem stale
299
+ az cache clear
300
+ ```
301
+
302
+ ### Browser Issues
303
+ ```bash
304
+ # Install Playwright browsers
305
+ npx playwright install
306
+ ```
307
+
308
+ ## Contributing
309
+
310
+ Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
44
311
 
45
312
  ## License
46
313
 
47
- MIT
314
+ MIT License - see [LICENSE](LICENSE) for details.
315
+
316
+ ## Support
317
+
318
+ - 📧 Email: contacto@soygino.com
319
+ - 🐛 Issues: [GitHub Issues](https://github.com/maldos23/atezca/issues)
320
+ - 💬 Discussions: [GitHub Discussions](https://github.com/maldos23/atezca/discussions)
321
+
322
+ ## Roadmap
323
+
324
+ - [ ] Support for additional AI models (OpenAI, local models)
325
+ - [ ] Visual regression testing
326
+ - [ ] Parallel test execution
327
+ - [ ] Plugin system
328
+ - [ ] CI/CD integrations
329
+ - [ ] Test recorder browser extension
330
+
331
+ ---
332
+
333
+ Made with ❤️ by maldos23
package/package.json CHANGED
@@ -1,10 +1,17 @@
1
1
  {
2
2
  "name": "@atezca/core",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "AI-powered E2E testing library with natural language syntax",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
7
7
  "types": "./dist/index.d.ts",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/maldos23/atezca.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/maldos23/atezca/issues"
14
+ },
8
15
  "bin": {
9
16
  "az": "./dist/cli.js"
10
17
  },