Skip to content

Commit c86796b

Browse files
committed
Retry if it doesn't work the first time
1 parent 6204458 commit c86796b

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

  • demo/integration-tests/webapp-vaadin-it/src/test/java/software/xdev/sse/demo/vaadin/cases

demo/integration-tests/webapp-vaadin-it/src/test/java/software/xdev/sse/demo/vaadin/cases/LoginOIDCTest.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,7 @@ void checkReLoginShouldKeepUrl(final TestBrowser browser)
6161
this.navigateTo("another");
6262

6363
// Delete all cookies of the CURRENT domain
64-
// Retry because GHA machine is sometimes failing here
65-
Unreliables.retryUntilSuccess(
66-
3, () -> {
67-
this.getWebDriver().manage().deleteAllCookies();
68-
return this.getWebDriver().manage().getCookies().isEmpty();
69-
});
64+
this.ensureAllCookiesDeleted();
7065
this.getWebDriver().navigate().refresh();
7166

7267
// Should be restored to the same path/view
@@ -85,14 +80,24 @@ void checkReLoginShouldNOTKeepUrlIfViewDoesNotExist(final TestBrowser browser)
8580
this.navigateTo("anotherThatDoesNotExist");
8681

8782
// Delete all cookies of the CURRENT domain
88-
this.getWebDriver().manage().deleteAllCookies();
83+
this.ensureAllCookiesDeleted();
8984
this.getWebDriver().navigate().refresh();
9085

9186
// Should be restored to the same path/view
9287
Assertions.assertDoesNotThrow(() ->
9388
this.waitUntil(ExpectedConditions.urlToBe(this.getWebAppBaseUrl() + "/main")));
9489
}
9590

91+
private void ensureAllCookiesDeleted()
92+
{
93+
// Retry because GHA machine is sometimes failing here
94+
Unreliables.retryUntilSuccess(
95+
3, () -> {
96+
this.getWebDriver().manage().deleteAllCookies();
97+
return this.getWebDriver().manage().getCookies().isEmpty();
98+
});
99+
}
100+
96101
@DisplayName("Check Login works when OIDC offline")
97102
@ParameterizedTest
98103
@EnumSource(TestBrowser.class)

0 commit comments

Comments
 (0)