@react-three-dom/cypress
v0.6.2
Published
Cypress E2E testing SDK for React Three Fiber apps
Readme
@react-three-dom/cypress
Cypress E2E testing SDK for React Three Fiber apps. Custom commands and Chai assertions to query and interact with 3D objects by test ID and wait for scene readiness.
Install
npm install @react-three-dom/core
npm install -D @react-three-dom/cypress cypressPeer: cypress ≥12.
Setup
App: Use
@react-three-dom/corewith<ThreeDom />inside your<Canvas>and setuserData.testId(or similar) on objects you want to target.Cypress support: Import the package so it registers commands and assertions:
In cypress/support/e2e.ts (or your support file):
import '@react-three-dom/cypress';- Test: Use the custom commands and assertions:
it('scene works', () => {
cy.visit('/');
cy.r3fWaitForSceneReady();
cy.r3f().r3fExist('hero-cube');
cy.r3f().r3fHaveColor('hero-cube', '#ffa500');
cy.r3f().r3fClick('hero-cube');
});Documentation
Full docs: surendra1151.github.io/react-three-dom
License
MIT
