简体   繁体   English

使用 react-testing-library 测试 mxGraph

[英]Testing mxGraph with react-testing-library

I'm using mxGraph library in React App.我在 React App 中使用 mxGraph 库。 I need to create unit tests for components that draw graph.我需要为绘制图形的组件创建单元测试。 I'm using jest and react testing library .我正在使用 jest 和react 测试库 But this library cannot render out mxGraph's elements.但是这个库不能渲染出 mxGraph 的元素。 Maybe because, while testing it cannot define screen resolution, and render out properly.也许是因为,在测试时它无法定义屏幕分辨率,也无法正确渲染。

Is it possible to test mxGraph drawings or is there any examples or practices with it?是否可以测试 mxGraph 绘图或是否有任何示例或实践?

I don't think RTL is the best tool for this kind of testing.我不认为 RTL 是这种测试的最佳工具。 It does not compute any graphical value like height and width of the elements or their positions.它不计算任何图形值,如元素的高度和宽度或其位置。 I would suggest you use something like Cypress for this kind of tests我建议您使用Cypress 之类的东西进行此类测试

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM