diff --git a/frontend/tests/e2e/sold-filter.spec.ts b/frontend/tests/e2e/sold-filter.spec.ts index 3a94f61..16b1a88 100644 --- a/frontend/tests/e2e/sold-filter.spec.ts +++ b/frontend/tests/e2e/sold-filter.spec.ts @@ -76,15 +76,28 @@ test.describe('Filtering the storefront by availability', () => { await expect(storefront.gridCell(NAMES.sold)).toHaveCount(0); }); - // The control sits beside the Filters button rather than inside the drawer, - // so its state must not be counted as one of the drawer's filters. - test('does not inflate the Filters count', async ({ page, storefront }) => { + // Since #188 the tally is the number of chips, not the number of drawer + // controls, so a bar dimension counts like any other. This test asserted the + // older rule and went unnoticed for days because nothing updated it when that + // rule changed — see #239. + // + // The count and the chip row are deliberately the same number. Availability + // emits a chip for any non-default status so that ?status=reserved is not an + // empty grid with no Clear filters button, and counting bar chips differently + // from drawer ones would restore exactly the per-screen special-casing #188 + // removed. + test('counts the availability preset in the Filters tally', async ({ page, storefront }) => { await storefront.goto(); await storefront.chooseAvailability('Sold'); // Matched loosely and asserted on the text, because antd's icon contributes - // its own aria-label to the button's accessible name. The text is the part - // that would gain a "(1)" if status were counted as a drawer filter. + // its own aria-label to the button's accessible name. + await expect(storefront.filtersButton).toHaveText('Filters (1)'); + + // The default earns silence: returning to it removes the chip, so the tally + // goes with it. Without this the test would pass on a tally that never + // decremented. + await storefront.chooseAvailability('Not sold'); await expect(storefront.filtersButton).toHaveText('Filters'); }); });