创建笔记
用户可以用创建笔记功能在浏览器或 CLI 里保存一条带标题的笔记,放弃还没写完的草稿,并在第二个面向用户的界面里确认笔记已经存下。
Sub-features
Section titled “Sub-features”create-open从浏览器的每个入口打开空白编辑器。create-save保存标题和正文。create-cancel丢弃浏览器里没写完的草稿。create-cli在终端里创建同样结构的笔记。
How to get to it (user POV)
Section titled “How to get to it (user POV)”- 在浏览器工具栏里点
New note按钮。 - 焦点不在可编辑区域时,在浏览器里按
n。 - 在终端里运行
notes create --title <title> --body <body>。
Driving it with control-notes
Section titled “Driving it with control-notes”Preconditions:
-
Notes 在
http://127.0.0.1:4173运行正常。 -
没有标题为
Release checklist的笔记。 -
control-notes doctor报告的 URL 和用完即弃的数据目录都符合预期。 -
打开编辑器。 点
New note。运行control-notes browser click --role button --name "New note"。出现名为Note editor的表单,焦点在Title输入框里。 -
填写内容。 输入标题和正文。运行
control-notes browser fill --role textbox --name "Title" --value "Release checklist"和control-notes browser fill --role textbox --name "Body" --value "Tag and publish"。Save note按钮变为可点。 -
保存笔记。 点
Save note。运行control-notes browser click --role button --name "Save note"。出现名为Note saved的状态提示,标题显示为Release checklist。 -
确认已保存。 回到笔记列表,再打开这条笔记。运行
control-notes browser click --role link --name "All notes"和control-notes browser click --role link --name "Release checklist"。编辑器里两个值都在。 -
放弃草稿。 新建一条笔记,输入
Discard me,点Cancel。运行control-notes browser click --role button --name "New note"、control-notes browser fill --role textbox --name "Title" --value "Discard me"和control-notes browser click --role button --name "Cancel"。回到笔记列表,列表里没有Discard me链接。 -
CLI 入口。 再建第二条笔记。运行
control-notes cli -- notes create --title "CLI note" --body "Created from terminal" --format json。退出码为0,stdout 里有新笔记的 ID 和标题。 -
证明。 从
All notes重新打开两条已保存的笔记。运行control-notes browser snapshot --aria --path artifacts/create-note/list.aria.txt和control-notes browser screenshot --path artifacts/create-note/list.png。证明材料里能看到Release checklist和CLI note。
Gotchas
Section titled “Gotchas”- 输入框有焦点时按
n,会打出这个字母,而不是打开新编辑器。 - 保存时标题首尾的空白会被去掉。断言渲染出来的标题,不要断言草稿里输入的值。
- 光有保存成功的提示不足以证明。要从列表重新打开这条笔记。
- 清理测试数据时删掉
Release checklist和CLI note,但保留它们的证明材料。
