From 028c212be438eaeff233f663839f46340078dc91 Mon Sep 17 00:00:00 2001 From: Daniel Garnier-Moiroux Date: Tue, 21 Jan 2025 22:49:14 +0100 Subject: [PATCH] fix flakey test in WebAuthnWebDriverTests Closes gh-16463 Signed-off-by: Daniel Garnier-Moiroux --- .../annotation/configurers/WebAuthnWebDriverTests.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/config/src/integration-test/java/org/springframework/security/config/annotation/configurers/WebAuthnWebDriverTests.java b/config/src/integration-test/java/org/springframework/security/config/annotation/configurers/WebAuthnWebDriverTests.java index 075856f3a4..cc5d7a3501 100644 --- a/config/src/integration-test/java/org/springframework/security/config/annotation/configurers/WebAuthnWebDriverTests.java +++ b/config/src/integration-test/java/org/springframework/security/config/annotation/configurers/WebAuthnWebDriverTests.java @@ -33,6 +33,7 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.openqa.selenium.By; +import org.openqa.selenium.WebDriverException; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriverService; import org.openqa.selenium.chrome.ChromeOptions; @@ -273,12 +274,14 @@ class WebAuthnWebDriverTests { /** * Await until the assertion passes. If the assertion fails, it will display the - * assertion error in stdout. + * assertion error in stdout. WebDriver-related exceptions are ignored, so that + * {@code assertion}s can interact with the page and be retried on error, e.g. + * {@code assertThat(this.driver.findElement(By.Id("some-id")).isNotNull()}. */ private void await(Supplier> assertion) { new FluentWait<>(this.driver).withTimeout(Duration.ofSeconds(2)) .pollingEvery(Duration.ofMillis(100)) - .ignoring(AssertionError.class) + .ignoring(AssertionError.class, WebDriverException.class) .until((d) -> { assertion.get(); return true;