Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/tests/Categories/Categories.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { test, expect } from '@playwright/test';

test.describe('Categories Navigation', () => {
test.beforeEach(async ({ page }) => {
await page.goto('http://localhost:3000/');
});

test('should navigate through category pages', async ({ page }) => {
// Navigate to categories page
await page.getByRole('link', { name: 'Kategorier' }).click();
await expect(page).toHaveURL('http://localhost:3000/kategorier');

// Click a category and verify navigation
await page.getByRole('link', { name: 'Clothing' }).click();
await expect(page).toHaveURL(/^http:\/\/localhost:3000\/kategori\/clothing/);

// Go back to categories
await page.getByRole('link', { name: 'Kategorier' }).click();
await expect(page).toHaveURL('http://localhost:3000/kategorier');

// Try another category
await page.getByRole('link', { name: 'Tshirts' }).click();
await expect(page).toHaveURL(/^http:\/\/localhost:3000\/kategori\/tshirts/);
});

test('should navigate between categories and home', async ({ page }) => {
// Go to categories
await page.getByRole('link', { name: 'Kategorier' }).click();
await expect(page).toHaveURL('http://localhost:3000/kategorier');

// Go back home
await page.getByRole('link', { name: 'NETTBUTIKK' }).click();
await expect(page).toHaveURL('http://localhost:3000/');
});
});
Loading