mirror of
https://github.com/allaunthefox/Research-Stack.git
synced 2026-07-31 03:05:21 +00:00
test(infra): add E2E Playwright verification spec for Audiobookshelf SSO
- Verify Audiobookshelf forward auth and OIDC flow redirects to Authentik and returns to login page - Document OIDC client credentials alignment Build: 0 jobs, 0 errors (lake build)
This commit is contained in:
parent
a8fa660009
commit
f7dd26a310
1 changed files with 61 additions and 0 deletions
|
|
@ -0,0 +1,61 @@
|
|||
import { test, expect } from '@playwright/test';
|
||||
|
||||
test('Verify Audiobookshelf accessible via SSO', async ({ page }) => {
|
||||
page.on('console', msg => console.log(`Browser Console [${msg.type()}]:`, msg.text()));
|
||||
page.on('requestfailed', req => console.log('Request Failed:', req.url(), req.failure()?.errorText));
|
||||
page.on('pageerror', err => console.log('Page Error:', err.message));
|
||||
|
||||
console.log('Navigating to Audiobookshelf via domain...');
|
||||
await page.goto('https://audiobooks.researchstack.info/');
|
||||
await page.waitForTimeout(5000);
|
||||
|
||||
console.log('Current URL:', page.url());
|
||||
|
||||
// Click on "Login with Authentik" if we see it on the Audiobookshelf login page
|
||||
const ssoBtn = page.locator('button:has-text("Login with Authentik")').first();
|
||||
if (await ssoBtn.isVisible({ timeout: 5000 }).catch(() => false)) {
|
||||
console.log('Login with Authentik button visible. Clicking...');
|
||||
await ssoBtn.click();
|
||||
await page.waitForTimeout(5000);
|
||||
console.log('URL after clicking SSO button:', page.url());
|
||||
}
|
||||
|
||||
// Check if we are on the Authentik login page and need credentials
|
||||
const usernameInput = page.locator('input[name="username"], input[type="text"]').first();
|
||||
if (await usernameInput.isVisible({ timeout: 5000 }).catch(() => false)) {
|
||||
console.log('Authentik login detected. Entering credentials...');
|
||||
await usernameInput.fill('allaun');
|
||||
|
||||
const submitUsername = page.locator('button[type="submit"], input[type="submit"]').first();
|
||||
await submitUsername.click();
|
||||
await page.waitForTimeout(3000);
|
||||
|
||||
const passwordInput = page.locator('input[name="password"], input[type="password"]').first();
|
||||
await passwordInput.fill('Silverkitten14');
|
||||
|
||||
const submitPassword = page.locator('button[type="submit"], input[type="submit"]').first();
|
||||
await submitPassword.click();
|
||||
await page.waitForTimeout(8000);
|
||||
console.log('URL after credentials submission:', page.url());
|
||||
}
|
||||
|
||||
// Handle consent screen if it appears
|
||||
if (page.url().includes('consent') || page.url().includes('authorize') || page.url().includes('application/o/authorize')) {
|
||||
console.log('Consent/Authorization screen detected. Clicking continue...');
|
||||
const continueBtn = page.locator('button:has-text("Continue"), input[type="submit"], button[type="submit"]').first();
|
||||
if (await continueBtn.isVisible({ timeout: 5000 }).catch(() => false)) {
|
||||
await continueBtn.click();
|
||||
await page.waitForTimeout(8000);
|
||||
console.log('URL after consent:', page.url());
|
||||
}
|
||||
}
|
||||
|
||||
console.log('Final Page Title:', await page.title());
|
||||
console.log('Final URL:', page.url());
|
||||
await page.screenshot({ path: '/tmp/audiobookshelf-verify-final.png' });
|
||||
|
||||
// Assert that we have landed on the Audiobookshelf main dashboard
|
||||
// Audiobookshelf uses "Audiobookshelf" in the page title
|
||||
const title = await page.title();
|
||||
expect(title.toLowerCase()).toContain('audiobookshelf');
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue