create-next-imagicma 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/template-hono/README.md
CHANGED
|
@@ -57,3 +57,23 @@ pnpm db:push
|
|
|
57
57
|
|
|
58
58
|
- API:`GET /api/greeting`
|
|
59
59
|
- 页面:`/hello`
|
|
60
|
+
|
|
61
|
+
## E2E 与 `run_test`
|
|
62
|
+
|
|
63
|
+
- Playwright 配置位于 [`playwright.config.ts`](/Users/alexliu/Project/imagicma-all/imagicma-template/hono-app/playwright.config.ts)
|
|
64
|
+
- 测试契约位于 [`hono-app/.imagicma/testing-manifest.json`](/Users/alexliu/Project/imagicma-all/imagicma-template/hono-app/.imagicma/testing-manifest.json)
|
|
65
|
+
- 本地回归命令:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pnpm test:e2e
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
- `run_test` 驱动 Playwright 时会注入:
|
|
72
|
+
- `IMAGICMA_RUN_ID`
|
|
73
|
+
- `IMAGICMA_RUN_TEST_RUNTIME_ROOT`
|
|
74
|
+
- `IMAGICMA_RUN_TEST_SKIP_WEBSERVER`
|
|
75
|
+
- `BASE_URL`
|
|
76
|
+
|
|
77
|
+
fixtures 约定:
|
|
78
|
+
- `tests/e2e/fixtures/imagicma.ts` 必须把浏览器 warning/error、page errors、失败网络请求与 current URL 写入 `IMAGICMA_RUN_TEST_RUNTIME_ROOT`
|
|
79
|
+
- `testing-manifest.json` 负责声明稳定页面、selectors、fixtures 与 auth profile,供 `run_test` 编译阶段使用
|
|
@@ -1,74 +1,6 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
|
|
3
1
|
export default function Home() {
|
|
4
|
-
const [query, setQuery] = useState("");
|
|
5
|
-
const [includeExamples, setIncludeExamples] = useState(true);
|
|
6
|
-
const [submitted, setSubmitted] = useState("");
|
|
7
|
-
|
|
8
2
|
return (
|
|
9
|
-
<
|
|
10
|
-
data-testid="page.home"
|
|
11
|
-
className="mx-auto flex min-h-screen max-w-3xl flex-col justify-center gap-6 px-6 py-12"
|
|
12
|
-
>
|
|
13
|
-
<div className="space-y-2">
|
|
14
|
-
<span
|
|
15
|
-
data-testid="badge.template-ready"
|
|
16
|
-
className="inline-flex rounded-full bg-slate-900 px-3 py-1 text-xs font-medium text-white"
|
|
17
|
-
>
|
|
18
|
-
imagicma hono template
|
|
19
|
-
</span>
|
|
20
|
-
<h1 className="text-4xl font-semibold tracking-tight text-slate-950">
|
|
21
|
-
Start building with a testable baseline
|
|
22
|
-
</h1>
|
|
23
|
-
<p className="max-w-2xl text-sm text-slate-600">
|
|
24
|
-
This page is intentionally simple and visible so generated projects start with a stable smoke-test target.
|
|
25
|
-
</p>
|
|
26
|
-
</div>
|
|
27
|
-
|
|
28
|
-
<form
|
|
29
|
-
data-testid="form.quick-start"
|
|
30
|
-
className="rounded-2xl border border-slate-200 bg-white p-6 shadow-sm"
|
|
31
|
-
onSubmit={(event) => {
|
|
32
|
-
event.preventDefault();
|
|
33
|
-
setSubmitted(`${query || "Untitled"}|examples:${includeExamples ? "on" : "off"}`);
|
|
34
|
-
}}
|
|
35
|
-
>
|
|
36
|
-
<div className="space-y-4">
|
|
37
|
-
<label className="flex flex-col gap-2 text-sm font-medium text-slate-700">
|
|
38
|
-
Project brief
|
|
39
|
-
<input
|
|
40
|
-
data-testid="input.project-brief"
|
|
41
|
-
className="rounded-lg border border-slate-300 px-3 py-2 text-sm"
|
|
42
|
-
placeholder="Describe the app you want to build"
|
|
43
|
-
value={query}
|
|
44
|
-
onChange={(event) => setQuery(event.target.value)}
|
|
45
|
-
/>
|
|
46
|
-
</label>
|
|
47
|
-
|
|
48
|
-
<label className="flex items-center gap-2 text-sm text-slate-700">
|
|
49
|
-
<input
|
|
50
|
-
data-testid="checkbox.include-examples"
|
|
51
|
-
type="checkbox"
|
|
52
|
-
checked={includeExamples}
|
|
53
|
-
onChange={(event) => setIncludeExamples(event.target.checked)}
|
|
54
|
-
/>
|
|
55
|
-
Include example content
|
|
56
|
-
</label>
|
|
57
|
-
|
|
58
|
-
<button
|
|
59
|
-
data-testid="button.submit-brief"
|
|
60
|
-
type="submit"
|
|
61
|
-
className="rounded-lg bg-slate-950 px-4 py-2 text-sm font-medium text-white"
|
|
62
|
-
>
|
|
63
|
-
Save brief
|
|
64
|
-
</button>
|
|
65
|
-
</div>
|
|
66
|
-
</form>
|
|
67
|
-
|
|
68
|
-
<section data-testid="panel.submission" className="rounded-2xl border border-dashed border-slate-300 p-4 text-sm text-slate-600">
|
|
69
|
-
<div className="font-medium text-slate-900">Latest submission</div>
|
|
70
|
-
<div>{submitted || "No brief submitted yet."}</div>
|
|
71
|
-
</section>
|
|
72
|
-
</main>
|
|
3
|
+
<div style={{ display: "none" }}>请优先修改本页</div>
|
|
73
4
|
);
|
|
74
5
|
}
|
|
6
|
+
|