LearnNewsExamplesServices
Frontmatter
id8851
titleExploration: Neural Link Driven Playwright Tests (Deep E2E)
stateClosed
labels
enhancementno auto closeaitestingarchitecture
assigneestobiu
createdAtJan 21, 2026, 3:53 PM
updatedAtApr 8, 2026, 12:16 PM
githubUrlhttps://github.com/neomjs/neo/issues/8851
authortobiu
commentsCount2
parentIssuenull
subIssues
9782 Neural Link Playwright SDK Integration
9783 Implement NeuralLink Playwright Test Fixture
subIssuesCompleted2
subIssuesTotal2
blockedBy[ ] 9821 Enhancement: Neural Link VDOM Sync Primitives, [ ] 9820 R&D: Grid Component Mutability & Column Synchronization, [ ] 9819 R&D: Identify Ideal Candidates for Whitebox E2E Testing
blocking[]
closedAtApr 8, 2026, 12:16 PM

Exploration: Neural Link Driven Playwright Tests (Deep E2E)

Closedenhancementno auto closeaitestingarchitecture
tobiu
tobiu commented on Jan 21, 2026, 3:53 PM

Concept

Move beyond traditional "Black-Box" E2E testing (which only inspects the DOM) to "White-Box" testing that can inspect the internal state of the Neo.mjs App Worker directly during a Playwright test run.

By integrating the Neural Link (NL) SDK (ai/services.mjs) into the Playwright Node.js environment, tests can establish a WebSocket connection to the running application.

The Architecture

  1. Playwright (Node.js): Drives the Browser (User Input, DOM assertions).
  2. Neural Link Client (Node.js): Runs inside the test process, connected to the App Worker via WebSocket.
  3. The Loop:
    • Action: Playwright clicks a button.
    • Verification: Neural Link queries the worker: "What is the store count?", "What is the windowId of this component?".
    • Assertion: Test asserts against the internal truth returned by the worker.

Key Benefits

1. Multi-Window Mastery

Testing multi-window apps with Playwright is notoriously flaky due to context switching. With NL, we don't need to switch the Playwright "page" context to inspect a popup. We simply ask the App Worker (which owns all windows) for the state of the component, regardless of where it is rendering.

2. State > DOM

Verifying complex data structures (e.g., a Grid with 10k rows) via DOM selectors is slow and brittle. NL allows direct inspection of Stores, Managers, and Component Configs.

  • Old Way: expect(await page.locator('.row').count()).toBe(100)
  • New Way: expect(await app.getStore('my-store').count).toBe(100)

3. Event Telemetry

We can potentially subscribe to internal framework events (vnodeInitialized, storeLoaded) to create precise, deterministic wait conditions, eliminating flaky waitForTimeout calls.

Implementation Tasks

  1. SDK Compatibility: Verify/Refactor ai/services.mjs to ensure it can be imported and instantiated easily within a Node.js Playwright environment (outside the context of a full Agent).
  2. Test-Specific Handshake: Implement a mode in the NL Server to accept "Test Clients" that require RPC access but minimal overhead (no full Agent identity/memory).
  3. Playwright Fixture: Create a custom test fixture that manages the connection lifecycle.

Example Usage

test('Panel moves to new window correctly', async ({ page, neuralLink }) => {
    // 1. Setup
    const app = await neuralLink.connectToApp('Helix');
    const panelId = 'neo-panel-1';

    // 2. Initial State Check (Internal)
    const initialProps = await app.getComponent(panelId);
    expect(initialProps.windowId).toBe(1);

    // 3. Action (User Input via Playwright)
    await page.click('#detach-button');

    // 4. Verification (Internal via Neural Link)
    // Wait for the worker to acknowledge the move
    await expect.poll(async () => {
        const props = await app.getComponent(panelId);
        return props.windowId;
    }).not.toBe(1);
});

Strategic Value

This capability would uniquely position Neo.mjs as an exceptionally testable framework for complex, multi-window, data-heavy applications—something traditional frameworks struggle to offer.

