From 6fe954b8d92f6bade8c035ca3ced2754efa62849 Mon Sep 17 00:00:00 2001 From: Benjamin Kane Date: Mon, 18 Nov 2024 14:01:39 -0500 Subject: [PATCH 1/6] template --- .../oss/specs/sidebar/query-performance.ts | 126 ++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 e2e-pw/src/oss/specs/sidebar/query-performance.ts diff --git a/e2e-pw/src/oss/specs/sidebar/query-performance.ts b/e2e-pw/src/oss/specs/sidebar/query-performance.ts new file mode 100644 index 00000000000..6c001284fb7 --- /dev/null +++ b/e2e-pw/src/oss/specs/sidebar/query-performance.ts @@ -0,0 +1,126 @@ +import { test as base } from "src/oss/fixtures"; +import { GridPom } from "src/oss/poms/grid"; +import { SidebarPom } from "src/oss/poms/sidebar"; +import { getUniqueDatasetNameWithPrefix } from "src/oss/utils"; + +const datasetName = getUniqueDatasetNameWithPrefix("query-performance"); + +const test = base.extend<{ sidebar: SidebarPom; grid: GridPom }>({ + sidebar: async ({ page }, use) => { + await use(new SidebarPom(page)); + }, + grid: async ({ page, eventUtils }, use) => { + await use(new GridPom(page, eventUtils)); + }, +}); + +test.describe("query performance sidebar", () => { + test.beforeAll(async ({ fiftyoneLoader }) => { + await fiftyoneLoader.executePythonCode(` +import fiftyone as fo + +dataset = fo.Dataset("${datasetName}") +dataset.add_samples([fo.Sample(filepath=f"{i}.png") for i in range(0, 4)]) +dataset.persistent = True + +# NOT REAL VALUES + +first = dataset.first() +first["inf"] = float("inf") +first["inf_list"] = [float("inf")] +first["inf_label_list"] = fo.Classifications( + classifications=[fo.Classification(label="label", confidence=float("inf"))] +) + +first["nan"] = float("nan") +first["nan_list"] = [float("nan")] +first["nan_label_list"] = fo.Classifications( + classifications=[fo.Classification(label="label", confidence=float("nan"))] +) + +first["ninf"] = float("-inf") +first["ninf_list"] = [float("-inf")] +first["ninf_label_list"] = fo.Classifications( + classifications=[ + fo.Classification(label="label", confidence=float("-inf")) + ] +) + +first.save() + +# REAL VALUES MAX + +second = dataset.skip(1).first() + +second["inf"] = 1.0 +second["inf_list"] = [1.0] +second["inf_label_list"] = fo.Classifications( + classifications=[fo.Classification(label="label", confidence=1.0)] +) + +second["nan"] = 1.0 +second["nan_list"] = [1.0] +second["nan_label_list"] = fo.Classifications( + classifications=[fo.Classification(label="label", confidence=1.0)] +) + +second["ninf"] = 1.0 +second["ninf_list"] = [1.0] +second["ninf_label_list"] = fo.Classifications( + classifications=[fo.Classification(label="label", confidence=float(1.0))] +) + +second.save() + +# REAL VALUES MIN + +third = dataset.skip(2).first() + +third["inf"] = -1.0 +third["inf_list"] = [-1.0] +third["inf_label_list"] = fo.Classifications( + classifications=[fo.Classification(label="label", confidence=-1.0)] +) + +third["nan"] = -1.0 +third["nan_list"] = [-1.0] +third["nan_label_list"] = fo.Classifications( + classifications=[fo.Classification(label="label", confidence=-1.0)] +) + +third["ninf"] = -1.0 +third["ninf_list"] = [-1.0] +third["ninf_label_list"] = fo.Classifications( + classifications=[fo.Classification(label="label", confidence=-1.0)] +) + +third.save() + +# NONE VALUES + +fourth = dataset.skip(3).first() + +fourth["inf"] = None +fourth["inf_list"] = None +fourth["inf_label_list"] = fo.Classifications( + classifications=[fo.Classification(label="label", confidence=None)] +) + +fourth["nan"] = None +fourth["nan_list"] = None +fourth["nan_label_list"] = fo.Classifications( + classifications=[fo.Classification(label="label", confidence=None)] +) + +fourth["ninf"] = None +fourth["ninf_list"] = None +fourth["ninf_label_list"] = fo.Classifications( + classifications=[fo.Classification(label="label", confidence=None)] +) + +fourth.save() + `); + + test("none counts", async ({}) => {}); + }); +}); From 680f314c5d57fbf1de3416c4005e8f5a16e5d064 Mon Sep 17 00:00:00 2001 From: Benjamin Kane Date: Tue, 19 Nov 2024 19:22:09 -0500 Subject: [PATCH 2/6] setup --- .../Entries/FilterablePathEntry/Icon.tsx | 5 ++- e2e-pw/src/oss/poms/sidebar.ts | 12 ++++++ ...rformance.ts => query-performance.spec.ts} | 37 ++++++++++++++++++- 3 files changed, 51 insertions(+), 3 deletions(-) rename e2e-pw/src/oss/specs/sidebar/{query-performance.ts => query-performance.spec.ts} (82%) diff --git a/app/packages/core/src/components/Sidebar/Entries/FilterablePathEntry/Icon.tsx b/app/packages/core/src/components/Sidebar/Entries/FilterablePathEntry/Icon.tsx index 12b6101c14c..52e34f3bb45 100644 --- a/app/packages/core/src/components/Sidebar/Entries/FilterablePathEntry/Icon.tsx +++ b/app/packages/core/src/components/Sidebar/Entries/FilterablePathEntry/Icon.tsx @@ -13,7 +13,10 @@ export const LightningIcon = styled(Bolt)` export const LightningBolt: React.FC = (_) => { return ( - + ); }; diff --git a/e2e-pw/src/oss/poms/sidebar.ts b/e2e-pw/src/oss/poms/sidebar.ts index 2415f9958b6..3e89a874493 100644 --- a/e2e-pw/src/oss/poms/sidebar.ts +++ b/e2e-pw/src/oss/poms/sidebar.ts @@ -42,6 +42,10 @@ export class SidebarPom { return this.sidebar.getByTestId(`${filterType}-filter-${fieldName}`); } + queryPerformance(fieldName: string) { + return this.fieldContainer(fieldName).getByTestId("query-performance"); + } + sidebarEntryDraggableArea(fieldName: string) { return this.sidebar .getByTestId(`sidebar-entry-draggable-${fieldName}`) @@ -179,6 +183,14 @@ class SidebarAsserter { } } + async assertFieldHasQueryPerformance(fieldName: string) { + await expect(this.sb.queryPerformance(fieldName)).toBeVisible(); + } + + async assertFieldMissingQueryPerformance(fieldName: string) { + await expect(this.assertFieldHasQueryPerformance(fieldName)).toBe(false); + } + async assertFieldInSidebar(fieldName: string) { await expect(this.sb.field(fieldName)).toBeVisible(); } diff --git a/e2e-pw/src/oss/specs/sidebar/query-performance.ts b/e2e-pw/src/oss/specs/sidebar/query-performance.spec.ts similarity index 82% rename from e2e-pw/src/oss/specs/sidebar/query-performance.ts rename to e2e-pw/src/oss/specs/sidebar/query-performance.spec.ts index 6c001284fb7..1c9beeaac93 100644 --- a/e2e-pw/src/oss/specs/sidebar/query-performance.ts +++ b/e2e-pw/src/oss/specs/sidebar/query-performance.spec.ts @@ -18,7 +18,7 @@ test.describe("query performance sidebar", () => { test.beforeAll(async ({ fiftyoneLoader }) => { await fiftyoneLoader.executePythonCode(` import fiftyone as fo - + dataset = fo.Dataset("${datasetName}") dataset.add_samples([fo.Sample(filepath=f"{i}.png") for i in range(0, 4)]) dataset.persistent = True @@ -26,6 +26,10 @@ dataset.persistent = True # NOT REAL VALUES first = dataset.first() + +first["bool"] = False +first["bool_list"] = False + first["inf"] = float("inf") first["inf_list"] = [float("inf")] first["inf_label_list"] = fo.Classifications( @@ -46,12 +50,19 @@ first["ninf_label_list"] = fo.Classifications( ] ) + +first["str"] = "0" +first["str_list"] = ["0"] + first.save() # REAL VALUES MAX second = dataset.skip(1).first() +second["bool"] = False +second["bool_list"] = False + second["inf"] = 1.0 second["inf_list"] = [1.0] second["inf_label_list"] = fo.Classifications( @@ -70,12 +81,18 @@ second["ninf_label_list"] = fo.Classifications( classifications=[fo.Classification(label="label", confidence=float(1.0))] ) +second["str"] = "1" +second["str_list"] = ["1"] + second.save() # REAL VALUES MIN third = dataset.skip(2).first() +third["bool"] = True +third["bool_list"] = True + third["inf"] = -1.0 third["inf_list"] = [-1.0] third["inf_label_list"] = fo.Classifications( @@ -94,12 +111,18 @@ third["ninf_label_list"] = fo.Classifications( classifications=[fo.Classification(label="label", confidence=-1.0)] ) +third["str"] = "2" +third["str_list"] = ["2"] + third.save() # NONE VALUES fourth = dataset.skip(3).first() +fourth["bool"] = None +fourth["bool_list"] = None + fourth["inf"] = None fourth["inf_list"] = None fourth["inf_label_list"] = fo.Classifications( @@ -118,9 +141,19 @@ fourth["ninf_label_list"] = fo.Classifications( classifications=[fo.Classification(label="label", confidence=None)] ) +fourth["str"] = None +fourth["str_list"] = None + +dataset.create_index("$**") + fourth.save() `); - test("none counts", async ({}) => {}); + test.beforeEach(async ({ page, fiftyoneLoader }) => { + await fiftyoneLoader.waitUntilGridVisible(page, datasetName); + }); + test("assert query performance icons", async ({ sidebar }) => { + sidebar.asserter.assertFieldHasQueryPerformance("sample tags"); + }); }); }); From 5c50e6c79e9dddcb651af2726c53c8ebf9c2aaf6 Mon Sep 17 00:00:00 2001 From: Benjamin Kane Date: Tue, 19 Nov 2024 20:13:57 -0500 Subject: [PATCH 3/6] initial assertions --- .../oss/poms/action-row/display-options.ts | 4 +- .../specs/sidebar/query-performance.spec.ts | 222 ++++++++++-------- 2 files changed, 122 insertions(+), 104 deletions(-) diff --git a/e2e-pw/src/oss/poms/action-row/display-options.ts b/e2e-pw/src/oss/poms/action-row/display-options.ts index 57cef8d9d9e..b461dbcef46 100644 --- a/e2e-pw/src/oss/poms/action-row/display-options.ts +++ b/e2e-pw/src/oss/poms/action-row/display-options.ts @@ -3,7 +3,7 @@ import { Page } from "src/oss/fixtures"; type SidebarStatisticsMode = "slice" | "group"; type SidebarMode = "fast" | "best" | "all"; type SidebarSortMode = "count" | "value"; -type LightningMode = "enable" | "disable"; +type QueryPerformanceMode = "enabled" | "disabled"; export class DisplayOptionsPom { readonly page: Page; @@ -12,7 +12,7 @@ export class DisplayOptionsPom { this.page = page; } - async setLightningMode(mode: LightningMode) { + async setQueryPerformance(mode: QueryPerformanceMode) { const selector = this.page.getByTestId(`qp-mode-${mode}`); return selector.click(); } diff --git a/e2e-pw/src/oss/specs/sidebar/query-performance.spec.ts b/e2e-pw/src/oss/specs/sidebar/query-performance.spec.ts index 1c9beeaac93..cebf6a6a1e7 100644 --- a/e2e-pw/src/oss/specs/sidebar/query-performance.spec.ts +++ b/e2e-pw/src/oss/specs/sidebar/query-performance.spec.ts @@ -17,143 +17,161 @@ const test = base.extend<{ sidebar: SidebarPom; grid: GridPom }>({ test.describe("query performance sidebar", () => { test.beforeAll(async ({ fiftyoneLoader }) => { await fiftyoneLoader.executePythonCode(` -import fiftyone as fo + import fiftyone as fo -dataset = fo.Dataset("${datasetName}") -dataset.add_samples([fo.Sample(filepath=f"{i}.png") for i in range(0, 4)]) -dataset.persistent = True + dataset = fo.Dataset("${datasetName}") + dataset.add_samples([fo.Sample(filepath=f"{i}.png") for i in range(0, 4)]) + dataset.persistent = True -# NOT REAL VALUES + # NOT REAL VALUES -first = dataset.first() + first = dataset.first() -first["bool"] = False -first["bool_list"] = False + first["bool"] = False + first["bool_list"] = False -first["inf"] = float("inf") -first["inf_list"] = [float("inf")] -first["inf_label_list"] = fo.Classifications( - classifications=[fo.Classification(label="label", confidence=float("inf"))] -) + first["inf"] = float("inf") + first["inf_list"] = [float("inf")] + first["inf_label_list"] = fo.Classifications( + classifications=[fo.Classification(label="label", confidence=float("inf"))] + ) -first["nan"] = float("nan") -first["nan_list"] = [float("nan")] -first["nan_label_list"] = fo.Classifications( - classifications=[fo.Classification(label="label", confidence=float("nan"))] -) + first["nan"] = float("nan") + first["nan_list"] = [float("nan")] + first["nan_label_list"] = fo.Classifications( + classifications=[fo.Classification(label="label", confidence=float("nan"))] + ) -first["ninf"] = float("-inf") -first["ninf_list"] = [float("-inf")] -first["ninf_label_list"] = fo.Classifications( - classifications=[ - fo.Classification(label="label", confidence=float("-inf")) - ] -) + first["ninf"] = float("-inf") + first["ninf_list"] = [float("-inf")] + first["ninf_label_list"] = fo.Classifications( + classifications=[ + fo.Classification(label="label", confidence=float("-inf")) + ] + ) -first["str"] = "0" -first["str_list"] = ["0"] + first["str"] = "0" + first["str_list"] = ["0"] -first.save() + first.save() -# REAL VALUES MAX + # REAL VALUES MAX -second = dataset.skip(1).first() + second = dataset.skip(1).first() -second["bool"] = False -second["bool_list"] = False + second["bool"] = False + second["bool_list"] = False -second["inf"] = 1.0 -second["inf_list"] = [1.0] -second["inf_label_list"] = fo.Classifications( - classifications=[fo.Classification(label="label", confidence=1.0)] -) + second["inf"] = 1.0 + second["inf_list"] = [1.0] + second["inf_label_list"] = fo.Classifications( + classifications=[fo.Classification(label="label", confidence=1.0)] + ) -second["nan"] = 1.0 -second["nan_list"] = [1.0] -second["nan_label_list"] = fo.Classifications( - classifications=[fo.Classification(label="label", confidence=1.0)] -) + second["nan"] = 1.0 + second["nan_list"] = [1.0] + second["nan_label_list"] = fo.Classifications( + classifications=[fo.Classification(label="label", confidence=1.0)] + ) -second["ninf"] = 1.0 -second["ninf_list"] = [1.0] -second["ninf_label_list"] = fo.Classifications( - classifications=[fo.Classification(label="label", confidence=float(1.0))] -) + second["ninf"] = 1.0 + second["ninf_list"] = [1.0] + second["ninf_label_list"] = fo.Classifications( + classifications=[fo.Classification(label="label", confidence=float(1.0))] + ) -second["str"] = "1" -second["str_list"] = ["1"] + second["str"] = "1" + second["str_list"] = ["1"] -second.save() + second.save() -# REAL VALUES MIN + # REAL VALUES MIN -third = dataset.skip(2).first() + third = dataset.skip(2).first() -third["bool"] = True -third["bool_list"] = True + third["bool"] = True + third["bool_list"] = True -third["inf"] = -1.0 -third["inf_list"] = [-1.0] -third["inf_label_list"] = fo.Classifications( - classifications=[fo.Classification(label="label", confidence=-1.0)] -) + third["inf"] = -1.0 + third["inf_list"] = [-1.0] + third["inf_label_list"] = fo.Classifications( + classifications=[fo.Classification(label="label", confidence=-1.0)] + ) -third["nan"] = -1.0 -third["nan_list"] = [-1.0] -third["nan_label_list"] = fo.Classifications( - classifications=[fo.Classification(label="label", confidence=-1.0)] -) + third["nan"] = -1.0 + third["nan_list"] = [-1.0] + third["nan_label_list"] = fo.Classifications( + classifications=[fo.Classification(label="label", confidence=-1.0)] + ) -third["ninf"] = -1.0 -third["ninf_list"] = [-1.0] -third["ninf_label_list"] = fo.Classifications( - classifications=[fo.Classification(label="label", confidence=-1.0)] -) + third["ninf"] = -1.0 + third["ninf_list"] = [-1.0] + third["ninf_label_list"] = fo.Classifications( + classifications=[fo.Classification(label="label", confidence=-1.0)] + ) -third["str"] = "2" -third["str_list"] = ["2"] + third["str"] = "2" + third["str_list"] = ["2"] -third.save() + third.save() -# NONE VALUES + # NONE VALUES -fourth = dataset.skip(3).first() + fourth = dataset.skip(3).first() -fourth["bool"] = None -fourth["bool_list"] = None + fourth["bool"] = None + fourth["bool_list"] = None -fourth["inf"] = None -fourth["inf_list"] = None -fourth["inf_label_list"] = fo.Classifications( - classifications=[fo.Classification(label="label", confidence=None)] -) + fourth["inf"] = None + fourth["inf_list"] = None + fourth["inf_label_list"] = fo.Classifications( + classifications=[fo.Classification(label="label", confidence=None)] + ) -fourth["nan"] = None -fourth["nan_list"] = None -fourth["nan_label_list"] = fo.Classifications( - classifications=[fo.Classification(label="label", confidence=None)] -) + fourth["nan"] = None + fourth["nan_list"] = None + fourth["nan_label_list"] = fo.Classifications( + classifications=[fo.Classification(label="label", confidence=None)] + ) -fourth["ninf"] = None -fourth["ninf_list"] = None -fourth["ninf_label_list"] = fo.Classifications( - classifications=[fo.Classification(label="label", confidence=None)] -) + fourth["ninf"] = None + fourth["ninf_list"] = None + fourth["ninf_label_list"] = fo.Classifications( + classifications=[fo.Classification(label="label", confidence=None)] + ) -fourth["str"] = None -fourth["str_list"] = None + fourth["str"] = None + fourth["str_list"] = None -dataset.create_index("$**") + dataset.create_index("$**") -fourth.save() - `); + fourth.save()`); + }); + + test.beforeEach(async ({ page, fiftyoneLoader }) => { + await fiftyoneLoader.waitUntilGridVisible(page, datasetName); + }); - test.beforeEach(async ({ page, fiftyoneLoader }) => { - await fiftyoneLoader.waitUntilGridVisible(page, datasetName); - }); - test("assert query performance icons", async ({ sidebar }) => { - sidebar.asserter.assertFieldHasQueryPerformance("sample tags"); - }); + test("assert query performance icons", async ({ sidebar, grid }) => { + await grid.actionsRow.toggleDisplayOptions(); + await grid.actionsRow.displayActions.setQueryPerformance("enabled"); + for (const i of [ + "tags", + "metadata.mime_type", + "inf_label_list", + "nan_label_list", + "ninf_label_list", + "id", + "filepath", + "created_at", + "last_modified_at", + "bool", + "bool_list", + "str", + "str_list", + ]) { + await sidebar.asserter.assertFieldHasQueryPerformance(i); + } }); }); From bada6ac869f61dd5dbbd3292383729771651563d Mon Sep 17 00:00:00 2001 From: Benjamin Kane Date: Tue, 19 Nov 2024 20:23:27 -0500 Subject: [PATCH 4/6] add hidden --- e2e-pw/src/oss/poms/sidebar.ts | 2 +- .../oss/specs/sidebar/query-performance.spec.ts | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/e2e-pw/src/oss/poms/sidebar.ts b/e2e-pw/src/oss/poms/sidebar.ts index 3e89a874493..af1ada9e121 100644 --- a/e2e-pw/src/oss/poms/sidebar.ts +++ b/e2e-pw/src/oss/poms/sidebar.ts @@ -188,7 +188,7 @@ class SidebarAsserter { } async assertFieldMissingQueryPerformance(fieldName: string) { - await expect(this.assertFieldHasQueryPerformance(fieldName)).toBe(false); + await expect(this.sb.queryPerformance(fieldName)).toBeHidden(); } async assertFieldInSidebar(fieldName: string) { diff --git a/e2e-pw/src/oss/specs/sidebar/query-performance.spec.ts b/e2e-pw/src/oss/specs/sidebar/query-performance.spec.ts index cebf6a6a1e7..7ad73475409 100644 --- a/e2e-pw/src/oss/specs/sidebar/query-performance.spec.ts +++ b/e2e-pw/src/oss/specs/sidebar/query-performance.spec.ts @@ -173,5 +173,21 @@ test.describe("query performance sidebar", () => { ]) { await sidebar.asserter.assertFieldHasQueryPerformance(i); } + + for (const i of [ + "_label_tags", + "metadata.size_bytes", + "metadata.width", + "metadata.height", + "metadata.num_channels", + "inf", + "inf_list", + "nan", + "nan_list", + "ninf", + "ninf_list", + ]) { + await sidebar.asserter.assertFieldMissingQueryPerformance(i); + } }); }); From f105148b4c3cee7a2dee1cf8e4b79ac7a27e7110 Mon Sep 17 00:00:00 2001 From: Benjamin Kane Date: Wed, 20 Nov 2024 09:31:53 -0500 Subject: [PATCH 5/6] subfield filter assertions --- .../NumericFieldFilter/NumericFieldFilter.tsx | 5 +- .../Filters/StringFilter/StringFilter.tsx | 6 +- .../Entries/FilterablePathEntry/Icon.tsx | 2 +- e2e-pw/src/oss/poms/sidebar.ts | 21 +++++- .../specs/sidebar/query-performance.spec.ts | 69 ++++++++++++++++--- 5 files changed, 87 insertions(+), 16 deletions(-) diff --git a/app/packages/core/src/components/Filters/NumericFieldFilter/NumericFieldFilter.tsx b/app/packages/core/src/components/Filters/NumericFieldFilter/NumericFieldFilter.tsx index 3b1c4b130d5..427b8468425 100644 --- a/app/packages/core/src/components/Filters/NumericFieldFilter/NumericFieldFilter.tsx +++ b/app/packages/core/src/components/Filters/NumericFieldFilter/NumericFieldFilter.tsx @@ -50,7 +50,10 @@ const NumericFieldFilter = ({ color, modal, named = true, path }: Props) => { }; return ( - e.stopPropagation()}> + e.stopPropagation()} + > {named && name && ( ( {label} - {showQueryPerformanceIcon && ( - - )} + {showQueryPerformanceIcon && } )} /> diff --git a/app/packages/core/src/components/Sidebar/Entries/FilterablePathEntry/Icon.tsx b/app/packages/core/src/components/Sidebar/Entries/FilterablePathEntry/Icon.tsx index 52e34f3bb45..c9e02f39015 100644 --- a/app/packages/core/src/components/Sidebar/Entries/FilterablePathEntry/Icon.tsx +++ b/app/packages/core/src/components/Sidebar/Entries/FilterablePathEntry/Icon.tsx @@ -6,7 +6,7 @@ import { useRecoilValue } from "recoil"; import styled from "styled-components"; import Arrow from "./Arrow"; -export const LightningIcon = styled(Bolt)` +const LightningIcon = styled(Bolt)` color: ${({ theme }) => theme.text.secondary}; `; diff --git a/e2e-pw/src/oss/poms/sidebar.ts b/e2e-pw/src/oss/poms/sidebar.ts index af1ada9e121..5af30d0817e 100644 --- a/e2e-pw/src/oss/poms/sidebar.ts +++ b/e2e-pw/src/oss/poms/sidebar.ts @@ -42,8 +42,11 @@ export class SidebarPom { return this.sidebar.getByTestId(`${filterType}-filter-${fieldName}`); } - queryPerformance(fieldName: string) { - return this.fieldContainer(fieldName).getByTestId("query-performance"); + queryPerformance(fieldName: string, filterType?: "categorical" | "numeric") { + const locator = filterType + ? this.filter(fieldName, filterType) + : this.fieldContainer(fieldName); + return locator.getByTestId("query-performance"); } sidebarEntryDraggableArea(fieldName: string) { @@ -191,6 +194,20 @@ class SidebarAsserter { await expect(this.sb.queryPerformance(fieldName)).toBeHidden(); } + async assertSubfieldHasQueryPerformance( + fieldName: string, + filterType?: "categorical" | "numeric" + ) { + await expect(this.sb.queryPerformance(fieldName, filterType)).toBeVisible(); + } + + async assertSubfieldMissingQueryPerformance( + fieldName: string, + filterType?: "categorical" | "numeric" + ) { + await expect(this.sb.queryPerformance(fieldName, filterType)).toBeHidden(); + } + async assertFieldInSidebar(fieldName: string) { await expect(this.sb.field(fieldName)).toBeVisible(); } diff --git a/e2e-pw/src/oss/specs/sidebar/query-performance.spec.ts b/e2e-pw/src/oss/specs/sidebar/query-performance.spec.ts index 7ad73475409..3ccc6b57331 100644 --- a/e2e-pw/src/oss/specs/sidebar/query-performance.spec.ts +++ b/e2e-pw/src/oss/specs/sidebar/query-performance.spec.ts @@ -6,12 +6,12 @@ import { getUniqueDatasetNameWithPrefix } from "src/oss/utils"; const datasetName = getUniqueDatasetNameWithPrefix("query-performance"); const test = base.extend<{ sidebar: SidebarPom; grid: GridPom }>({ - sidebar: async ({ page }, use) => { - await use(new SidebarPom(page)); - }, grid: async ({ page, eventUtils }, use) => { await use(new GridPom(page, eventUtils)); }, + sidebar: async ({ page }, use) => { + await use(new SidebarPom(page)); + }, }); test.describe("query performance sidebar", () => { @@ -153,10 +153,14 @@ test.describe("query performance sidebar", () => { await fiftyoneLoader.waitUntilGridVisible(page, datasetName); }); - test("assert query performance icons", async ({ sidebar, grid }) => { + test("assert query performance icons", async ({ + eventUtils, + grid, + sidebar, + }) => { await grid.actionsRow.toggleDisplayOptions(); await grid.actionsRow.displayActions.setQueryPerformance("enabled"); - for (const i of [ + for (const field of [ "tags", "metadata.mime_type", "inf_label_list", @@ -171,10 +175,10 @@ test.describe("query performance sidebar", () => { "str", "str_list", ]) { - await sidebar.asserter.assertFieldHasQueryPerformance(i); + await sidebar.asserter.assertFieldHasQueryPerformance(field); } - for (const i of [ + for (const field of [ "_label_tags", "metadata.size_bytes", "metadata.width", @@ -187,7 +191,56 @@ test.describe("query performance sidebar", () => { "ninf", "ninf_list", ]) { - await sidebar.asserter.assertFieldMissingQueryPerformance(i); + await sidebar.asserter.assertFieldMissingQueryPerformance(field); + } + + let animation = eventUtils.getEventReceivedPromiseForPredicate( + "animation-onRest", + () => true + ); + await sidebar.clickFieldDropdown("inf_label_list"); + await animation; + + animation = eventUtils.getEventReceivedPromiseForPredicate( + "animation-onRest", + () => true + ); + await sidebar.clickFieldDropdown("nan_label_list"); + await animation; + + animation = eventUtils.getEventReceivedPromiseForPredicate( + "animation-onRest", + () => true + ); + await sidebar.clickFieldDropdown("ninf_label_list"); + await animation; + + const subfieldsIndexed = ["id", "label", "tags"]; + for (const field of [ + "inf_label_list", + "nan_label_list", + "ninf_label_list", + ]) { + for (const subfield of subfieldsIndexed) { + await sidebar.asserter.assertSubfieldHasQueryPerformance( + `${field}.classifications.${subfield}`, + "categorical" + ); + } + } + + const subfieldsUnindexed = ["confidence"]; + for (const field of [ + "inf_label_list", + "nan_label_list", + "ninf_label_list", + ]) { + for (const subfield of subfieldsUnindexed) { + await sidebar.asserter.assertSubfieldMissingQueryPerformance( + `${field}.classifications.${subfield}`, + "categorical" + ); + } } }); }); From c13af68734488f8de56c2c7a6159f9754dfcbe1a Mon Sep 17 00:00:00 2001 From: Benjamin Kane Date: Wed, 20 Nov 2024 09:44:21 -0500 Subject: [PATCH 6/6] typos --- e2e-pw/src/oss/specs/sidebar/query-performance.spec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/e2e-pw/src/oss/specs/sidebar/query-performance.spec.ts b/e2e-pw/src/oss/specs/sidebar/query-performance.spec.ts index 3ccc6b57331..abea1434712 100644 --- a/e2e-pw/src/oss/specs/sidebar/query-performance.spec.ts +++ b/e2e-pw/src/oss/specs/sidebar/query-performance.spec.ts @@ -28,7 +28,7 @@ test.describe("query performance sidebar", () => { first = dataset.first() first["bool"] = False - first["bool_list"] = False + first["bool_list"] = [False] first["inf"] = float("inf") first["inf_list"] = [float("inf")] @@ -61,7 +61,7 @@ test.describe("query performance sidebar", () => { second = dataset.skip(1).first() second["bool"] = False - second["bool_list"] = False + second["bool_list"] = [False] second["inf"] = 1.0 second["inf_list"] = [1.0] @@ -91,7 +91,7 @@ test.describe("query performance sidebar", () => { third = dataset.skip(2).first() third["bool"] = True - third["bool_list"] = True + third["bool_list"] = [True] third["inf"] = -1.0 third["inf_list"] = [-1.0]