https://cypress.io logo
Cypress Component testing x NextJS x Stitches: css...
# i-need-help
m
Hi ! Has anyone set up Cypress component testing in a** NextJS** app that uses Stitches? Me and my team followed these guidelines to set up Stitches in our NextJS app: https://stitches.dev/blog/using-nextjs-with-stitches The issue is that the variables defined in the stitches.config.ts are not accessible in Cypress' testing environment. Hence, the components are styled properly except for everything that uses a variable (colours etc) defined in the theme. Because the guidelines recommend inserting Stitches css into the Next app by doing this >
<style id="stitches" dangerouslySetInnerHTML={{ __html: getCssText() }} />
I can't think of a way to load the content of getCssText() properly into the testing environment, whether using the
cypress/support/component.tsx
file or the
cypress/support/component-index.html file
Has anyone ran into this situation before and successfuly solved it? Thank you in advance!