@lvce-editor/test-worker 4.43.0 → 5.0.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
@@ -19,6 +19,7 @@ declare const readNativeFiles: () => Promise<void>;
19
19
  declare const writeNativeFiles: (uris: readonly string[]) => Promise<void>;
20
20
  declare const enableMemoryClipBoard: () => Promise<void>;
21
21
  declare const disableMemoryClipBoard: () => Promise<void>;
22
+ declare const shouldHaveText: (expectedText: string) => Promise<void>;
22
23
  declare const execute: (id: string, ...args: readonly any[]) => Promise<any>;
23
24
  declare const selectItem: (text: string) => Promise<void>;
24
25
  declare const openIframeInspector: () => Promise<void>;
@@ -87,7 +88,7 @@ declare const openRename: () => Promise<void>;
87
88
  declare const rename2: (newName: string) => Promise<void>;
88
89
  declare const growSelection: () => Promise<void>;
89
90
  declare const getSelections: () => Promise<Uint32Array>;
90
- declare const shouldHaveText: (expectedText: string) => Promise<void>;
91
+ declare const shouldHaveText$1: (expectedText: string) => Promise<void>;
91
92
  declare const shouldHaveSelections: (expectedSelections: Uint32Array) => Promise<void>;
92
93
  declare const selectIndex: (index: number) => Promise<void>;
93
94
  declare const selectCurrentIndex: () => Promise<void>;
@@ -130,6 +131,10 @@ declare const selectIndices: (indices: readonly number[]) => Promise<void>;
130
131
  declare const toggleIndividualSelection: (index: number) => Promise<void>;
131
132
  declare const addWebExtension: (relativePath: string) => Promise<void>;
132
133
  declare const addNodeExtension: (relativePath: string) => Promise<void>;
134
+ declare const handleClickCategory: (categoryId: string) => Promise<void>;
135
+ declare const handleClickEnable: () => Promise<void>;
136
+ declare const handleClickDisable: () => Promise<void>;
137
+ declare const handleClickSetColorTheme: () => Promise<void>;
133
138
  declare const selectFeature: (name: string) => Promise<void>;
134
139
  declare const selectTab: (name: string) => Promise<void>;
135
140
  declare const selectDetails: () => Promise<void>;
@@ -315,7 +320,7 @@ declare namespace BaseUrl {
315
320
  export { getBaseUrl };
316
321
  }
317
322
  declare namespace ClipBoard {
318
- export { disableMemoryClipBoard, enableMemoryClipBoard, readNativeFiles, writeNativeFiles };
323
+ export { disableMemoryClipBoard, enableMemoryClipBoard, readNativeFiles, shouldHaveText, writeNativeFiles };
319
324
  }
