testUtils.ts 334 B

12345678910
  1. import { screen, getAllByRole } from '@testing-library/react';
  2. export function getLabelSelects(index = 0) {
  3. const labels = screen.getByText(/Labels/);
  4. const selects = getAllByRole(labels.parentElement!.parentElement!.parentElement!, 'combobox');
  5. return {
  6. name: selects[3 * index],
  7. value: selects[3 * index + 2],
  8. };
  9. }