@elliemae/pui-app-bridge 2.29.0-alpha.0 → 2.29.0

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 (61) hide show
  1. package/dist/cjs/appBridge.js +88 -35
  2. package/dist/cjs/config/app.js +7 -2
  3. package/dist/cjs/config/microFE.js +28 -30
  4. package/dist/cjs/eventManager.js +6 -7
  5. package/dist/cjs/frame.js +7 -10
  6. package/dist/cjs/loaders/manifest.js +1 -1
  7. package/dist/cjs/microfeHost.js +2 -5
  8. package/dist/cjs/tests/scriptingObjects/analytics.js +21 -6
  9. package/dist/cjs/tests/scriptingObjects/appraisalServiceModule.js +4 -1
  10. package/dist/cjs/tests/utils.js +1 -76
  11. package/dist/cjs/typings/window.js +1 -1
  12. package/dist/esm/appBridge.js +88 -35
  13. package/dist/esm/config/app.js +7 -2
  14. package/dist/esm/config/microFE.js +28 -30
  15. package/dist/esm/eventManager.js +6 -7
  16. package/dist/esm/frame.js +7 -10
  17. package/dist/esm/loaders/manifest.js +1 -1
  18. package/dist/esm/microfeHost.js +2 -5
  19. package/dist/esm/tests/scriptingObjects/analytics.js +21 -6
  20. package/dist/esm/tests/scriptingObjects/appraisalServiceModule.js +4 -1
  21. package/dist/esm/tests/serverHandlers.js +1 -3
  22. package/dist/esm/tests/utils.js +1 -76
  23. package/dist/esm/typings/window.js +1 -1
  24. package/dist/public/e2e-host.html +1 -1
  25. package/dist/public/e2e-index.html +1 -1
  26. package/dist/public/frame.html +1 -1
  27. package/dist/public/index.html +1 -1
  28. package/dist/public/js/emuiAppBridge.02aa5aed856e7e070591.js +17 -0
  29. package/dist/public/js/emuiAppBridge.02aa5aed856e7e070591.js.br +0 -0
  30. package/dist/public/js/emuiAppBridge.02aa5aed856e7e070591.js.gz +0 -0
  31. package/dist/public/js/emuiAppBridge.02aa5aed856e7e070591.js.map +1 -0
  32. package/dist/types/lib/appBridge.d.ts +6 -6
  33. package/dist/types/lib/appRegistry.d.ts +1 -1
  34. package/dist/types/lib/config/app.d.ts +1 -1
  35. package/dist/types/lib/config/microFE.d.ts +2 -2
  36. package/dist/types/lib/eventManager.d.ts +3 -3
  37. package/dist/types/lib/loaders/script.d.ts +1 -1
  38. package/dist/types/lib/loaders/style.d.ts +1 -1
  39. package/dist/types/lib/microfeHost.d.ts +6 -5
  40. package/dist/types/lib/tests/scriptingObjects/analytics.d.ts +5 -5
  41. package/dist/types/lib/tests/scriptingObjects/appraisalServiceModule.d.ts +5 -8
  42. package/dist/types/lib/tests/scriptingObjects/global.d.ts +1 -1
  43. package/dist/types/lib/tests/server.d.ts +1 -1
  44. package/dist/types/lib/tests/serverHandlers.d.ts +1 -1
  45. package/dist/types/lib/tests/utils.d.ts +2 -64
  46. package/dist/types/lib/typings/appInfo.d.ts +1 -1
  47. package/dist/types/lib/typings/common.d.ts +0 -10
  48. package/dist/types/lib/typings/guest.d.ts +6 -6
  49. package/dist/types/lib/typings/host.d.ts +4 -4
  50. package/dist/types/lib/typings/index.d.ts +1 -1
  51. package/dist/types/lib/typings/window.d.ts +4 -4
  52. package/dist/types/tsconfig.tsbuildinfo +1 -1
  53. package/dist/umd/index.js +14 -9
  54. package/dist/umd/index.js.br +0 -0
  55. package/dist/umd/index.js.gz +0 -0
  56. package/dist/umd/index.js.map +1 -1
  57. package/package.json +13 -14
  58. package/dist/public/js/emuiAppBridge.e4cfaa7d8c810b09c233.js +0 -12
  59. package/dist/public/js/emuiAppBridge.e4cfaa7d8c810b09c233.js.br +0 -0
  60. package/dist/public/js/emuiAppBridge.e4cfaa7d8c810b09c233.js.gz +0 -0
  61. package/dist/public/js/emuiAppBridge.e4cfaa7d8c810b09c233.js.map +0 -1
@@ -19,6 +19,11 @@ import { StyleLoader, ScriptLoader, ManifestLoader } from "./loaders/index.js";
19
19
  import { CMicroFEHost } from "./microfeHost.js";
20
20
  import { CAppRegistry } from "./appRegistry.js";
21
21
  const KEEP_ALIVE_INTERVAL = 12e4;
22
+ const MODULE_UNLOADING_EVENT = "module.unloading";
23
+ const MODULE_UNMOUNT_EVENT = "module.unmount";
24
+ const MODULE_EVENT_TIMEOUT_MS = 1e3;
25
+ const MODULE_EVENT_STUB = new ScriptingObject(ScriptingObjectNames.Module);
26
+ const isModuleUnloadVetoed = (feedback) => Array.isArray(feedback) && feedback.some((v) => v === false);
22
27
  const userInteractionEvents = ["click", "scroll", "keypress", "touchstart"];
23
28
  const cssType = /\.css$/;
24
29
  const isCss = (fileName) => cssType.test(fileName);
