It's a lovely article and great technology. I am just not so on board with testing the implementation details of such a component. Visual testing always feels off when done with these kinds of testing frameworks (jest, and vitest). As in do you really want to test that a class name is applied to assert that the component rendered with a certain style or visual look? If I change the CSS of the class name to a totally different background colour, then this test
will still pass yet the component is broken because it has the wrong style.
Although then I have to answer the question, what is the best way to test for visual changes? Then it would have to be visual snapshots where you save the current state of the test as a screenshot and then assert it matches the previous run.
Although then I have to answer the question, what is the best way to test for visual changes? Then it would have to be visual snapshots where you save the current state of the test as a screenshot and then assert it matches the previous run.