tobiu added the enhancement label on Jan 21, 2026, 3:53 PM
tobiu added the ai label on Jan 21, 2026, 3:53 PM
tobiu added the testing label on Jan 21, 2026, 3:53 PM
tobiu added the architecture label on Jan 21, 2026, 3:53 PM
tobiu
tobiu Jan 21, 2026, 3:57 PM

✦ While standard Neo.mjs unit tests (like RealWorldUpdates.spec.mjs) have some visibility because they run inside the framework's context (single-threaded mode), E2E tests running against a real production build (Worker mode) are typically walled off.

Neural Link bridges that wall.

By getting write access (set_instance_properties, evaluate_expression), we unlock "God Mode" for E2E testing:

  1. State Injection: Skip the 10-step wizard setup by injecting the final state directly into the Store/Model.
  2. Chaos Engineering: Randomly kill a window or disconnect a worker connection to verify recovery logic.
  3. Hot-Patching during Test: Inject a console.log spy into a specific method on the fly to assert it was called.

The topology check is indeed the first handshake. Once we know who is online (App Worker ID), we own the runtime.

Issue #8851 serves as the placeholder for this "Next Level" capability. It aligns perfectly with the "Application Engine" narrative—providing professional-grade tooling that toy frameworks can't match.

tobiu cross-referenced by #8884 on Jan 26, 2026, 7:45 PM
tobiu added the no auto close label on Apr 5, 2026, 2:24 AM
tobiu assigned to @tobiu on Apr 5, 2026, 12:22 PM
tobiu added sub-issue #9782 on Apr 8, 2026, 11:44 AM
tobiu added sub-issue #9783 on Apr 8, 2026, 11:44 AM
tobiu referenced in commit 108fffc - "feat: Neural Link Driven Playwright Integration (#8851) on Apr 8, 2026, 12:04 PM
tobiu
tobiu Apr 8, 2026, 12:04 PM

Input from Antigravity (Gemini 3.1 Pro):

✦ ### White-Box E2E Testing Implemented

The implementation for Neural Link Driven Playwright Integration is complete.

Changes Included:

  • Enhanced Bridge.mjs to authorize role=test connections and updated ConnectionService.mjs to cache appName.
  • Developed waitForSession in ConnectionService.mjs to handle Playwright's sequential test sync requirements.
  • Developed neuralLink test fixture exposing app.getComponent, app.getStore, app.callMethod, and app.setProperties.
  • Addressed robust DOM ID extraction inside the smoke test to support dynamic App Worker context bindings.

Verification: Fully verified with a new E2E smoke test (test/playwright/e2e/NeuralLink.spec.mjs), which successfully intercepts internal component state (neo-viewport-1 or dynamic ID) from worker memory seamlessly via websocket, modifies it natively with setProperties, and confirms the DOM mutates via toHaveCSS(). All without interacting directly with Playwright page handles!

Changes have been pushed to feature/issue-8851-neural-link-playwright.

tobiu cross-referenced by PR #9788 on Apr 8, 2026, 12:13 PM
tobiu referenced in commit dc50d2d - "Merge pull request #9788 from neomjs/feature/issue-8851-neural-link-playwright on Apr 8, 2026, 12:16 PM
tobiu closed this issue on Apr 8, 2026, 12:16 PM
tobiu marked this issue as being blocked by #9819 on Apr 9, 2026, 1:34 PM
tobiu marked this issue as being blocked by #9820 on Apr 9, 2026, 1:34 PM
tobiu marked this issue as being blocked by #9821 on Apr 9, 2026, 1:34 PM
tobiu referenced in commit 38fd22e - "test(playwright): stabilize Neural Link test environment and fix DevIndex bindings (#8851)" on Apr 9, 2026, 1:35 PM
tobiu cross-referenced by PR #9823 on Apr 9, 2026, 2:18 PM
tobiu referenced in commit 383d838 - "Merge pull request #9823 from neomjs/feature/issue-8851-neural-link-playwright on Apr 9, 2026, 2:20 PM