@rimori/playwright-testing 0.3.5-next.0 → 0.3.5-next.2

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.
@@ -231,6 +231,7 @@ export declare class RimoriTestEnvironment {
231
231
  mockGetVoice: (values: Buffer, options?: MockOptions) => void;
232
232
  mockGetTextFromVoice: (text: string, options?: MockOptions) => void;
233
233
  mockGetObject: (value: Record<string, unknown>, options?: MockOptions) => void;
234
+ mockGetStreamedObject: (value: Record<string, unknown>, options?: MockOptions) => void;
234
235
  };
235
236
  /**
236
237
  * Helpers for tracking browser audio playback in tests.
@@ -47,7 +47,13 @@ class RimoriTestEnvironment {
47
47
  this.addSupabaseRoute('plugin_settings', response, { ...options, method: 'POST' });
48
48
  },
49
49
  mockGetUserInfo: (userInfo, options) => {
50
- this.addSupabaseRoute('/user-info', { ...this.rimoriInfo.profile, ...userInfo }, { ...options, delay: 0 });
50
+ // Update the rimoriInfo.profile so that MessageChannelSimulator returns the correct user info
51
+ this.rimoriInfo.profile = { ...this.rimoriInfo.profile, ...userInfo };
52
+ // Also update the MessageChannelSimulator if it exists (setup() has been called)
53
+ if (this.messageChannelSimulator) {
54
+ this.messageChannelSimulator.setUserInfo(this.rimoriInfo.profile);
55
+ }
56
+ this.addSupabaseRoute('/user-info', this.rimoriInfo.profile, { ...options, delay: 0 });
51
57
  },
52
58
  mockGetPluginInfo: (pluginInfo, options) => {
53
59
  this.addSupabaseRoute('/plugin-info', pluginInfo, options);
@@ -218,6 +224,9 @@ class RimoriTestEnvironment {
218
224
  mockGetObject: (value, options) => {
219
225
  this.addBackendRoute('/ai/llm-object', value, { ...options, method: 'POST' });
220
226
  },
227
+ mockGetStreamedObject: (value, options) => {
228
+ this.addBackendRoute('/ai/llm-object', value, { ...options, isStreaming: true });
229
+ },
221
230
  };
222
231
  /**
223
232
  * Helpers for tracking browser audio playback in tests.
@@ -821,10 +830,19 @@ class RimoriTestEnvironment {
821
830
  if (typeof matchingMock.value === 'function') {
822
831
  responseValue = await matchingMock.value(request);
823
832
  }
824
- // Handle streaming responses (for mockGetSteamedText)
833
+ // Handle streaming responses (for mockGetSteamedText and mockGetStreamedObject)
825
834
  // Since Playwright requires complete body, we format as SSE without delays
826
- if (matchingMock.isStreaming && typeof responseValue === 'string') {
827
- const body = this.formatAsSSE(responseValue);
835
+ if (matchingMock.isStreaming) {
836
+ let body;
837
+ if (typeof responseValue === 'string') {
838
+ // Text streaming (mockGetSteamedText)
839
+ body = this.formatAsSSE(responseValue);
840
+ }
841
+ else {
842
+ // Object streaming (mockGetStreamedObject)
843
+ // Format as SSE with JSON payload, followed by [DONE] marker
844
+ body = `data: ${JSON.stringify(responseValue)}\n\ndata: [DONE]\n\n`;
845
+ }
828
846
  return await route.fulfill({
829
847
  status: 200,
830
848
  headers: { 'Content-Type': 'text/event-stream' },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rimori/playwright-testing",
3
- "version": "0.3.5-next.0",
3
+ "version": "0.3.5-next.2",
4
4
  "description": "Playwright testing utilities for Rimori plugins and workers",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -23,11 +23,11 @@
23
23
  },
24
24
  "peerDependencies": {
25
25
  "@playwright/test": "^1.40.0",
26
- "@rimori/client": "^2.5.8"
26
+ "@rimori/client": "2.5.10-next.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@playwright/test": "^1.40.0",
30
- "@rimori/client": "^2.5.8",
30
+ "@rimori/client": "2.5.10-next.0",
31
31
  "@types/node": "^20.12.7",
32
32
  "rimraf": "^5.0.7",
33
33
  "typescript": "^5.7.2"