是否可以使用 react-testing-library 进行端到端测试?
Is it possible end-to-end tests using react-testing-library?
我知道我们可以使用 React 测试库测试组件标签测试。但是出于好奇,我想知道有什么方法可以使用这个库对反应组件进行端到端测试。
如果我能得到一些有用的信息,我将不胜感激。
RTL 文档中有一个使用 React Router 的示例:https://testing-library.com/docs/example-react-router/ so it looks like it's possible. However, I'd recommend using a dedicated e2e testing library such as Cypress to do the job. There is an RTL integration for Cypress 因此您可以遵循 RTL 提倡的相同测试原则。
我知道我们可以使用 React 测试库测试组件标签测试。但是出于好奇,我想知道有什么方法可以使用这个库对反应组件进行端到端测试。
如果我能得到一些有用的信息,我将不胜感激。
RTL 文档中有一个使用 React Router 的示例:https://testing-library.com/docs/example-react-router/ so it looks like it's possible. However, I'd recommend using a dedicated e2e testing library such as Cypress to do the job. There is an RTL integration for Cypress 因此您可以遵循 RTL 提倡的相同测试原则。