Skip to content

Commit 5a4dfe5

Browse files
committed
[bazel] Get the virtual authenticator test working on EngFlow
1 parent 018293f commit 5a4dfe5

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

java/test/org/openqa/selenium/virtualauthenticator/VirtualAuthenticatorTest.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
import static org.assertj.core.api.InstanceOfAssertFactories.MAP;
2424
import static org.junit.jupiter.api.Assertions.assertThrows;
2525

26+
import java.net.MalformedURLException;
27+
import java.net.URI;
28+
import java.net.URL;
2629
import java.security.spec.PKCS8EncodedKeySpec;
2730
import java.util.Arrays;
2831
import java.util.Base64;
@@ -66,10 +69,24 @@ class VirtualAuthenticatorTest extends JupiterTestBase {
6669
private VirtualAuthenticator authenticator;
6770

6871
@BeforeEach
69-
public void setup() {
72+
public void setup() throws MalformedURLException {
7073
assumeThat(driver).isInstanceOf(HasVirtualAuthenticator.class);
7174
jsAwareDriver = (JavascriptExecutor) driver;
72-
driver.get(appServer.whereIs("virtual-authenticator.html"));
75+
76+
// According to the spec, the only way we can use the virtual
77+
// authenticator is if we are using HTTPS or contacting
78+
// `localhost` directly. When we try and access the `NettyAppServer`
79+
// over HTTPS, the `registerCredential` method is missing. Let's
80+
// make the assumption that the server being used is running on
81+
// `localhost` and rewrite URLs from there.
82+
URL url = new URL(appServer.whereIs("virtual-authenticator.html"));
83+
String localUrl = new URL(
84+
url.getProtocol(),
85+
"localhost",
86+
url.getPort(),
87+
url.getFile()).toString();
88+
89+
driver.get(localUrl);
7390
}
7491

7592
private void createRKEnabledU2FAuthenticator() {

0 commit comments

Comments
 (0)