0

Prelude:

I have a tags input component, (in vanilla javascript), which triggers callbacks for different scenarios such as: adding a tag, removing, editing etc.

The problem:

Jest+Puppeteer doesn't have access to window variables, so I cannot access the component's instance (on a global variable in my HTML test page) and check if the callback function was fired (with a jest.fn() spy for example)

This is the component btw which the tests are for: https://yaireo.github.io/tagify

I cannot cover this only with unit-tests without a browser (puppeteer) because everything is DOM-based


Is this the right approach for testing a DOM-based web component non-visual UX side-effects?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.