Skip to content

Enable browser mode for graph-rendering specs #4866

@Yicong-Huang

Description

@Yicong-Huang

Task Summary

Enable Vitest browser mode (Playwright-driven) for the specs that exercise jointjs paper geometry. Right now they run under jsdom with a stub SVG polyfill — enough for jointjs to instantiate, not enough to compute the graph layout the assertions depend on.

Currently affected

  • workflow-editor.component.spec.ts — entire suite (JointJS Paper + External Module Integration, ~22 tests). Every assertion depends on real getScreenCTM / getBBox / pointer-event hit testing that the jsdom polyfill returns identity-only stubs for. Currently kept on the exclusion list with the "jointjs paper geometry" comment in tsconfig.spec.json and angular.json.

  • drag-drop.service.spec.ts — 2 specific tests pinned with it.skip and a #4866 comment:

    • should find 3 input operatorPredicates and 3 output operatorPredicates for an operatorPredicate with 3 input / 3 output ports
    • should update highlighting, add operator, and add links when an operator is dropped

    Both rely on findClosestOperators, which queries SVG geometry. The other 4 tests in this file pass under jsdom and are running.

The earlier-listed monaco-related specs (code-debugger, code-editor, codearea-custom-template, time-travel, versions-list, operator-property-edit-frame) turned out to be blocked by infrastructure issues (CSS import, missing requestIdleCallback, stale TestBed shape), not jsdom layout. They were re-enabled in #4950.

Approach

Add Vitest browser mode via @vitest/browser + Playwright:

  1. yarn add -D @vitest/browser playwright
  2. Add a separate vitest.browser.config.ts (or per-target config) that opts in to browser mode and includes only the affected patterns:
    test: {
      browser: { enabled: true, provider: 'playwright', headless: true, name: 'chromium' },
      include: ['**/workflow-editor.component.spec.ts', '**/drag-drop.service.spec.ts'],
    }
  3. Wire a second gui:test-browser target into angular.json so ng test keeps the fast jsdom default and a dedicated browser-mode run handles these specs.
  4. Drop workflow-editor.component.spec.ts from the jsdom exclude lists; flip the 2 drag-drop it.skip back to it.
  5. CI: add an ubuntu-only job (Playwright on macos/windows runners would multiply minute cost), cache the Playwright binary by version.

Definition of done

  • workflow-editor.component.spec.ts runs under browser mode with passing assertions.
  • The 2 drag-drop it.skip tests are flipped back to it and pass under browser mode.
  • CI runs both default (jsdom) and browser-mode test targets; total wall-clock impact understood.
  • Documentation note in frontend/README.md (or similar) explaining when to use browser mode.

Task Type

  • Bug
  • New Feature
  • Refactor / Cleanup
  • DevOps / Deployment / CI
  • Testing / QA
  • Documentation
  • Performance
  • Other

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions