LearnNewsExamplesServices
Frontmatter
id7438
titleCreate RMA Helper Scripts for Component Tests
stateClosed
labels
enhancementhelp wantedhacktoberfestai
assigneesAki-07
createdAtOct 10, 2025, 6:48 PM
updatedAtOct 11, 2025, 1:43 PM
githubUrlhttps://github.com/neomjs/neo/issues/7438
authortobiu
commentsCount3
parentIssue7435
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtOct 11, 2025, 10:40 AM

Create RMA Helper Scripts for Component Tests

Closed v11.0.0 enhancementhelp wantedhacktoberfestai
tobiu
tobiu commented on Oct 10, 2025, 6:48 PM

IMPORTANT: Before starting, please read the parent epic in detail to understand the required architecture and testing patterns: https://github.com/neomjs/neo/issues/7435

To facilitate communication between the Playwright test runner and the component instances in the app worker, a set of RMA (Remote Method Access) helper scripts is required. These scripts will be injected into the browser context using page.addInitScript().

Acceptance Criteria

  1. Create a new file, e.g., test/playwright/util/rma-helpers.mjs.
  2. This file should export the following asynchronous functions:
    • loadModule(path): A wrapper around Neo.worker.App.loadModule({path}).
    • createComponent(config): A wrapper around Neo.worker.App.createNeoInstance().
    • destroyComponent(id): A wrapper around Neo.worker.App.destroyNeoInstance().
    • getComponentConfig(id, keyOrKeys): A wrapper around Neo.worker.App.getConfigs().
    • setComponentConfig(id, config): A wrapper around Neo.worker.App.setConfigs().
  3. These helpers will be used in the beforeEach, afterEach, and test body sections of the component tests.
tobiu added parent issue #7435 on Oct 10, 2025, 6:48 PM
tobiu added the enhancement label on Oct 10, 2025, 6:48 PM
tobiu added the help wanted label on Oct 10, 2025, 6:48 PM
tobiu added the hacktoberfest label on Oct 10, 2025, 6:48 PM
tobiu added the ai label on Oct 10, 2025, 6:48 PM
tobiu closed this issue on Oct 11, 2025, 10:40 AM
tobiu assigned to @Aki-07 on Oct 11, 2025, 10:50 AM
tobiu
tobiu Oct 11, 2025, 11:03 AM

Let me add some more context what remote method access is all about, since this is one of my favorite topics. It simplifies cross-thread communication via using namespaces.

As an example, inside workers we can not access the live-DOM. When using e.g. CSS flexbox layouts, the virtual DOM abstraction layer does not know about the real sizes of DOM nodes inside of it. So, inside the app worker we can call:

const buttonRect = await Neo.main.DomAccess.getBoundingClientRect({windowId, id});

Neo.main.DomAccess exists inside main threads, but not inside the app worker. An app worker can communicate with multiple browser windows (main threads), so we pass the windowId to get the right one. Under the hood, we send a postMessage from the app worker to main, execute the method, send the return value back and this resolves the Promise.

The real method definitions can be either sync or async, calling them from other threads is always async, due to the nature of post messages.

This concept also works for cross-worker communication, and workers are connected via MessageChannels for direct communication.

Code: https://github.com/neomjs/neo/blob/dev/src/worker/mixin/RemoteMethodAccess.mjs https://github.com/neomjs/neo/blob/dev/src/core/Base.mjs#L569

tobiu
tobiu Oct 11, 2025, 1:43 PM