Repository navigation
Conversation
Include apps/e2e/tests in the E2E tsconfig and enable strict mode and library checks. Fix the 102 resulting diagnostics without weakening assertions: use the typed window.GraphModule, read collapsible group state as TCollapsibleGroup, narrow missing page state with a requireValue helper or inline guards inside page.evaluate, pass complete TBlock data, and type event details and the React globals. Part of #367. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reviewer's GuideThe PR brings the E2E project under strict TypeScript checking by including all specs, disabling library-check skipping, and fixing the resulting diagnostics through typed globals, explicit null guards, domain-specific generics, and narrow test-focused typing updates while preserving existing assertions and behavior. File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
|
Preview is ready. |
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="apps/e2e/tests/port-delegation.spec.ts" line_range="123" />
<code_context>
- window.graph.updateEntities({ blocks: [{ id: "block-c", x: 300, y: 600 }] });
- });
+ await page.evaluate(({ id, is, name, width, height }) => {
+ window.graph.updateEntities({ blocks: [{ id, is, name, width, height, x: 300, y: 600 }] });
+ }, BLOCKS[2]);
</code_context>
<issue_to_address>
**Unmoved delegated port passes**
When the block-c update does not change its position, `connection updates when delegate target block moves` compares the connection source to the target port’s current position at line 147; if the line 123 update leaves block-c in place, both values remain equal and the test passes.
Assert that the target port is at the expected position after the update, in addition to matching the connection source to it.
</issue_to_address>Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: apps/e2e/tests/port-delegation.spec.ts:123
The "connection updates when delegate target block moves" test only compared the connection source with block-c's current port, so it also passed when the update left block-c in place. Assert block-c's new position and that its output port follows it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #367 (epic #353).
Summary
Until now,
apps/e2e/tsconfig.jsonexcludedtests, ran with"strict": falseand skipped library checks, so the E2E specs were never type-checked. This PR includestests/**/*.tsand enables"strict": trueand"skipLibCheck": false. That surfaced 102 diagnostics, all in the specs, and they are now fixed without weakening any assertion.Diagnostics at the
v2head with the new config:groups/collapsible-group.spec.ts62,port-delegation.spec.ts22,camera/camera-mouse-emulation.spec.ts10,minimap/minimap-styling.spec.ts2,evented-area.spec.ts2,connection/connection.spec.ts2,camera/camera-block-scale-level.spec.ts1,block/block-geometry-batching.spec.ts1.Changes (all under
apps/e2e/**)window.GraphModule: replaced(window as any).GraphModulewith the typed global fromglobal.d.ts. This also fixes thedraggablelayer-prop errors.window.Reactandwindow.ReactDOMinglobal.d.tsare typed astypeof import("react")andtypeof import("react-dom/client")instead ofany.requireValue(value, description): new helper inpage-objects/requireValue.ts. It narrows possibly-missing page state on the Node side and fails with a clear message. Existingexpect(...).not.toBeNull()/toBeDefined()checks are kept, and thex!/(x as any)reads that followed them now go through the helper.page.evaluate: that code is serialized and runs in the browser, so it uses inlinethrowguards for missing ports, connections and blocks instead.TCollapsibleGroupviagetGroupState<TCollapsibleGroup>(). Every group in these suites is created withcomponent: CollapsibleGroup, and a comment records this.group-collapse-changedetail type is derived fromGraphEventsDefinitions, and theas anyon that event subscription is removed.instanceof HTMLDivElement, which is what theGraphconstructor andattachexpect. Both E2E pages use<div id="root">.port-delegation.spec.ts: passesTBlock-completeupdateEntitiesdata (id,is,name,width,heightplus the newx/y), with the same values as before. Anchors and selection are not passed.camera-mouse-emulation.spec.ts, and"vertical" as constforbezierConnectionDirection.Older
anyusages that still compile under strict (for example the__eventLogwindow globals andGraphEventProbeinternals) are left as they are.Verification
pnpm --filter @gravity-ui/graph-e2e exec tsc -p tsconfig.json --noEmit: 0 errors (was 102).pnpm run typecheck,pnpm run test:type-configs,pnpm test,pnpm run lint: all pass.node scripts/strict-diagnostics.mjs: passes;apps/e2ehas 0 diagnostics and the baseline is unchanged.pnpm run test:e2e: 197 passed.🤖 Generated with Claude Code
Summary by Sourcery
Type-check the complete E2E test suite under strict TypeScript settings and eliminate the resulting type errors.
Enhancements:
Tests: