mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 19:17:10 +00:00
feat(replay-ui): add data-testid hooks the dogfood spec drives
This commit is contained in:
1 parent
f1974e9f88
commit
c5b221fe3b
5 files changed
+30
-3
No files matched your search
@@ -65,6 +65,7 @@ export default function Tabs({ tabs, defaultTabId, ariaLabel }: TabsProps) {
|
|||||||
<div className="tabs">
|
<div className="tabs">
|
||||||
<div
|
<div
|
||||||
className="tabs-header"
|
className="tabs-header"
|
||||||
|
data-testid="tab-strip"
|
||||||
role="tablist"
|
role="tablist"
|
||||||
aria-label={ariaLabel}
|
aria-label={ariaLabel}
|
||||||
onKeyDown={handleKeyDown}
|
onKeyDown={handleKeyDown}
|
||||||
@@ -82,6 +83,8 @@ export default function Tabs({ tabs, defaultTabId, ariaLabel }: TabsProps) {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
type="button"
|
type="button"
|
||||||
|
data-testid="tab"
|
||||||
|
data-tab-id={tab.id}
|
||||||
role="tab"
|
role="tab"
|
||||||
id={`${panelId}-tab-${tab.id}`}
|
id={`${panelId}-tab-${tab.id}`}
|
||||||
className="tabs-tab"
|
className="tabs-tab"
|
||||||
|
|||||||
@@ -170,6 +170,8 @@ export default function ActionList({
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
className="action-list-item"
|
className="action-list-item"
|
||||||
|
data-testid="step-row"
|
||||||
|
data-step={step.index}
|
||||||
role="option"
|
role="option"
|
||||||
tabIndex={isActive ? 0 : -1}
|
tabIndex={isActive ? 0 : -1}
|
||||||
aria-selected={isActive}
|
aria-selected={isActive}
|
||||||
|
|||||||
@@ -9,6 +9,12 @@ export interface ScreenshotProps {
|
|||||||
deviceHeight?: number;
|
deviceHeight?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// stepOfSource reads the step out of the screenshot URL the panel is rendering,
|
||||||
|
// so a spec can compare what this panel shows against what the toolbar claims.
|
||||||
|
function stepOfSource(src: string): string | undefined {
|
||||||
|
return /step-0*(\d+)\.png/.exec(src)?.[1];
|
||||||
|
}
|
||||||
|
|
||||||
const DEFAULT_WIDTH = 1080;
|
const DEFAULT_WIDTH = 1080;
|
||||||
const DEFAULT_HEIGHT = 1920;
|
const DEFAULT_HEIGHT = 1920;
|
||||||
|
|
||||||
@@ -58,6 +64,8 @@ export default function Screenshot({ src, action, deviceWidth, deviceHeight }: S
|
|||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
className="screenshot-image"
|
className="screenshot-image"
|
||||||
|
data-testid="screenshot"
|
||||||
|
data-step={stepOfSource(src)}
|
||||||
src={src}
|
src={src}
|
||||||
alt="device screenshot"
|
alt="device screenshot"
|
||||||
onLoad={(event) => {
|
onLoad={(event) => {
|
||||||
|
|||||||
@@ -130,13 +130,18 @@ export default function ViolationsPanel({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="violations-panel">
|
<section
|
||||||
|
className="violations-panel"
|
||||||
|
data-testid="violations-panel"
|
||||||
|
data-violation-count={rows.filter((row) => row.status === "violated").length}
|
||||||
|
>
|
||||||
{violationsOnly ? null : (
|
{violationsOnly ? null : (
|
||||||
<header className="violations-panel-header">
|
<header className="violations-panel-header">
|
||||||
<h2 className="violations-panel-title">properties</h2>
|
<h2 className="violations-panel-title">properties</h2>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="violations-panel-jump"
|
className="violations-panel-jump"
|
||||||
|
data-testid="jump-to-first-violation"
|
||||||
onClick={onJumpToFirstViolation}
|
onClick={onJumpToFirstViolation}
|
||||||
disabled={!hasFirstViolation}
|
disabled={!hasFirstViolation}
|
||||||
>
|
>
|
||||||
@@ -149,7 +154,12 @@ export default function ViolationsPanel({
|
|||||||
const residual = residuals?.[name];
|
const residual = residuals?.[name];
|
||||||
const witness = status === "violated" ? witnesses?.[name] : undefined;
|
const witness = status === "violated" ? witnesses?.[name] : undefined;
|
||||||
return (
|
return (
|
||||||
<li key={name} className="violations-panel-row" data-status={status}>
|
<li
|
||||||
|
key={name}
|
||||||
|
className="violations-panel-row"
|
||||||
|
data-testid="property-row"
|
||||||
|
data-status={status}
|
||||||
|
>
|
||||||
<div className="violations-panel-row-head">
|
<div className="violations-panel-row-head">
|
||||||
<span
|
<span
|
||||||
className="violations-panel-badge"
|
className="violations-panel-badge"
|
||||||
|
|||||||
@@ -267,7 +267,11 @@ export default function RunDetail() {
|
|||||||
<span>
|
<span>
|
||||||
<strong title={run.spec_path}>{basename(run.spec_path)}</strong> seed={run.seed}
|
<strong title={run.spec_path}>{basename(run.spec_path)}</strong> seed={run.seed}
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span
|
||||||
|
data-testid="step-indicator"
|
||||||
|
data-step={stepIndex}
|
||||||
|
data-step-count={stepCount ?? 0}
|
||||||
|
>
|
||||||
step {stepIndex} / {stepCount ?? 0}
|
step {stepIndex} / {stepCount ?? 0}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in new issue
Block a user