@applitools/driver 1.23.4 → 1.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.24.0](https://github.com/Applitools-Dev/sdk/compare/js/driver@1.23.5...js/driver@1.24.0) (2025-10-16)
4
+
5
+
6
+ ### Features
7
+
8
+ * use performActions (W3C) instead of touchPerform (MJSONWP) ([#3223](https://github.com/Applitools-Dev/sdk/issues/3223)) ([d4e5da8](https://github.com/Applitools-Dev/sdk/commit/d4e5da8dc19ad3c3f76de8e762be867970df3dd2))
9
+
10
+ ## [1.23.5](https://github.com/Applitools-Dev/sdk/compare/js/driver@1.23.4...js/driver@1.23.5) (2025-09-16)
11
+
12
+
13
+ ### Dependencies
14
+
15
+ * @applitools/logger bumped to 2.2.4
16
+ #### Bug Fixes
17
+
18
+ * remove duplicate tests on different sessions for same batch ([#3184](https://github.com/Applitools-Dev/sdk/issues/3184)) ([ede0d1f](https://github.com/Applitools-Dev/sdk/commit/ede0d1fd8018e14c19811903d78c273bce048f84))
19
+
3
20
  ## [1.23.4](https://github.com/Applitools-Dev/sdk/compare/js/driver@1.23.3...js/driver@1.23.4) (2025-09-09)
4
21
 
5
22
 
package/dist/element.js CHANGED
@@ -472,42 +472,60 @@ class Element {
472
472
  const xRight = effectiveRegion.x + Math.min(xRemaining + xPadding, effectiveRegion.width - xPadding);
473
473
  const [xStart, xEnd] = xDirection === 'right' ? [xRight, xLeft] : [xLeft, xRight];
474
474
  if (isPager) {
475
- actions.push([
476
- { action: 'press', y: yTrack, x: xStart },
477
- // scroll through the page
478
- { action: 'wait', ms: 170 },
479
- { action: 'moveTo', y: yTrack, x: xEnd },
480
- { action: 'release' },
481
- ]);
475
+ actions.push({
476
+ type: 'pointer',
477
+ id: 'finger1',
478
+ parameters: { pointerType: 'touch' },
479
+ actions: [
480
+ { type: 'pointerMove', duration: 0, x: xStart, y: yTrack },
481
+ { type: 'pointerDown', button: 0 },
482
+ { type: 'pause', duration: 200 },
483
+ { type: 'pointerMove', duration: 1, x: xEnd, y: yTrack },
484
+ { type: 'pointerUp', button: 0 },
485
+ ],
486
+ });
482
487
  }
483
488
  else if (environment.isAndroid) {
484
- actions.push([
485
- // move through scrolling gap (actual scrolling will be triggered only after that)
486
- { action: 'press', y: yTrack, x: xStart - xGap },
487
- { action: 'wait', ms: 100 },
488
- { action: 'moveTo', y: yTrack, x: xStart + xCompensation },
489
- { action: 'wait', ms: 100 },
490
- { action: 'moveTo', y: yTrack, x: xStart },
491
- // perform actual scrolling
492
- { action: 'wait', ms: 100 },
493
- { action: 'moveTo', y: yTrack, x: xEnd },
494
- { action: 'release' },
495
- ]);
489
+ actions.push({
490
+ type: 'pointer',
491
+ id: 'finger1',
492
+ parameters: { pointerType: 'touch' },
493
+ actions: [
494
+ // move through scrolling gap (actual scrolling will be triggered only after that)
495
+ { type: 'pointerMove', duration: 0, x: xStart - xGap, y: yTrack },
496
+ { type: 'pointerDown', button: 0 },
497
+ { type: 'pause', duration: 100 },
498
+ { type: 'pointerMove', duration: 1, x: xStart + xCompensation, y: yTrack },
499
+ { type: 'pause', duration: 100 },
500
+ { type: 'pointerMove', duration: 1, x: xStart, y: yTrack },
501
+ // Start of the main swipe
502
+ { type: 'pause', duration: 100 },
503
+ { type: 'pointerMove', duration: 1, x: xEnd, y: yTrack },
504
+ { type: 'pointerUp', button: 0 },
505
+ ],
506
+ });
496
507
  }
497
508
  else if (environment.isIOS) {
498
- actions.push([
499
- // move through scrolling gap (actual scrolling will be triggered only after that)
500
- { action: 'press', y: yTrack, x: xStart - xGap },
501
- { action: 'wait', ms: 100 },
502
- { action: 'moveTo', y: yTrack, x: xStart },
503
- // perform actual scrolling
504
- { action: 'wait', ms: 100 },
505
- { action: 'moveTo', y: yTrack, x: xEnd },
506
- // prevent inertial scrolling after release
507
- { action: 'wait', ms: 100 },
508
- { action: 'moveTo', y: yTrack + 1, x: xEnd },
509
- { action: 'release' },
510
- ]);
509
+ actions.push({
510
+ type: 'pointer',
511
+ id: 'finger1',
512
+ parameters: { pointerType: 'touch' },
513
+ actions: [
514
+ // move through scrolling gap (actual scrolling will be triggered only after that)
515
+ { type: 'pointerMove', duration: 0, x: xStart - xGap, y: yTrack },
516
+ { type: 'pointerDown', button: 0 },
517
+ { type: 'pause', duration: 100 },
518
+ { type: 'pointerMove', duration: 1, x: xStart, y: yTrack },
519
+ { type: 'pause', duration: 100 },
520
+ // perform actual scrolling
521
+ { type: 'pointerMove', duration: 1, x: xEnd, y: yTrack },
522
+ { type: 'pause', duration: 100 },
523
+ // prevent inertial scrolling after release
524
+ { type: 'pointerMove', duration: 1, x: xEnd, y: yTrack + 1 },
525
+ { type: 'pause', duration: 100 },
526
+ { type: 'pointerUp', button: 0 },
527
+ ],
528
+ });
511
529
  }
512
530
  xRemaining -= xRight - xLeft;
513
531
  }
@@ -527,54 +545,68 @@ class Element {
527
545
  const yTop = Math.max(yBottom - yRemaining, effectiveRegion.y + yPadding);
528
546
  const [yStart, yEnd] = yDirection === 'down' ? [yBottom, yTop] : [yTop, yBottom];
529
547
  if (isPager) {
530
- actions.push([
531
- { action: 'press', x: xTrack, y: yStart },
532
- // scroll through the page
533
- { action: 'wait', ms: 170 },
534
- { action: 'moveTo', x: xTrack, y: yEnd },
535
- { action: 'release' },
536
- ]);
548
+ actions.push({
549
+ type: 'pointer',
550
+ id: 'finger1',
551
+ parameters: { pointerType: 'touch' },
552
+ actions: [
553
+ { type: 'pointerMove', duration: 0, x: xTrack, y: yStart },
554
+ { type: 'pointerDown', button: 0 },
555
+ { type: 'pause', duration: 200 },
556
+ { type: 'pointerMove', duration: 1, x: xTrack, y: yEnd },
557
+ { type: 'pointerUp', button: 0 },
558
+ ],
559
+ });
537
560
  }
538
561
  else if (environment.isAndroid) {
539
- actions.push([
540
- // move through scrolling gap (actual scrolling will be triggered only after that)
541
- { action: 'press', x: xTrack, y: yStart - yGap },
542
- { action: 'wait', ms: 100 },
543
- { action: 'moveTo', x: xTrack, y: yStart + yCompensation },
544
- { action: 'wait', ms: 100 },
545
- { action: 'moveTo', x: xTrack, y: yStart },
546
- // perform actual scrolling
547
- { action: 'wait', ms: 100 },
548
- { action: 'moveTo', x: xTrack, y: yEnd },
549
- { action: 'release' },
550
- ]);
562
+ actions.push({
563
+ type: 'pointer',
564
+ id: 'finger1',
565
+ parameters: { pointerType: 'touch' },
566
+ actions: [
567
+ // move through scrolling gap (actual scrolling will be triggered only after that)
568
+ { type: 'pointerMove', duration: 0, x: xTrack, y: yStart - yGap },
569
+ { type: 'pointerDown', button: 0 },
570
+ { type: 'pause', duration: 100 },
571
+ { type: 'pointerMove', duration: 1, x: xTrack, y: yStart + yCompensation },
572
+ { type: 'pause', duration: 100 },
573
+ { type: 'pointerMove', duration: 1, x: xTrack, y: yStart },
574
+ { type: 'pause', duration: 100 },
575
+ // perform actual scrolling
576
+ { type: 'pointerMove', duration: 1, x: xTrack, y: yEnd },
577
+ { type: 'pointerUp', button: 0 },
578
+ ],
579
+ });
551
580
  }
552
581
  else if (environment.isIOS) {
553
- actions.push([
554
- // move through scrolling gap (actual scrolling will be triggered only after that)
555
- { action: 'press', x: xTrack, y: yStart - yGap },
556
- { action: 'wait', ms: 100 },
557
- { action: 'moveTo', x: xTrack, y: yStart },
558
- // perform actual scrolling
559
- { action: 'wait', ms: 100 },
560
- { action: 'moveTo', x: xTrack, y: yEnd },
561
- // prevent inertial scrolling after release
562
- { action: 'wait', ms: 100 },
563
- { action: 'moveTo', x: xTrack + 1, y: yEnd },
564
- { action: 'release' },
565
- ]);
582
+ actions.push({
583
+ type: 'pointer',
584
+ id: 'finger1',
585
+ parameters: { pointerType: 'touch' },
586
+ actions: [
587
+ // move through scrolling gap (actual scrolling will be triggered only after that)
588
+ { type: 'pointerMove', duration: 0, x: xTrack, y: yStart - yGap },
589
+ { type: 'pointerDown', button: 0 },
590
+ { type: 'pause', duration: 100 },
591
+ { type: 'pointerMove', duration: 1, x: xTrack, y: yStart },
592
+ // perform actual scrolling
593
+ { type: 'pause', duration: 100 },
594
+ { type: 'pointerMove', duration: 1, x: xTrack, y: yEnd },
595
+ // 3. The "brake" to prevent inertia
596
+ { type: 'pause', duration: 100 },
597
+ { type: 'pointerMove', duration: 1, x: xTrack + 1, y: yEnd },
598
+ { type: 'pause', duration: 100 },
599
+ // prevent inertial scrolling after release
600
+ { type: 'pointerUp', button: 0 },
601
+ ],
602
+ });
566
603
  }
567
604
  yRemaining -= yBottom - yTop;
568
605
  }
569
- // ios actions should be executed one-by-one sequentially, otherwise the result isn't stable
606
+ // actions should be executed one-by-one sequentially, otherwise the result isn't stable
570
607
  // pages should be scrolled one-by-one as well
571
- if (isPager || environment.isIOS) {
572
- for (const action of actions) {
573
- await this._spec.performAction(this.driver.target, action);
574
- }
575
- }
576
- else if (actions.length > 0) {
577
- await this._spec.performAction(this.driver.target, actions.flat());
608
+ for (const action of actions) {
609
+ await this._spec.performAction(this.driver.target, [action]);
578
610
  }
579
611
  const actualScrollableRegion = await this.getClientRegion();
580
612
  this._state.scrollOffset = utils.geometry.offsetNegative(requiredOffset, {
@@ -6,8 +6,8 @@ const { inspect } = require('util');
6
6
  const utils = require('@applitools/utils');
7
7
  const snippets = require('@applitools/snippets');
8
8
  const WELL_KNOWN_SCRIPTS = {
9
- 'dom-snapshot': script => /\/\* @applitools\/dom-snapshot@[\d.]+ \*\//.test(script),
10
- 'dom-capture': script => /\/\* @applitools\/dom-capture@[\d.]+ \*\//.test(script),
9
+ 'dom-snapshot': script => /\/\* @applitools\/dom-snapshot(@[\d.]+)? \*\//.test(script),
10
+ 'dom-capture': script => /\/\* @applitools\/dom-capture(@[\d.]+)? \*\//.test(script),
11
11
  };
12
12
  const DEFAULT_DESKTOP_UA = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36';
13
13
  const DEFAULT_MOBILE_UA = 'Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Mobile Safari/537.36';
@@ -20,9 +20,17 @@ class HelperIOS {
20
20
  var _a, _b;
21
21
  const { x, y } = await this._spec.getElementRegion(this._driver.target, this._element.target);
22
22
  await this._spec.performAction(this._driver.target, [
23
- { action: 'press', x, y },
24
- { action: 'wait', ms: 300 },
25
- { action: 'release' },
23
+ {
24
+ type: 'pointer',
25
+ id: 'finger1',
26
+ parameters: { pointerType: 'touch' },
27
+ actions: [
28
+ { type: 'pointerMove', duration: 0, x, y },
29
+ { type: 'pointerDown', button: 0 },
30
+ { type: 'pause', duration: 300 },
31
+ { type: 'pointerUp', button: 0 },
32
+ ],
33
+ },
26
34
  ]);
27
35
  const sizeLabel = await this._driver.element({ type: 'name', selector: 'applitools_content_size_label' });
28
36
  const sizeString = await (sizeLabel === null || sizeLabel === void 0 ? void 0 : sizeLabel.getText());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/driver",
3
- "version": "1.23.4",
3
+ "version": "1.24.0",
4
4
  "description": "Applitools universal framework wrapper",
5
5
  "keywords": [
6
6
  "applitools",
@@ -73,7 +73,7 @@
73
73
  "test": "run --top-level mocha './test/**/*.spec.ts'"
74
74
  },
75
75
  "dependencies": {
76
- "@applitools/logger": "2.2.3",
76
+ "@applitools/logger": "2.2.4",
77
77
  "@applitools/snippets": "2.7.0",
78
78
  "@applitools/utils": "1.12.0",
79
79
  "semver": "7.6.2"
@@ -11,6 +11,14 @@ export type SpecType<TDriver = unknown, TContext = unknown, TElement = unknown,
11
11
  secondary: TSecondary;
12
12
  userFunction: UserFunction;
13
13
  };
14
+ export type DriverAction = {
15
+ type: string;
16
+ id: string;
17
+ parameters: {
18
+ pointerType: string;
19
+ };
20
+ actions: any[];
21
+ };
14
22
  export interface SpecDriver<T extends SpecType> {
15
23
  /**
16
24
  * Assures that the given driver has a speced type.
@@ -128,7 +136,7 @@ export interface SpecDriver<T extends SpecType> {
128
136
  getTitle?(driver: T['driver']): Promise<string>;
129
137
  getUrl?(driver: T['driver']): Promise<string>;
130
138
  visit?(driver: T['driver'], url: string): Promise<void>;
131
- performAction?(driver: T['driver'], steps: any[]): Promise<void>;
139
+ performAction?(driver: T['driver'], steps: DriverAction[]): Promise<void>;
132
140
  takeScreenshot(driver: T['driver']): Promise<Uint8Array | string>;
133
141
  getCurrentWorld?(driver: T['driver']): Promise<string>;
134
142
  getWorlds?(driver: T['driver']): Promise<string[]>;