@@ -98,13 +103,12 @@ class CAppBridge {
98
103
  * @param value
99
104
  * @returns
100
105
  */
101
- #isProxyEvent = (value) => {
102
- if (value instanceof ProxyEvent) return true;
103
- if (typeof value === "object" && value !== null && "subscribe" in value) {
104
- return typeof value.subscribe === "function";
105
- }
106
- return false;
107
- };
106
+ #isProxyEvent = (value) => (
107
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
108
+ value instanceof ProxyEvent || // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
109
+ typeof value?.subscribe === "function"
110
+ );
111
+ // support v1 scripting objects
108
112
  /**
109
113
  * format error message for app not found
110
114
  * @param id app id
@@ -141,7 +145,8 @@ class CAppBridge {
141
145
  instanceId,
142
146
  documentEle,
143
147
  elementIds,
144
- microFEHost
148
+ microFEHost,
149
+ selfInitialize
145
150
  }) => {
146
151
  const app = this.#appRegistry.get({ id, instanceId });
147
152
  if (!app) {
@@ -155,7 +160,8 @@ class CAppBridge {
155
160
  guestWindow: documentEle?.defaultView,
156
161
  ...app
157
162
  },
158
- microFEHost
163
+ microFEHost,
164
+ selfInitialize
159
165
  });
160
166
  };
161
167
  #initApplication = async ({
@@ -228,7 +234,8 @@ class CAppBridge {
228
234
  instanceId,
229
235
  documentEle,
230
236
  elementIds: [...styleElementIds, ...scriptElementIds],
231
- microFEHost: options.microFEHost
237
+ microFEHost: options.microFEHost,
238
+ selfInitialize: options.selfInitialize
232
239
  });
233
240
  if (!options.selfInitialize) {
234
241
  await this.#initApplication(options);
@@ -243,7 +250,7 @@ class CAppBridge {
243
250
  appId: options.id,
244
251
  exception: err
245
252
  });
246
- throw new Error(message, { cause: err });
253
+ throw new Error(message);
247
254
  }
248
255
  };
249
256
  #unloadApp = ({ id, instanceId, hostUrl, documentEle }) => {
@@ -351,23 +358,36 @@ class CAppBridge {
351
358
  }
352
359
  };
353
360
  /**
354
- * Dispatch the module.unloading event and collect feedback.
355
- * Returns true if unload is allowed, false if any listener vetoed.
356
- * @param id
357
- */
361
+ * Registered module SO for a guest, if the host added one.
362
+ * @param guestAppId
363
+ */
364
+ #getGuestModuleScriptingObject = (guestAppId) => this.#soManager.getObject(
365
+ ScriptingObjectNames.Module,
366
+ { id: guestAppId }
367
+ );
368
+ /**
369
+ * Dispatch module.unloading or module.unmount to guest listeners.
370
+ * Uses a stub module SO when none is registered; routing is by eventId.
371
+ * @param guestAppId
372
+ * @param eventId
373
+ * @param eventName
374
+ */
375
+ #dispatchGuestModuleEvent = async (guestAppId, eventId, eventName) => {
376
+ const moduleSO = this.#getGuestModuleScriptingObject(guestAppId) ?? MODULE_EVENT_STUB;
377
+ return this.#eventManager.dispatchEvent(moduleSO, {
378
+ event: { id: eventId, name: eventName },
379
+ eventParams: { moduleId: guestAppId },
380
+ eventOptions: { timeout: MODULE_EVENT_TIMEOUT_MS }
381
+ });
382
+ };
358
383
  #canUnload = async (id) => {
359
- const moduleSO = this.#soManager.getObject(
360
- ScriptingObjectNames.Module,
361
- { id }
362
- );
363
- if (!moduleSO) return true;
364
384
  try {
365
- const feedback = await this.#eventManager.dispatchEvent(moduleSO, {
366
- event: { id: "module.unloading", name: "unloading" },
367
- eventParams: { moduleId: id },
368
- eventOptions: { timeout: 1e3 }
369
- });
370
- if (Array.isArray(feedback) && feedback.some((v) => v === false)) {
385
+ const feedback = await this.#dispatchGuestModuleEvent(
386
+ id,
387
+ MODULE_UNLOADING_EVENT,
388
+ "unloading"
389
+ );
390
+ if (isModuleUnloadVetoed(feedback)) {
371
391
  this.#logger.info(
372
392
  `Unload denied by guest ${id} via module.unloading event`
373
393
  );
@@ -375,12 +395,37 @@ class CAppBridge {
375
395
  }
376
396
  } catch (err) {
377
397
  this.#logger.warn({
378
- message: `Error dispatching module.unloading event for ${id}`,
398
+ message: `Error dispatching module.unloading event for ${id}; proceeding with unload`,
379
399
  exception: err
380
400
  });
381
401
  }
382
402
  return true;
383
403
  };
404
+ /**
405
+ * Legacy guests use registerApp.unmount; self-init guests receive module.unmount.
406
+ * @param root0
407
+ * @param root0.id
408
+ * @param root0.instanceId
409
+ * @param root0.selfInitialize
410
+ */
411
+ #teardownGuest = async ({
412
+ id,
413
+ instanceId,
414
+ selfInitialize
415
+ }) => {
416
+ if (!selfInitialize) {
417
+ await this.#unmountApp({ id, instanceId });
418
+ return;
419
+ }
420
+ try {
421
+ await this.#dispatchGuestModuleEvent(id, MODULE_UNMOUNT_EVENT, "unmount");
422
+ } catch (err) {
423
+ this.#logger.warn({
424
+ message: `Error dispatching module.unmount event for ${id}`,
425
+ exception: err
426
+ });
427
+ }
428
+ };
384
429
  /**
385
430
  * clear session management for the guest application
386
431
  * @param instanceId unique instance id of the application
@@ -439,7 +484,9 @@ class CAppBridge {
439
484
  eventOptions
440
485
  }) => this.dispatchEvent({
441
486
  event,
487
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
442
488
  eventParams,
489
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
443
490
  eventOptions
444
491
  });
445
492
  const token = propValue.subscribe(listener);
@@ -449,8 +496,7 @@ class CAppBridge {
449
496
  } else if (this.#isFunction(propValue)) {
450
497
  Object.defineProperty(so, propName, {
451
498
  value: async (...args) => {
452
- const soMethod = so[propName];
453
- const callerCtx = soMethod?.callContext;
499
+ const callerCtx = so[propName]?.callContext;
454
500
  if (callerCtx?.guest) {
455
501
  const existingChain = callerCtx.callChain ?? [];
456
502
  const guestId = callerCtx.guest.id;
@@ -511,7 +557,7 @@ class CAppBridge {
511
557
  );
512
558
  return;
513
559
  }
514
- const { id } = app;
560
+ const { id, selfInitialize } = app;
515
561
  if (!await this.#canUnload(id)) return;
516
562
  const appConfig = this.#microFEConfig.getConfigById(id);
517
563
  if (!appConfig) {
@@ -521,11 +567,11 @@ class CAppBridge {
521
567
  return;
522
568
  }
523
569
  const { hostUrl } = appConfig;
570
+ const frameEle = Frame.get(instanceId);
524
571
  try {
525
572
  this.#clearSession(app);
526
- await this.#unmountApp({ id, instanceId });
573
+ await this.#teardownGuest({ id, instanceId, selfInitialize });
527
574
  } finally {
528
- const frameEle = Frame.get(instanceId);
529
575
  if (frameEle?.contentDocument) {
530
576
  this.#unloadApp({
531
577
  id,
@@ -534,6 +580,9 @@ class CAppBridge {
534
580
  documentEle: frameEle.contentDocument
535
581
  });
536
582
  }
583
+ if (frameEle) {
584
+ frameEle.src = "about:blank";
585
+ }
537
586
  this.#activeApps.delete(instanceId);
538
587
  this.#guestMetadata.delete(id);
539
588
  Frame.remove(instanceId);
@@ -656,7 +705,10 @@ class CAppBridge {
656
705
  if (iframeWindow) {
657
706
  iframeWindow.emui = iframeWindow.emui ?? {};
658
707
  iframeWindow.emui.__host = microFEHost;
659
- iframeWindow.emui.getHost = () => iframeWindow.emui?.__host ?? null;
708
+ iframeWindow.emui.getHost = () => (
709
+ // eslint-disable-next-line no-underscore-dangle
710
+ iframeWindow.emui?.__host ?? null
711
+ );
660
712
  }
661
713
  const preconnect = frameDoc.createElement("link");
662
714
  preconnect.rel = "preconnect";
@@ -784,7 +836,8 @@ class CAppBridge {
784
836
  */
