Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

electron-playwright-helpers

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

electron-playwright-helpers - npm Package Compare versions

Comparing version 1.6.0 to 1.7.0

dist/utilities.d.ts

5

dist/general_helpers.d.ts

@@ -1,4 +0,3 @@

import 'electron';
import { ElectronApplication } from 'playwright-core';
import { PageFunctionOn } from 'playwright-core/types/structs';
import type { ElectronApplication } from 'playwright-core';
import type { PageFunctionOn } from 'playwright-core/types/structs';
/**

@@ -5,0 +4,0 @@ * Wait for a function to evaluate to true in the main Electron process. This really

1

dist/general_helpers.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.electronWaitForFunction = void 0;
require("electron");
/**

@@ -6,0 +5,0 @@ * Wait for a function to evaluate to true in the main Electron process. This really

@@ -6,2 +6,3 @@ export * from './general_helpers';

export * from './find_parse_builds';
export * from './utilities';
//# sourceMappingURL=index.d.ts.map

@@ -22,2 +22,3 @@ "use strict";

__exportStar(require("./find_parse_builds"), exports);
__exportStar(require("./utilities"), exports);
//# sourceMappingURL=index.js.map

@@ -16,3 +16,3 @@ import { ElectronApplication, Page } from 'playwright-core';

*/
export declare function ipcRendererSend(window: Page, channel: string, ...args: unknown[]): Promise<unknown>;
export declare function ipcRendererSend(page: Page, channel: string, ...args: unknown[]): Promise<unknown>;
/**

@@ -32,3 +32,3 @@ * Send an ipcRenderer.invoke() from a given window.

*/
export declare function ipcRendererInvoke(window: Page, message: string, ...args: unknown[]): Promise<unknown>;
export declare function ipcRendererInvoke(page: Page, message: string, ...args: unknown[]): Promise<unknown>;
/**

@@ -45,3 +45,3 @@ * Call just the first listener for a given ipcRenderer channel in a given window.

*
* @param window {Page} The Playwright Page to with the `ipcRenderer.on()` listener
* @param page {Page} The Playwright Page to with the `ipcRenderer.on()` listener
* @param message {string} The channel to call the first listener for

@@ -52,3 +52,3 @@ * @param args {...unknown} optional - One or more arguments to send to the ipcRenderer.on() listener

*/
export declare function ipcRendererCallFirstListener(window: Page, message: string, ...args: unknown[]): Promise<unknown>;
export declare function ipcRendererCallFirstListener(page: Page, message: string, ...args: unknown[]): Promise<unknown>;
/**

@@ -65,3 +65,3 @@ * Emit an IPC message to a given window.

*
* @param window {Page} - the Playwright Page to with the ipcRenderer.on() listener
* @param page {Page} - the Playwright Page to with the ipcRenderer.on() listener
* @param message {string} - the channel to call all ipcRenderer listeners for

@@ -73,3 +73,3 @@ * @param args {...unknown} optional - one or more arguments to send

*/
export declare function ipcRendererEmit(window: Page, message: string, ...args: unknown[]): Promise<boolean>;
export declare function ipcRendererEmit(page: Page, message: string, ...args: unknown[]): Promise<boolean>;
/**

@@ -76,0 +76,0 @@ * Emit an ipcMain message from the main process.

@@ -18,4 +18,7 @@ "use strict";

*/
function ipcRendererSend(window, channel, ...args) {
return window.evaluate(({ channel, args }) => {
function ipcRendererSend(page, channel, ...args) {
return page.evaluate(({ channel, args }) => {
if (!require) {
throw new Error(`Cannot access require() in renderer process. Is nodeIntegration: true?`);
}
// eslint-disable-next-line @typescript-eslint/no-var-requires

@@ -41,4 +44,7 @@ const { ipcRenderer } = require('electron');

*/
function ipcRendererInvoke(window, message, ...args) {
return window.evaluate(async ({ message, args }) => {
function ipcRendererInvoke(page, message, ...args) {
return page.evaluate(async ({ message, args }) => {
if (!require) {
throw new Error(`Cannot access require() in renderer process. Is nodeIntegration: true?`);
}
// eslint-disable-next-line @typescript-eslint/no-var-requires

@@ -61,3 +67,3 @@ const { ipcRenderer } = require('electron');

*
* @param window {Page} The Playwright Page to with the `ipcRenderer.on()` listener
* @param page {Page} The Playwright Page to with the `ipcRenderer.on()` listener
* @param message {string} The channel to call the first listener for

@@ -68,4 +74,7 @@ * @param args {...unknown} optional - One or more arguments to send to the ipcRenderer.on() listener

*/
async function ipcRendererCallFirstListener(window, message, ...args) {
const result = await window.evaluate(async ({ message, args }) => {
async function ipcRendererCallFirstListener(page, message, ...args) {
const result = await page.evaluate(async ({ message, args }) => {
if (!require) {
throw new Error(`Cannot access require() in renderer process. Is nodeIntegration: true?`);
}
// eslint-disable-next-line @typescript-eslint/no-var-requires

@@ -98,3 +107,3 @@ const { ipcRenderer } = require('electron');

*
* @param window {Page} - the Playwright Page to with the ipcRenderer.on() listener
* @param page {Page} - the Playwright Page to with the ipcRenderer.on() listener
* @param message {string} - the channel to call all ipcRenderer listeners for

@@ -106,4 +115,7 @@ * @param args {...unknown} optional - one or more arguments to send

*/
function ipcRendererEmit(window, message, ...args) {
return window.evaluate(({ message, args }) => {
function ipcRendererEmit(page, message, ...args) {
return page.evaluate(({ message, args }) => {
if (!require) {
throw new Error(`Cannot access require() in renderer process. Is nodeIntegration: true?`);
}
// eslint-disable-next-line @typescript-eslint/no-var-requires

@@ -110,0 +122,0 @@ const { ipcRenderer } = require('electron');

{
"name": "electron-playwright-helpers",
"version": "1.6.0",
"version": "1.7.0",
"description": "Helper functions for Electron end-to-end testing using Playwright",

@@ -13,8 +13,8 @@ "main": "./dist/index.js",

"scripts": {
"build": "npm run build:compile && npm run build:doc",
"build:compile": "rm -rf dist; tsc",
"build:doc": "npx jsdoc2md --template ./readme-template.hbs.md --files ./src/*.ts --configure ./jsdoc2md.json > ./README.md",
"make": "npm run make:compile && npm run make:doc",
"make:compile": "rm -rf dist; tsc",
"make:doc": "npx jsdoc2md --template ./readme-template.hbs.md --files ./src/*.ts --configure ./jsdoc2md.json > ./README.md",
"lint": "npx eslint src/**/*.ts",
"lint:fix": "npx eslint src/**/*.ts --fix",
"prepublish": "npm run build:compile && npm run build:doc",
"prepublish": "npm run make",
"test": "cd example-project && npm run e2e",

@@ -21,0 +21,0 @@ "version:patch": "npm version patch",

@@ -163,3 +163,3 @@ # Electron Playwright Helpers

in the webPreferences for this window</p></dd>
<dt><a href="#ipcRendererCallFirstListener">ipcRendererCallFirstListener(window, message, ...args)</a> ⇒ <code>Promise.&lt;unknown&gt;</code></dt>
<dt><a href="#ipcRendererCallFirstListener">ipcRendererCallFirstListener(page, message, ...args)</a> ⇒ <code>Promise.&lt;unknown&gt;</code></dt>
<dd><p>Call just the first listener for a given ipcRenderer channel in a given window.

@@ -170,3 +170,3 @@ <em>UNLIKE MOST Electron ipcRenderer listeners</em>, this function SHOULD return a value.</p>

<p>Note: nodeIntegration must be true for this BrowserWindow.</p></dd>
<dt><a href="#ipcRendererEmit">ipcRendererEmit(window, message, ...args)</a> ⇒ <code>Promise.&lt;boolean&gt;</code></dt>
<dt><a href="#ipcRendererEmit">ipcRendererEmit(page, message, ...args)</a> ⇒ <code>Promise.&lt;boolean&gt;</code></dt>
<dd><p>Emit an IPC message to a given window.

@@ -203,2 +203,6 @@ This will trigger all ipcRenderer listeners for the message.</p>

For example, wait for a MenuItem to be enabled... or be visible.. etc</p></dd>
<dt><a href="#addTimeoutToPromise">addTimeoutToPromise(promise, timeoutMs, timeoutMessage)</a> ⇒ <code>Promise.&lt;T&gt;</code></dt>
<dd><p>Add a timeout to any Promise</p></dd>
<dt><a href="#addTimeout">addTimeout(functionName, timeoutMs, timeoutMessage, ...args)</a> ⇒ <code>Promise.&lt;T&gt;</code></dt>
<dd><p>Add a timeout to any helper function from this library which returns a Promise.</p></dd>
</dl>

@@ -485,3 +489,3 @@

## ipcRendererCallFirstListener(window, message, ...args) ⇒ <code>Promise.&lt;unknown&gt;</code>
## ipcRendererCallFirstListener(page, message, ...args) ⇒ <code>Promise.&lt;unknown&gt;</code>
<p>Call just the first listener for a given ipcRenderer channel in a given window.

@@ -499,3 +503,3 @@ <em>UNLIKE MOST Electron ipcRenderer listeners</em>, this function SHOULD return a value.</p>

| --- | --- | --- |
| window | <code>Page</code> | <p>The Playwright Page to with the <code>ipcRenderer.on()</code> listener</p> |
| page | <code>Page</code> | <p>The Playwright Page to with the <code>ipcRenderer.on()</code> listener</p> |
| message | <code>string</code> | <p>The channel to call the first listener for</p> |

@@ -506,3 +510,3 @@ | ...args | <code>unknown</code> | <p>optional - One or more arguments to send to the ipcRenderer.on() listener</p> |

## ipcRendererEmit(window, message, ...args) ⇒ <code>Promise.&lt;boolean&gt;</code>
## ipcRendererEmit(page, message, ...args) ⇒ <code>Promise.&lt;boolean&gt;</code>
<p>Emit an IPC message to a given window.

@@ -521,3 +525,3 @@ This will trigger all ipcRenderer listeners for the message.</p>

| --- | --- | --- |
| window | <code>Page</code> | <p>the Playwright Page to with the ipcRenderer.on() listener</p> |
| page | <code>Page</code> | <p>the Playwright Page to with the ipcRenderer.on() listener</p> |
| message | <code>string</code> | <p>the channel to call all ipcRenderer listeners for</p> |

@@ -653,1 +657,33 @@ | ...args | <code>unknown</code> | <p>optional - one or more arguments to send</p> |

<a name="addTimeoutToPromise"></a>
## addTimeoutToPromise(promise, timeoutMs, timeoutMessage) ⇒ <code>Promise.&lt;T&gt;</code>
<p>Add a timeout to any Promise</p>
**Kind**: global function
**Returns**: <code>Promise.&lt;T&gt;</code> - <p>the result of the original promise if it resolves before the timeout</p>
**Category**: Utilities
**See**: addTimeout
| Param | Default | Description |
| --- | --- | --- |
| promise | | <p>the promise to add a timeout to - must be a Promise</p> |
| timeoutMs | <code>5000</code> | <p>the timeout in milliseconds - defaults to 5000</p> |
| timeoutMessage | | <p>optional - the message to return if the timeout is reached</p> |
<a name="addTimeout"></a>
## addTimeout(functionName, timeoutMs, timeoutMessage, ...args) ⇒ <code>Promise.&lt;T&gt;</code>
<p>Add a timeout to any helper function from this library which returns a Promise.</p>
**Kind**: global function
**Returns**: <code>Promise.&lt;T&gt;</code> - <p>the result of the helper function if it resolves before the timeout</p>
**Category**: Utilities
| Param | Default | Description |
| --- | --- | --- |
| functionName | | <p>the name of the helper function to call</p> |
| timeoutMs | <code>5000</code> | <p>the timeout in milliseconds - defaults to 5000</p> |
| timeoutMessage | | <p>optional - the message to return if the timeout is reached</p> |
| ...args | | <p>any arguments to pass to the helper function</p> |

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc