我正在使用react-testing-libarary来测试我的反应应用程序。出于某种原因,我需要能够通过id
and not找到元素data-testid
。在文档中没有办法实现这一点。
有没有办法做到这一点?
我将渲染输出为:
const dom = render(<App />);
我正在寻找符合以下条件的东西:
const input = dom.getElemenById('firstinput');
//or
const input = dom.getById('firstinput');