Skip to content

Commit 2f5f6fa

Browse files
committed
test: add e2e test for Ctrl+E clear filters with input filter stuck in Filtering state
Reproduces bug where pressing Ctrl+E to clear all filters while an input filter has a value causes the table to get stuck showing 'Filtering...' until the user clicks cancel or resizes the grid. The root cause is a race condition: clearAllFilters() clears the grid's quick filters and stops loading, but the input filter's debounced empty update arrives later, calling startLoading('Filtering...') again. Since the filters are already cleared, applyInputFilters() finds no changes and never calls setState, so handleUpdate/stopLoading never fires."
1 parent 7aa07c1 commit 2f5f6fa

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

tests/table-clear-filter.spec.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { test, expect } from '@playwright/test';
2+
import {
3+
dragComponent,
4+
waitForLoadingDone,
5+
openTable,
6+
gotoPage,
7+
} from './utils';
8+
9+
test('ctrl+e clears input filter without getting stuck in Filtering state', async ({
10+
page,
11+
}) => {
12+
await gotoPage(page, '');
13+
14+
await openTable(page, 'all_types');
15+
16+
await test.step('add input filter', async () => {
17+
await page.getByRole('button', { name: 'Controls' }).click();
18+
19+
const inputFilter = page.getByRole('button', { name: 'Input Filter' });
20+
const target = page.getByText('Command History');
21+
const dropIndicator = page.locator('.lm_dragProxy');
22+
await dragComponent(inputFilter, target, dropIndicator);
23+
});
24+
25+
await test.step('configure input filter for Int column', async () => {
26+
await page.getByRole('combobox').selectOption({ label: 'Int' });
27+
await page.getByRole('button', { name: 'Save' }).click();
28+
await expect(page.getByPlaceholder('Enter value...')).toHaveCount(1);
29+
});
30+
31+
await test.step('set input filter value', async () => {
32+
await page.getByPlaceholder('Enter value...').click();
33+
await page.keyboard.type('>1000');
34+
await expect(page.getByPlaceholder('Enter value...')).toHaveValue('>1000');
35+
36+
await waitForLoadingDone(page);
37+
});
38+
39+
await test.step('clear all filters with Ctrl+E', async () => {
40+
// Click on the grid to ensure it has focus for the keyboard shortcut
41+
await page.locator('.iris-grid .grid-wrapper').click();
42+
43+
await page.keyboard.press('Control+e');
44+
45+
// Wait for any debounced updates to process (input filter debounce is ~400ms total)
46+
await page.waitForTimeout(1000);
47+
48+
// The table should NOT be stuck in a loading/filtering state
49+
await waitForLoadingDone(page);
50+
});
51+
});

0 commit comments

Comments
 (0)