Skip to content

Commit d59e9be

Browse files
ethanalvizomofojedmattrunyon
authored
fix: flaky e2e tests (#1453)
Fixes: - code not pasting/typing into editor - deleting tables between tests - menus not closing between steps - using dblclick over drag when possible --------- Co-authored-by: Mike Bender <mikebender@deephaven.io> Co-authored-by: Matthew Runyon <matthewrunyon@deephaven.io>
1 parent 96b27a5 commit d59e9be

3 files changed

Lines changed: 18 additions & 4 deletions

File tree

packages/iris-grid/src/CrossColumnSearch.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ class CrossColumnSearch extends PureComponent<
203203
<SearchInput
204204
className="cross-column-search"
205205
placeholder="Search Data..."
206+
data-testid="cross-column-search"
206207
value={value}
207208
onChange={this.handleSearchValueChange}
208209
ref={this.searchField}

tests/table-operations.spec.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,13 @@ async function artificialWait(page: Page, tableNumber = 0) {
105105
await page.getByTestId('btn-page-close').first().click();
106106
}
107107

108+
const tableName = generateVarName('t');
108109
test.beforeEach(async ({ page }) => {
109110
await page.goto('');
110111

111112
const consoleInput = page.locator('.console-input');
112113

113-
const command = makeTableCommand(undefined, TableTypes.AllTypes);
114+
const command = makeTableCommand(tableName, TableTypes.AllTypes);
114115

115116
await pasteInMonaco(consoleInput, command);
116117
await page.keyboard.press('Enter');
@@ -135,6 +136,15 @@ test.beforeEach(async ({ page }) => {
135136
await expect(page.locator('.table-sidebar')).toHaveCount(1);
136137
});
137138

139+
test.afterEach(async ({ page }) => {
140+
const consoleInput = page.locator('.console-input');
141+
await consoleInput.click();
142+
143+
const command = `del ${tableName}`;
144+
await pasteInMonaco(consoleInput, command);
145+
await page.keyboard.press('Enter');
146+
});
147+
138148
test('select distinct values', async ({ page }) => {
139149
await openTableOption(page, 'Select Distinct Values');
140150

@@ -149,7 +159,7 @@ test('select distinct values', async ({ page }) => {
149159
test('search', async ({ page }) => {
150160
await page.locator('data-testid=menu-item-Search Bar').click();
151161

152-
const searchBar = page.getByPlaceholder('Search Data...');
162+
const searchBar = page.getByTestId('cross-column-search');
153163
await expect(searchBar).toHaveCount(1);
154164

155165
await searchBar.click();
@@ -451,7 +461,7 @@ test('rollup rows and aggregrate columns', async ({ page }) => {
451461
const stringColumn = page.getByRole('button', { name: 'String' });
452462
await test.step('Rollup column', async () => {
453463
expect(stringColumn).toBeTruthy();
454-
await dragComponent(stringColumn, dropdown, dropIndicator);
464+
await stringColumn.dblclick();
455465

456466
await waitForLoadingDone(page);
457467
await expect(page.locator('.iris-grid-column')).toHaveScreenshot();
@@ -474,7 +484,7 @@ test('rollup rows and aggregrate columns', async ({ page }) => {
474484
await test.step('Rollup another column', async () => {
475485
const intColumn = page.getByRole('button', { name: 'Int', exact: true });
476486
expect(intColumn).toBeTruthy();
477-
await dragComponent(intColumn, stringColumn, dropIndicator, 10);
487+
await intColumn.dblclick();
478488

479489
await waitForLoadingDone(page);
480490
await expect(page.locator('.iris-grid-column')).toHaveScreenshot();
@@ -549,6 +559,8 @@ test('advanced settings', async ({ page }) => {
549559
const target = page.getByText('Command History');
550560
const dropIndicator = page.locator('.lm_dragProxy');
551561
await dragComponent(inputFilter, target, dropIndicator);
562+
563+
await page.getByRole('button', { name: 'Panels' }).click();
552564
});
553565

554566
await test.step('add linker filter to string column', async () => {

tests/utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ export async function openTableOption(
221221
page: Page,
222222
tableOption: string
223223
): Promise<void> {
224+
await expect(page.getByText('Table Options')).toHaveCount(1);
224225
await page.locator(`data-testid=menu-item-${tableOption}`).click();
225226

226227
// Wait until the table option has fully appeared, by checking that the top level menu is no longer visible

0 commit comments

Comments
 (0)