-
Notifications
You must be signed in to change notification settings - Fork 591
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Render summary fields in modal sidebar (#4851)
* render summary fields in modal sidebar * lint log * fix urls * e2e summary fields * e2e fixes
- Loading branch information
1 parent
b305252
commit 81037fa
Showing
5 changed files
with
226 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { test as base } from "src/oss/fixtures"; | ||
import { GridPom } from "src/oss/poms/grid"; | ||
import { ModalPom } from "src/oss/poms/modal"; | ||
import { getUniqueDatasetNameWithPrefix } from "src/oss/utils"; | ||
|
||
const test = base.extend<{ grid: GridPom; modal: ModalPom }>({ | ||
grid: async ({ page, eventUtils }, use) => { | ||
await use(new GridPom(page, eventUtils)); | ||
}, | ||
modal: async ({ page, eventUtils }, use) => { | ||
await use(new ModalPom(page, eventUtils)); | ||
}, | ||
}); | ||
|
||
const datasetName = getUniqueDatasetNameWithPrefix("summary-fields"); | ||
|
||
test.describe("summary fields", () => { | ||
test.beforeAll(async ({ fiftyoneLoader }) => { | ||
await fiftyoneLoader.executePythonCode(` | ||
import fiftyone as fo | ||
dataset = fo.Dataset("${datasetName}") | ||
dataset.persistent = True | ||
dataset.add_sample( | ||
fo.Sample( | ||
filepath=f"image.png", | ||
summary=fo.DynamicEmbeddedDocument(one="two", three="four"), | ||
summaries=[ | ||
fo.DynamicEmbeddedDocument(five="six", seven="eight"), | ||
fo.DynamicEmbeddedDocument(nine="ten"), | ||
], | ||
) | ||
) | ||
dataset.app_config.sidebar_groups = [ | ||
fo.SidebarGroupDocument( | ||
name="summaries", paths=["summary", "summaries"], expanded=True | ||
) | ||
] | ||
dataset.save() | ||
dataset.add_dynamic_sample_fields() | ||
`); | ||
}); | ||
|
||
test("modal sidebar summary fields render", async ({ | ||
eventUtils, | ||
fiftyoneLoader, | ||
grid, | ||
modal, | ||
page, | ||
}) => { | ||
await fiftyoneLoader.waitUntilGridVisible(page, datasetName); | ||
await grid.openFirstSample(); | ||
await modal.waitForSampleLoadDomAttribute(true); | ||
await modal.sidebar.assert.verifyObject("summary", { | ||
one: "two", | ||
three: "four", | ||
}); | ||
const entryExpandPromise = eventUtils.getEventReceivedPromiseForPredicate( | ||
"animation-onRest", | ||
() => true | ||
); | ||
await modal.sidebar.clickFieldDropdown("summaries"); | ||
await entryExpandPromise; | ||
await modal.sidebar.assert.verifyObject("summaries", { | ||
five: "six", | ||
seven: "eight", | ||
nine: "ten", | ||
}); | ||
}); | ||
}); |