785
837
  unmountApp = async (instanceId) => {
786
838
  if (!instanceId) throw new Error("instanceId is required");
787
- const { id } = this.#activeApps.get(instanceId) || {};
839
+ const activeApp = this.#activeApps.get(instanceId);
840
+ const { id, selfInitialize } = activeApp || {};
788
841
  if (!id) {
789
842
  throw new Error(
790
843
  `Application with instance id ${instanceId} is not found`
@@ -794,7 +847,7 @@ class CAppBridge {
794
847
  if (!appConfig) {
795
848
  throw new Error(`Application with id ${id} is not found`);
796
849
  }
797
- await this.#unmountApp({ ...appConfig, instanceId });
850
+ await this.#teardownGuest({ id, instanceId, selfInitialize });
798
851
  };
799
852
  }
800
853
  export {
@@ -88,7 +88,9 @@ class CAppConfig {
88
88
  await this.load(`${this.#baseUrl}latest/app.config.json`);
89
89
  return;
90
90
  }
91
- throw new Error("Failed to fetch app config", { cause: err });
91
+ throw new Error("Failed to fetch app config", {
92
+ cause: err
93
+ });
92
94
  }
93
95
  if (response.ok) {
94
96
  try {
@@ -97,7 +99,10 @@ class CAppConfig {
97
99
  } catch (err) {
98
100
  if (!configUrl && this.#version !== LATEST_VERSION) {
99
101
  await this.load(`${this.#baseUrl}latest/app.config.json`);
100
- } else throw new Error("Failed to parse app config", { cause: err });
102
+ } else
103
+ throw new Error("Failed to parse app config", {
104
+ cause: err
105
+ });
101
106
  }
102
107
  } else {
103
108
  if (!configUrl && this.#version !== LATEST_VERSION) {
@@ -29,38 +29,36 @@ const isFileListValid = (files) => {
29
29
  if (!files || !files.length) return false;
30
30
  return files.every((file) => typeof file === "string");
31
31
  };
32
- const isLaunchMode = (mode, expected) => String(mode).toLowerCase() === expected.toLowerCase();
33
- const isAppSdkManager = (manager) => String(manager).toLowerCase() === MicroAppManager.APPSDK.toLowerCase();
34
- const validateMode = (id, mode) => {
35
- if (!isLaunchMode(mode, LaunchMode.PRODUCTION) && !isLaunchMode(mode, LaunchMode.DEVELOPMENT)) {
36
- throw new Error(`invalid mode '${String(mode)}' for ${id}`);
37
- }
38
- };
39
- const validateAppSdkEnvFiles = (id, envSection, envName) => {
40
- if (!envSection) {
41
- throw new Error(
42
- `microFrontendApps.${id} is missing ${envName} section in app.config.json`
43
- );
44
- }
45
- if (!isFileListValid(envSection.files)) {
46
- throw new Error(`invalid value for ${envName}.files`);
47
- }
48
- };
49
- const validateAppSdkConfig = (id, mode, mfeConfig) => {
50
- const { production, development } = mfeConfig;
51
- if (isLaunchMode(mode, LaunchMode.PRODUCTION)) {
52
- validateAppSdkEnvFiles(id, production, "production");
53
- }
54
- if (isLaunchMode(mode, LaunchMode.DEVELOPMENT)) {
55
- validateAppSdkEnvFiles(id, development, "development");
56
- }
57
- };
58
32
  const validate = (id, mfeConfig) => {
59
33
  const { mode = LaunchMode.PRODUCTION } = mfeConfig;
60
- validateMode(id, mode);
61
- const { microappManager = MicroAppManager.APPSDK } = mfeConfig;
62
- if (isAppSdkManager(microappManager)) {
63
- validateAppSdkConfig(id, mode, mfeConfig);
34
+ if (String(mode).toLowerCase() !== LaunchMode.PRODUCTION.toLowerCase() && String(mode).toLowerCase() !== LaunchMode.DEVELOPMENT.toLowerCase())
35
+ throw new Error(`invalid mode '${String(mode)}' for ${id}`);
36
+ const {
37
+ production,
38
+ development,
39
+ microappManager = MicroAppManager.APPSDK
40
+ } = mfeConfig;
41
+ if (String(microappManager).toLowerCase() === MicroAppManager.APPSDK.toLowerCase()) {
42
+ if (String(mode).toLowerCase() === LaunchMode.PRODUCTION.toLowerCase()) {
43
+ if (!production) {
44
+ throw new Error(
45
+ `microFrontendApps.${id} is missing production section in app.config.json`
46
+ );
47
+ }
48
+ if (!isFileListValid(production.files)) {
49
+ throw new Error(`invalid value for production.files`);
50
+ }
51
+ }
52
+ if (String(mode).toLowerCase() === LaunchMode.DEVELOPMENT.toLowerCase()) {
53
+ if (!development) {
54
+ throw new Error(
55
+ `microFrontendApps.${id} is missing development section in app.config.json`
56
+ );
57
+ }
58
+ if (!isFileListValid(development.files)) {
59
+ throw new Error(`invalid value for development.files`);
60
+ }
61
+ }
64
62
  }
65
63
  };
66
64
  const getConfig = ({
@@ -71,13 +71,12 @@ class EventManager {
71
71
  }
72
72
  }
73
73
  return this.#asyncCallwithTimeout(
74
- Promise.resolve(
75
- listener.callback({
76
- obj: scriptingObject,
77
- eventName,
78
- eventParams
79
- })
80
- ),
74
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
75
+ listener.callback({
76
+ obj: scriptingObject,
77
+ eventName,
78
+ eventParams
79
+ }),
81
80
  feedbackWaitTime
82
81
  );
83
82
  });
package/dist/esm/frame.js CHANGED
@@ -65,14 +65,11 @@ const create = ({
65
65
  frame.setAttribute("src", buildFrameSrc(options));
66
66
  const FRAME_LOAD_TIMEOUT_MS = 1e4;
67
67
  let settled = false;
68
- const frameLoadRefs = {
69
- timeoutId: void 0,
70
- onAbort: (() => {
71
- })
72
- };
68
+ let timeoutId;
69
+ let onAbort;
73
70
  const cleanup = () => {
74
- if (frameLoadRefs.timeoutId) clearTimeout(frameLoadRefs.timeoutId);
75
- signal?.removeEventListener("abort", frameLoadRefs.onAbort);
71
+ clearTimeout(timeoutId);
72
+ signal?.removeEventListener("abort", onAbort);
76
73
  };
77
74
  const rejectIfAborted = () => {
78
75
  if (!signal?.aborted) return false;
@@ -84,12 +81,12 @@ const create = ({
84
81
  }
85
82
  return true;
86
83
  };
87
- frameLoadRefs.onAbort = () => {
84
+ onAbort = () => {
88
85
  rejectIfAborted();
89
86
  };
90
87
  if (rejectIfAborted()) return;
91
- signal?.addEventListener("abort", frameLoadRefs.onAbort);
92
- frameLoadRefs.timeoutId = setTimeout(() => {
88
+ signal?.addEventListener("abort", onAbort);
89
+ timeoutId = setTimeout(() => {
93
90
  if (!settled) {
94
91
  settled = true;
95
92
  cleanup();
@@ -4,7 +4,7 @@ const isValidHttpUrl = (fileName) => {
4
4
  let url;
5
5
  try {
6
6
  url = new URL(fileName);
7
- } catch {
7
+ } catch (_) {
8
8
  return false;
9
9
  }
10
10
  return url.protocol === "http:" || url.protocol === "https:";
@@ -55,8 +55,7 @@ class CMicroFEHost {
55
55
  } else if (isPublicFunction(propValue, propName)) {
56
56
  Object.defineProperty(proxy, propName, {
57
57
  value: (...args) => {
58
- const proxyMethod = proxy[propName];
59
- const existingCallChain = proxyMethod?.callContext?.callChain;
58
+ const existingCallChain = proxy[propName]?.callContext?.callChain;
60
59
  Object.defineProperty(propValue, "callContext", {
61
60
  value: {
62
61
  guest: this.#guest,
@@ -76,9 +75,7 @@ class CMicroFEHost {
76
75
  });
77
76
  return Promise.resolve(proxy);
78
77
  } catch (err) {
79
- return Promise.reject(
80
- err instanceof Error ? err : new Error(String(err))
81
- );
78
+ return Promise.reject(err);
82
79
  }
83
80
  };
84
81
  /**
@@ -3,16 +3,31 @@ class Analytics extends ScriptingObject {
3
3
  constructor() {
4
4
  super("analytics");
5
5
  }
6
- deleteTimingEventSamplingRatio = (_names) => {
6
+ deleteTimingEventSamplingRatio = (names) => {
7
+ console.log("Analytics.deleteTimingEventSamplingRatio", names);
7
8
  };
8
- getAllTimingEventSamplingRatios = () => ({});
9
- getTimingEventSamplingRatio = (_names) => ({});
10
- setTimingEventSamplingRatio = (_ratios) => {
9
+ getAllTimingEventSamplingRatios = () => {
10
+ console.log("Analytics.getAllTimingEventSamplingRatios");
11
+ return {};
12
+ };
13
+ getTimingEventSamplingRatio = (names) => {
14
+ console.log("Analytics.getTimingEventSamplingRatio", names);
15
+ return {};
16
+ };
17
+ setTimingEventSamplingRatio = (ratios) => {
18
+ console.log("Analytics.setTimingEventSamplingRatio", ratios);
19
+ };
20
+ sendBAEvent = (event) => {
21
+ console.log("Analytics.sendBAEvent", event);
22
+ return Promise.resolve();
23
+ };
24
+ startTiming = (name, options) => {
25
+ console.log("Analytics.perfMarkStart", name);
26
+ return Promise.resolve(performance.mark(name, { detail: options }));
11
27
  };
12
- sendBAEvent = (_event) => Promise.resolve();
13
- startTiming = (name, options) => Promise.resolve(performance.mark(name, { detail: options }));
14
28
  endTiming = (start, options) => {
15
29
  const name = typeof start === "string" ? start : start.name;
30
+ console.log("Analytics.perfMarkEnd", name);
16
31
  performance.measure(name, {
17
32
  detail: options,
18
33
  start: name
@@ -51,7 +51,10 @@ class AppraisalService extends ScriptingObject {
51
51
  delete = () => {
52
52
  throw new Error("Not implemented");
53
53
  };
54
- log = async (_message, _level) => Promise.resolve();
54
+ log = async (message, level) => {
55
+ console.log(message, level);
56
+ return Promise.resolve();
57
+ };
55
58
  unload = async () => {
56
59
  };
57
60
  }
@@ -1,6 +1,4 @@
1
- import {
2
- rest
3
- } from "msw";
1
+ import { rest } from "msw";
4
2
  import { readFile } from "fs/promises";
5
3
  import path from "node:path";
6
4
  import appConfig from "../app.config.json";
@@ -1,72 +1,6 @@
1
1
  import { readFile } from "fs/promises";
2
2
  import path from "node:path";
3
3
  import { logger as puiLogger, Console } from "@elliemae/pui-diagnostics";
4
- import { ScriptingObject } from "@elliemae/microfe-common";
5
- const getIframeWindow = (frame) => {
6
- const view = frame.contentDocument?.defaultView;
7
- if (!view) {
8
- throw new Error("iframe content window is not available");
9
- }
10
- return view;
11
- };
12
- const getEmuiApps = (emui, appId) => {
13
- const entry = emui[appId];
14
- if (Array.isArray(entry)) return entry;
15
- return entry ? [entry] : [];
16
- };
17
- const setEmuiAppEntry = (emui, appId, entry) => {
18
- emui[appId] = entry;
19
- };
20
- const clearWindowEmui = () => {
21
- Reflect.deleteProperty(window, "emui");
22
- };
23
- const createTestModuleSO = () => {
24
- const moduleSO = new ScriptingObject("module");
25
- Object.defineProperty(moduleSO, "getParameters", {
26
- value: () => Promise.resolve({ moduleId: "urn:test", homeRoute: "/test" }),
27
- enumerable: true
28
- });
29
- return moduleSO;
30
- };
31
- const expectInitHistoryShape = (history) => {
32
- expect(history).toBeDefined();
33
- expect(history?.action).toBe("POP");
34
- expect(typeof history?.push).toBe("function");
35
- expect(typeof history?.replace).toBe("function");
36
- };
37
- const expectInitThemeShape = (theme) => {
38
- expect(theme).toBeDefined();
39
- expect(theme?.breakpoints).toBeDefined();
40
- expect(theme?.colors).toBeDefined();
41
- expect(typeof theme?.media.large).toBe("function");
42
- expect(typeof theme?.media.medium).toBe("function");
43
- };
44
- const expectInitLoggerShape = (initLogger) => {
45
- expect(initLogger).toBeDefined();
46
- expect(typeof initLogger?.audit).toBe("function");
47
- expect(typeof initLogger?.debug).toBe("function");
48
- expect(typeof initLogger?.error).toBe("function");
49
- };
50
- const snapshotInitOptionsPayload = (initOptions) => ({
51
- ...initOptions,
52
- logger: void 0,
53
- history: initOptions.history ? {
54
- action: initOptions.history.action,
55
- location: initOptions.history.location
56
- } : void 0,
57
- theme: initOptions.theme ? {
58
- breakpoints: initOptions.theme.breakpoints,
59
- colors: initOptions.theme.colors,
60
- fontSizes: initOptions.theme.fontSizes,
61
- fontWeights: initOptions.theme.fontWeights,
62
- fonts: initOptions.theme.fonts,
63
- letterSpacings: initOptions.theme.letterSpacings,
64
- lineHeights: initOptions.theme.lineHeights,
65
- shadows: initOptions.theme.shadows,
66
- space: initOptions.theme.space,
67
- zIndex: initOptions.theme.zIndex
68
- } : void 0
69
- });
70
4
  const getMajorMinorVersion = (version) => version.split(".").slice(0, 2).join(".");
71
5
  const sendJS = async (res, ctx, filePath) => {
72
6
  const fileContent = await readFile(path.join(__dirname, filePath), "utf-8");
@@ -91,18 +25,9 @@ const logger = puiLogger({
91
25
  appName: "MicroFE Tests"
92
26
  });
93
27
  export {
94
- clearWindowEmui,
95
- createTestModuleSO,
96
- expectInitHistoryShape,
97
- expectInitLoggerShape,
98
- expectInitThemeShape,
99
- getEmuiApps,
100
- getIframeWindow,
101
28
  getMajorMinorVersion,
102
29
  logger,
103
30
  releaseJSThread,
104
31
  sendJS,
105
- sendJSText,
106
- setEmuiAppEntry,
107
- snapshotInitOptionsPayload
32
+ sendJSText
108
33
  };
@@ -3,7 +3,7 @@ const getWindow = () => {
3
3
  try {
4
4
  window.parent.document;
5
5
  return window.parent;
6
- } catch {
6
+ } catch (err) {
7
7
  return window;
8
8
  }
9
9
  };
@@ -1,4 +1,4 @@
1
- <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>AppBridge E2E — Comprehensive Host Test</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script src="https://cdn.mortgagetech.q1.ice.com/pui-diagnostics@3"></script><script defer="defer" src="js/emuiAppBridge.e4cfaa7d8c810b09c233.js"></script></head><body class="bg-gray-50"><header class="bg-indigo-600 text-white px-4 py-3 flex items-center justify-between"><h1 class="text-lg font-semibold">AppBridge E2E — Comprehensive Host Test</h1><a href="./e2e-index.html" class="text-indigo-200 hover:text-white text-sm">&larr; Back to dashboard</a></header><main class="mx-auto max-w-7xl px-4 py-4"><div class="bg-blue-50 border border-blue-200 rounded-md p-3 mb-4"><h2 class="text-sm font-bold text-blue-900 mb-1">How to Use This Page</h2><ol class="text-xs text-blue-800 list-decimal ml-4 space-y-1"><li>Wait for <strong>"E2E Host ready"</strong> in the Event Log.</li><li>Use buttons in each section to test AppBridge features.</li><li>Check Event Log and result panels for expected output.</li><li>Work through the Verification Checklist at the bottom.</li></ol></div><div class="grid grid-cols-3 gap-4"><div class="col-span-2 space-y-4"><div class="bg-white rounded-lg shadow p-4"><h2 class="text-sm font-semibold text-gray-700 mb-2">App Loading</h2><div class="flex flex-wrap gap-2"><button data-testid="btn-open-app" id="btnOpenApp" class="rounded bg-indigo-600 px-3 py-1 text-xs text-white hover:bg-indigo-700">Open App (pricingservice)</button> <button data-testid="btn-open-credit" id="btnOpenCredit" class="rounded bg-indigo-600 px-3 py-1 text-xs text-white hover:bg-indigo-700">Open App (creditservice)</button> <button data-testid="btn-open-validation" id="btnOpenValidation" class="rounded bg-indigo-600 px-3 py-1 text-xs text-white hover:bg-indigo-700">Open App (loanvalidation)</button> <button data-testid="btn-open-with-metadata" id="btnOpenWithMetadata" class="rounded bg-purple-600 px-3 py-1 text-xs text-white hover:bg-purple-700">Open App with Metadata</button> <button data-testid="btn-open-e2e-guest" id="btnOpenE2EGuest" class="rounded bg-teal-600 px-3 py-1 text-xs text-white hover:bg-teal-700">Open E2E Test Guest</button> <button data-testid="btn-open-nested-chain" id="btnOpenNestedChain" class="rounded bg-orange-600 px-3 py-1 text-xs text-white hover:bg-orange-700">Open Nested Chain (A→B→C)</button></div><p class="text-xs text-gray-400 mt-1"><strong>Expected:</strong> App loads into the container below. Log shows "openApp" succeeded. The E2E Test Guest provides interactive buttons to test guest→host communication. The Nested Chain (A→B→C) opens an intermediate that clones Loan and re-exposes it to a grandchild — use C's buttons to verify callChain propagation on Host A.</p></div><div class="bg-white rounded-lg shadow p-4"><h2 class="text-sm font-semibold text-gray-700 mb-2">Scripting Object Management</h2><div class="flex flex-wrap gap-2"><button data-testid="btn-add-so" id="btnAddSO" class="rounded bg-green-600 px-3 py-1 text-xs text-white hover:bg-green-700">Add "Inventory" Object</button> <button data-testid="btn-remove-so" id="btnRemoveSO" class="rounded bg-red-600 px-3 py-1 text-xs text-white hover:bg-red-700">Remove "Inventory" Object</button> <button data-testid="btn-remove-all-so" id="btnRemoveAllSO" class="rounded bg-red-600 px-3 py-1 text-xs text-white hover:bg-red-700">Remove All Objects</button></div><p class="text-xs text-gray-400 mt-1"><strong>Expected:</strong> Add succeeds. Remove succeeds. Guest apps can/cannot call removed objects.</p></div><div class="bg-white rounded-lg shadow p-4"><h2 class="text-sm font-semibold text-gray-700 mb-2">Event Dispatching</h2><div class="flex flex-wrap gap-2"><button data-testid="btn-dispatch-presave" id="btnDispatchPreSave" class="rounded bg-yellow-600 px-3 py-1 text-xs text-white hover:bg-yellow-700">Dispatch onPreSave (all apps)</button> <button data-testid="btn-dispatch-amount" id="btnDispatchAmount" class="rounded bg-yellow-600 px-3 py-1 text-xs text-white hover:bg-yellow-700">Dispatch onLoanAmountChanged</button> <button data-testid="btn-dispatch-term" id="btnDispatchTerm" class="rounded bg-yellow-600 px-3 py-1 text-xs text-white hover:bg-yellow-700">Dispatch onLoanTermChanged</button></div><div data-testid="dispatch-result" id="dispatchResult" class="mt-2 text-xs bg-gray-100 rounded p-2 min-h-[40px]">Dispatch results appear here...</div></div><div class="bg-white rounded-lg shadow p-4"><h2 class="text-sm font-semibold text-gray-700 mb-2">callContext (from last scripting object invocation)</h2><div class="grid grid-cols-2 gap-2"><div><h3 class="text-xs font-medium text-gray-500 mb-1">callContext.guest</h3><pre data-testid="call-context-guest" id="callContextGuest" class="text-xs bg-gray-100 rounded p-2 min-h-[30px] whitespace-pre-wrap">
1
+ <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>AppBridge E2E — Comprehensive Host Test</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script src="https://cdn.mortgagetech.q1.ice.com/pui-diagnostics@3"></script><script defer="defer" src="js/emuiAppBridge.02aa5aed856e7e070591.js"></script></head><body class="bg-gray-50"><header class="bg-indigo-600 text-white px-4 py-3 flex items-center justify-between"><h1 class="text-lg font-semibold">AppBridge E2E — Comprehensive Host Test</h1><a href="./e2e-index.html" class="text-indigo-200 hover:text-white text-sm">&larr; Back to dashboard</a></header><main class="mx-auto max-w-7xl px-4 py-4"><div class="bg-blue-50 border border-blue-200 rounded-md p-3 mb-4"><h2 class="text-sm font-bold text-blue-900 mb-1">How to Use This Page</h2><ol class="text-xs text-blue-800 list-decimal ml-4 space-y-1"><li>Wait for <strong>"E2E Host ready"</strong> in the Event Log.</li><li>Use buttons in each section to test AppBridge features.</li><li>Check Event Log and result panels for expected output.</li><li>Work through the Verification Checklist at the bottom.</li></ol></div><div class="grid grid-cols-3 gap-4"><div class="col-span-2 space-y-4"><div class="bg-white rounded-lg shadow p-4"><h2 class="text-sm font-semibold text-gray-700 mb-2">App Loading</h2><div class="flex flex-wrap gap-2"><button data-testid="btn-open-app" id="btnOpenApp" class="rounded bg-indigo-600 px-3 py-1 text-xs text-white hover:bg-indigo-700">Open App (pricingservice)</button> <button data-testid="btn-open-credit" id="btnOpenCredit" class="rounded bg-indigo-600 px-3 py-1 text-xs text-white hover:bg-indigo-700">Open App (creditservice)</button> <button data-testid="btn-open-validation" id="btnOpenValidation" class="rounded bg-indigo-600 px-3 py-1 text-xs text-white hover:bg-indigo-700">Open App (loanvalidation)</button> <button data-testid="btn-open-with-metadata" id="btnOpenWithMetadata" class="rounded bg-purple-600 px-3 py-1 text-xs text-white hover:bg-purple-700">Open App with Metadata</button> <button data-testid="btn-open-e2e-guest" id="btnOpenE2EGuest" class="rounded bg-teal-600 px-3 py-1 text-xs text-white hover:bg-teal-700">Open E2E Test Guest</button> <button data-testid="btn-open-nested-chain" id="btnOpenNestedChain" class="rounded bg-orange-600 px-3 py-1 text-xs text-white hover:bg-orange-700">Open Nested Chain (A→B→C)</button></div><p class="text-xs text-gray-400 mt-1"><strong>Expected:</strong> App loads into the container below. Log shows "openApp" succeeded. The E2E Test Guest provides interactive buttons to test guest→host communication. The Nested Chain (A→B→C) opens an intermediate that clones Loan and re-exposes it to a grandchild — use C's buttons to verify callChain propagation on Host A.</p></div><div class="bg-white rounded-lg shadow p-4"><h2 class="text-sm font-semibold text-gray-700 mb-2">Scripting Object Management</h2><div class="flex flex-wrap gap-2"><button data-testid="btn-add-so" id="btnAddSO" class="rounded bg-green-600 px-3 py-1 text-xs text-white hover:bg-green-700">Add "Inventory" Object</button> <button data-testid="btn-remove-so" id="btnRemoveSO" class="rounded bg-red-600 px-3 py-1 text-xs text-white hover:bg-red-700">Remove "Inventory" Object</button> <button data-testid="btn-remove-all-so" id="btnRemoveAllSO" class="rounded bg-red-600 px-3 py-1 text-xs text-white hover:bg-red-700">Remove All Objects</button></div><p class="text-xs text-gray-400 mt-1"><strong>Expected:</strong> Add succeeds. Remove succeeds. Guest apps can/cannot call removed objects.</p></div><div class="bg-white rounded-lg shadow p-4"><h2 class="text-sm font-semibold text-gray-700 mb-2">Event Dispatching</h2><div class="flex flex-wrap gap-2"><button data-testid="btn-dispatch-presave" id="btnDispatchPreSave" class="rounded bg-yellow-600 px-3 py-1 text-xs text-white hover:bg-yellow-700">Dispatch onPreSave (all apps)</button> <button data-testid="btn-dispatch-amount" id="btnDispatchAmount" class="rounded bg-yellow-600 px-3 py-1 text-xs text-white hover:bg-yellow-700">Dispatch onLoanAmountChanged</button> <button data-testid="btn-dispatch-term" id="btnDispatchTerm" class="rounded bg-yellow-600 px-3 py-1 text-xs text-white hover:bg-yellow-700">Dispatch onLoanTermChanged</button></div><div data-testid="dispatch-result" id="dispatchResult" class="mt-2 text-xs bg-gray-100 rounded p-2 min-h-[40px]">Dispatch results appear here...</div></div><div class="bg-white rounded-lg shadow p-4"><h2 class="text-sm font-semibold text-gray-700 mb-2">callContext (from last scripting object invocation)</h2><div class="grid grid-cols-2 gap-2"><div><h3 class="text-xs font-medium text-gray-500 mb-1">callContext.guest</h3><pre data-testid="call-context-guest" id="callContextGuest" class="text-xs bg-gray-100 rounded p-2 min-h-[30px] whitespace-pre-wrap">
2
2
  Waiting for invocation...</pre></div><div><h3 class="text-xs font-medium text-gray-500 mb-1">callContext.callChain</h3><pre data-testid="call-context-chain" id="callContextChain" class="text-xs bg-gray-100 rounded p-2 min-h-[30px] whitespace-pre-wrap">
3
3
  Waiting for invocation...</pre></div></div></div><div class="bg-white rounded-lg shadow p-4"><h2 class="text-sm font-semibold text-gray-700 mb-2">App Lifecycle</h2><div class="flex flex-wrap gap-2"><button data-testid="btn-close-app" id="btnCloseApp" class="rounded bg-red-600 px-3 py-1 text-xs text-white hover:bg-red-700">Close First App</button> <button data-testid="btn-close-all" id="btnCloseAll" class="rounded bg-red-800 px-3 py-1 text-xs text-white hover:bg-red-900">Close All Apps</button> <button data-testid="btn-list-apps" id="btnListApps" class="rounded bg-gray-600 px-3 py-1 text-xs text-white hover:bg-gray-700">List Apps</button></div><pre data-testid="app-list" id="appList" class="mt-2 text-xs bg-gray-100 rounded p-2 min-h-[30px] whitespace-pre-wrap">
4
4
  (no apps)</pre></div></div><div class="space-y-4"><div class="bg-white rounded-lg shadow p-3"><h2 class="text-sm font-semibold text-gray-700 mb-2">Guest App Container</h2><div data-testid="app-container" id="appContainer" class="border-2 border-dashed border-indigo-300 rounded-lg" style="height:700px;overflow:auto"></div></div><div class="bg-white rounded-lg shadow p-3"><div class="flex justify-between items-center mb-2"><h2 class="text-sm font-semibold text-gray-700">Event Log</h2><button data-testid="btn-clear-log" id="btnClearLog" class="rounded bg-gray-200 px-2 py-0.5 text-xs text-gray-600 hover:bg-gray-300">Clear</button></div><div data-testid="event-log" id="eventLog" class="text-xs bg-gray-100 rounded p-2 min-h-[200px] max-h-[400px] overflow-y-auto"></div></div></div></div><div class="bg-gray-100 border border-gray-300 rounded-md p-3 mt-4"><h2 class="text-sm font-bold text-gray-800 mb-2">Verification Checklist</h2><div class="grid grid-cols-2 gap-2 text-xs"><label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-APP-01:</strong> openApp loads pricingservice into container, log shows mounted</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-APP-02:</strong> openApp loads creditservice into container</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-APP-03:</strong> openApp loads loanvalidation into container</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-APP-04:</strong> openApp with metadata — metadata stored for callChain</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-SO-01:</strong> Loan object registered on init (guest apps can call getLoanDetails)</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-SO-02:</strong> Add Inventory object succeeds</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-SO-03:</strong> Remove Inventory object succeeds</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-SO-04:</strong> removeAllScriptingObjects clears everything</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-SO-05:</strong> callContext.guest populated when guest invokes scripting object method</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-SO-06:</strong> Loan.getLoanDetails returns expected loan data</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-EVT-01:</strong> Dispatch onPreSave reaches all subscribed apps, results returned</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-EVT-02:</strong> Dispatch onLoanAmountChanged reaches subscribed apps</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-EVT-03:</strong> Dispatch onLoanTermChanged reaches subscribed apps</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-LIFE-01:</strong> closeApp removes first app from list</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-LIFE-02:</strong> List Apps shows all active apps with instanceIds</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-LIFE-03:</strong> closeAllApps removes all apps</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-LIFE-04:</strong> No console errors during any operation</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-META-01:</strong> openApp with metadata — callContext.callChain contains metadata when guest invokes cloned object</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-GUEST-01:</strong> Guest getObject("Loan") returns proxy with expected methods (getLoanDetails, setCreditScore)</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-GUEST-02:</strong> Guest Loan.getLoanDetails() returns loan data, host callContext.guest shows e2etestguest</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-GUEST-03:</strong> Guest Loan.setCreditScore(800) returns {updated: true}, host callContext updates</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-GUEST-04:</strong> Guest getObject("Inventory") returns proxy after host adds it; null before</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-GUEST-05:</strong> Guest Inventory.getItems() returns item array</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-GUEST-06:</strong> Guest getObject("NonExistent") returns null</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-GUEST-07:</strong> Guest subscribes to onPreSave — receives event when host dispatches</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-GUEST-08:</strong> Guest subscribes to onLoanAmountChanged — receives event when host dispatches</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-GUEST-09:</strong> Guest unsubscribe all — no more events received after unsubscribe</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-CHAIN-01:</strong> Open Nested Chain — Intermediate B loads, shows "CAppBridge B initialized"</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-CHAIN-02:</strong> Grandchild C (E2E Test Guest) appears inside Intermediate B</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-CHAIN-03:</strong> In C: getObject("Loan") → Loan.getLoanDetails() → Host A shows callContext.guest = e2eintermediateguest, callChain = [{id: "e2etestguest", metadata: {role: "grandchild", ...}}]</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-CHAIN-04:</strong> In C: Loan.setCreditScore(800) → Host A callChain includes e2etestguest with metadata from B</span></label></div></div></main><script src="./e2e-host.js" type="module"></script></body></html>
@@ -1 +1 @@
1
- <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>AppBridge E2E Test Suite</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script defer="defer" src="js/emuiAppBridge.e4cfaa7d8c810b09c233.js"></script></head><body class="bg-gray-50"><header class="bg-gray-900 text-white px-6 py-4"><h1 class="text-xl font-bold">AppBridge End-to-End Test Suite</h1><p class="text-sm text-gray-400 mt-1">Comprehensive blackbox tests for AppBridge (in-process micro-frontend framework). Each page includes test steps, expected values, and a verification checklist.</p></header><main class="mx-auto max-w-5xl px-6 py-6"><section class="mb-6 bg-yellow-50 border border-yellow-200 rounded-lg p-4"><h2 class="text-sm font-semibold text-yellow-800 mb-2">Setup Instructions</h2><ol class="text-xs text-yellow-700 list-decimal ml-4 space-y-1"><li>Install dependencies: <code class="bg-yellow-100 px-1 rounded">pnpm install</code></li><li>Start AppBridge dev server: <code class="bg-yellow-100 px-1 rounded">cd libs/app-bridge && pnpm start</code> (default port 3000)</li><li>Open <code class="bg-yellow-100 px-1 rounded">http://localhost:3000/e2e-index.html</code> in the browser</li><li>Each test page has <code class="bg-yellow-100 px-1 rounded">data-testid</code> attributes for Playwright/Cypress selectors</li></ol></section><section class="mb-6"><h2 class="text-lg font-semibold text-gray-800 border-b pb-1 mb-3">1. Core AppBridge Host Tests</h2><div class="grid grid-cols-1 md:grid-cols-2 gap-3"><a href="./e2e-host.html" data-testid="link-e2e-host" class="block bg-white rounded-lg shadow p-4 hover:shadow-md transition"><h3 class="font-medium text-indigo-700">Comprehensive E2E Host</h3><p class="text-xs text-gray-500 mt-1">All host scenarios: openApp, closeApp, scripting objects, events, lifecycle, metadata, callContext.</p><p class="text-xs text-gray-400 mt-2"><strong>What to verify:</strong> Apps open and mount into containers. Scripting objects can be added/removed/invoked with correct callContext. Events reach subscribed apps. closeApp/closeAllApps cleans up properly.</p><div class="mt-2 text-xs text-gray-400"><strong>Test Cases:</strong> TC-APP-01..04 &bull; TC-SO-01..06 &bull; TC-EVT-01..03 &bull; TC-LIFE-01..04 &bull; TC-META-01</div></a><a href="./index.html" data-testid="link-main-demo" class="block bg-white rounded-lg shadow p-4 hover:shadow-md transition"><h3 class="font-medium text-indigo-700">Main Demo App</h3><p class="text-xs text-gray-500 mt-1">Original Loan Application demo with credit, pricing, and loan validation micro-apps.</p><p class="text-xs text-gray-400 mt-2"><strong>What to verify:</strong> Loan form data flows to guest apps. Events (onLoanAmountChanged, etc.) update guest UIs. Credit score updates from guest. Save dispatches onPreSave with feedback.</p></a></div></section></main></body></html>
1
+ <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>AppBridge E2E Test Suite</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script defer="defer" src="js/emuiAppBridge.02aa5aed856e7e070591.js"></script></head><body class="bg-gray-50"><header class="bg-gray-900 text-white px-6 py-4"><h1 class="text-xl font-bold">AppBridge End-to-End Test Suite</h1><p class="text-sm text-gray-400 mt-1">Comprehensive blackbox tests for AppBridge (in-process micro-frontend framework). Each page includes test steps, expected values, and a verification checklist.</p></header><main class="mx-auto max-w-5xl px-6 py-6"><section class="mb-6 bg-yellow-50 border border-yellow-200 rounded-lg p-4"><h2 class="text-sm font-semibold text-yellow-800 mb-2">Setup Instructions</h2><ol class="text-xs text-yellow-700 list-decimal ml-4 space-y-1"><li>Install dependencies: <code class="bg-yellow-100 px-1 rounded">pnpm install</code></li><li>Start AppBridge dev server: <code class="bg-yellow-100 px-1 rounded">cd libs/app-bridge && pnpm start</code> (default port 3000)</li><li>Open <code class="bg-yellow-100 px-1 rounded">http://localhost:3000/e2e-index.html</code> in the browser</li><li>Each test page has <code class="bg-yellow-100 px-1 rounded">data-testid</code> attributes for Playwright/Cypress selectors</li></ol></section><section class="mb-6"><h2 class="text-lg font-semibold text-gray-800 border-b pb-1 mb-3">1. Core AppBridge Host Tests</h2><div class="grid grid-cols-1 md:grid-cols-2 gap-3"><a href="./e2e-host.html" data-testid="link-e2e-host" class="block bg-white rounded-lg shadow p-4 hover:shadow-md transition"><h3 class="font-medium text-indigo-700">Comprehensive E2E Host</h3><p class="text-xs text-gray-500 mt-1">All host scenarios: openApp, closeApp, scripting objects, events, lifecycle, metadata, callContext.</p><p class="text-xs text-gray-400 mt-2"><strong>What to verify:</strong> Apps open and mount into containers. Scripting objects can be added/removed/invoked with correct callContext. Events reach subscribed apps. closeApp/closeAllApps cleans up properly.</p><div class="mt-2 text-xs text-gray-400"><strong>Test Cases:</strong> TC-APP-01..04 &bull; TC-SO-01..06 &bull; TC-EVT-01..03 &bull; TC-LIFE-01..04 &bull; TC-META-01</div></a><a href="./index.html" data-testid="link-main-demo" class="block bg-white rounded-lg shadow p-4 hover:shadow-md transition"><h3 class="font-medium text-indigo-700">Main Demo App</h3><p class="text-xs text-gray-500 mt-1">Original Loan Application demo with credit, pricing, and loan validation micro-apps.</p><p class="text-xs text-gray-400 mt-2"><strong>What to verify:</strong> Loan form data flows to guest apps. Events (onLoanAmountChanged, etc.) update guest UIs. Credit score updates from guest. Save dispatches onPreSave with feedback.</p></a></div></section></main></body></html>