Файли
openidea/src/features/debugger/__tests__/EventBreakpointsSection.test.tsx
T
ntbang0901 f0f15366e4 feat(debugger): Network tab for a debugged page (#3315)
A page session gets a Network tab in the Debug tool window: the page's requests with status, method, type, size and time, filtered by URL, resource kind and My code only (a request sent through a library is attributed to the project code that called it). A request shows its headers, response body (text, cut at 1 MB) and initiator; Break on Next Request turns it into a request breakpoint, and Reload Page loads the page again. js-debug's enableNetworking is asked once the page's launch is answered; a js-debug that doesn't report requests says so in the tab.

Co-authored-by: ntbang0901 <[email protected]>
2026-11-14 16:37:23 +08:00

24 рядки
977 B
TypeScript

import { afterEach, describe, expect, it } from "vitest";
import { act, render, screen } from "@testing-library/react";
import { EventBreakpointsSection } from "../js/EventBreakpointsSection";
import { forgetRefusals, setRefused } from "../js/refusals";
afterEach(() => forgetRefusals(4));
describe("JavaScript events and requests section", () => {
it("says so when the debugger of a page does not take these breakpoints", () => {
render(<EventBreakpointsSection />);
expect(screen.queryByRole("alert")).toBeNull();
act(() => setRefused(4, "eventBreakpoints", "unknown request"));
expect(screen.getByRole("alert")).toHaveTextContent(
"The debugger of the running page does not take these breakpoints: unknown request",
);
// Another tool's refusal is not about breakpoints.
act(() => {
setRefused(4, "eventBreakpoints", null);
setRefused(4, "network", "");
});
expect(screen.queryByRole("alert")).toBeNull();
});
});