@geekmidas/constructs 10.0.0-alpha.132 → 10.0.0-alpha.134

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.
@@ -569,6 +569,7 @@ const bound = /* @__PURE__ */ new WeakSet();
569
569
  function featureTest(options = {}) {
570
570
  const manifest = options.manifest ?? loadTestManifest();
571
571
  const BrowserClass = options.browser ?? _geekmidas_testkit_browser.Browser;
572
+ const site = wildcardSiteUrl(manifest);
572
573
  let app;
573
574
  let factoryDatabases = [];
574
575
  let owned = [];
@@ -622,7 +623,7 @@ function featureTest(options = {}) {
622
623
  await state.discovery.register(watchers(app, state));
623
624
  try {
624
625
  await (0, _geekmidas_testkit_context.runInTestContext)(id, async () => {
625
- const browser = new BrowserClass();
626
+ const browser = new BrowserClass(site ? { site } : {});
626
627
  const restore = browser.install();
627
628
  try {
628
629
  const transaction = (database) => state.transactions.get(database.id, urlOf(database, app.envParser), database.clientConfig);
@@ -1045,6 +1046,18 @@ function isLocal(url) {
1045
1046
  return url.hostname === "localhost" || url.hostname === "127.0.0.1" || url.hostname.endsWith(".localhost");
1046
1047
  }
1047
1048
  /**
1049
+ * The test stage's address for the app's site on every subdomain —
1050
+ * `https://*.test.shop.localhost:8443` — which `browser.on(slug)` puts a
1051
+ * tenant into, or `undefined` when the app declares none.
1052
+ */
1053
+ function wildcardSiteUrl(manifest) {
1054
+ for (const [id, construct] of Object.entries(manifest.constructs)) {
1055
+ if (construct.kind !== "site") continue;
1056
+ const url = manifest.env[(0, _geekmidas_manifest.provideKey)(id, "url")];
1057
+ if (url && new URL(url).hostname.startsWith(`${_geekmidas_manifest.WILDCARD_SUBDOMAIN}.`)) return url;
1058
+ }
1059
+ }
1060
+ /**
1048
1061
  * Sign a test's browser in the way a person does: ask the auth server for a
1049
1062
  * magic link, open the email it sent, follow the link.
1050
1063
  *