@essential-apps/shopify-test-runner 1.0.12 → 1.0.14
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/dist/edge/edgeProxy.d.ts.map +1 -1
- package/dist/edge/edgeProxy.js +18 -12
- package/dist/edge/edgeProxy.js.map +1 -1
- package/dist/lib/guestVnc.d.ts +31 -0
- package/dist/lib/guestVnc.d.ts.map +1 -0
- package/dist/lib/guestVnc.js +111 -0
- package/dist/lib/guestVnc.js.map +1 -0
- package/dist/probes/runProbe.js +0 -0
- package/dist/scripts/addStore.js +0 -0
- package/dist/scripts/buildImage.d.ts +3 -0
- package/dist/scripts/buildImage.d.ts.map +1 -0
- package/dist/scripts/{buildDockerImage.js → buildImage.js} +12 -10
- package/dist/scripts/buildImage.js.map +1 -0
- package/dist/scripts/captureAuth.js +0 -0
- package/dist/scripts/captureContracts.js +0 -0
- package/dist/scripts/captureRestContracts.js +0 -0
- package/dist/scripts/captureSharedContracts.d.ts +3 -0
- package/dist/scripts/captureSharedContracts.d.ts.map +1 -0
- package/dist/scripts/captureSharedContracts.js +209 -0
- package/dist/scripts/captureSharedContracts.js.map +1 -0
- package/dist/scripts/checkOperationCoverage.js +0 -0
- package/dist/scripts/cleanupStores.js +0 -0
- package/dist/scripts/createStores.js +0 -0
- package/dist/scripts/deployAppVersion.js +0 -0
- package/dist/scripts/devOnlineBackend.js +0 -0
- package/dist/scripts/installApp.js +0 -0
- package/dist/scripts/listStores.js +0 -0
- package/dist/scripts/runOffline.js +78 -1
- package/dist/scripts/runOffline.js.map +1 -1
- package/dist/scripts/runOfflineFullTests.js +49 -21
- package/dist/scripts/runOfflineFullTests.js.map +1 -1
- package/dist/scripts/runTests.js +0 -0
- package/dist/scripts/runVm.js +0 -0
- package/dist/scripts/runVmAuth.js +0 -0
- package/dist/scripts/setupTestDb.js +0 -0
- package/dist/scripts/verifyContracts.js +20 -29
- package/dist/scripts/verifyContracts.js.map +1 -1
- package/dist/scripts/verifyRestContracts.js +17 -30
- package/dist/scripts/verifyRestContracts.js.map +1 -1
- package/package.json +11 -9
- package/src/edge/edgeProxy.ts +19 -12
- package/src/lib/guestVnc.ts +147 -0
- package/src/scripts/{buildDockerImage.ts → buildImage.ts} +11 -9
- package/src/scripts/captureSharedContracts.ts +228 -0
- package/src/scripts/runOffline.ts +82 -1
- package/src/scripts/runOfflineFullTests.ts +56 -21
- package/src/scripts/verifyContracts.ts +22 -38
- package/src/scripts/verifyRestContracts.ts +23 -42
- package/dist/edge/nodeShim.d.ts +0 -2
- package/dist/edge/nodeShim.d.ts.map +0 -1
- package/dist/edge/nodeShim.js +0 -217
- package/dist/edge/nodeShim.js.map +0 -1
- package/dist/scripts/_probeSourceUrl.d.ts +0 -3
- package/dist/scripts/_probeSourceUrl.d.ts.map +0 -1
- package/dist/scripts/_probeSourceUrl.js +0 -119
- package/dist/scripts/_probeSourceUrl.js.map +0 -1
- package/dist/scripts/buildDockerImage.d.ts +0 -3
- package/dist/scripts/buildDockerImage.d.ts.map +0 -1
- package/dist/scripts/buildDockerImage.js.map +0 -1
- package/dist/scripts/devE2eBackend.d.ts +0 -3
- package/dist/scripts/devE2eBackend.d.ts.map +0 -1
- package/dist/scripts/devE2eBackend.js +0 -117
- package/dist/scripts/devE2eBackend.js.map +0 -1
- package/dist/scripts/runDocker.d.ts +0 -3
- package/dist/scripts/runDocker.d.ts.map +0 -1
- package/dist/scripts/runDocker.js +0 -88
- package/dist/scripts/runDocker.js.map +0 -1
- package/dist/scripts/runDockerAuth.d.ts +0 -3
- package/dist/scripts/runDockerAuth.d.ts.map +0 -1
- package/dist/scripts/runDockerAuth.js +0 -108
- package/dist/scripts/runDockerAuth.js.map +0 -1
- package/dist/scripts/runDockerOffline.d.ts +0 -3
- package/dist/scripts/runDockerOffline.d.ts.map +0 -1
- package/dist/scripts/runDockerOffline.js +0 -129
- package/dist/scripts/runDockerOffline.js.map +0 -1
- package/dist/scripts/runDockerOfflineExplore.d.ts +0 -3
- package/dist/scripts/runDockerOfflineExplore.d.ts.map +0 -1
- package/dist/scripts/runDockerOfflineExplore.js +0 -116
- package/dist/scripts/runDockerOfflineExplore.js.map +0 -1
- package/dist/scripts/runIsolatedDockerOffline.d.ts +0 -3
- package/dist/scripts/runIsolatedDockerOffline.d.ts.map +0 -1
- package/dist/scripts/runIsolatedDockerOffline.js +0 -351
- package/dist/scripts/runIsolatedDockerOffline.js.map +0 -1
- package/dist/scripts/runOfflineE2e.d.ts +0 -3
- package/dist/scripts/runOfflineE2e.d.ts.map +0 -1
- package/dist/scripts/runOfflineE2e.js +0 -408
- package/dist/scripts/runOfflineE2e.js.map +0 -1
- package/dist/scripts/runSupermachine.d.ts +0 -3
- package/dist/scripts/runSupermachine.d.ts.map +0 -1
- package/dist/scripts/runSupermachine.js +0 -474
- package/dist/scripts/runSupermachine.js.map +0 -1
- package/dist/scripts/runSupermachineAuth.d.ts +0 -3
- package/dist/scripts/runSupermachineAuth.d.ts.map +0 -1
- package/dist/scripts/runSupermachineAuth.js +0 -454
- package/dist/scripts/runSupermachineAuth.js.map +0 -1
- package/dist/vite/offlineConfig.d.ts +0 -34
- package/dist/vite/offlineConfig.d.ts.map +0 -1
- package/dist/vite/offlineConfig.js +0 -61
- package/dist/vite/offlineConfig.js.map +0 -1
- 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
|
-
});
|