Skip to content

Commit bcce269

Browse files
ethanalvizovbabich
andauthored
test: add e2e tests for advanced settings (#1361)
Closes #1356 --------- Co-authored-by: Vlad Babich <vladbabich@deephaven.io>
1 parent 9e53dd2 commit bcce269

14 files changed

Lines changed: 188 additions & 3 deletions

tests/table-operations.spec.ts

Lines changed: 183 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
dragComponent,
77
waitForLoadingDone,
88
openTableOption,
9+
generateVarName,
910
} from './utils';
1011

1112
// Run tests serially since they all use the same table
@@ -89,6 +90,21 @@ async function changeCondFormatHighlight(page: Page) {
8990
await waitForLoadingDone(page);
9091
}
9192

93+
/**
94+
* Acts as a small time buffer so that the table has time to update before the screenshot.
95+
* Can be deleted in the future if the timing is figured out with the polling intervals for advanced settings.
96+
* Without it the snapshot is taken before the table is updated.
97+
* Attempt was made to check for loading status bar with custom polling intervals but no luck
98+
* @param page
99+
*/
100+
async function artificialWait(page: Page, tableNumber = 0) {
101+
const tableOperationsMenu = page
102+
.locator('data-testid=btn-iris-grid-settings-button-table')
103+
.nth(tableNumber);
104+
await tableOperationsMenu.click();
105+
await page.getByTestId('btn-page-close').first().click();
106+
}
107+
92108
test.beforeEach(async ({ page }) => {
93109
await page.goto('');
94110

@@ -160,6 +176,7 @@ test('search', async ({ page }) => {
160176
await expect(page.locator('.iris-grid-column')).toHaveScreenshot();
161177
});
162178

179+
// TODO: Fix flakiness of this test by linking loading status bar to this menu (#1367)
163180
// test('conditional format', async ({ page }) => {
164181
// await openTableOption(page, 'Conditional Formatting');
165182

@@ -202,7 +219,10 @@ test('search', async ({ page }) => {
202219

203220
// await formattingRule.click();
204221
// await conditionSelect.selectOption('is-null');
205-
// await page.getByRole('button', { name: 'Cancel' }).click();
222+
// await page
223+
// .locator('.conditional-format-editor')
224+
// .getByRole('button', { name: 'Cancel' })
225+
// .click();
206226

207227
// await waitForLoadingDone(page);
208228
// await expect(page.locator('.iris-grid-column')).toHaveScreenshot();
@@ -490,3 +510,165 @@ test('rollup rows and aggregrate columns', async ({ page }) => {
490510
await expect(page.locator('.iris-grid-column')).toHaveScreenshot();
491511
});
492512
});
513+
514+
test('advanced settings', async ({ page }) => {
515+
const table2Name = generateVarName('t2');
516+
517+
await test.step('create 2nd table', async () => {
518+
const consoleInput = page.locator('.console-input');
519+
await consoleInput.click();
520+
521+
const command = makeTableCommand(table2Name, TableTypes.AllTypes);
522+
523+
await pasteInMonaco(consoleInput, command);
524+
await page.keyboard.press('Enter');
525+
});
526+
527+
await test.step('drag table to new panel', async () => {
528+
// opening up this menu makes it easier to drag to that corner
529+
await page
530+
.getByTestId('btn-iris-grid-settings-button-table')
531+
.first()
532+
.click();
533+
534+
const table = page
535+
.locator('.lm_tab')
536+
.filter({ has: page.getByText(table2Name) });
537+
const target = page.getByText('Command History');
538+
const dropIndicator = page.locator('.lm_dragProxy');
539+
await dragComponent(table, target, dropIndicator, 300);
540+
541+
await page.getByTestId('btn-page-close').first().click();
542+
await page.getByTestId('btn-page-close').nth(1).click();
543+
544+
await waitForLoadingDone(page);
545+
});
546+
547+
await test.step('add input filter to int column', async () => {
548+
await page.getByRole('button', { name: 'Controls' }).click();
549+
550+
const inputFilter = page.getByRole('button', { name: 'Input Filter' });
551+
const target = page.getByText('Command History');
552+
const dropIndicator = page.locator('.lm_dragProxy');
553+
await dragComponent(inputFilter, target, dropIndicator);
554+
});
555+
556+
await test.step('add linker filter to string column', async () => {
557+
await page.getByRole('button', { name: 'Controls' }).click();
558+
await page.getByRole('button', { name: 'Linker' }).click();
559+
560+
// Note: do not have to drag to use linker filter I just wanted it in this position
561+
const firstStringCol = page.locator('.iris-grid .grid-wrapper').first();
562+
await firstStringCol.click({ position: { x: 20, y: 10 } });
563+
const secondStringCol = page.locator('.iris-grid .grid-wrapper').nth(1);
564+
await secondStringCol.click({
565+
position: { x: 20, y: 10 },
566+
});
567+
568+
await page
569+
.locator('.linker-toast-dialog')
570+
.getByRole('button', { name: 'Done' })
571+
.click();
572+
});
573+
574+
await test.step('use linker filter', async () => {
575+
await page
576+
.locator('.iris-grid .grid-wrapper')
577+
.first()
578+
.dblclick({
579+
position: { x: 20, y: 60 },
580+
});
581+
582+
await waitForLoadingDone(page, 1);
583+
});
584+
585+
await test.step('use input filter', async () => {
586+
await page.getByRole('combobox').selectOption({ label: 'Int' });
587+
await page.getByRole('button', { name: 'Save' }).click();
588+
589+
await expect(page.getByPlaceholder('Enter value...')).toHaveCount(1);
590+
await page.getByPlaceholder('Enter value...').click();
591+
await page.keyboard.type('>1000');
592+
await expect(page.getByPlaceholder('Enter value...')).toHaveValue('>1000');
593+
594+
await artificialWait(page, 1);
595+
await waitForLoadingDone(page);
596+
await waitForLoadingDone(page, 1);
597+
598+
await expect(page.locator('.iris-grid-column').nth(1)).toHaveScreenshot();
599+
});
600+
601+
await test.step('toggle control setting', async () => {
602+
const tableOperationsMenu = page
603+
.locator('data-testid=btn-iris-grid-settings-button-table')
604+
.nth(1);
605+
await tableOperationsMenu.click();
606+
607+
await expect(page.locator('.table-sidebar')).toHaveCount(1);
608+
609+
await openTableOption(page, 'Advanced Settings');
610+
await page
611+
.getByTestId(
612+
'menu-item-Clear current table filters before applying new filters from a control'
613+
)
614+
.click();
615+
await page.getByTestId('btn-page-close').click();
616+
});
617+
618+
await test.step('use input filter', async () => {
619+
await expect(page.getByPlaceholder('Enter value...')).toHaveCount(1);
620+
await page.getByPlaceholder('Enter value...').fill('>5000');
621+
await expect(page.getByPlaceholder('Enter value...')).toHaveValue('>5000');
622+
623+
await artificialWait(page, 1);
624+
await waitForLoadingDone(page);
625+
await waitForLoadingDone(page, 1);
626+
627+
await expect(page.locator('.iris-grid-column').nth(1)).toHaveScreenshot();
628+
});
629+
630+
await test.step('use linker filter', async () => {
631+
await page
632+
.locator('.iris-grid .grid-wrapper')
633+
.first()
634+
.dblclick({
635+
position: { x: 20, y: 60 },
636+
});
637+
638+
await artificialWait(page, 1);
639+
await waitForLoadingDone(page, 1);
640+
641+
await expect(page.locator('.iris-grid-column').nth(1)).toHaveScreenshot();
642+
});
643+
644+
await test.step('toggle linker setting', async () => {
645+
const tableOperationsMenu = page
646+
.locator('data-testid=btn-iris-grid-settings-button-table')
647+
.nth(1);
648+
await tableOperationsMenu.click();
649+
650+
await expect(page.locator('.table-sidebar')).toHaveCount(1);
651+
652+
await openTableOption(page, 'Advanced Settings');
653+
await page
654+
.getByTestId(
655+
'menu-item-Clear current table filters before applying new filters from an incoming link filter'
656+
)
657+
.click();
658+
await page.getByTestId('btn-page-close').click();
659+
});
660+
661+
await test.step('use linker filter', async () => {
662+
await page
663+
.locator('.iris-grid .grid-wrapper')
664+
.first()
665+
.dblclick({
666+
position: { x: 20, y: 60 },
667+
});
668+
669+
await artificialWait(page, 1);
670+
await waitForLoadingDone(page, 1);
671+
672+
await expect(page.locator('.iris-grid-column').nth(1)).toHaveScreenshot();
673+
});
674+
});
23.5 KB
Loading
42.3 KB
Loading
22.4 KB
Loading
41.7 KB
Loading
69 KB
Loading
39.6 KB
Loading
21.5 KB
Loading
38.8 KB
Loading
20.5 KB
Loading

0 commit comments

Comments
 (0)