Files
keycloak-js/test/tests/login.spec.ts
T
Jon Koops 8b85448c21 Add basic test suite setup (#55)
Closes #53

Signed-off-by: Jon Koops <jonkoops@gmail.com>
Signed-off-by: Peter Skopek <pskopek@redhat.com>
Co-authored-by: Peter Skopek <pskopek@redhat.com>
2025-04-03 09:14:28 +02:00

18 lines
748 B
TypeScript

import { expect, test } from '@playwright/test'
import { createTestResources } from '../support/helpers.ts'
import { TestExecutor } from '../support/test-executor.ts'
test('logs in and out', async ({ page }) => {
const realm = await createTestResources()
const executor = new TestExecutor(page, realm)
// Initially, no user should be authenticated.
expect(await executor.initializeAdapter()).toBe(false)
// After triggering a login, the user should be authenticated.
await executor.login()
await executor.submitLoginForm()
expect(await executor.initializeAdapter()).toBe(true)
// After logging out, the user should no longer be authenticated.
await executor.logout()
expect(await executor.initializeAdapter()).toBe(false)
})