testeranto 0.81.3 → 0.84.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.
Files changed (71) hide show
  1. package/dist/common/src/Node.js +4 -2
  2. package/dist/common/src/PM/main.js +188 -61
  3. package/dist/common/src/PM/node.js +32 -7
  4. package/dist/common/src/PM/web.js +28 -54
  5. package/dist/common/src/Project.js +0 -3
  6. package/dist/common/src/Puppeteer.js +9 -51
  7. package/dist/common/src/SubPackages/react-dom/jsx/web.js +11 -11
  8. package/dist/common/src/Web.js +7 -1
  9. package/dist/common/src/esbuildConfigs/featuresPlugin.js +39 -0
  10. package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +62 -64
  11. package/dist/common/src/esbuildConfigs/node.js +10 -3
  12. package/dist/common/src/esbuildConfigs/web.js +6 -2
  13. package/dist/common/src/lib/abstractBase.js +348 -337
  14. package/dist/common/src/lib/basebuilder.js +9 -4
  15. package/dist/common/src/lib/core.js +1 -1
  16. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  17. package/dist/module/src/Node.js +3 -3
  18. package/dist/module/src/PM/main.js +188 -61
  19. package/dist/module/src/PM/node.js +32 -7
  20. package/dist/module/src/PM/web.js +28 -51
  21. package/dist/module/src/Project.js +0 -3
  22. package/dist/module/src/Puppeteer.js +9 -51
  23. package/dist/module/src/SubPackages/react-dom/jsx/web.js +10 -10
  24. package/dist/module/src/Web.js +6 -2
  25. package/dist/module/src/esbuildConfigs/featuresPlugin.js +34 -0
  26. package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +62 -64
  27. package/dist/module/src/esbuildConfigs/node.js +10 -3
  28. package/dist/module/src/esbuildConfigs/web.js +6 -2
  29. package/dist/module/src/lib/abstractBase.js +348 -337
  30. package/dist/module/src/lib/basebuilder.js +9 -4
  31. package/dist/module/src/lib/core.js +1 -1
  32. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  33. package/dist/prebuild/Puppeteer.mjs +82033 -0
  34. package/dist/types/src/Node.d.ts +5 -1
  35. package/dist/types/src/PM/index.d.ts +10 -4
  36. package/dist/types/src/PM/main.d.ts +21 -9
  37. package/dist/types/src/PM/node.d.ts +11 -3
  38. package/dist/types/src/PM/web.d.ts +11 -2
  39. package/dist/types/src/SubPackages/react-dom/jsx/index.d.ts +1 -0
  40. package/dist/types/src/SubPackages/react-test-renderer/jsx/index.d.ts +1 -0
  41. package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/index.d.ts +1 -0
  42. package/dist/types/src/Types.d.ts +2 -2
  43. package/dist/types/src/Web.d.ts +5 -1
  44. package/dist/types/src/esbuildConfigs/featuresPlugin.d.ts +5 -0
  45. package/dist/types/src/esbuildConfigs/inputFilesPlugin.d.ts +4 -2
  46. package/dist/types/src/lib/abstractBase.d.ts +5 -4
  47. package/dist/types/src/lib/core.d.ts +1 -1
  48. package/dist/types/src/lib/index.d.ts +1 -0
  49. package/dist/types/src/lib/types.d.ts +7 -5
  50. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  51. package/package.json +18 -45
  52. package/pupBuild.js +18 -0
  53. package/src/Node.ts +3 -5
  54. package/src/PM/index.ts +12 -3
  55. package/src/PM/main.ts +306 -140
  56. package/src/PM/node.ts +40 -7
  57. package/src/PM/web.ts +108 -58
  58. package/src/Project.ts +0 -8
  59. package/src/Puppeteer.ts +11 -57
  60. package/src/SubPackages/react-dom/jsx/web.ts +15 -10
  61. package/src/Types.ts +5 -2
  62. package/src/Web.ts +6 -2
  63. package/src/esbuildConfigs/featuresPlugin.ts +43 -0
  64. package/src/esbuildConfigs/inputFilesPlugin.ts +97 -90
  65. package/src/esbuildConfigs/node.ts +18 -3
  66. package/src/esbuildConfigs/web.ts +14 -2
  67. package/src/lib/abstractBase.ts +388 -366
  68. package/src/lib/basebuilder.ts +9 -9
  69. package/src/lib/core.ts +4 -2
  70. package/src/lib/index.ts +1 -0
  71. package/src/lib/types.ts +14 -6
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.NodeTesteranto = void 0;
6
7
  const core_js_1 = __importDefault(require("./lib/core.js"));
