fix(ui): AWS form selector default values (#8553)

This commit is contained in:
Alejandro Bailo
2025-08-25 12:30:02 +02:00
committed by GitHub
parent 88f38b2d2a
commit d457166a0c
6 changed files with 105 additions and 23 deletions

View File

@@ -134,25 +134,56 @@ test.describe("Session Persistence", () => {
await goToLogin(page);
await login(page, TEST_CREDENTIALS.VALID);
await verifySuccessfulLogin(page);
// Logout
await logout(page);
await verifyLogoutSuccess(page);
// Verify cannot access protected route after logout
await page.goto(URLS.DASHBOARD);
await expect(page).toHaveURL(URLS.LOGIN);
});
test("should handle session timeout gracefully", async ({ page }) => {
// Login first
await goToLogin(page);
await login(page, TEST_CREDENTIALS.VALID);
await verifySuccessfulLogin(page);
// Simulate session timeout by clearing cookies
await page.context().clearCookies();
// Try to navigate to a protected route
await page.goto(URLS.PROFILE);
// Should be redirected to login
await expect(page).toHaveURL(URLS.LOGIN);
test("should handle session timeout gracefully", async ({ browser }) => {
// Test approach: Verify that a new browser context without auth cookies
// gets redirected to login when accessing protected routes
// First, login in one context to verify auth works
const authContext = await browser.newContext();
const authPage = await authContext.newPage();
await goToLogin(authPage);
await login(authPage, TEST_CREDENTIALS.VALID);
await verifySuccessfulLogin(authPage);
// Verify session exists in authenticated context
const authResponse = await authPage.request.get("/api/auth/session");
const authSession = await authResponse.json();
expect(authSession).toBeTruthy();
expect(authSession.user).toBeTruthy();
// Now create a completely separate context without any auth
const unauthContext = await browser.newContext();
const unauthPage = await unauthContext.newPage();
// Try to access protected route in unauthenticated context
await unauthPage.goto(URLS.PROFILE, {
waitUntil: "networkidle",
});
// Should be redirected to login since this context has no auth
await expect(unauthPage).toHaveURL(URLS.LOGIN);
// Verify session is null in unauthenticated context
const unauthResponse = await unauthPage.request.get("/api/auth/session");
const unauthSessionText = await unauthResponse.text();
expect(unauthSessionText).toBe("null");
// Clean up
await authPage.close();
await authContext.close();
await unauthPage.close();
await unauthContext.close();
});
});