fix(tests): update tests for granular auth toggles

- Add new fields to AppConfig type and buildAppConfig factory
- Update FE-PAGE-ADMIN-018: heading changed to "Authentication Methods"
- Update FE-PAGE-ADMIN-053: oidc_only toggle removed from OIDC panel
- Update FE-PAGE-LOGIN-007/017: mocks now include password_login/oidc_login
- Update ADMIN-SVC-049: updateOidcSettings no longer writes oidc_only
This commit is contained in:
jubnl
2026-04-11 20:30:30 +02:00
parent bfd2553d1e
commit 47d9cce936
5 changed files with 27 additions and 21 deletions
+4 -13
View File
@@ -359,13 +359,13 @@ describe('AdminPage', () => {
fireEvent.click(screen.getByRole('button', { name: /settings/i }));
const heading = await screen.findByRole('heading', { name: /allow registration/i });
const heading = await screen.findByRole('heading', { name: /authentication methods/i });
const card = heading.closest('.bg-white');
const toggle = within(card!).getByRole('button');
fireEvent.click(toggle);
const toggles = within(card!).getAllByRole('button');
fireEvent.click(toggles[0]); // First toggle = password_login
await waitFor(() => {
expect(capturedBody).toEqual(expect.objectContaining({ allow_registration: false }));
expect(capturedBody).toEqual(expect.objectContaining({ password_login: false }));
});
});
});
@@ -1328,15 +1328,6 @@ describe('AdminPage', () => {
const clientSecretInput = clientSecretLabel.closest('div')!.querySelector('input')!;
fireEvent.change(clientSecretInput, { target: { value: 'my-client-secret' } });
// OIDC-only toggle — button within the OIDC card for oidc_only toggle
// admin.oidcOnlyMode = 'Disable password authentication'
const oidcOnlyText = within(oidcCard!).getByText('Disable password authentication');
const oidcOnlySection = oidcOnlyText.closest('.flex');
const oidcOnlyToggle = oidcOnlySection?.querySelector('button');
if (oidcOnlyToggle) {
fireEvent.click(oidcOnlyToggle);
}
// Verify the inputs updated
expect((issuerInput as HTMLInputElement).value).toBe('https://accounts.google.com');
expect((clientIdInput as HTMLInputElement).value).toBe('my-client-id');
+5
View File
@@ -155,6 +155,9 @@ describe('LoginPage', () => {
oidc_configured: true,
oidc_display_name: 'Okta',
oidc_only_mode: false,
oidc_login: true,
password_login: true,
password_registration: true,
setup_complete: true,
});
}),
@@ -438,6 +441,8 @@ describe('LoginPage', () => {
demo_mode: false,
oidc_configured: true,
oidc_only_mode: true,
password_login: false,
oidc_login: true,
setup_complete: true,
});
}),