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
2 changes: 1 addition & 1 deletion e2e/home.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ test("home page and health endpoint are reachable", async ({ page, request }) =>

await expect(page.getByRole("heading", { level: 1, name: "TraceMap" })).toBeVisible();
await expect(page.getByRole("button", { name: "Start Investigation" })).toBeVisible();
await expect(page.getByTestId("manual-source-urls-input")).toBeVisible();
await expect(page.getByTestId("manual-source-url-input")).toBeVisible();
});
4 changes: 3 additions & 1 deletion specs/manual-source-url-intake.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ Allow users to submit optional source URLs from the landing page so Investigatio
- Label: `Optional source URLs`.
- Help text: `Add one URL per line. TraceMap will prioritize these sources when building the evidence map.`
- Name: `sourceUrls`.
- `data-testid="manual-source-urls-input"`.
- `data-testid="manual-source-url-input"` for textarea input.
- `data-testid="manual-source-url-help"` for help text.
- `data-testid="manual-source-url-error"` for invalid URL validation message.
- Optional input, empty means existing behavior.
- Validation error can be shown near existing form error region.

Expand Down
22 changes: 19 additions & 3 deletions src/features/landing/components/question-intake.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
createMockRunAction,
type CreateRunFormState,
} from "@/app/actions/create-run";
import { MANUAL_SOURCE_URLS_ERROR_MESSAGE } from "@/app/actions/manual-source-urls";
import { Panel } from "@/components/ui/panel";

const initialState: CreateRunFormState = {};
Expand Down Expand Up @@ -60,7 +61,11 @@ export function QuestionIntake({ disabled = false }: { disabled?: boolean }) {
<label className="question-label" htmlFor="sourceUrls" style={{ marginTop: "1rem" }}>
Optional source URLs
</label>
<p className="muted" style={{ marginTop: "0.25rem", marginBottom: "0.5rem" }}>
<p
className="muted"
data-testid="manual-source-url-help"
style={{ marginTop: "0.25rem", marginBottom: "0.5rem" }}
>
Add one URL per line. TraceMap will prioritize these sources when building the evidence map.
</p>
<textarea
Expand All @@ -71,7 +76,7 @@ https://example.com/press-release
https://example.com/technical-doc`}
rows={4}
disabled={isPending || disabled}
data-testid="manual-source-urls-input"
data-testid="manual-source-url-input"
/>
<label className="question-label" htmlFor="mode" style={{ marginTop: "1rem" }}>
Investigation depth
Expand All @@ -96,7 +101,18 @@ https://example.com/technical-doc`}
Deep — broader investigation with more claims and counterpoints
</option>
</select>
{state.error ? <p className="form-error">{state.error}</p> : null}
{state.error ? (
<p
className="form-error"
data-testid={
state.error === MANUAL_SOURCE_URLS_ERROR_MESSAGE
? "manual-source-url-error"
: undefined
}
>
{state.error}
</p>
) : null}
{disabled ? <p className="form-error">Please sign in to start an investigation. <Link href="/login">Sign in</Link></p> : null}
<div className="question-actions">
<button type="submit" disabled={isPending || disabled}>
Expand Down
Loading