@testring/plugin-selenium-driver 0.6.14-alpha.2 → 0.6.14-alpha.3

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.
@@ -18,9 +18,7 @@ const logger_1 = require("@testring/logger");
18
18
  const dwnld_collector_crx_1 = require("@testring/dwnld-collector-crx");
19
19
  const devtool_extension_1 = require("@testring/devtool-extension");
20
20
  const code_coverage_client_1 = require("@nullcc/code-coverage-client");
21
- // Stupidly needed thing for making our own requests
22
- const _webdriverReq = require('webdriver/build/request');
23
- const WebDriverRequest = _webdriverReq.default;
21
+ const webdriver_1 = require("webdriver");
24
22
  const DEFAULT_CONFIG = {
25
23
  recorderExtension: false,
26
24
  clientCheckInterval: 5 * 1000,
@@ -33,6 +31,7 @@ const DEFAULT_CONFIG = {
33
31
  // for local ChromeDriver
34
32
  args: [],
35
33
  },
34
+ 'wdio:enforceWebDriverClassic': true
36
35
  },
37
36
  cdpCoverage: false,
38
37
  };
@@ -339,16 +338,6 @@ class SeleniumPlugin {
339
338
  });
340
339
  }
341
340
  addCustromMethods(client) {
342
- // Creating our delete selenium session to be able to close
343
- // session if it's id is changed while we are running test
344
- client.addCommand('deleteSessionId', function (sessionId) {
345
- const { w3cCaps, jsonwpCaps } = this.options.requestedCapabilities;
346
- const sessionDeleteRequest = new WebDriverRequest('DELETE', '/session/:sessionId', {
347
- capabilities: w3cCaps, // W3C compliant
348
- desiredCapabilities: jsonwpCaps, // JSONWP compliant
349
- });
350
- return sessionDeleteRequest.makeRequest(this.options, sessionId);
351
- }, false);
352
341
  return client;
353
342
  }
354
343
  end(applicant) {
@@ -376,7 +365,10 @@ class SeleniumPlugin {
376
365
  `Session ids are not equal, started with - ${startingSessionID}, ended with - ${sessionID}`, () => __awaiter(this, void 0, void 0, function* () {
377
366
  try {
378
367
  if (startingSessionID) {
379
- yield client.deleteSessionId(startingSessionID);
368
+ const attachedClient = webdriver_1.default.attachToSession({
369
+ sessionId: startingSessionID,
370
+ });
371
+ yield attachedClient.deleteSession();
380
372
  }
381
373
  }
382
374
  catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testring/plugin-selenium-driver",
3
- "version": "0.6.14-alpha.2",
3
+ "version": "0.6.14-alpha.3",
4
4
  "main": "./dist/index.js",
5
5
  "typings": "./src/index.ts",
6
6
  "repository": {
@@ -11,12 +11,12 @@
11
11
  "license": "MIT",
12
12
  "dependencies": {
13
13
  "@nullcc/code-coverage-client": "1.4.2",
14
- "@testring/child-process": "0.6.14-alpha.2",
15
- "@testring/devtool-extension": "0.6.14-alpha.2",
16
- "@testring/dwnld-collector-crx": "0.6.14-alpha.2",
17
- "@testring/logger": "0.6.14-alpha.2",
18
- "@testring/plugin-api": "0.6.14-alpha.2",
19
- "@testring/types": "0.6.14-alpha.2",
14
+ "@testring/child-process": "0.6.14-alpha.3",
15
+ "@testring/devtool-extension": "0.6.14-alpha.3",
16
+ "@testring/dwnld-collector-crx": "0.6.14-alpha.3",
17
+ "@testring/logger": "0.6.14-alpha.3",
18
+ "@testring/plugin-api": "0.6.14-alpha.3",
19
+ "@testring/types": "0.6.14-alpha.3",
20
20
  "@types/deepmerge": "2.2.3",
21
21
  "@types/node": "22.8.5",
22
22
  "@wdio/types": "9.2.2",
@@ -19,14 +19,10 @@ import type {
19
19
  } from 'webdriverio';
20
20
  import type {JsonCompatible} from '@wdio/types';
21
21
  import type {RespondWithOptions} from 'webdriverio/build/utils/interception/types';
22
-
23
- // Stupidly needed thing for making our own requests
24
- const _webdriverReq = require('webdriver/build/request');
25
- const WebDriverRequest = _webdriverReq.default;
22
+ import webdriver from 'webdriver';
26
23
 
27
24
  type BrowserObjectCustom = WebdriverIO.Browser & {
28
25
  sessionId: string;
29
- deleteSessionId: (sessionId: string) => Promise<void>;
30
26
  };
31
27
 
32
28
  type browserClientItem = {
@@ -48,6 +44,7 @@ const DEFAULT_CONFIG: SeleniumPluginConfig = {
48
44
  // for local ChromeDriver
49
45
  args: [] as string[],
50
46
  },
47
+ 'wdio:enforceWebDriverClassic': true
51
48
  },
52
49
  cdpCoverage: false,
53
50
  };
@@ -437,31 +434,6 @@ export class SeleniumPlugin implements IBrowserProxyPlugin {
437
434
  protected addCustromMethods(
438
435
  client: BrowserObjectCustom,
439
436
  ): BrowserObjectCustom {
440
- // Creating our delete selenium session to be able to close
441
- // session if it's id is changed while we are running test
442
- client.addCommand(
443
- 'deleteSessionId',
444
- function (sessionId) {
445
- const {w3cCaps, jsonwpCaps} =
446
- this.options.requestedCapabilities;
447
-
448
- const sessionDeleteRequest = new WebDriverRequest(
449
- 'DELETE',
450
- '/session/:sessionId',
451
- {
452
- capabilities: w3cCaps, // W3C compliant
453
- desiredCapabilities: jsonwpCaps, // JSONWP compliant
454
- },
455
- );
456
-
457
- return sessionDeleteRequest.makeRequest(
458
- this.options,
459
- sessionId,
460
- );
461
- },
462
- false,
463
- );
464
-
465
437
  return client as BrowserObjectCustom;
466
438
  }
467
439
 
@@ -496,7 +468,10 @@ export class SeleniumPlugin implements IBrowserProxyPlugin {
496
468
  async () => {
497
469
  try {
498
470
  if (startingSessionID) {
499
- await client.deleteSessionId(startingSessionID);
471
+ const attachedClient = webdriver.attachToSession({
472
+ sessionId: startingSessionID,
473
+ });
474
+ await attachedClient.deleteSession();
500
475
  }
501
476
  } catch (err) {
502
477
  this.logger.error(