Skip to content

Commit 1819a7f

Browse files
committed
add invalid credentials basic auth test case
1 parent 6183cc8 commit 1819a7f

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

exercises/02.authentication/01.solution.basic/app/components/forms.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function ErrorList({
2424
const errorsToRender = errors?.filter(Boolean)
2525
if (!errorsToRender?.length) return null
2626
return (
27-
<ul id={id} className="flex flex-col gap-1">
27+
<ul id={id} className="flex flex-col gap-1" role="alert">
2828
{errorsToRender.map((e) => (
2929
<li key={e} className="text-foreground-destructive text-[10px]">
3030
{e}

exercises/02.authentication/01.solution.basic/tests/e2e/authentication.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,18 @@ test('authenticates using a email and password', async ({ navigate, page }) => {
1212

1313
await expect(page.getByText(user.name!)).toBeVisible()
1414
})
15+
16+
test('displays an error message when authenticating with invalid credentials', async ({
17+
navigate,
18+
page,
19+
}) => {
20+
await navigate('/login')
21+
22+
await page.getByLabel('Username').fill('non_existing_user')
23+
await page.getByLabel('Password').fill('non_existing_password')
24+
await page.getByRole('button', { name: 'Log in' }).click()
25+
26+
await expect(
27+
page.getByRole('alert').getByText('Invalid username or password'),
28+
).toBeVisible()
29+
})

exercises/03.databases/04.problem.test-data/README.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Test data
22

3+
- How to efficiently create and tear down test data.
4+
35
## Your task
46

57
👨‍💼 In this one, your goal is to test that your app displays the list of user's notes. For that, the authenticated user must have some notes to display! The `user` we are creating via the `authenticate` function right now has no notes and you have to change that fact for this test case to pass.

0 commit comments

Comments
 (0)