Skip to content

Commit 184e53a

Browse files
committed
AAP-36512: FIx Admin portal tests fallout due to PF5 and latest Ansible-UI-framework
1 parent 46f05aa commit 184e53a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

ansible_ai_connect_admin_portal/src/__tests__/AppHeader.test.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { render, screen } from "@testing-library/react";
22
import "@testing-library/jest-dom";
33
import { AppHeader } from "../AppHeader";
44
import { BrowserRouter } from "react-router-dom";
5+
import userEvent from "@testing-library/user-event";
6+
import { act } from "react";
57

68
describe("AppHeader", () => {
79
// Store the original 'location' object so that it can be restored for other tests.
@@ -33,5 +35,16 @@ describe("AppHeader", () => {
3335

3436
// Check "Logout" option is not present
3537
expect(screen.queryByText("Logout")).toBeNull();
38+
39+
// Emulate click on menu button
40+
await act(() => userEvent.click(accountMenu));
41+
42+
// "Logout" menu option should now be present
43+
const logoutMenuButton = await screen.findByText("Logout");
44+
expect(logoutMenuButton).toBeInTheDocument();
45+
46+
// Emulate clicking on the logout button
47+
await act(() => userEvent.click(logoutMenuButton));
48+
expect(window.location.assign).toBeCalledWith("/logout");
3649
});
3750
});

0 commit comments

Comments
 (0)