@essential-apps/shopify-test-runner 1.0.11 → 1.0.13

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 (97) hide show
  1. package/dist/lib/guestVnc.d.ts +31 -0
  2. package/dist/lib/guestVnc.d.ts.map +1 -0
  3. package/dist/lib/guestVnc.js +111 -0
  4. package/dist/lib/guestVnc.js.map +1 -0
  5. package/dist/probes/runProbe.js +0 -0
  6. package/dist/scripts/addStore.js +0 -0
  7. package/dist/scripts/buildImage.d.ts +3 -0
  8. package/dist/scripts/buildImage.d.ts.map +1 -0
  9. package/dist/scripts/{buildDockerImage.js → buildImage.js} +12 -10
  10. package/dist/scripts/buildImage.js.map +1 -0
  11. package/dist/scripts/captureAuth.js +0 -0
  12. package/dist/scripts/captureContracts.js +0 -0
  13. package/dist/scripts/captureRestContracts.js +0 -0
  14. package/dist/scripts/captureSharedContracts.d.ts +3 -0
  15. package/dist/scripts/captureSharedContracts.d.ts.map +1 -0
  16. package/dist/scripts/captureSharedContracts.js +209 -0
  17. package/dist/scripts/captureSharedContracts.js.map +1 -0
  18. package/dist/scripts/checkOperationCoverage.js +0 -0
  19. package/dist/scripts/cleanupStores.js +0 -0
  20. package/dist/scripts/createStores.js +0 -0
  21. package/dist/scripts/deployAppVersion.js +0 -0
  22. package/dist/scripts/devOnlineBackend.js +0 -0
  23. package/dist/scripts/installApp.js +0 -0
  24. package/dist/scripts/listStores.js +0 -0
  25. package/dist/scripts/runOffline.js +83 -1
  26. package/dist/scripts/runOffline.js.map +1 -1
  27. package/dist/scripts/runOfflineFullTests.js +82 -6
  28. package/dist/scripts/runOfflineFullTests.js.map +1 -1
  29. package/dist/scripts/runTests.js +0 -0
  30. package/dist/scripts/runVm.js +0 -0
  31. package/dist/scripts/runVmAuth.js +0 -0
  32. package/dist/scripts/setupTestDb.js +0 -0
  33. package/dist/scripts/verifyContracts.js +20 -29
  34. package/dist/scripts/verifyContracts.js.map +1 -1
  35. package/dist/scripts/verifyRestContracts.js +17 -30
  36. package/dist/scripts/verifyRestContracts.js.map +1 -1
  37. package/docker/Dockerfile.vm +1 -0
  38. package/package.json +11 -9
  39. package/src/lib/guestVnc.ts +147 -0
  40. package/src/scripts/{buildDockerImage.ts → buildImage.ts} +11 -9
  41. package/src/scripts/captureSharedContracts.ts +228 -0
  42. package/src/scripts/runOffline.ts +87 -1
  43. package/src/scripts/runOfflineFullTests.ts +94 -6
  44. package/src/scripts/verifyContracts.ts +22 -38
  45. package/src/scripts/verifyRestContracts.ts +23 -42
  46. package/dist/edge/nodeShim.d.ts +0 -2
  47. package/dist/edge/nodeShim.d.ts.map +0 -1
  48. package/dist/edge/nodeShim.js +0 -217
  49. package/dist/edge/nodeShim.js.map +0 -1
  50. package/dist/scripts/_probeSourceUrl.d.ts +0 -3
  51. package/dist/scripts/_probeSourceUrl.d.ts.map +0 -1
  52. package/dist/scripts/_probeSourceUrl.js +0 -119
  53. package/dist/scripts/_probeSourceUrl.js.map +0 -1
  54. package/dist/scripts/buildDockerImage.d.ts +0 -3
  55. package/dist/scripts/buildDockerImage.d.ts.map +0 -1
  56. package/dist/scripts/buildDockerImage.js.map +0 -1
  57. package/dist/scripts/devE2eBackend.d.ts +0 -3
  58. package/dist/scripts/devE2eBackend.d.ts.map +0 -1
  59. package/dist/scripts/devE2eBackend.js +0 -117
  60. package/dist/scripts/devE2eBackend.js.map +0 -1
  61. package/dist/scripts/runDocker.d.ts +0 -3
  62. package/dist/scripts/runDocker.d.ts.map +0 -1
  63. package/dist/scripts/runDocker.js +0 -88
  64. package/dist/scripts/runDocker.js.map +0 -1
  65. package/dist/scripts/runDockerAuth.d.ts +0 -3
  66. package/dist/scripts/runDockerAuth.d.ts.map +0 -1
  67. package/dist/scripts/runDockerAuth.js +0 -108
  68. package/dist/scripts/runDockerAuth.js.map +0 -1
  69. package/dist/scripts/runDockerOffline.d.ts +0 -3
  70. package/dist/scripts/runDockerOffline.d.ts.map +0 -1
  71. package/dist/scripts/runDockerOffline.js +0 -129
  72. package/dist/scripts/runDockerOffline.js.map +0 -1
  73. package/dist/scripts/runDockerOfflineExplore.d.ts +0 -3
  74. package/dist/scripts/runDockerOfflineExplore.d.ts.map +0 -1
  75. package/dist/scripts/runDockerOfflineExplore.js +0 -116
  76. package/dist/scripts/runDockerOfflineExplore.js.map +0 -1
  77. package/dist/scripts/runIsolatedDockerOffline.d.ts +0 -3
  78. package/dist/scripts/runIsolatedDockerOffline.d.ts.map +0 -1
  79. package/dist/scripts/runIsolatedDockerOffline.js +0 -351
  80. package/dist/scripts/runIsolatedDockerOffline.js.map +0 -1
  81. package/dist/scripts/runOfflineE2e.d.ts +0 -3
  82. package/dist/scripts/runOfflineE2e.d.ts.map +0 -1
  83. package/dist/scripts/runOfflineE2e.js +0 -408
  84. package/dist/scripts/runOfflineE2e.js.map +0 -1
  85. package/dist/scripts/runSupermachine.d.ts +0 -3
  86. package/dist/scripts/runSupermachine.d.ts.map +0 -1
  87. package/dist/scripts/runSupermachine.js +0 -474
  88. package/dist/scripts/runSupermachine.js.map +0 -1
  89. package/dist/scripts/runSupermachineAuth.d.ts +0 -3
  90. package/dist/scripts/runSupermachineAuth.d.ts.map +0 -1
  91. package/dist/scripts/runSupermachineAuth.js +0 -454
  92. package/dist/scripts/runSupermachineAuth.js.map +0 -1
  93. package/dist/vite/offlineConfig.d.ts +0 -34
  94. package/dist/vite/offlineConfig.d.ts.map +0 -1
  95. package/dist/vite/offlineConfig.js +0 -61
  96. package/dist/vite/offlineConfig.js.map +0 -1
  97. package/src/scripts/runDockerAuth.ts +0 -120
