Runnable Robot Framework cells
<RunnableRobot> runs a real .robot suite in the browser via Pyodide
- the bundled RF wheel. Same infrastructure as
<RunnablePython>, with CodeMirror's RF grammar + libdoc autocomplete + the rebot artifact pipeline pre-wired.
import RunnableRobot from '@/components/rf/RunnableRobot.tsx';
<RunnableRobot
client:visible
fileName="first_test.robot"
caption="Edit the suite then hit Run — log.html is produced just like the CLI."
initialCode={`*** Settings ***
Documentation My very first Robot Framework test
*** Test Cases ***
Say Hello
Log Hello, Robot Framework!
Should Be Equal \${1 + 1} \${2}
`}
/>
What the learner sees:
- A CodeMirror editor with RF syntax highlighting + autocomplete (~298 keywords across BuiltIn, Collections, String, DateTime, OperatingSystem, Process, XML).
- Run suite / Reset buttons in a toolbar below the editor.
- After running:
- Console output (stdout + stderr).
- A stats pill: passed / failed / skipped.
- Show / Download log.html — the detailed trace.
- Show / Download report.html — the high-level summary.
- Download output.xml — rebot-input XML for external tooling.
For the deep technical reference (architecture, setup, vendoring), see
<RunnableRobot> deep-dive.
Props
| Prop | Type | Required | Default | Notes |
|---|---|---|---|---|
initialCode | string | yes | — | The .robot source the learner sees |
fileName | string | no | "suite.robot" | Filename inside the virtual FS — also used as the artifact filename stem |
caption | string | no | — | Optional description rendered above the editor |
runLabel | string | no | "Run suite" | Override the run button label |
Source: apps/docs/src/components/rf/RunnableRobot.tsx.
A complete example
The lesson 1.4 from rf-training shows a real edit-and-run flow. Drop this into any lesson:
<RunnableRobot
client:visible
fileName="warehouse_smoke.robot"
caption="Two tests in one file. After Run, open log.html to see [Documentation] and [Tags] rendered."
initialCode={`*** Test Cases ***
Warehouse Arrival Is Logged
[Documentation] Smoke test confirming arrival is recorded.
[Tags] warehouse smoke
Log Shift started at Munich DC
Container Weight Is Within Limit
[Documentation] Verifies that containers do not exceed the vessel limit.
[Tags] warehouse weights
VAR \${weight: int} 8200
Should Be True \${weight} < 25000
`}
/>
After the learner clicks Run suite:
- Pyodide boots (first run only, ~10–15 s).
- The RF wheel installs into the in-worker filesystem (cached after first run).
- The
.robotfile is written to/lernkit_rf_work/. robot.run_cli([...])executes the suite.log.html,report.html,output.xmlcome back as blob URLs.
Escaping ${variable} in MDX
RF uses ${} and \${} for variable references. MDX treats {...} as a
JSX expression. Two safe patterns:
Pattern 1 — backtick template with escaped $
<RunnableRobot
initialCode={`*** Test Cases ***
Greet
Log \${weight: int}
`}
/>
The escape is the backslash before $. JavaScript template literals
treat \$ as a literal $, so RF's ${weight} survives.
Pattern 2 — string concatenation
For complex code, store it in a constant and pass it in:
import RunnableRobot from '@/components/rf/RunnableRobot.tsx';
export const ROBOT_CODE = `*** Test Cases ***
Greet
Log \${weight: int}
`;
<RunnableRobot client:visible initialCode={ROBOT_CODE} />
Use whichever is easier to read.
Editor features
The CodeMirror editor includes:
- Syntax highlighting for RF (StreamLanguage-based grammar; covers section headers, comments, settings, variables, control-flow keywords, keyword settings, numbers, strings).
- Autocomplete — Ctrl-Space (or Cmd-Space) opens the popup with ~298 keywords from the vendored libdocs, filtered by the prefix you typed. Each entry shows args + short doc.
- Bracket matching for
{,[,(. - Active-line highlighting.
- Tab → 4 spaces (preserves the 2-space-separator rule by NOT collapsing whitespace).
- Undo / redo via standard keybindings.
What works in the in-browser runner
✅ Pure-Python libraries. BuiltIn, Collections, String, DateTime, OperatingSystem, Process, XML — all work.
✅ Standard RF features. Test cases, keywords, settings, variables (typed + untyped), control structures, evaluations.
✅ Artifacts. log.html, report.html, output.xml all generated identically to a CLI run.
✅ Multiple test cases per suite.
❌ Native libraries. SeleniumLibrary and Browser (Playwright) need
real OS-level browsers. They don't work in Pyodide; lessons that need
them use the server-side rf-mcp runner per
ADR 0009.