Skip to content

Add dataset factory and canvas testing e2e guidance#7249

Open
benjaminpkane wants to merge 5 commits intodevelopfrom
chore/e2e-readme
Open

Add dataset factory and canvas testing e2e guidance#7249
benjaminpkane wants to merge 5 commits intodevelopfrom
chore/e2e-readme

Conversation

@benjaminpkane
Copy link
Copy Markdown
Member

@benjaminpkane benjaminpkane commented Mar 27, 2026

What changes are proposed in this pull request?

Adds dataset factory and canvas testing sections to the E2E README

How is this patch tested? If it is not, please explain why.

N/A

What areas of FiftyOne does this PR affect?

  • App: FiftyOne application changes
  • Build: Build and test infrastructure changes
  • Core: Core fiftyone Python library changes
  • Documentation: FiftyOne documentation changes
  • Other

Summary by CodeRabbit

  • Documentation
    • Added a “Creating Datasets” guide showing how to programmatically create blank datasets, specify schemas, and populate per-sample data for tests.
    • Documented stable, index-derived sample ID format and usage for deterministic sample references.
    • Added modal-only test guidance for opening modals directly and waiting for grid visibility.
    • Added “Canvas Testing” rules: only use keyboard/mouse POM methods, restrict assertions to cursor-value and screenshot checks, and neutralize pointers before screenshots.

@benjaminpkane benjaminpkane self-assigned this Mar 27, 2026
@benjaminpkane benjaminpkane requested a review from a team as a code owner March 27, 2026 13:49
@benjaminpkane benjaminpkane added testing Unit, regression, performance and QA testing standard Code standards labels Mar 27, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 27, 2026

Walkthrough

This pull request adds 117 lines to the e2e-pw README with guidance for tests: use DatasetFactory.createBlankDataset (with schema and withSampleData) for FiftyOne datasets; derive stable sample _ids using the zero-padded 24-character hex indexToId; enable modal-only tests by navigating to the grid with an id URL search parameter passed to fiftyoneLoader.waitUntilGridVisible; and a Canvas Testing section that mandates imperative interactions via modal.sampleCanvas (keyboard/mouse methods), forbids Playwright locators/accessibility queries against canvas elements, restricts assertions to assert.hasCursor and assert.hasScreenshot (with pointer neutralization before screenshots), and discourages feature-semantic helper methods in the SampleCanvas POM.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding documentation sections for dataset factory and canvas testing to the E2E README.
Description check ✅ Passed The PR description covers the main changes proposed and correctly identifies this as a documentation-only change, though it omits the Release Notes section.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/e2e-readme

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@e2e-pw/README.md`:
- Line 124: Replace the redundant phrase "blank PNG images" with "blank PNGs" in
the README where the dataset generation is described; locate the sentence
containing the exact text "blank PNG images" and update it to read "blank PNGs"
so the wording is tighter and consistent.
- Around line 195-206: The README overstates available signals; update the text
to either mention SampleCanvasAsserter.assert.is(type) as an additional
assertion or rephrase “only available signals” to “primary signals” (or similar)
and list hasCursor, hasScreenshot, and is so readers know assert.is(...) is also
supported; reference the SampleCanvasAsserter type and its methods assert.is,
assert.hasCursor, and assert.hasScreenshot when updating the wording.
- Around line 128-150: The snippet passed to DatasetFactory.createBlankDataset
calls indexToId(index) but does not import indexToId; add an import for
indexToId from the appropriate module (e.g., "src/shared/utils") at the top of
the file so the symbol is available when using createBlankDataset's
withSampleData callback; ensure the import line is added alongside the existing
import of DatasetFactory to prevent runtime/reference errors.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: e4aa7dc5-49a6-4a96-a3d6-1336465cab83

📥 Commits

Reviewing files that changed from the base of the PR and between da48bdd and 92013c9.

📒 Files selected for processing (1)
  • e2e-pw/README.md

Comment on lines +195 to +206
Since the canvas surface is opaque to the DOM, the only available signals for
assertions are **screenshots** and **cursor values**. Use these to verify that
an interaction had the expected effect.

```ts
// Assert the CSS cursor at the current pointer position
await modal.sampleCanvas.assert.hasCursor("default");
await modal.sampleCanvas.assert.hasCursor("nwse-resize");

// Assert the canvas state via screenshot
await modal.sampleCanvas.assert.hasScreenshot("my-test-state.png");
```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Soften or correct “only available signals” wording.

Line 195 says only cursor/screenshot assertions are available, but SampleCanvasAsserter also exposes is(type). Either document assert.is(...) or reword this as recommended primary signals to avoid misleading contributors.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@e2e-pw/README.md` around lines 195 - 206, The README overstates available
signals; update the text to either mention SampleCanvasAsserter.assert.is(type)
as an additional assertion or rephrase “only available signals” to “primary
signals” (or similar) and list hasCursor, hasScreenshot, and is so readers know
assert.is(...) is also supported; reference the SampleCanvasAsserter type and
its methods assert.is, assert.hasCursor, and assert.hasScreenshot when updating
the wording.

Copy link
Copy Markdown
Contributor

@mcdoh mcdoh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff!

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (3)
e2e-pw/README.md (3)

128-150: ⚠️ Potential issue | 🟡 Minor

Add missing indexToId import in the first code snippet.

Line 140 uses indexToId(index) but this snippet doesn't import it. While line 158 shows the import later, readers copying the first example will encounter a reference error.

📦 Add the missing import
 ```ts
 import { DatasetFactory } from "src/shared/dataset-factory";
+import { indexToId } from "src/shared/utils";
 
 await DatasetFactory.createBlankDataset({
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@e2e-pw/README.md` around lines 128 - 150, The example calls indexToId(index)
but the snippet doesn't import it; update the first code sample so it imports
indexToId from the same utils module as the later example (i.e., add an import
for indexToId from "src/shared/utils") alongside the existing DatasetFactory
import so the createBlankDataset example compiles and doesn't throw a
ReferenceError.

198-200: ⚠️ Potential issue | 🟡 Minor

Soften or correct "only available signals" wording.

Line 198 states these are the "only available signals," but if SampleCanvasAsserter exposes additional assertion methods like assert.is(type), this claim is inaccurate. Either document all available assertions or rephrase to "primary signals" to avoid misleading contributors.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@e2e-pw/README.md` around lines 198 - 200, The README's claim that screenshots
and cursor values are the "only available signals" is incorrect if
SampleCanvasAsserter exposes other assertion helpers (e.g.,
SampleCanvasAsserter.assert.is(type)); update the sentence to either list all
available assertion methods from SampleCanvasAsserter (including assert.is,
etc.) or soften the wording to "primary signals" (e.g., "The primary signals
available for assertions are screenshots and cursor values") so it no longer
misrepresents available APIs; locate the sentence referencing "only available
signals" and change it accordingly.

124-124: ⚠️ Potential issue | 🟡 Minor

Tighten redundant wording.

Use "blank PNGs" instead of "blank PNG images" per the static analysis hint.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@e2e-pw/README.md` at line 124, Replace the redundant phrase "blank PNG
images" with the tighter "blank PNGs" in the README text (look for the sentence
containing "dataset. It generates blank PNG images, inserts samples directly
into the"); update that phrase to "blank PNGs" to satisfy the static analysis
suggestion.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@e2e-pw/README.md`:
- Around line 152-156: Clarify whether stable `_id`s are created automatically
or must be assigned in the sample setup: update the README text around the
`withSampleData` example to state that stable IDs are assigned only when you
explicitly set `_id` (as shown with `withSampleData` using
`createId(indexToId(index))`), and note that if your framework/tool also
auto-generates IDs those can be overridden by providing an `_id` value;
reference `withSampleData`, `_id`, `createId`, and `indexToId` in the sentence
so readers know exactly where to set or override stable IDs.

---

Duplicate comments:
In `@e2e-pw/README.md`:
- Around line 128-150: The example calls indexToId(index) but the snippet
doesn't import it; update the first code sample so it imports indexToId from the
same utils module as the later example (i.e., add an import for indexToId from
"src/shared/utils") alongside the existing DatasetFactory import so the
createBlankDataset example compiles and doesn't throw a ReferenceError.
- Around line 198-200: The README's claim that screenshots and cursor values are
the "only available signals" is incorrect if SampleCanvasAsserter exposes other
assertion helpers (e.g., SampleCanvasAsserter.assert.is(type)); update the
sentence to either list all available assertion methods from
SampleCanvasAsserter (including assert.is, etc.) or soften the wording to
"primary signals" (e.g., "The primary signals available for assertions are
screenshots and cursor values") so it no longer misrepresents available APIs;
locate the sentence referencing "only available signals" and change it
accordingly.
- Line 124: Replace the redundant phrase "blank PNG images" with the tighter
"blank PNGs" in the README text (look for the sentence containing "dataset. It
generates blank PNG images, inserts samples directly into the"); update that
phrase to "blank PNGs" to satisfy the static analysis suggestion.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 96096475-47a4-448b-ab5f-bc28cb606d06

📥 Commits

Reviewing files that changed from the base of the PR and between 92013c9 and 0d0fb30.

📒 Files selected for processing (1)
  • e2e-pw/README.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

standard Code standards testing Unit, regression, performance and QA testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants