@lvce-editor/test-worker 4.32.0 → 4.34.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
@@ -187,11 +187,14 @@ declare const focusFirst$4: () => Promise<void>;
187
187
  declare const focusNext$6: () => Promise<void>;
188
188
  declare const focusPrevious$4: () => Promise<void>;
189
189
  declare const focusLast$4: () => Promise<void>;
190
+ declare const show$1: () => Promise<void>;
191
+ declare const handleFilterInput: (text: string) => Promise<void>;
192
+ declare const selectChannel: (channelId: string) => Promise<void>;
190
193
  declare const open$2: (id: string) => Promise<void>;
191
194
  declare const getNodePath: () => Promise<string>;
192
195
  declare const isFirefox: () => boolean;
193
- declare const show$1: () => Promise<void>;
194
- declare const handleFilterInput: (text: string) => Promise<void>;
196
+ declare const show$2: () => Promise<void>;
197
+ declare const handleFilterInput$1: (text: string) => Promise<void>;
195
198
  declare const copyMessage: () => Promise<void>;
196
199
  declare const focusIndex$1: (index: number) => Promise<void>;
197
200
  declare const handleArrowLeft$1: () => Promise<void>;
@@ -245,13 +248,16 @@ declare const togglePreserveCase: () => Promise<void>;
245
248
  declare const toggleUseRegularExpression: () => Promise<void>;
246
249
  declare const toggleReplace: () => Promise<void>;
247
250
  declare const update: (settings: any) => Promise<void>;
248
- declare const show$2: () => Promise<void>;
251
+ declare const show$3: () => Promise<void>;
249
252
  declare const handleInput$2: (searchValue: string) => Promise<void>;
253
+ declare const usePreviousSearchValue: () => Promise<void>;
254
+ declare const useNextSearchValue: () => Promise<void>;
250
255
  declare const clear: (searchValue: string) => Promise<void>;
251
256
  declare const selectTab$1: (tabId: string) => Promise<void>;
252
257
  declare const selectWorkspace: () => Promise<void>;
253
258
  declare const selectTextEditor: () => Promise<void>;
254
259
  declare const selectExtensions: () => Promise<void>;
260
+ declare const handleScroll$1: (scrollTop: number) => Promise<void>;
255
261
  declare const open$4: (id: string) => Promise<void>;
256
262
  declare const hide: () => Promise<void>;
257
263
  declare const selectIndex$5: (index: number) => Promise<void>;
