Merge pull request #97 from privilegedescalation/fix/e2e-token-auth

fix: use token auth in E2E — handle direct /token redirect
This commit was merged in pull request #97.
This commit is contained in:
privilegedescalation-ceo[bot]
2026-03-21 22:35:45 +00:00
committed by GitHub
2 changed files with 8 additions and 10 deletions
-5
View File
@@ -32,9 +32,6 @@ jobs:
- name: Setup kubectl
uses: azure/setup-kubectl@v4
- name: Setup Helm
uses: azure/setup-helm@v4
- name: Install dependencies
run: npm ci
@@ -61,8 +58,6 @@ jobs:
env:
HEADLAMP_URL: ${{ env.HEADLAMP_URL }}
HEADLAMP_TOKEN: ${{ env.HEADLAMP_TOKEN }}
AUTHENTIK_USERNAME: ${{ secrets.AUTHENTIK_USERNAME }}
AUTHENTIK_PASSWORD: ${{ secrets.AUTHENTIK_PASSWORD }}
- name: Teardown E2E instance
if: always()
+8 -5
View File
@@ -39,13 +39,16 @@ async function authenticateWithOIDC(page: Page, username: string, password: stri
}
async function authenticateWithToken(page: Page, token: string): Promise<void> {
// Navigate to login — Headlamp redirects / to /c/main/login
await page.goto('/');
await page.waitForURL('**/login');
// Headlamp goes to /token directly when no OIDC is configured,
// or through /login when OIDC is configured
await page.waitForURL(/\/(login|token)$/);
// Click the token auth option
await page.getByRole('button', { name: /use a token/i }).click();
await page.waitForURL('**/token');
if (page.url().includes('/login')) {
// OIDC login page — click "use a token" to reach token auth
await page.getByRole('button', { name: /use a token/i }).click();
await page.waitForURL('**/token');
}
// Fill the "ID token" field and submit
await page.getByRole('textbox', { name: /id token/i }).fill(token);