7
8
  const index_js_1 = require("./lib/index.js");
8
9
  const node_js_1 = require("./PM/node.js");
@@ -12,12 +13,13 @@ class NodeTesteranto extends core_js_1.default {
12
13
  }
13
14
  async receiveTestResourceConfig(partialTestResource) {
14
15
  const t = JSON.parse(partialTestResource);
15
- console.log("receiveTestResourceConfig", t);
16
16
  const pm = new node_js_1.PM_Node(t);
17
- const { failed, artifacts, logPromise } = await this.testJobs[0].receiveTestResourceConfig(pm);
17
+ const { failed, artifacts, logPromise, features } = await this.testJobs[0].receiveTestResourceConfig(pm);
18
18
  pm.customclose();
19
+ return features;
19
20
  }
20
21
  }
22
+ exports.NodeTesteranto = NodeTesteranto;
21
23
  exports.default = async (input, testSpecification, testImplementation, testInterface, testResourceRequirement = index_js_1.defaultTestResourceRequirement) => {
22
24
  return new NodeTesteranto(input, testSpecification, testImplementation, testResourceRequirement, testInterface);
23
25
  };
@@ -30,11 +30,12 @@ exports.PM_Main = void 0;
30
30
  const fs_1 = __importDefault(require("fs"));
31
31
  const path_1 = __importDefault(require("path"));
32
32
  const puppeteer_core_1 = __importDefault(require("puppeteer-core"));
33
+ const crypto_1 = __importDefault(require("crypto"));
33
34
  const index_js_1 = require("./index.js");
34
35
  const utils_js_1 = require("../utils.js");
35
36
  const fPaths = [];
36
37
  const fileStreams3 = [];
37
- const files = {}; // = new Set<string>();
38
+ const files = {};
38
39
  const screenshots = {};
