Install the Playwright test runner and convert an initial Siesta unit test to the new framework to establish a baseline pattern for future test migration.
Implementation Notes
The initial approach was to convert the VDOM unit test into a browser-based component integration test. However, the goal was refined to keep it as a pure VDOM unit test running within a Node.js environment.
The final, successful implementation uses Playwright's test runner without a browser. It works by:
- Creating a
setup.mjs file to mock the necessary browser globals (DOMRect) and configure the Neo namespace on globalThis for a headless environment.
- Configuring
playwright.config.mjs to run without a browser or web server.
- Writing the test spec as a pure Node.js module, importing the framework classes directly and asserting against the VDOM data structures returned by the component's methods.
This pattern allows for fast, browser-less unit testing of framework components using the Playwright test runner.
Tasks
Install the Playwright test runner and convert an initial Siesta unit test to the new framework to establish a baseline pattern for future test migration.
Implementation Notes
The initial approach was to convert the VDOM unit test into a browser-based component integration test. However, the goal was refined to keep it as a pure VDOM unit test running within a Node.js environment.
The final, successful implementation uses Playwright's test runner without a browser. It works by:
setup.mjsfile to mock the necessary browser globals (DOMRect) and configure theNeonamespace onglobalThisfor a headless environment.playwright.config.mjsto run without a browser or web server.This pattern allows for fast, browser-less unit testing of framework components using the Playwright test runner.
Tasks
@playwright/testdependency.playwright.config.mjsfor a Node.js test environment.test/playwright/setup.mjsto configure the Node.js global scope.test/siesta/tests/classic/Button.mjstotest/playwright/classic/button.spec.mjs.playwright.config.mjsintotest/playwright/and update paths.