@applitools/nlp-web-runner 5.9.1 → 5.10.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.
@@ -206,24 +206,13 @@ type CreateTargetAction = {
206
206
  type: 'create target';
207
207
  url?: StringExpression;
208
208
  };
209
- type CloseTargetAction = {
210
- type: 'close target';
211
- };
212
209
  type CloseAction = {
213
210
  type: 'close';
214
- element: ElementDescriptor | DialogDescriptor;
215
- };
216
- type SwitchTargetByIndexAction = {
217
- type: 'switch target';
218
- index: NumberExpression;
219
- };
220
- type SwitchTargetByTitleAction = {
221
- type: 'switch target';
222
- title: StringExpression;
211
+ element: ElementDescriptor | DialogDescriptor | ChromeTabDescriptor;
223
212
  };
224
- type SwitchTargetByPositionAction = {
225
- type: 'switch target';
226
- position: SequentialRelativePosition;
213
+ type SwitchAction = {
214
+ type: 'switch';
215
+ element: ElementDescriptor | ChromeTabDescriptor;
227
216
  };
228
217
  type WaitAction = {
229
218
  type: 'wait';
@@ -241,7 +230,7 @@ type IntentAction = {
241
230
  type: 'intent';
242
231
  description: string;
243
232
  };
244
- type Action<TType extends string> = Extract<EmptyAction | CommentAction | SetVariableAction | SetValueAction | FetchAction | AssertAction | EvaluateAction | FocusAction | CheckAction | ClearAction | EraseAction | TypeAction | HitKeyAction | SearchAction | ClickElementAction | ClickChromeElementAction | ClickDialogElementAction | HoverAction | ScrollByDistanceAction | ScrollByFractionAction | ScrollToPositionAction | ScrollToElementAction | ScrollTheElementAction | NavigateToUrlAction | NavigateThroughHistoryAction | NavigatePdfAction | RefreshAction | CreateTargetAction | CloseTargetAction | CloseAction | SwitchTargetByIndexAction | SwitchTargetByTitleAction | SwitchTargetByPositionAction | WaitAction | GoAction | FindAction | VisualCheckAction | IntentAction, {
233
+ type Action<TType extends string> = Extract<EmptyAction | CommentAction | SetVariableAction | SetValueAction | FetchAction | AssertAction | EvaluateAction | FocusAction | CheckAction | ClearAction | EraseAction | TypeAction | HitKeyAction | SearchAction | ClickElementAction | ClickChromeElementAction | ClickDialogElementAction | HoverAction | ScrollByDistanceAction | ScrollByFractionAction | ScrollToPositionAction | ScrollToElementAction | ScrollTheElementAction | NavigateToUrlAction | NavigateThroughHistoryAction | NavigatePdfAction | RefreshAction | CreateTargetAction | CloseAction | SwitchAction | WaitAction | GoAction | FindAction | VisualCheckAction | IntentAction, {
245
234
  type: TType;
246
235
  }>;
247
236
  type Instruction = Action<any> | ControlFlow;
@@ -513,9 +502,27 @@ type DialogElementDescriptor = {
513
502
  isDialogElementDescriptor: true;
514
503
  title: 'ok' | 'cancel' | 'prompt';
515
504
  };
516
- type ChromeElementDescriptor = {
505
+ type ChromeElementDescriptor = ChromeButtonDescriptor | ChromeTextboxDescriptor | ChromeTabDescriptor | ChromeTablistDescriptor;
506
+ type ChromeButtonDescriptor = {
507
+ isChromeElementDescriptor: true;
508
+ type: 'button';
509
+ title: 'refresh' | 'back' | 'forward';
510
+ };
511
+ type ChromeTextboxDescriptor = {
512
+ isChromeElementDescriptor: true;
513
+ type: 'textbox';
514
+ title: 'url';
515
+ };
516
+ type ChromeTabDescriptor = {
517
+ isChromeElementDescriptor: true;
518
+ type: 'tab';
519
+ index?: NumberExpression;
520
+ title?: StringExpression;
521
+ position?: SequentialRelativePosition;
522
+ };
523
+ type ChromeTablistDescriptor = {
517
524
  isChromeElementDescriptor: true;
518
- title: 'refresh' | 'back' | 'forward' | 'url';
525
+ type: 'tablist';
519
526
  };
520
527
  type ViewportDescriptor = {
521
528
  isViewportDescriptor: true;
@@ -525,8 +532,8 @@ type ArrowKey = 'ArrowUp' | 'ArrowDown' | 'ArrowLeft' | 'ArrowRight';
525
532
  type ControlKey = 'Escape' | 'F1' | 'F2' | 'F3' | 'F4' | 'F5' | 'F6' | 'F7' | 'F8' | 'F9' | 'F10' | 'F11' | 'F12' | 'Backspace' | 'Tab' | 'CapsLock' | 'Enter' | 'ShiftLeft' | 'ShiftRight' | 'ControlLeft' | 'MetaLeft' | 'AltLeft' | 'Space' | 'AltRight' | 'AltGraph' | 'MetaRight' | 'ControlRight' | 'Delete' | 'Home' | 'End' | 'PageUp' | 'PageDown' | 'Insert';
526
533
  type Key = ControlKey | ArrowKey | CharacterKey;
527
534
  type ElementType = StructuralType | ControlType | ContentType;
528
- type StructuralType = 'app' | 'host' | 'ad' | 'header' | 'footer' | 'sidebar' | 'popup' | 'tooltip' | 'modal' | 'scrollable' | 'form' | 'fieldset' | 'menu' | 'menuitem' | 'hamburger' | 'list' | 'listitem' | 'heading' | 'table' | 'table-cell' | 'table-head-cell' | 'table-row' | 'table-dom-row' | 'table-leaf-row' | 'table-head-row' | 'table-column' | 'table-leaf-column' | 'table-stub-column' | 'card' | 'pdfpage';
529
- type ControlType = 'checkboxgroup' | 'checkbox' | 'radiogroup' | 'radio' | 'textbox' | 'combobox' | 'listbox' | 'option' | 'datepicker' | 'timepicker' | 'datetimepicker' | 'colorpicker' | 'filepicker' | 'slider' | 'inputbox' | 'selectbox' | 'valuebox' | 'button' | 'color';
535
+ type StructuralType = 'app' | 'host' | 'ad' | 'header' | 'footer' | 'sidebar' | 'popup' | 'tooltip' | 'modal' | 'scrollable' | 'form' | 'fieldset' | 'menu' | 'menuitem' | 'hamburger' | 'list' | 'listitem' | 'heading' | 'table' | 'table-cell' | 'table-head-cell' | 'table-row' | 'table-dom-row' | 'table-leaf-row' | 'table-head-row' | 'table-column' | 'table-leaf-column' | 'table-stub-column' | 'card' | 'pdfpage' | 'tablist' | 'tabpanel';
536
+ type ControlType = 'checkboxgroup' | 'checkbox' | 'radiogroup' | 'radio' | 'textbox' | 'combobox' | 'listbox' | 'option' | 'datepicker' | 'timepicker' | 'datetimepicker' | 'colorpicker' | 'filepicker' | 'slider' | 'inputbox' | 'selectbox' | 'valuebox' | 'button' | 'tab' | 'color';
530
537
  type ContentType = 'text' | 'link' | 'label' | 'logo' | 'image' | 'icon' | 'video' | 'paragraph';
531
538
  type HistoryDirection = 'back' | 'forward';
532
539
  type SequentialRelativePosition = 'next' | 'previous';
@@ -9233,8 +9240,20 @@ declare const ErrorCode: {
9233
9240
  };
9234
9241
  type ErrorCode = (typeof ErrorCode)[keyof typeof ErrorCode];
9235
9242
  //#endregion
9243
+ //#region src/handlers/web/browser-tab.d.ts
9244
+ /** A {@link import('@applitools/nlp-parser').ChromeTabDescriptor} after expression evaluation. */
9245
+ type ResolvedChromeTabDescriptor = {
9246
+ isChromeElementDescriptor: true;
9247
+ type: 'tab';
9248
+ index?: number;
9249
+ title?: string;
9250
+ position?: 'next' | 'previous';
9251
+ };
9252
+ /** Activates the browser tab the descriptor points at (the former `switch target` behavior). */
9253
+ declare function activateBrowserTab(automator: Browser, descriptor: ResolvedChromeTabDescriptor): Promise<void>;
9254
+ //#endregion
9236
9255
  //#region src/utils/evaluate-expression.d.ts
9237
- type EvaluatedExpression<TValue> = TValue extends ExtractOperation ? Any : TValue extends NumberExpression ? number : TValue extends SizeOperation ? number : TValue extends KeysOperation ? string[] : TValue extends ValuesOperation | EntriesOperation ? Any[] : TValue extends Condition ? boolean : TValue extends OTP ? string : TValue extends RandomValue<string> ? string | string[] : TValue extends RandomValue<number> ? number : TValue extends Reference<infer TType extends Any> ? TType : TValue extends JSExpressionReference<infer TType extends Any> ? TType : TValue extends InterpolatedString ? string : TValue extends JSExpression ? string : TValue extends Structure ? Record<string, any> | any[] : TValue extends FileHandle ? string : TValue extends Pattern ? RegExp | Match : TValue extends ChromeElementDescriptor ? ChromeElementDescriptor : TValue extends ElementDescriptor ? ResolvedElementDescriptor : TValue;
9256
+ type EvaluatedExpression<TValue> = TValue extends ExtractOperation ? Any : TValue extends NumberExpression ? number : TValue extends SizeOperation ? number : TValue extends KeysOperation ? string[] : TValue extends ValuesOperation | EntriesOperation ? Any[] : TValue extends Condition ? boolean : TValue extends OTP ? string : TValue extends RandomValue<string> ? string | string[] : TValue extends RandomValue<number> ? number : TValue extends Reference<infer TType extends Any> ? TType : TValue extends JSExpressionReference<infer TType extends Any> ? TType : TValue extends InterpolatedString ? string : TValue extends JSExpression ? string : TValue extends Structure ? Record<string, any> | any[] : TValue extends FileHandle ? string : TValue extends Pattern ? RegExp | Match : TValue extends ChromeTabDescriptor ? ResolvedChromeTabDescriptor : TValue extends ChromeElementDescriptor ? ChromeElementDescriptor : TValue extends ElementDescriptor ? ResolvedElementDescriptor : TValue;
9238
9257
  //#endregion
9239
9258
  //#region src/handler.d.ts
9240
9259
  type HandlerOptions<TAutomator extends Automator, TInstruction extends Instruction> = {
@@ -9611,6 +9630,9 @@ declare class ClickHandler$1 extends Handler$1<Browser, Action<'click'>> {
9611
9630
  handle(): Promise<{
9612
9631
  status: "success";
9613
9632
  }>;
9633
+ handleWithChromeTab(descriptor: ResolvedChromeTabDescriptor): Promise<{
9634
+ status: "success";
9635
+ }>;
9614
9636
  handleWithDialogElementDescriptor(descriptor: DialogElementDescriptor): Promise<{
9615
9637
  status: "success";
9616
9638
  }>;
@@ -9666,18 +9688,14 @@ declare class FocusHandler$1 extends Handler$1<Browser, Action<'focus'>> {
9666
9688
  }>;
9667
9689
  }
9668
9690
  //#endregion
9669
- //#region src/handlers/web/close-target.d.ts
9670
- declare class CloseTargetHandler extends Handler$1<Browser, Action<'close target'>> {
9671
- handle(): Promise<{
9672
- status: "success";
9673
- }>;
9674
- }
9675
- //#endregion
9676
9691
  //#region src/handlers/web/close.d.ts
9677
9692
  declare class CloseHandler extends Handler$1<Browser, CloseAction> {
9678
9693
  handle(): Promise<{
9679
9694
  status: "success";
9680
9695
  }>;
9696
+ handleWithChromeTab(descriptor: ResolvedChromeTabDescriptor): Promise<{
9697
+ status: "success";
9698
+ }>;
9681
9699
  }
9682
9700
  //#endregion
9683
9701
  //#region src/handlers/web/create-target.d.ts
@@ -9812,11 +9830,14 @@ declare class SetValueHandler extends Handler$1<Browser, Action<'set value'>> {
9812
9830
  }>;
9813
9831
  }
9814
9832
  //#endregion
9815
- //#region src/handlers/web/switch-target.d.ts
9816
- declare class SwitchTargetHandler extends Handler$1<Browser, Action<'switch target'>> {
9833
+ //#region src/handlers/web/switch.d.ts
9834
+ declare class SwitchHandler extends Handler$1<Browser, Action<'switch'>> {
9817
9835
  handle(): Promise<{
9818
9836
  status: "success";
9819
9837
  }>;
9838
+ handleWithChromeTab(descriptor: Parameters<typeof activateBrowserTab>[1]): Promise<{
9839
+ status: "success";
9840
+ }>;
9820
9841
  }
9821
9842
  //#endregion
9822
9843
  //#region src/handlers/mobile/check.d.ts
@@ -9878,7 +9899,6 @@ declare const handlers: {
9878
9899
  clear: typeof ClearHandler;
9879
9900
  click: typeof ClickHandler$1;
9880
9901
  close: typeof CloseHandler;
9881
- 'close target': typeof CloseTargetHandler;
9882
9902
  'create target': typeof CreateTargetHandler;
9883
9903
  erase: typeof EraseHandler;
9884
9904
  evaluate: typeof EvaluateHandler;
@@ -9892,7 +9912,7 @@ declare const handlers: {
9892
9912
  scroll: typeof ScrollHandler$1;
9893
9913
  search: typeof SearchHandler;
9894
9914
  'set value': typeof SetValueHandler;
9895
- 'switch target': typeof SwitchTargetHandler;
9915
+ switch: typeof SwitchHandler;
9896
9916
  type: typeof TypeHandler$1;
9897
9917
  'visual check': typeof VisualCheckHandler;
9898
9918
  go: typeof GoHandler;
@@ -9940,9 +9960,8 @@ declare const handlers: {
9940
9960
  "navigate pdf": never;
9941
9961
  refresh: never;
9942
9962
  "create target": never;
9943
- "close target": never;
9944
9963
  close: never;
9945
- "switch target": never;
9964
+ switch: never;
9946
9965
  go: never;
9947
9966
  };
9948
9967
  };