@testsmith/testblocks 0.9.8 → 0.9.9

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.
@@ -16,7 +16,7 @@
16
16
  overflow: hidden;
17
17
  }
18
18
  </style>
19
- <script type="module" crossorigin src="/assets/index-CYoJ_6bl.js"></script>
19
+ <script type="module" crossorigin src="/assets/index-CSdQPHwK.js"></script>
20
20
  <link rel="stylesheet" crossorigin href="/assets/index-CDAzk2fI.css">
21
21
  </head>
22
22
  <body>
@@ -43,6 +43,7 @@ const path_1 = __importDefault(require("path"));
43
43
  const fs_1 = __importDefault(require("fs"));
44
44
  const executor_1 = require("./executor");
45
45
  const reporters_1 = require("../cli/reporters");
46
+ const openApiParser_1 = require("./openApiParser");
46
47
  // Read version from package.json
47
48
  function getVersion() {
48
49
  try {
@@ -390,6 +391,55 @@ async function startServer(options = {}) {
390
391
  (0, globals_1.setTestIdAttribute)(testIdAttribute);
391
392
  res.json({ testIdAttribute: (0, globals_1.getTestIdAttribute)() });
392
393
  });
394
+ // OpenAPI import endpoints
395
+ app.post('/api/openapi/parse', async (req, res) => {
396
+ try {
397
+ const { url } = req.body;
398
+ if (!url) {
399
+ return res.status(400).json({ error: 'URL is required' });
400
+ }
401
+ const spec = await (0, openApiParser_1.parseOpenApiSpec)(url, true);
402
+ res.json(spec);
403
+ }
404
+ catch (error) {
405
+ res.status(500).json({ error: 'Failed to parse spec', message: error.message });
406
+ }
407
+ });
408
+ app.post('/api/openapi/parse-content', async (req, res) => {
409
+ try {
410
+ const { content } = req.body;
411
+ if (!content) {
412
+ return res.status(400).json({ error: 'Content is required' });
413
+ }
414
+ const spec = await (0, openApiParser_1.parseOpenApiSpec)(content, false);
415
+ res.json(spec);
416
+ }
417
+ catch (error) {
418
+ res.status(500).json({ error: 'Failed to parse spec', message: error.message });
419
+ }
420
+ });
421
+ app.post('/api/openapi/generate', async (req, res) => {
422
+ try {
423
+ const { url, content, selectedEndpoints, options } = req.body;
424
+ if (!selectedEndpoints || selectedEndpoints.length === 0) {
425
+ return res.status(400).json({ error: 'No endpoints selected' });
426
+ }
427
+ const spec = url
428
+ ? await (0, openApiParser_1.parseOpenApiSpec)(url, true)
429
+ : await (0, openApiParser_1.parseOpenApiSpec)(content, false);
430
+ const files = (0, openApiParser_1.generateTestFiles)(spec, selectedEndpoints, options);
431
+ res.json({
432
+ files: files.map(f => ({
433
+ fileName: f.fileName,
434
+ testFile: f.testFile,
435
+ testCount: f.testFile.tests.length,
436
+ })),
437
+ });
438
+ }
439
+ catch (error) {
440
+ res.status(500).json({ error: 'Failed to generate tests', message: error.message });
441
+ }
442
+ });
393
443
  // Run tests
394
444
  app.post('/api/run', async (req, res) => {
395
445
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testsmith/testblocks",
3
- "version": "0.9.8",
3
+ "version": "0.9.9",
4
4
  "description": "Visual test automation tool with Blockly - API and Playwright testing",
5
5
  "author": "Roy de Kleijn",
6
6
  "license": "MIT",