Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ jobs:
repl bench checkout/.bench/*/*.svg
repl bench checkout/.bench/*/terminal.ansi
repl bench checkout/.bench/*/closed.json
repl bench checkout/.xmd/test-artifacts
include-hidden-files: "true"

# The same command the release publishes with, minus --dry-run. Catches slow
Expand Down
6 changes: 4 additions & 2 deletions examples/repl-bench/journeys/conversation.test.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,11 @@
<Terminal.WaitForText text="↳ [X] Round 1 result sent" as="narrowFeedback" />
<Terminal.Click at={narrowFeedback} />
<Terminal.WaitForText text="Show recorded feedback" />
<Terminal.WaitForText text="Outcome · ✓ COMPLETED" />
<Terminal.WaitForText text="Outcome · ✓ COMPLETED" as="narrowOutcome" />
<Terminal.WaitForText text="Output · Checkout output witness." />
<Terminal.WaitForText text="Esc closes · Tab moves · PageUp/PageDown in Content" row={18} />
<Terminal.WaitForText text="Esc closes" as="narrowGuidance" />
<Terminal.WaitForText text="PageUp/PageDown reads more content." />
<AssertEquals actual={Math.sign(narrowOutcome.row - narrowGuidance.row)} expected={1} />
<Terminal.WaitForText text="Entry entry-1 completed." present={false} />
<Terminal.Screenshot name="narrow-feedback-drawer" />
<Terminal.WaitForText text="linked entry Round 1" as="linked" />
Expand Down
47 changes: 33 additions & 14 deletions examples/repl-bench/journeys/repl-bench.test.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@
<ReplBench.Key key="Enter" />
<ReplBench.WaitForText text="> Round" />
<ReplBench.Type text="draft survives" />
<ReplBench.WaitForText text="draft survives" />
<ReplBench.WaitForText text="│ draft survives" />
<ReplBench.Key key="Home" />
<Repl.Focus.History />
<ReplBench.WaitForText text="> [history]" />
<ReplBench.Key key="Enter" />
Expand All @@ -101,17 +102,25 @@
<ReplBench.WaitForText text="* Entries" row={1} />
<ReplBench.WaitForText text="[exit]" row={19} />
<ReplBench.WaitForText text="· draft" as="narrowDraft" />
<ReplBench.WaitForText text="draft survives" row={narrowDraft.row + 1} />
<ReplBench.WaitForText text="│ draft survives" as="narrowValue" />
<AssertEquals actual={Math.sign(narrowValue.row - narrowDraft.row)} expected={1} />
<ReplBench.Resize columns={160} rows={36} />
<ReplBench.WaitForText text="TRANSCRIPT" row={1} />
<ReplBench.WaitForText text="[exit]" row={35} />
<ReplBench.WaitForText text="· draft" as="wideDraft" />
<ReplBench.WaitForText text="draft survives" row={wideDraft.row + 1} />
<ReplBench.WaitForText text="│ draft survives" as="wideValue" />
<AssertEquals actual={Math.sign(wideValue.row - wideDraft.row)} expected={1} />
<ReplBench.WaitForText text="stray input" present={false} />
<Repl.Focus.Draft />
<ReplBench.Type text="caret " />
<ReplBench.WaitForText text="│ caret draft survives" />
<ReplBench.Region name="sidekick-composer">
<ReplBench.WaitForText text="draft survives" present={false} />
</ReplBench.Region>
<ReplBench.Key key="Ctrl+C" />
</ReplBench>
<AssertEquals actual={closed.exitCode} expected={0} />
<AssertStringIncludes actual={closed.location} expected="/entries?draft=draft%20survives" />
<AssertStringIncludes actual={closed.location} expected="/entries?draft=caret%20draft%20survives" />
</Test>

<Test name="Enter on the focused exit allows the settled entry to reopen">
Expand Down Expand Up @@ -148,7 +157,8 @@
<ReplBench.WaitForText text="[send]" row={composer.row-1} as="sidekickSend" />
<ReplBench.WaitForText text="No messages yet." />
<ReplBench.Type text="Draft Send witness" />
<ReplBench.WaitForText text="Draft Send witness" row={draft.row+1} />
<ReplBench.WaitForText text="│ Draft Send witness" as="draftValue" />
<AssertEquals actual={Math.sign(draftValue.row - draft.row)} expected={1} />
<ReplBench.Region name="sidekick-composer">
<ReplBench.WaitForText text="Draft Send witness" present={false} />
</ReplBench.Region>
Expand All @@ -157,8 +167,10 @@
<ReplBench.Click at={draftSend} />
<ReplBench.WaitForText text="1 ✓" />
<ReplBench.WaitForText text="✓ COMPLETED" />
<ReplBench.WaitForText text="Draft Send witness" row={draft.row+1} present={false} />
<ReplBench.WaitForText text="Draft Send witness" />
<ReplBench.WaitForText text="✎ draft" present={false} />
<ReplBench.WaitForText text="│ Draft Send witness" present={false} />
<ReplBench.WaitForText text="Output" as="sentOutput" />
<ReplBench.WaitForText text="Draft Send witness" row={sentOutput.row+1} />
<ReplBench.WaitForText text="[send]" at={sidekickSend} />
<ReplBench.WaitForText text="No messages yet." />
<ReplBench.Region name="transcript">
Expand All @@ -173,18 +185,20 @@
<ReplBench.Key key="Enter" />
<ReplBench.WaitForText text="> Round" as="beforeResize" />
<ReplBench.Type text="Draft kept through resize" />
<ReplBench.WaitForText text="Draft kept through resize" />
<ReplBench.WaitForText text="│ Draft kept through resize" />
<ReplBench.Key key="Home" />

<ReplBench.Resize columns={120} rows={30} />
<ReplBench.WaitForText text="HISTORY" row={29} />
<ReplBench.WaitForText text="> Round" as="medium" />
<AssertEquals actual={medium.row} expected={beforeResize.row} />
<ReplBench.WaitForText text="Draft kept through resize" row={medium.row+1} />
<ReplBench.WaitForText text="│ Draft kept through resize" as="mediumValue" />
<AssertEquals actual={Math.sign(mediumValue.row - medium.row)} expected={1} />

<ReplBench.Resize columns={72} rows={20} />
<ReplBench.WaitForText text="* Entries" />
<ReplBench.WaitForText text="> Round" as="narrow" />
<ReplBench.WaitForText text="Draft kept through resize" row={narrow.row+1} />
<ReplBench.WaitForText text="│ Draft kept through resize" as="narrowValue" />
<AssertEquals actual={Math.sign(narrowValue.row - narrow.row)} expected={1} />
<ReplBench.WaitForText text="✎ draft" as="narrowBar" />
<ReplBench.WaitForText text="Send" row={narrowBar.row} />
<ReplBench.WaitForText text="SIDEKICK" present={false} />
Expand All @@ -199,15 +213,20 @@
<ReplBench.Resize columns={160} rows={36} />
<ReplBench.WaitForText text="> All sessions" />
<ReplBench.WaitForText text="· draft" as="wide" />
<ReplBench.WaitForText text="Draft kept through resize" row={wide.row+1} />
<ReplBench.WaitForText text="│ Draft kept through resize" as="wideValue" />
<AssertEquals actual={Math.sign(wideValue.row - wide.row)} expected={1} />
<Repl.Focus.Draft />
<ReplBench.WaitForText text="> Round" />
<ReplBench.Type text="Caret: " />
<ReplBench.WaitForText text="│ Caret: Draft kept through resize" />
<ReplBench.Key key="Tab" />
<ReplBench.WaitForText text="> Send" />
<ReplBench.Key key="Enter" />
<ReplBench.WaitForText text="HEAD · SETTLED" />
<ReplBench.WaitForText text="✓ COMPLETED" />
<ReplBench.WaitForText text="Draft kept through resize" row={wide.row+1} present={false} />
<ReplBench.WaitForText text="Draft kept through resize" />
<ReplBench.WaitForText text="✎ draft" present={false} />
<ReplBench.WaitForText text="Output" as="sentOutput" />
<ReplBench.WaitForText text="Caret: Draft kept through" row={sentOutput.row+1} />
<ReplBench.WaitForText text="resize" row={sentOutput.row+2} />
</ReplBench>
</Test>
20 changes: 13 additions & 7 deletions examples/repl-bench/journeys/repl-focus-shortcuts.test.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,19 @@

<Repl.Focus.Draft />
<Terminal.Key key="Enter" />
<Terminal.WaitForText text="> Round" bold={true} />
<Terminal.WaitForText text="> Round 1 · draft" />
<Terminal.Type text="entry-draft" />
<Terminal.WaitForText text="entry-draft" />
<Terminal.WaitForText text="│ entry-draft" />
<Terminal.Key key="Home" />

<Terminal.Key key="Tab" />
<Terminal.WaitForText text="> Send" bold={true} />
<Terminal.WaitForText text="message the sidekick" bold={false} />
<Terminal.Key key="Shift+Tab" />
<Terminal.WaitForText text="> Round" bold={true} />
<Terminal.WaitForText text="> Round 1 · draft" />
<Terminal.WaitForText text="> BINDINGS" present={false} />
<Terminal.Type text="pre-" />
<Terminal.WaitForText text="│ pre-entry-draft" />

<Repl.Focus.Message />
<Terminal.WaitForText text="message the sidekick" bold={true} />
Expand All @@ -49,8 +52,9 @@
</Terminal.Region>
<Repl.Focus.Draft />
<Terminal.Key key="Enter" />
<Terminal.WaitForText text="> Round" bold={true} />
<Terminal.WaitForText text="> Round 1 · draft" />
<Terminal.Type text="narrow-draft" />
<Terminal.WaitForText text="│ narrow-draft" />
<Try>
<Repl.Focus.Tabs />
<Fail message="The narrow viewport does not offer the Tabs shortcut" />
Expand All @@ -61,7 +65,8 @@
<Terminal.Key key="Escape" />
<Terminal.WaitForText text="move focus · Esc closes" present={false} />
<Terminal.Type text="-kept" />
<Terminal.WaitForText text="narrow-draft-kept" />
<Terminal.WaitForText text="│ narrow-draft-kept" />
<Terminal.Key key="Home" />

<Repl.Focus.History />
<Terminal.WaitForText text="> [history]" bold={true} />
Expand All @@ -81,8 +86,9 @@
<Terminal.WaitForText text="narrow-message-kept" />
</Terminal.Region>
<Repl.Focus.Draft />
<Terminal.WaitForText text="> Round" bold={true} />
<Terminal.WaitForText text="narrow-draft-kept" />
<Terminal.WaitForText text="> Round 1 · draft" />
<Terminal.Type text="^" />
<Terminal.WaitForText text="│ ^narrow-draft-kept" />
</ReplBench>
</Terminal>
</Test>
Expand Down
11 changes: 9 additions & 2 deletions examples/repl-bench/journeys/repl-wheel-permission.test.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,21 @@
<Each in={[1,2,3,4,5,6,7,8]} let="page">
<ReplBench.Key key="PageUp" />
</Each>
<ReplBench.WaitForText text="Enter does nothing" />
<ReplBench.WaitForText text="Permission prose 01" as="prose" />
<ReplBench.WaitForText text="Permission prose 00" at={{row:prose.row-1,column:prose.column}} />
<ReplBench.Scroll delta={1} at={prose} />
<ReplBench.WaitForText text="Permission prose 01" at={prose} present={false} />
<ReplBench.WaitForText text="Permission prose 03" />
<ReplBench.WaitForText text="Permission prose 04" at={prose} />
<ReplBench.WaitForText text="Permission prose 03" at={{row:prose.row-1,column:prose.column}} />
<ReplBench.Scroll delta={1} at={prose} />
<ReplBench.WaitForText text="Permission prose 07" at={prose} />
<ReplBench.Scroll delta={-1} at={prose} />
<ReplBench.WaitForText text="Permission prose 04" at={prose} />
<ReplBench.Scroll delta={-1} at={prose} />
<ReplBench.WaitForText text="Permission prose 01" at={prose} />
<ReplBench.WaitForText text="Permission prose 00" at={{row:prose.row-1,column:prose.column}} />
<ReplBench.WaitForText text="Enter does nothing" />
<ReplBench.WaitForText text="Enter decides" present={false} />
<Each in={[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]} let="page">
<ReplBench.Key key="PageDown" />
</Each>
Expand Down
10 changes: 9 additions & 1 deletion examples/repl-bench/journeys/round-editor.test.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,17 @@
<Terminal.Screenshot name="draft-open" />
<Terminal.Key key="Tab" />
<Terminal.WaitForText text="> Send" />
<If condition={viewport.columns === 72}>
<Terminal.WaitForText text="Round 1 · draft" present={false} />
</If>
<Terminal.Key key="Enter" />
<Terminal.WaitForText text="Round 1 · draft" />
<Terminal.WaitForText text="> Send" />
<Terminal.WaitForText text="✎ draft" />
<Terminal.WaitForText text="Executable Markdown" />
<Terminal.WaitForText text="1 ✎" />
<Terminal.WaitForText text="● running" present={false} />
<Terminal.Key key="Shift+Tab" />
<Terminal.WaitForText text="> Round 1 · draft" />
<Terminal.Type text="First witness." />
<Terminal.Key key="Enter" />
<Terminal.Type text="Second witness." />
Expand Down
7 changes: 6 additions & 1 deletion examples/repl-bench/lib/screen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,12 @@ export function viewport(backend: TerminalBackend, size: Size) {
},
sidekickControl(): Point | undefined {
const header = { ...full, bottom: Math.min(size.rows, 3) };
return matches("SIDEKICK", header).next().value ?? matches("Sidekick", header).next().value;
// The identity and notice rows share the chrome surface and can name the Sidekick in prose.
const tab = (point: Point) =>
background(point.row, point.column) !== REPL_PALETTE.chromeSurface;
return (
[...matches("SIDEKICK", header)].find(tab) ?? [...matches("Sidekick", header)].find(tab)
);
},
};
}
21 changes: 21 additions & 0 deletions examples/repl-bench/tests/screen.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,24 @@ Deno.test("reads the complete focus legend without treating document text as sho
backend.destroy();
}
});

Deno.test("finds the Sidekick tab below a notice that names the Sidekick", () => {
const backend = createXtermBackend({ cols: size.columns, rows: size.rows });
try {
const identity = paint(REPL_PALETTE.chromeSurface, " XMD REPL".padEnd(size.columns));
const notice = paint(
REPL_PALETTE.chromeSurface,
"! the Sidekick was stopped. Nothing it had already done was undone".padEnd(size.columns),
);
backend.feed(encoder.encode(`${identity}\r\n${notice}\r\n`));
assert.equal(viewport(backend, size).sidekickControl(), undefined);

const surfaces =
paint(REPL_PALETTE.paneHeaderSurface, " Sessions Entries ") +
paint(REPL_PALETTE.selectedSurface, " * Sidekick");
backend.feed(encoder.encode(surfaces));
assert.deepEqual(viewport(backend, size).sidekickControl(), { row: 2, column: 32 });
} finally {
backend.destroy();
}
});
16 changes: 16 additions & 0 deletions scripts/tests/ci-workflow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,22 @@ describe("the dedicated ReplBench job", () => {
expect(terminal?.run).toContain(file);
}
});

it("uploads the failed journeys' journals beside their bench evidence", function* () {
const bench = (yield* workflow())["repl-bench"];
const upload = bench?.steps.find((step) => step.uses?.startsWith("actions/upload-artifact@"));

expect(upload?.if).toBe("github.event_name == 'push' && (failure() || cancelled())");
expect(upload?.with?.["include-hidden-files"]).toBe("true");
expect(upload?.with?.path?.trim().split("\n")).toEqual([
"repl bench checkout/.bench/*/run.json",
"repl bench checkout/.bench/*/screen.txt",
"repl bench checkout/.bench/*/*.svg",
"repl bench checkout/.bench/*/terminal.ansi",
"repl bench checkout/.bench/*/closed.json",
"repl bench checkout/.xmd/test-artifacts",
]);
});
});

describe("the CI workflow aggregate", () => {
Expand Down
Loading