Skip to content

Commit 316536e

Browse files
committed
Add test for "Re-Login should keep url"
1 parent 469a3ed commit 316536e

File tree

1 file changed

+21
-0
lines changed
  • demo/integration-tests/webapp-vaadin-it/src/test/java/software/xdev/sse/demo/vaadin/cases

1 file changed

+21
-0
lines changed

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
import static org.junit.jupiter.api.Assertions.assertNotNull;
55
import static org.junit.jupiter.api.Assertions.assertTrue;
66

7+
import org.junit.jupiter.api.Assertions;
78
import org.junit.jupiter.api.DisplayName;
89
import org.junit.jupiter.params.ParameterizedTest;
910
import org.junit.jupiter.params.provider.EnumSource;
11+
import org.openqa.selenium.support.ui.ExpectedConditions;
1012

1113
import software.xdev.sse.demo.entities.UserDetail;
1214
import software.xdev.sse.demo.persistence.jpa.dao.UserDetailDAO;
@@ -47,6 +49,25 @@ void checkSignupOfUser(final TestBrowser browser)
4749
assertEquals(this.oidcInfra().getDefaultUserName(), user.getFullName());
4850
}
4951

52+
@DisplayName("Re-Login should keep url")
53+
@ParameterizedTest
54+
@EnumSource(TestBrowser.class)
55+
void checkReLoginShouldKeepUrl(final TestBrowser browser)
56+
{
57+
this.startAll(browser, dbCtrl -> dbCtrl.useNewEntityManager(em -> new DefaultDG(em).generateAll()));
58+
59+
this.loginAndGotoMainSite();
60+
this.navigateTo("another");
61+
62+
// Delete all cookies of the CURRENT domain
63+
this.getWebDriver().manage().deleteAllCookies();
64+
this.getWebDriver().navigate().refresh();
65+
66+
// Should be restored to the same path/view
67+
Assertions.assertDoesNotThrow(() ->
68+
this.waitUntil(ExpectedConditions.urlToBe(this.getWebAppBaseUrl() + "/another?continue")));
69+
}
70+
5071
@DisplayName("Check Login works when OIDC offline")
5172
@ParameterizedTest
5273
@EnumSource(TestBrowser.class)

0 commit comments

Comments
 (0)