Skip to content

Commit b79dca6

Browse files
authored
Merge pull request #1426 from w3bdesign/develop
Create Kategorier test
2 parents 215e612 + ef341b1 commit b79dca6

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { test, expect } from '@playwright/test';
2+
3+
test.describe('Categories Navigation', () => {
4+
test.beforeEach(async ({ page }) => {
5+
await page.goto('http://localhost:3000/');
6+
});
7+
8+
test('should navigate through category pages', async ({ page }) => {
9+
// Navigate to categories page
10+
await page.getByRole('link', { name: 'Kategorier' }).click();
11+
await expect(page).toHaveURL('http://localhost:3000/kategorier');
12+
13+
// Click a category and verify navigation
14+
await page.getByRole('link', { name: 'Clothing' }).click();
15+
await expect(page).toHaveURL(/^http:\/\/localhost:3000\/kategori\/clothing/);
16+
17+
// Go back to categories
18+
await page.getByRole('link', { name: 'Kategorier' }).click();
19+
await expect(page).toHaveURL('http://localhost:3000/kategorier');
20+
21+
// Try another category
22+
await page.getByRole('link', { name: 'Tshirts' }).click();
23+
await expect(page).toHaveURL(/^http:\/\/localhost:3000\/kategori\/tshirts/);
24+
});
25+
26+
test('should navigate between categories and home', async ({ page }) => {
27+
// Go to categories
28+
await page.getByRole('link', { name: 'Kategorier' }).click();
29+
await expect(page).toHaveURL('http://localhost:3000/kategorier');
30+
31+
// Go back home
32+
await page.getByRole('link', { name: 'NETTBUTIKK' }).click();
33+
await expect(page).toHaveURL('http://localhost:3000/');
34+
});
35+
});

0 commit comments

Comments
 (0)