320
325
  declare namespace Command {
321
326
  export { execute };
@@ -330,7 +335,7 @@ declare namespace Dialog {
330
335
  export { executeMock, mockSaveFilePicker, showSaveFilePicker };
331
336
  }
332
337
  declare namespace Editor {
333
- export { addAllMissingImports, closeColorPicker, closeCompletion, closeCompletionDetails, copy, copyLineDown, copyLineUp, cursorCharacterLeft, cursorCharacterRight, cursorDown, cursorEnd, cursorHome, cursorUp, cursorWordLeft, cursorWordPartLeft, cursorWordPartRight, cursorWordRight, deleteAllLeft, deleteAllRight, executeTabCompletion, findAllImplementations, findAllReferences, format, getSelections, getText, goToDefinition, goToTypeDefinition, growSelection, insertLineBreak, invokeBraceCompletion, invokeTabCompletion, openColorPicker, openCompletion, openCompletionDetails, openContextMenu, openEditorContextMenu, openFind, openFindWidget, openHover, openRename, openSourceActions, organizeImports, rename, rename2, selectAll, setCursor, setDeltaY, setSelections, shouldHaveSelections, shouldHaveText, showHover, sortImports, sourceActionsSelectCurrent, toggleBlockComment, toggleCompletionDetails, toggleLineComment, type };
338
+ export { addAllMissingImports, closeColorPicker, closeCompletion, closeCompletionDetails, copy, copyLineDown, copyLineUp, cursorCharacterLeft, cursorCharacterRight, cursorDown, cursorEnd, cursorHome, cursorUp, cursorWordLeft, cursorWordPartLeft, cursorWordPartRight, cursorWordRight, deleteAllLeft, deleteAllRight, executeTabCompletion, findAllImplementations, findAllReferences, format, getSelections, getText, goToDefinition, goToTypeDefinition, growSelection, insertLineBreak, invokeBraceCompletion, invokeTabCompletion, openColorPicker, openCompletion, openCompletionDetails, openContextMenu, openEditorContextMenu, openFind, openFindWidget, openHover, openRename, openSourceActions, organizeImports, rename, rename2, selectAll, setCursor, setDeltaY, setSelections, shouldHaveSelections, shouldHaveText$1 as shouldHaveText, showHover, sortImports, sourceActionsSelectCurrent, toggleBlockComment, toggleCompletionDetails, toggleLineComment, type };
334
339
  }
335
340
  declare namespace EditorCompletion {
336
341
  export { selectCurrentIndex, selectIndex };
@@ -345,7 +350,7 @@ declare namespace Extension {
345
350
  export { addNodeExtension, addWebExtension };
346
351
  }
347
352
  declare namespace ExtensionDetail {
348
- export { handleScroll, open, openCommands, openFeature, openJsonValidation, openRuntimeStatus, openSettings, openThemes, openWebViews, selectChangelog, selectDetails, selectFeature, selectFeatures, selectTab };
353
+ export { handleClickCategory, handleClickDisable, handleClickEnable, handleClickSetColorTheme, handleScroll, open, openCommands, openFeature, openJsonValidation, openRuntimeStatus, openSettings, openThemes, openWebViews, selectChangelog, selectDetails, selectFeature, selectFeatures, selectTab };
349
354
  }
350
355
  declare namespace FileSystem {
351
356
  export { chmod, createExecutable, createExecutableFrom, getTmpDir, mkdir, readFile, remove, writeFile, writeJson };
@@ -1384,6 +1384,7 @@ const number = (value, message) => {
1384
1384
 
1385
1385
  const expect$1 = locator => {
1386
1386
  return {
1387
+ negated: false,
1387
1388
  async checkSingleElementCondition(fnName, options) {
1388
1389
  // TODO add rpcId property to locator instead
1389
1390
  const result = await locatorInvoke(locator, 'TestFrameWork.checkSingleElementCondition', locator, fnName, options);
@@ -1528,70 +1529,68 @@ const toButtonNumber = buttonType => {
1528
1529
  };
1529
1530
 
1530
1531
  const create = (selector, options = {}) => {
1531
- // @ts-ignore
1532
1532
  return new Locator(selector, options);
1533
1533
  };
1534
- const Locator = function (selector, {
1535
- nth = -1,
1536
- hasText = ''
1537
- } = {}) {
1538
- // @ts-ignore
1539
- this._selector = selector;
1540
- // @ts-ignore
1541
- this._nth = nth;
1542
- // @ts-ignore
1543
- this._hasText = hasText;
1544
- };
1545
1534
  const performAction = async (locator, action, options) => {
1546
1535
  const invoke = getLocatorInvoke(locator);
1547
1536
  return invoke('TestFrameWork.performAction', locator, action, options);
1548
1537
  };
1549
- Locator.prototype.click = async function ({
1550
- button = 'left'
1551
- } = {}) {
1552
- const options = {
1553
- cancable: true,
1554
- bubbles: true,
1555
- button: toButtonNumber(button),
1556
- detail: 1
1557
- };
1558
- return performAction(this, 'click', options);
1559
- };
1560
- Locator.prototype.hover = async function () {
1561
- const options = {
1562
- cancable: true,
1563
- bubbles: true
1564
- };
1565
- return performAction(this, 'hover', options);
1566
- };
1567
- Locator.prototype.first = function () {
1568
- return create(this._selector, {
1569
- nth: 0
1570
- });
1571
- };
1572
- Locator.prototype.locator = function (subSelector) {
1573
- if (this._nth !== -1) {
1574
- return create(`${this._selector}:nth-of-type(${this._nth + 1}) ${subSelector}`);
1538
+ class Locator {
1539
+ constructor(selector, {
1540
+ nth = -1,
1541
+ hasText = ''
1542
+ } = {}) {
1543
+ this._selector = selector;
1544
+ this._nth = nth;
1545
+ this._hasText = hasText;
1546
+ }
1547
+ async click({
1548
+ button = 'left'
1549
+ } = {}) {
1550
+ const options = {
1551
+ cancable: true,
1552
+ bubbles: true,
1553
+ button: toButtonNumber(button),
1554
+ detail: 1
1555
+ };
1556
+ return performAction(this, 'click', options);
1575
1557
  }
1576
- return create(`${this._selector} ${subSelector}`);
1577
- };
1578
- Locator.prototype.nth = function (nth) {
1579
- return create(this._selector, {
1580
- nth
1581
- });
1582
- };
1583
- Locator.prototype.type = async function (text) {
1584
- const options = {
1585
- text
1586
- };
1587
- return performAction(this, 'type', options);
1588
- };
1589
- Locator.prototype.dispatchEvent = async function (type, init) {
1590
- return performAction(this, 'dispatchEvent', {
1591
- type,
1592
- init
1593
- });
1594
- };
1558
+ async hover() {
1559
+ const options = {
1560
+ cancable: true,
1561
+ bubbles: true
1562
+ };
1563
+ return performAction(this, 'hover', options);
1564
+ }
1565
+ first() {
1566
+ return create(this._selector, {
1567
+ nth: 0
1568
+ });
1569
+ }
1570
+ locator(subSelector) {
1571
+ if (this._nth !== -1) {
1572
+ return create(`${this._selector}:nth-of-type(${this._nth + 1}) ${subSelector}`);
1573
+ }
1574
+ return create(`${this._selector} ${subSelector}`);
1575
+ }
1576
+ nth(nth) {
1577
+ return create(this._selector, {
1578
+ nth
1579
+ });
1580
+ }
1581
+ async type(text) {
1582
+ const options = {
1583
+ text
1584
+ };
1585
+ return performAction(this, 'type', options);
1586
+ }
1587
+ async dispatchEvent(type, init) {
1588
+ return performAction(this, 'dispatchEvent', {
1589
+ type,
1590
+ init
1591
+ });
1592
+ }
1593
+ }
1595
1594
 
1596
1595
  const getTmpDir$1 = async () => {
1597
1596
  return 'memfs://';
@@ -1744,12 +1743,20 @@ const disableMemoryClipBoard = async () => {
1744
1743
  // @ts-ignore
1745
1744
  await invoke$1('ClipBoard.disableMemoryClipBoard');
1746
1745
  };
1746
+ const shouldHaveText$1 = async expectedText => {
1747
+ // @ts-ignore
1748
+ const actualText = await invoke$1('ClipBoard.readMemoryText');
1749
+ if (actualText !== expectedText) {
1750
+ throw new AssertionError(`expected clipboard to have text "${expectedText}" but was "${actualText}"`);
1751
+ }
1752
+ };
1747
1753
 
1748
1754
  const TestFrameworkComponentClipBoard = {
1749
1755
  __proto__: null,
1750
1756
  disableMemoryClipBoard,
1751
1757
  enableMemoryClipBoard,
1752
1758
  readNativeFiles,
1759
+ shouldHaveText: shouldHaveText$1,
1753
1760
  writeNativeFiles
1754
1761
  };
1755
1762
 
@@ -2351,6 +2358,22 @@ const TestFrameWorkComponentExtension = {
2351
2358
  addWebExtension
2352
2359
  };
2353
2360
 
2361
+ const handleClickCategory = async categoryId => {
2362
+ // @ts-ignore
2363
+ await invoke$1('ExtensionDetail.handleClickCategory', categoryId);
2364
+ };
2365
+ const handleClickEnable = async () => {
2366
+ // @ts-ignore
2367
+ await invoke$1('ExtensionDetail.handleClickEnable');
2368
+ };
2369
+ const handleClickDisable = async () => {
2370
+ // @ts-ignore
2371
+ await invoke$1('ExtensionDetail.handleClickDisable');
2372
+ };
2373
+ const handleClickSetColorTheme = async () => {
2374
+ // @ts-ignore
2375
+ await invoke$1('ExtensionDetail.handleClickSetColorTheme');
2376
+ };
2354
2377
  const selectFeature = name => {
2355
2378
  return invoke$1('ExtensionDetail.selectFeature', name);
2356
2379
  };
@@ -2399,6 +2422,10 @@ const handleScroll$1 = async scrollTop => {
2399
2422
 
2400
2423
  const TestFrameWorkComponentExtensionDetail = {
2401
2424
  __proto__: null,
2425
+ handleClickCategory,
2426
+ handleClickDisable,
2427
+ handleClickEnable,
2428
+ handleClickSetColorTheme,
2402
2429
  handleScroll: handleScroll$1,
2403
2430
  open: open$4,
2404
2431
  openCommands,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/test-worker",
3
- "version": "4.43.0",
3
+ "version": "5.0.0",
4
4
  "description": "Test Worker",
5
5
  "repository": {
6
6
  "type": "git",