Add frontend project structure with React/TypeScript setup
This commit is contained in:
1 parent
c7abb73c66
commit
6914a6855c
58 files changed
+9056
-236
No files matched your search
@@ -0,0 +1,64 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
test.describe('Home Page E2E Tests', () => {
|
||||
test('loads home page successfully', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
|
||||
const title = page.getByText('newzy');
|
||||
await expect(title).toBeVisible();
|
||||
});
|
||||
|
||||
test('renders navigation links with proper href attributes', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
|
||||
const homeLink = page.getByRole('link', { name: /home/i });
|
||||
const articlesLink = page.getByRole('link', { name: /articles/i });
|
||||
const categoriesLink = page.getByRole('link', { name: /categories/i });
|
||||
|
||||
await expect(homeLink).toHaveAttribute('href', '/');
|
||||
await expect(articlesLink).toHaveAttribute('href', '/articles');
|
||||
await expect(categoriesLink).toHaveAttribute('href', '/categories');
|
||||
});
|
||||
|
||||
test('renders article grid with content', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
|
||||
const articleCard = page.locator('.article-card');
|
||||
await expect(articleCard).toBeVisible();
|
||||
});
|
||||
|
||||
test('passes accessibility checks for navigation', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
|
||||
const navLinks = page.locator('.nav a');
|
||||
await expect(navLinks).toHaveCount(3);
|
||||
|
||||
for (const link of await navLinks.all()) {
|
||||
await expect(link).toBeAccessible();
|
||||
}
|
||||
});
|
||||
|
||||
test('verifies react-router links navigate without full reload', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
|
||||
const articlesLink = page.getByRole('link', { name: /articles/i });
|
||||
await articlesLink.click();
|
||||
|
||||
// Client-side navigation should happen without full page reload
|
||||
const url = page.url();
|
||||
expect(url).toContain('/articles');
|
||||
});
|
||||
|
||||
test('page structure contains expected elements', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
|
||||
// Check for layout components
|
||||
const header = page.locator('header');
|
||||
const mainContent = page.locator('main.content-area');
|
||||
const footer = page.locator('.footer-section');
|
||||
|
||||
await expect(header).toBeVisible();
|
||||
await expect(mainContent).toBeVisible();
|
||||
await expect(footer).toBeVisible();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user