@web/test-runner-commands
Advanced tools
Comparing version 0.5.8 to 0.5.9
@@ -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}.`); |
{ | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
87404
1494
4