@@ -342,6 +348,9 @@ declare namespace KeyBoard {
342
348
  declare namespace Main {
343
349
  export { closeActiveEditor, closeAllEditors, closeOthers, closeTabsLeft, closeTabsRight, focusFirst$4 as focusFirst, focusLast$4 as focusLast, focusNext$6 as focusNext, focusPrevious$4 as focusPrevious, openKeyBindings, openUri, splitRight };
344
350
  }
351
+ declare namespace Output {
352
+ export { handleFilterInput, selectChannel, show$1 as show };
353
+ }
345
354
  declare namespace Panel {
346
355
  export { open$2 as open };
347
356
  }
@@ -349,7 +358,7 @@ declare namespace Platform {
349
358
  export { getNodePath, isFirefox };
350
359
  }
351
360
  declare namespace Problems {
352
- export { copyMessage, focusIndex$1 as focusIndex, handleArrowLeft$1 as handleArrowLeft, handleArrowRight, handleClickAt$1 as handleClickAt, handleFilterInput, handleIconThemeChange, show$1 as show, viewAsList, viewAsTable };
361
+ export { copyMessage, focusIndex$1 as focusIndex, handleArrowLeft$1 as handleArrowLeft, handleArrowRight, handleClickAt$1 as handleClickAt, handleFilterInput$1 as handleFilterInput, handleIconThemeChange, show$2 as show, viewAsList, viewAsTable };
353
362
  }
354
363
  declare namespace QuickPick {
355
364
  export { executeCommand, focusFirst$5 as focusFirst, focusIndex$2 as focusIndex, focusLast$5 as focusLast, focusNext$7 as focusNext, focusPrevious$5 as focusPrevious, handleClickAt$2 as handleClickAt, handleInput$1 as handleInput, open$3 as open, selectCurrentIndex$1 as selectCurrentIndex, selectIndex$2 as selectIndex, selectItem$1 as selectItem, setValue$1 as setValue };
@@ -364,7 +373,7 @@ declare namespace Settings {
364
373
  export { update };
365
374
  }
366
375
  declare namespace SettingsView {
367
- export { clear, handleInput$2 as handleInput, selectExtensions, selectTab$1 as selectTab, selectTextEditor, selectWorkspace, show$2 as show };
376
+ export { clear, handleInput$2 as handleInput, handleScroll$1 as handleScroll, selectExtensions, selectTab$1 as selectTab, selectTextEditor, selectWorkspace, show$3 as show, useNextSearchValue, usePreviousSearchValue };
368
377
  }
369
378
  declare namespace SideBar {
370
379
  export { hide, open$4 as open };
@@ -405,6 +414,7 @@ export interface TestApi {
405
414
  readonly KeyBindingsEditor: typeof KeyBindingsEditor,
406
415
  readonly KeyBoard: typeof KeyBoard,
407
416
  readonly Main: typeof Main,
417
+ readonly Output: typeof Output,
408
418
  readonly Panel: typeof Panel,
409
419
  readonly Platform: typeof Platform,
410
420
  readonly Problems: typeof Problems,
@@ -620,7 +620,8 @@ const splitLines = lines => {
620
620
  return lines.split(NewLine);
621
621
  };
622
622
  const getCurrentStack = () => {
623
- const currentStack = joinLines(splitLines(new Error().stack || '').slice(2));
623
+ const stackLinesToSkip = 3;
624
+ const currentStack = joinLines(splitLines(new Error().stack || '').slice(stackLinesToSkip));
624
625
  return currentStack;
625
626
  };
626
627
  const getNewLineIndex = (string, startIndex = undefined) => {
@@ -891,6 +892,12 @@ const invokeAndTransfer$1 = (ipc, method, ...params) => {
891
892
  return invokeHelper(ipc, method, params, true);
892
893
  };
893
894
 
895
+ class CommandNotFoundError extends Error {
896
+ constructor(command) {
897
+ super(`Command not found ${command}`);
898
+ this.name = 'CommandNotFoundError';
899
+ }
900
+ }
894
901
  const commands = Object.create(null);
895
902
  const register = commandMap => {
896
903
  Object.assign(commands, commandMap);
@@ -901,7 +908,7 @@ const getCommand = key => {
901
908
  const execute$2 = (command, ...args) => {
902
909
  const fn = getCommand(command);
903
910
  if (!fn) {
904
- throw new Error(`command not found ${command}`);
911
+ throw new CommandNotFoundError(command);
905
912
  }
906
913
  return fn(...args);
907
914
  };
@@ -958,7 +965,7 @@ const listen$1 = async (module, options) => {
958
965
  const ipc = module.wrap(rawIpc);
959
966
  return ipc;
960
967
  };
961
- const create$d = async ({
968
+ const create$e = async ({
962
969
  commandMap,
963
970
  messagePort,
964
971
  isMessagePortOpen
@@ -976,7 +983,7 @@ const create$d = async ({
976
983
  };
977
984
  const MessagePortRpcParent = {
978
985
  __proto__: null,
979
- create: create$d
986
+ create: create$e
980
987
  };
981
988
  const create$2 = async ({
982
989
  commandMap
@@ -1060,13 +1067,6 @@ const {
1060
1067
  invokeAndTransfer
1061
1068
  } = RendererWorker;
1062
1069
 
1063
- const Rpc = {
1064
- __proto__: null,
1065
- invoke,
1066
- invokeAndTransfer,
1067
- set: set$1
1068
- };
1069
-
1070
1070
  const stringifyError = error => {
1071
1071
  if (!error) {
1072
1072
  return `${error}`;
@@ -1161,19 +1161,18 @@ const get = id => {
1161
1161
  return webViews[id];
1162
1162
  };
1163
1163
 
1164
- const getLocatorRpc = locator => {
1164
+ const getLocatorInvoke = locator => {
1165
1165
  if (locator.webViewId) {
1166
- return get(locator.webViewId);
1166
+ const module = get(locator.webViewId);
1167
+ return module.invoke;
1167
1168
  }
1168
- return Rpc;
1169
+ return invoke;
1169
1170
  };
1170
1171
 
1171
1172
  const locatorInvoke = (locator, method, ...params) => {
1172
1173
  object(locator);
1173
1174
  string$1(method);
1174
- const {
1175
- invoke
1176
- } = getLocatorRpc(locator);
1175
+ const invoke = getLocatorInvoke(locator);
1177
1176
  return invoke(method, ...params);
1178
1177
  };
1179
1178
 
@@ -1286,6 +1285,21 @@ const toHaveCss = async (locator, options) => {
1286
1285
  }
1287
1286
  return `expected ${locatorString} to have css ${key} ${value} but was ${actual}`;
1288
1287
  };
1288
+ const toHaveJSProperty = async (locator, options) => {
1289
+ const {
1290
+ wasFound,
1291
+ actual
1292
+ } = await locatorInvoke(locator, 'TestFrameWork.checkConditionError', 'toHaveJSProperty', locator, options);
1293
+ const locatorString = printLocator(locator);
1294
+ const {
1295
+ key,
1296
+ value
1297
+ } = options;
1298
+ if (!wasFound) {
1299
+ return `expected ${locatorString} to have js property ${key} ${value} but element was not found`;
1300
+ }
1301
+ return `expected ${locatorString} to have js property ${key} ${value} but was ${actual}`;
1302
+ };
1289
1303
 
1290
1304
  const getFunction = fnName => {
1291
1305
  switch (fnName) {
@@ -1309,6 +1323,8 @@ const getFunction = fnName => {
1309
1323
  return toHaveCss;
1310
1324
  case 'toHaveClass':
1311
1325
  return toHaveClass;
1326
+ case 'toHaveJSProperty':
1327
+ return toHaveJSProperty;
1312
1328
  default:
1313
1329
  throw new Error(`unexpected function name ${fnName}`);
1314
1330
  }
@@ -1486,8 +1502,8 @@ const Locator = function (selector, {
1486
1502
  this._hasText = hasText;
1487
1503
  };
1488
1504
  const performAction = async (locator, action, options) => {
1489
- const rpc = getLocatorRpc(locator);
1490
- return rpc.invoke('TestFrameWork.performAction', locator, action, options);
1505
+ const invoke = getLocatorInvoke(locator);
1506
+ return invoke('TestFrameWork.performAction', locator, action, options);
1491
1507
  };
1492
1508
  Locator.prototype.click = async function ({
1493
1509
  button = 'left'
@@ -1562,7 +1578,7 @@ const TestFrameWork = {
1562
1578
  test
1563
1579
  };
1564
1580
 
1565
- const show$2 = async () => {
1581
+ const show$3 = async () => {
1566
1582
  return invoke('About.showAbout');
1567
1583
  };
1568
1584
  const handleClickOk = async () => {
@@ -1588,7 +1604,7 @@ const TestFrameWorkComponentAbout = {
1588
1604
  handleClickClose,
1589
1605
  handleClickCopy,
1590
1606
  handleClickOk,
1591
- show: show$2
1607
+ show: show$3
1592
1608
  };
1593
1609
 
1594
1610
  const focus$2 = async () => {
@@ -2215,14 +2231,14 @@ const openJsonValidation = async () => {
2215
2231
  const openSettings = async () => {
2216
2232
  await openFeature('Settings');
2217
2233
  };
2218
- const handleScroll = async scrollTop => {
2234
+ const handleScroll$1 = async scrollTop => {
2219
2235
  // @ts-ignore
2220
2236
  return invoke('ExtensionDetail.handleScroll', scrollTop);
2221
2237
  };
2222
2238
 
2223
2239
  const TestFrameWorkComponentExtensionDetail = {
2224
2240
  __proto__: null,
2225
- handleScroll,
2241
+ handleScroll: handleScroll$1,
2226
2242
  open: open$4,
2227
2243
  openCommands,
2228
2244
  openFeature,
@@ -2557,6 +2573,26 @@ const TestFrameWorkComponentMain = {
2557
2573
  splitRight
2558
2574
  };
2559
2575
 
2576
+ const show$2 = async () => {
2577
+ // @ts-ignore
2578
+ await invoke('Panel.selectIndex', 1);
2579
+ };
2580
+ const handleFilterInput$1 = async text => {
2581
+ // @ts-ignore
2582
+ await invoke('Output.handleFilterInput', text);
2583
+ };
2584
+ const selectChannel = async channelId => {
2585
+ // @ts-ignore
2586
+ await invoke('Output.selectChannel', channelId);
2587
+ };
2588
+
2589
+ const TestFrameWorkComponentOutput = {
2590
+ __proto__: null,
2591
+ handleFilterInput: handleFilterInput$1,
2592
+ selectChannel,
2593
+ show: show$2
2594
+ };
2595
+
2560
2596
  const open$2 = async id => {
2561
2597
  await invoke('Layout.showPanel', id);
2562
2598
  };
@@ -2899,6 +2935,14 @@ const handleInput$1 = async searchValue => {
2899
2935
  // @ts-ignore
2900
2936
  return invoke('Settings.handleInput', searchValue, Script);
2901
2937
  };
2938
+ const usePreviousSearchValue = async () => {
2939
+ // @ts-ignore
2940
+ return invoke('Settings.usePreviousSearchValue');
2941
+ };
2942
+ const useNextSearchValue = async () => {
2943
+ // @ts-ignore
2944
+ return invoke('Settings.useNextSearchValue');
2945
+ };
2902
2946
  const clear = async searchValue => {
2903
2947
  // @ts-ignore
2904
2948
  return invoke('Settings.clear', searchValue, Script);
@@ -2916,16 +2960,23 @@ const selectTextEditor = async () => {
2916
2960
  const selectExtensions = async () => {
2917
2961
  await selectTab('extensions');
2918
2962
  };
2963
+ const handleScroll = async scrollTop => {
2964
+ // @ts-ignore
2965
+ await invoke('Settings.handleScroll', scrollTop, Script);
2966
+ };
2919
2967
 
2920
2968
  const TestFrameWorkComponentSettingsView = {
2921
2969
  __proto__: null,
2922
2970
  clear,
2923
2971
  handleInput: handleInput$1,
2972
+ handleScroll,
2924
2973
  selectExtensions,
2925
2974
  selectTab,
2926
2975
  selectTextEditor,
2927
2976
  selectWorkspace,
2928
- show
2977
+ show,
2978
+ useNextSearchValue,
2979
+ usePreviousSearchValue
2929
2980
  };
2930
2981
 
2931
2982
  const open = async id => {
@@ -3167,6 +3218,7 @@ const TestFrameWorkComponent = {
3167
3218
  KeyBindingsEditor: TestFrameWorkComponentKeyBindingsEditor,
3168
3219
  KeyBoard: TestFrameWorkComponentKeyBoard,
3169
3220
  Main: TestFrameWorkComponentMain,
3221
+ Output: TestFrameWorkComponentOutput,
3170
3222
  Panel: TestFrameWorkComponentPanel,
3171
3223
  Platform: TestFrameWorkComponentPlatform,
3172
3224
  Problems: TestFrameWorkComponentProblems,
@@ -3184,6 +3236,10 @@ const TestFrameWorkComponent = {
3184
3236
  Workspace: TestFrameWorkComponentWorkspace
3185
3237
  };
3186
3238
 
3239
+ // TODO move this into three steps:
3240
+ // 1. import test module
3241
+ // 2. execute test
3242
+ // 3. print out results
3187
3243
  const execute = async href => {
3188
3244
  const globals = {
3189
3245
  ...TestFrameWorkComponent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/test-worker",
3
- "version": "4.32.0",
3
+ "version": "4.34.0",
4
4
  "description": "Test Worker",
5
5
  "repository": {
6
6
  "type": "git",