39
40
  class PM_Main extends index_js_1.PM {
40
41
  constructor(configs) {
@@ -52,11 +53,9 @@ class PM_Main extends index_js_1.PM {
52
53
  }
53
54
  };
54
55
  this.register = (src) => {
55
- // console.log("register", src);
56
56
  this.registry[src] = false;
57
57
  };
58
58
  this.deregister = (src) => {
59
- // console.log("deregister", src, this.shutdownMode);
60
59
  this.registry[src] = true;
61
60
  if (this.shutdownMode) {
62
61
  this.checkForShutdown();
@@ -123,6 +122,9 @@ class PM_Main extends index_js_1.PM {
123
122
  return module.default.then((defaultModule) => {
124
123
  defaultModule
125
124
  .receiveTestResourceConfig(argz)
125
+ .then(async (features) => {
126
+ this.receiveFeatures(features, destFolder);
127
+ })
126
128
  .catch((e) => {
127
129
  console.log("catch", e);
128
130
  })
@@ -148,22 +150,22 @@ class PM_Main extends index_js_1.PM {
148
150
  fs: destFolder,
149
151
  browserWSEndpoint: this.browser.wsEndpoint(),
150
152
  });
151
- const evaluation = `
152
- console.log("importing ${dest}.mjs");
153
- import('${dest}.mjs').then(async (x) => {
154
- console.log("imported", x.default);
155
- })`;
153
+ // const evaluation = `
154
+ // console.log("importing ${dest}.mjs");
155
+ // import('${dest}.mjs').then(async (x) => {
156
+ // console.log("imported", x.default);
157
+ // })`;
156
158
  const fileStreams2 = [];
157
159
  const doneFileStream2 = [];
158
160
  return new Promise((res, rej) => {
159
161
  this.browser
160
162
  .newPage()
161
163
  .then((page) => {
162
- page.on("console", (msg) => {
163
- console.log("web > ", msg.args(), msg.text());
164
- // for (let i = 0; i < msg._args.length; ++i)
165
- // console.log(`${i}: ${msg._args[i]}`);
166
- });
164
+ // page.on("console", (msg) => {
165
+ // console.log("web > ", msg.args(), msg.text());
166
+ // // for (let i = 0; i < msg._args.length; ++i)
167
+ // // console.log(`${i}: ${msg._args[i]}`);
168
+ // });
167
169
  page.exposeFunction("custom-screenshot", async (ssOpts, testName) => {
168
170
  // console.log("main.ts browser custom-screenshot", testName);
169
171
  const p = ssOpts.path;
@@ -238,35 +240,12 @@ class PM_Main extends index_js_1.PM {
238
240
  delete screenshots[testName];
239
241
  // page.close();
240
242
  });
241
- // globalThis["writeFileSync"](
242
- // p + "/manifest.json",
243
- // // files.entries()
244
- // JSON.stringify(Array.from(files[testName]))
245
- // );
246
- // console.log("closing doneFileStream2", doneFileStream2);
247
- // console.log("closing doneFileStream2", doneFileStream2);
248
- // Promise.all([...doneFileStream2, ...screenshots2]).then(() => {
249
- // page.close();
250
- // });
251
- // Promise.all(screenshots).then(() => {
252
- // page.close();
253
- // });
254
- // setTimeout(() => {
255
- // console.log("Delayed for 1 second.");
256
- // page.close();
257
- // }, 5000);
258
- // return page.close();
259
243
  });
260
244
  return page;
261
245
  })
262
246
  .then(async (page) => {
263
- page.on("console", (log) => console.debug(`Log from client: [${log.text()}] `));
264
247
  await page.goto(`file://${`${dest}.html`}`, {});
265
248
  res(page);
266
- // page.evaluate(evaluation).finally(() => {
267
- // console.log("evaluation failed.", dest);
268
- // });
269
- // return page;
270
249
  });
271
250
  });
272
251
  };
@@ -275,13 +254,6 @@ class PM_Main extends index_js_1.PM {
275
254
  console.log("launchNodeSideCar", src, dest, d);
276
255
  const destFolder = dest.replace(".mjs", "");
277
256
  let argz = "";
278
- // const testConfig = this.configs.tests.find((t) => {
279
- // return t[0] === src;
280
- // });
281
- // if (!testConfig) {
282
- // console.error("missing test config");
283
- // process.exit(-1);
284
- // }
285
257
  const testConfigResource = testConfig[2];
286
258
  let portsToUse = [];
287
259
  if (testConfigResource.ports === 0) {
@@ -366,9 +338,9 @@ class PM_Main extends index_js_1.PM {
366
338
  const evaluation = `
367
339
  console.log("importing ${dest}.mjs");
368
340
  import('${dest}.mjs').then(async (x) => {
369
- console.log("imported", x.default);
341
+ console.log("imported", (await x.default));
370
342
  try {
371
- await (await x.default).receiveTestResourceConfig(${webArgz})
343
+ return await (await x.default).receiveTestResourceConfig(${webArgz})
372
344
  } catch (e) {
373
345
  console.log("fail", e)
374
346
  }
@@ -378,13 +350,30 @@ class PM_Main extends index_js_1.PM {
378
350
  this.browser
379
351
  .newPage()
380
352
  .then((page) => {
381
- page.on("console", (msg) => {
382
- console.log("web > ", msg.args(), msg.text());
383
- // for (let i = 0; i < msg._args.length; ++i)
384
- // console.log(`${i}: ${msg._args[i]}`);
353
+ // page.on("console", (msg) => {
354
+ // // console.log("web > ", msg.args(), msg.text());
355
+ // });
356
+ page.exposeFunction("screencast", async (ssOpts, testName) => {
357
+ const p = ssOpts.path;
358
+ const dir = path_1.default.dirname(p);
359
+ fs_1.default.mkdirSync(dir, {
360
+ recursive: true,
361
+ });
362
+ if (!files[testName]) {
363
+ files[testName] = new Set();
364
+ }
365
+ files[testName].add(ssOpts.path);
366
+ const sPromise = page.screenshot(Object.assign(Object.assign({}, ssOpts), { path: p }));
367
+ if (!screenshots[testName]) {
368
+ screenshots[testName] = [];
369
+ }
370
+ screenshots[testName].push(sPromise);
371
+ // sPromise.then(())
372
+ await sPromise;
373
+ return sPromise;
374
+ // page.evaluate(`window["screenshot done"]`);
385
375
  });
386
376
  page.exposeFunction("customScreenShot", async (ssOpts, testName) => {
387
- // console.log("main.ts browser custom-screenshot", testName);
388
377
  const p = ssOpts.path;
389
378
  const dir = path_1.default.dirname(p);
390
379
  fs_1.default.mkdirSync(dir, {
@@ -483,13 +472,46 @@ class PM_Main extends index_js_1.PM {
483
472
  // }, 5000);
484
473
  // return page.close();
485
474
  });
475
+ page.exposeFunction("page", () => {
476
+ return page.mainFrame()._id;
477
+ });
478
+ page.exposeFunction("click", (sel) => {
479
+ return page.click(sel);
480
+ });
481
+ page.exposeFunction("focusOn", (sel) => {
482
+ return page.focus(sel);
483
+ });
484
+ page.exposeFunction("typeInto", async (value) => await page.keyboard.type(value));
485
+ page.exposeFunction("getValue", (selector) => page.$eval(selector, (input) => input.getAttribute("value")));
486
+ page.exposeFunction("getAttribute", async (selector, attribute) => {
487
+ const attributeValue = await page.$eval(selector, (input) => {
488
+ return input.getAttribute(attribute);
489
+ });
490
+ return attributeValue;
491
+ });
492
+ page.exposeFunction("isDisabled", async (selector) => {
493
+ const attributeValue = await page.$eval(selector, (input) => {
494
+ return input.disabled;
495
+ });
496
+ return attributeValue;
497
+ });
498
+ page.exposeFunction("$", async (selector) => {
499
+ const x = page.$(selector);
500
+ const y = await x;
501
+ return y;
502
+ });
486
503
  return page;
487
504
  })
488
505
  .then(async (page) => {
489
- page.on("console", (log) => console.debug(`Log from client: [${log.text()}] `));
506
+ // page.on("console", (log) =>
507
+ // console.debug(`Log from client: [${log.text()}] `)
508
+ // );
490
509
  await page.goto(`file://${`${dest}.html`}`, {});
491
- page
510
+ await page
492
511
  .evaluate(evaluation)
512
+ .then(async (features) => {
513
+ this.receiveFeatures(features, destFolder);
514
+ })
493
515
  .catch((e) => {
494
516
  console.log("evaluation failed.", dest);
495
517
  console.log(e);
@@ -498,11 +520,62 @@ class PM_Main extends index_js_1.PM {
498
520
  console.log("evaluation complete.", dest);
499
521
  // page.close();
500
522
  this.deregister(t);
501
- // whyIsNodeRunning();
502
523
  });
503
524
  return page;
504
525
  });
505
526
  };
527
+ this.receiveFeatures = (features, destFolder) => {
528
+ console.log("this.receiveFeatures", features);
529
+ features
530
+ .reduce(async (mm, featureStringKey) => {
531
+ const accum = await mm;
532
+ const isUrl = isValidUrl(featureStringKey);
533
+ if (isUrl) {
534
+ const u = new URL(featureStringKey);
535
+ if (u.protocol === "file:") {
536
+ const newPath = `${process.cwd()}/docs/features/internal/${path_1.default.relative(process.cwd(), u.pathname)}`;
537
+ await fs_1.default.promises.mkdir(path_1.default.dirname(newPath), { recursive: true });
538
+ try {
539
+ await fs_1.default.unlinkSync(newPath);
540
+ // console.log(`Removed existing link at ${newPath}`);
541
+ }
542
+ catch (error) {
543
+ if (error.code !== "ENOENT") {
544
+ // throw error;
545
+ }
546
+ }
547
+ fs_1.default.symlink(u.pathname, newPath, (err) => {
548
+ if (err) {
549
+ // console.error("Error creating symlink:", err);
550
+ }
551
+ else {
552
+ // console.log("Symlink created successfully");
553
+ }
554
+ });
555
+ accum.push(newPath);
556
+ }
557
+ else if (u.protocol === "http:" || u.protocol === "https:") {
558
+ const newPath = `${process.cwd()}/docs/features/external${u.hostname}${u.pathname}`;
559
+ const body = await this.configs.featureIngestor(featureStringKey);
560
+ writeFileAndCreateDir(newPath, body);
561
+ accum.push(newPath);
562
+ }
563
+ }
564
+ else {
565
+ const newPath = `${process.cwd()}/docs/features/plain/${await sha256(featureStringKey)}`;
566
+ writeFileAndCreateDir(newPath, featureStringKey);
567
+ accum.push(newPath);
568
+ }
569
+ return accum;
570
+ }, Promise.resolve([]))
571
+ .then((features) => {
572
+ fs_1.default.writeFileSync(`${destFolder}/featurePrompt.txt`, features
573
+ .map((f) => {
574
+ return `/read ${f}`;
575
+ })
576
+ .join("\n"));
577
+ });
578
+ };
506
579
  this.server = {};
507
580
  this.configs = configs;
508
581
  this.ports = {};
@@ -573,17 +646,14 @@ class PM_Main extends index_js_1.PM {
573
646
  delete files[testName];
574
647
  };
575
648
  }
576
- shutDown() {
577
- console.log("shutting down...");
578
- this.shutdownMode = true;
579
- this.checkForShutdown();
649
+ $(selector) {
650
+ throw new Error("Method not implemented.");
580
651
  }
581
- customScreenShot(opts) {
652
+ screencast(opts) {
582
653
  throw new Error("Method not implemented.");
583
654
  }
584
- async startPuppeteer(options, destfolder) {
585
- this.browser = (await puppeteer_core_1.default.launch(options));
586
- return this.browser;
655
+ customScreenShot(opts) {
656
+ throw new Error("Method not implemented.");
587
657
  }
588
658
  end(accessObject) {
589
659
  throw new Error("Method not implemented.");
@@ -646,5 +716,62 @@ class PM_Main extends index_js_1.PM {
646
716
  write(accessObject, contents) {
647
717
  throw new Error("Method not implemented.");
648
718
  }
719
+ page() {
720
+ throw new Error("Method not implemented.");
721
+ }
722
+ click(selector) {
723
+ throw new Error("Method not implemented.");
724
+ }
725
+ focusOn(selector) {
726
+ throw new Error("Method not implemented.");
727
+ }
728
+ typeInto(value) {
729
+ throw new Error("Method not implemented.");
730
+ }
731
+ getValue(value) {
732
+ throw new Error("Method not implemented.");
733
+ }
734
+ getAttribute(selector, attribute) {
735
+ throw new Error("Method not implemented.");
736
+ }
737
+ isDisabled(selector) {
738
+ throw new Error("Method not implemented.");
739
+ }
740
+ ////////////////////////////////////////////////////////////////////////////////
741
+ async startPuppeteer(options, destfolder) {
742
+ this.browser = (await puppeteer_core_1.default.launch(options));
743
+ }
744
+ ////////////////////////////////////////////////////////////////////////////////
745
+ shutDown() {
746
+ console.log("shutting down...");
747
+ this.shutdownMode = true;
748
+ this.checkForShutdown();
749
+ }
649
750
  }
650
751
  exports.PM_Main = PM_Main;
752
+ async function writeFileAndCreateDir(filePath, data) {
753
+ const dirPath = path_1.default.dirname(filePath);
754
+ try {
755
+ await fs_1.default.promises.mkdir(dirPath, { recursive: true });
756
+ await fs_1.default.promises.writeFile(filePath, data);
757
+ }
758
+ catch (error) {
759
+ console.error(`Error writing file: ${error}`);
760
+ }
761
+ }
762
+ async function sha256(rawData) {
763
+ const data = typeof rawData === "object" ? JSON.stringify(rawData) : String(rawData);
764
+ const msgBuffer = new TextEncoder().encode(data);
765
+ const hashBuffer = await crypto_1.default.subtle.digest("SHA-256", msgBuffer);
766
+ const hashArray = Array.from(new Uint8Array(hashBuffer));
767
+ return hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
768
+ }
769
+ function isValidUrl(string) {
770
+ try {
771
+ new URL(string);
772
+ return true;
773
+ }
774
+ catch (err) {
775
+ return false;
776
+ }
777
+ }
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.PM_Node = void 0;
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const path_1 = __importDefault(require("path"));
9
- const puppeteer_core_1 = __importDefault(require("puppeteer-core"));
10
9
  const index_js_1 = require("./index.js");
11
10
  const fPaths = [];
12
11
  class PM_Node extends index_js_1.PM {
@@ -15,8 +14,35 @@ class PM_Node extends index_js_1.PM {
15
14
  this.server = {};
16
15
  this.testResourceConfiguration = t;
17
16
  }
18
- customScreenShot(opts, page) {
19
- return globalThis["customScreenShot"](opts, page);
17
+ $(selector) {
18
+ throw new Error("Method not implemented.");
19
+ }
20
+ screencast(opts) {
21
+ throw new Error("Method not implemented.");
22
+ }
23
+ isDisabled(selector) {
24
+ throw new Error("Method not implemented.");
25
+ }
26
+ getAttribute(selector, attribute) {
27
+ throw new Error("Method not implemented.");
28
+ }
29
+ getValue(selector) {
30
+ throw new Error("Method not implemented.");
31
+ }
32
+ focusOn(selector) {
33
+ throw new Error("Method not implemented.");
34
+ }
35
+ typeInto(value) {
36
+ throw new Error("Method not implemented.");
37
+ }
38
+ page() {
39
+ return globalThis["page"]();
40
+ }
41
+ click(selector) {
42
+ return globalThis["click"](selector);
43
+ }
44
+ customScreenShot(opts) {
45
+ return globalThis["customScreenShot"](opts);
20
46
  }
21
47
  existsSync(destFolder) {
22
48
  return globalThis["existsSync"](this.testResourceConfiguration.fs + "/" + destFolder);
@@ -28,7 +54,6 @@ class PM_Node extends index_js_1.PM {
28
54
  return globalThis["write"](writeObject.uid, contents);
29
55
  }
30
56
  writeFileSync(filepath, contents) {
31
- // console.log("pm_node-writeFileSync", this.testResourceConfiguration);
32
57
  return globalThis["writeFileSync"](this.testResourceConfiguration.fs + "/" + filepath, contents, this.testResourceConfiguration.name);
33
58
  }
34
59
  createWriteStream(filepath) {
@@ -80,9 +105,9 @@ class PM_Node extends index_js_1.PM {
80
105
  }
81
106
  // launch(options?: PuppeteerLaunchOptions): Promise<Browser>;
82
107
  startPuppeteer(options) {
83
- return puppeteer_core_1.default.connect(options).then((b) => {
84
- this.browser = b;
85
- });
108
+ // return puppeteer.connect(options).then((b) => {
109
+ // this.browser = b;
110
+ // });
86
111
  }
87
112
  }
88
113
  exports.PM_Node = PM_Node;
@@ -1,10 +1,6 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.PM_Web = void 0;
7
- const puppeteer_core_browser_js_1 = __importDefault(require("puppeteer-core/lib/esm/puppeteer/puppeteer-core-browser.js"));
8
4
  const index_js_1 = require("./index.js");
9
5
  class PM_Web extends index_js_1.PM {
10
6
  constructor(t) {
@@ -12,8 +8,35 @@ class PM_Web extends index_js_1.PM {
12
8
  this.server = {};
13
9
  this.testResourceConfiguration = t;
14
10
  }
11
+ $(selector) {
12
+ return window["$"](selector);
13
+ }
14
+ screencast(opts) {
15
+ throw new Error("Method not implemented.");
16
+ }
17
+ isDisabled(selector) {
18
+ return window["isDisabled"](selector);
19
+ }
20
+ getAttribute(selector, attribute) {
21
+ return window["getValue"](selector, attribute);
22
+ }
23
+ getValue(selector) {
24
+ return window["getValue"](selector);
25
+ }
26
+ focusOn(selector) {
27
+ return window["focusOn"](selector);
28
+ }
29
+ typeInto(value) {
30
+ return window["typeInto"](value);
31
+ }
32
+ page() {
33
+ return window["page"]();
34
+ }
35
+ click(selector) {
36
+ return window["click"](selector);
37
+ }
15
38
  customScreenShot(opts) {
16
- window["customScreenShot"](opts);
39
+ return window["customScreenShot"](Object.assign(Object.assign({}, opts), { path: this.testResourceConfiguration.fs + "/" + opts.path }), this.testResourceConfiguration.name);
17
40
  }
18
41
  existsSync(destFolder) {
19
42
  return window["existsSync"](destFolder);
@@ -79,54 +102,5 @@ class PM_Web extends index_js_1.PM {
79
102
  }));
80
103
  };
81
104
  }
82
- startPuppeteer(options, destFolder) {
83
- const name = this.testResourceConfiguration.name;
84
- return fetch(`http://localhost:3234/json/version`)
85
- .then((v) => {
86
- return v.json();
87
- })
88
- .then((json) => {
89
- return puppeteer_core_browser_js_1.default
90
- .connect({
91
- browserWSEndpoint: json.webSocketDebuggerUrl,
92
- })
93
- .then((b) => {
94
- this.browser = b;
95
- const handler2 = {
96
- get(target, prop, receiver) {
97
- if (prop === "screenshot") {
98
- return async (x) => {
99
- return await window["custom-screenshot"](Object.assign(Object.assign({}, x), {
100
- // path: destFolder + "/" + x.path,
101
- path: x.path }), name);
102
- };
103
- }
104
- else if (prop === "mainFrame") {
105
- return () => target[prop](...arguments);
106
- }
107
- else {
108
- return Reflect.get(...arguments);
109
- }
110
- },
111
- };
112
- const handler1 = {
113
- get(target, prop, receiver) {
114
- if (prop === "pages") {
115
- return async () => {
116
- return target.pages().then((pages) => {
117
- return pages.map((p) => {
118
- return new Proxy(p, handler2);
119
- });
120
- });
121
- };
122
- }
123
- return Reflect.get(...arguments);
124
- },
125
- };
126
- const proxy3 = new Proxy(this.browser, handler1);
127
- this.browser = proxy3;
128
- });
129
- });
130
- }
131
105
  }
132
106
  exports.PM_Web = PM_Web;
@@ -12,7 +12,6 @@ const glob_1 = require("glob");
12
12
  const node_js_1 = __importDefault(require("./esbuildConfigs/node.js"));
13
13
  const web_js_1 = __importDefault(require("./esbuildConfigs/web.js"));
14
14
  const web_html_js_1 = __importDefault(require("./web.html.js"));
15
- // var mode: "DEV" | "PROD" = process.argv[2] === "-dev" ? "DEV" : "PROD";
16
15
  readline_1.default.emitKeypressEvents(process.stdin);
17
16
  if (process.stdin.isTTY)
18
17
  process.stdin.setRawMode(true);
@@ -74,7 +73,6 @@ class ITProject {
74
73
  .then((x) => fs_1.default.writeFileSync(htmlFilePath, (0, web_html_js_1.default)(jsfilePath, htmlFilePath)));
75
74
  })));
76
75
  const [nodeEntryPoints, webEntryPoints] = getRunnables(this.config.tests);
77
- console.log(`this.getSecondaryEndpointsPoints("web")`, this.getSecondaryEndpointsPoints("web"));
78
76
  (0, glob_1.glob)(`./${this.config.outdir}/chunk-*.mjs`, {
79
77
  ignore: "node_modules/**",
80
78
  }).then((chunks) => {
@@ -118,7 +116,6 @@ class ITProject {
118
116
  getSecondaryEndpointsPoints(runtime) {
119
117
  const meta = (ts, st) => {
120
118
  ts.forEach((t) => {
121
- console.log("getSecondaryEndpointsPoints", t);
122
119
  if (t[1] === runtime) {
123
120
  st.add(t[0]);
124
121
  }
@@ -8,14 +8,9 @@ const fs_1 = __importDefault(require("fs"));
8
8
  const recursive_watch_1 = __importDefault(require("recursive-watch"));
9
9
  const main_js_1 = require("./PM/main.js");
10
10
  const utils_js_1 = require("./utils.js");
11
- // var mode: "DEV" | "PROD" = process.argv[2] === "-dev" ? "DEV" : "PROD";
12
- // const node2web: Record<string, string[]> = {};
13
- // const web2node: Record<string, string[]> = {};
14
- // const childProcesses: Record<string, "loaded" | "running" | "done"> = {};
15
11
  readline_1.default.emitKeypressEvents(process.stdin);
16
12
  if (process.stdin.isTTY)
17
13
  process.stdin.setRawMode(true);
18
- // let shutDownMode = false;
19
14
  exports.default = async (partialConfig) => {
20
15
  const config = Object.assign(Object.assign({}, partialConfig), { buildDir: process.cwd() + "/" + partialConfig.outdir });
21
16
  fs_1.default.writeFileSync(`${config.outdir}/testeranto.json`, JSON.stringify(Object.assign(Object.assign({}, config), { buildDir: process.cwd() + "/" + config.outdir }), null, 2));
@@ -29,9 +24,11 @@ exports.default = async (partialConfig) => {
29
24
  headless: true,
30
25
  dumpio: true,
31
26
  // timeout: 0,
27
+ devtools: true,
32
28
  args: [
33
- // "--auto-open-devtools-for-tabs",
34
- "--disable-features=IsolateOrigins,site-per-process",
29
+ "--auto-open-devtools-for-tabs",
30
+ `--remote-debugging-port=3234`,
31
+ // "--disable-features=IsolateOrigins,site-per-process",
35
32
  "--disable-site-isolation-trials",
36
33
  "--allow-insecure-localhost",
37
34
  "--allow-file-access-from-files",
@@ -54,18 +51,21 @@ exports.default = async (partialConfig) => {
54
51
  // "--single-process",
55
52
  // "--unsafely-treat-insecure-origin-as-secure",
56
53
  // "--unsafely-treat-insecure-origin-as-secure=ws://192.168.0.101:3234",
57
- `--remote-debugging-port=3234`,
58
54
  // "--disk-cache-dir=/dev/null",
59
55
  // "--disk-cache-size=1",
60
56
  // "--start-maximized",
61
57
  ],
62
58
  }, ".");
63
- console.log("\n Puppeteer is running. Press 'q' to quit\n");
59
+ console.log("\n Puppeteer is running. Press 'q' to shutdown softly. Press 'x' to shutdown forcefully.\n");
64
60
  process.stdin.on("keypress", (str, key) => {
65
61
  if (key.name === "q") {
66
62
  pm.shutDown();
67
63
  // process.exit();
68
64
  }
65
+ if (key.name === "x") {
66
+ // pm.shutDown();
67
+ process.exit(-1);
68
+ }
69
69
  });
70
70
  config.tests.forEach(([test, runtime, tr, sidecars]) => {
71
71
  if (runtime === "node") {
@@ -110,46 +110,4 @@ exports.default = async (partialConfig) => {
110
110
  else {
111
111
  pm.shutDown();
112
112
  }
113
- // pm.browser.close();
114
- // does not work on linux
115
- // fs.watch(
116
- // config.buildDir,
117
- // {
118
- // recursive: true,
119
- // },
120
- // (eventType, changedFile) => {
121
- // if (changedFile) {
122
- // config.tests.forEach(([test, runtime, tr, sidecars]) => {
123
- // if (eventType === "change" || eventType === "rename") {
124
- // if (
125
- // changedFile ===
126
- // test
127
- // .replace("./", "node/")
128
- // .split(".")
129
- // .slice(0, -1)
130
- // .concat("mjs")
131
- // .join(".")
132
- // ) {
133
- // pm.launchNode(test, destinationOfRuntime(test, "node", config));
134
- // }
135
- // if (
136
- // changedFile ===
137
- // test
138
- // .replace("./", "web/")
139
- // .split(".")
140
- // .slice(0, -1)
141
- // .concat("mjs")
142
- // .join(".")
143
- // ) {
144
- // pm.launchWeb(
145
- // test,
146
- // destinationOfRuntime(test, "web", config),
147
- // sidecars
148
- // );
149
- // }
150
- // }
151
- // });
152
- // }
153
- // }
154
- // );
155
113
  };