Skip to content

feat(browser-tests): refactor interface(s) between server, headless browser, and client #2619

@adklempner

Description

@adklempner

Description

In order to simulate realistic js-waku behavior in a browser, we use playwright to load @waku/sdk in a headless webpage.

In order to integrate with Vac DST's Waku simulation infrastructure we provide a dockerized server that exposes a REST API symmetric to nwaku's REST API.

The existing method of mapping REST requests into functions executed in the headless app is error-prone and difficult to reason about.

User Story

As a developer, I want to be able to quickly understand what functions are triggered in the headless browser by a REST request to the server, and add new endpoints/functions in a reliable manner.

Proposed Solution / Feature Design

Remove use of inline page contents, instead serve a static page
Use a class WakuHeadless and refactor both headless app and server endpoints to use this class for interacting with the js-waku node running in the browser
Abstract away common pattern of REST endpoint (with parsing and errors) -> function call to WakuHeadleess class in headless browser

Optional: Diagram or Draft of Design

Notes

Metadata

Metadata

Assignees

Labels

effort/daysRoughly 1–2 working days (~6–16h).

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions