webdriverio 9.5.3 → 9.5.6

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.
@@ -14,8 +14,8 @@ import type { ChainablePromiseElement, DragAndDropCoordinate, DragAndDropOptions
14
14
  * <example>
15
15
  :example.test.js
16
16
  it('should demonstrate the dragAndDrop command', async () => {
17
- const elem = await $('#someElem')
18
- const target = await $('#someTarget')
17
+ const elem = $('#someElem')
18
+ const target = $('#someTarget')
19
19
 
20
20
  // drag and drop to other element
21
21
  await elem.dragAndDrop(target)
@@ -16,8 +16,8 @@ export {};
16
16
  * <example>
17
17
  :example.test.js
18
18
  it('should demonstrate the dragAndDrop command', async () => {
19
- const elem = await $('#someElem')
20
- const target = await $('#someTarget')
19
+ const elem = $('#someElem')
20
+ const target = $('#someTarget')
21
21
 
22
22
  // drag and drop to other element
23
23
  await elem.dragAndDrop(target)
package/build/index.js CHANGED
@@ -3026,7 +3026,7 @@ var SessionManager = class {
3026
3026
  }
3027
3027
  }
3028
3028
  removeListeners() {
3029
- this.#browser.off("result", this.#onCommand.bind(this));
3029
+ this.#browser.off("command", this.#onCommand.bind(this));
3030
3030
  }
3031
3031
  initialize() {
3032
3032
  return void 0;
@@ -3225,23 +3225,38 @@ var log5 = logger5("webdriverio:PolyfillManager");
3225
3225
  var NAME_POLYFILL = "var __defProp = Object.defineProperty;var __name = function (target, value) { return __defProp(target, 'name', { value: value, configurable: true }); };var __globalThis = (typeof globalThis === 'object' && globalThis) || (typeof window === 'object' && window);__globalThis.__name = __name;";
3226
3226
  var PolyfillManager = class _PolyfillManager extends SessionManager {
3227
3227
  #initialize;
3228
+ #browser;
3228
3229
  constructor(browser) {
3229
3230
  super(browser, _PolyfillManager.name);
3231
+ this.#browser = browser;
3230
3232
  if (!this.isEnabled()) {
3231
3233
  this.#initialize = Promise.resolve(true);
3232
3234
  return;
3233
3235
  }
3234
- const polyfill = (polyfill2) => {
3235
- const closure = new Function(polyfill2);
3236
- return closure();
3237
- };
3238
3236
  this.#initialize = Promise.all([
3239
- browser.addInitScript(polyfill, NAME_POLYFILL),
3240
- browser.execute(polyfill, NAME_POLYFILL)
3237
+ this.#registerScripts(),
3238
+ this.#browser.sessionSubscribe({
3239
+ events: ["browsingContext.contextCreated"]
3240
+ })
3241
3241
  ]).then(() => {
3242
3242
  log5.info("polyfill script added");
3243
3243
  return true;
3244
3244
  }, () => false);
3245
+ this.#browser.on("browsingContext.contextCreated", this.#registerScripts.bind(this));
3246
+ }
3247
+ removeListeners() {
3248
+ super.removeListeners();
3249
+ this.#browser.off("browsingContext.contextCreated", this.#registerScripts.bind(this));
3250
+ }
3251
+ #registerScripts() {
3252
+ const polyfill = (polyfill2) => {
3253
+ const closure = new Function(polyfill2);
3254
+ return closure();
3255
+ };
3256
+ return Promise.all([
3257
+ this.#browser.addInitScript(polyfill, NAME_POLYFILL),
3258
+ this.#browser.execute(polyfill, NAME_POLYFILL)
3259
+ ]);
3245
3260
  }
3246
3261
  async initialize() {
3247
3262
  return this.#initialize;
@@ -5872,15 +5887,15 @@ import { ELEMENT_KEY as ELEMENT_KEY11 } from "webdriver";
5872
5887
  import { getBrowserObject as getBrowserObject16 } from "@wdio/utils";
5873
5888
  async function dragAndDrop(target, options = {}) {
5874
5889
  const moveToCoordinates = target;
5875
- const moveToElement = target;
5890
+ const moveToElement = await target;
5876
5891
  if (
5877
5892
  /**
5878
5893
  * no target was specified
5879
5894
  */
5880
- !target || /**
5895
+ !moveToElement || /**
5881
5896
  * target is not from type element
5882
5897
  */
5883
- target.constructor.name !== "Element" && /**
5898
+ moveToElement.constructor.name !== "Element" && /**
5884
5899
  * and is also not an object with x and y number parameters
5885
5900
  */
5886
5901
  (typeof moveToCoordinates.x !== "number" || typeof moveToCoordinates.y !== "number")
@@ -5891,7 +5906,7 @@ async function dragAndDrop(target, options = {}) {
5891
5906
  const browser = getBrowserObject16(this);
5892
5907
  const defaultOptions = { duration: browser.isMobile ? 250 : 10 };
5893
5908
  const { duration } = { ...defaultOptions, ...options };
5894
- const isMovingToElement = target.constructor.name === "Element";
5909
+ const isMovingToElement = moveToElement.constructor.name === "Element";
5895
5910
  const sourceRef = { [ELEMENT_KEY11]: this[ELEMENT_KEY11] };
5896
5911
  const targetRef = { [ELEMENT_KEY11]: moveToElement[ELEMENT_KEY11] };
5897
5912
  const origin = sourceRef;
@@ -7,6 +7,7 @@ export declare const NAME_POLYFILL: string;
7
7
  export declare class PolyfillManager extends SessionManager {
8
8
  #private;
9
9
  constructor(browser: WebdriverIO.Browser);
10
+ removeListeners(): void;
10
11
  initialize(): Promise<boolean>;
11
12
  }
12
13
  //# sourceMappingURL=polyfill.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"polyfill.d.ts","sourceRoot":"","sources":["../../src/session/polyfill.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE7C,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,WAAW,CAAC,OAAO,mBAE9D;AAID,eAAO,MAAM,aAAa,QAKzB,CAAA;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,cAAc;;gBAGnC,OAAO,EAAE,WAAW,CAAC,OAAO;IAoClC,UAAU;CAGnB"}
1
+ {"version":3,"file":"polyfill.d.ts","sourceRoot":"","sources":["../../src/session/polyfill.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE7C,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,WAAW,CAAC,OAAO,mBAE9D;AAID,eAAO,MAAM,aAAa,QAKzB,CAAA;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,cAAc;;gBAInC,OAAO,EAAE,WAAW,CAAC,OAAO;IA4BxC,eAAe;IAyBT,UAAU;CAGnB"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "webdriverio",
3
3
  "description": "Next-gen browser and mobile automation test framework for Node.js",
4
- "version": "9.5.3",
4
+ "version": "9.5.6",
5
5
  "homepage": "https://webdriver.io",
6
6
  "author": "Christian Bromann <mail@bromann.dev>",
7
7
  "license": "MIT",
@@ -100,7 +100,7 @@
100
100
  "rgb2hex": "0.2.5",
101
101
  "serialize-error": "^11.0.3",
102
102
  "urlpattern-polyfill": "^10.0.0",
103
- "webdriver": "9.5.3"
103
+ "webdriver": "9.5.4"
104
104
  },
105
105
  "peerDependencies": {
106
106
  "puppeteer-core": "^22.3.0"
@@ -110,5 +110,5 @@
110
110
  "optional": true
111
111
  }
112
112
  },
113
- "gitHead": "f637de6d4711fe0e3f6d84925286481afcacc324"
113
+ "gitHead": "7b29d6eb39620bd1469ba1a3ac37407c7958e56a"
114
114
  }