Skip to content

test(frontend): re-enable two skipped drag-drop tests#4971

Merged
aglinxinyuan merged 6 commits intoapache:mainfrom
Yicong-Huang:feat/frontend-vitest-browser-mode
May 9, 2026
Merged

test(frontend): re-enable two skipped drag-drop tests#4971
aglinxinyuan merged 6 commits intoapache:mainfrom
Yicong-Huang:feat/frontend-vitest-browser-mode

Conversation

@Yicong-Huang
Copy link
Copy Markdown
Contributor

@Yicong-Huang Yicong-Huang commented May 6, 2026

What changes were proposed in this PR?

The two tests in drag-drop.service.spec.ts parked under #4866 turn out not to need browser mode at all — both root causes are jsdom-friendly.

should find 3 input/output operatorPredicatesfindClosestOperators was called before addOperator, so the captured result was always []. Reorder, and relax the assertion from a strict ordered toEqual([…]) to arrayContaining + toHaveLength since the function returns its closest-N priority queue as an unsorted heap.

should update highlighting, add operator, and add links when an operator is dropped — drive the real flow through attachMainJointPaper (real paper on a hidden host), dragStarted("MultiInputOutput"), a synthetic window.dispatchEvent(new MouseEvent('mousemove', ...)) to populate the suggestion pipeline, and dragDropped. No mocks. Inputs are placed at x=-100 and outputs at x=100 because jsdom's polyfilled pageToLocalPoint always resolves to (0, 0) — fine for input/output classification which only compares operator x against mouse x.

Any related issues, documentation, discussions?

Part of #4866 — re-enables the drag-drop half. The remaining workflow-editor.component.spec.ts is still excluded for an unrelated reason: it transitively pulls in download.service.ts's top-level require("content-disposition"), which esbuild can't rewrite for the browser bundle. That cleanup belongs in a separate PR, and #4866's scope can be revisited then — neither blocker is actually a browser-mode issue.

How was this PR tested?

yarn test: 271 pass, 9 skip, 2 todo (jsdom; +2 from baseline). yarn format:ci clean.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Opus 4.7 (1M context)

@github-actions github-actions Bot added feature dependencies Pull requests that update a dependency file frontend Changes related to the frontend GUI ci changes related to CI labels May 6, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 43.02%. Comparing base (7f7bba8) to head (e523c2c).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #4971      +/-   ##
============================================
+ Coverage     42.95%   43.02%   +0.07%     
+ Complexity     2186     2175      -11     
============================================
  Files          1031     1031              
  Lines         38153    38104      -49     
  Branches       4004     3997       -7     
============================================
+ Hits          16387    16395       +8     
+ Misses        20742    20678      -64     
- Partials       1024     1031       +7     
Flag Coverage Δ *Carryforward flag
access-control-service 39.53% <ø> (ø) Carriedforward from 6b79896
agent-service 33.72% <ø> (ø) Carriedforward from 6b79896
amber 43.09% <ø> (-0.13%) ⬇️ Carriedforward from 6b79896
computing-unit-managing-service 0.00% <ø> (ø) Carriedforward from 6b79896
config-service 0.00% <ø> (ø) Carriedforward from 6b79896
file-service 31.83% <ø> (-0.36%) ⬇️ Carriedforward from 6b79896
frontend 34.28% <ø> (+0.60%) ⬆️
python 88.07% <ø> (-0.83%) ⬇️ Carriedforward from 6b79896
workflow-compiling-service 47.72% <ø> (ø) Carriedforward from 6b79896

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Yicong-Huang Yicong-Huang changed the title feat(frontend): wire up Vitest browser-mode infrastructure feat(frontend): Vitest browser-mode infra + re-enable findClosestOperators test May 6, 2026
@Yicong-Huang Yicong-Huang changed the title feat(frontend): Vitest browser-mode infra + re-enable findClosestOperators test test(frontend): re-enable drag-drop tests; add Vitest browser-mode infra May 6, 2026
@Yicong-Huang Yicong-Huang force-pushed the feat/frontend-vitest-browser-mode branch from d0ed12a to 2d6a759 Compare May 6, 2026 08:12
`should find 3 input/output operatorPredicates`:
- `findClosestOperators` was called *before* `addOperator`, so the
  captured result was always [].
