askui 0.2.1 → 0.2.4
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/README.md +2 -2
- package/dist/cjs/execution/dsl.d.ts +54 -1
- package/dist/cjs/execution/dsl.js +72 -11
- package/dist/cjs/execution/execution-runtime.js +0 -1
- package/dist/cjs/execution/read-environment-credentials.js +4 -4
- package/dist/cjs/execution/read-environment-credentials.spec.js +2 -2
- package/dist/cjs/execution/ui-control-client.d.ts +1 -0
- package/dist/cjs/execution/ui-control-client.js +9 -3
- package/dist/cjs/execution/ui-controller-client-interface.d.ts +1 -1
- package/dist/cjs/lib/ui-controller-facade.js +1 -1
- package/dist/cjs/lib/ui-controller-linux.js +2 -2
- package/dist/cjs/utils/http/credentials.d.ts +1 -1
- package/dist/cjs/utils/http/credentials.js +1 -1
- package/dist/cjs/utils/http/credentials.spec.js +2 -2
- package/dist/cjs/utils/http/custom-errors/index.js +1 -1
- package/dist/esm/execution/dsl.d.ts +54 -1
- package/dist/esm/execution/dsl.js +71 -10
- package/dist/esm/execution/execution-runtime.js +0 -1
- package/dist/esm/execution/read-environment-credentials.js +4 -4
- package/dist/esm/execution/read-environment-credentials.spec.js +2 -2
- package/dist/esm/execution/ui-control-client.d.ts +1 -0
- package/dist/esm/execution/ui-control-client.js +10 -4
- package/dist/esm/execution/ui-controller-client-interface.d.ts +1 -1
- package/dist/esm/lib/ui-controller-facade.js +1 -1
- package/dist/esm/lib/ui-controller-linux.js +2 -2
- package/dist/esm/utils/http/credentials.d.ts +1 -1
- package/dist/esm/utils/http/credentials.js +1 -1
- package/dist/esm/utils/http/credentials.spec.js +2 -2
- package/dist/esm/utils/http/custom-errors/index.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -45,8 +45,8 @@ Visit our [documentation](https://docs.askui.com) for examples and a full list o
|
|
|
45
45
|
### Notes
|
|
46
46
|
|
|
47
47
|
Important note for Linux users: Currently, Wayland is not supported.
|
|
48
|
-
You can read more in our [troubleshooting chapter](https://docs.askui.com/docs/general/Troubleshooting/
|
|
49
|
-
If you want to use the askui library libfuse2 is needed ([libfuse2 installation](https://docs.askui.com/docs/general/Troubleshooting/
|
|
48
|
+
You can read more in our [troubleshooting chapter](https://docs.askui.com/docs/general/Troubleshooting/linux#wayland).
|
|
49
|
+
If you want to use the askui library libfuse2 is needed ([libfuse2 installation](https://docs.askui.com/docs/general/Troubleshooting/linux#libfuse2)).
|
|
50
50
|
|
|
51
51
|
## Example
|
|
52
52
|
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { CustomElementJson } from '../core/model/test-case-dto';
|
|
2
|
+
export declare enum Separators {
|
|
3
|
+
STRING = "<|string|>"
|
|
4
|
+
}
|
|
2
5
|
export declare type PC_KEY = 'backspace' | 'delete' | 'enter' | 'tab' | 'escape' | 'up' | 'down' | 'right' | 'left' | 'home' | 'end' | 'pageup' | 'pagedown' | 'f1' | 'f2' | 'f3' | 'f4' | 'f5' | 'f6' | 'f7' | 'f8' | 'f9' | 'f10' | 'f11' | 'f12' | 'space' | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z' | '!' | '"' | '#' | '$' | '%' | '&' | "'" | '(' | ')' | '*' | '+' | ',' | '-' | '.' | '/' | ':' | ';' | '<' | '=' | '>' | '?' | '@' | '[' | '\\' | ']' | '^' | '_' | '`' | '{' | '|' | '}' | '~ ';
|
|
3
6
|
export declare type ANDROID_KEY = 'home' | 'back' | 'call' | 'endcall' | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | 'star' | 'pound' | 'dpad_up' | 'dpad_down' | 'dpad_left' | 'dpad_right' | 'dpad_center' | 'volume_up' | 'volume_down' | 'power' | 'camera' | 'clear' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' | 'comma' | 'period' | 'alt_left' | 'alt_right' | 'shift_left' | 'shift_right' | 'tab' | 'space' | 'sym' | 'explorer' | 'envelope' | 'enter' | 'del' | 'grave' | 'minus' | 'equals' | 'left_bracket' | 'right_bracket' | 'backslash' | 'semicolon' | 'apostrophe' | 'slash' | 'at' | 'num' | 'headsethook' | 'focus' | 'plus' | 'menu' | 'notification' | 'search' | 'media_play_pause' | 'media_stop' | 'media_next' | 'media_previous' | 'media_rewind' | 'media_fast_forward' | 'mute' | 'page_up' | 'page_down' | 'switch_charset' | 'escape' | 'forward_del' | 'ctrl_left' | 'ctrl_right' | 'caps_lock' | 'scroll_lock' | 'function' | 'break' | 'move_home' | 'move_end' | 'insert' | 'forward' | 'media_play' | 'media_pause' | 'media_close' | 'media_eject' | 'media_record' | 'f1' | 'f2' | 'f3' | 'f4' | 'f5' | 'f6' | 'f7' | 'f8' | 'f9' | 'f10' | 'f11' | 'f12' | 'num_lock' | 'numpad_0' | 'numpad_1' | 'numpad_2' | 'numpad_3' | 'numpad_4' | 'numpad_5' | 'numpad_6' | 'numpad_7' | 'numpad_8' | 'numpad_9' | 'numpad_divide' | 'numpad_multiply' | 'numpad_subtract' | 'numpad_add' | 'numpad_dot' | 'numpad_comma' | 'numpad_enter' | 'numpad_equals' | 'numpad_left_paren' | 'numpad_right_paren' | 'volume_mute' | 'info' | 'channel_up' | 'channel_down' | 'zoom_in' | 'zoom_out' | 'window' | 'guide' | 'bookmark' | 'captions' | 'settings' | 'app_switch' | 'language_switch' | 'contacts' | 'calendar' | 'music' | 'calculator' | 'assist' | 'brightness_down' | 'brightness_up' | 'media_audio_track' | 'sleep' | 'wakeup' | 'pairing' | 'media_top_menu' | 'last_channel' | 'tv_data_service' | 'voice_assist' | 'help' | 'navigate_previous' | 'navigate_next' | 'navigate_in' | 'navigate_out' | 'dpad_up_left' | 'dpad_down_left' | 'dpad_up_right' | 'dpad_down_right' | 'media_skip_forward' | 'media_skip_backward' | 'media_step_forward' | 'media_step_backward' | 'soft_sleep' | 'cut' | 'copy' | 'paste' | 'all_apps' | 'refresh';
|
|
4
7
|
export declare type MODIFIER_KEY = 'command' | 'alt' | 'control' | 'shift' | 'right_shift';
|
|
@@ -426,6 +429,15 @@ export declare class FluentFilters extends FluentBase {
|
|
|
426
429
|
/**
|
|
427
430
|
* Filters for an UI element 'icon'.
|
|
428
431
|
*
|
|
432
|
+
* You can combine it with the 'withText' command to look for a specific icon.
|
|
433
|
+
*
|
|
434
|
+
* **Examples:**
|
|
435
|
+
* ```typescript
|
|
436
|
+
* icon().withText('plus')
|
|
437
|
+
* ```
|
|
438
|
+
*
|
|
439
|
+
* Note: This is an alpha feature. The prediction of the icon name is sometimes unstable. Use custom elements as an alternative.
|
|
440
|
+
*
|
|
429
441
|
* @return {FluentFiltersOrRelations}
|
|
430
442
|
*/
|
|
431
443
|
icon(): FluentFiltersOrRelations;
|
|
@@ -461,6 +473,22 @@ export declare class FluentFilters extends FluentBase {
|
|
|
461
473
|
* @return {FluentFiltersOrRelations}
|
|
462
474
|
*/
|
|
463
475
|
withText(text: string): FluentFiltersOrRelations;
|
|
476
|
+
/**
|
|
477
|
+
* Filters for texts, which match the regex pattern.
|
|
478
|
+
*
|
|
479
|
+
* **Examples:**
|
|
480
|
+
*
|
|
481
|
+
* ```typescript
|
|
482
|
+
* 'The rain in Spain' === withTextRegex('\b[Ss]\w+') => true
|
|
483
|
+
* 'The rain in Portugal' === withTextRegex('\b[Ss]\w+') => false
|
|
484
|
+
* 'The rain in switzerland' === withTextRegex('\b[Ss]\w+') => true
|
|
485
|
+
* ```
|
|
486
|
+
*
|
|
487
|
+
* @param {string} regex_pattern - An regex pattern
|
|
488
|
+
*
|
|
489
|
+
* @return {FluentFiltersOrRelations}
|
|
490
|
+
*/
|
|
491
|
+
withTextRegex(regex_pattern: string): FluentFiltersOrRelations;
|
|
464
492
|
/**
|
|
465
493
|
* Filters for equal text.
|
|
466
494
|
*
|
|
@@ -1060,6 +1088,15 @@ export declare class FluentFiltersCondition extends FluentBase {
|
|
|
1060
1088
|
/**
|
|
1061
1089
|
* Filters for an UI element 'icon'.
|
|
1062
1090
|
*
|
|
1091
|
+
* You can combine it with the 'withText' command to look for a specific icon.
|
|
1092
|
+
*
|
|
1093
|
+
* **Examples:**
|
|
1094
|
+
* ```typescript
|
|
1095
|
+
* icon().withText('plus')
|
|
1096
|
+
* ```
|
|
1097
|
+
*
|
|
1098
|
+
* Note: This is an alpha feature. The prediction of the icon name is sometimes unstable. Use custom elements as an alternative.
|
|
1099
|
+
*
|
|
1063
1100
|
* @return {FluentFiltersOrRelationsCondition}
|
|
1064
1101
|
*/
|
|
1065
1102
|
icon(): FluentFiltersOrRelationsCondition;
|
|
@@ -1095,6 +1132,22 @@ export declare class FluentFiltersCondition extends FluentBase {
|
|
|
1095
1132
|
* @return {FluentFiltersOrRelationsCondition}
|
|
1096
1133
|
*/
|
|
1097
1134
|
withText(text: string): FluentFiltersOrRelationsCondition;
|
|
1135
|
+
/**
|
|
1136
|
+
* Filters for texts, which match the regex pattern.
|
|
1137
|
+
*
|
|
1138
|
+
* **Examples:**
|
|
1139
|
+
*
|
|
1140
|
+
* ```typescript
|
|
1141
|
+
* 'The rain in Spain' === withTextRegex('\b[Ss]\w+') => true
|
|
1142
|
+
* 'The rain in Portugal' === withTextRegex('\b[Ss]\w+') => false
|
|
1143
|
+
* 'The rain in switzerland' === withTextRegex('\b[Ss]\w+') => true
|
|
1144
|
+
* ```
|
|
1145
|
+
*
|
|
1146
|
+
* @param {string} regex_pattern - An regex pattern
|
|
1147
|
+
*
|
|
1148
|
+
* @return {FluentFiltersOrRelationsCondition}
|
|
1149
|
+
*/
|
|
1150
|
+
withTextRegex(regex_pattern: string): FluentFiltersOrRelationsCondition;
|
|
1098
1151
|
/**
|
|
1099
1152
|
* Filters for equal text.
|
|
1100
1153
|
*
|
|
@@ -1331,7 +1384,7 @@ export declare abstract class FluentCommand extends FluentBase {
|
|
|
1331
1384
|
*/
|
|
1332
1385
|
typeIn(text: string): FluentFilters;
|
|
1333
1386
|
/**
|
|
1334
|
-
* Moves mouse to the filtered element and scrolls in the x and y direction
|
|
1387
|
+
* Moves mouse to the filtered element and scrolls in the x and y direction.
|
|
1335
1388
|
*
|
|
1336
1389
|
* @param {number} x_offset - A (positive/negative) x direction.
|
|
1337
1390
|
* @param {number} y_offset - A (positive/negative) y direction.
|
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
3
3
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
4
4
|
/* eslint-disable max-classes-per-file */
|
|
5
|
+
/* eslint-disable max-len */
|
|
5
6
|
// Autogenerated from typescript.template file
|
|
6
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.FluentCommand = exports.FluentFiltersOrRelationsCondition = exports.FluentFiltersCondition = exports.FluentFiltersOrRelations = exports.FluentFilters = exports.Exec = void 0;
|
|
8
|
+
exports.FluentCommand = exports.FluentFiltersOrRelationsCondition = exports.FluentFiltersCondition = exports.FluentFiltersOrRelations = exports.FluentFilters = exports.Exec = exports.Separators = void 0;
|
|
9
|
+
var Separators;
|
|
10
|
+
(function (Separators) {
|
|
11
|
+
Separators["STRING"] = "<|string|>";
|
|
12
|
+
})(Separators = exports.Separators || (exports.Separators = {}));
|
|
8
13
|
class FluentBase {
|
|
9
14
|
constructor(prev) {
|
|
10
15
|
this.prev = prev;
|
|
@@ -650,6 +655,15 @@ class FluentFilters extends FluentBase {
|
|
|
650
655
|
/**
|
|
651
656
|
* Filters for an UI element 'icon'.
|
|
652
657
|
*
|
|
658
|
+
* You can combine it with the 'withText' command to look for a specific icon.
|
|
659
|
+
*
|
|
660
|
+
* **Examples:**
|
|
661
|
+
* ```typescript
|
|
662
|
+
* icon().withText('plus')
|
|
663
|
+
* ```
|
|
664
|
+
*
|
|
665
|
+
* Note: This is an alpha feature. The prediction of the icon name is sometimes unstable. Use custom elements as an alternative.
|
|
666
|
+
*
|
|
653
667
|
* @return {FluentFiltersOrRelations}
|
|
654
668
|
*/
|
|
655
669
|
icon() {
|
|
@@ -695,7 +709,26 @@ class FluentFilters extends FluentBase {
|
|
|
695
709
|
* @return {FluentFiltersOrRelations}
|
|
696
710
|
*/
|
|
697
711
|
withText(text) {
|
|
698
|
-
this._textStr = `with text
|
|
712
|
+
this._textStr = `with text ${Separators.STRING}${text}${Separators.STRING}`;
|
|
713
|
+
return new FluentFiltersOrRelations(this);
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* Filters for texts, which match the regex pattern.
|
|
717
|
+
*
|
|
718
|
+
* **Examples:**
|
|
719
|
+
*
|
|
720
|
+
* ```typescript
|
|
721
|
+
* 'The rain in Spain' === withTextRegex('\b[Ss]\w+') => true
|
|
722
|
+
* 'The rain in Portugal' === withTextRegex('\b[Ss]\w+') => false
|
|
723
|
+
* 'The rain in switzerland' === withTextRegex('\b[Ss]\w+') => true
|
|
724
|
+
* ```
|
|
725
|
+
*
|
|
726
|
+
* @param {string} regex_pattern - An regex pattern
|
|
727
|
+
*
|
|
728
|
+
* @return {FluentFiltersOrRelations}
|
|
729
|
+
*/
|
|
730
|
+
withTextRegex(regex_pattern) {
|
|
731
|
+
this._textStr = `match regex pattern ${Separators.STRING}${regex_pattern}${Separators.STRING}`;
|
|
699
732
|
return new FluentFiltersOrRelations(this);
|
|
700
733
|
}
|
|
701
734
|
/**
|
|
@@ -717,7 +750,7 @@ class FluentFilters extends FluentBase {
|
|
|
717
750
|
* @return {FluentFiltersOrRelations}
|
|
718
751
|
*/
|
|
719
752
|
withExactText(text) {
|
|
720
|
-
this._textStr = `equals text
|
|
753
|
+
this._textStr = `equals text ${Separators.STRING}${text}${Separators.STRING}`;
|
|
721
754
|
return new FluentFiltersOrRelations(this);
|
|
722
755
|
}
|
|
723
756
|
/**
|
|
@@ -735,7 +768,7 @@ class FluentFilters extends FluentBase {
|
|
|
735
768
|
* @return {FluentFiltersOrRelations}
|
|
736
769
|
*/
|
|
737
770
|
containsText(text) {
|
|
738
|
-
this._textStr = `contain text
|
|
771
|
+
this._textStr = `contain text ${Separators.STRING}${text}${Separators.STRING}`;
|
|
739
772
|
return new FluentFiltersOrRelations(this);
|
|
740
773
|
}
|
|
741
774
|
/**
|
|
@@ -1534,6 +1567,15 @@ class FluentFiltersCondition extends FluentBase {
|
|
|
1534
1567
|
/**
|
|
1535
1568
|
* Filters for an UI element 'icon'.
|
|
1536
1569
|
*
|
|
1570
|
+
* You can combine it with the 'withText' command to look for a specific icon.
|
|
1571
|
+
*
|
|
1572
|
+
* **Examples:**
|
|
1573
|
+
* ```typescript
|
|
1574
|
+
* icon().withText('plus')
|
|
1575
|
+
* ```
|
|
1576
|
+
*
|
|
1577
|
+
* Note: This is an alpha feature. The prediction of the icon name is sometimes unstable. Use custom elements as an alternative.
|
|
1578
|
+
*
|
|
1537
1579
|
* @return {FluentFiltersOrRelationsCondition}
|
|
1538
1580
|
*/
|
|
1539
1581
|
icon() {
|
|
@@ -1579,7 +1621,26 @@ class FluentFiltersCondition extends FluentBase {
|
|
|
1579
1621
|
* @return {FluentFiltersOrRelationsCondition}
|
|
1580
1622
|
*/
|
|
1581
1623
|
withText(text) {
|
|
1582
|
-
this._textStr = `with text
|
|
1624
|
+
this._textStr = `with text ${Separators.STRING}${text}${Separators.STRING}`;
|
|
1625
|
+
return new FluentFiltersOrRelationsCondition(this);
|
|
1626
|
+
}
|
|
1627
|
+
/**
|
|
1628
|
+
* Filters for texts, which match the regex pattern.
|
|
1629
|
+
*
|
|
1630
|
+
* **Examples:**
|
|
1631
|
+
*
|
|
1632
|
+
* ```typescript
|
|
1633
|
+
* 'The rain in Spain' === withTextRegex('\b[Ss]\w+') => true
|
|
1634
|
+
* 'The rain in Portugal' === withTextRegex('\b[Ss]\w+') => false
|
|
1635
|
+
* 'The rain in switzerland' === withTextRegex('\b[Ss]\w+') => true
|
|
1636
|
+
* ```
|
|
1637
|
+
*
|
|
1638
|
+
* @param {string} regex_pattern - An regex pattern
|
|
1639
|
+
*
|
|
1640
|
+
* @return {FluentFiltersOrRelationsCondition}
|
|
1641
|
+
*/
|
|
1642
|
+
withTextRegex(regex_pattern) {
|
|
1643
|
+
this._textStr = `match regex pattern ${Separators.STRING}${regex_pattern}${Separators.STRING}`;
|
|
1583
1644
|
return new FluentFiltersOrRelationsCondition(this);
|
|
1584
1645
|
}
|
|
1585
1646
|
/**
|
|
@@ -1601,7 +1662,7 @@ class FluentFiltersCondition extends FluentBase {
|
|
|
1601
1662
|
* @return {FluentFiltersOrRelationsCondition}
|
|
1602
1663
|
*/
|
|
1603
1664
|
withExactText(text) {
|
|
1604
|
-
this._textStr = `equals text
|
|
1665
|
+
this._textStr = `equals text ${Separators.STRING}${text}${Separators.STRING}`;
|
|
1605
1666
|
return new FluentFiltersOrRelationsCondition(this);
|
|
1606
1667
|
}
|
|
1607
1668
|
/**
|
|
@@ -1619,7 +1680,7 @@ class FluentFiltersCondition extends FluentBase {
|
|
|
1619
1680
|
* @return {FluentFiltersOrRelationsCondition}
|
|
1620
1681
|
*/
|
|
1621
1682
|
containsText(text) {
|
|
1622
|
-
this._textStr = `contain text
|
|
1683
|
+
this._textStr = `contain text ${Separators.STRING}${text}${Separators.STRING}`;
|
|
1623
1684
|
return new FluentFiltersOrRelationsCondition(this);
|
|
1624
1685
|
}
|
|
1625
1686
|
/**
|
|
@@ -1868,11 +1929,11 @@ class FluentCommand extends FluentBase {
|
|
|
1868
1929
|
* @return {FluentFilters}
|
|
1869
1930
|
*/
|
|
1870
1931
|
typeIn(text) {
|
|
1871
|
-
this._textStr = `Type
|
|
1932
|
+
this._textStr = `Type ${Separators.STRING}${text}${Separators.STRING} in`;
|
|
1872
1933
|
return new FluentFilters(this);
|
|
1873
1934
|
}
|
|
1874
1935
|
/**
|
|
1875
|
-
* Moves mouse to the filtered element and scrolls in the x and y direction
|
|
1936
|
+
* Moves mouse to the filtered element and scrolls in the x and y direction.
|
|
1876
1937
|
*
|
|
1877
1938
|
* @param {number} x_offset - A (positive/negative) x direction.
|
|
1878
1939
|
* @param {number} y_offset - A (positive/negative) y direction.
|
|
@@ -1916,7 +1977,7 @@ class FluentCommand extends FluentBase {
|
|
|
1916
1977
|
* @return {Exec}
|
|
1917
1978
|
*/
|
|
1918
1979
|
type(text) {
|
|
1919
|
-
this._textStr = `Type
|
|
1980
|
+
this._textStr = `Type ${Separators.STRING}${text}${Separators.STRING}`;
|
|
1920
1981
|
return new Exec(this);
|
|
1921
1982
|
}
|
|
1922
1983
|
/**
|
|
@@ -1965,7 +2026,7 @@ class FluentCommand extends FluentBase {
|
|
|
1965
2026
|
* @return {Exec}
|
|
1966
2027
|
*/
|
|
1967
2028
|
execOnShell(shell_command) {
|
|
1968
|
-
this._textStr = `Execute shell command
|
|
2029
|
+
this._textStr = `Execute shell command ${Separators.STRING}${shell_command}${Separators.STRING}`;
|
|
1969
2030
|
return new Exec(this);
|
|
1970
2031
|
}
|
|
1971
2032
|
/**
|
|
@@ -4,12 +4,12 @@ exports.envCredentials = void 0;
|
|
|
4
4
|
const lib_1 = require("../lib");
|
|
5
5
|
function envCredentials() {
|
|
6
6
|
const envToken = process.env['ASKUI_TOKEN'];
|
|
7
|
-
const
|
|
7
|
+
const envWorkspaceId = process.env['ASKUI_WORKSPACE_ID'];
|
|
8
8
|
const envEmail = process.env['ASKUI_EMAIL'];
|
|
9
|
-
if (envToken &&
|
|
10
|
-
lib_1.logger.info('Credentials are used from ENV variables: ASKUI_TOKEN,
|
|
9
|
+
if (envToken && envWorkspaceId && envEmail) {
|
|
10
|
+
lib_1.logger.info('Credentials are used from ENV variables: ASKUI_TOKEN, ASKUI_WORKSPACE_ID and ASKUI_EMAIL');
|
|
11
11
|
return {
|
|
12
|
-
|
|
12
|
+
workspaceId: envWorkspaceId,
|
|
13
13
|
email: envEmail,
|
|
14
14
|
token: envToken,
|
|
15
15
|
};
|
|
@@ -4,9 +4,9 @@ const read_environment_credentials_1 = require("./read-environment-credentials")
|
|
|
4
4
|
describe('envCredentials()', () => {
|
|
5
5
|
test('should read the credentials from the environment variables', () => {
|
|
6
6
|
process.env['ASKUI_TOKEN'] = 'token';
|
|
7
|
-
process.env['
|
|
7
|
+
process.env['ASKUI_WORKSPACE_ID'] = 'id123';
|
|
8
8
|
process.env['ASKUI_EMAIL'] = 'name@tenant.com';
|
|
9
9
|
const credentialsFromTheEnv = (0, read_environment_credentials_1.envCredentials)();
|
|
10
|
-
expect(credentialsFromTheEnv).toStrictEqual({
|
|
10
|
+
expect(credentialsFromTheEnv).toStrictEqual({ workspaceId: 'id123', email: 'name@tenant.com', token: 'token' });
|
|
11
11
|
});
|
|
12
12
|
});
|
|
@@ -17,6 +17,7 @@ export declare class UiControlClient extends FluentCommand {
|
|
|
17
17
|
connect(): Promise<UiControllerClientConnectionState>;
|
|
18
18
|
annotate(annotationRequest?: AnnotationRequest): Promise<Annotation>;
|
|
19
19
|
annotateInteractively(): Promise<void>;
|
|
20
|
+
private escapeSeparatorString;
|
|
20
21
|
exec(instruction: string, customElementJson?: CustomElementJson[]): Promise<void>;
|
|
21
22
|
private secretText;
|
|
22
23
|
/**
|
|
@@ -23,7 +23,7 @@ const annotation_level_1 = require("./annotation-level");
|
|
|
23
23
|
const ui_control_client_error_1 = require("./ui-control-client-error");
|
|
24
24
|
const read_environment_credentials_1 = require("./read-environment-credentials");
|
|
25
25
|
const analytics_1 = require("../utils/analytics");
|
|
26
|
-
const getClientArgsWithDefaults = (clientArgs = {}) => (Object.assign({ uiControllerUrl: 'http://
|
|
26
|
+
const getClientArgsWithDefaults = (clientArgs = {}) => (Object.assign({ uiControllerUrl: 'http://127.0.0.1:6769', inferenceServerUrl: 'https://inference.askui.com', annotationLevel: annotation_level_1.AnnotationLevel.DISABLED }, clientArgs));
|
|
27
27
|
class UiControlClient extends dsl_1.FluentCommand {
|
|
28
28
|
constructor(httpClient, clientArgs) {
|
|
29
29
|
super();
|
|
@@ -89,10 +89,16 @@ class UiControlClient extends dsl_1.FluentCommand {
|
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
|
+
// eslint-disable-next-line class-methods-use-this
|
|
93
|
+
escapeSeparatorString(instruction) {
|
|
94
|
+
return instruction.split(dsl_1.Separators.STRING).join('"');
|
|
95
|
+
}
|
|
92
96
|
exec(instruction, customElementJson = []) {
|
|
93
97
|
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
-
const customElements = yield test_case_dto_1.CustomElement.fromJsonListWithImagePathOrImage(customElementJson);
|
|
95
98
|
const { secretText } = this;
|
|
99
|
+
const customElements = yield test_case_dto_1.CustomElement.fromJsonListWithImagePathOrImage(customElementJson);
|
|
100
|
+
const stringWithoutSeparators = this.escapeSeparatorString(instruction);
|
|
101
|
+
logger_1.logger.debug(stringWithoutSeparators);
|
|
96
102
|
try {
|
|
97
103
|
yield this.executionRuntime.executeTestStep({
|
|
98
104
|
instruction,
|
|
@@ -104,7 +110,7 @@ class UiControlClient extends dsl_1.FluentCommand {
|
|
|
104
110
|
}
|
|
105
111
|
catch (error) {
|
|
106
112
|
yield this.annotateByDefault(test_case_result_dto_1.TestStepState.FAILED, customElements);
|
|
107
|
-
return Promise.reject(new ui_control_client_error_1.UiControlClientError(`A problem
|
|
113
|
+
return Promise.reject(new ui_control_client_error_1.UiControlClientError(`A problem occurred while executing the instruction: ${stringWithoutSeparators}. Reason ${error}`));
|
|
108
114
|
}
|
|
109
115
|
});
|
|
110
116
|
}
|
|
@@ -3,7 +3,7 @@ import { AnnotationLevel } from './annotation-level';
|
|
|
3
3
|
/**
|
|
4
4
|
* Configuration options for the askui UI Control Client
|
|
5
5
|
*
|
|
6
|
-
* @param {string} uiControllerUrl - Default: http://
|
|
6
|
+
* @param {string} uiControllerUrl - Default: http://127.0.0.1:6769
|
|
7
7
|
* The adress of the askui UI Controller server.
|
|
8
8
|
* @param {string} inferenceClientUrl - Default: https://inference.askui.com`
|
|
9
9
|
* Address of the askui Inference server.
|
|
@@ -129,7 +129,7 @@ class UiControllerFacade {
|
|
|
129
129
|
}
|
|
130
130
|
catch (err) {
|
|
131
131
|
throw new Error(`The UI Controller could not be started. Log file : ${this.serverLogFile}. ErrorReason: ${err}
|
|
132
|
-
Check this website for more information: https://docs.askui.com/docs/general/Troubleshooting
|
|
132
|
+
Check this website for more information: https://docs.askui.com/docs/general/Troubleshooting`);
|
|
133
133
|
}
|
|
134
134
|
});
|
|
135
135
|
}
|
|
@@ -27,7 +27,7 @@ class UiControllerLinux extends ui_controller_facade_1.UiControllerFacade {
|
|
|
27
27
|
const runCommand = (0, util_1.promisify)(child_process_1.exec);
|
|
28
28
|
const waylandStatus = yield runCommand('echo $WAYLAND_DISPLAY');
|
|
29
29
|
if (waylandStatus.stdout.trim().includes('wayland')) {
|
|
30
|
-
throw new wayland_error_1.WaylandError('Wayland is not supported: https://docs.askui.com/docs/general/Troubleshooting/
|
|
30
|
+
throw new wayland_error_1.WaylandError('Wayland is not supported: https://docs.askui.com/docs/general/Troubleshooting/linux#wayland');
|
|
31
31
|
}
|
|
32
32
|
/* First we want to check if the user is using a debian distribution.
|
|
33
33
|
* and in the following if libfuse2 is installed.
|
|
@@ -44,7 +44,7 @@ class UiControllerLinux extends ui_controller_facade_1.UiControllerFacade {
|
|
|
44
44
|
yield runCommand('dpkg -s libfuse2 | grep Status');
|
|
45
45
|
}
|
|
46
46
|
catch (_a) {
|
|
47
|
-
throw new libfuse_error_1.LibfuseError('Libfuse2 package is missing: https://docs.askui.com/docs/general/Troubleshooting/
|
|
47
|
+
throw new libfuse_error_1.LibfuseError('Libfuse2 package is missing: https://docs.askui.com/docs/general/Troubleshooting/linux#libfuse2');
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
50
|
}
|
|
@@ -12,7 +12,7 @@ class Credentials {
|
|
|
12
12
|
return Buffer.from(`${this.userName}:${this.credentials.token}`);
|
|
13
13
|
}
|
|
14
14
|
get userName() {
|
|
15
|
-
return `${this.credentials.
|
|
15
|
+
return `${this.credentials.workspaceId}|${this.credentials.email}`;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
exports.Credentials = Credentials;
|
|
@@ -4,8 +4,8 @@ const credentials_1 = require("./credentials");
|
|
|
4
4
|
describe('Credentials', () => {
|
|
5
5
|
describe('base64Encoded()', () => {
|
|
6
6
|
test('should return base64-encoded credentials', () => {
|
|
7
|
-
const credentials = new credentials_1.Credentials({
|
|
8
|
-
expect(credentials.base64Encoded).toBe('
|
|
7
|
+
const credentials = new credentials_1.Credentials({ workspaceId: 'id123', email: 'name@tenant.com', token: 'password' });
|
|
8
|
+
expect(credentials.base64Encoded).toBe('aWQxMjN8bmFtZUB0ZW5hbnQuY29tOnBhc3N3b3Jk');
|
|
9
9
|
});
|
|
10
10
|
});
|
|
11
11
|
});
|
|
@@ -8,7 +8,7 @@ const unkown_http_client_error_1 = require("./unkown-http-client-error");
|
|
|
8
8
|
var general_http_client_error_1 = require("./general-http-client-error");
|
|
9
9
|
Object.defineProperty(exports, "GeneralHttpClientError", { enumerable: true, get: function () { return general_http_client_error_1.GeneralHttpClientError; } });
|
|
10
10
|
function httpClientErrorHandler(responseCode, errorMessage) {
|
|
11
|
-
const diplayedMessage = `
|
|
11
|
+
const diplayedMessage = `HTTP Status Code: ${responseCode}. Message:${errorMessage}`;
|
|
12
12
|
if (responseCode >= 400 && responseCode < 500) {
|
|
13
13
|
if (responseCode === 401 || responseCode === 403) {
|
|
14
14
|
return new authentication_http_client_error_1.AuthenticationHttpClientError(diplayedMessage);
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { CustomElementJson } from '../core/model/test-case-dto';
|
|
2
|
+
export declare enum Separators {
|
|
3
|
+
STRING = "<|string|>"
|
|
4
|
+
}
|
|
2
5
|
export declare type PC_KEY = 'backspace' | 'delete' | 'enter' | 'tab' | 'escape' | 'up' | 'down' | 'right' | 'left' | 'home' | 'end' | 'pageup' | 'pagedown' | 'f1' | 'f2' | 'f3' | 'f4' | 'f5' | 'f6' | 'f7' | 'f8' | 'f9' | 'f10' | 'f11' | 'f12' | 'space' | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z' | '!' | '"' | '#' | '$' | '%' | '&' | "'" | '(' | ')' | '*' | '+' | ',' | '-' | '.' | '/' | ':' | ';' | '<' | '=' | '>' | '?' | '@' | '[' | '\\' | ']' | '^' | '_' | '`' | '{' | '|' | '}' | '~ ';
|
|
3
6
|
export declare type ANDROID_KEY = 'home' | 'back' | 'call' | 'endcall' | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | 'star' | 'pound' | 'dpad_up' | 'dpad_down' | 'dpad_left' | 'dpad_right' | 'dpad_center' | 'volume_up' | 'volume_down' | 'power' | 'camera' | 'clear' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' | 'comma' | 'period' | 'alt_left' | 'alt_right' | 'shift_left' | 'shift_right' | 'tab' | 'space' | 'sym' | 'explorer' | 'envelope' | 'enter' | 'del' | 'grave' | 'minus' | 'equals' | 'left_bracket' | 'right_bracket' | 'backslash' | 'semicolon' | 'apostrophe' | 'slash' | 'at' | 'num' | 'headsethook' | 'focus' | 'plus' | 'menu' | 'notification' | 'search' | 'media_play_pause' | 'media_stop' | 'media_next' | 'media_previous' | 'media_rewind' | 'media_fast_forward' | 'mute' | 'page_up' | 'page_down' | 'switch_charset' | 'escape' | 'forward_del' | 'ctrl_left' | 'ctrl_right' | 'caps_lock' | 'scroll_lock' | 'function' | 'break' | 'move_home' | 'move_end' | 'insert' | 'forward' | 'media_play' | 'media_pause' | 'media_close' | 'media_eject' | 'media_record' | 'f1' | 'f2' | 'f3' | 'f4' | 'f5' | 'f6' | 'f7' | 'f8' | 'f9' | 'f10' | 'f11' | 'f12' | 'num_lock' | 'numpad_0' | 'numpad_1' | 'numpad_2' | 'numpad_3' | 'numpad_4' | 'numpad_5' | 'numpad_6' | 'numpad_7' | 'numpad_8' | 'numpad_9' | 'numpad_divide' | 'numpad_multiply' | 'numpad_subtract' | 'numpad_add' | 'numpad_dot' | 'numpad_comma' | 'numpad_enter' | 'numpad_equals' | 'numpad_left_paren' | 'numpad_right_paren' | 'volume_mute' | 'info' | 'channel_up' | 'channel_down' | 'zoom_in' | 'zoom_out' | 'window' | 'guide' | 'bookmark' | 'captions' | 'settings' | 'app_switch' | 'language_switch' | 'contacts' | 'calendar' | 'music' | 'calculator' | 'assist' | 'brightness_down' | 'brightness_up' | 'media_audio_track' | 'sleep' | 'wakeup' | 'pairing' | 'media_top_menu' | 'last_channel' | 'tv_data_service' | 'voice_assist' | 'help' | 'navigate_previous' | 'navigate_next' | 'navigate_in' | 'navigate_out' | 'dpad_up_left' | 'dpad_down_left' | 'dpad_up_right' | 'dpad_down_right' | 'media_skip_forward' | 'media_skip_backward' | 'media_step_forward' | 'media_step_backward' | 'soft_sleep' | 'cut' | 'copy' | 'paste' | 'all_apps' | 'refresh';
|
|
4
7
|
export declare type MODIFIER_KEY = 'command' | 'alt' | 'control' | 'shift' | 'right_shift';
|
|
@@ -426,6 +429,15 @@ export declare class FluentFilters extends FluentBase {
|
|
|
426
429
|
/**
|
|
427
430
|
* Filters for an UI element 'icon'.
|
|
428
431
|
*
|
|
432
|
+
* You can combine it with the 'withText' command to look for a specific icon.
|
|
433
|
+
*
|
|
434
|
+
* **Examples:**
|
|
435
|
+
* ```typescript
|
|
436
|
+
* icon().withText('plus')
|
|
437
|
+
* ```
|
|
438
|
+
*
|
|
439
|
+
* Note: This is an alpha feature. The prediction of the icon name is sometimes unstable. Use custom elements as an alternative.
|
|
440
|
+
*
|
|
429
441
|
* @return {FluentFiltersOrRelations}
|
|
430
442
|
*/
|
|
431
443
|
icon(): FluentFiltersOrRelations;
|
|
@@ -461,6 +473,22 @@ export declare class FluentFilters extends FluentBase {
|
|
|
461
473
|
* @return {FluentFiltersOrRelations}
|
|
462
474
|
*/
|
|
463
475
|
withText(text: string): FluentFiltersOrRelations;
|
|
476
|
+
/**
|
|
477
|
+
* Filters for texts, which match the regex pattern.
|
|
478
|
+
*
|
|
479
|
+
* **Examples:**
|
|
480
|
+
*
|
|
481
|
+
* ```typescript
|
|
482
|
+
* 'The rain in Spain' === withTextRegex('\b[Ss]\w+') => true
|
|
483
|
+
* 'The rain in Portugal' === withTextRegex('\b[Ss]\w+') => false
|
|
484
|
+
* 'The rain in switzerland' === withTextRegex('\b[Ss]\w+') => true
|
|
485
|
+
* ```
|
|
486
|
+
*
|
|
487
|
+
* @param {string} regex_pattern - An regex pattern
|
|
488
|
+
*
|
|
489
|
+
* @return {FluentFiltersOrRelations}
|
|
490
|
+
*/
|
|
491
|
+
withTextRegex(regex_pattern: string): FluentFiltersOrRelations;
|
|
464
492
|
/**
|
|
465
493
|
* Filters for equal text.
|
|
466
494
|
*
|
|
@@ -1060,6 +1088,15 @@ export declare class FluentFiltersCondition extends FluentBase {
|
|
|
1060
1088
|
/**
|
|
1061
1089
|
* Filters for an UI element 'icon'.
|
|
1062
1090
|
*
|
|
1091
|
+
* You can combine it with the 'withText' command to look for a specific icon.
|
|
1092
|
+
*
|
|
1093
|
+
* **Examples:**
|
|
1094
|
+
* ```typescript
|
|
1095
|
+
* icon().withText('plus')
|
|
1096
|
+
* ```
|
|
1097
|
+
*
|
|
1098
|
+
* Note: This is an alpha feature. The prediction of the icon name is sometimes unstable. Use custom elements as an alternative.
|
|
1099
|
+
*
|
|
1063
1100
|
* @return {FluentFiltersOrRelationsCondition}
|
|
1064
1101
|
*/
|
|
1065
1102
|
icon(): FluentFiltersOrRelationsCondition;
|
|
@@ -1095,6 +1132,22 @@ export declare class FluentFiltersCondition extends FluentBase {
|
|
|
1095
1132
|
* @return {FluentFiltersOrRelationsCondition}
|
|
1096
1133
|
*/
|
|
1097
1134
|
withText(text: string): FluentFiltersOrRelationsCondition;
|
|
1135
|
+
/**
|
|
1136
|
+
* Filters for texts, which match the regex pattern.
|
|
1137
|
+
*
|
|
1138
|
+
* **Examples:**
|
|
1139
|
+
*
|
|
1140
|
+
* ```typescript
|
|
1141
|
+
* 'The rain in Spain' === withTextRegex('\b[Ss]\w+') => true
|
|
1142
|
+
* 'The rain in Portugal' === withTextRegex('\b[Ss]\w+') => false
|
|
1143
|
+
* 'The rain in switzerland' === withTextRegex('\b[Ss]\w+') => true
|
|
1144
|
+
* ```
|
|
1145
|
+
*
|
|
1146
|
+
* @param {string} regex_pattern - An regex pattern
|
|
1147
|
+
*
|
|
1148
|
+
* @return {FluentFiltersOrRelationsCondition}
|
|
1149
|
+
*/
|
|
1150
|
+
withTextRegex(regex_pattern: string): FluentFiltersOrRelationsCondition;
|
|
1098
1151
|
/**
|
|
1099
1152
|
* Filters for equal text.
|
|
1100
1153
|
*
|
|
@@ -1331,7 +1384,7 @@ export declare abstract class FluentCommand extends FluentBase {
|
|
|
1331
1384
|
*/
|
|
1332
1385
|
typeIn(text: string): FluentFilters;
|
|
1333
1386
|
/**
|
|
1334
|
-
* Moves mouse to the filtered element and scrolls in the x and y direction
|
|
1387
|
+
* Moves mouse to the filtered element and scrolls in the x and y direction.
|
|
1335
1388
|
*
|
|
1336
1389
|
* @param {number} x_offset - A (positive/negative) x direction.
|
|
1337
1390
|
* @param {number} y_offset - A (positive/negative) y direction.
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
2
2
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
3
|
/* eslint-disable max-classes-per-file */
|
|
4
|
+
/* eslint-disable max-len */
|
|
4
5
|
// Autogenerated from typescript.template file
|
|
6
|
+
export var Separators;
|
|
7
|
+
(function (Separators) {
|
|
8
|
+
Separators["STRING"] = "<|string|>";
|
|
9
|
+
})(Separators || (Separators = {}));
|
|
5
10
|
class FluentBase {
|
|
6
11
|
constructor(prev) {
|
|
7
12
|
this.prev = prev;
|
|
@@ -646,6 +651,15 @@ export class FluentFilters extends FluentBase {
|
|
|
646
651
|
/**
|
|
647
652
|
* Filters for an UI element 'icon'.
|
|
648
653
|
*
|
|
654
|
+
* You can combine it with the 'withText' command to look for a specific icon.
|
|
655
|
+
*
|
|
656
|
+
* **Examples:**
|
|
657
|
+
* ```typescript
|
|
658
|
+
* icon().withText('plus')
|
|
659
|
+
* ```
|
|
660
|
+
*
|
|
661
|
+
* Note: This is an alpha feature. The prediction of the icon name is sometimes unstable. Use custom elements as an alternative.
|
|
662
|
+
*
|
|
649
663
|
* @return {FluentFiltersOrRelations}
|
|
650
664
|
*/
|
|
651
665
|
icon() {
|
|
@@ -691,7 +705,26 @@ export class FluentFilters extends FluentBase {
|
|
|
691
705
|
* @return {FluentFiltersOrRelations}
|
|
692
706
|
*/
|
|
693
707
|
withText(text) {
|
|
694
|
-
this._textStr = `with text
|
|
708
|
+
this._textStr = `with text ${Separators.STRING}${text}${Separators.STRING}`;
|
|
709
|
+
return new FluentFiltersOrRelations(this);
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* Filters for texts, which match the regex pattern.
|
|
713
|
+
*
|
|
714
|
+
* **Examples:**
|
|
715
|
+
*
|
|
716
|
+
* ```typescript
|
|
717
|
+
* 'The rain in Spain' === withTextRegex('\b[Ss]\w+') => true
|
|
718
|
+
* 'The rain in Portugal' === withTextRegex('\b[Ss]\w+') => false
|
|
719
|
+
* 'The rain in switzerland' === withTextRegex('\b[Ss]\w+') => true
|
|
720
|
+
* ```
|
|
721
|
+
*
|
|
722
|
+
* @param {string} regex_pattern - An regex pattern
|
|
723
|
+
*
|
|
724
|
+
* @return {FluentFiltersOrRelations}
|
|
725
|
+
*/
|
|
726
|
+
withTextRegex(regex_pattern) {
|
|
727
|
+
this._textStr = `match regex pattern ${Separators.STRING}${regex_pattern}${Separators.STRING}`;
|
|
695
728
|
return new FluentFiltersOrRelations(this);
|
|
696
729
|
}
|
|
697
730
|
/**
|
|
@@ -713,7 +746,7 @@ export class FluentFilters extends FluentBase {
|
|
|
713
746
|
* @return {FluentFiltersOrRelations}
|
|
714
747
|
*/
|
|
715
748
|
withExactText(text) {
|
|
716
|
-
this._textStr = `equals text
|
|
749
|
+
this._textStr = `equals text ${Separators.STRING}${text}${Separators.STRING}`;
|
|
717
750
|
return new FluentFiltersOrRelations(this);
|
|
718
751
|
}
|
|
719
752
|
/**
|
|
@@ -731,7 +764,7 @@ export class FluentFilters extends FluentBase {
|
|
|
731
764
|
* @return {FluentFiltersOrRelations}
|
|
732
765
|
*/
|
|
733
766
|
containsText(text) {
|
|
734
|
-
this._textStr = `contain text
|
|
767
|
+
this._textStr = `contain text ${Separators.STRING}${text}${Separators.STRING}`;
|
|
735
768
|
return new FluentFiltersOrRelations(this);
|
|
736
769
|
}
|
|
737
770
|
/**
|
|
@@ -1528,6 +1561,15 @@ export class FluentFiltersCondition extends FluentBase {
|
|
|
1528
1561
|
/**
|
|
1529
1562
|
* Filters for an UI element 'icon'.
|
|
1530
1563
|
*
|
|
1564
|
+
* You can combine it with the 'withText' command to look for a specific icon.
|
|
1565
|
+
*
|
|
1566
|
+
* **Examples:**
|
|
1567
|
+
* ```typescript
|
|
1568
|
+
* icon().withText('plus')
|
|
1569
|
+
* ```
|
|
1570
|
+
*
|
|
1571
|
+
* Note: This is an alpha feature. The prediction of the icon name is sometimes unstable. Use custom elements as an alternative.
|
|
1572
|
+
*
|
|
1531
1573
|
* @return {FluentFiltersOrRelationsCondition}
|
|
1532
1574
|
*/
|
|
1533
1575
|
icon() {
|
|
@@ -1573,7 +1615,26 @@ export class FluentFiltersCondition extends FluentBase {
|
|
|
1573
1615
|
* @return {FluentFiltersOrRelationsCondition}
|
|
1574
1616
|
*/
|
|
1575
1617
|
withText(text) {
|
|
1576
|
-
this._textStr = `with text
|
|
1618
|
+
this._textStr = `with text ${Separators.STRING}${text}${Separators.STRING}`;
|
|
1619
|
+
return new FluentFiltersOrRelationsCondition(this);
|
|
1620
|
+
}
|
|
1621
|
+
/**
|
|
1622
|
+
* Filters for texts, which match the regex pattern.
|
|
1623
|
+
*
|
|
1624
|
+
* **Examples:**
|
|
1625
|
+
*
|
|
1626
|
+
* ```typescript
|
|
1627
|
+
* 'The rain in Spain' === withTextRegex('\b[Ss]\w+') => true
|
|
1628
|
+
* 'The rain in Portugal' === withTextRegex('\b[Ss]\w+') => false
|
|
1629
|
+
* 'The rain in switzerland' === withTextRegex('\b[Ss]\w+') => true
|
|
1630
|
+
* ```
|
|
1631
|
+
*
|
|
1632
|
+
* @param {string} regex_pattern - An regex pattern
|
|
1633
|
+
*
|
|
1634
|
+
* @return {FluentFiltersOrRelationsCondition}
|
|
1635
|
+
*/
|
|
1636
|
+
withTextRegex(regex_pattern) {
|
|
1637
|
+
this._textStr = `match regex pattern ${Separators.STRING}${regex_pattern}${Separators.STRING}`;
|
|
1577
1638
|
return new FluentFiltersOrRelationsCondition(this);
|
|
1578
1639
|
}
|
|
1579
1640
|
/**
|
|
@@ -1595,7 +1656,7 @@ export class FluentFiltersCondition extends FluentBase {
|
|
|
1595
1656
|
* @return {FluentFiltersOrRelationsCondition}
|
|
1596
1657
|
*/
|
|
1597
1658
|
withExactText(text) {
|
|
1598
|
-
this._textStr = `equals text
|
|
1659
|
+
this._textStr = `equals text ${Separators.STRING}${text}${Separators.STRING}`;
|
|
1599
1660
|
return new FluentFiltersOrRelationsCondition(this);
|
|
1600
1661
|
}
|
|
1601
1662
|
/**
|
|
@@ -1613,7 +1674,7 @@ export class FluentFiltersCondition extends FluentBase {
|
|
|
1613
1674
|
* @return {FluentFiltersOrRelationsCondition}
|
|
1614
1675
|
*/
|
|
1615
1676
|
containsText(text) {
|
|
1616
|
-
this._textStr = `contain text
|
|
1677
|
+
this._textStr = `contain text ${Separators.STRING}${text}${Separators.STRING}`;
|
|
1617
1678
|
return new FluentFiltersOrRelationsCondition(this);
|
|
1618
1679
|
}
|
|
1619
1680
|
/**
|
|
@@ -1860,11 +1921,11 @@ export class FluentCommand extends FluentBase {
|
|
|
1860
1921
|
* @return {FluentFilters}
|
|
1861
1922
|
*/
|
|
1862
1923
|
typeIn(text) {
|
|
1863
|
-
this._textStr = `Type
|
|
1924
|
+
this._textStr = `Type ${Separators.STRING}${text}${Separators.STRING} in`;
|
|
1864
1925
|
return new FluentFilters(this);
|
|
1865
1926
|
}
|
|
1866
1927
|
/**
|
|
1867
|
-
* Moves mouse to the filtered element and scrolls in the x and y direction
|
|
1928
|
+
* Moves mouse to the filtered element and scrolls in the x and y direction.
|
|
1868
1929
|
*
|
|
1869
1930
|
* @param {number} x_offset - A (positive/negative) x direction.
|
|
1870
1931
|
* @param {number} y_offset - A (positive/negative) y direction.
|
|
@@ -1908,7 +1969,7 @@ export class FluentCommand extends FluentBase {
|
|
|
1908
1969
|
* @return {Exec}
|
|
1909
1970
|
*/
|
|
1910
1971
|
type(text) {
|
|
1911
|
-
this._textStr = `Type
|
|
1972
|
+
this._textStr = `Type ${Separators.STRING}${text}${Separators.STRING}`;
|
|
1912
1973
|
return new Exec(this);
|
|
1913
1974
|
}
|
|
1914
1975
|
/**
|
|
@@ -1957,7 +2018,7 @@ export class FluentCommand extends FluentBase {
|
|
|
1957
2018
|
* @return {Exec}
|
|
1958
2019
|
*/
|
|
1959
2020
|
execOnShell(shell_command) {
|
|
1960
|
-
this._textStr = `Execute shell command
|
|
2021
|
+
this._textStr = `Execute shell command ${Separators.STRING}${shell_command}${Separators.STRING}`;
|
|
1961
2022
|
return new Exec(this);
|
|
1962
2023
|
}
|
|
1963
2024
|
/**
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { logger } from '../lib';
|
|
2
2
|
export function envCredentials() {
|
|
3
3
|
const envToken = process.env['ASKUI_TOKEN'];
|
|
4
|
-
const
|
|
4
|
+
const envWorkspaceId = process.env['ASKUI_WORKSPACE_ID'];
|
|
5
5
|
const envEmail = process.env['ASKUI_EMAIL'];
|
|
6
|
-
if (envToken &&
|
|
7
|
-
logger.info('Credentials are used from ENV variables: ASKUI_TOKEN,
|
|
6
|
+
if (envToken && envWorkspaceId && envEmail) {
|
|
7
|
+
logger.info('Credentials are used from ENV variables: ASKUI_TOKEN, ASKUI_WORKSPACE_ID and ASKUI_EMAIL');
|
|
8
8
|
return {
|
|
9
|
-
|
|
9
|
+
workspaceId: envWorkspaceId,
|
|
10
10
|
email: envEmail,
|
|
11
11
|
token: envToken,
|
|
12
12
|
};
|
|
@@ -2,9 +2,9 @@ import { envCredentials } from './read-environment-credentials';
|
|
|
2
2
|
describe('envCredentials()', () => {
|
|
3
3
|
test('should read the credentials from the environment variables', () => {
|
|
4
4
|
process.env['ASKUI_TOKEN'] = 'token';
|
|
5
|
-
process.env['
|
|
5
|
+
process.env['ASKUI_WORKSPACE_ID'] = 'id123';
|
|
6
6
|
process.env['ASKUI_EMAIL'] = 'name@tenant.com';
|
|
7
7
|
const credentialsFromTheEnv = envCredentials();
|
|
8
|
-
expect(credentialsFromTheEnv).toStrictEqual({
|
|
8
|
+
expect(credentialsFromTheEnv).toStrictEqual({ workspaceId: 'id123', email: 'name@tenant.com', token: 'token' });
|
|
9
9
|
});
|
|
10
10
|
});
|
|
@@ -17,6 +17,7 @@ export declare class UiControlClient extends FluentCommand {
|
|
|
17
17
|
connect(): Promise<UiControllerClientConnectionState>;
|
|
18
18
|
annotate(annotationRequest?: AnnotationRequest): Promise<Annotation>;
|
|
19
19
|
annotateInteractively(): Promise<void>;
|
|
20
|
+
private escapeSeparatorString;
|
|
20
21
|
exec(instruction: string, customElementJson?: CustomElementJson[]): Promise<void>;
|
|
21
22
|
private secretText;
|
|
22
23
|
/**
|
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { CustomElement } from '../core/model/test-case-dto';
|
|
11
|
-
import { FluentCommand, } from './dsl';
|
|
11
|
+
import { FluentCommand, Separators, } from './dsl';
|
|
12
12
|
import { HttpClientGot } from '../utils/http/http-client-got';
|
|
13
13
|
import { UiControllerClient } from './ui-controller-client';
|
|
14
14
|
import { ExecutionRuntime } from './execution-runtime';
|
|
@@ -20,7 +20,7 @@ import { AnnotationLevel } from './annotation-level';
|
|
|
20
20
|
import { UiControlClientError } from './ui-control-client-error';
|
|
21
21
|
import { envCredentials } from './read-environment-credentials';
|
|
22
22
|
import { Analytics } from '../utils/analytics';
|
|
23
|
-
const getClientArgsWithDefaults = (clientArgs = {}) => (Object.assign({ uiControllerUrl: 'http://
|
|
23
|
+
const getClientArgsWithDefaults = (clientArgs = {}) => (Object.assign({ uiControllerUrl: 'http://127.0.0.1:6769', inferenceServerUrl: 'https://inference.askui.com', annotationLevel: AnnotationLevel.DISABLED }, clientArgs));
|
|
24
24
|
export class UiControlClient extends FluentCommand {
|
|
25
25
|
constructor(httpClient, clientArgs) {
|
|
26
26
|
super();
|
|
@@ -86,10 +86,16 @@ export class UiControlClient extends FluentCommand {
|
|
|
86
86
|
}
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
|
+
// eslint-disable-next-line class-methods-use-this
|
|
90
|
+
escapeSeparatorString(instruction) {
|
|
91
|
+
return instruction.split(Separators.STRING).join('"');
|
|
92
|
+
}
|
|
89
93
|
exec(instruction, customElementJson = []) {
|
|
90
94
|
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
-
const customElements = yield CustomElement.fromJsonListWithImagePathOrImage(customElementJson);
|
|
92
95
|
const { secretText } = this;
|
|
96
|
+
const customElements = yield CustomElement.fromJsonListWithImagePathOrImage(customElementJson);
|
|
97
|
+
const stringWithoutSeparators = this.escapeSeparatorString(instruction);
|
|
98
|
+
logger.debug(stringWithoutSeparators);
|
|
93
99
|
try {
|
|
94
100
|
yield this.executionRuntime.executeTestStep({
|
|
95
101
|
instruction,
|
|
@@ -101,7 +107,7 @@ export class UiControlClient extends FluentCommand {
|
|
|
101
107
|
}
|
|
102
108
|
catch (error) {
|
|
103
109
|
yield this.annotateByDefault(TestStepState.FAILED, customElements);
|
|
104
|
-
return Promise.reject(new UiControlClientError(`A problem
|
|
110
|
+
return Promise.reject(new UiControlClientError(`A problem occurred while executing the instruction: ${stringWithoutSeparators}. Reason ${error}`));
|
|
105
111
|
}
|
|
106
112
|
});
|
|
107
113
|
}
|
|
@@ -3,7 +3,7 @@ import { AnnotationLevel } from './annotation-level';
|
|
|
3
3
|
/**
|
|
4
4
|
* Configuration options for the askui UI Control Client
|
|
5
5
|
*
|
|
6
|
-
* @param {string} uiControllerUrl - Default: http://
|
|
6
|
+
* @param {string} uiControllerUrl - Default: http://127.0.0.1:6769
|
|
7
7
|
* The adress of the askui UI Controller server.
|
|
8
8
|
* @param {string} inferenceClientUrl - Default: https://inference.askui.com`
|
|
9
9
|
* Address of the askui Inference server.
|
|
@@ -123,7 +123,7 @@ export class UiControllerFacade {
|
|
|
123
123
|
}
|
|
124
124
|
catch (err) {
|
|
125
125
|
throw new Error(`The UI Controller could not be started. Log file : ${this.serverLogFile}. ErrorReason: ${err}
|
|
126
|
-
Check this website for more information: https://docs.askui.com/docs/general/Troubleshooting
|
|
126
|
+
Check this website for more information: https://docs.askui.com/docs/general/Troubleshooting`);
|
|
127
127
|
}
|
|
128
128
|
});
|
|
129
129
|
}
|
|
@@ -24,7 +24,7 @@ export class UiControllerLinux extends UiControllerFacade {
|
|
|
24
24
|
const runCommand = promisify(exec);
|
|
25
25
|
const waylandStatus = yield runCommand('echo $WAYLAND_DISPLAY');
|
|
26
26
|
if (waylandStatus.stdout.trim().includes('wayland')) {
|
|
27
|
-
throw new WaylandError('Wayland is not supported: https://docs.askui.com/docs/general/Troubleshooting/
|
|
27
|
+
throw new WaylandError('Wayland is not supported: https://docs.askui.com/docs/general/Troubleshooting/linux#wayland');
|
|
28
28
|
}
|
|
29
29
|
/* First we want to check if the user is using a debian distribution.
|
|
30
30
|
* and in the following if libfuse2 is installed.
|
|
@@ -41,7 +41,7 @@ export class UiControllerLinux extends UiControllerFacade {
|
|
|
41
41
|
yield runCommand('dpkg -s libfuse2 | grep Status');
|
|
42
42
|
}
|
|
43
43
|
catch (_a) {
|
|
44
|
-
throw new LibfuseError('Libfuse2 package is missing: https://docs.askui.com/docs/general/Troubleshooting/
|
|
44
|
+
throw new LibfuseError('Libfuse2 package is missing: https://docs.askui.com/docs/general/Troubleshooting/linux#libfuse2');
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
47
|
}
|
|
@@ -9,6 +9,6 @@ export class Credentials {
|
|
|
9
9
|
return Buffer.from(`${this.userName}:${this.credentials.token}`);
|
|
10
10
|
}
|
|
11
11
|
get userName() {
|
|
12
|
-
return `${this.credentials.
|
|
12
|
+
return `${this.credentials.workspaceId}|${this.credentials.email}`;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -2,8 +2,8 @@ import { Credentials } from './credentials';
|
|
|
2
2
|
describe('Credentials', () => {
|
|
3
3
|
describe('base64Encoded()', () => {
|
|
4
4
|
test('should return base64-encoded credentials', () => {
|
|
5
|
-
const credentials = new Credentials({
|
|
6
|
-
expect(credentials.base64Encoded).toBe('
|
|
5
|
+
const credentials = new Credentials({ workspaceId: 'id123', email: 'name@tenant.com', token: 'password' });
|
|
6
|
+
expect(credentials.base64Encoded).toBe('aWQxMjN8bmFtZUB0ZW5hbnQuY29tOnBhc3N3b3Jk');
|
|
7
7
|
});
|
|
8
8
|
});
|
|
9
9
|
});
|
|
@@ -4,7 +4,7 @@ import { ClientHttpClientError } from './client-http-client-error';
|
|
|
4
4
|
import { UnkownHttpClientError } from './unkown-http-client-error';
|
|
5
5
|
export { GeneralHttpClientError } from './general-http-client-error';
|
|
6
6
|
export function httpClientErrorHandler(responseCode, errorMessage) {
|
|
7
|
-
const diplayedMessage = `
|
|
7
|
+
const diplayedMessage = `HTTP Status Code: ${responseCode}. Message:${errorMessage}`;
|
|
8
8
|
if (responseCode >= 400 && responseCode < 500) {
|
|
9
9
|
if (responseCode === 401 || responseCode === 403) {
|
|
10
10
|
return new AuthenticationHttpClientError(diplayedMessage);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "askui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"main": "./dist/cjs/main.js",
|
|
5
5
|
"module": "./dist/esm/main.js",
|
|
6
6
|
"bin": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"lint": "eslint --cache --fix --max-warnings 0 \"./**/*.{js,ts}\"",
|
|
15
15
|
"lint:staged": "lint-staged",
|
|
16
16
|
"test": "jest '/src'",
|
|
17
|
-
"postinstall": "
|
|
17
|
+
"postinstall": "node -e \"require('./bin/askui-postinstall')\""
|
|
18
18
|
},
|
|
19
19
|
"files": [
|
|
20
20
|
"dist/cjs/",
|