@appliqation/automation-sdk 2.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.
- package/LICENSE +21 -0
- package/README.md +441 -0
- package/package.json +107 -0
- package/src/AppliqationClient.js +562 -0
- package/src/constants.js +245 -0
- package/src/core/AuthManager.js +353 -0
- package/src/core/HttpClient.js +475 -0
- package/src/index.d.ts +333 -0
- package/src/index.js +26 -0
- package/src/playwright/JwtBrowserAuth.js +240 -0
- package/src/playwright/fixture.js +92 -0
- package/src/playwright/global-setup.js +243 -0
- package/src/playwright/helpers/jwt-browser-auth.js +227 -0
- package/src/playwright/index.js +16 -0
- package/src/reporters/cypress/CypressReporter.js +387 -0
- package/src/reporters/cypress/UuidExtractor.js +139 -0
- package/src/reporters/cypress/index.js +30 -0
- package/src/reporters/jest/JestReporter.js +361 -0
- package/src/reporters/jest/UuidExtractor.js +174 -0
- package/src/reporters/jest/index.js +28 -0
- package/src/reporters/playwright/AppliqationReporter.js +654 -0
- package/src/reporters/playwright/helpers/DeviceOsDetector.js +435 -0
- package/src/reporters/playwright/helpers/UuidExtractor.js +290 -0
- package/src/reporters/playwright/index.d.ts +96 -0
- package/src/reporters/playwright/index.js +14 -0
- package/src/services/OrphanTestService.js +74 -0
- package/src/services/ResultService.js +252 -0
- package/src/services/RunMatrixService.js +309 -0
- package/src/utils/PayloadBuilder.js +280 -0
- package/src/utils/RunDataNormalizer.js +335 -0
- package/src/utils/UuidValidator.js +102 -0
- package/src/utils/errors.js +217 -0
- package/src/utils/index.js +17 -0
- package/src/utils/logger.js +124 -0
- package/src/utils/mapAppqUuid.js +83 -0
- package/src/utils/validator.js +157 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Appliqation Pty Ltd
|
|
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
ADDED
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
# Appliqation Automation Integration SDK
|
|
2
|
+
|
|
3
|
+
A powerful SDK for integrating test automation results with the Appliqation portal. Supports **Playwright** (v2.0+) with built-in reporters, plus **Cypress and Jest** (coming soon).
|
|
4
|
+
|
|
5
|
+
## ✨ Features
|
|
6
|
+
|
|
7
|
+
- 🎯 **Modern Architecture** - API key authentication, run matrix management
|
|
8
|
+
- 🔧 **Built-in Reporters** - Native Playwright integration (Cypress & Jest in progress)
|
|
9
|
+
- 🆔 **Automatic Run Management** - Creates run matrices with browser/device/OS tracking
|
|
10
|
+
- 📊 **Batch Operations** - Efficient batch result submission
|
|
11
|
+
- 🔄 **Retry Logic** - Built-in retry mechanism for reliability
|
|
12
|
+
- 📝 **Flexible Logging** - Configurable logging levels
|
|
13
|
+
- 🛡️ **Error Handling** - Comprehensive error handling and validation
|
|
14
|
+
- 🎨 **Custom Run Titles** - Set custom test run names via environment variables or config
|
|
15
|
+
|
|
16
|
+
## 🚩 Framework Support Status
|
|
17
|
+
|
|
18
|
+
| Framework | Status | Reporter Available |
|
|
19
|
+
|-----------|--------|-------------------|
|
|
20
|
+
| Playwright | ✅ **Production Ready** | Yes - `@appliqation/playwright` |
|
|
21
|
+
| Cypress | 🚧 **In Development** | Coming in v2.1.0 |
|
|
22
|
+
| Jest | 🚧 **In Development** | Coming in v2.1.0 |
|
|
23
|
+
| Others | ⏳ **Planned** | Use core SDK directly |
|
|
24
|
+
|
|
25
|
+
## 🚀 Quick Start
|
|
26
|
+
|
|
27
|
+
### Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install @appliqation/automation-sdk
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Playwright (Recommended - Production Ready)
|
|
34
|
+
|
|
35
|
+
Add the Appliqation reporter to your `playwright.config.js`:
|
|
36
|
+
|
|
37
|
+
```javascript
|
|
38
|
+
const { AppliqationReporter } = require('@appliqation/automation-sdk/playwright');
|
|
39
|
+
|
|
40
|
+
module.exports = {
|
|
41
|
+
reporter: [
|
|
42
|
+
['list'],
|
|
43
|
+
[AppliqationReporter, {
|
|
44
|
+
baseUrl: process.env.APPLIQATION_BASE_URL,
|
|
45
|
+
apiKey: process.env.APPLIQATION_API_KEY,
|
|
46
|
+
projectKey: process.env.APPLIQATION_PROJECT_KEY,
|
|
47
|
+
scenarioId: parseInt(process.env.APPLIQATION_SCENARIO_ID),
|
|
48
|
+
environment: process.env.APPLIQATION_ENVIRONMENT || 'Local',
|
|
49
|
+
title: process.env.APPLIQATION_RUN_TITLE, // Custom run title (optional)
|
|
50
|
+
autoCreateRun: true
|
|
51
|
+
}]
|
|
52
|
+
]
|
|
53
|
+
};
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Add UUIDs to your tests using the `mapAppqUuid` helper:
|
|
57
|
+
|
|
58
|
+
```javascript
|
|
59
|
+
const { test, expect } = require('@playwright/test');
|
|
60
|
+
const { mapAppqUuid } = require('@appliqation/automation-sdk/utils');
|
|
61
|
+
|
|
62
|
+
test('should login successfully', async ({ page }, testInfo) => {
|
|
63
|
+
// Map test to Appliqation test case
|
|
64
|
+
mapAppqUuid(testInfo, '1154-7a17b809-0ff9-4ba1-9322-4eb2a49abfc5');
|
|
65
|
+
|
|
66
|
+
// Your test code
|
|
67
|
+
await page.goto('/login');
|
|
68
|
+
await page.fill('#username', 'user@example.com');
|
|
69
|
+
await page.fill('#password', 'password');
|
|
70
|
+
await page.click('#login-button');
|
|
71
|
+
|
|
72
|
+
await expect(page).toHaveURL('/dashboard');
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Alternative (Manual Annotation):**
|
|
77
|
+
```javascript
|
|
78
|
+
test('should login successfully', async ({ page }) => {
|
|
79
|
+
// Add UUID annotation manually
|
|
80
|
+
test.info().annotations.push({
|
|
81
|
+
type: 'appliqation-uuid',
|
|
82
|
+
description: '1154-7a17b809-0ff9-4ba1-9322-4eb2a49abfc5'
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// Your test code...
|
|
86
|
+
});
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
That's it! Results are automatically reported to Appliqation. 🎉
|
|
90
|
+
|
|
91
|
+
## 📋 Configuration
|
|
92
|
+
|
|
93
|
+
### Environment Variables (Recommended)
|
|
94
|
+
|
|
95
|
+
Create a `.env` file:
|
|
96
|
+
|
|
97
|
+
```env
|
|
98
|
+
# Appliqation SDK Configuration - API KEY BASED AUTHENTICATION
|
|
99
|
+
# To generate an API key, go to: http://your-appliqation-instance/admin/config/appliqation/api-keys
|
|
100
|
+
APPLIQATION_BASE_URL=http://localhost:61285
|
|
101
|
+
APPLIQATION_API_KEY=appq_live_xxxxxxxxxxxxx
|
|
102
|
+
APPLIQATION_PROJECT_KEY=your-project-key-here
|
|
103
|
+
APPLIQATION_SCENARIO_ID=1154
|
|
104
|
+
APPLIQATION_ENVIRONMENT=Local
|
|
105
|
+
|
|
106
|
+
# Custom Run Title (optional) - Defaults to "Automation Run - {timestamp}" if not set
|
|
107
|
+
# Examples:
|
|
108
|
+
# APPLIQATION_RUN_TITLE=Sprint 24 - Regression Tests
|
|
109
|
+
# APPLIQATION_RUN_TITLE=Nightly Build #123
|
|
110
|
+
# APPLIQATION_RUN_TITLE=Production Smoke Tests
|
|
111
|
+
# APPLIQATION_RUN_TITLE=
|
|
112
|
+
|
|
113
|
+
# Logging
|
|
114
|
+
LOG_LEVEL=INFO
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Custom Run Titles
|
|
118
|
+
|
|
119
|
+
You can customize the test run name in three ways:
|
|
120
|
+
|
|
121
|
+
**1. Environment Variable (Recommended):**
|
|
122
|
+
```bash
|
|
123
|
+
APPLIQATION_RUN_TITLE="Sprint 24 - Regression Tests" npx playwright test
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**2. Config File (playwright.config.js):**
|
|
127
|
+
```javascript
|
|
128
|
+
[AppliqationReporter, {
|
|
129
|
+
// ...other config
|
|
130
|
+
title: "Sprint 24 - Regression Tests"
|
|
131
|
+
}]
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**3. SDK Client (Programmatic):**
|
|
135
|
+
```javascript
|
|
136
|
+
const client = new AppliqationClient({
|
|
137
|
+
baseUrl: 'https://your-instance.appliqation.com',
|
|
138
|
+
apiKey: 'appq_live_xxxxxxxxxxxxx',
|
|
139
|
+
projectKey: 'your-project-key',
|
|
140
|
+
title: 'Sprint 24 - Regression Tests'
|
|
141
|
+
});
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**Priority:** Config → Env Var → Default ("Automation Run - {timestamp}")
|
|
145
|
+
|
|
146
|
+
## 🔧 Framework Integration Examples
|
|
147
|
+
|
|
148
|
+
### Playwright ✅ (Production Ready)
|
|
149
|
+
|
|
150
|
+
See Quick Start above for full Playwright integration. The reporter automatically:
|
|
151
|
+
- Creates run matrices with browser/device/OS detection
|
|
152
|
+
- Extracts UUIDs from test annotations
|
|
153
|
+
- Batches and submits results
|
|
154
|
+
- Handles orphan tests (tests without UUIDs)
|
|
155
|
+
|
|
156
|
+
### Cypress 🚧 (Coming in v2.1.0)
|
|
157
|
+
|
|
158
|
+
Will work similarly to Playwright:
|
|
159
|
+
|
|
160
|
+
```javascript
|
|
161
|
+
// cypress.config.js
|
|
162
|
+
const { CypressReporter } = require('@appliqation/automation-sdk/cypress');
|
|
163
|
+
|
|
164
|
+
module.exports = defineConfig({
|
|
165
|
+
e2e: {
|
|
166
|
+
setupNodeEvents(on, config) {
|
|
167
|
+
CypressReporter(on, {
|
|
168
|
+
baseUrl: process.env.APPLIQATION_BASE_URL,
|
|
169
|
+
apiKey: process.env.APPLIQATION_API_KEY,
|
|
170
|
+
projectKey: process.env.APPLIQATION_PROJECT_KEY,
|
|
171
|
+
scenarioId: parseInt(process.env.APPLIQATION_SCENARIO_ID),
|
|
172
|
+
environment: process.env.APPLIQATION_ENVIRONMENT || 'Local',
|
|
173
|
+
title: process.env.APPLIQATION_RUN_TITLE
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
```javascript
|
|
181
|
+
// Add UUID to tests
|
|
182
|
+
it('should login successfully', { uuid: '1154-7a17b809-0ff9-4ba1-9322-4eb2a49abfc5' }, () => {
|
|
183
|
+
cy.visit('/login');
|
|
184
|
+
cy.get('#username').type('user@example.com');
|
|
185
|
+
cy.get('#password').type('password');
|
|
186
|
+
cy.get('#login-button').click();
|
|
187
|
+
cy.url().should('include', '/dashboard');
|
|
188
|
+
});
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Jest 🚧 (Coming in v2.1.0)
|
|
192
|
+
|
|
193
|
+
Will work similarly to Playwright:
|
|
194
|
+
|
|
195
|
+
```javascript
|
|
196
|
+
// jest.config.js
|
|
197
|
+
const { JestReporter } = require('@appliqation/automation-sdk/jest');
|
|
198
|
+
|
|
199
|
+
module.exports = {
|
|
200
|
+
reporters: [
|
|
201
|
+
'default',
|
|
202
|
+
[JestReporter, {
|
|
203
|
+
baseUrl: process.env.APPLIQATION_BASE_URL,
|
|
204
|
+
apiKey: process.env.APPLIQATION_API_KEY,
|
|
205
|
+
projectKey: process.env.APPLIQATION_PROJECT_KEY,
|
|
206
|
+
scenarioId: parseInt(process.env.APPLIQATION_SCENARIO_ID),
|
|
207
|
+
environment: process.env.APPLIQATION_ENVIRONMENT || 'Local',
|
|
208
|
+
title: process.env.APPLIQATION_RUN_TITLE
|
|
209
|
+
}]
|
|
210
|
+
]
|
|
211
|
+
};
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
```javascript
|
|
215
|
+
// Add UUID to tests
|
|
216
|
+
test('should login successfully', async () => {
|
|
217
|
+
// Add UUID metadata
|
|
218
|
+
expect.getState().currentTestName = '1154-7a17b809-0ff9-4ba1-9322-4eb2a49abfc5';
|
|
219
|
+
|
|
220
|
+
// Your test code
|
|
221
|
+
const loginSuccess = await performLogin();
|
|
222
|
+
expect(loginSuccess).toBe(true);
|
|
223
|
+
});
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## 📊 Advanced Usage (Direct SDK)
|
|
227
|
+
|
|
228
|
+
For custom integrations or frameworks without built-in reporters, use the core SDK directly:
|
|
229
|
+
|
|
230
|
+
### Core SDK Usage
|
|
231
|
+
|
|
232
|
+
```javascript
|
|
233
|
+
const AppliqationClient = require('@appliqation/automation-sdk');
|
|
234
|
+
|
|
235
|
+
// Initialize client
|
|
236
|
+
const client = new AppliqationClient({
|
|
237
|
+
baseUrl: process.env.APPLIQATION_BASE_URL,
|
|
238
|
+
apiKey: process.env.APPLIQATION_API_KEY,
|
|
239
|
+
projectKey: process.env.APPLIQATION_PROJECT_KEY,
|
|
240
|
+
title: 'My Custom Test Run'
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
// Create run matrix
|
|
244
|
+
const run = await client.createRun({
|
|
245
|
+
scenarioId: 1154,
|
|
246
|
+
environment: 'Production',
|
|
247
|
+
browsers: ['Chrome', 'Firefox'],
|
|
248
|
+
device: 'Desktop',
|
|
249
|
+
os: 'Windows 11'
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
console.log('Run created:', run.runId);
|
|
253
|
+
|
|
254
|
+
// Submit single result
|
|
255
|
+
await client.submitResult(run.runId, {
|
|
256
|
+
uuid: '124-d1f9559c-b978-43cc-9c76-fd539c717cb4',
|
|
257
|
+
status: 'passed',
|
|
258
|
+
browser: 'Chrome',
|
|
259
|
+
comment: 'Test passed successfully'
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
// Submit batch results
|
|
263
|
+
const results = [
|
|
264
|
+
{ uuid: '124-test1-uuid', runId: run.runId, status: 'passed', browser: 'Chrome' },
|
|
265
|
+
{ uuid: '124-test2-uuid', runId: run.runId, status: 'failed', browser: 'Chrome', comment: 'Button missing' },
|
|
266
|
+
{ uuid: '124-test3-uuid', runId: run.runId, status: 'skipped', browser: 'Chrome' }
|
|
267
|
+
];
|
|
268
|
+
|
|
269
|
+
const summary = await client.submitBatch(results);
|
|
270
|
+
console.log(`Submitted: ${summary.success}/${summary.total} successful`);
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### Run Matrix Management
|
|
274
|
+
|
|
275
|
+
```javascript
|
|
276
|
+
// Create multiple runs for cross-browser testing
|
|
277
|
+
const configs = [
|
|
278
|
+
{ scenarioId: 1154, environment: 'Staging', browsers: ['Chrome'], device: 'Desktop', os: 'Windows 11' },
|
|
279
|
+
{ scenarioId: 1154, environment: 'Staging', browsers: ['Firefox'], device: 'Desktop', os: 'Windows 11' },
|
|
280
|
+
{ scenarioId: 1154, environment: 'Staging', browsers: ['Safari'], device: 'Desktop', os: 'macOS' }
|
|
281
|
+
];
|
|
282
|
+
|
|
283
|
+
const result = await client.createMultipleRuns(configs);
|
|
284
|
+
console.log(`Created ${result.summary.success} runs`);
|
|
285
|
+
|
|
286
|
+
// Add browser to existing run
|
|
287
|
+
await client.addBrowser(run.runId, 'Edge');
|
|
288
|
+
|
|
289
|
+
// Get run details
|
|
290
|
+
const runData = await client.getRun(run.runId);
|
|
291
|
+
console.log(runData);
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
## 🔍 API Reference
|
|
295
|
+
|
|
296
|
+
### AppliqationClient Class
|
|
297
|
+
|
|
298
|
+
**Constructor:**
|
|
299
|
+
```javascript
|
|
300
|
+
new AppliqationClient(config)
|
|
301
|
+
```
|
|
302
|
+
- `config.baseUrl` (string) - Appliqation instance URL
|
|
303
|
+
- `config.apiKey` (string) - API key (appq_live_xxxxx)
|
|
304
|
+
- `config.projectKey` (string) - Project key
|
|
305
|
+
- `config.username` (string, optional) - Username for legacy CSRF auth
|
|
306
|
+
- `config.password` (string, optional) - Password for legacy CSRF auth
|
|
307
|
+
- `config.title` (string, optional) - Custom run title
|
|
308
|
+
- `config.options` (object, optional):
|
|
309
|
+
- `timeout` (number) - Request timeout in ms (default: 30000)
|
|
310
|
+
- `retries` (number) - Retry attempts (default: 3)
|
|
311
|
+
- `logOrphans` (boolean) - Log orphan tests (default: true)
|
|
312
|
+
- `logLevel` (string) - Logging level (default: 'info')
|
|
313
|
+
|
|
314
|
+
**Methods:**
|
|
315
|
+
|
|
316
|
+
**createRun(options)** - Create test run matrix
|
|
317
|
+
- `options.scenarioId` (number) - Scenario node ID
|
|
318
|
+
- `options.testSetId` (number) - Test set node ID (alternative to scenarioId)
|
|
319
|
+
- `options.environment` (string) - Environment name (default: 'Local')
|
|
320
|
+
- `options.browsers` (array) - Browser names (default: ['Chrome'])
|
|
321
|
+
- `options.device` (string) - Device type
|
|
322
|
+
- `options.os` (string) - Operating system
|
|
323
|
+
- `options.title` (string) - Custom run title
|
|
324
|
+
- Returns: `{ runId, token, timestamp, metadata }`
|
|
325
|
+
|
|
326
|
+
**submitResult(runId, result)** - Submit single test result
|
|
327
|
+
- `runId` (string) - Run ID
|
|
328
|
+
- `result.uuid` (string) - Test case UUID (format: nid-uuid)
|
|
329
|
+
- `result.status` (string) - 'passed', 'failed', 'skipped'
|
|
330
|
+
- `result.browser` (string) - Browser name
|
|
331
|
+
- `result.comment` (string, optional) - Additional comments
|
|
332
|
+
- `result.environment` (string, optional) - Environment override
|
|
333
|
+
|
|
334
|
+
**submitBatch(results, options)** - Submit batch of results
|
|
335
|
+
- `results` (array) - Array of result objects
|
|
336
|
+
- `options.batchSize` (number) - Results per batch (default: 50)
|
|
337
|
+
- `options.onProgress` (function) - Progress callback
|
|
338
|
+
- `options.retryFailures` (boolean) - Retry failed submissions (default: true)
|
|
339
|
+
- Returns: `{ success, failed, total, invalidResults }`
|
|
340
|
+
|
|
341
|
+
**logOrphanTests(runId, orphanTests)** - Log tests without UUID mappings
|
|
342
|
+
**addBrowser(runId, browser)** - Add browser to existing run
|
|
343
|
+
**getRun(runId)** - Get run matrix data
|
|
344
|
+
**testConnection()** - Test connectivity to Appliqation
|
|
345
|
+
**validateUuid(uuid)** - Validate UUID format
|
|
346
|
+
**extractNid(uuid)** - Extract NID from UUID
|
|
347
|
+
**parseUuid(uuid)** - Validate and extract UUID components
|
|
348
|
+
|
|
349
|
+
## 🆔 Getting Test UUIDs
|
|
350
|
+
|
|
351
|
+
1. Login to your Appliqation portal
|
|
352
|
+
2. Navigate to your test cases
|
|
353
|
+
3. Download/copy the UUIDs for the test cases you want to automate
|
|
354
|
+
4. Use these UUIDs in your `reportResult()` calls
|
|
355
|
+
|
|
356
|
+
The UUIDs follow the format: `nid-uuid` (e.g., `124-d1f9559c-b978-43cc-9c76-fd539c717cb4`)
|
|
357
|
+
|
|
358
|
+
## 🏃♂️ Run Matrix Integration
|
|
359
|
+
|
|
360
|
+
Each test run in Appliqation has a unique `run_id`. The SDK will:
|
|
361
|
+
|
|
362
|
+
1. **Auto-generate** a run ID if not provided
|
|
363
|
+
2. **Use environment variable** `RUN_ID` if set
|
|
364
|
+
3. **Accept custom run ID** in configuration
|
|
365
|
+
|
|
366
|
+
All test results reported with the same `run_id` will appear together in your Appliqation run matrix.
|
|
367
|
+
|
|
368
|
+
## 🐛 Error Handling
|
|
369
|
+
|
|
370
|
+
```javascript
|
|
371
|
+
try {
|
|
372
|
+
const response = await reportResult('124-test-uuid', 'pass');
|
|
373
|
+
if (response.success) {
|
|
374
|
+
console.log('✅ Result reported successfully');
|
|
375
|
+
} else {
|
|
376
|
+
console.error('❌ Failed to report:', response.error);
|
|
377
|
+
}
|
|
378
|
+
} catch (error) {
|
|
379
|
+
console.error('❌ SDK Error:', error.message);
|
|
380
|
+
}
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
## 🔧 Troubleshooting
|
|
384
|
+
|
|
385
|
+
### Common Issues
|
|
386
|
+
|
|
387
|
+
1. **Authentication Failed**
|
|
388
|
+
```
|
|
389
|
+
Error: APPLIQATION_USERNAME environment variable is required
|
|
390
|
+
```
|
|
391
|
+
**Solution**: Set your credentials in `.env` file or pass to `init()`
|
|
392
|
+
|
|
393
|
+
2. **Invalid UUID Format**
|
|
394
|
+
```
|
|
395
|
+
Error: uuid must be in format: nid-uuid
|
|
396
|
+
```
|
|
397
|
+
**Solution**: Ensure UUID follows `124-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` format
|
|
398
|
+
|
|
399
|
+
3. **Connection Issues**
|
|
400
|
+
```javascript
|
|
401
|
+
// Test your connection
|
|
402
|
+
const sdk = new AppliqationSDK();
|
|
403
|
+
await sdk.init({ /* config */ });
|
|
404
|
+
const result = await sdk.testConnection();
|
|
405
|
+
console.log(result);
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
### Debug Mode
|
|
409
|
+
|
|
410
|
+
```javascript
|
|
411
|
+
await init({
|
|
412
|
+
// ... other config
|
|
413
|
+
logLevel: 'DEBUG' // See detailed logs
|
|
414
|
+
});
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
## 📝 Migration from v0.x
|
|
418
|
+
|
|
419
|
+
If you're upgrading from the old `drupal-test-results-sdk`:
|
|
420
|
+
|
|
421
|
+
```javascript
|
|
422
|
+
// Old way
|
|
423
|
+
const { DrupalTestResultsSDK } = require('drupal-test-results-sdk');
|
|
424
|
+
const sdk = new DrupalTestResultsSDK(config);
|
|
425
|
+
await sdk.insertResult(payload);
|
|
426
|
+
|
|
427
|
+
// New way
|
|
428
|
+
const { init, reportResult } = require('@appliqation/automation-sdk');
|
|
429
|
+
await init(config);
|
|
430
|
+
await reportResult(uuid, status, options);
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
## 🤝 Support
|
|
434
|
+
|
|
435
|
+
- 📧 **Email**: support@appliqation.com
|
|
436
|
+
- 📖 **Documentation**: [Appliqation Docs](https://docs.appliqation.com)
|
|
437
|
+
- 🐛 **Issues**: [GitHub Issues](https://github.com/your-repo/issues)
|
|
438
|
+
|
|
439
|
+
## 📄 License
|
|
440
|
+
|
|
441
|
+
MIT License - see LICENSE file for details.
|
package/package.json
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@appliqation/automation-sdk",
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "Appliqation Automation SDK with API key authentication, custom run titles, and framework-specific reporters",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"types": "src/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"require": "./src/index.js",
|
|
10
|
+
"import": "./src/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./playwright": {
|
|
13
|
+
"require": "./src/reporters/playwright/index.js",
|
|
14
|
+
"import": "./src/reporters/playwright/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./cypress": {
|
|
17
|
+
"require": "./src/reporters/cypress/index.js",
|
|
18
|
+
"import": "./src/reporters/cypress/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./jest": {
|
|
21
|
+
"require": "./src/reporters/jest/index.js",
|
|
22
|
+
"import": "./src/reporters/jest/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./utils": {
|
|
25
|
+
"require": "./src/utils/index.js",
|
|
26
|
+
"import": "./src/utils/index.js"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"src/",
|
|
31
|
+
"src/**/*.d.ts",
|
|
32
|
+
"README.md",
|
|
33
|
+
"LICENSE"
|
|
34
|
+
],
|
|
35
|
+
"scripts": {
|
|
36
|
+
"test": "jest",
|
|
37
|
+
"test:unit": "jest tests/unit",
|
|
38
|
+
"test:integration": "jest tests/integration",
|
|
39
|
+
"test:watch": "jest --watch",
|
|
40
|
+
"test:coverage": "jest --coverage",
|
|
41
|
+
"lint": "eslint src/",
|
|
42
|
+
"lint:fix": "eslint src/ --fix",
|
|
43
|
+
"example:basic": "node examples/basic-usage.js",
|
|
44
|
+
"example:playwright": "cd examples/playwright-basic && npx playwright test",
|
|
45
|
+
"example:cypress": "cd examples/cypress-basic && npm test",
|
|
46
|
+
"example:jest": "cd examples/jest-basic && npm test",
|
|
47
|
+
"docs": "echo 'Documentation generation coming soon'"
|
|
48
|
+
},
|
|
49
|
+
"keywords": [
|
|
50
|
+
"appliqation",
|
|
51
|
+
"testing",
|
|
52
|
+
"automation",
|
|
53
|
+
"test-management",
|
|
54
|
+
"playwright",
|
|
55
|
+
"cypress",
|
|
56
|
+
"jest",
|
|
57
|
+
"selenium",
|
|
58
|
+
"webdriver",
|
|
59
|
+
"api-key",
|
|
60
|
+
"sdk",
|
|
61
|
+
"test-reporting",
|
|
62
|
+
"test-results",
|
|
63
|
+
"quality-assurance",
|
|
64
|
+
"qa-tools"
|
|
65
|
+
],
|
|
66
|
+
"author": "Appliqation Team",
|
|
67
|
+
"license": "MIT",
|
|
68
|
+
"dependencies": {
|
|
69
|
+
"axios": "^1.6.0",
|
|
70
|
+
"dotenv": "^16.3.1",
|
|
71
|
+
"jsonwebtoken": "^9.0.2"
|
|
72
|
+
},
|
|
73
|
+
"devDependencies": {
|
|
74
|
+
"@playwright/test": "^1.40.0",
|
|
75
|
+
"cypress": "^13.0.0",
|
|
76
|
+
"eslint": "^8.57.0",
|
|
77
|
+
"jest": "^29.7.0",
|
|
78
|
+
"playwright": "^1.40.0"
|
|
79
|
+
},
|
|
80
|
+
"peerDependencies": {
|
|
81
|
+
"@playwright/test": ">=1.30.0",
|
|
82
|
+
"cypress": ">=10.0.0",
|
|
83
|
+
"jest": ">=29.0.0"
|
|
84
|
+
},
|
|
85
|
+
"peerDependenciesMeta": {
|
|
86
|
+
"@playwright/test": {
|
|
87
|
+
"optional": true
|
|
88
|
+
},
|
|
89
|
+
"cypress": {
|
|
90
|
+
"optional": true
|
|
91
|
+
},
|
|
92
|
+
"jest": {
|
|
93
|
+
"optional": true
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"engines": {
|
|
97
|
+
"node": ">=16.0.0"
|
|
98
|
+
},
|
|
99
|
+
"repository": {
|
|
100
|
+
"type": "git",
|
|
101
|
+
"url": "https://github.com/appliqation/automation-sdk-js"
|
|
102
|
+
},
|
|
103
|
+
"bugs": {
|
|
104
|
+
"url": "https://github.com/appliqation/automation-sdk-js/issues"
|
|
105
|
+
},
|
|
106
|
+
"homepage": "https://github.com/appliqation/automation-sdk-js#readme"
|
|
107
|
+
}
|