@serenity-js/playwright 3.42.1 → 3.43.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 +28 -0
- package/esm/screenplay/abilities/BrowseTheWebWithPlaywright.d.ts +60 -2
- package/esm/screenplay/abilities/BrowseTheWebWithPlaywright.d.ts.map +1 -1
- package/esm/screenplay/abilities/BrowseTheWebWithPlaywright.js +74 -2
- package/esm/screenplay/abilities/BrowseTheWebWithPlaywright.js.map +1 -1
- package/esm/screenplay/models/ElectronLaunchOptions.d.ts +55 -0
- package/esm/screenplay/models/ElectronLaunchOptions.d.ts.map +1 -0
- package/esm/screenplay/models/ElectronLaunchOptions.js +2 -0
- package/esm/screenplay/models/ElectronLaunchOptions.js.map +1 -0
- package/esm/screenplay/models/PlaywrightBrowsingSessionWithBrowser.d.ts +3 -2
- package/esm/screenplay/models/PlaywrightBrowsingSessionWithBrowser.d.ts.map +1 -1
- package/esm/screenplay/models/PlaywrightBrowsingSessionWithBrowser.js +6 -5
- package/esm/screenplay/models/PlaywrightBrowsingSessionWithBrowser.js.map +1 -1
- package/esm/screenplay/models/PlaywrightBrowsingSessionWithElectron.d.ts +52 -0
- package/esm/screenplay/models/PlaywrightBrowsingSessionWithElectron.d.ts.map +1 -0
- package/esm/screenplay/models/PlaywrightBrowsingSessionWithElectron.js +103 -0
- package/esm/screenplay/models/PlaywrightBrowsingSessionWithElectron.js.map +1 -0
- package/esm/screenplay/models/PlaywrightBrowsingSessionWithPage.d.ts +1 -0
- package/esm/screenplay/models/PlaywrightBrowsingSessionWithPage.d.ts.map +1 -1
- package/esm/screenplay/models/PlaywrightBrowsingSessionWithPage.js +3 -0
- package/esm/screenplay/models/PlaywrightBrowsingSessionWithPage.js.map +1 -1
- package/esm/screenplay/models/SelfLaunchingPlaywrightBrowsingSessionWithElectron.d.ts +52 -0
- package/esm/screenplay/models/SelfLaunchingPlaywrightBrowsingSessionWithElectron.d.ts.map +1 -0
- package/esm/screenplay/models/SelfLaunchingPlaywrightBrowsingSessionWithElectron.js +70 -0
- package/esm/screenplay/models/SelfLaunchingPlaywrightBrowsingSessionWithElectron.js.map +1 -0
- package/esm/screenplay/models/index.d.ts +3 -0
- package/esm/screenplay/models/index.d.ts.map +1 -1
- package/esm/screenplay/models/index.js +3 -0
- package/esm/screenplay/models/index.js.map +1 -1
- package/lib/screenplay/abilities/BrowseTheWebWithPlaywright.d.ts +60 -2
- package/lib/screenplay/abilities/BrowseTheWebWithPlaywright.d.ts.map +1 -1
- package/lib/screenplay/abilities/BrowseTheWebWithPlaywright.js +73 -1
- package/lib/screenplay/abilities/BrowseTheWebWithPlaywright.js.map +1 -1
- package/lib/screenplay/models/ElectronLaunchOptions.d.ts +55 -0
- package/lib/screenplay/models/ElectronLaunchOptions.d.ts.map +1 -0
- package/lib/screenplay/models/ElectronLaunchOptions.js +3 -0
- package/lib/screenplay/models/ElectronLaunchOptions.js.map +1 -0
- package/lib/screenplay/models/PlaywrightBrowsingSessionWithBrowser.d.ts +3 -2
- package/lib/screenplay/models/PlaywrightBrowsingSessionWithBrowser.d.ts.map +1 -1
- package/lib/screenplay/models/PlaywrightBrowsingSessionWithBrowser.js +6 -5
- package/lib/screenplay/models/PlaywrightBrowsingSessionWithBrowser.js.map +1 -1
- package/lib/screenplay/models/PlaywrightBrowsingSessionWithElectron.d.ts +52 -0
- package/lib/screenplay/models/PlaywrightBrowsingSessionWithElectron.d.ts.map +1 -0
- package/lib/screenplay/models/PlaywrightBrowsingSessionWithElectron.js +107 -0
- package/lib/screenplay/models/PlaywrightBrowsingSessionWithElectron.js.map +1 -0
- package/lib/screenplay/models/PlaywrightBrowsingSessionWithPage.d.ts +1 -0
- package/lib/screenplay/models/PlaywrightBrowsingSessionWithPage.d.ts.map +1 -1
- package/lib/screenplay/models/PlaywrightBrowsingSessionWithPage.js +3 -0
- package/lib/screenplay/models/PlaywrightBrowsingSessionWithPage.js.map +1 -1
- package/lib/screenplay/models/SelfLaunchingPlaywrightBrowsingSessionWithElectron.d.ts +52 -0
- package/lib/screenplay/models/SelfLaunchingPlaywrightBrowsingSessionWithElectron.d.ts.map +1 -0
- package/lib/screenplay/models/SelfLaunchingPlaywrightBrowsingSessionWithElectron.js +107 -0
- package/lib/screenplay/models/SelfLaunchingPlaywrightBrowsingSessionWithElectron.js.map +1 -0
- package/lib/screenplay/models/index.d.ts +3 -0
- package/lib/screenplay/models/index.d.ts.map +1 -1
- package/lib/screenplay/models/index.js +3 -0
- package/lib/screenplay/models/index.js.map +1 -1
- package/package.json +21 -9
- package/src/screenplay/abilities/BrowseTheWebWithPlaywright.ts +112 -7
- package/src/screenplay/models/ElectronLaunchOptions.ts +55 -0
- package/src/screenplay/models/PlaywrightBrowsingSessionWithBrowser.ts +13 -8
- package/src/screenplay/models/PlaywrightBrowsingSessionWithElectron.ts +129 -0
- package/src/screenplay/models/PlaywrightBrowsingSessionWithPage.ts +4 -0
- package/src/screenplay/models/SelfLaunchingPlaywrightBrowsingSessionWithElectron.ts +85 -0
- package/src/screenplay/models/index.ts +3 -0
|
@@ -43,6 +43,9 @@ class PlaywrightBrowsingSessionWithPage extends PlaywrightBrowsingSession_js_1.P
|
|
|
43
43
|
browserVersion: browser.version()
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
+
async discard() {
|
|
47
|
+
await this.closeAllPages();
|
|
48
|
+
}
|
|
46
49
|
}
|
|
47
50
|
exports.PlaywrightBrowsingSessionWithPage = PlaywrightBrowsingSessionWithPage;
|
|
48
51
|
//# sourceMappingURL=PlaywrightBrowsingSessionWithPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlaywrightBrowsingSessionWithPage.js","sourceRoot":"","sources":["../../../src/screenplay/models/PlaywrightBrowsingSessionWithPage.ts"],"names":[],"mappings":";;;AAAA,mDAAwD;AAKxD,iFAA2E;AAC3E,2DAAqD;AAErD;;GAEG;AACH,MAAa,iCAAkC,SAAQ,wDAAyB;IAIrD;IAHN,uBAAuB,GAAkB,qBAAa,CAAC,MAAM,EAAE,CAAC;IAEjF,YACuB,IAAqB,EACxC,qBAAiD,EACjD,SAA+B;QAE/B,KAAK,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC;QAJrB,SAAI,GAAJ,IAAI,CAAiB;IAK5C,CAAC;IAEkB,KAAK,CAAC,mBAAmB;QACxC,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAE5B,MAAM,cAAc,GAAG,IAAI,kCAAc,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,0BAA0B,EAAE,IAAI,CAAC,uBAAuB,CAAC,CAAC;QAE1H,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;QAE9B,OAAO,cAAc,CAAC;IAC1B,CAAC;IAEkB,KAAK,CAAC,oBAAoB;QACzC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,aAAa;QACf,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;YACrC,IAAI,CAAE,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,uBAAuB,CAAC,EAAE,CAAC;gBACjD,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;YACvB,CAAC;QACL,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACnB,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC;IACxC,CAAC;IAEQ,KAAK,CAAC,mBAAmB;QAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,CAAC;QAC9C,OAAO;YACH,WAAW,EAAG,OAAe,CAAC,YAAY,CAAC,IAAI,EAAI,4DAA4D;YAC/G,YAAY,EAAE,OAAO,CAAC,QAAQ,EAAqB,gDAAgD;YACnG,cAAc,EAAE,OAAO,CAAC,OAAO,EAAE;SACpC,CAAA;IACL,CAAC;
|
|
1
|
+
{"version":3,"file":"PlaywrightBrowsingSessionWithPage.js","sourceRoot":"","sources":["../../../src/screenplay/models/PlaywrightBrowsingSessionWithPage.ts"],"names":[],"mappings":";;;AAAA,mDAAwD;AAKxD,iFAA2E;AAC3E,2DAAqD;AAErD;;GAEG;AACH,MAAa,iCAAkC,SAAQ,wDAAyB;IAIrD;IAHN,uBAAuB,GAAkB,qBAAa,CAAC,MAAM,EAAE,CAAC;IAEjF,YACuB,IAAqB,EACxC,qBAAiD,EACjD,SAA+B;QAE/B,KAAK,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC;QAJrB,SAAI,GAAJ,IAAI,CAAiB;IAK5C,CAAC;IAEkB,KAAK,CAAC,mBAAmB;QACxC,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAE5B,MAAM,cAAc,GAAG,IAAI,kCAAc,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,0BAA0B,EAAE,IAAI,CAAC,uBAAuB,CAAC,CAAC;QAE1H,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;QAE9B,OAAO,cAAc,CAAC;IAC1B,CAAC;IAEkB,KAAK,CAAC,oBAAoB;QACzC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,aAAa;QACf,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;YACrC,IAAI,CAAE,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,uBAAuB,CAAC,EAAE,CAAC;gBACjD,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;YACvB,CAAC;QACL,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACnB,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC;IACxC,CAAC;IAEQ,KAAK,CAAC,mBAAmB;QAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,CAAC;QAC9C,OAAO;YACH,WAAW,EAAG,OAAe,CAAC,YAAY,CAAC,IAAI,EAAI,4DAA4D;YAC/G,YAAY,EAAE,OAAO,CAAC,QAAQ,EAAqB,gDAAgD;YACnG,cAAc,EAAE,OAAO,CAAC,OAAO,EAAE;SACpC,CAAA;IACL,CAAC;IAED,KAAK,CAAC,OAAO;QACT,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;IAC/B,CAAC;CACJ;AAnDD,8EAmDC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Discardable, Initialisable } from '@serenity-js/core';
|
|
2
|
+
import * as playwright from 'playwright-core';
|
|
3
|
+
import type { ExtraBrowserContextOptions } from '../../ExtraBrowserContextOptions.js';
|
|
4
|
+
import type { ElectronLaunchOptions } from './ElectronLaunchOptions.js';
|
|
5
|
+
import { PlaywrightBrowsingSessionWithElectron } from './PlaywrightBrowsingSessionWithElectron.js';
|
|
6
|
+
/**
|
|
7
|
+
* Self-launching implementation of [`PlaywrightBrowsingSession`](https://serenity-js.org/api/playwright/class/PlaywrightBrowsingSession/)
|
|
8
|
+
* for Electron applications.
|
|
9
|
+
*
|
|
10
|
+
* This class launches the Electron application on first use and closes it when discarded.
|
|
11
|
+
* Use this for test runners like Mocha or Jasmine that don't manage Electron lifecycle.
|
|
12
|
+
*
|
|
13
|
+
* ## Example
|
|
14
|
+
*
|
|
15
|
+
* ```typescript
|
|
16
|
+
* import { actorCalled } from '@serenity-js/core';
|
|
17
|
+
* import { BrowseTheWebWithPlaywright } from '@serenity-js/playwright';
|
|
18
|
+
*
|
|
19
|
+
* const actor = actorCalled('Tester').whoCan(
|
|
20
|
+
* BrowseTheWebWithPlaywright.launchingElectronApp({
|
|
21
|
+
* args: ['path/to/main.js'],
|
|
22
|
+
* cwd: 'path/to/app',
|
|
23
|
+
* })
|
|
24
|
+
* );
|
|
25
|
+
*
|
|
26
|
+
* // The app is automatically closed when the actor is dismissed
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @group Models
|
|
30
|
+
*/
|
|
31
|
+
export declare class SelfLaunchingPlaywrightBrowsingSessionWithElectron extends PlaywrightBrowsingSessionWithElectron implements Initialisable, Discardable {
|
|
32
|
+
private readonly launchOptions;
|
|
33
|
+
constructor(launchOptions: ElectronLaunchOptions, extraBrowserContextOptions: Partial<ExtraBrowserContextOptions>, selectors: playwright.Selectors);
|
|
34
|
+
/**
|
|
35
|
+
* Launches the Electron application using the configured launch options.
|
|
36
|
+
*
|
|
37
|
+
* This method is idempotent - calling it multiple times will only launch
|
|
38
|
+
* the application once.
|
|
39
|
+
*/
|
|
40
|
+
initialise(): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Returns `true` if the Electron application has been launched.
|
|
43
|
+
*/
|
|
44
|
+
isInitialised(): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Closes the Electron application that was launched by this session.
|
|
47
|
+
* Called when the ability is discarded.
|
|
48
|
+
*/
|
|
49
|
+
closeElectronApp(): Promise<void>;
|
|
50
|
+
discard(): Promise<void>;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=SelfLaunchingPlaywrightBrowsingSessionWithElectron.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelfLaunchingPlaywrightBrowsingSessionWithElectron.d.ts","sourceRoot":"","sources":["../../../src/screenplay/models/SelfLaunchingPlaywrightBrowsingSessionWithElectron.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAE9C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACtF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,qCAAqC,EAAE,MAAM,4CAA4C,CAAC;AAEnG;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,kDACT,SAAQ,qCACR,YAAW,aAAa,EAAE,WAAW;IAGjC,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,EAAE,qBAAqB,EACrD,0BAA0B,EAAE,OAAO,CAAC,0BAA0B,CAAC,EAC/D,SAAS,EAAE,UAAU,CAAC,SAAS;IAMnC;;;;;OAKG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IASjC;;OAEG;IACH,aAAa,IAAI,OAAO;IAIxB;;;OAGG;IACG,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAOjC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAMjC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.SelfLaunchingPlaywrightBrowsingSessionWithElectron = void 0;
|
|
37
|
+
const playwright = __importStar(require("playwright-core"));
|
|
38
|
+
const PlaywrightBrowsingSessionWithElectron_js_1 = require("./PlaywrightBrowsingSessionWithElectron.js");
|
|
39
|
+
/**
|
|
40
|
+
* Self-launching implementation of [`PlaywrightBrowsingSession`](https://serenity-js.org/api/playwright/class/PlaywrightBrowsingSession/)
|
|
41
|
+
* for Electron applications.
|
|
42
|
+
*
|
|
43
|
+
* This class launches the Electron application on first use and closes it when discarded.
|
|
44
|
+
* Use this for test runners like Mocha or Jasmine that don't manage Electron lifecycle.
|
|
45
|
+
*
|
|
46
|
+
* ## Example
|
|
47
|
+
*
|
|
48
|
+
* ```typescript
|
|
49
|
+
* import { actorCalled } from '@serenity-js/core';
|
|
50
|
+
* import { BrowseTheWebWithPlaywright } from '@serenity-js/playwright';
|
|
51
|
+
*
|
|
52
|
+
* const actor = actorCalled('Tester').whoCan(
|
|
53
|
+
* BrowseTheWebWithPlaywright.launchingElectronApp({
|
|
54
|
+
* args: ['path/to/main.js'],
|
|
55
|
+
* cwd: 'path/to/app',
|
|
56
|
+
* })
|
|
57
|
+
* );
|
|
58
|
+
*
|
|
59
|
+
* // The app is automatically closed when the actor is dismissed
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @group Models
|
|
63
|
+
*/
|
|
64
|
+
class SelfLaunchingPlaywrightBrowsingSessionWithElectron extends PlaywrightBrowsingSessionWithElectron_js_1.PlaywrightBrowsingSessionWithElectron {
|
|
65
|
+
launchOptions;
|
|
66
|
+
constructor(launchOptions, extraBrowserContextOptions, selectors) {
|
|
67
|
+
// setting electronApp to undefined since it's lazily initialised
|
|
68
|
+
super(undefined, extraBrowserContextOptions, selectors);
|
|
69
|
+
this.launchOptions = launchOptions;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Launches the Electron application using the configured launch options.
|
|
73
|
+
*
|
|
74
|
+
* This method is idempotent - calling it multiple times will only launch
|
|
75
|
+
* the application once.
|
|
76
|
+
*/
|
|
77
|
+
async initialise() {
|
|
78
|
+
if (this.electronApp) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
this.electronApp = await playwright._electron.launch(this.launchOptions);
|
|
82
|
+
this.currentBrowserPage = await this.registerCurrentPage();
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Returns `true` if the Electron application has been launched.
|
|
86
|
+
*/
|
|
87
|
+
isInitialised() {
|
|
88
|
+
return this.electronApp !== undefined;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Closes the Electron application that was launched by this session.
|
|
92
|
+
* Called when the ability is discarded.
|
|
93
|
+
*/
|
|
94
|
+
async closeElectronApp() {
|
|
95
|
+
if (this.electronApp) {
|
|
96
|
+
await this.electronApp.close();
|
|
97
|
+
this.electronApp = undefined;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
async discard() {
|
|
101
|
+
await this.closeElectronApp();
|
|
102
|
+
this.pages.clear();
|
|
103
|
+
this.currentBrowserPage = undefined;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.SelfLaunchingPlaywrightBrowsingSessionWithElectron = SelfLaunchingPlaywrightBrowsingSessionWithElectron;
|
|
107
|
+
//# sourceMappingURL=SelfLaunchingPlaywrightBrowsingSessionWithElectron.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelfLaunchingPlaywrightBrowsingSessionWithElectron.js","sourceRoot":"","sources":["../../../src/screenplay/models/SelfLaunchingPlaywrightBrowsingSessionWithElectron.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,4DAA8C;AAI9C,yGAAmG;AAEnG;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAa,kDACT,SAAQ,gFAAqC;IAIxB;IADrB,YACqB,aAAoC,EACrD,0BAA+D,EAC/D,SAA+B;QAE/B,iEAAiE;QACjE,KAAK,CAAC,SAAS,EAAE,0BAA0B,EAAE,SAAS,CAAC,CAAC;QALvC,kBAAa,GAAb,aAAa,CAAuB;IAMzD,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,UAAU;QACZ,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACnB,OAAO;QACX,CAAC;QAED,IAAI,CAAC,WAAW,GAAG,MAAM,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACzE,IAAI,CAAC,kBAAkB,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC/D,CAAC;IAED;;OAEG;IACH,aAAa;QACT,OAAO,IAAI,CAAC,WAAW,KAAK,SAAS,CAAC;IAC1C,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,gBAAgB;QAClB,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACnB,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;YAC/B,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;QACjC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,OAAO;QACT,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAE9B,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACnB,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC;IACxC,CAAC;CACJ;AApDD,gHAoDC"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
export * from './ElectronLaunchOptions.js';
|
|
1
2
|
export * from './locators/index.js';
|
|
2
3
|
export * from './PlaywrightBrowsingSession.js';
|
|
3
4
|
export * from './PlaywrightBrowsingSessionWithBrowser.js';
|
|
5
|
+
export * from './PlaywrightBrowsingSessionWithElectron.js';
|
|
4
6
|
export * from './PlaywrightBrowsingSessionWithPage.js';
|
|
5
7
|
export * from './PlaywrightCookie.js';
|
|
6
8
|
export * from './PlaywrightPage.js';
|
|
7
9
|
export * from './PlaywrightPageElement.js';
|
|
10
|
+
export * from './SelfLaunchingPlaywrightBrowsingSessionWithElectron.js';
|
|
8
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/screenplay/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2CAA2C,CAAC;AAC1D,cAAc,wCAAwC,CAAC;AACvD,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/screenplay/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2CAA2C,CAAC;AAC1D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,wCAAwC,CAAC;AACvD,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yDAAyD,CAAC"}
|
|
@@ -14,11 +14,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./ElectronLaunchOptions.js"), exports);
|
|
17
18
|
__exportStar(require("./locators/index.js"), exports);
|
|
18
19
|
__exportStar(require("./PlaywrightBrowsingSession.js"), exports);
|
|
19
20
|
__exportStar(require("./PlaywrightBrowsingSessionWithBrowser.js"), exports);
|
|
21
|
+
__exportStar(require("./PlaywrightBrowsingSessionWithElectron.js"), exports);
|
|
20
22
|
__exportStar(require("./PlaywrightBrowsingSessionWithPage.js"), exports);
|
|
21
23
|
__exportStar(require("./PlaywrightCookie.js"), exports);
|
|
22
24
|
__exportStar(require("./PlaywrightPage.js"), exports);
|
|
23
25
|
__exportStar(require("./PlaywrightPageElement.js"), exports);
|
|
26
|
+
__exportStar(require("./SelfLaunchingPlaywrightBrowsingSessionWithElectron.js"), exports);
|
|
24
27
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/screenplay/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,iEAA+C;AAC/C,4EAA0D;AAC1D,yEAAuD;AACvD,wDAAsC;AACtC,sDAAoC;AACpC,6DAA2C"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/screenplay/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA2C;AAC3C,sDAAoC;AACpC,iEAA+C;AAC/C,4EAA0D;AAC1D,6EAA2D;AAC3D,yEAAuD;AACvD,wDAAsC;AACtC,sDAAoC;AACpC,6DAA2C;AAC3C,0FAAwE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serenity-js/playwright",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.43.0",
|
|
4
4
|
"description": "Adapter that integrates @serenity-js/web with Playwright, enabling Serenity/JS reporting and using the Screenplay Pattern to write component and end-to-end test scenarios",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Jan Molak",
|
|
@@ -22,9 +22,14 @@
|
|
|
22
22
|
"module": "./esm/index.js",
|
|
23
23
|
"exports": {
|
|
24
24
|
".": {
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
"import": {
|
|
26
|
+
"types": "./esm/index.d.ts",
|
|
27
|
+
"default": "./esm/index.js"
|
|
28
|
+
},
|
|
29
|
+
"require": {
|
|
30
|
+
"types": "./lib/index.d.ts",
|
|
31
|
+
"default": "./lib/index.js"
|
|
32
|
+
}
|
|
28
33
|
},
|
|
29
34
|
"./lib/*": "./lib/*",
|
|
30
35
|
"./esm/*": "./esm/*",
|
|
@@ -54,7 +59,7 @@
|
|
|
54
59
|
"scripts": {
|
|
55
60
|
"clean": "rimraf target",
|
|
56
61
|
"~test": "c8 npm run test:no-coverage",
|
|
57
|
-
"~test:no-coverage": "mocha --config
|
|
62
|
+
"~test:no-coverage": "mocha --config .mocharc.yml --spec='spec/**/*.spec.*'",
|
|
58
63
|
"compile": "npm run compile:clean && npm run compile:esm && npm run compile:cjs-package && npm run compile:cjs",
|
|
59
64
|
"compile:clean": "rimraf lib esm",
|
|
60
65
|
"compile:esm": "tsc --project tsconfig-esm.build.json",
|
|
@@ -73,8 +78,8 @@
|
|
|
73
78
|
"node": "^20 || ^22 || ^24"
|
|
74
79
|
},
|
|
75
80
|
"dependencies": {
|
|
76
|
-
"@serenity-js/core": "3.
|
|
77
|
-
"@serenity-js/web": "3.
|
|
81
|
+
"@serenity-js/core": "3.43.0",
|
|
82
|
+
"@serenity-js/web": "3.43.0",
|
|
78
83
|
"tiny-types": "2.0.5"
|
|
79
84
|
},
|
|
80
85
|
"peerDependencies": {
|
|
@@ -83,13 +88,20 @@
|
|
|
83
88
|
"devDependencies": {
|
|
84
89
|
"@integration/testing-tools": "3.0.0",
|
|
85
90
|
"@types/chai": "4.3.20",
|
|
91
|
+
"@types/chai-as-promised": "7.1.8",
|
|
86
92
|
"@types/mocha": "10.0.10",
|
|
93
|
+
"@types/sinon": "21.0.1",
|
|
87
94
|
"c8": "11.0.0",
|
|
95
|
+
"chai": "4.5.0",
|
|
96
|
+
"chai-as-promised": "7.1.2",
|
|
88
97
|
"mocha": "11.7.5",
|
|
89
98
|
"mocha-multi": "1.1.7",
|
|
90
99
|
"playwright-core": "1.59.1",
|
|
91
|
-
"
|
|
100
|
+
"sinon": "20.0.0",
|
|
101
|
+
"sinon-chai": "3.7.0",
|
|
102
|
+
"tiny-types": "2.0.5",
|
|
103
|
+
"tsx": "4.20.3",
|
|
92
104
|
"typescript": "5.9.3"
|
|
93
105
|
},
|
|
94
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "96ffb7ecba111082c92d7b107fef007d9f56bb83"
|
|
95
107
|
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Discardable, Initialisable } from '@serenity-js/core';
|
|
2
2
|
import { BrowseTheWeb } from '@serenity-js/web';
|
|
3
3
|
import * as playwright from 'playwright-core';
|
|
4
4
|
|
|
5
5
|
import type { ExtraBrowserContextOptions } from '../../ExtraBrowserContextOptions.js';
|
|
6
6
|
import {
|
|
7
|
+
type ElectronLaunchOptions,
|
|
7
8
|
PlaywrightBrowsingSessionWithBrowser,
|
|
8
|
-
|
|
9
|
+
PlaywrightBrowsingSessionWithElectron,
|
|
10
|
+
PlaywrightBrowsingSessionWithPage,
|
|
11
|
+
SelfLaunchingPlaywrightBrowsingSessionWithElectron
|
|
9
12
|
} from '../models/index.js';
|
|
10
13
|
|
|
11
14
|
/**
|
|
@@ -154,24 +157,126 @@ import {
|
|
|
154
157
|
*
|
|
155
158
|
* @group Abilities
|
|
156
159
|
*/
|
|
157
|
-
export class BrowseTheWebWithPlaywright
|
|
158
|
-
|
|
159
|
-
|
|
160
|
+
export class BrowseTheWebWithPlaywright
|
|
161
|
+
extends BrowseTheWeb<playwright.Locator>
|
|
162
|
+
implements Initialisable, Discardable
|
|
163
|
+
{
|
|
164
|
+
static using(
|
|
165
|
+
browser: playwright.Browser,
|
|
166
|
+
browserContextOptions?: playwright.BrowserContextOptions,
|
|
167
|
+
extraBrowserContextOptions?: ExtraBrowserContextOptions
|
|
168
|
+
): BrowseTheWebWithPlaywright {
|
|
160
169
|
return new BrowseTheWebWithPlaywright(new PlaywrightBrowsingSessionWithBrowser(browser, browserContextOptions, extraBrowserContextOptions, playwright.selectors));
|
|
161
170
|
}
|
|
162
171
|
|
|
163
|
-
static usingPage(
|
|
172
|
+
static usingPage(
|
|
173
|
+
page: playwright.Page,
|
|
174
|
+
extraBrowserContextOptions?: ExtraBrowserContextOptions
|
|
175
|
+
): BrowseTheWebWithPlaywright {
|
|
164
176
|
return new BrowseTheWebWithPlaywright(new PlaywrightBrowsingSessionWithPage(page, extraBrowserContextOptions, playwright.selectors));
|
|
165
177
|
}
|
|
166
178
|
|
|
179
|
+
/**
|
|
180
|
+
* Creates an ability to browse the web using an already-launched Electron application.
|
|
181
|
+
*
|
|
182
|
+
* Use this method when the Electron application lifecycle is managed externally,
|
|
183
|
+
* such as in Playwright Test where the app is launched per-worker.
|
|
184
|
+
*
|
|
185
|
+
* ## Example
|
|
186
|
+
*
|
|
187
|
+
* ```ts
|
|
188
|
+
* import { _electron as electron } from 'playwright';
|
|
189
|
+
* import { actorCalled } from '@serenity-js/core';
|
|
190
|
+
* import { BrowseTheWebWithPlaywright } from '@serenity-js/playwright';
|
|
191
|
+
*
|
|
192
|
+
* const electronApp = await electron.launch({ args: ['main.js'] });
|
|
193
|
+
*
|
|
194
|
+
* const actor = actorCalled('Tester').whoCan(
|
|
195
|
+
* BrowseTheWebWithPlaywright.usingElectronApp(electronApp)
|
|
196
|
+
* );
|
|
197
|
+
*
|
|
198
|
+
* // After tests, close the app manually
|
|
199
|
+
* await electronApp.close();
|
|
200
|
+
* ```
|
|
201
|
+
*
|
|
202
|
+
* @param electronApp - An already-launched Playwright ElectronApplication instance
|
|
203
|
+
* @param extraBrowserContextOptions - Optional configuration for timeouts and navigation
|
|
204
|
+
*/
|
|
205
|
+
static usingElectronApp(
|
|
206
|
+
electronApp: playwright.ElectronApplication,
|
|
207
|
+
extraBrowserContextOptions?: ExtraBrowserContextOptions
|
|
208
|
+
): BrowseTheWebWithPlaywright {
|
|
209
|
+
return new BrowseTheWebWithPlaywright(
|
|
210
|
+
new PlaywrightBrowsingSessionWithElectron(
|
|
211
|
+
electronApp,
|
|
212
|
+
extraBrowserContextOptions ?? {},
|
|
213
|
+
playwright.selectors
|
|
214
|
+
)
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Creates an ability to browse the web by launching and managing an Electron application.
|
|
220
|
+
*
|
|
221
|
+
* Use this method when you want Serenity/JS to manage the Electron application lifecycle.
|
|
222
|
+
* The app is launched on first use and closed when the ability is discarded.
|
|
223
|
+
*
|
|
224
|
+
* ## Example
|
|
225
|
+
*
|
|
226
|
+
* ```typescript
|
|
227
|
+
* import { actorCalled } from '@serenity-js/core';
|
|
228
|
+
* import { BrowseTheWebWithPlaywright } from '@serenity-js/playwright';
|
|
229
|
+
*
|
|
230
|
+
* const actor = actorCalled('Tester').whoCan(
|
|
231
|
+
* BrowseTheWebWithPlaywright.launchingElectronApp({
|
|
232
|
+
* args: ['path/to/main.js'],
|
|
233
|
+
* cwd: 'path/to/app',
|
|
234
|
+
* })
|
|
235
|
+
* );
|
|
236
|
+
*
|
|
237
|
+
* // The app is automatically closed when the actor is dismissed
|
|
238
|
+
* ```
|
|
239
|
+
*
|
|
240
|
+
* @param launchOptions - Options for launching the Electron application
|
|
241
|
+
* @param extraBrowserContextOptions - Optional configuration for timeouts and navigation
|
|
242
|
+
*/
|
|
243
|
+
static launchingElectronApp(
|
|
244
|
+
launchOptions: ElectronLaunchOptions,
|
|
245
|
+
extraBrowserContextOptions?: ExtraBrowserContextOptions
|
|
246
|
+
): BrowseTheWebWithPlaywright {
|
|
247
|
+
return new BrowseTheWebWithPlaywright(
|
|
248
|
+
new SelfLaunchingPlaywrightBrowsingSessionWithElectron(
|
|
249
|
+
launchOptions,
|
|
250
|
+
extraBrowserContextOptions ?? {},
|
|
251
|
+
playwright.selectors
|
|
252
|
+
)
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
async initialise(): Promise<void> {
|
|
257
|
+
if (Initialisable.isInitialisable(this.session)) {
|
|
258
|
+
await this.session.initialise();
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
isInitialised(): boolean {
|
|
263
|
+
return Initialisable.isInitialisable(this.session)
|
|
264
|
+
? this.session.isInitialised()
|
|
265
|
+
: true;
|
|
266
|
+
}
|
|
267
|
+
|
|
167
268
|
/**
|
|
168
269
|
* Automatically closes any open [pages](https://serenity-js.org/api/web/class/Page/) when the [SceneFinishes](https://serenity-js.org/api/core-events/class/SceneFinishes/)
|
|
169
270
|
*
|
|
271
|
+
* For self-launching Electron sessions, also closes the Electron application.
|
|
272
|
+
*
|
|
170
273
|
* #### Learn more
|
|
171
274
|
* - [`PlaywrightBrowsingSession.closeAllPages`](https://serenity-js.org/api/playwright/class/PlaywrightBrowsingSession/#closeAllPages)
|
|
172
275
|
* - [`Discardable`](https://serenity-js.org/api/core/interface/Discardable/)
|
|
173
276
|
*/
|
|
174
277
|
async discard(): Promise<void> {
|
|
175
|
-
|
|
278
|
+
if (Discardable.isDiscardable(this.session)) {
|
|
279
|
+
await this.session.discard();
|
|
280
|
+
}
|
|
176
281
|
}
|
|
177
282
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type * as playwright from 'playwright-core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Options for launching an Electron application via Playwright.
|
|
5
|
+
*
|
|
6
|
+
* This type re-exports Playwright's Electron launch options with additional documentation
|
|
7
|
+
* for commonly used properties.
|
|
8
|
+
*
|
|
9
|
+
* ## Example
|
|
10
|
+
*
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { actorCalled } from '@serenity-js/core';
|
|
13
|
+
* import { BrowseTheWebWithPlaywright, ElectronLaunchOptions } from '@serenity-js/playwright';
|
|
14
|
+
*
|
|
15
|
+
* const options: ElectronLaunchOptions = {
|
|
16
|
+
* executablePath: '/path/to/electron',
|
|
17
|
+
* args: ['main.js'],
|
|
18
|
+
* cwd: '/path/to/app',
|
|
19
|
+
* env: { NODE_ENV: 'test' },
|
|
20
|
+
* timeout: 30000,
|
|
21
|
+
* };
|
|
22
|
+
*
|
|
23
|
+
* const actor = actorCalled('Tester').whoCan(
|
|
24
|
+
* BrowseTheWebWithPlaywright.launchingElectronApp(options)
|
|
25
|
+
* );
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* ## Common Options
|
|
29
|
+
*
|
|
30
|
+
* - **executablePath**: Path to the Electron executable. If not specified, uses the default
|
|
31
|
+
* Electron installed in `node_modules/.bin/electron`.
|
|
32
|
+
* - **args**: Command-line arguments passed to the application. Typically includes the path
|
|
33
|
+
* to the main script (e.g., `['main.js']`).
|
|
34
|
+
* - **cwd**: Current working directory for the Electron process.
|
|
35
|
+
* - **env**: Environment variables visible to the Electron process. Defaults to `process.env`.
|
|
36
|
+
* - **timeout**: Maximum time in milliseconds to wait for the application to start.
|
|
37
|
+
* Defaults to 30000 (30 seconds). Pass 0 to disable timeout.
|
|
38
|
+
*
|
|
39
|
+
* ## Additional Options
|
|
40
|
+
*
|
|
41
|
+
* - **acceptDownloads**: Whether to automatically download all attachments. Defaults to `true`.
|
|
42
|
+
* - **bypassCSP**: Toggles bypassing page's Content-Security-Policy. Defaults to `false`.
|
|
43
|
+
* - **colorScheme**: Emulates `prefers-colors-scheme` media feature. Supported values are `'light'`, `'dark'`, and `'no-preference'`.
|
|
44
|
+
* - **locale**: Specify user locale, for example `en-GB`, `de-DE`, etc.
|
|
45
|
+
* - **offline**: Whether to emulate network being offline. Defaults to `false`.
|
|
46
|
+
* - **recordVideo**: Enables video recording for all pages.
|
|
47
|
+
* - **timezoneId**: Changes the timezone of the context.
|
|
48
|
+
*
|
|
49
|
+
* ## Learn more
|
|
50
|
+
* - [Playwright Electron API](https://playwright.dev/docs/api/class-electron)
|
|
51
|
+
* - [Electron Testing with Playwright](https://playwright.dev/docs/electron)
|
|
52
|
+
*
|
|
53
|
+
* @group Configuration
|
|
54
|
+
*/
|
|
55
|
+
export type ElectronLaunchOptions = Parameters<typeof playwright._electron.launch>[0];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Discardable } from '@serenity-js/core';
|
|
1
2
|
import type { BrowserCapabilities } from '@serenity-js/web';
|
|
2
3
|
import type * as playwright from 'playwright-core';
|
|
3
4
|
|
|
@@ -8,7 +9,10 @@ import type { PlaywrightPage } from './PlaywrightPage.js';
|
|
|
8
9
|
/**
|
|
9
10
|
* @group Models
|
|
10
11
|
*/
|
|
11
|
-
export class PlaywrightBrowsingSessionWithBrowser
|
|
12
|
+
export class PlaywrightBrowsingSessionWithBrowser
|
|
13
|
+
extends PlaywrightBrowsingSession
|
|
14
|
+
implements Discardable
|
|
15
|
+
{
|
|
12
16
|
|
|
13
17
|
constructor(
|
|
14
18
|
protected readonly browser: playwright.Browser,
|
|
@@ -20,6 +24,7 @@ export class PlaywrightBrowsingSessionWithBrowser extends PlaywrightBrowsingSess
|
|
|
20
24
|
}
|
|
21
25
|
|
|
22
26
|
protected override async createBrowserContext(): Promise<playwright.BrowserContext> {
|
|
27
|
+
// todo: move to initialise?
|
|
23
28
|
return this.browser.newContext(this.browserContextOptions);
|
|
24
29
|
}
|
|
25
30
|
|
|
@@ -37,13 +42,6 @@ export class PlaywrightBrowsingSessionWithBrowser extends PlaywrightBrowsingSess
|
|
|
37
42
|
return allPages.at(-1);
|
|
38
43
|
}
|
|
39
44
|
|
|
40
|
-
override async closeAllPages(): Promise<void> {
|
|
41
|
-
await super.closeAllPages();
|
|
42
|
-
|
|
43
|
-
const context = await this.browserContext();
|
|
44
|
-
await context.close();
|
|
45
|
-
}
|
|
46
|
-
|
|
47
45
|
override async browserCapabilities(): Promise<BrowserCapabilities> {
|
|
48
46
|
return {
|
|
49
47
|
browserName: (this.browser as any)._initializer.name, // todo: raise a PR to Playwright to expose this information
|
|
@@ -51,4 +49,11 @@ export class PlaywrightBrowsingSessionWithBrowser extends PlaywrightBrowsingSess
|
|
|
51
49
|
browserVersion: this.browser.version()
|
|
52
50
|
}
|
|
53
51
|
}
|
|
52
|
+
|
|
53
|
+
async discard(): Promise<void> {
|
|
54
|
+
await this.closeAllPages();
|
|
55
|
+
|
|
56
|
+
const context = await this.browserContext();
|
|
57
|
+
await context.close();
|
|
58
|
+
}
|
|
54
59
|
}
|