This is a migrated thread and some comments may be shown as answers.

React Grid's are non-deterministic, don't work with snapshot testing

2 Answers 187 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
IT Dept
Top achievements
Rank 1
IT Dept asked on 23 Oct 2018, 05:58 PM

I'm running into an issue with the Kendo React Grids after introducing snapshot testing: The filtering cells seem to generate properties with GUIDs that change each render, making it impossible to snapshot test. You can see an example in the attached screenshot.

This is probably more of a feature request: Could thing be changed so the grid filter cells by default render in a predictable, repeatable way so they can be snapshot tested? Is there a better place to request this?

 

2 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 24 Oct 2018, 07:57 AM
Hello, Eric,

This is indeed caused by the internal use of a guid generator function that ensures that every instance of the component is unique.

The approach listed in the Jest documentation is also a good approach and it is actually the one recommended by them in this cases:

https://github.com/facebook/jest/blob/master/docs/SnapshotTesting.md#property-matchers

We may consider removing the source of randomness directly inside the code, but this could lead to issues when multiple components are added and we have to discuss this cases in more details.

Let me know if you need more details on this matter.

Regards,
Stefan
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
IT Dept
Top achievements
Rank 1
answered on 24 Oct 2018, 01:35 PM

Thanks, I'll give that approach a try.

Tags
General Discussions
Asked by
IT Dept
Top achievements
Rank 1
Answers by
Stefan
Telerik team
IT Dept
Top achievements
Rank 1
Share this question
or