@lvce-editor/test-worker 1.1.0 → 1.3.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/testWorkerMain.js +40 -6
- package/package.json +1 -4
package/dist/testWorkerMain.js
CHANGED
|
@@ -345,6 +345,12 @@ const listen$4 = ipc => {
|
|
|
345
345
|
set$1(ipc);
|
|
346
346
|
};
|
|
347
347
|
|
|
348
|
+
const Rpc = {
|
|
349
|
+
__proto__: null,
|
|
350
|
+
invoke,
|
|
351
|
+
listen: listen$4
|
|
352
|
+
};
|
|
353
|
+
|
|
348
354
|
const Fail = 'fail';
|
|
349
355
|
const Pass = 'pass';
|
|
350
356
|
|
|
@@ -504,9 +510,13 @@ const Assert = {
|
|
|
504
510
|
}
|
|
505
511
|
};
|
|
506
512
|
const expect$1 = locator => {
|
|
513
|
+
const {
|
|
514
|
+
invoke
|
|
515
|
+
} = locator.webView || Rpc;
|
|
507
516
|
return {
|
|
508
517
|
async checkSingleElementCondition(fnName, options) {
|
|
509
518
|
Assert.string(fnName);
|
|
519
|
+
// TODO add rpcId property to locator instead
|
|
510
520
|
return invoke('TestFrameWork.checkSingleElementCondition', locator, fnName, options);
|
|
511
521
|
},
|
|
512
522
|
async checkMultiElementCondition(fnName, options) {
|
|
@@ -587,9 +597,6 @@ class AssertionError extends Error {
|
|
|
587
597
|
this.name = 'AssertionError';
|
|
588
598
|
}
|
|
589
599
|
}
|
|
590
|
-
|
|
591
|
-
// TODO treeshake out this whole module in production
|
|
592
|
-
|
|
593
600
|
const getType = value => {
|
|
594
601
|
switch (typeof value) {
|
|
595
602
|
case 'number':
|
|
@@ -605,9 +612,6 @@ const getType = value => {
|
|
|
605
612
|
if (Array.isArray(value)) {
|
|
606
613
|
return 'array';
|
|
607
614
|
}
|
|
608
|
-
if (value instanceof Uint32Array) {
|
|
609
|
-
return 'uint32array';
|
|
610
|
-
}
|
|
611
615
|
return 'object';
|
|
612
616
|
case 'boolean':
|
|
613
617
|
return 'boolean';
|
|
@@ -668,6 +672,9 @@ const Locator = function (selector, {
|
|
|
668
672
|
this._hasText = hasText;
|
|
669
673
|
};
|
|
670
674
|
const performAction = async (locator, fnName, options) => {
|
|
675
|
+
const {
|
|
676
|
+
invoke
|
|
677
|
+
} = locator.webView || Rpc;
|
|
671
678
|
return invoke('TestFrameWork.performAction', locator, fnName, options);
|
|
672
679
|
};
|
|
673
680
|
const toButtonNumber = buttonType => {
|
|
@@ -1398,6 +1405,32 @@ const TestFrameWorkComponentTitleBarMenuBar = {
|
|
|
1398
1405
|
toggleMenu
|
|
1399
1406
|
};
|
|
1400
1407
|
|
|
1408
|
+
const fromId = async webViewId => {
|
|
1409
|
+
// TODO
|
|
1410
|
+
// 1. create messagechannel
|
|
1411
|
+
// 2. send one message port to webview
|
|
1412
|
+
// 3. setup rpc connection and wait for webview to be ready
|
|
1413
|
+
// 4. send test commands like locator.toBeVisible to webview
|
|
1414
|
+
const webViewRpc = {
|
|
1415
|
+
invoke(method, ...params) {
|
|
1416
|
+
console.log('invoke called', method, params);
|
|
1417
|
+
}
|
|
1418
|
+
};
|
|
1419
|
+
return {
|
|
1420
|
+
locator(selector, options) {
|
|
1421
|
+
const baseLocator = create(selector, options);
|
|
1422
|
+
baseLocator.webView = webViewRpc;
|
|
1423
|
+
return baseLocator;
|
|
1424
|
+
},
|
|
1425
|
+
expect: expect$1
|
|
1426
|
+
};
|
|
1427
|
+
};
|
|
1428
|
+
|
|
1429
|
+
const TestFrameWorkComponentWebView = {
|
|
1430
|
+
__proto__: null,
|
|
1431
|
+
fromId
|
|
1432
|
+
};
|
|
1433
|
+
|
|
1401
1434
|
const setPath = async path => {
|
|
1402
1435
|
await invoke('Workspace.setPath', path);
|
|
1403
1436
|
};
|
|
@@ -1431,6 +1464,7 @@ const TestFrameWorkComponent = {
|
|
|
1431
1464
|
SourceControl: TestFrameWorkComponentSourceControl,
|
|
1432
1465
|
StatusBar: TestFrameWorkComponentStatusBar,
|
|
1433
1466
|
TitleBarMenuBar: TestFrameWorkComponentTitleBarMenuBar,
|
|
1467
|
+
WebView: TestFrameWorkComponentWebView,
|
|
1434
1468
|
Workspace: TestFrameWorkComponentWorkspace
|
|
1435
1469
|
};
|
|
1436
1470
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/test-worker",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/testWorkerMain.js",
|
|
6
6
|
"type": "module",
|
|
@@ -66,8 +66,5 @@
|
|
|
66
66
|
"ignores": [
|
|
67
67
|
"distmin"
|
|
68
68
|
]
|
|
69
|
-
},
|
|
70
|
-
"dependencies": {
|
|
71
|
-
"@lvce-editor/assert": "^1.2.0"
|
|
72
69
|
}
|
|
73
70
|
}
|