Socket
Socket
Sign inDemoInstall

@web/test-runner-commands

Package Overview
Dependencies
Maintainers
7
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@web/test-runner-commands - npm Package Compare versions

Comparing version 0.5.8 to 0.5.9

4

browser/commands.d.ts

@@ -53,2 +53,6 @@ import {

*
* Or, the Webdriver documentation, here:
*
* https://webdriver.io/docs/api/browser/keys/
*
* @param payload An object including a `press` or `type` property an the associated string

@@ -55,0 +59,0 @@ * for the browser runner to apply via that input method.

# @web/test-runner-commands
## 0.5.9
### Patch Changes
- 056ba8c8: Add sendKeys support for webdriver
## 0.5.8

@@ -4,0 +10,0 @@

@@ -82,2 +82,17 @@ "use strict";

}
// handle specific behavior for webdriver
if (session.browser.type === 'webdriver') {
const browser = session.browser;
if (isTypePayload(payload)) {
await browser.sendKeys(session.id, payload.type.split(''));
return true;
}
else if (isPressPayload(payload)) {
await browser.sendKeys(session.id, [payload.press]);
return true;
}
else {
throw new Error('Only "press" and "type" are supported by webdriver.');
}
}
// you might not be able to support all browser launchers

@@ -84,0 +99,0 @@ throw new Error(`Sending keys is not supported for browser type ${session.browser.type}.`);

3

package.json
{
"name": "@web/test-runner-commands",
"version": "0.5.8",
"version": "0.5.9",
"publishConfig": {

@@ -54,4 +54,5 @@ "access": "public"

"@web/test-runner-playwright": "^0.8.5",
"@web/test-runner-webdriver": "^0.4.1",
"mocha": "^8.2.1"
}
}
import { TestRunnerPlugin } from '@web/test-runner-core';
import type { ChromeLauncher, puppeteerCore } from '@web/test-runner-chrome';
import type { PlaywrightLauncher } from '@web/test-runner-playwright';
import type { WebdriverLauncher } from '@web/test-runner-webdriver';

@@ -104,2 +105,16 @@ type TypePayload = { type: string };

// handle specific behavior for webdriver
if (session.browser.type === 'webdriver') {
const browser = session.browser as WebdriverLauncher;
if (isTypePayload(payload)) {
await browser.sendKeys(session.id, payload.type.split(''));
return true;
} else if (isPressPayload(payload)) {
await browser.sendKeys(session.id, [payload.press]);
return true;
} else {
throw new Error('Only "press" and "type" are supported by webdriver.');
}
}
// you might not be able to support all browser launchers

@@ -106,0 +121,0 @@ throw new Error(`Sending keys is not supported for browser type ${session.browser.type}.`);

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