askui 0.21.2 → 0.23.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.
@@ -192,46 +192,6 @@ export class FluentFilters extends FluentBase {
192
192
  this._textStr += 'button';
193
193
  return new FluentFiltersOrRelations(this);
194
194
  }
195
- /**
196
- *
197
- * @param {number} index - element index
198
- *
199
- * @return {FluentFiltersOrRelations}
200
- */
201
- row(index) {
202
- this._textStr = '';
203
- this._textStr += 'row';
204
- this._textStr += ` ${index}`;
205
- return new FluentFiltersOrRelations(this);
206
- }
207
- /**
208
- *
209
- * @param {number} index - element index
210
- *
211
- * @return {FluentFiltersOrRelations}
212
- */
213
- column(index) {
214
- this._textStr = '';
215
- this._textStr += 'column';
216
- this._textStr += ` ${index}`;
217
- return new FluentFiltersOrRelations(this);
218
- }
219
- /**
220
- *
221
- * @param {number} row_index - row index
222
- * @param {number} column_index - column index
223
- *
224
- * @return {FluentFiltersOrRelations}
225
- */
226
- cell(row_index, column_index) {
227
- this._textStr = '';
228
- this._textStr += 'cell';
229
- this._textStr += ' row';
230
- this._textStr += ` ${row_index}`;
231
- this._textStr += ' column';
232
- this._textStr += ` ${column_index}`;
233
- return new FluentFiltersOrRelations(this);
234
- }
235
195
  /**
236
196
  * Filters for a UI element 'table'.
237
197
  *
@@ -576,47 +536,6 @@ export class FluentFilters extends FluentBase {
576
536
  this._textStr += ` ${Separators.STRING}${text}${Separators.STRING}`;
577
537
  return new FluentFiltersOrRelations(this);
578
538
  }
579
- /**
580
- * Filters elements based on a textual description.
581
- *
582
- * **What Should I Write as Matching Text**
583
- *
584
- * The text description inside the `matching()` should describe the element visually.
585
- * It understands color, some famous company/product names, general descriptions.
586
- *
587
- * **Important: _Matching only returns the best matching element when you use it with `get()`_**
588
- *
589
- * A bit of playing around to find a matching description is sometimes needed:
590
- * For example, `puzzle piece` can fail while `an icon showing a puzzle piece` might work.
591
- * Generally, the more detail the better.
592
- *
593
- * We also recommend to not restrict the type of element by using the general selector `element()` as shown in the examples below.
594
- *
595
- * **Examples:**
596
- * ```typescript
597
- * // Select the black sneaker from a bunch of sneakers
598
- * await aui.click().element().matching('a black sneaker shoe').exec();
599
- *
600
- * // Select an image that has text in it
601
- * await aui.click().element().matching('has Burger King in it').exec();
602
- * await aui.click().element().matching('has adidas in it').exec();
603
- *
604
- * // Target a logo/image by describing it
605
- * await aui.click().element().matching('a mask on purple background and a firefox logo').exec();
606
- * await aui.click().element().matching('logo looking like an apple with one bite bitten off').exec();
607
- * await aui.click().element().matching('logo looking like a seashell').exec();
608
- * ```
609
- *
610
- * @param {string} text - A description of the target element.
611
- *
612
- * @return {FluentFiltersOrRelations}
613
- */
614
- matching(text) {
615
- this._textStr = '';
616
- this._textStr += 'matching';
617
- this._textStr += ` ${Separators.STRING}${text}${Separators.STRING}`;
618
- return new FluentFiltersOrRelations(this);
619
- }
620
539
  }
621
540
  // Relations
