import { expect, test } from '@playwright/test'; test('signs in and creates a product and physical copy from the admin workspace', async ({ page }) => { const email = process.env.INITIAL_ADMIN_EMAIL; const password = process.env.INITIAL_ADMIN_PASSWORD; test.skip(!email || !password, 'Set INITIAL_ADMIN_EMAIL and INITIAL_ADMIN_PASSWORD for the local authenticated workflow.'); await page.goto('/login'); await page.getByLabel('Email').fill(email); await page.getByLabel('Password').fill(password); await page.getByRole('button', { name: 'Sign in' }).click(); await expect(page).toHaveURL(/\/admin$/); await expect(page.getByRole('heading', { name: 'Collector workspace' })).toBeVisible(); const category = page.locator('#product-category option').nth(1); await expect(category).toBeAttached(); await page.getByLabel('Name').fill(`Browser test collectible ${Date.now()}`); await page.getByLabel('Category').selectOption({ index: 1 }); await page.getByRole('button', { name: 'Create product' }).click(); await expect(page.locator('#inventory-product option').nth(1)).toBeAttached(); await page.getByLabel('Product', { exact: true }).selectOption({ index: 1 }); await page.getByLabel('Condition', { exact: true }).selectOption({ index: 1 }); await page.getByRole('button', { name: 'Create copy' }).click(); await expect(page.getByText('Manage images')).toBeVisible(); await page.getByText('Manage images').last().click(); await expect(page).toHaveURL(/\/admin\/inventory\/[^/]+\/images$/); await expect(page.getByRole('heading', { name: 'Manage images' })).toBeVisible(); });