fix(test): correct the sold-filter tally assertion stranded by #188 (#239) #240

Merged
bermudalamb merged 1 commits from fix/239-sold-filter-tally into main 2026-08-29 19:22:13 -05:00
Showing only changes of commit 30227fb1e1 - Show all commits
+18 -5
View File
@@ -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');
});
});