|
20 | 20 | import static java.util.Collections.EMPTY_LIST;
|
21 | 21 | import static java.util.Collections.emptyMap;
|
22 | 22 | import static java.util.Collections.singletonList;
|
| 23 | +import static java.util.Collections.singletonMap; |
23 | 24 | import static org.assertj.core.api.Assertions.assertThat;
|
24 | 25 | import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
25 |
| -import static org.mockito.ArgumentMatchers.argThat; |
26 | 26 | import static org.mockito.Mockito.mock;
|
27 |
| -import static org.mockito.Mockito.verify; |
28 | 27 | import static org.mockito.Mockito.verifyNoMoreInteractions;
|
| 28 | +import static org.mockito.Mockito.when; |
29 | 29 | import static org.openqa.selenium.remote.WebDriverFixture.errorResponder;
|
30 | 30 | import static org.openqa.selenium.remote.WebDriverFixture.webDriverExceptionResponder;
|
31 | 31 | import static org.openqa.selenium.remote.WebDriverFixture.echoCapabilities;
|
|
51 | 51 | import org.openqa.selenium.WebElement;
|
52 | 52 | import org.openqa.selenium.WindowType;
|
53 | 53 | import org.openqa.selenium.testing.UnitTests;
|
| 54 | +import org.openqa.selenium.virtualauthenticator.VirtualAuthenticator; |
| 55 | +import org.openqa.selenium.virtualauthenticator.VirtualAuthenticatorOptions; |
54 | 56 |
|
55 | 57 | import java.io.IOException;
|
56 |
| -import java.io.UncheckedIOException; |
57 | 58 | import java.net.URL;
|
58 | 59 | import java.time.Duration;
|
59 | 60 | import java.util.Arrays;
|
@@ -661,6 +662,33 @@ public void canHandleIME() {
|
661 | 662 | new CommandPayload(DriverCommand.IME_GET_AVAILABLE_ENGINES, emptyMap()));
|
662 | 663 | }
|
663 | 664 |
|
| 665 | + @Test |
| 666 | + public void canAddVirtualAuthenticator() { |
| 667 | + WebDriverFixture fixture = new WebDriverFixture( |
| 668 | + echoCapabilities, valueResponder("authId")); |
| 669 | + |
| 670 | + VirtualAuthenticatorOptions options = new VirtualAuthenticatorOptions(); |
| 671 | + VirtualAuthenticator auth = fixture.driver.addVirtualAuthenticator(options); |
| 672 | + |
| 673 | + assertThat(auth.getId()).isEqualTo("authId"); |
| 674 | + fixture.verifyCommands( |
| 675 | + new CommandPayload(DriverCommand.ADD_VIRTUAL_AUTHENTICATOR, options.toMap())); |
| 676 | + } |
| 677 | + |
| 678 | + @Test |
| 679 | + public void canRemoveVirtualAuthenticator() { |
| 680 | + WebDriverFixture fixture = new WebDriverFixture( |
| 681 | + echoCapabilities, nullValueResponder); |
| 682 | + VirtualAuthenticator auth = mock(VirtualAuthenticator.class); |
| 683 | + when(auth.getId()).thenReturn("authId"); |
| 684 | + |
| 685 | + fixture.driver.removeVirtualAuthenticator(auth); |
| 686 | + |
| 687 | + fixture.verifyCommands( |
| 688 | + new CommandPayload(DriverCommand.REMOVE_VIRTUAL_AUTHENTICATOR, |
| 689 | + singletonMap("authenticatorId", "authId"))); |
| 690 | + } |
| 691 | + |
664 | 692 | @Test
|
665 | 693 | public void canHandleWebDriverExceptionThrownByCommandExecutor() {
|
666 | 694 | WebDriverFixture fixture = new WebDriverFixture(
|
|
0 commit comments