@qate/cli 1.0.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/README.md +449 -0
- package/dist/AxiosGenerator.d.ts +24 -0
- package/dist/AxiosGenerator.d.ts.map +1 -0
- package/dist/AxiosGenerator.js +260 -0
- package/dist/AxiosGenerator.js.map +1 -0
- package/dist/PlaywrightGenerator.d.ts +39 -0
- package/dist/PlaywrightGenerator.d.ts.map +1 -0
- package/dist/PlaywrightGenerator.js +1342 -0
- package/dist/PlaywrightGenerator.js.map +1 -0
- package/dist/RestApiExecutor.d.ts +45 -0
- package/dist/RestApiExecutor.d.ts.map +1 -0
- package/dist/RestApiExecutor.js +336 -0
- package/dist/RestApiExecutor.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +1269 -0
- package/dist/cli.js.map +1 -0
- package/dist/client.d.ts +296 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +143 -0
- package/dist/client.js.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Axios Test Generator
|
|
4
|
+
* Converts Qate REST API and SOAP test definitions to runnable Axios test files
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.generateAxiosTests = generateAxiosTests;
|
|
8
|
+
exports.generateAxiosSummary = generateAxiosSummary;
|
|
9
|
+
/**
|
|
10
|
+
* Escape string for use in generated code
|
|
11
|
+
*/
|
|
12
|
+
function escapeString(str) {
|
|
13
|
+
if (!str)
|
|
14
|
+
return '';
|
|
15
|
+
return str
|
|
16
|
+
.replace(/\\/g, '\\\\')
|
|
17
|
+
.replace(/'/g, "\\'")
|
|
18
|
+
.replace(/\n/g, '\\n')
|
|
19
|
+
.replace(/\r/g, '\\r');
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Escape a template literal string (backtick-delimited)
|
|
23
|
+
*/
|
|
24
|
+
function escapeTemplateLiteral(str) {
|
|
25
|
+
if (!str)
|
|
26
|
+
return '';
|
|
27
|
+
return str
|
|
28
|
+
.replace(/\\/g, '\\\\')
|
|
29
|
+
.replace(/`/g, '\\`')
|
|
30
|
+
.replace(/\$\{/g, '\\${');
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Convert test name to valid filename
|
|
34
|
+
*/
|
|
35
|
+
function toFilename(name) {
|
|
36
|
+
return name
|
|
37
|
+
.toLowerCase()
|
|
38
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
39
|
+
.replace(/^-|-$/g, '')
|
|
40
|
+
.substring(0, 50);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Generate the code for a single REST API step
|
|
44
|
+
*/
|
|
45
|
+
function generateRestApiStepCode(step, stepIndex, indent) {
|
|
46
|
+
const input = step.toolInput || {};
|
|
47
|
+
const method = (input.method || 'GET').toUpperCase();
|
|
48
|
+
const url = input.url || '/';
|
|
49
|
+
const description = step.description || `${method} ${url}`;
|
|
50
|
+
const lines = [];
|
|
51
|
+
lines.push(`${indent}test('Step ${stepIndex + 1}: ${escapeString(description)}', async () => {`);
|
|
52
|
+
// Build axios config
|
|
53
|
+
lines.push(`${indent} const response = await axios({`);
|
|
54
|
+
lines.push(`${indent} method: '${method}',`);
|
|
55
|
+
lines.push(`${indent} url: \`\${BASE_URL}${escapeTemplateLiteral(url)}\`,`);
|
|
56
|
+
// Headers
|
|
57
|
+
const headers = { ...input.headers };
|
|
58
|
+
if (input.body && ['POST', 'PUT', 'PATCH'].includes(method) && !headers['Content-Type']) {
|
|
59
|
+
try {
|
|
60
|
+
JSON.parse(input.body);
|
|
61
|
+
headers['Content-Type'] = 'application/json';
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
headers['Content-Type'] = 'text/plain';
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (Object.keys(headers).length > 0) {
|
|
68
|
+
lines.push(`${indent} headers: {`);
|
|
69
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
70
|
+
lines.push(`${indent} '${escapeString(key)}': '${escapeString(value)}',`);
|
|
71
|
+
}
|
|
72
|
+
lines.push(`${indent} },`);
|
|
73
|
+
}
|
|
74
|
+
// Request body
|
|
75
|
+
if (input.body && ['POST', 'PUT', 'PATCH'].includes(method)) {
|
|
76
|
+
try {
|
|
77
|
+
const parsed = JSON.parse(input.body);
|
|
78
|
+
const bodyJson = JSON.stringify(parsed, null, 6)
|
|
79
|
+
.split('\n')
|
|
80
|
+
.map((line, i) => i === 0 ? line : `${indent} ${line}`)
|
|
81
|
+
.join('\n');
|
|
82
|
+
lines.push(`${indent} data: ${bodyJson},`);
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
lines.push(`${indent} data: '${escapeString(input.body)}',`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (input.timeout) {
|
|
89
|
+
lines.push(`${indent} timeout: ${input.timeout},`);
|
|
90
|
+
}
|
|
91
|
+
lines.push(`${indent} validateStatus: () => true,`);
|
|
92
|
+
lines.push(`${indent} });`);
|
|
93
|
+
lines.push('');
|
|
94
|
+
// Assertions
|
|
95
|
+
if (input.expectedStatus !== undefined) {
|
|
96
|
+
lines.push(`${indent} expect(response.status).toBe(${input.expectedStatus});`);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
lines.push(`${indent} expect(response.status).toBeGreaterThanOrEqual(200);`);
|
|
100
|
+
lines.push(`${indent} expect(response.status).toBeLessThan(300);`);
|
|
101
|
+
}
|
|
102
|
+
lines.push(`${indent}});`);
|
|
103
|
+
return lines.join('\n');
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Generate the code for a single SOAP step
|
|
107
|
+
*/
|
|
108
|
+
function generateSoapStepCode(step, stepIndex, indent) {
|
|
109
|
+
const input = step.toolInput || {};
|
|
110
|
+
const operation = input.operation || 'SOAP Operation';
|
|
111
|
+
const serviceUrl = input.serviceUrl || '/';
|
|
112
|
+
const description = step.description || `SOAP ${operation}`;
|
|
113
|
+
const lines = [];
|
|
114
|
+
lines.push(`${indent}test('Step ${stepIndex + 1}: ${escapeString(description)}', async () => {`);
|
|
115
|
+
// SOAP envelope
|
|
116
|
+
lines.push(`${indent} const envelope = \`${escapeTemplateLiteral(input.envelope || '')}\`;`);
|
|
117
|
+
lines.push('');
|
|
118
|
+
// Build axios config
|
|
119
|
+
lines.push(`${indent} const response = await axios({`);
|
|
120
|
+
lines.push(`${indent} method: 'POST',`);
|
|
121
|
+
lines.push(`${indent} url: \`\${BASE_URL}${escapeTemplateLiteral(serviceUrl)}\`,`);
|
|
122
|
+
// Headers
|
|
123
|
+
lines.push(`${indent} headers: {`);
|
|
124
|
+
lines.push(`${indent} 'Content-Type': 'text/xml; charset=utf-8',`);
|
|
125
|
+
if (input.soapAction) {
|
|
126
|
+
lines.push(`${indent} 'SOAPAction': '${escapeString(input.soapAction)}',`);
|
|
127
|
+
}
|
|
128
|
+
if (input.headers) {
|
|
129
|
+
for (const [key, value] of Object.entries(input.headers)) {
|
|
130
|
+
if (key !== 'Content-Type' && key !== 'SOAPAction') {
|
|
131
|
+
lines.push(`${indent} '${escapeString(key)}': '${escapeString(value)}',`);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
lines.push(`${indent} },`);
|
|
136
|
+
lines.push(`${indent} data: envelope,`);
|
|
137
|
+
if (input.timeout) {
|
|
138
|
+
lines.push(`${indent} timeout: ${input.timeout},`);
|
|
139
|
+
}
|
|
140
|
+
lines.push(`${indent} validateStatus: () => true,`);
|
|
141
|
+
lines.push(`${indent} });`);
|
|
142
|
+
lines.push('');
|
|
143
|
+
// Assertions
|
|
144
|
+
lines.push(`${indent} expect(response.status).toBe(200);`);
|
|
145
|
+
if (input.validateSoapFault !== false) {
|
|
146
|
+
lines.push(`${indent} expect(response.data).not.toContain('<soap:Fault>');`);
|
|
147
|
+
lines.push(`${indent} expect(response.data).not.toContain('<faultcode>');`);
|
|
148
|
+
}
|
|
149
|
+
lines.push(`${indent}});`);
|
|
150
|
+
return lines.join('\n');
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Generate a single test file for a REST API / SOAP test
|
|
154
|
+
*/
|
|
155
|
+
function generateTestFile(test, baseUrl) {
|
|
156
|
+
const steps = (test.steps || [])
|
|
157
|
+
.filter(s => s.type === 'tool_use')
|
|
158
|
+
.sort((a, b) => (a.order || 0) - (b.order || 0));
|
|
159
|
+
const stepCode = steps
|
|
160
|
+
.map((step, index) => {
|
|
161
|
+
const toolName = step.toolName || '';
|
|
162
|
+
if (toolName === 'soap_service_test') {
|
|
163
|
+
return generateSoapStepCode(step, index, ' ');
|
|
164
|
+
}
|
|
165
|
+
return generateRestApiStepCode(step, index, ' ');
|
|
166
|
+
})
|
|
167
|
+
.join('\n\n');
|
|
168
|
+
const description = test.description ? `\n * ${test.description}` : '';
|
|
169
|
+
const tags = test.tags?.length ? `\n * Tags: ${test.tags.join(', ')}` : '';
|
|
170
|
+
const priority = test.priority ? `\n * Priority: ${test.priority}` : '';
|
|
171
|
+
return `/**
|
|
172
|
+
* Test: ${test.name}${description}${tags}${priority}
|
|
173
|
+
*
|
|
174
|
+
* Generated by Qate CLI
|
|
175
|
+
* Do not edit manually - regenerate using: qate export
|
|
176
|
+
*/
|
|
177
|
+
|
|
178
|
+
import axios from 'axios';
|
|
179
|
+
import { describe, test, expect } from 'vitest';
|
|
180
|
+
|
|
181
|
+
const BASE_URL = '${escapeString(baseUrl)}';
|
|
182
|
+
|
|
183
|
+
describe('${escapeString(test.name)}', () => {
|
|
184
|
+
${stepCode}
|
|
185
|
+
});
|
|
186
|
+
`;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Generate package.json for Axios tests
|
|
190
|
+
*/
|
|
191
|
+
function generatePackageJson(name) {
|
|
192
|
+
const safeName = name.toLowerCase().replace(/[^a-z0-9-]/g, '-');
|
|
193
|
+
return JSON.stringify({
|
|
194
|
+
name: `${safeName}-api-tests`,
|
|
195
|
+
version: '1.0.0',
|
|
196
|
+
description: 'API tests generated by Qate CLI',
|
|
197
|
+
scripts: {
|
|
198
|
+
test: 'vitest run',
|
|
199
|
+
'test:watch': 'vitest',
|
|
200
|
+
},
|
|
201
|
+
dependencies: {
|
|
202
|
+
'axios': '^1.6.0',
|
|
203
|
+
},
|
|
204
|
+
devDependencies: {
|
|
205
|
+
'vitest': '^1.0.0',
|
|
206
|
+
'typescript': '^5.0.0',
|
|
207
|
+
},
|
|
208
|
+
}, null, 2);
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Generate vitest.config.ts
|
|
212
|
+
*/
|
|
213
|
+
function generateVitestConfig() {
|
|
214
|
+
return `import { defineConfig } from 'vitest/config';
|
|
215
|
+
|
|
216
|
+
export default defineConfig({
|
|
217
|
+
test: {
|
|
218
|
+
globals: true,
|
|
219
|
+
testTimeout: 30000,
|
|
220
|
+
},
|
|
221
|
+
});
|
|
222
|
+
`;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Main generator function
|
|
226
|
+
*/
|
|
227
|
+
function generateAxiosTests(exportData, options) {
|
|
228
|
+
const appUrl = exportData.application?.url || 'http://localhost:3000';
|
|
229
|
+
const appName = exportData.application?.name || 'app';
|
|
230
|
+
const tests = exportData.tests || [];
|
|
231
|
+
const result = {
|
|
232
|
+
'package.json': generatePackageJson(appName),
|
|
233
|
+
'vitest.config.ts': generateVitestConfig(),
|
|
234
|
+
tests: {},
|
|
235
|
+
};
|
|
236
|
+
for (const test of tests) {
|
|
237
|
+
const filename = `${toFilename(test.name)}.test.ts`;
|
|
238
|
+
result.tests[filename] = generateTestFile(test, appUrl);
|
|
239
|
+
}
|
|
240
|
+
return result;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Generate a summary of what will be created
|
|
244
|
+
*/
|
|
245
|
+
function generateAxiosSummary(exportData) {
|
|
246
|
+
const testCount = exportData.tests?.length || 0;
|
|
247
|
+
const stepCount = exportData.tests?.reduce((sum, t) => sum + (t.steps?.length || 0), 0) || 0;
|
|
248
|
+
const appName = exportData.application?.name || 'Unknown';
|
|
249
|
+
const appUrl = exportData.application?.url || 'Not specified';
|
|
250
|
+
const appType = exportData.application?.type || 'unknown';
|
|
251
|
+
const type = exportData.type === 'testsequence' ? 'Test Sequence' : 'Test Set';
|
|
252
|
+
const name = exportData.testSequence?.name || exportData.testSet?.name || 'Unknown';
|
|
253
|
+
return `
|
|
254
|
+
Generating Axios tests from ${type}: "${name}"
|
|
255
|
+
Application: ${appName} (${appType}) - ${appUrl}
|
|
256
|
+
Tests: ${testCount}
|
|
257
|
+
Total Steps: ${stepCount}
|
|
258
|
+
`;
|
|
259
|
+
}
|
|
260
|
+
//# sourceMappingURL=AxiosGenerator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AxiosGenerator.js","sourceRoot":"","sources":["../src/AxiosGenerator.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAgQH,gDAoBC;AAKD,oDAgBC;AA3RD;;GAEG;AACH,SAAS,YAAY,CAAC,GAAuB;IAC3C,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC;IACpB,OAAO,GAAG;SACP,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,SAAS,qBAAqB,CAAC,GAAuB;IACpD,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC;IACpB,OAAO,GAAG;SACP,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,OAAO,EA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C;IAChD,MAAM,SAAS,GAAG,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IAC7F,MAAM,OAAO,GAAG,UAAU,CAAC,WAAW,EAAE,IAAI,IAAI,SAAS,CAAC;IAC1D,MAAM,MAAM,GAAG,UAAU,CAAC,WAAW,EAAE,GAAG,IAAI,eAAe,CAAC;IAC9D,MAAM,OAAO,GAAG,UAAU,CAAC,WAAW,EAAE,IAAI,IAAI,SAAS,CAAC;IAE1D,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,KAAK,cAAc,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,UAAU,CAAC;IAC/E,MAAM,IAAI,GAAG,UAAU,CAAC,YAAY,EAAE,IAAI,IAAI,UAAU,CAAC,OAAO,EAAE,IAAI,IAAI,SAAS,CAAC;IAEpF,OAAO;8BACqB,IAAI,MAAM,IAAI;eAC7B,OAAO,KAAK,OAAO,OAAO,MAAM;SACtC,SAAS;eACH,SAAS;CACvB,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Playwright Code Generator
|
|
3
|
+
* Converts Qate test definitions to runnable Playwright test files
|
|
4
|
+
*/
|
|
5
|
+
import { ExportData } from './client';
|
|
6
|
+
export interface GeneratorOptions {
|
|
7
|
+
outputDir: string;
|
|
8
|
+
baseUrl?: string;
|
|
9
|
+
provider?: 'local' | 'browserstack' | 'saucelabs' | 'lambdatest';
|
|
10
|
+
browsers?: string[];
|
|
11
|
+
executionId?: string;
|
|
12
|
+
apiUrl?: string;
|
|
13
|
+
browser?: string;
|
|
14
|
+
browserVersion?: string;
|
|
15
|
+
os?: string;
|
|
16
|
+
osVersion?: string;
|
|
17
|
+
orchestration?: 'websocket' | 'cli';
|
|
18
|
+
}
|
|
19
|
+
export interface GeneratedFiles {
|
|
20
|
+
'playwright.config.ts': string;
|
|
21
|
+
'package.json': string;
|
|
22
|
+
tests: {
|
|
23
|
+
[filename: string]: string;
|
|
24
|
+
};
|
|
25
|
+
'.sauce/config.yml'?: string;
|
|
26
|
+
'browserstack.yml'?: string;
|
|
27
|
+
'hyperexecute.yaml'?: string;
|
|
28
|
+
'qate-reporter.ts'?: string;
|
|
29
|
+
'qate-runtime.ts'?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Main generator function
|
|
33
|
+
*/
|
|
34
|
+
export declare function generatePlaywrightTests(exportData: ExportData, options: GeneratorOptions): GeneratedFiles;
|
|
35
|
+
/**
|
|
36
|
+
* Generate a summary of what will be created
|
|
37
|
+
*/
|
|
38
|
+
export declare function generateSummary(exportData: ExportData): string;
|
|
39
|
+
//# sourceMappingURL=PlaywrightGenerator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlaywrightGenerator.d.ts","sourceRoot":"","sources":["../src/PlaywrightGenerator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAA4B,MAAM,UAAU,CAAC;AAEhE,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,GAAG,cAAc,GAAG,WAAW,GAAG,YAAY,CAAC;IACjE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,aAAa,CAAC,EAAE,WAAW,GAAG,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