import { expect, test } from '@playwright/test'; const username = process.env.TEST_USERNAME; const password = process.env.TEST_PASSWORD; test.beforeEach(async ({ page }) => { test.skip(!username || !password, 'TEST_USERNAME/TEST_PASSWORD not set'); await page.goto('/login'); await page.getByLabel(/username/i).fill(username!); await page.getByLabel(/password/i).fill(password!); await page.getByRole('button', { name: /sign in|log in/i }).click(); await expect(page).toHaveURL(/\/(?!login)/, { timeout: 10_000 }); }); test('bulk-edit dialog opens from the parts table', async ({ page }) => { await page.goto('/parts'); // Select the first visible checkbox (row selector). If there are no rows, skip. const rowCheckbox = page.locator('tr [role=checkbox]').first(); if ((await rowCheckbox.count()) === 0) test.skip(true, 'no parts to bulk-edit'); await rowCheckbox.check(); await page.getByRole('button', { name: /bulk|change state|edit selected/i }).first().click(); await expect(page.getByRole('dialog')).toBeVisible(); await expect(page.getByText(/bulk/i).first()).toBeVisible(); });