Skip to content

Commit

Permalink
fix playwright login without keycloak
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewrisse committed Aug 2, 2024
1 parent 0138251 commit eeb1904
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/leapfrogai_ui/src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<Label for="email">Email</Label>
<Input
id="email"
data-testid="email-input"
name="email"
type="email"
bind:value={$form.email}
Expand All @@ -43,13 +44,14 @@
<Label for="password">Password</Label>
<Input
id="password"
data-testid="password-input"
name="password"
type="password"
placeholder="Your password"
bind:value={$form.password}
/>

<Button type="submit">{isSignup ? 'Sign Up' : 'Sign In'}</Button>
<Button data-testid="submit-btn" type="submit">{isSignup ? 'Sign Up' : 'Sign In'}</Button>
{#if $errors.email}
<span style="color: red">{$errors.email}</span>
{/if}
Expand Down

This file was deleted.

Binary file not shown.
8 changes: 4 additions & 4 deletions src/leapfrogai_ui/tests/global.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ setup('authenticate', async ({ page }) => {
await page.goto('/'); // go to the home page
if (process.env.PUBLIC_DISABLE_KEYCLOAK === 'true') {
// when running in Github CI, create a new account because we don't have seed migrations
const emailField = page.getByLabel('email');
const passwordField = page.getByLabel('password');
const emailField = page.getByTestId('email-input');
const passwordField = page.getByTestId('password-input');
if (process.env.TEST_ENV === 'CI') {
await emailField.click();
await emailField.fill('[email protected]');
await passwordField.click();
await passwordField.fill('password123');
await page.getByRole('button', { name: 'Sign Up' }).click();
await page.getByTestId('submit-btn').click();
} else {
// uses local supabase test users, logs in directly with Supabase, no Keycloak
await page.getByText('Already have an account? Sign In').click();
await emailField.click();
await emailField.fill('[email protected]');
await passwordField.click();
await passwordField.fill('password123');
await page.getByRole('button', { name: 'Sign In' }).click();
await page.getByTestId('submit-btn').click();
}
} else {
// With Keycloak
Expand Down

0 comments on commit eeb1904

Please sign in to comment.