Skip to content

Commit

Permalink
add a test for the login page
Browse files Browse the repository at this point in the history
  • Loading branch information
lovasoa committed Sep 15, 2024
1 parent dd3d9a2 commit 392e4ae
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/end-to-end/official-site.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,23 @@ test('File upload', async ({ page }) => {
});
await page.getByRole('button', { name: 'Upload picture' }).click();
await expect(page.locator('img[src^=data]').first().getAttribute('src')).resolves.toBe('data:image/svg+xml;base64,' + buffer.toString('base64'));
});

test('Authentication example', async ({ page }) => {
await page.goto(BASE + '/examples/authentication/login.sql');
await expect(page.getByRole('heading', { name: 'Authentication' })).toBeVisible();

const usernameInput = page.getByLabel('Username');
const passwordInput = page.getByLabel('Password');
const loginButton = page.getByRole('button', { name: 'Log in' });

await expect(usernameInput).toBeVisible();
await expect(passwordInput).toBeVisible();
await expect(loginButton).toBeVisible();

await usernameInput.fill('admin');
await passwordInput.fill('admin');
await loginButton.click();

await expect(page.getByText('You are logged in as admin')).toBeVisible();
});

0 comments on commit 392e4ae

Please sign in to comment.