@rimori/playwright-testing 0.3.20 → 0.3.21-next.1

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.
@@ -220,10 +220,13 @@ export declare class RimoriTestEnvironment {
220
220
  triggerOnSidePanelAction: (payload: SidebarAction) => Promise<void>;
221
221
  /**
222
222
  * Triggers a main panel action event as the parent application would.
223
- * This simulates how rimori-main's MainPluginHandler uses EventBus.respond to respond
224
- * to plugin's 'action.requestMain' events. When the plugin calls onMainPanelAction(),
225
- * it emits '{pluginId}.action.requestMain' and listens for the response.
226
- * This method sets up a responder that automatically responds when the plugin emits this event.
223
+ * This simulates how rimori-main sends the MainPanelAction back to the plugin after
224
+ * the plugin calls onMainPanelAction() and emits '{pluginId}.action.requestMain'.
225
+ *
226
+ * We listen for that outbound emit and respond by injecting a fresh event with
227
+ * sender='rimori-main'. This avoids the EventBus per-listener blacklist that would
228
+ * block a {type:'response'} message carrying the same eventId as the original emit.
229
+ *
227
230
  * @param payload - The main panel action payload containing plugin_id, action_key, and action parameters
228
231
  */
229
232
  triggerOnMainPanelAction: (payload: MainPanelAction) => Promise<void>;
@@ -175,25 +175,27 @@ class RimoriTestEnvironment {
175
175
  },
176
176
  /**
177
177
  * Triggers a main panel action event as the parent application would.
178
- * This simulates how rimori-main's MainPluginHandler uses EventBus.respond to respond
179
- * to plugin's 'action.requestMain' events. When the plugin calls onMainPanelAction(),
180
- * it emits '{pluginId}.action.requestMain' and listens for the response.
181
- * This method sets up a responder that automatically responds when the plugin emits this event.
178
+ * This simulates how rimori-main sends the MainPanelAction back to the plugin after
179
+ * the plugin calls onMainPanelAction() and emits '{pluginId}.action.requestMain'.
180
+ *
181
+ * We listen for that outbound emit and respond by injecting a fresh event with
182
+ * sender='rimori-main'. This avoids the EventBus per-listener blacklist that would
183
+ * block a {type:'response'} message carrying the same eventId as the original emit.
184
+ *
182
185
  * @param payload - The main panel action payload containing plugin_id, action_key, and action parameters
183
186
  */
184
187
  triggerOnMainPanelAction: async (payload) => {
185
188
  if (!this.messageChannelSimulator) {
186
189
  throw new Error('MessageChannelSimulator not initialized. Call setup() first.');
187
190
  }
188
- // Listen for when the plugin emits 'action.requestMain' (which becomes '{pluginId}.action.requestMain')
189
- // and respond with the MainPanelAction payload, matching rimori-main's EventBus.respond behavior
190
191
  const topic = `${this.pluginId}.action.requestMain`;
191
- // Store the payload in a closure so we can respond with it
192
192
  const actionPayload = payload;
193
- // Register a persistent auto-responder (not respondOnce) because the plugin may
194
- // emit this event multiple times during its lifecycle. Using respondOnce would
195
- // only respond to the first request and ignore subsequent ones.
196
- this.messageChannelSimulator.respond(topic, actionPayload);
193
+ // When the plugin emits action.requestMain, immediately emit back the action data
194
+ // as a fresh event from 'rimori-main' (different sender bypasses the EventBus blacklist).
195
+ const off = this.messageChannelSimulator.on(topic, async () => {
196
+ await this.messageChannelSimulator.emit(topic, actionPayload, 'rimori-main');
197
+ off();
198
+ });
197
199
  },
198
200
  };
199
201
  this.ai = {
@@ -680,12 +682,11 @@ class RimoriTestEnvironment {
680
682
  pluginId: options.pluginId,
681
683
  guild: {
682
684
  id: 'guild-test-id',
683
- // @ts-ignore
684
685
  name: 'Test Guild',
685
686
  city: 'Test City',
686
687
  country: 'Testland',
687
688
  description: 'A dummy guild used for testing purposes.',
688
- // @ts-ignore
689
+ // @ts-expect-error - createdAt field not in type but required for test data
689
690
  createdAt: '2024-01-01T00:00:00.000Z',
690
691
  updatedAt: '2024-01-02T00:00:00.000Z',
691
692
  inviteCode: 'INVITE123',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rimori/playwright-testing",
3
- "version": "0.3.20",
3
+ "version": "0.3.21-next.1",
4
4
  "description": "Playwright testing utilities for Rimori plugins and workers",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -26,11 +26,11 @@
26
26
  },
27
27
  "peerDependencies": {
28
28
  "@playwright/test": "^1.40.0",
29
- "@rimori/client": "^2.5.29"
29
+ "@rimori/client": "2.5.32-next.2"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@playwright/test": "^1.40.0",
33
- "@rimori/client": "^2.5.29",
33
+ "@rimori/client": "2.5.32-next.2",
34
34
  "@types/node": "^20.12.7",
35
35
  "rimraf": "^5.0.7",
36
36
  "typescript": "^5.7.2"