@lvce-editor/test-worker 4.15.0 → 4.17.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.
package/dist/api.d.ts CHANGED
@@ -208,8 +208,10 @@ declare const toggleReplace: () => Promise<void>;
208
208
  declare const update: (settings: any) => Promise<void>;
209
209
  declare const open$4: (id: string) => Promise<void>;
210
210
  declare const hide: () => Promise<void>;
211
+ declare const selectIndex$4: (index: number) => Promise<void>;
211
212
  declare const acceptInput: () => Promise<void>;
212
213
  declare const handleInput$2: (text: string) => Promise<void>;
214
+ declare const handleClickSourceControlButtons: (index: number, name: string) => Promise<void>;
213
215
  declare const update$1: () => Promise<void>;
214
216
  declare const closeMenu: () => Promise<void>;
215
217
  declare const focus$2: () => Promise<void>;
@@ -310,7 +312,7 @@ declare namespace SideBar {
310
312
  export { hide, open$4 as open };
311
313
  }
312
314
  declare namespace SourceControl {
313
- export { acceptInput, handleInput$2 as handleInput };
315
+ export { acceptInput, handleClickSourceControlButtons, handleInput$2 as handleInput, selectIndex$4 as selectIndex };
314
316
  }
315
317
  declare namespace StatusBar {
316
318
  export { update$1 as update };
@@ -524,7 +524,7 @@ const create$4 = (method, params) => {
524
524
  };
525
525
  };
526
526
  const callbacks = Object.create(null);
