@applitools/nlp-web-runner 5.6.1 → 5.7.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.
@@ -118,7 +118,7 @@ type TypeAction = {
118
118
  type: 'type';
119
119
  value: AnyExpression | Extractor<ElementDescriptor, any> | Generator$1;
120
120
  secret?: boolean;
121
- element?: ElementDescriptor | ChromeElementDescriptor;
121
+ element?: ElementDescriptor | ChromeElementDescriptor | DialogElementDescriptor;
122
122
  };
123
123
  type SearchAction = {
124
124
  type: 'search';
@@ -141,6 +141,10 @@ type ClickChromeElementAction = {
141
141
  type: 'click';
142
142
  element: ChromeElementDescriptor;
143
143
  };
144
+ type ClickDialogElementAction = {
145
+ type: 'click';
146
+ element: DialogElementDescriptor;
147
+ };
144
148
  type HoverAction = {
145
149
  type: 'hover';
146
150
  element: ElementDescriptor;
@@ -175,11 +179,6 @@ type ScrollTheElementAction = {
175
179
  distance: NumberExpression;
176
180
  times?: NumberExpression;
177
181
  };
178
- type AlertAction = {
179
- type: 'alert';
180
- value: boolean;
181
- condition?: ElementCondition;
182
- };
183
182
  type NavigatePdfAction = {
184
183
  type: 'navigate pdf';
185
184
  page: NumberExpression;
@@ -212,7 +211,7 @@ type CloseTargetAction = {
212
211
  };
213
212
  type CloseAction = {
214
213
  type: 'close';
215
- element: ElementDescriptor;
214
+ element: ElementDescriptor | DialogDescriptor;
216
215
  };
217
216
  type SwitchTargetByIndexAction = {
218
217
  type: 'switch target';
@@ -242,7 +241,7 @@ type IntentAction = {
242
241
  type: 'intent';
243
242
  description: string;
244
243
  };
245
- type Action<TType extends string> = Extract<EmptyAction | CommentAction | SetVariableAction | SetValueAction | FetchAction | AssertAction | EvaluateAction | FocusAction | CheckAction | ClearAction | EraseAction | TypeAction | HitKeyAction | SearchAction | ClickElementAction | ClickChromeElementAction | HoverAction | ScrollByDistanceAction | ScrollByFractionAction | ScrollToPositionAction | ScrollToElementAction | ScrollTheElementAction | AlertAction | NavigateToUrlAction | NavigateThroughHistoryAction | NavigatePdfAction | RefreshAction | CreateTargetAction | CloseTargetAction | CloseAction | SwitchTargetByIndexAction | SwitchTargetByTitleAction | SwitchTargetByPositionAction | WaitAction | GoAction | FindAction | VisualCheckAction | IntentAction, {
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, {
246
245
  type: TType;
247
246
  }>;
248
247
  type Instruction = Action<any> | ControlFlow;
@@ -504,11 +503,15 @@ type RelativeAnchorDescriptor<TElement = ElementDescriptor> = {
504
503
  };
505
504
  type AbsoluteAnchorDescriptor<TElement = ElementDescriptor> = {
506
505
  position: AbsolutePosition | AbsolutePosition[];
507
- element?: TElement | ViewportDescriptor;
506
+ element?: TElement | ViewportDescriptor | DialogDescriptor;
508
507
  };
509
508
  type DialogDescriptor = {
510
509
  isDialogDescriptor: true;
511
510
  };
511
+ type DialogElementDescriptor = {
512
+ isDialogElementDescriptor: true;
513
+ title: 'ok' | 'cancel' | 'prompt';
514
+ };
512
515
  type ChromeElementDescriptor = {
513
516
  isChromeElementDescriptor: true;
514
517
  title: 'refresh' | 'back' | 'forward' | 'url';
@@ -520,11 +523,6 @@ type CharacterKey = 'Backquote' | 'Digit1' | 'Digit2' | 'Digit3' | 'Digit4' | 'D
520
523
  type ArrowKey = 'ArrowUp' | 'ArrowDown' | 'ArrowLeft' | 'ArrowRight';
521
524
  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';
522
525
  type Key = ControlKey | ArrowKey | CharacterKey;
523
- type ElementCondition = {
524
- type: ConditionType;
525
- element?: ElementDescriptor;
526
- };
527
- type ConditionType = 'exists' | 'not-exists' | 'visible' | 'not-visible' | 'clickable';
528
526
  type ElementType = StructuralType | ControlType | ContentType;
529
527
  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';
530
528
  type ControlType = 'checkboxgroup' | 'checkbox' | 'radiogroup' | 'radio' | 'textbox' | 'combobox' | 'listbox' | 'option' | 'datepicker' | 'timepicker' | 'datetimepicker' | 'colorpicker' | 'filepicker' | 'slider' | 'inputbox' | 'selectbox' | 'valuebox' | 'button' | 'color';
@@ -711,6 +709,7 @@ declare class Rectangle {
711
709
  width: number;
712
710
  height: number;
713
711
  }): Rectangle;
712
+ /** Builds the axis-aligned bounding box of a CDP quad, whose 4 corners come in transform-dependent order. */
714
713
  static fromQuad(quad: number[]): Rectangle;
715
714
  readonly left: number;
716
715
  readonly top: number;
@@ -773,7 +772,7 @@ declare class Rectangle {
773
772
  //#region src/patterns.d.ts
774
773
  type Match = (text: string) => string | null;
775
774
  //#endregion
776
- //#region dist/_inline/_chunks/script-De9VUKC6.d.ts
775
+ //#region dist/_inline/_chunks/script-DKZ-WCFT.d.ts
777
776
  //#region src/port.d.ts
778
777
  interface PortMessageEvent<TName extends string = string, TPayload = unknown> extends Event {
779
778
  readonly name: TName;
@@ -1241,6 +1240,13 @@ declare class WebNode<TNode extends globalThis.Node = Element | Text> implements
1241
1240
  button?: 'left' | 'middle' | 'right' | 'back' | 'forward';
1242
1241
  times?: number;
1243
1242
  }): Promise<void>;
1243
+ scrollIntoView({
1244
+ block,
1245
+ inline
1246
+ }?: {
1247
+ block?: ScrollLogicalPosition;
1248
+ inline?: ScrollLogicalPosition;
1249
+ }): Promise<void>;
1244
1250
  tryToUnobscure(): Promise<void>;
1245
1251
  isVisible(): Promise<boolean>;
1246
1252
  getObscurationInfo(): Promise<{
@@ -1291,6 +1297,7 @@ type BlockingDialogOptions = {
1291
1297
  };
1292
1298
  declare function makeBlockingDialog(options: BlockingDialogOptions): BlockingDialog;
1293
1299
  declare class BlockingDialog extends EventTargetNode<DialogEventMap> {
1300
+ #private;
1294
1301
  readonly target: Target;
1295
1302
  readonly type: 'alert' | 'confirm' | 'prompt' | 'beforeunload';
1296
1303
  readonly message: string;
@@ -1299,6 +1306,8 @@ declare class BlockingDialog extends EventTargetNode<DialogEventMap> {
1299
1306
  type,
1300
1307
  message
1301
1308
  }: BlockingDialogOptions);
1309
+ /** Whether the dialog was closed programmatically (as opposed to by the user). */
1310
+ get handled(): boolean;
1302
1311
  handle(ok: boolean, text?: string): Promise<void>;
1303
1312
  }
1304
1313
  type FilepickerDialogOptions = {
@@ -1828,7 +1837,14 @@ declare class TargetFrameTargetCreatedEvent extends Event {
1828
1837
  declare class TargetDialogEvent extends Event {
1829
1838
  readonly state: 'opened' | 'closed';
1830
1839
  readonly dialog: BlockingDialog;
1831
- constructor(state: 'opened' | 'closed', dialog: BlockingDialog);
1840
+ /** Whether the dialog was confirmed (only on `closed`). */
1841
+ readonly result?: boolean;
1842
+ /** The prompt input the dialog was confirmed with (only on `closed`). */
1843
+ readonly value?: string;
1844
+ constructor(state: 'opened' | 'closed', dialog: BlockingDialog, options?: {
1845
+ result?: boolean;
1846
+ value?: string;
1847
+ });
1832
1848
  }
1833
1849
  declare class TargetFilepickerDialogEvent extends Event {
1834
1850
  readonly dialog: FilepickerDialog;
@@ -9183,6 +9199,7 @@ declare const ErrorCode: {
9183
9199
  readonly ELEMENT_NOT_CLEARABLE: "ELEMENT_NOT_CLEARABLE";
9184
9200
  readonly UNHANDLED_DIALOG: "UNHANDLED_DIALOG";
9185
9201
  readonly NO_ELEMENT: "NO_ELEMENT";
9202
+ readonly ILLEGAL_ELEMENT_DESCRIPTOR: "ILLEGAL_ELEMENT_DESCRIPTOR";
9186
9203
  readonly NO_OPTION: "NO_OPTION";
9187
9204
  readonly NO_DIALOG: "NO_DIALOG";
9188
9205
  readonly CONDITION_TIMED_OUT: "CONDITION_TIMED_OUT";
@@ -9310,6 +9327,10 @@ declare abstract class Handler$1<TAutomator extends Automator, TInstruction exte
9310
9327
  mobile: IAXNodeView<IOSNode> | null;
9311
9328
  }[TAutomator["type"]]>;
9312
9329
  capture(): Promise<Capture | undefined>;
9330
+ /** Best-effort scroll bringing the elements matched by this handler into the viewport, so the
9331
+ * `after` capture shows them. Call it after the instruction's page reads are done — the scroll
9332
+ * persists. No-op without `shouldCapture` or off web. */
9333
+ reveal(): Promise<void>;
9313
9334
  before(): Promise<void>;
9314
9335
  after(): Promise<void>;
9315
9336
  }
@@ -9574,6 +9595,9 @@ declare class ClickHandler$1 extends Handler$1<Browser, Action<'click'>> {
9574
9595
  handle(): Promise<{
9575
9596
  status: "success";
9576
9597
  }>;
9598
+ handleWithDialogElementDescriptor(descriptor: DialogElementDescriptor): Promise<{
9599
+ status: "success";
9600
+ }>;
9577
9601
  handleWithChromeElementDescriptor(descriptor: ChromeElementDescriptor): Promise<{
9578
9602
  status: "success";
9579
9603
  }>;
@@ -9587,6 +9611,9 @@ declare class TypeHandler$1 extends Handler$1<Browser, Action<'type'>> {
9587
9611
  handle(): Promise<{
9588
9612
  status: "success";
9589
9613
  }>;
9614
+ handleWithDialogElementDescriptor(): Promise<{
9615
+ status: "success";
9616
+ }>;
9590
9617
  }
9591
9618
  //#endregion
9592
9619
  //#region src/handlers/web/clear.d.ts
@@ -9726,13 +9753,6 @@ declare class GoHandler extends Handler$1<Browser, Action<'go'>, NavigateResult
9726
9753
  }>;
9727
9754
  }
9728
9755
  //#endregion
9729
- //#region src/handlers/web/handle-dialog.d.ts
9730
- declare class HandleDialogHandler extends Handler$1<Browser, Action<'alert'>> {
9731
- handle(): Promise<{
9732
- status: "success";
9733
- }>;
9734
- }
9735
- //#endregion
9736
9756
  //#region src/handlers/web/hit-key.d.ts
9737
9757
  declare class HitKeyHandler extends Handler$1<Browser, Action<'hit key'>> {
9738
9758
  handle(): Promise<{
@@ -9848,7 +9868,6 @@ declare const handlers: {
9848
9868
  evaluate: typeof EvaluateHandler;
9849
9869
  find: typeof FindHandler$1;
9850
9870
  focus: typeof FocusHandler$1;
9851
- alert: typeof HandleDialogHandler;
9852
9871
  'hit key': typeof HitKeyHandler;
9853
9872
  hover: typeof HoverHandler;
9854
9873
  navigate: typeof NavigateHandler;
@@ -9901,7 +9920,6 @@ declare const handlers: {
9901
9920
  "hit key": never;
9902
9921
  search: never;
9903
9922
  hover: never;
9904
- alert: never;
9905
9923
  navigate: never;
9906
9924
  "navigate pdf": never;
9907
9925
  refresh: never;