@rimori/playwright-testing 0.3.1 → 0.3.2-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.
@@ -9,7 +9,7 @@ interface RimoriTestEnvironmentOptions {
9
9
  pluginUrl: string;
10
10
  settings?: PluginSettings;
11
11
  queryParams?: Record<string, string>;
12
- userInfo?: Record<string, unknown>;
12
+ userInfo?: Partial<UserInfo>;
13
13
  installedPlugins?: Plugin[];
14
14
  guildOverrides?: Record<string, unknown>;
15
15
  }
@@ -485,6 +485,31 @@ class RimoriTestEnvironment {
485
485
  });
486
486
  }
487
487
  getRimoriInfo(options) {
488
+ // Merge userInfo with DEFAULT_USER_INFO, with userInfo taking precedence
489
+ // Deep merge nested objects first, then spread the rest
490
+ const mergedUserInfo = {
491
+ ...default_user_info_1.DEFAULT_USER_INFO,
492
+ ...(options.userInfo?.mother_tongue && {
493
+ mother_tongue: {
494
+ ...default_user_info_1.DEFAULT_USER_INFO.mother_tongue,
495
+ ...options.userInfo.mother_tongue,
496
+ },
497
+ }),
498
+ ...(options.userInfo?.target_language && {
499
+ target_language: {
500
+ ...default_user_info_1.DEFAULT_USER_INFO.target_language,
501
+ ...options.userInfo.target_language,
502
+ },
503
+ }),
504
+ ...(options.userInfo?.study_buddy && {
505
+ study_buddy: {
506
+ ...default_user_info_1.DEFAULT_USER_INFO.study_buddy,
507
+ ...options.userInfo.study_buddy,
508
+ },
509
+ }),
510
+ // Spread the rest of userInfo after deep merging nested objects
511
+ ...Object.fromEntries(Object.entries(options.userInfo || {}).filter(([key]) => !['mother_tongue', 'target_language', 'study_buddy'].includes(key))),
512
+ };
488
513
  return {
489
514
  key: 'rimori-testing-key',
490
515
  token: 'rimori-testing-token',
@@ -513,10 +538,10 @@ class RimoriTestEnvironment {
513
538
  longTermGoalOverride: '',
514
539
  },
515
540
  installedPlugins: options.installedPlugins ?? [],
516
- profile: default_user_info_1.DEFAULT_USER_INFO,
541
+ profile: mergedUserInfo,
517
542
  mainPanelPlugin: undefined,
518
543
  sidePanelPlugin: undefined,
519
- interfaceLanguage: default_user_info_1.DEFAULT_USER_INFO.mother_tongue.code, // Set interface language from user's mother tongue
544
+ interfaceLanguage: mergedUserInfo.mother_tongue.code, // Set interface language from user's mother tongue
520
545
  };
521
546
  }
522
547
  /**
@@ -4,7 +4,7 @@ const test_1 = require("@playwright/test");
4
4
  const RimoriTestEnvironment_1 = require("../core/RimoriTestEnvironment");
5
5
  const pluginId = 'pl7720512027';
6
6
  const pluginUrl = 'http://localhost:3009';
7
- test_1.test.describe('Translator Plugin', () => {
7
+ test_1.test.describe('Demo Plugin', () => {
8
8
  let env;
9
9
  test_1.test.beforeEach(async ({ page }) => {
10
10
  env = new RimoriTestEnvironment_1.RimoriTestEnvironment({ page, pluginId, pluginUrl });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rimori/playwright-testing",
3
- "version": "0.3.1",
3
+ "version": "0.3.2-next.0",
4
4
  "description": "Playwright testing utilities for Rimori plugins and workers",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {