@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.
- package/dist/lib/buildExtensions.js +1 -1
- package/dist/lib/buildExtensions.js.map +1 -1
- package/dist/lib/buildSourceBundle.d.ts +8 -0
- package/dist/lib/buildSourceBundle.d.ts.map +1 -1
- package/dist/lib/buildSourceBundle.js.map +1 -1
- package/dist/playwright/globalSetup.js +2 -2
- package/dist/playwright/globalSetup.js.map +1 -1
- package/dist/probes/fonts.js +1 -1
- package/dist/probes/fonts.js.map +1 -1
- package/dist/probes/mirror.js +1 -1
- package/dist/probes/mirror.js.map +1 -1
- package/dist/probes/runProbe.js +1 -1
- package/dist/probes/types.d.ts +1 -1
- package/dist/scripts/deployAppVersion.js +25 -6
- package/dist/scripts/deployAppVersion.js.map +1 -1
- package/dist/scripts/runOffline.js +4 -4
- package/dist/scripts/runOffline.js.map +1 -1
- package/dist/scripts/runOfflineFullTests.js +10 -0
- package/dist/scripts/runOfflineFullTests.js.map +1 -1
- package/dist/scripts/runTests.js +11 -26
- package/dist/scripts/runTests.js.map +1 -1
- package/dist/scripts/runVm.js +3 -4
- package/dist/scripts/runVm.js.map +1 -1
- package/package.json +1 -1
- package/src/lib/buildExtensions.ts +1 -1
- package/src/lib/buildSourceBundle.ts +8 -0
- package/src/playwright/globalSetup.ts +2 -2
- package/src/probes/fonts.ts +1 -1
- package/src/probes/mirror.ts +1 -1
- package/src/probes/runProbe.ts +1 -1
- package/src/probes/types.ts +1 -1
- package/src/scripts/deployAppVersion.ts +32 -8
- package/src/scripts/runOffline.ts +4 -4
- package/src/scripts/runOfflineFullTests.ts +12 -0
- package/src/scripts/runTests.ts +13 -27
- 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
|
|
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
|
|
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
|
-
//
|
|
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
|
|
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
|
package/src/scripts/runTests.ts
CHANGED
|
@@ -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
|
|
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)
|
|
207
|
-
// the
|
|
208
|
-
//
|
|
209
|
-
//
|
|
210
|
-
//
|
|
211
|
-
...(
|
|
212
|
-
|
|
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…');
|
package/src/scripts/runVm.ts
CHANGED
|
@@ -480,10 +480,9 @@ async function main(): Promise<void> {
|
|
|
480
480
|
'TEST_VISIBLE',
|
|
481
481
|
'TEST_WORKERS',
|
|
482
482
|
'TEST_PRESERVE_DB',
|
|
483
|
-
//
|
|
484
|
-
//
|
|
485
|
-
//
|
|
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
|