import { test, expect } from '@playwright/test'; test('register, login and create item', async ({ page }) => { const email = `test${Date.now()}@example.com`; const password = 'test1234'; // Register via backend API const registerResponse = await page.request.post('http://localhost:8000/auth/register', { data: { email, password }, }); expect(registerResponse.ok()).toBeTruthy(); // Open the React app await page.goto('/'); await page.fill('input[type="email"]', email); await page.fill('input[type="password"]', password); await page.click('button:has-text("Login")'); // Verify dashboard appears await expect(page.locator('text=Dashboard')).toBeVisible(); // Create a new item const title = 'Playwright Item'; await page.fill('input[placeholder="Title"]', title); await page.click('button:has-text("Add Item")'); // Verify the item is listed await expect(page.locator(`text=${title}`)).toBeVisible(); });