Enable 5 previously skipped e2e tests
All checks were successful
Deploy / deploy (push) Successful in 1m37s
All checks were successful
Deploy / deploy (push) Successful in 1m37s
- Fix OIDC tests with route interception for auth-methods API - Add data-testid to DecisionCard for reliable test selection - Fix /api/today to fetch fresh user data instead of stale cookie data - Fix period logging test timing with proper API wait patterns - Fix decision engine test with waitForResponse instead of timeout - Simplify mobile viewport test locator All 206 e2e tests now pass with 0 skipped. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -228,26 +228,42 @@ test.describe("authentication", () => {
|
||||
});
|
||||
|
||||
test.describe("OIDC authentication flow", () => {
|
||||
// Mock PocketBase auth-methods to return OIDC provider
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.route("**/api/collections/users/auth-methods*", (route) => {
|
||||
route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({
|
||||
usernamePassword: true,
|
||||
oauth2: {
|
||||
enabled: true,
|
||||
providers: [
|
||||
{
|
||||
name: "oidc",
|
||||
displayName: "Test Provider",
|
||||
state: "mock-state",
|
||||
codeVerifier: "mock-verifier",
|
||||
codeChallenge: "mock-challenge",
|
||||
codeChallengeMethod: "S256",
|
||||
authURL: "https://mock.example.com/auth",
|
||||
},
|
||||
],
|
||||
},
|
||||
}),
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test("OIDC button shows provider name when configured", async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.goto("/login");
|
||||
await page.waitForLoadState("networkidle");
|
||||
|
||||
// Look for OIDC sign-in button with provider name
|
||||
const oidcButton = page.getByRole("button", { name: /sign in with/i });
|
||||
const hasOidc = await oidcButton.isVisible().catch(() => false);
|
||||
|
||||
if (hasOidc) {
|
||||
// OIDC button should show provider display name
|
||||
await expect(oidcButton).toBeVisible();
|
||||
// Button text should include "Sign in with" prefix
|
||||
const buttonText = await oidcButton.textContent();
|
||||
expect(buttonText?.toLowerCase()).toContain("sign in with");
|
||||
} else {
|
||||
// Skip test if OIDC not configured (email/password mode)
|
||||
test.skip();
|
||||
}
|
||||
await expect(oidcButton).toBeVisible();
|
||||
await expect(oidcButton).toContainText("Test Provider");
|
||||
});
|
||||
|
||||
test("OIDC button shows loading state during authentication", async ({
|
||||
@@ -256,22 +272,18 @@ test.describe("authentication", () => {
|
||||
await page.goto("/login");
|
||||
await page.waitForLoadState("networkidle");
|
||||
|
||||
// Find button by initial text
|
||||
const oidcButton = page.getByRole("button", { name: /sign in with/i });
|
||||
const hasOidc = await oidcButton.isVisible().catch(() => false);
|
||||
await expect(oidcButton).toBeVisible();
|
||||
|
||||
if (hasOidc) {
|
||||
// Click the button
|
||||
await oidcButton.click();
|
||||
// Click and immediately check for loading state
|
||||
// The button text changes to "Signing in..." so we need a different locator
|
||||
await oidcButton.click();
|
||||
|
||||
// Button should show "Signing in..." state
|
||||
await expect(oidcButton)
|
||||
.toContainText(/signing in/i, { timeout: 2000 })
|
||||
.catch(() => {
|
||||
// May redirect too fast to catch loading state - that's acceptable
|
||||
});
|
||||
} else {
|
||||
test.skip();
|
||||
}
|
||||
// Find the button that shows loading state (text changed)
|
||||
const loadingButton = page.getByRole("button", { name: /signing in/i });
|
||||
await expect(loadingButton).toBeVisible();
|
||||
await expect(loadingButton).toBeDisabled();
|
||||
});
|
||||
|
||||
test("OIDC button is disabled when rate limited", async ({ page }) => {
|
||||
@@ -279,15 +291,9 @@ test.describe("authentication", () => {
|
||||
await page.waitForLoadState("networkidle");
|
||||
|
||||
const oidcButton = page.getByRole("button", { name: /sign in with/i });
|
||||
const hasOidc = await oidcButton.isVisible().catch(() => false);
|
||||
|
||||
if (hasOidc) {
|
||||
// Initial state should not be disabled
|
||||
const isDisabledBefore = await oidcButton.isDisabled();
|
||||
expect(isDisabledBefore).toBe(false);
|
||||
} else {
|
||||
test.skip();
|
||||
}
|
||||
// Initial state should not be disabled
|
||||
await expect(oidcButton).not.toBeDisabled();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user