I have been struggling trying to do an integration test on a material UI component. I can target the slider, but have not successfully been able to move the slider and find the new value. Do you have any guidance on how to interact with this component and test that interaction?
import React from "react";
import { fireEvent, render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import "@testing-library/jest-dom";
import { MemoryRouter } from "react-router-dom";
import { Slider } from "@material-ui/core";
import SearchForm from "./SearchForm";
describe("SearchForm interaction", () => {
it("should change value if slider is moved", () => {
const minValue = 1;
const maxValue = 8;
const currentValue = 4;
render(
<Slider
className="slider"
min={minValue}
max={maxValue}
value={currentValue}
onChange={jest.fn()}
valueLabelDisplay="auto"
aria-labelledby="range-slider"
data-testid="numPlayer-slider"
/>
);
const slider = screen.getByTestId("numPlayer-slider");
//userEvent.click(slider, )
});
});