TypeError: ionRouterOutlet.commit is not a function

Hi,

I’m writing test cases for react ionic app ( using tab template ). I want to test when I click on IonTabButton it should redirect to the correct route. How can I achieve this? Below is the code I’m trying

test("redirect to posts", async () => {

  const history = createMemoryHistory()
  const { baseElement, getByTestId } = render(
    <Router history={history}>
      <App />
    </Router>
  );
  const postBtn = await getByTestId("posts"); // It's not able to find element with posts
  fireEvent.click(postBtn);
  
});

and In IonTabButton

<IonTabButton data-testid="posts" tab="posts" href="/posts">
  <img
     alt="posts"
     className="menu-icon"
     src="/assets/icon/active/category_show.png" /> 
</IonTabButton>

How can I add testid in IonTab Button

And in another test which is on button component (HTML component), in this test case getByTestId is working but click on it causing below error:

TypeError: ionRouterOutlet.commit is not a function