BillTracker/e2e/categories.spec.js

21 lines
940 B
JavaScript
Raw Normal View History

// Regression for the QA-B14-02 a11y refactor: category rows are now plain
// containers with a dedicated chevron toggle button (instead of role=button rows
// that nested action buttons). Verify expand/collapse still works both ways.
const { test, expect } = require('@playwright/test');
const { STORAGE_STATE } = require('./constants');
test.use({ storageState: STORAGE_STATE });
test('category expands via the chevron toggle and via row click (QA-B14-02)', async ({ page }) => {
await page.goto('/categories');
// Dedicated toggle button, collapsed initially.
const expandBtn = page.getByRole('button', { name: /^Expand / }).first();
await expect(expandBtn).toBeVisible();
await expect(expandBtn).toHaveAttribute('aria-expanded', 'false');
// Clicking it expands the row (button flips to "Collapse …").
await expandBtn.click();
await expect(page.getByRole('button', { name: /^Collapse / })).not.toHaveCount(0);
});