622
541
  export class FluentFiltersOrRelations extends FluentFilters {
@@ -1226,46 +1145,6 @@ export class FluentFiltersCondition extends FluentBase {
1226
1145
  this._textStr += 'button';
1227
1146
  return new FluentFiltersOrRelationsCondition(this);
1228
1147
  }
1229
- /**
1230
- *
1231
- * @param {number} index - element index
1232
- *
1233
- * @return {FluentFiltersOrRelationsCondition}
1234
- */
1235
- row(index) {
1236
- this._textStr = '';
1237
- this._textStr += 'row';
1238
- this._textStr += ` ${index}`;
1239
- return new FluentFiltersOrRelationsCondition(this);
1240
- }
1241
- /**
1242
- *
1243
- * @param {number} index - element index
1244
- *
1245
- * @return {FluentFiltersOrRelationsCondition}
1246
- */
1247
- column(index) {
1248
- this._textStr = '';
1249
- this._textStr += 'column';
1250
- this._textStr += ` ${index}`;
1251
- return new FluentFiltersOrRelationsCondition(this);
1252
- }
1253
- /**
1254
- *
1255
- * @param {number} row_index - row index
1256
- * @param {number} column_index - column index
1257
- *
1258
- * @return {FluentFiltersOrRelationsCondition}
1259
- */
1260
- cell(row_index, column_index) {
1261
- this._textStr = '';
1262
- this._textStr += 'cell';
1263
- this._textStr += ' row';
1264
- this._textStr += ` ${row_index}`;
1265
- this._textStr += ' column';
1266
- this._textStr += ` ${column_index}`;
1267
- return new FluentFiltersOrRelationsCondition(this);
1268
- }
1269
1148
  /**
1270
1149
  * Filters for a UI element 'table'.
1271
1150
  *
@@ -1610,47 +1489,6 @@ export class FluentFiltersCondition extends FluentBase {
1610
1489
  this._textStr += ` ${Separators.STRING}${text}${Separators.STRING}`;
1611
1490
  return new FluentFiltersOrRelationsCondition(this);
1612
1491
  }
1613
- /**
1614
- * Filters elements based on a textual description.
1615
- *
1616
- * **What Should I Write as Matching Text**
1617
- *
1618
- * The text description inside the `matching()` should describe the element visually.
1619
- * It understands color, some famous company/product names, general descriptions.
1620
- *
1621
- * **Important: _Matching only returns the best matching element when you use it with `get()`_**
1622
- *
1623
- * A bit of playing around to find a matching description is sometimes needed:
1624
- * For example, `puzzle piece` can fail while `an icon showing a puzzle piece` might work.
1625
- * Generally, the more detail the better.
1626
- *
1627
- * We also recommend to not restrict the type of element by using the general selector `element()` as shown in the examples below.
1628
- *
1629
- * **Examples:**
1630
- * ```typescript
1631
- * // Select the black sneaker from a bunch of sneakers
1632
- * await aui.click().element().matching('a black sneaker shoe').exec();
1633
- *
1634
- * // Select an image that has text in it
1635
- * await aui.click().element().matching('has Burger King in it').exec();
1636
- * await aui.click().element().matching('has adidas in it').exec();
1637
- *
1638
- * // Target a logo/image by describing it
1639
- * await aui.click().element().matching('a mask on purple background and a firefox logo').exec();
1640
- * await aui.click().element().matching('logo looking like an apple with one bite bitten off').exec();
1641
- * await aui.click().element().matching('logo looking like a seashell').exec();
1642
- * ```
1643
- *
1644
- * @param {string} text - A description of the target element.
1645
- *
1646
- * @return {FluentFiltersOrRelationsCondition}
1647
- */
1648
- matching(text) {
1649
- this._textStr = '';
1650
- this._textStr += 'matching';
1651
- this._textStr += ` ${Separators.STRING}${text}${Separators.STRING}`;
1652
- return new FluentFiltersOrRelationsCondition(this);
1653
- }
1654
1492
  }
1655
1493
  // Relations
