我在查询时遇到问题,我正在尝试获取两个无线电输入,其中之一没有任何问题,但另一个反应测试库引发了错误:It Found multiple elements with the role "radio" and name /to/i:
test('Render form with default items', () => {
const handleUpdateValue = jest.fn();
const handleNextStep = jest.fn();
render(
<Form
handleNextStep={handleNextStep}
updateValue={handleUpdateValue}
transferFundsValues={{}}
/>
);
const amountInput = screen.getByLabelText(/amount/i);
const fromRadio = screen.getByLabelText(/from/i);
const toRadio = screen.getByLabelText(/to/i);
const messageInput = screen.getByLabelText(/message/i);
const continueButton = screen.getByRole('button', { name: /continue/i });
const cancelButton = screen.getByRole('button', { name: /cancel/i });
// If no value has been entered to the inputs, the continue …Run Code Online (Sandbox Code Playgroud)