@serenity-js/playwright
Version:
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
52 lines • 2.17 kB
TypeScript
import type { Discardable, Initialisable } from '@serenity-js/core';
import * as playwright from 'playwright-core';
import type { ExtraBrowserContextOptions } from '../../ExtraBrowserContextOptions.js';
import type { ElectronLaunchOptions } from './ElectronLaunchOptions.js';
import { PlaywrightBrowsingSessionWithElectron } from './PlaywrightBrowsingSessionWithElectron.js';
/**
* Self-launching implementation of [`PlaywrightBrowsingSession`](https://serenity-js.org/api/playwright/class/PlaywrightBrowsingSession/)
* for Electron applications.
*
* This class launches the Electron application on first use and closes it when discarded.
* Use this for test runners like Mocha or Jasmine that don't manage Electron lifecycle.
*
* ## Example
*
* ```typescript
* import { actorCalled } from '@serenity-js/core';
* import { BrowseTheWebWithPlaywright } from '@serenity-js/playwright';
*
* const actor = actorCalled('Tester').whoCan(
* BrowseTheWebWithPlaywright.launchingElectronApp({
* args: ['path/to/main.js'],
* cwd: 'path/to/app',
* })
* );
*
* // The app is automatically closed when the actor is dismissed
* ```
*
* @group Models
*/
export declare class SelfLaunchingPlaywrightBrowsingSessionWithElectron extends PlaywrightBrowsingSessionWithElectron implements Initialisable, Discardable {
private readonly launchOptions;
constructor(launchOptions: ElectronLaunchOptions, extraBrowserContextOptions: Partial<ExtraBrowserContextOptions>, selectors: playwright.Selectors);
/**
* Launches the Electron application using the configured launch options.
*
* This method is idempotent - calling it multiple times will only launch
* the application once.
*/
initialise(): Promise<void>;
/**
* Returns `true` if the Electron application has been launched.
*/
isInitialised(): boolean;
/**
* Closes the Electron application that was launched by this session.
* Called when the ability is discarded.
*/
closeElectronApp(): Promise<void>;
discard(): Promise<void>;
}
//# sourceMappingURL=SelfLaunchingPlaywrightBrowsingSessionWithElectron.d.ts.map