Skip to content

Commit 4baaa3a

Browse files
authored
Remove breakpoints (#10604)
Follow on to #10601 - Delete breakpoint UI and protocol-related code - Remove unnecessary abstractions (now that there aren't two types of "points" in the app) - Rename Nag/Tour related code that had potentially confusing references to breakpoints - Update any e2e tests that got broken by this change
1 parent 606e120 commit 4baaa3a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+185
-896
lines changed

packages/e2e-tests/authenticated/logpoints-01.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ test(`authenticated/logpoints-01: Shared logpoints functionality`, async ({
6464
const page = await context.newPage();
6565
await load(page, recordingId, testUsers![1].apiKey, testScope);
6666

67-
const locator = await findPoints(page, "logpoint", { lineNumber });
67+
const locator = await findPoints(page, { lineNumber });
6868

6969
// Verify point is not editable
7070
await expect(await isPointEditable(locator)).toBe(false);

packages/e2e-tests/helpers/pause-information-panel.ts

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ async function toggleAccordionPane(page: Page, pane: Locator, targetState: "open
1818
}
1919
}
2020

21-
export async function closeBreakpointsAccordionPane(page: Page): Promise<void> {
22-
await toggleAccordionPane(page, getBreakpointsAccordionPane(page), "closed");
23-
}
24-
2521
export async function closeCallStackAccordionPane(page: Page): Promise<void> {
2622
await toggleAccordionPane(page, getCallStackAccordionPane(page), "closed");
2723
}
@@ -49,7 +45,7 @@ export async function expandAllScopesBlocks(page: Page): Promise<void> {
4945

5046
export async function closeSidePanel(page: Page) {
5147
// Ensure that it's closed by forcing the "Pause" pane to open instead...
52-
const pane = getBreakpointsAccordionPane(page);
48+
const pane = getPrintStatementsAccordionPane(page);
5349
const pauseButton = page.locator('[data-test-name="ToolbarButton-PauseInformation"]');
5450
await pauseButton.click();
5551
const isVisible = await pane.isVisible();
@@ -58,10 +54,6 @@ export async function closeSidePanel(page: Page) {
5854
}
5955
}
6056

61-
export function getBreakpointsAccordionPane(page: Page): Locator {
62-
return page.locator('[data-test-id="AccordionPane-Breakpoints"]');
63-
}
64-
6557
export function getCallStackAccordionPane(page: Page): Locator {
6658
return page.locator('[data-test-id="AccordionPane-CallStack"]');
6759
}
@@ -110,17 +102,13 @@ export function getScopesPanel(page: Page): Locator {
110102
return page.locator('[data-test-name="ScopesList"]');
111103
}
112104

113-
export async function openBreakpointsAccordionPane(page: Page): Promise<void> {
114-
await toggleAccordionPane(page, getBreakpointsAccordionPane(page), "open");
115-
}
116-
117105
export async function openCallStackPane(page: Page): Promise<void> {
118106
await toggleAccordionPane(page, getCallStackAccordionPane(page), "open");
119107
}
120108

121109
export async function openPauseInformationPanel(page: Page): Promise<void> {
122110
// Only click if it's not already open; clicking again will collapse the side bar.
123-
const pane = getBreakpointsAccordionPane(page);
111+
const pane = getPrintStatementsAccordionPane(page);
124112

125113
let isVisible = await pane.isVisible();
126114
if (!isVisible) {
@@ -344,7 +332,6 @@ export async function waitForScopeValue(
344332

345333
export function findPoints(
346334
page: Page,
347-
type: "logpoint" | "breakpoint",
348335
options: {
349336
sourceId?: SourceId;
350337
lineNumber?: number;
@@ -354,8 +341,7 @@ export function findPoints(
354341
const { columnIndex, lineNumber, sourceId } = options;
355342

356343
const selectorCriteria = [
357-
'[data-test-name="Breakpoint"]',
358-
`[data-test-type="${type}"]`,
344+
'[data-test-name="LogPoint"]',
359345
columnIndex != null ? `[data-test-column-index="${columnIndex}"]` : "",
360346
lineNumber != null ? `[data-test-line-number="${lineNumber}"]` : "",
361347
sourceId != null ? `[data-test-source-id="${sourceId}"]` : "",
@@ -365,17 +351,17 @@ export function findPoints(
365351
}
366352

367353
export async function isPointEditable(pointLocator: Locator) {
368-
const editButton = pointLocator.locator('[data-test-name="RemoveBreakpointButton"]');
354+
const editButton = pointLocator.locator('[data-test-name="RemoveLogPointButton"]');
369355
return (await editButton.count()) > 0;
370356
}
371357

372358
export async function removePoint(pointLocator: Locator) {
373-
await pointLocator.locator('[data-test-name="RemoveBreakpointButton"]').first().click();
359+
await pointLocator.locator('[data-test-name="RemoveLogPointButton"]').first().click();
374360
}
375361

376362
export async function togglePoint(page: Page, pointLocator: Locator, enabled: boolean) {
377363
const targetState = enabled ? POINT_BEHAVIOR_ENABLED : POINT_BEHAVIOR_DISABLED_TEMPORARILY;
378-
const toggle = pointLocator.locator('[data-test-name="BreakpointToggle"]');
364+
const toggle = pointLocator.locator('[data-test-name="LogPointToggle"]');
379365
const currentState = await toggle.getAttribute("date-test-state");
380366
if (targetState !== currentState) {
381367
await debugPrint(page, `Toggling point to ${targetState}`, "togglePoint");

packages/e2e-tests/helpers/source-panel.ts

Lines changed: 5 additions & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -3,74 +3,12 @@ import chalk from "chalk";
33

44
import { Badge } from "shared/client/types";
55

6-
import { clearText, focus, hideTypeAheadSuggestions, typeLogPoint as typeLexical } from "./lexical";
6+
import { focus, hideTypeAheadSuggestions, typeLogPoint as typeLexical } from "./lexical";
77
import { findPoints, openPauseInformationPanel, removePoint } from "./pause-information-panel";
88
import { openSource } from "./source-explorer-panel";
9-
import { clearTextArea, debugPrint, delay, getByTestName, getCommandKey, waitFor } from "./utils";
9+
import { clearTextArea, debugPrint, getByTestName, getCommandKey, waitFor } from "./utils";
1010
import { openDevToolsTab } from ".";
1111

12-
export async function addBreakpoint(
13-
page: Page,
14-
options: {
15-
columnIndex?: number;
16-
lineNumber: number;
17-
url: string;
18-
}
19-
): Promise<void> {
20-
const { lineNumber, url } = options;
21-
22-
await openDevToolsTab(page);
23-
24-
if (url) {
25-
await openSource(page, url);
26-
}
27-
28-
await debugPrint(
29-
page,
30-
`Adding breakpoint at ${chalk.bold(`${url}:${lineNumber}`)}`,
31-
"addBreakpoint"
32-
);
33-
34-
await scrollUntilLineIsVisible(page, lineNumber);
35-
await waitForSourceLineHitCounts(page, lineNumber);
36-
37-
const lineLocator = await getSourceLine(page, lineNumber);
38-
39-
// Account for the fact that SourceListRow doesn't render SourceListRowMouseEvents while scrolling
40-
await waitFor(async () => {
41-
const isScrolling = await lineLocator.getAttribute("data-test-is-scrolling");
42-
expect(isScrolling).toBe(null);
43-
});
44-
45-
const lineNumberLocator = lineLocator.locator('[data-test-name="SourceLine-LineNumber"]');
46-
await lineNumberLocator.waitFor();
47-
48-
const breakpointToggleLocator = lineLocator.locator('[data-test-name="BreakpointToggle"]');
49-
50-
await waitFor(async () => {
51-
// Mouse out then back over
52-
await page.mouse.move(0, 0);
53-
await lineNumberLocator.hover({ force: true });
54-
55-
// Wait for breakpoint toggle from mouse over
56-
await breakpointToggleLocator.waitFor();
57-
58-
const state = await breakpointToggleLocator.getAttribute("data-test-state");
59-
if (state === "off") {
60-
await lineLocator.locator('[data-test-name="SourceLine-LineNumber"]').click({ force: true });
61-
}
62-
});
63-
64-
await waitForBreakpoint(page, options);
65-
66-
// We want to add a slight delay after adding a breakpoint so that the
67-
// breakpoint logic will have time to send protocol commands to the server,
68-
// since that is not guaranteed to happen synchronously on click. This is
69-
// important for cases where we add a breakpoint and then immediately
70-
// attempt to step to the breakpoint location.
71-
await delay(2000);
72-
}
73-
7412
export async function editBadge(
7513
page: Page,
7614
options: {
@@ -514,69 +452,18 @@ export async function openLogPointPanelContextMenu(
514452
}
515453
}
516454

517-
export async function removeAllBreakpoints(page: Page): Promise<void> {
518-
await debugPrint(page, `Removing all breakpoints for the current source`, "removeBreakpoint");
519-
520-
await openPauseInformationPanel(page);
521-
const points = await findPoints(page, "breakpoint");
522-
const count = await points.count();
523-
for (let index = count - 1; index >= 0; index--) {
524-
const point = points.nth(index);
525-
await removePoint(point);
526-
}
527-
}
528-
529455
export async function removeAllLogpoints(page: Page): Promise<void> {
530-
await debugPrint(page, `Removing all breakpoints for the current source`, "removeBreakpoint");
456+
await debugPrint(page, `Removing all logpoints for the current source`, "removeAllLogpoints");
531457

532458
await openPauseInformationPanel(page);
533-
const points = await findPoints(page, "logpoint");
459+
const points = await findPoints(page);
534460
const count = await points.count();
535461
for (let index = count - 1; index >= 0; index--) {
536462
const point = points.nth(index);
537463
await removePoint(point);
538464
}
539465
}
540466

541-
export async function removeBreakpoint(
542-
page: Page,
543-
options: {
544-
lineNumber: number;
545-
url: string;
546-
}
547-
): Promise<void> {
548-
const { lineNumber, url } = options;
549-
550-
await debugPrint(
551-
page,
552-
`Removing breakpoint at ${chalk.bold(`${url}:${lineNumber}`)}`,
553-
"removeBreakpoint"
554-
);
555-
556-
await openDevToolsTab(page);
557-
558-
if (url) {
559-
await openSource(page, url);
560-
}
561-
562-
const lineLocator = await getSourceLine(page, lineNumber);
563-
const numberLocator = lineLocator.locator(`[data-test-name="SourceLine-LineNumber"]`);
564-
await numberLocator.hover({ force: true });
565-
const state = await lineLocator
566-
.locator('[data-test-name="BreakpointToggle"]')
567-
.getAttribute("data-test-state");
568-
if (state !== "off") {
569-
await numberLocator.click({ force: true });
570-
}
571-
572-
// We want to add a slight delay after removing a breakpoint so that the
573-
// breakpoint logic will have time to send protocol commands to the server,
574-
// since that is not guaranteed to happen synchronously on click. This is
575-
// important for cases where we remove a breakpoint and then immediately
576-
// attempt to step across the breakpoint location.
577-
await delay(1000);
578-
}
579-
580467
export async function removeConditional(
581468
page: Page,
582469
options: {
@@ -698,39 +585,6 @@ export async function toggleMappedSources(page: Page, targetState: "on" | "off")
698585
}
699586
}
700587

701-
export async function waitForBreakpoint(
702-
page: Page,
703-
options: {
704-
columnIndex?: number;
705-
lineNumber: number;
706-
url: string;
707-
}
708-
): Promise<void> {
709-
const { columnIndex, lineNumber, url } = options;
710-
711-
await debugPrint(
712-
page,
713-
`Waiting for breakpoint at ${chalk.bold(`${url}:${lineNumber}`)}`,
714-
"waitForBreakpoint"
715-
);
716-
717-
await openPauseInformationPanel(page);
718-
719-
const breakpointGroup = await page.waitForSelector(
720-
`[data-test-name="BreakpointsList"]:has-text("${url}")`
721-
);
722-
723-
if (columnIndex != null) {
724-
await breakpointGroup.waitForSelector(
725-
`[data-test-name="PointLocation"]:has-text("${lineNumber}:${columnIndex}")`
726-
);
727-
} else {
728-
await breakpointGroup.waitForSelector(
729-
`[data-test-name="PointLocation"]:has-text("${lineNumber}")`
730-
);
731-
}
732-
}
733-
734588
export async function waitForLogpoint(
735589
page: Page,
736590
options: {
@@ -775,7 +629,7 @@ export async function verifyLogpointStep(
775629

776630
await debugPrint(
777631
page,
778-
`Verifying breakpoint status "${chalk.bold(expectedStatus)}" for line ${chalk.bold(
632+
`Verifying logpoint status "${chalk.bold(expectedStatus)}" for line ${chalk.bold(
779633
options.lineNumber
780634
)}`,
781635
"verifyLogpointStep"

packages/e2e-tests/tests/logpoints-01.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
verifyLogpointBadge,
99
} from "../helpers/console-panel";
1010
import { reverseStepOverToLine } from "../helpers/pause-information-panel";
11-
import { addBreakpoint, addLogpoint } from "../helpers/source-panel";
11+
import { addLogpoint } from "../helpers/source-panel";
1212
import { waitFor } from "../helpers/utils";
1313
import test, { expect } from "../testFixture";
1414

@@ -21,7 +21,6 @@ test(`logpoints-01: log-points appear in the correct order and allow time warpin
2121
await startTest(page, recordingId, testScope);
2222
await openDevToolsTab(page);
2323

24-
await addBreakpoint(page, { lineNumber: 20, url: exampleKey });
2524
await addLogpoint(page, {
2625
content: '"Logpoint Number " + number',
2726
lineNumber: 20,

packages/e2e-tests/tests/logpoints-02.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
seekToPreviousLogPointHit,
1111
verifyLogpointStep,
1212
} from "../helpers/source-panel";
13-
import { delay } from "../helpers/utils";
1413
import test, { expect } from "../testFixture";
1514

1615
test.use({ exampleKey: "doc_rr_basic.html" });
@@ -47,7 +46,7 @@ test(`logpoints-02: conditional log-points`, async ({
4746
await expect(logPointMessages.first()).toHaveText(/Beginning/);
4847
await expect(logPointMessages.last()).toHaveText(/Ending/);
4948

50-
const logpoint = findPoints(page, "logpoint", { lineNumber: 20 });
49+
const logpoint = findPoints(page, { lineNumber: 20 });
5150
await togglePoint(page, logpoint, false);
5251
await expect(logPointMessages).toHaveCount(2);
5352
await togglePoint(page, logpoint, true);

packages/e2e-tests/tests/logpoints-06.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ test(`logpoints-06: should be temporarily disabled`, async ({
3333
// Find the newly added point in the side panel
3434
await openPauseInformationPanel(page);
3535
await openPrintStatementsAccordionPane(page);
36-
const logpoints = findPoints(page, "logpoint", { lineNumber });
36+
const logpoints = findPoints(page, { lineNumber });
3737
await expect(await logpoints.count()).toBe(1);
3838
const logpoint = logpoints.first();
3939

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
import { startTest } from "../helpers";
22
import { openSource } from "../helpers/source-explorer-panel";
3-
import { addBreakpoint, fastForwardToLine, rewindToLine } from "../helpers/source-panel";
4-
import test, { Page } from "../testFixture";
5-
6-
async function resumeToBreakpoint(page: Page, line: number) {
7-
await addBreakpoint(page, { url: "control_flow.js", lineNumber: line });
8-
await fastForwardToLine(page, { lineNumber: line });
9-
}
3+
import { fastForwardToLine, rewindToLine } from "../helpers/source-panel";
4+
import test from "../testFixture";
105

116
test.use({ exampleKey: "node/control_flow.js" });
127

@@ -22,20 +17,18 @@ test("node_control_flow: catch, finally, generators, and async/await", async ({
2217

2318
await rewindToLine(page, { lineNumber: 84 });
2419

25-
await resumeToBreakpoint(page, 10);
26-
await resumeToBreakpoint(page, 12);
27-
await resumeToBreakpoint(page, 18);
28-
await resumeToBreakpoint(page, 20);
29-
await resumeToBreakpoint(page, 32);
30-
await resumeToBreakpoint(page, 27);
31-
20+
await fastForwardToLine(page, { lineNumber: 10 });
21+
await fastForwardToLine(page, { lineNumber: 12 });
22+
await fastForwardToLine(page, { lineNumber: 18 });
23+
await fastForwardToLine(page, { lineNumber: 20 });
3224
await fastForwardToLine(page, { lineNumber: 32 });
3325
await fastForwardToLine(page, { lineNumber: 27 });
34-
35-
await resumeToBreakpoint(page, 42);
36-
await resumeToBreakpoint(page, 44);
37-
await resumeToBreakpoint(page, 50);
38-
await resumeToBreakpoint(page, 54);
39-
await resumeToBreakpoint(page, 65);
40-
await resumeToBreakpoint(page, 72);
26+
await fastForwardToLine(page, { lineNumber: 32 });
27+
await fastForwardToLine(page, { lineNumber: 27 });
28+
await fastForwardToLine(page, { lineNumber: 42 });
29+
await fastForwardToLine(page, { lineNumber: 44 });
30+
await fastForwardToLine(page, { lineNumber: 50 });
31+
await fastForwardToLine(page, { lineNumber: 54 });
32+
await fastForwardToLine(page, { lineNumber: 65 });
33+
await fastForwardToLine(page, { lineNumber: 72 });
4134
});

0 commit comments

Comments
 (0)