Skip to content

Commit e71ce54

Browse files
armanmarmanm
andauthored
docs for enabling Virtual Authenticator in Chromedriver (#799)
Co-authored-by: armanm <arman.mirkzemi@gmail.com>
1 parent cfa4adc commit e71ce54

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,33 @@ Application.put_env(:wallaby, :js_logger, file)
598598

599599
Logging can be disabled by setting `:js_logger` to `nil`.
600600

601+
### Enabling WebAuthn Virtual Authenticator (Chrome only)
602+
603+
When wanting to test Passkeys with Wallaby, you have to make sure WebAuthn Virtual Authenticator is enabled. You must execute this code to enable this feature in Chrome via the Chromedriver. This configuration will make Chrome automatically present a virtual Passkey whenever WebAuthn [create()](https://developer.mozilla.org/en-US/docs/Web/API/CredentialsContainer/create) or [get()](https://developer.mozilla.org/en-US/docs/Web/API/CredentialsContainer/get) APIs are called in browser.
604+
605+
```elixir
606+
{:ok, _result} =
607+
Wallaby.HTTPClient.request(:post, "#{session.url}/chromium/send_command_and_get_result", %{
608+
cmd: "WebAuthn.enable",
609+
params: %{}
610+
})
611+
612+
{:ok, result} =
613+
Wallaby.HTTPClient.request(:post, "#{session.url}/chromium/send_command_and_get_result", %{
614+
cmd: "WebAuthn.addVirtualAuthenticator",
615+
params: %{
616+
options: %{
617+
protocol: "ctap2",
618+
transport: "internal",
619+
hasResidentKey: true,
620+
hasUserVerification: true,
621+
isUserVerified: true,
622+
automaticPresenceSimulation: true
623+
}
624+
}
625+
})
626+
```
627+
601628
## Configuration
602629

603630
### Adjusting timeouts

0 commit comments

Comments
 (0)