Skip to content

Commit 0096a6e

Browse files
committed
Fix download modal E2E tests to use correct selectors
- Replace getByRole('tab') with locator('.nav-tabs').getByText() since Reactstrap NavLink doesn't use role="tab" - Use getByRole('heading') for h3 headings like 'Easy Install', 'Mac OS X', 'Windows' - Scope all selectors properly to avoid strict mode violations
1 parent 4824d5d commit 0096a6e

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

frontend/e2e/download-modal.spec.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,19 @@ test.describe('Download Modal Flow', () => {
1616
await page.goto('/#download');
1717

1818
const modal = page.locator('.modal');
19+
const navTabs = modal.locator('.nav-tabs');
1920
// Check for tab elements with OS names
20-
await expect(modal.getByRole('tab', { name: /ubuntu/i })).toBeVisible();
21-
await expect(modal.getByRole('tab', { name: /debian/i })).toBeVisible();
22-
await expect(modal.getByRole('tab', { name: /other/i })).toBeVisible();
21+
await expect(navTabs.getByText('Ubuntu')).toBeVisible();
22+
await expect(navTabs.getByText('Debian')).toBeVisible();
23+
await expect(navTabs.getByText('Other')).toBeVisible();
2324
});
2425

2526
test('should show Ubuntu instructions by default', async ({ page }) => {
2627
await page.goto('/#download');
2728

2829
const modal = page.locator('.modal');
2930
// Ubuntu Easy Install should be visible
30-
await expect(modal.getByText('Easy Install').first()).toBeVisible();
31+
await expect(modal.getByRole('heading', { name: 'Easy Install' }).first()).toBeVisible();
3132
await expect(modal.getByText(/ubuntu 17.04 and later/i)).toBeVisible();
3233
await expect(modal.getByText('sudo apt install cryfs').first()).toBeVisible();
3334
});
@@ -36,7 +37,8 @@ test.describe('Download Modal Flow', () => {
3637
await page.goto('/#download');
3738

3839
const modal = page.locator('.modal');
39-
await modal.getByRole('tab', { name: /debian/i }).click();
40+
// Click on Debian tab using the nav-link
41+
await modal.locator('.nav-tabs').getByText('Debian').click();
4042

4143
// Debian instructions should be visible
4244
await expect(modal.getByText(/debian stretch and later/i)).toBeVisible();
@@ -46,10 +48,11 @@ test.describe('Download Modal Flow', () => {
4648
await page.goto('/#download');
4749

4850
const modal = page.locator('.modal');
49-
await modal.getByRole('tab', { name: /other/i }).click();
51+
// Click on Other tab
52+
await modal.locator('.nav-tabs').getByText('Other').click();
5053

5154
// macOS instructions should be visible
52-
await expect(modal.getByText('Mac OS X').first()).toBeVisible();
55+
await expect(modal.getByRole('heading', { name: 'Mac OS X' })).toBeVisible();
5356
await expect(modal.getByText('brew install --cask macfuse').first()).toBeVisible();
5457
await expect(modal.getByText('brew install cryfs/tap/cryfs').first()).toBeVisible();
5558
});
@@ -58,18 +61,19 @@ test.describe('Download Modal Flow', () => {
5861
await page.goto('/#download');
5962

6063
const modal = page.locator('.modal');
61-
await modal.getByRole('tab', { name: /other/i }).click();
64+
// Click on Other tab
65+
await modal.locator('.nav-tabs').getByText('Other').click();
6266

6367
// Windows instructions should be visible
64-
await expect(modal.getByText('Windows').first()).toBeVisible();
68+
await expect(modal.getByRole('heading', { name: 'Windows' })).toBeVisible();
6569
await expect(modal.getByText(/windows support is highly experimental/i)).toBeVisible();
6670
});
6771

6872
test('should have DokanY download link', async ({ page }) => {
6973
await page.goto('/#download');
7074

7175
const modal = page.locator('.modal');
72-
await modal.getByRole('tab', { name: /other/i }).click();
76+
await modal.locator('.nav-tabs').getByText('Other').click();
7377

7478
const dokanLink = modal.getByRole('link', { name: /dokany/i });
7579
await expect(dokanLink).toBeVisible();

0 commit comments

Comments
 (0)