@rimori/playwright-testing 0.3.37-next.0 → 0.3.38-next.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.
|
@@ -332,6 +332,32 @@ export declare class RimoriTestEnvironment {
|
|
|
332
332
|
* @param options - Optional mock options.
|
|
333
333
|
*/
|
|
334
334
|
mockGetStreamedObject: (value: Record<string, unknown>, options?: MockOptions) => void;
|
|
335
|
+
/**
|
|
336
|
+
* Mocks a streaming object response that emits multiple snapshots, one SSE frame each.
|
|
337
|
+
* Use this to reproduce progressive/settled streaming: each frame is a full cumulative
|
|
338
|
+
* snapshot of the object, and the client's `onResult` fires once per frame. This is how
|
|
339
|
+
* the backend streams `settledOnly` output, where a trailing field of an item only appears
|
|
340
|
+
* in a later snapshot (once a following item starts and pushes it off the streaming frontier).
|
|
341
|
+
*
|
|
342
|
+
* @param frames - Ordered cumulative snapshots. The last frame should be the complete object.
|
|
343
|
+
* @param options - Optional mock options.
|
|
344
|
+
*/
|
|
345
|
+
mockGetStreamedObjectFrames: (frames: Record<string, unknown>[], options?: MockOptions) => void;
|
|
346
|
+
/**
|
|
347
|
+
* Mocks the image generation endpoint (`getImage` → `POST /ai/image`).
|
|
348
|
+
* The value may be a static `{ url, cached }` object or a function of the request, letting
|
|
349
|
+
* tests count calls or capture the prompt that was sent.
|
|
350
|
+
*
|
|
351
|
+
* @param value - The `{ url, cached }` response, or a function returning it from the request.
|
|
352
|
+
* @param options - Optional mock options.
|
|
353
|
+
*/
|
|
354
|
+
mockGetImage: (value: {
|
|
355
|
+
url: string;
|
|
356
|
+
cached?: boolean;
|
|
357
|
+
} | ((request: Request) => {
|
|
358
|
+
url: string;
|
|
359
|
+
cached?: boolean;
|
|
360
|
+
}), options?: MockOptions) => void;
|
|
335
361
|
};
|
|
336
362
|
/**
|
|
337
363
|
* Helpers for tracking browser audio playback in tests.
|
|
@@ -354,6 +354,31 @@ class RimoriTestEnvironment {
|
|
|
354
354
|
this.addBackendRoute('/ai/session', { session_token_id: 'mock-session-token' }, { method: 'POST' });
|
|
355
355
|
this.addBackendRoute('/ai/llm', value, { ...options, isStreaming: true });
|
|
356
356
|
},
|
|
357
|
+
/**
|
|
358
|
+
* Mocks a streaming object response that emits multiple snapshots, one SSE frame each.
|
|
359
|
+
* Use this to reproduce progressive/settled streaming: each frame is a full cumulative
|
|
360
|
+
* snapshot of the object, and the client's `onResult` fires once per frame. This is how
|
|
361
|
+
* the backend streams `settledOnly` output, where a trailing field of an item only appears
|
|
362
|
+
* in a later snapshot (once a following item starts and pushes it off the streaming frontier).
|
|
363
|
+
*
|
|
364
|
+
* @param frames - Ordered cumulative snapshots. The last frame should be the complete object.
|
|
365
|
+
* @param options - Optional mock options.
|
|
366
|
+
*/
|
|
367
|
+
mockGetStreamedObjectFrames: (frames, options) => {
|
|
368
|
+
this.addBackendRoute('/ai/session', { session_token_id: 'mock-session-token' }, { method: 'POST' });
|
|
369
|
+
this.addBackendRoute('/ai/llm', { __sseFrames: frames }, { ...options, isStreaming: true });
|
|
370
|
+
},
|
|
371
|
+
/**
|
|
372
|
+
* Mocks the image generation endpoint (`getImage` → `POST /ai/image`).
|
|
373
|
+
* The value may be a static `{ url, cached }` object or a function of the request, letting
|
|
374
|
+
* tests count calls or capture the prompt that was sent.
|
|
375
|
+
*
|
|
376
|
+
* @param value - The `{ url, cached }` response, or a function returning it from the request.
|
|
377
|
+
* @param options - Optional mock options.
|
|
378
|
+
*/
|
|
379
|
+
mockGetImage: (value, options) => {
|
|
380
|
+
this.addBackendRoute('/ai/image', value, options);
|
|
381
|
+
},
|
|
357
382
|
};
|
|
358
383
|
/**
|
|
359
384
|
* Helpers for tracking browser audio playback in tests.
|
|
@@ -1135,6 +1160,14 @@ class RimoriTestEnvironment {
|
|
|
1135
1160
|
// Text streaming (mockGetStreamedText)
|
|
1136
1161
|
body = this.formatAsSSE(responseValue);
|
|
1137
1162
|
}
|
|
1163
|
+
else if (responseValue && typeof responseValue === 'object' && '__sseFrames' in responseValue) {
|
|
1164
|
+
// Multi-snapshot object streaming (mockGetStreamedObjectFrames). Each frame is emitted
|
|
1165
|
+
// as its own `data:` line so the client's `onResult` fires once per snapshot — this lets
|
|
1166
|
+
// tests reproduce progressive/settled streaming where later snapshots reveal fields that
|
|
1167
|
+
// earlier ones omitted (e.g. a trailing field still on the streaming "frontier").
|
|
1168
|
+
const frames = responseValue.__sseFrames;
|
|
1169
|
+
body = frames.map((frame) => `data: ${JSON.stringify(frame)}\n\n`).join('') + 'data: [DONE]\n\n';
|
|
1170
|
+
}
|
|
1138
1171
|
else {
|
|
1139
1172
|
// Object streaming (mockGetStreamedObject)
|
|
1140
1173
|
// Format as SSE with JSON payload, followed by [DONE] marker
|
package/dist/harness/hostInit.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{l as e}from"./__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare___mf_0_rimori_mf_1_client__loadShare__.mjs.js";var t=`__mf_module_cache__`;globalThis[t]||={share:{},remote:{}},globalThis[t].share||={},globalThis[t].remote||={};var n=globalThis[t],r;async function i(){return r||=(async()=>{let t=await(await e(()=>import(`./remoteEntry.js`),[])).init();for(let[e,r]of Object.entries({react:{shareConfig:{singleton:!0,requiredVersion:`^19.2.6`}},"react-dom":{shareConfig:{singleton:!0,requiredVersion:`^19.2.6`}},"react/jsx-dev-runtime":{shareConfig:{singleton:!0,requiredVersion:`^19.2.6`}},"react/jsx-runtime":{shareConfig:{singleton:!0,requiredVersion:`^19.2.6`}},"@rimori/client":{shareConfig:{singleton:!0,requiredVersion:`^2.5.
|
|
1
|
+
import{l as e}from"./__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare___mf_0_rimori_mf_1_client__loadShare__.mjs.js";var t=`__mf_module_cache__`;globalThis[t]||={share:{},remote:{}},globalThis[t].share||={},globalThis[t].remote||={};var n=globalThis[t],r;async function i(){return r||=(async()=>{let t=await(await e(()=>import(`./remoteEntry.js`),[])).init();for(let[e,r]of Object.entries({react:{shareConfig:{singleton:!0,requiredVersion:`^19.2.6`}},"react-dom":{shareConfig:{singleton:!0,requiredVersion:`^19.2.6`}},"react/jsx-dev-runtime":{shareConfig:{singleton:!0,requiredVersion:`^19.2.6`}},"react/jsx-runtime":{shareConfig:{singleton:!0,requiredVersion:`^19.2.6`}},"@rimori/client":{shareConfig:{singleton:!0,requiredVersion:`^2.5.47`}},"@rimori/react-client":{shareConfig:{singleton:!0,requiredVersion:`^0.4.31`}},"@tanstack/react-query":{shareConfig:{singleton:!0,requiredVersion:`^5.100.11`}},zod:{shareConfig:{singleton:!0,requiredVersion:`^4.4.3`}}}))n.share[e]===void 0&&await t.loadShare(e,{customShareInfo:{shareConfig:r.shareConfig}}).then(t=>{let r=typeof t==`function`?t():t;return Promise.resolve(r).then(t=>{n.share[e]=t})});return await Promise.all([]),t})(),r}r=i();export{r as hostInitPromise,i as initHost};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime.js";import"./dist.js";import{l as t}from"./__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare___mf_0_rimori_mf_1_client__loadShare__.mjs.js";var n={"@rimori/client":async()=>await t(()=>import(`./dist3.js`),[]),"@rimori/react-client":async()=>await t(()=>import(`./dist2.js`),[]),"@tanstack/react-query":async()=>await t(()=>import(`./modern.js`),[]),react:async()=>await t(()=>import(`./react.js`).then(t=>e(t.default)),[]),"react-dom":async()=>await t(()=>import(`./react-dom.js`).then(t=>e(t.default)),[]),"react-dom/client":async()=>await t(()=>import(`./client.js`).then(t=>e(t.default)),[]),"react/jsx-dev-runtime":async()=>await t(()=>import(`./jsx-dev-runtime.js`).then(t=>e(t.default)),[]),"react/jsx-runtime":async()=>await t(()=>import(`./jsx-runtime.js`).then(t=>e(t.default)),[]),zod:async()=>await t(()=>import(`./zod.js`),[])},r={"@rimori/client":{name:`@rimori/client`,version:`2.5.
|
|
1
|
+
import{a as e}from"./rolldown-runtime.js";import"./dist.js";import{l as t}from"./__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare___mf_0_rimori_mf_1_client__loadShare__.mjs.js";var n={"@rimori/client":async()=>await t(()=>import(`./dist3.js`),[]),"@rimori/react-client":async()=>await t(()=>import(`./dist2.js`),[]),"@tanstack/react-query":async()=>await t(()=>import(`./modern.js`),[]),react:async()=>await t(()=>import(`./react.js`).then(t=>e(t.default)),[]),"react-dom":async()=>await t(()=>import(`./react-dom.js`).then(t=>e(t.default)),[]),"react-dom/client":async()=>await t(()=>import(`./client.js`).then(t=>e(t.default)),[]),"react/jsx-dev-runtime":async()=>await t(()=>import(`./jsx-dev-runtime.js`).then(t=>e(t.default)),[]),"react/jsx-runtime":async()=>await t(()=>import(`./jsx-runtime.js`).then(t=>e(t.default)),[]),zod:async()=>await t(()=>import(`./zod.js`),[])},r={"@rimori/client":{name:`@rimori/client`,version:`2.5.47`,scope:[`default`],loaded:!1,from:`__mfe_internal__rimori-scenario-host`,async get(){r[`@rimori/client`].loaded=!0;let{"@rimori/client":e}=n,t={...await e()};return Object.defineProperty(t,"__esModule",{value:!0,enumerable:!1}),function(){return t}},shareConfig:{singleton:!0,requiredVersion:`^2.5.47`}},"@rimori/react-client":{name:`@rimori/react-client`,version:`0.4.31`,scope:[`default`],loaded:!1,from:`__mfe_internal__rimori-scenario-host`,async get(){r[`@rimori/react-client`].loaded=!0;let{"@rimori/react-client":e}=n,t={...await e()};return Object.defineProperty(t,"__esModule",{value:!0,enumerable:!1}),function(){return t}},shareConfig:{singleton:!0,requiredVersion:`^0.4.31`}},"@tanstack/react-query":{name:`@tanstack/react-query`,version:`5.100.11`,scope:[`default`],loaded:!1,from:`__mfe_internal__rimori-scenario-host`,async get(){r[`@tanstack/react-query`].loaded=!0;let{"@tanstack/react-query":e}=n,t={...await e()};return Object.defineProperty(t,"__esModule",{value:!0,enumerable:!1}),function(){return t}},shareConfig:{singleton:!0,requiredVersion:`^5.100.11`}},react:{name:`react`,version:`19.2.6`,scope:[`default`],loaded:!1,from:`__mfe_internal__rimori-scenario-host`,async get(){r.react.loaded=!0;let{react:e}=n,t={...await e()};return Object.defineProperty(t,"__esModule",{value:!0,enumerable:!1}),function(){return t}},shareConfig:{singleton:!0,requiredVersion:`^19.2.6`}},"react-dom":{name:`react-dom`,version:`19.2.6`,scope:[`default`],loaded:!1,from:`__mfe_internal__rimori-scenario-host`,async get(){r[`react-dom`].loaded=!0;let{"react-dom":e}=n,t={...await e()};return Object.defineProperty(t,"__esModule",{value:!0,enumerable:!1}),function(){return t}},shareConfig:{singleton:!0,requiredVersion:`^19.2.6`}},"react-dom/client":{name:`react-dom/client`,version:`19.2.6`,scope:[`default`],loaded:!1,from:`__mfe_internal__rimori-scenario-host`,async get(){r[`react-dom/client`].loaded=!0;let{"react-dom/client":e}=n,t={...await e()};return Object.defineProperty(t,"__esModule",{value:!0,enumerable:!1}),function(){return t}},shareConfig:{singleton:!0,requiredVersion:`^19.2.6`}},"react/jsx-dev-runtime":{name:`react/jsx-dev-runtime`,version:`19.2.6`,scope:[`default`],loaded:!1,from:`__mfe_internal__rimori-scenario-host`,async get(){r[`react/jsx-dev-runtime`].loaded=!0;let{"react/jsx-dev-runtime":e}=n,t={...await e()};return Object.defineProperty(t,"__esModule",{value:!0,enumerable:!1}),function(){return t}},shareConfig:{singleton:!0,requiredVersion:`^19.2.6`}},"react/jsx-runtime":{name:`react/jsx-runtime`,version:`19.2.6`,scope:[`default`],loaded:!1,from:`__mfe_internal__rimori-scenario-host`,async get(){r[`react/jsx-runtime`].loaded=!0;let{"react/jsx-runtime":e}=n,t={...await e()};return Object.defineProperty(t,"__esModule",{value:!0,enumerable:!1}),function(){return t}},shareConfig:{singleton:!0,requiredVersion:`^19.2.6`}},zod:{name:`zod`,version:`4.4.3`,scope:[`default`],loaded:!1,from:`__mfe_internal__rimori-scenario-host`,async get(){r.zod.loaded=!0;let{zod:e}=n,t={...await e()};return Object.defineProperty(t,"__esModule",{value:!0,enumerable:!1}),function(){return t}},shareConfig:{singleton:!0,requiredVersion:`^4.4.3`}}},i=[];export{i as usedRemotes,r as usedShared};
|