@testring/plugin-selenium-driver 0.6.14-alpha.2 → 0.6.14-alpha.4
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/dist/plugin/index.js +10 -17
- package/package.json +7 -7
- package/src/plugin/index.ts +10 -35
- package/src/types.ts +1 -1
package/dist/plugin/index.js
CHANGED
|
@@ -18,21 +18,20 @@ 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
|
-
|
|
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,
|
|
27
25
|
clientTimeout: 15 * 60 * 1000,
|
|
28
26
|
port: 4444,
|
|
29
|
-
logLevel: '
|
|
27
|
+
logLevel: 'error',
|
|
30
28
|
capabilities: {
|
|
31
29
|
browserName: 'chrome',
|
|
32
30
|
'goog:chromeOptions': {
|
|
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
|
-
|
|
368
|
+
const attachedClient = webdriver_1.default.attachToSession({
|
|
369
|
+
sessionId: startingSessionID,
|
|
370
|
+
});
|
|
371
|
+
yield attachedClient.deleteSession();
|
|
380
372
|
}
|
|
381
373
|
}
|
|
382
374
|
catch (err) {
|
|
@@ -451,10 +443,11 @@ class SeleniumPlugin {
|
|
|
451
443
|
yield this.createClient(applicant);
|
|
452
444
|
const client = this.getBrowserClient(applicant);
|
|
453
445
|
const args = stringifyWindowFeatures(windowFeatures);
|
|
454
|
-
|
|
446
|
+
const newWindow = yield client.newWindow(val, {
|
|
455
447
|
windowName: windowName || this.generateWinId(),
|
|
456
448
|
windowFeatures: args,
|
|
457
449
|
});
|
|
450
|
+
return (newWindow === null || newWindow === void 0 ? void 0 : newWindow.handle) || newWindow;
|
|
458
451
|
});
|
|
459
452
|
}
|
|
460
453
|
waitForExist(applicant, xpath, timeout) {
|
|
@@ -547,7 +540,7 @@ class SeleniumPlugin {
|
|
|
547
540
|
return __awaiter(this, void 0, void 0, function* () {
|
|
548
541
|
yield this.createClient(applicant);
|
|
549
542
|
const client = this.getBrowserClient(applicant);
|
|
550
|
-
return client.
|
|
543
|
+
return client.switchFrame(frameID.toString());
|
|
551
544
|
});
|
|
552
545
|
}
|
|
553
546
|
frameParent(applicant) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testring/plugin-selenium-driver",
|
|
3
|
-
"version": "0.6.14-alpha.
|
|
3
|
+
"version": "0.6.14-alpha.4",
|
|
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.
|
|
15
|
-
"@testring/devtool-extension": "0.6.14-alpha.
|
|
16
|
-
"@testring/dwnld-collector-crx": "0.6.14-alpha.
|
|
17
|
-
"@testring/logger": "0.6.14-alpha.
|
|
18
|
-
"@testring/plugin-api": "0.6.14-alpha.
|
|
19
|
-
"@testring/types": "0.6.14-alpha.
|
|
14
|
+
"@testring/child-process": "0.6.14-alpha.4",
|
|
15
|
+
"@testring/devtool-extension": "0.6.14-alpha.4",
|
|
16
|
+
"@testring/dwnld-collector-crx": "0.6.14-alpha.4",
|
|
17
|
+
"@testring/logger": "0.6.14-alpha.4",
|
|
18
|
+
"@testring/plugin-api": "0.6.14-alpha.4",
|
|
19
|
+
"@testring/types": "0.6.14-alpha.4",
|
|
20
20
|
"@types/deepmerge": "2.2.3",
|
|
21
21
|
"@types/node": "22.8.5",
|
|
22
22
|
"@wdio/types": "9.2.2",
|
package/src/plugin/index.ts
CHANGED
|
@@ -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 = {
|
|
@@ -41,13 +37,14 @@ const DEFAULT_CONFIG: SeleniumPluginConfig = {
|
|
|
41
37
|
clientCheckInterval: 5 * 1000,
|
|
42
38
|
clientTimeout: 15 * 60 * 1000,
|
|
43
39
|
port: 4444,
|
|
44
|
-
logLevel: '
|
|
40
|
+
logLevel: 'error',
|
|
45
41
|
capabilities: {
|
|
46
42
|
browserName: 'chrome',
|
|
47
43
|
'goog:chromeOptions': {
|
|
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
|
-
|
|
471
|
+
const attachedClient = webdriver.attachToSession({
|
|
472
|
+
sessionId: startingSessionID,
|
|
473
|
+
});
|
|
474
|
+
await attachedClient.deleteSession();
|
|
500
475
|
}
|
|
501
476
|
} catch (err) {
|
|
502
477
|
this.logger.error(
|
|
@@ -590,10 +565,11 @@ export class SeleniumPlugin implements IBrowserProxyPlugin {
|
|
|
590
565
|
const client = this.getBrowserClient(applicant);
|
|
591
566
|
const args = stringifyWindowFeatures(windowFeatures);
|
|
592
567
|
|
|
593
|
-
|
|
568
|
+
const newWindow = await client.newWindow(val, {
|
|
594
569
|
windowName: windowName || this.generateWinId(),
|
|
595
570
|
windowFeatures: args,
|
|
596
571
|
});
|
|
572
|
+
return newWindow?.handle || newWindow;
|
|
597
573
|
}
|
|
598
574
|
|
|
599
575
|
public async waitForExist(
|
|
@@ -698,8 +674,7 @@ export class SeleniumPlugin implements IBrowserProxyPlugin {
|
|
|
698
674
|
public async frame(applicant: string, frameID: number) {
|
|
699
675
|
await this.createClient(applicant);
|
|
700
676
|
const client = this.getBrowserClient(applicant);
|
|
701
|
-
|
|
702
|
-
return client.switchToFrame(frameID);
|
|
677
|
+
return client.switchFrame(frameID.toString());
|
|
703
678
|
}
|
|
704
679
|
|
|
705
680
|
public async frameParent(applicant: string) {
|
package/src/types.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Capabilities } from '@wdio/types';
|
|
2
2
|
|
|
3
|
-
export type SeleniumPluginConfig = Capabilities.
|
|
3
|
+
export type SeleniumPluginConfig = Capabilities.WebdriverIOConfig & {
|
|
4
4
|
chromeDriverPath?: string;
|
|
5
5
|
recorderExtension: boolean;
|
|
6
6
|
clientCheckInterval: number;
|