2323import static org .junit .jupiter .api .Assertions .assertThrows ;
2424import static org .openqa .selenium .testing .drivers .Browser .CHROME ;
2525
26+ import java .net .MalformedURLException ;
27+ import java .net .URL ;
2628import java .time .Duration ;
2729import java .util .List ;
2830import org .junit .jupiter .api .AfterEach ;
@@ -42,18 +44,32 @@ class FederatedCredentialManagementTest {
4244
4345 private HasFederatedCredentialManagement fedcmDriver ;
4446 private WebDriver localDriver ;
45- InProcessTestEnvironment environment = new InProcessTestEnvironment (false );
47+ InProcessTestEnvironment environment = new InProcessTestEnvironment (true );
4648 AppServer appServer = environment .getAppServer ();
4749
4850 @ BeforeEach
4951 public void setup () {
5052 ChromeOptions options = (ChromeOptions ) CHROME .getCapabilities ();
5153 options .setAcceptInsecureCerts (true );
54+ options .addArguments (
55+ String .format ("host-resolver-rules=MAP localhost:443 localhost:%d" , getSecurePort ()));
56+ options .addArguments ("ignore-certificate-errors" );
57+ options .addArguments ("--enable-fedcm-without-well-known-enforcement" );
5258 localDriver = new ChromeDriver (options );
5359
5460 assumeThat (localDriver ).isInstanceOf (HasFederatedCredentialManagement .class );
5561 fedcmDriver = (HasFederatedCredentialManagement ) localDriver ;
56- localDriver .get (appServer .whereIs ("/fedcm/fedcm_async.html" ));
62+ localDriver .get (appServer .whereIsSecure ("/fedcm/fedcm_async.html" ));
63+ }
64+
65+ private int getSecurePort () {
66+ String urlString = appServer .whereIsSecure ("/" );
67+ try {
68+ return new URL (urlString ).getPort ();
69+ } catch (MalformedURLException ex ) {
70+ // This should not happen.
71+ return 0 ;
72+ }
5773 }
5874
5975 @ AfterEach
0 commit comments