Skip to content

Commit a679563

Browse files
fix: update e2e tests to match current UI (closes #104) (#105)
- Use exact label match for Password field to avoid matching show/hide toggle - Update login button selector from 'Login' to 'Sign in' - Update toolbar nav from button role to link role with current labels Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent dc0600b commit a679563

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

apps/web-app-e2e/src/login.e2e.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ test.describe('Login page', () => {
1111
await page.goto('/login');
1212

1313
await expect(page.getByLabel('Email')).toBeVisible();
14-
await expect(page.getByLabel('Password')).toBeVisible();
14+
await expect(page.getByLabel('Password', { exact: true })).toBeVisible();
1515
});
1616

17-
test('should display a Login button', async ({ page }) => {
17+
test('should display a Sign in button', async ({ page }) => {
1818
await page.goto('/login');
1919

20-
await expect(page.getByRole('button', { name: /login/i })).toBeVisible();
20+
await expect(page.getByRole('button', { name: /sign in/i })).toBeVisible();
2121
});
2222

2323
test('login button should be disabled when form is invalid', async ({
@@ -28,7 +28,7 @@ test.describe('Login page', () => {
2828
// Clear the pre-filled email so the form becomes invalid
2929
await page.getByLabel('Email').fill('');
3030

31-
await expect(page.getByRole('button', { name: /login/i })).toBeDisabled();
31+
await expect(page.getByRole('button', { name: /sign in/i })).toBeDisabled();
3232
});
3333

3434
test('login button should be enabled when form is valid', async ({
@@ -37,8 +37,8 @@ test.describe('Login page', () => {
3737
await page.goto('/login');
3838

3939
await page.getByLabel('Email').fill('user@example.com');
40-
await page.getByLabel('Password').fill('password123');
40+
await page.getByLabel('Password', { exact: true }).fill('password123');
4141

42-
await expect(page.getByRole('button', { name: /login/i })).toBeEnabled();
42+
await expect(page.getByRole('button', { name: /sign in/i })).toBeEnabled();
4343
});
4444
});

apps/web-app-e2e/src/navigation.e2e.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@ test.describe('Navigation', () => {
44
test.describe('toolbar (desktop)', () => {
55
test.use({ viewport: { width: 1280, height: 720 } });
66

7-
test('should navigate to weather forecast page via toolbar button', async ({
7+
test('should navigate to weather forecast page via toolbar link', async ({
88
page,
99
}) => {
1010
await page.goto('/');
1111

12-
await page.getByRole('button', { name: 'Get Data Feature' }).click();
12+
await page.getByRole('link', { name: 'Weather Forecasts' }).click();
1313

1414
await expect(page).toHaveURL(/\/weather-forecast/);
1515
await expect(page.getByTestId('lib-weather-forecast')).toBeVisible();
1616
});
1717

18-
test('should navigate to counter page via toolbar button', async ({
18+
test('should navigate to counter page via toolbar link', async ({
1919
page,
2020
}) => {
2121
await page.goto('/');
2222

23-
await page.getByRole('button', { name: 'Lazy Loaded Feature' }).click();
23+
await page.getByRole('link', { name: 'Counter' }).click();
2424

2525
await expect(page).toHaveURL(/\/feature/);
2626
await expect(page.getByTestId('lib-counter-container')).toBeVisible();

0 commit comments

Comments
 (0)