Skip to content

Commit fb95406

Browse files
Kehrlannrwinch
authored andcommitted
Fix WebAuthnWebdriverTests
Closes gh-16279
1 parent 2a76a09 commit fb95406

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Diff for: config/src/integration-test/java/org/springframework/security/config/annotation/configurers/WebAuthnWebDriverTests.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import org.junit.jupiter.api.AfterEach;
3232
import org.junit.jupiter.api.BeforeAll;
3333
import org.junit.jupiter.api.BeforeEach;
34-
import org.junit.jupiter.api.Disabled;
3534
import org.junit.jupiter.api.Test;
3635
import org.openqa.selenium.By;
3736
import org.openqa.selenium.WebElement;
@@ -67,7 +66,6 @@
6766
*
6867
* @author Daniel Garnier-Moiroux
6968
*/
70-
@Disabled
7169
class WebAuthnWebDriverTests {
7270

7371
private String baseUrl;
@@ -194,6 +192,11 @@ void loginWhenAuthenticatorRegisteredThenSuccess() {
194192
this.driver.findElement(passkeyLabel()).sendKeys("Virtual authenticator");
195193
this.driver.findElement(registerPasskeyButton()).click();
196194

195+
// Ensure the page location has changed before performing further assertions.
196+
// This is required because the location change is asynchronously performed in
197+
// javascript, and performing assertions based on this.driver.findElement(...)
198+
// may result in a StaleElementReferenceException.
199+
await(() -> assertThat(this.driver.getCurrentUrl()).endsWith("/webauthn/register?success"));
197200
await(() -> assertHasAlertStartingWith("success", "Success!"));
198201

199202
List<WebElement> passkeyRows = this.driver.findElements(passkeyTableRows());

0 commit comments

Comments
 (0)