我正在用测试UI。想知道在我运行测试时是否有任何方法(包括包含单独的包)来呈现由我的浏览器中的测试创建的页面。我基本上是想在我的反应测试中完成Ruby的Capybara gem的save_and_open_page函数所发生的事情。有可能吗?
发布于 2022-07-11 08:38:21
可以使用测试操场在浏览器中呈现组件。
import { screen } from "@testing-library/react"
render(<MyComponent />)
// log entire document to testing-playground
screen.logTestingPlaygroundURL()
// log a single element
screen.logTestingPlaygroundURL(screen.getByText('test'))
https://stackoverflow.com/questions/70764166
复制相似问题