- Reorder the calls and relax the assertion from a strict ordered
  `toEqual([…])` to `arrayContaining` + `toHaveLength`. The function
  returns its closest-N priority queue as an unsorted heap, so the
  original assertion was over-specified.

`should update highlighting, add operator, and add links when an
operator is dropped`:
- Drive the actual flow through `attachMainJointPaper` (real paper on
  a hidden host), `dragStarted("MultiInputOutput")`, a synthetic
  `window.dispatchEvent(new MouseEvent('mousemove', ...))` to populate
  the suggestion lists, and `dragDropped`.
- Place inputs at x=-100 and outputs at x=100 because jsdom's
  polyfilled `pageToLocalPoint` always resolves to (0, 0) — fine for
  classification, which only compares operator x against mouse x.
- Tighten assertions around link membership and unhighlight set
  rather than asserting on jasmine-era sentinel arrays.

Closes apache#4866.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Yicong-Huang Yicong-Huang changed the title test(frontend): re-enable drag-drop tests; add Vitest browser-mode infra test(frontend): re-enable two skipped drag-drop tests May 6, 2026
@Yicong-Huang Yicong-Huang reopened this May 6, 2026
@github-actions github-actions Bot removed dependencies Pull requests that update a dependency file ci changes related to CI labels May 6, 2026
@Yicong-Huang Yicong-Huang requested a review from Copilot May 6, 2026 08:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Re-enables two previously skipped DragDropService unit tests by fixing the test logic (ordering of calls) and driving the drag/drop flow through a real (hidden) JointJS paper under jsdom, avoiding browser-mode-only dependencies.

Changes:

  • Re-enabled the “closest operators” test by calling findClosestOperators after operators are added and relaxing assertions to be order-independent.
  • Replaced the previously skipped “drop operator” test with an integration-style jsdom test that attaches a real JointJS paper, triggers dragStarted, synthesizes mousemove, and then calls dragDropped.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread frontend/src/app/workspace/service/drag-drop/drag-drop.service.spec.ts Outdated
Comment thread frontend/src/app/workspace/service/drag-drop/drag-drop.service.spec.ts Outdated
Comment thread frontend/src/app/workspace/service/drag-drop/drag-drop.service.spec.ts Outdated
- Replace the misleading `pageToLocalPoint(x, y) ≈ (x, y)` note with
  the actual behavior: the SVG polyfill's identity matrices collapse
  the call to (0, 0) regardless of input. That's the real reason
  operators are placed at x=±100 around the origin.
- Wrap DOM mutation in try/finally so paperHost / flyingOpHost are
  removed even if an assertion throws.
- Dispatch a synthetic `mouseup` after `dragDropped` so the window-level
  mousemove subscriptions installed by `dragStarted` tear down before
  the next spec runs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Yicong-Huang Yicong-Huang enabled auto-merge (squash) May 6, 2026 08:45
@aglinxinyuan
Copy link
Copy Markdown
Contributor

The frontend test took 6 hours and failed. Please take a look:
https://github.com/apache/texera/actions/runs/25425783736/job/74578713230

@aglinxinyuan aglinxinyuan disabled auto-merge May 6, 2026 23:08
@aglinxinyuan
Copy link
Copy Markdown
Contributor

The frontend test took 6 hours and failed. Please take a look: https://github.com/apache/texera/actions/runs/25425783736/job/74578713230

Fixed in PR #4999

@aglinxinyuan aglinxinyuan enabled auto-merge (squash) May 9, 2026 08:35
@aglinxinyuan aglinxinyuan merged commit c1a8d0f into apache:main May 9, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature frontend Changes related to the frontend GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants