@essential-apps/shopify-test-runner 1.0.21 → 1.0.23

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 (36) hide show
  1. package/dist/lib/buildExtensions.js +1 -1
  2. package/dist/lib/buildExtensions.js.map +1 -1
  3. package/dist/lib/buildSourceBundle.d.ts +8 -0
  4. package/dist/lib/buildSourceBundle.d.ts.map +1 -1
  5. package/dist/lib/buildSourceBundle.js.map +1 -1
  6. package/dist/playwright/globalSetup.js +2 -2
  7. package/dist/playwright/globalSetup.js.map +1 -1
  8. package/dist/probes/fonts.js +1 -1
  9. package/dist/probes/fonts.js.map +1 -1
  10. package/dist/probes/mirror.js +1 -1
  11. package/dist/probes/mirror.js.map +1 -1
  12. package/dist/probes/runProbe.js +1 -1
  13. package/dist/probes/types.d.ts +1 -1
  14. package/dist/scripts/deployAppVersion.js +25 -6
  15. package/dist/scripts/deployAppVersion.js.map +1 -1
  16. package/dist/scripts/runOffline.js +4 -4
  17. package/dist/scripts/runOffline.js.map +1 -1
  18. package/dist/scripts/runOfflineFullTests.js +10 -0
  19. package/dist/scripts/runOfflineFullTests.js.map +1 -1
  20. package/dist/scripts/runTests.js +11 -26
  21. package/dist/scripts/runTests.js.map +1 -1
  22. package/dist/scripts/runVm.js +3 -4
  23. package/dist/scripts/runVm.js.map +1 -1
  24. package/package.json +1 -1
  25. package/src/lib/buildExtensions.ts +1 -1
  26. package/src/lib/buildSourceBundle.ts +8 -0
  27. package/src/playwright/globalSetup.ts +2 -2
  28. package/src/probes/fonts.ts +1 -1
  29. package/src/probes/mirror.ts +1 -1
  30. package/src/probes/runProbe.ts +1 -1
  31. package/src/probes/types.ts +1 -1
  32. package/src/scripts/deployAppVersion.ts +32 -8
  33. package/src/scripts/runOffline.ts +4 -4
  34. package/src/scripts/runOfflineFullTests.ts +12 -0
  35. package/src/scripts/runTests.ts +13 -27
  36. package/src/scripts/runVm.ts +3 -4
@@ -559,7 +559,7 @@ async function main(): Promise<void> {
559
559
  // `<essential-upsell-app-embed>` to attach or
560
560
  // `[data-essential-upsell-funnel-id]` to portal.
561
561
  //
562
- // Source of truth is `tests/online/.apps.json` — same file the
562
+ // Source of truth is `tests/online/apps.json` — same file the
563
563
  // online tier reads (one app registry, shared across tiers). Each
564
564
  // extension entry needs a host-side `rootDir`; we translate it to
565
565
  // the VM-side `/workspace/<rel>` path so the orchestrator sees the
@@ -576,7 +576,7 @@ async function main(): Promise<void> {
576
576
  .filter((e) => e.rootDir)
577
577
  .map((e) => ({
578
578
  name: e.name,
579
- // rootDir in .apps.json is relative to the consumer repo
579
+ // rootDir in apps.json is relative to the consumer repo
580
580
  // (e.g. `app_extensions/upsells`). Inside the VM, the
581
581
  // repo is bind-mounted at `/workspace`.
582
582
  rootDir: `/workspace/${e.rootDir!.replace(/^\.?\//, '')}`,
@@ -594,10 +594,10 @@ async function main(): Promise<void> {
594
594
  }
595
595
  }
596
596
  } catch (err) {
597
- // .apps.json missing or malformed — skip auto-wiring rather than
597
+ // apps.json missing or malformed — skip auto-wiring rather than
598
598
  // crash. Tests that don't depend on extensions still run.
599
599
  console.error(
600
- `[runOffline] couldn't auto-load extensions from .apps.json: ${(err as Error).message}`,
600
+ `[runOffline] couldn't auto-load extensions from apps.json: ${(err as Error).message}`,
601
601
  );
602
602
  }
603
603
  }
@@ -1472,6 +1472,18 @@ async function main(): Promise<void> {
1472
1472
  TEST_OFFLINE_MOCK_CLIENT_ID: MOCK_CLIENT_ID,
1473
1473
  TEST_OFFLINE_MOCK_EDGE_URL: edge.baseUrl,
1474
1474
  TEST_OFFLINE_MOCK_EDGE_PORT: String(edge.port),
1475
+ // Partner API creds — same values as the backend (see backendEnv).
1476
+ // The issue-credit helper (tests/online/lib/issueCredit.ts) now runs
1477
+ // the app's `issueAppCredit` codepath directly in THIS Playwright
1478
+ // process (replacing the old /test-internal/issue-credit route), so
1479
+ // it needs these to init the Partner API client. The request still
1480
+ // resolves to the in-VM partner mock via /etc/hosts + the edge proxy.
1481
+ // Values MUST match backendEnv so the org id lines up with the mock.
1482
+ SHOPIFY_APP_ID: process.env['SHOPIFY_APP_ID'] ?? '999000000',
1483
+ SHOPIFY_PARTNER_ORGANIZATION_ID:
1484
+ process.env['SHOPIFY_PARTNER_ORGANIZATION_ID'] ?? '11111111',
1485
+ SHOPIFY_PARTNER_ACCESS_TOKEN:
1486
+ process.env['SHOPIFY_PARTNER_ACCESS_TOKEN'] ?? 'mock-partner-token',
1475
1487
  };
1476
1488
  // Use async spawn (NOT execSync) — execSync blocks the
1477
1489
  // orchestrator's event loop, so the in-process mock servers
@@ -33,7 +33,7 @@ import { resolve } from 'node:path';
33
33
  import { fileURLToPath } from 'node:url';
34
34
  import { setTimeout as sleep } from 'node:timers/promises';
35
35
  import { Agent } from 'undici';
36
- import { loadEnv, printEnvSummary } from '@essential-apps/shopify-test-core';
36
+ import { loadEnv, pickApp, printEnvSummary } from '@essential-apps/shopify-test-core';
37
37
  import { isPortFree } from '../lib/freePort.js';
38
38
 
39
39
  // Vite serves a self-signed cert in test mode — node:fetch rejects
@@ -159,18 +159,6 @@ async function main(): Promise<void> {
159
159
  console.log('[runTests] createdb…');
160
160
  execSync(`createdb -h ${PG_HOST} -p ${PG_PORT} ${dbName}`, { stdio: 'inherit' });
161
161
 
162
- // Per-run secret for the test-internal store-cleanup endpoint.
163
- // Generated fresh each run so we never depend on a long-lived
164
- // shared secret in .env.test (which used to point at a personal
165
- // dev tunnel and broke for any other dev / CI). Both the backend
166
- // (validates) and the test process (sends header) see the same
167
- // value via backendEnv below.
168
- const cleanupSecret = randomUUID();
169
- // Backend serves the cleanup endpoint at /test-internal/cleanup-shop.
170
- // Reach it via the same localhost URL the test browser uses for
171
- // the embedded app — no external tunnel involved.
172
- const cleanupUrl = `${env.devAppUrl.replace(/\/$/, '')}/test-internal/cleanup-shop`;
173
-
174
162
  // Hermetic env for the spawned Vite + Playwright. We do NOT inherit
175
163
  // Shopify-related secrets from process.env — we hand-build them
176
164
  // from .env.test only.
@@ -187,7 +175,7 @@ async function main(): Promise<void> {
187
175
  SHOPIFY_API_SECRET: env.apiSecret,
188
176
  SCOPES: env.scopes,
189
177
  SHOPIFY_APP_URL: env.devAppUrl,
190
- // Resolved from .apps.json (or .env.test) by loadEnv(). MUST be
178
+ // Resolved from apps.json (or .env.test) by loadEnv(). MUST be
191
179
  // forwarded: globalSetup.ts + the openApp fixture build the admin
192
180
  // deep link `…/apps/${SHOPIFY_APP_HANDLE}` from process.env directly,
193
181
  // and without this they fall back to the hardcoded 'essential-app'
@@ -197,20 +185,18 @@ async function main(): Promise<void> {
197
185
  SHOPIFY_APP_HANDLE: env.devAppHandle,
198
186
  PORT: port,
199
187
  HOST: env.devAppUrl,
200
- // Store-cleanup wiring (see storePool.ts afterEach). Both the
201
- // backend route handler (validates X-Test-Cleanup-Secret) and the
202
- // Playwright test process (sends the header) read these.
203
- TEST_ONLINE_CLEANUP_SECRET: cleanupSecret,
204
- TEST_ONLINE_STORE_CLEANUP_URL: cleanupUrl,
205
188
  // Theme app extension UUID — relevant for apps with theme app
206
- // extensions (essential-upsell). Without this, vite/remix loads
207
- // the dev-app value from .env (since vite/remix auto-loads .env
208
- // even with NODE_ENV=test), so the Activate deep link points at
209
- // the wrong extension and isAppEmbedActive never matches.
210
- // Harmless no-op for apps that don't use this var.
211
- ...(process.env['SHOPIFY_UPSELLS_ID']
212
- ? { SHOPIFY_UPSELLS_ID: process.env['SHOPIFY_UPSELLS_ID'] }
213
- : {}),
189
+ // extensions (essential-upsell), sourced from tests/online/apps.json
190
+ // (extensions[].uuid) — the single source, NOT env. Without this the
191
+ // Activate deep link points at the wrong extension and
192
+ // isAppEmbedActive never matches. Harmless no-op for apps with no
193
+ // theme extension in apps.json.
194
+ ...(() => {
195
+ const uuid = pickApp().extensions?.find(
196
+ (e) => e.rootDir?.includes('upsells') || e.name === 'upsells',
197
+ )?.uuid;
198
+ return uuid ? { SHOPIFY_UPSELLS_ID: uuid } : {};
199
+ })(),
214
200
  };
215
201
 
216
202
  console.log('[runTests] prisma migrate deploy…');
@@ -480,10 +480,9 @@ async function main(): Promise<void> {
480
480
  'TEST_VISIBLE',
481
481
  'TEST_WORKERS',
482
482
  'TEST_PRESERVE_DB',
483
- // TEST_ONLINE_STORE_CLEANUP_URL / TEST_ONLINE_CLEANUP_SECRET intentionally not
484
- // forwarded runTests.ts generates the secret per-run and
485
- // builds the URL from devAppUrl. Forwarding stale values from
486
- // .env.test would override that.
483
+ // Store seed/cleanup no longer ride env vars — they're app-owned
484
+ // Prisma helpers registered via setStoreHooks (see storePool.ts),
485
+ // so there's nothing cleanup-related to forward here.
487
486
  'TEST_OFFLINE_STRICT_GRAPHQL',
488
487
  // TEST_FORCE_REAL_CHROME: storePool flips chromium.launch to
489
488
  // `channel: 'chrome'` (real Google Chrome amd64 installed in