|
1 |
| -import { Application, AppConstructorOptions } from 'spectron' |
| 1 | +import { ElectronApplication } from 'playwright-core' |
2 | 2 | import { Configuration as ElectronBuilderOptions } from 'electron-builder'
|
3 | 3 | import * as ChainableWebpackConfig from 'webpack-chain'
|
4 | 4 |
|
5 | 5 | interface Options {
|
6 | 6 | /**
|
7 |
| - Do not launch spectron. |
8 |
| - You will have to launch it on your own. |
9 |
| - */ |
10 |
| - noSpectron: boolean |
11 |
| - /** Launch server in dev mode, not in production. */ |
12 |
| - forceDev: boolean |
13 |
| - /** Custom spectron options.These will be merged with default options. */ |
14 |
| - spectronOptions: AppConstructorOptions |
15 |
| - /** Do not start app or wait for it to load. |
16 |
| - You will have to run app.start() and app.client.waitUntilWindowLoaded() yourself. |
17 |
| - */ |
18 |
| - noStart: boolean |
19 |
| - /** Set custom Vue env mode. Defaults to 'test' */ |
20 |
| - mode: string |
| 7 | + Do not launch Playwright. |
| 8 | + You will have to launch it on your own. |
| 9 | + */ |
| 10 | + noPlaywright?: boolean |
| 11 | + /** Custom Playwright launch options. These will be merged with default options. */ |
| 12 | + launchOptions?: Object |
| 13 | + /** Set custom Vue env mode. Defaults to 'production' */ |
| 14 | + mode?: string |
21 | 15 | }
|
22 |
| -interface Server { |
23 |
| - /** Spectron instance. */ |
24 |
| - app: Application |
| 16 | +interface ElectronInstance { |
| 17 | + /** Playwright application instance. */ |
| 18 | + app: ElectronApplication |
| 19 | + /** Close app instance and stop dev server (must be called to prevent continued async operations). */ |
| 20 | + stop: () => Promise<ElectronApplication> |
25 | 21 | /** URL of dev server. */
|
26 |
| - url: string |
27 |
| - /** Close spectron and stop dev server (must be called to prevent continued async operations). */ |
28 |
| - stopServe: () => Promise<Application> |
| 22 | + serverUrl: string |
29 | 23 | /** Log of dev server. */
|
30 |
| - stdout: string |
| 24 | + serverStdout: string |
31 | 25 | }
|
32 | 26 |
|
33 | 27 | /**
|
34 |
| - Run electron:serve, but instead of launching Electron it returns a Spectron Application instance. |
35 |
| - Used for e2e testing with Spectron. |
| 28 | + Run electron:serve, but instead of launching Electron it returns a Playwright Application instance. |
| 29 | + Used for e2e testing with Playwright. |
36 | 30 | */
|
37 |
| -export function testWithSpectron(spectron: any, options?: Partial<Options>): Promise<Server> |
| 31 | +export function testWithPlaywright(options?: Options): Promise<ElectronInstance> |
38 | 32 |
|
39 |
| - |
40 | 33 | export type PluginOptions = {
|
41 |
| - builderOptions?: ElectronBuilderOptions, |
42 |
| - chainWebpackMainProcess?: (config?: ChainableWebpackConfig) => void, |
43 |
| - chainWebpackRendererProcess?: (config?: ChainableWebpackConfig) => void, |
44 |
| - mainProcessFile?: string, |
45 |
| - rendererProcessFile?: string, |
46 |
| - mainProcessWatch?: string[], |
47 |
| - mainProcessArgs?: string[], |
48 |
| - outputDir?: string, |
49 |
| - disableMainProcessTypescript?: boolean, |
50 |
| - mainProcessTypeChecking?: boolean, |
51 |
| - customFileProtocol?: string, |
52 |
| - removeElectronJunk?: boolean, |
53 |
| - externals?: string[], |
54 |
| - nodeModulesPath?: string[], |
| 34 | + builderOptions?: ElectronBuilderOptions |
| 35 | + chainWebpackMainProcess?: (config?: ChainableWebpackConfig) => void |
| 36 | + chainWebpackRendererProcess?: (config?: ChainableWebpackConfig) => void |
| 37 | + mainProcessFile?: string |
| 38 | + rendererProcessFile?: string |
| 39 | + mainProcessWatch?: string[] |
| 40 | + mainProcessArgs?: string[] |
| 41 | + outputDir?: string |
| 42 | + disableMainProcessTypescript?: boolean |
| 43 | + mainProcessTypeChecking?: boolean |
| 44 | + customFileProtocol?: string |
| 45 | + externals?: string[] |
| 46 | + nodeModulesPath?: string[] |
55 | 47 | preload?: string | Record<string, string>
|
| 48 | + nodeIntegration?: boolean |
56 | 49 | }
|
0 commit comments