@@ -1,120 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * One-time interactive Shopify auth capture inside the test container.
4
- *
5
- * Why a separate script: tests run with the chromium browser invisible
6
- * inside Xvfb, which means there's no way to interactively log in.
7
- * This script starts the same container, exposes the Xvfb display via
8
- * x11vnc on host port 5900, and opens macOS's built-in Screen Sharing
9
- * (`vnc://localhost:5900`) so a developer can log in once. The
10
- * resulting tests/test-online/.auth/storageState.json is bind-mounted into
11
- * the project, so subsequent test runs use the captured cookies —
12
- * bound to the container's Linux Chrome fingerprint, which is what
13
- * Cloudflare expects to see during automated runs.
14
- *
15
- * Usage (one-time per developer machine, or whenever cookies expire):
16
- * npm run test:online:capture-auth
17
- *
18
- * macOS Screen Sharing.app opens automatically; just log in to
19
- * Shopify, wait until you see the Partner Dashboard, then hit Enter
20
- * back in the terminal where this script is running.
21
- */
22
- import { spawn } from 'node:child_process';
23
- import { existsSync, mkdirSync, readFileSync } from 'node:fs';
24
- import { homedir, platform } from 'node:os';
25
- import { resolve } from 'node:path';
26
- import { setTimeout as sleep } from 'node:timers/promises';
27
- import { envFileArgs } from '@essential-apps/shopify-test-core';
28
- const repoRoot = process.cwd();
29
- const VNC_PORT = 5900;
30
-
31
- interface PackageJson {
32
- name?: string;
33
- }
34
-
35
- function readAppName(): string {
36
- const pkgPath = resolve(repoRoot, 'package.json');
37
- if (!existsSync(pkgPath)) {
38
- throw new Error(
39
- `No package.json at ${pkgPath}. Run this from the consuming app's repo root.`,
40
- );
41
- }
42
- const pkg = JSON.parse(readFileSync(pkgPath, 'utf8')) as PackageJson;
43
- if (!pkg.name) throw new Error(`package.json at ${pkgPath} has no \`name\` field.`);
44
- return pkg.name.replace(/^@[^/]+\//, '');
45
- }
46
-
47
- async function main(): Promise<void> {
48
- const appName = readAppName();
49
- const image = process.env['TEST_IMAGE'] ?? `${appName}-test:latest`;
50
- const linuxModules =
51
- process.env['TEST_LINUX_NODE_MODULES'] ??
52
- resolve(homedir(), `.cache/${appName}-test/node_modules`);
53
- const vncPassword = process.env['TEST_ONLINE_VNC_PASSWORD'] ?? 'test';
54
-
55
- mkdirSync(linuxModules, { recursive: true });
56
-
57
- const args = [
58
- 'run',
59
- '--rm',
60
- '--arch',
61
- 'amd64',
62
- '--memory',
63
- '4096M',
64
- '--cpus',
65
- '2',
66
- '--publish',
67
- `127.0.0.1:${VNC_PORT}:${VNC_PORT}`,
68
- '--env',
69
- 'TEST_ONLINE_VNC=1',
70
- '--env',
71
- `TEST_ONLINE_VNC_PASSWORD=${vncPassword}`,
72
- '--mount',
73
- `type=bind,source=${repoRoot},target=/workspace`,
74
- '--mount',
75
- `type=bind,source=${linuxModules},target=/workspace/node_modules`,
76
- '-w',
77
- '/workspace',
78
- image,
79
- 'bash',
80
- '-c',
81
- [
82
- 'sleep 1',
83
- `echo "[runDockerAuth] Container ready. VNC server should be on 127.0.0.1:${VNC_PORT}."`,
84
- 'echo ""',
85
- // captureAuth is now in @essential-apps/shopify-test-runner.
86
- `node ${envFileArgs(repoRoot)} node_modules/@essential-apps/shopify-test-runner/dist/scripts/captureAuth.js`,
87
- ].join(' && '),
88
- ];
89
-
90
- console.log(`[runDockerAuth] Starting container with VNC on 127.0.0.1:${VNC_PORT}…`);
91
- console.log(`[runDockerAuth] VNC password (paste into Screen Sharing): ${vncPassword}`);
92
- console.log('');
93
- const p = spawn('container', args, { stdio: 'inherit' });
94
-
95
- if (platform() === 'darwin') {
96
- void (async () => {
97
- await sleep(4_000);
98
- // Embed the password in the URL (vnc://:<pw>@host) so Screen Sharing
99
- // connects WITHOUT prompting — prefilled, not typed.
100
- const vncUrl = `vnc://:${encodeURIComponent(vncPassword)}@localhost:${VNC_PORT}`;
101
- console.log(`[runDockerAuth] Opening macOS Screen Sharing → vnc://localhost:${VNC_PORT} (password prefilled)`);
102
- console.log(`[runDockerAuth] (If nothing opens, run manually: open '${vncUrl}')`);
103
- spawn('open', [vncUrl], {
104
- stdio: 'ignore',
105
- detached: true,
106
- }).unref();
107
- })();
108
- } else {
109
- console.log(`[runDockerAuth] Connect any VNC viewer to localhost:${VNC_PORT}.`);
110
- }
111
-
112
- p.on('exit', (code) => process.exit(code ?? 0));
113
- process.on('SIGINT', () => p.kill('SIGINT'));
114
- process.on('SIGTERM', () => p.kill('SIGTERM'));
115
- }
116
-
117
- main().catch((err) => {
118
- console.error(err);
119
- process.exit(1);
120
- });