1656
1494
  export class FluentFiltersOrRelationsCondition extends FluentFiltersCondition {
@@ -2941,46 +2779,6 @@ export class FluentFiltersGetter extends FluentBase {
2941
2779
  this._textStr += 'button';
2942
2780
  return new FluentFiltersOrRelationsGetter(this);
2943
2781
  }
2944
- /**
2945
- *
2946
- * @param {number} index - element index
2947
- *
2948
- * @return {FluentFiltersOrRelationsGetter}
2949
- */
2950
- row(index) {
2951
- this._textStr = '';
2952
- this._textStr += 'row';
2953
- this._textStr += ` ${index}`;
2954
- return new FluentFiltersOrRelationsGetter(this);
2955
- }
2956
- /**
2957
- *
2958
- * @param {number} index - element index
2959
- *
2960
- * @return {FluentFiltersOrRelationsGetter}
2961
- */
2962
- column(index) {
2963
- this._textStr = '';
2964
- this._textStr += 'column';
2965
- this._textStr += ` ${index}`;
2966
- return new FluentFiltersOrRelationsGetter(this);
2967
- }
2968
- /**
2969
- *
2970
- * @param {number} row_index - row index
2971
- * @param {number} column_index - column index
2972
- *
2973
- * @return {FluentFiltersOrRelationsGetter}
2974
- */
2975
- cell(row_index, column_index) {
2976
- this._textStr = '';
2977
- this._textStr += 'cell';
2978
- this._textStr += ' row';
2979
- this._textStr += ` ${row_index}`;
2980
- this._textStr += ' column';
2981
- this._textStr += ` ${column_index}`;
2982
- return new FluentFiltersOrRelationsGetter(this);
2983
- }
2984
2782
  /**
2985
2783
  * Filters for a UI element 'table'.
2986
2784
  *
@@ -3325,47 +3123,6 @@ export class FluentFiltersGetter extends FluentBase {
3325
3123
  this._textStr += ` ${Separators.STRING}${text}${Separators.STRING}`;
3326
3124
  return new FluentFiltersOrRelationsGetter(this);
3327
3125
  }
3328
- /**
3329
- * Filters elements based on a textual description.
3330
- *
3331
- * **What Should I Write as Matching Text**
3332
- *
3333
- * The text description inside the `matching()` should describe the element visually.
3334
- * It understands color, some famous company/product names, general descriptions.
3335
- *
3336
- * **Important: _Matching only returns the best matching element when you use it with `get()`_**
3337
- *
3338
- * A bit of playing around to find a matching description is sometimes needed:
3339
- * For example, `puzzle piece` can fail while `an icon showing a puzzle piece` might work.
3340
- * Generally, the more detail the better.
3341
- *
3342
- * We also recommend to not restrict the type of element by using the general selector `element()` as shown in the examples below.
3343
- *
3344
- * **Examples:**
3345
- * ```typescript
3346
- * // Select the black sneaker from a bunch of sneakers
3347
- * await aui.click().element().matching('a black sneaker shoe').exec();
3348
- *
3349
- * // Select an image that has text in it
3350
- * await aui.click().element().matching('has Burger King in it').exec();
3351
- * await aui.click().element().matching('has adidas in it').exec();
3352
- *
3353
- * // Target a logo/image by describing it
3354
- * await aui.click().element().matching('a mask on purple background and a firefox logo').exec();
3355
- * await aui.click().element().matching('logo looking like an apple with one bite bitten off').exec();
3356
- * await aui.click().element().matching('logo looking like a seashell').exec();
3357
- * ```
3358
- *
3359
- * @param {string} text - A description of the target element.
3360
- *
3361
- * @return {FluentFiltersOrRelationsGetter}
3362
- */
3363
- matching(text) {
3364
- this._textStr = '';
3365
- this._textStr += 'matching';
3366
- this._textStr += ` ${Separators.STRING}${text}${Separators.STRING}`;
3367
- return new FluentFiltersOrRelationsGetter(this);
3368
- }
3369
3126
  }
3370
3127
  // Relations