527
- const set$2 = (id, fn) => {
527
+ const set$4 = (id, fn) => {
528
528
  callbacks[id] = fn;
529
529
  };
530
530
  const get$2 = id => {
@@ -543,7 +543,7 @@ const registerPromise = () => {
543
543
  resolve,
544
544
  promise
545
545
  } = Promise.withResolvers();
546
- set$2(id, resolve);
546
+ set$4(id, resolve);
547
547
  return {
548
548
  id,
549
549
  promise
@@ -891,6 +891,9 @@ const createRpc = ipc => {
891
891
  },
892
892
  invokeAndTransfer(method, ...params) {
893
893
  return invokeAndTransfer$1(ipc, method, ...params);
894
+ },
895
+ async dispose() {
896
+ await ipc?.dispose();
894
897
  }
895
898
  };
896
899
  return rpc;
@@ -925,7 +928,7 @@ const listen$1 = async (module, options) => {
925
928
  const ipc = module.wrap(rawIpc);
926
929
  return ipc;
927
930
  };
928
- const create$6 = async ({
931
+ const create$8 = async ({
929
932
  commandMap,
930
933
  messagePort,
931
934
  isMessagePortOpen
@@ -943,7 +946,7 @@ const create$6 = async ({
943
946
  };
944
947
  const MessagePortRpcParent = {
945
948
  __proto__: null,
946
- create: create$6
949
+ create: create$8
947
950
  };
948
951
  const create$1 = async ({
949
952
  commandMap
@@ -964,29 +967,39 @@ const formatDuration = duration => {
964
967
  return duration.toFixed(2) + 'ms';
965
968
  };
966
969
 
967
- const RendererWorker = 1;
968
-
969
970
  const rpcs = Object.create(null);
970
- const set$1 = (id, rpc) => {
971
+ const set$3 = (id, rpc) => {
971
972
  rpcs[id] = rpc;
972
973
  };
973
974
  const get$1 = id => {
974
975
  return rpcs[id];
975
976
  };
976
-
977
- const invoke = (method, ...params) => {
978
- const rpc = get$1(RendererWorker);
977
+ const RendererWorker$1 = 1;
978
+ const invoke$2 = (method, ...params) => {
979
+ const rpc = get$1(RendererWorker$1);
980
+ // @ts-ignore
979
981
  return rpc.invoke(method, ...params);
980
982
  };
981
- const invokeAndTransfer = (method, ...params) => {
982
- const rpc = get$1(RendererWorker);
983
- return rpc.invokeAndTransfer(method, ...params);
983
+ const set$2 = rpc => {
984
+ set$3(RendererWorker$1, rpc);
985
+ };
986
+ const RendererWorker = {
987
+ __proto__: null,
988
+ invoke: invoke$2,
989
+ set: set$2
984
990
  };
985
991
 
992
+ const {
993
+ set: set$1
994
+ } = RendererWorker;
995
+ const invoke = RendererWorker.invoke;
996
+ const invokeAndTransfer = RendererWorker.invoke;
997
+
986
998
  const Rpc = {
987
999
  __proto__: null,
988
1000
  invoke,
989
- invokeAndTransfer
1001
+ invokeAndTransfer,
1002
+ set: set$1
990
1003
  };
991
1004
 
992
1005
  const printError = error => {
@@ -1097,6 +1110,8 @@ const getLocatorRpc = locator => {
1097
1110
  };
1098
1111
 
1099
1112
  const locatorInvoke = (locator, method, ...params) => {
1113
+ object(locator);
1114
+ string$1(method);
1100
1115
  const {
1101
1116
  invoke
1102
1117
  } = getLocatorRpc(locator);
@@ -1126,7 +1141,7 @@ const toHaveText = async (locator, options) => {
1126
1141
  const {
1127
1142
  wasFound,
1128
1143
  actual
1129
- } = await locatorInvoke(locator, 'TestFrameWork.conditionToHaveAttribute', locator, options);
1144
+ } = await locatorInvoke(locator, 'TestFrameWork.checkConditionError', 'toHaveText', locator, options);
1130
1145
  const {
1131
1146
  text
1132
1147
  } = options;
@@ -1140,7 +1155,7 @@ const toHaveAttribute = async (locator, options) => {
1140
1155
  const {
1141
1156
  wasFound,
1142
1157
  actual
1143
- } = await locatorInvoke(locator, 'TestFrameWork.conditionToHaveAttribute', locator, options);
1158
+ } = await locatorInvoke(locator, 'TestFrameWork.checkConditionError', 'toHaveAttribute', locator, options);
1144
1159
  const {
1145
1160
  key,
1146
1161
  value
@@ -1156,21 +1171,21 @@ const toHaveCount = async (locator, {
1156
1171
  const locatorString = printLocator(locator);
1157
1172
  const {
1158
1173
  actual
1159
- } = await locatorInvoke(locator, 'TestFrameWork.conditionToHaveCount', locator);
1174
+ } = await locatorInvoke(locator, 'TestFrameWork.checkConditionError', 'toHaveCount', locator);
1160
1175
  return `expected ${locatorString} to have count ${count} but was ${actual}`;
1161
1176
  };
1162
1177
  const toBeFocused = async locator => {
1163
1178
  const locatorString = printLocator(locator);
1164
1179
  const {
1165
1180
  actual
1166
- } = await locatorInvoke(locator, 'TestFrameWork.conditionToBeFocused', locator);
1181
+ } = await locatorInvoke(locator, 'TestFrameWork.checkConditionError', 'toBeFocused', locator);
1167
1182
  return `expected ${locatorString} to be focused but active element is ${actual}`;
1168
1183
  };
1169
1184
  const toHaveClass = async (locator, options) => {
1170
1185
  const locatorString = printLocator(locator);
1171
1186
  const {
1172
1187
  wasFound
1173
- } = await locatorInvoke(locator, 'TestFrameWork.conditionToHaveCss', locator, options);
1188
+ } = await locatorInvoke(locator, 'TestFrameWork.checkConditionError', 'toHaveClass', locator, options);
1174
1189
  const {
1175
1190
  className
1176
1191
  } = options;
@@ -1183,7 +1198,7 @@ const toHaveId = async (locator, options) => {
1183
1198
  const {
1184
1199
  wasFound,
1185
1200
  actual
1186
- } = await locatorInvoke(locator, 'TestFrameWork.conditionToHaveId', locator, options);
1201
+ } = await locatorInvoke(locator, 'TestFrameWork.checkConditionError', 'toHaveId', locator, options);
1187
1202
  const locatorString = printLocator(locator);
1188
1203
  const {
1189
1204
  id
@@ -1201,7 +1216,7 @@ const toHaveCss = async (locator, options) => {
1201
1216
  const {
1202
1217
  wasFound,
1203
1218
  actual
1204
- } = await locatorInvoke(locator, 'TestFrameWork.conditionToHaveCss', locator, options);
1219
+ } = await locatorInvoke(locator, 'TestFrameWork.checkConditionError', 'toHaveCss', locator, options);
1205
1220
  const locatorString = printLocator(locator);
1206
1221
  const {
1207
1222
  key,
@@ -1255,7 +1270,7 @@ const expect$1 = locator => {
1255
1270
  return {
1256
1271
  async checkSingleElementCondition(fnName, options) {
1257
1272
  // TODO add rpcId property to locator instead
1258
- const result = await locatorInvoke('TestFrameWork.checkSingleElementCondition', locator, fnName, options);
1273
+ const result = await locatorInvoke(locator, 'TestFrameWork.checkSingleElementCondition', locator, fnName, options);
1259
1274
  if (result && result.error) {
1260
1275
  const fn = getFunction(fnName);
1261
1276
  const errorInfo = await fn(locator, options);
@@ -1263,7 +1278,7 @@ const expect$1 = locator => {
1263
1278
  }
1264
1279
  },
1265
1280
  async checkMultiElementCondition(fnName, options) {
1266
- const result = await locatorInvoke('TestFrameWork.checkMultiElementCondition', locator, fnName, options);
1281
+ const result = await locatorInvoke(locator, 'TestFrameWork.checkMultiElementCondition', locator, fnName, options);
1267
1282
  if (result && result.error) {
1268
1283
  const fn = getFunction(fnName);
1269
1284
  const errorInfo = await fn(locator, options);
@@ -1868,7 +1883,7 @@ const TestFrameWorkComponentEditor = {
1868
1883
  type
1869
1884
  };
1870
1885
 
1871
- const selectIndex$3 = async index => {
1886
+ const selectIndex$4 = async index => {
1872
1887
  await invoke('EditorCompletion.selectIndex', index);
1873
1888
  };
1874
1889
  const selectCurrentIndex$1 = async () => {
@@ -1878,7 +1893,7 @@ const selectCurrentIndex$1 = async () => {
1878
1893
  const TestFrameWorkComponentEditorCompletion = {
1879
1894
  __proto__: null,
1880
1895
  selectCurrentIndex: selectCurrentIndex$1,
1881
- selectIndex: selectIndex$3
1896
+ selectIndex: selectIndex$4
1882
1897
  };
1883
1898
 
1884
1899
  const openContextMenu = async index => {
@@ -2121,7 +2136,7 @@ const TestFrameWorkComponentIconTheme = {
2121
2136
  setIconTheme
2122
2137
  };
2123
2138
 
2124
- const selectIndex$2 = async index => {
2139
+ const selectIndex$3 = async index => {
2125
2140
  return invoke('IframeInspector.selectIndex', index);
2126
2141
  };
2127
2142
  const focusNext$5 = async () => {
@@ -2143,7 +2158,7 @@ const TestFrameWorkComponentIframeInspector = {
2143
2158
  focusLast: focusLast$4,
2144
2159
  focusNext: focusNext$5,
2145
2160
  focusPrevious: focusPrevious$5,
2146
- selectIndex: selectIndex$2
2161
+ selectIndex: selectIndex$3
2147
2162
  };
2148
2163
 
2149
2164
  const open$3 = async () => {
@@ -2431,7 +2446,7 @@ const focusPrevious$2 = async () => {
2431
2446
  const selectItem = async label => {
2432
2447
  await invoke('QuickPick.selectItem', label);
2433
2448
  };
2434
- const selectIndex$1 = async index => {
2449
+ const selectIndex$2 = async index => {
2435
2450
  await invoke('QuickPick.selectIndex', index);
2436
2451
  };
2437
2452
  const selectCurrentIndex = async () => {
@@ -2455,7 +2470,7 @@ const TestFrameWorkComponentQuickPick = {
2455
2470
  handleInput: handleInput$1,
2456
2471
  open: open$1,
2457
2472
  selectCurrentIndex,
2458
- selectIndex: selectIndex$1,
2473
+ selectIndex: selectIndex$2,
2459
2474
  selectItem,
2460
2475
  setValue: setValue$1
2461
2476
  };
@@ -2495,7 +2510,7 @@ const focusFirst$1 = async () => {
2495
2510
  const focusIndex$1 = async index => {
2496
2511
  await invoke('Search.focusIndex', index);
2497
2512
  };
2498
- const selectIndex = async index => {
2513
+ const selectIndex$1 = async index => {
2499
2514
  await invoke('Search.selectIndex', index);
2500
2515
  };
2501
2516
  const focusNext$1 = async () => {
@@ -2546,7 +2561,7 @@ const TestFrameWorkComponentSearch = {
2546
2561
  handleWheel,
2547
2562
  openDetails,
2548
2563
  replaceAll,
2549
- selectIndex,
2564
+ selectIndex: selectIndex$1,
2550
2565
  setExcludeValue,
2551
2566
  setIncludeValue,
2552
2567
  setReplaceValue,
@@ -2581,17 +2596,25 @@ const TestFrameWorkComponentSideBar = {
2581
2596
  open
2582
2597
  };
2583
2598
 
2599
+ const selectIndex = async index => {
2600
+ await invoke('Source Control.selectIndex');
2601
+ };
2584
2602
  const acceptInput = async () => {
2585
2603
  await invoke('Source Control.acceptInput');
2586
2604
  };
2587
2605
  const handleInput = async text => {
2588
2606
  await invoke('Source Control.handleInput', text);
2589
2607
  };
2608
+ const handleClickSourceControlButtons = async (index, name) => {
2609
+ await invoke('Source Control.handleClickSourceControlButtons', index, name);
2610
+ };
2590
2611
 
2591
2612
  const TestFrameWorkComponentSourceControl = {
2592
2613
  __proto__: null,
2593
2614
  acceptInput,
2594
- handleInput
2615
+ handleClickSourceControlButtons,
2616
+ handleInput,
2617
+ selectIndex
2595
2618
  };
2596
2619
 
2597
2620
  const update = async () => {
@@ -2832,7 +2855,7 @@ const listen = async () => {
2832
2855
  const rpc = await WebWorkerRpcClient.create({
2833
2856
  commandMap: commandMap
2834
2857
  });
2835
- set$1(RendererWorker, rpc);
2858
+ set$1(rpc);
2836
2859
  };
2837
2860
 
2838
2861
  const main = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/test-worker",
3
- "version": "4.15.0",
3
+ "version": "4.17.0",
4
4
  "description": "Test Worker",
5
5
  "repository": {
6
6
  "type": "git",