3371
3128
  export class FluentFiltersOrRelationsGetter extends FluentFiltersGetter {
@@ -15,7 +15,7 @@ import { InferenceResponseError } from './inference-response-error';
15
15
  import { ConfigurationError } from './config-error';
16
16
  import { logger } from '../lib/logger';
17
17
  export class InferenceClient {
18
- constructor(baseUrl, httpClient, resize, workspaceId, modelComposition, apiVersion = 'v3') {
18
+ constructor(baseUrl, httpClient, resize, workspaceId, modelComposition, apiVersion = 'v1') {
19
19
  this.baseUrl = baseUrl;
20
20
  this.httpClient = httpClient;
21
21
  this.resize = resize;
@@ -53,10 +53,13 @@ export class UiControlClientDependencyBuilder {
53
53
  }
54
54
  static getClientArgsWithDefaults(clientArgs) {
55
55
  return __awaiter(this, void 0, void 0, function* () {
56
- var _a, _b, _c, _d, _e, _f;
57
- return Object.assign(Object.assign({}, clientArgs), { context: {
58
- isCi: (_b = (_a = clientArgs.context) === null || _a === void 0 ? void 0 : _a.isCi) !== null && _b !== void 0 ? _b : isCI,
59
- }, credentials: readCredentials(clientArgs), inferenceServerApiVersion: (_c = clientArgs.inferenceServerApiVersion) !== null && _c !== void 0 ? _c : 'v3', inferenceServerUrl: (_d = clientArgs.inferenceServerUrl) !== null && _d !== void 0 ? _d : 'https://inference.askui.com', proxyAgents: (_e = clientArgs.proxyAgents) !== null && _e !== void 0 ? _e : (yield envProxyAgents()), uiControllerUrl: (_f = clientArgs.uiControllerUrl) !== null && _f !== void 0 ? _f : 'http://127.0.0.1:6769' });
56
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
57
+ return Object.assign(Object.assign({}, clientArgs), { aiElementArgs: {
58
+ additionalLocations: (_b = (_a = clientArgs.aiElementArgs) === null || _a === void 0 ? void 0 : _a.additionalLocations) !== null && _b !== void 0 ? _b : [],
59
+ onLocationNotExist: (_d = (_c = clientArgs.aiElementArgs) === null || _c === void 0 ? void 0 : _c.onLocationNotExist) !== null && _d !== void 0 ? _d : 'error',
60
+ }, context: {
61
+ isCi: (_f = (_e = clientArgs.context) === null || _e === void 0 ? void 0 : _e.isCi) !== null && _f !== void 0 ? _f : isCI,
62
+ }, credentials: readCredentials(clientArgs), inferenceServerApiVersion: (_g = clientArgs.inferenceServerApiVersion) !== null && _g !== void 0 ? _g : 'v3', inferenceServerUrl: (_h = clientArgs.inferenceServerUrl) !== null && _h !== void 0 ? _h : 'https://inference.askui.com', proxyAgents: (_j = clientArgs.proxyAgents) !== null && _j !== void 0 ? _j : (yield envProxyAgents()), uiControllerUrl: (_k = clientArgs.uiControllerUrl) !== null && _k !== void 0 ? _k : 'http://127.0.0.1:6769' });
60
63
  });
61
64
  }
62
65
  }
@@ -32,6 +32,7 @@ export declare class UiControlClient extends ApiCommands {
32
32
  private workspaceId;
33
33
  private executionRuntime;
34
34
  private stepReporter;
35
+ private aiElementArgs;
35
36
  private constructor();
36
37
  static build(clientArgs?: ClientArgs): Promise<UiControlClient>;
37
38
  /**
@@ -243,12 +244,6 @@ export declare class UiControlClient extends ApiCommands {
243
244
  * @param {string} label - The textfields label.
244
245
  */
245
246
  clickTextfieldNearestTo(label: string): Promise<void>;
246
- /**
247
- * Clicks an icon based on a description.
248
- *
249
- * @param {string} description
250
- */
251
- clickIcon(description: string): Promise<void>;
252
247
  /**
253
248
  * Wait until an AskUICommand does not fail.
254
249
  *
@@ -15,11 +15,12 @@ import { logger } from '../lib/logger';
15
15
  import { UiControlClientDependencyBuilder } from './ui-control-client-dependency-builder';
16
16
  import { AIElementCollection } from '../core/ai-element/ai-element-collection';
17
17
  export class UiControlClient extends ApiCommands {
18
- constructor(workspaceId, executionRuntime, stepReporter) {
18
+ constructor(workspaceId, executionRuntime, stepReporter, aiElementArgs) {
19
19
  super();
20
20
  this.workspaceId = workspaceId;
21
21
  this.executionRuntime = executionRuntime;
22
22
  this.stepReporter = stepReporter;
23
+ this.aiElementArgs = aiElementArgs;
23
24
  this.secretText = undefined;
24
25
  }
25
26
  static build() {
@@ -27,7 +28,7 @@ export class UiControlClient extends ApiCommands {
27
28
  const builder = UiControlClientDependencyBuilder;
28
29
  const clientArgsWithDefaults = yield builder.getClientArgsWithDefaults(clientArgs);
29
30
  const { workspaceId, executionRuntime, stepReporter, } = yield builder.build(clientArgsWithDefaults);
30
- return new UiControlClient(workspaceId, executionRuntime, stepReporter);
31
+ return new UiControlClient(workspaceId, executionRuntime, stepReporter, clientArgsWithDefaults.aiElementArgs);
31
32
  });
32
33
  }
33
34
  /**
@@ -127,7 +128,7 @@ export class UiControlClient extends ApiCommands {
127
128
  return [];
128
129
  }
129
130
  // eslint-disable-next-line max-len
130
- const workspaceAIElementCollection = yield AIElementCollection.collectForWorkspaceId(this.workspaceId);
131
+ const workspaceAIElementCollection = yield AIElementCollection.collectAIElements(this.workspaceId, this.aiElementArgs);
131
132
  return workspaceAIElementCollection.getByNames(names);
132
133
  });
133
134
  }
@@ -406,16 +407,6 @@ export class UiControlClient extends ApiCommands {
406
407
  .exec();
407
408
  });
408
409
  }
409
- /**
410
- * Clicks an icon based on a description.
411
- *
412
- * @param {string} description
413
- */
414
- clickIcon(description) {
415
- return __awaiter(this, void 0, void 0, function* () {
416
- yield this.click().icon().matching(description).exec();
417
- });
418
- }
419
410
  /**
420
411
  * Wait until an AskUICommand does not fail.
421
412
  *
@@ -4,6 +4,7 @@ import { ModelCompositionBranch } from './model-composition-branch';
4
4
  import { Reporter } from '../core/reporting';
5
5
  import { Context } from './context';
6
6
  import { RetryStrategy } from './retry-strategies/retry-strategy';
7
+ import { AIElementArgs } from '../core/ai-element/ai-elements-args';
7
8
  /**
8
9
  * Context object to provide additional information about the context of (test) automation.
9
10
  *
@@ -47,6 +48,8 @@ export interface ContextArgs {
47
48
  * @property {(RetryStrategy | undefined)} [retryStrategy] - Default: `new LinearRetryStrategy()`.
48
49
  * Strategy for retrying failed requests to the inference server. This can help manage transient
49
50
  * errors or network issues, improving the reliability of interactions with the server.
51
+ * @property {AIElementArgs} [aiElementArgs] - Options for configuring how AI elements are
52
+ * collected.
50
53
  */
51
54
  export interface ClientArgs {
52
55
  readonly uiControllerUrl?: string;
@@ -59,11 +62,13 @@ export interface ClientArgs {
59
62
  readonly context?: ContextArgs | undefined;
60
63
  readonly inferenceServerApiVersion?: string;
61
64
  readonly retryStrategy?: RetryStrategy;
65
+ readonly aiElementArgs?: AIElementArgs;
62
66
  }
63
67
  export interface ClientArgsWithDefaults extends ClientArgs {
64
68
  readonly uiControllerUrl: string;
65
69
  readonly inferenceServerUrl: string;
66
70
  readonly context: Context;
67
71
  readonly inferenceServerApiVersion: string;
72
+ readonly aiElementArgs: AIElementArgs;
68
73
  readonly retryStrategy?: RetryStrategy;
69
74
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "askui",
3
- "version": "0.21.2",
3
+ "version": "0.23.0",
4
4
  "license": "MIT",
5
5
  "author": "askui GmbH <info@askui.com> (http://www.askui.com/)",
6
6
  "description": "Reliable, automated end-to-end-testing that depends on what is shown on your screen instead of the technology you are running on",