Skip to content

Commit 0a14196

Browse files
committed
Rename project history doc and add real extension smoke test
1 parent 0b49afb commit 0a14196

4 files changed

Lines changed: 76 additions & 2 deletions

File tree

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Chrome extension MVP that tracks tab-level activity and shows what you worked on over the last 1 hour, 4 hours, 1 day, and 7 days.
44

55
For complete project history, architecture decisions, execution timeline, built/not-built scope, and current status, see:
6-
- `README.markdown`
6+
- `project-history.md`
77

88
## MVP Features
99

@@ -41,6 +41,8 @@ For complete project history, architecture decisions, execution timeline, built/
4141

4242
- Run unit and E2E suites together:
4343
- `npm run test:all`
44+
- Run unpacked-extension smoke test in Chromium:
45+
- `npm run test:smoke:extension`
4446

4547
Includes:
4648
- Unit tests for session engine transitions and IndexedDB retention/query boundaries.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"test:e2e": "playwright test",
99
"test:e2e:headed": "playwright test --headed",
1010
"test:e2e:ui": "playwright test --ui",
11+
"test:smoke:extension": "node scripts/extension-smoke-test.mjs",
1112
"test:all": "npm run test:unit && npm run test:e2e"
1213
},
1314
"keywords": [],

README.markdown renamed to project-history.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ Primary commits:
234234
### Documentation and Planning
235235

236236
- `README.md` (quick start)
237-
- `README.markdown` (this full build document)
237+
- `project-history.md` (this full build document)
238238
- `docs/APPROACH_AND_PLAN.md`
239239
- `docs/plans/2026-02-26-chrome-activity-reader-design.md`
240240
- `docs/plans/2026-02-26-chrome-activity-reader-implementation-plan.md`

scripts/extension-smoke-test.mjs

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import fs from "node:fs";
2+
import os from "node:os";
3+
import path from "node:path";
4+
5+
import { chromium } from "playwright";
6+
7+
async function run() {
8+
const extensionPath = process.cwd();
9+
const userDataDir = fs.mkdtempSync(path.join(os.tmpdir(), "car-ext-"));
10+
11+
const context = await chromium.launchPersistentContext(userDataDir, {
12+
channel: "chromium",
13+
headless: true,
14+
args: [
15+
`--disable-extensions-except=${extensionPath}`,
16+
`--load-extension=${extensionPath}`
17+
]
18+
});
19+
20+
try {
21+
let serviceWorker = context.serviceWorkers()[0];
22+
if (!serviceWorker) {
23+
serviceWorker = await context.waitForEvent("serviceworker", { timeout: 15_000 });
24+
}
25+
26+
const extensionId = new URL(serviceWorker.url()).host;
27+
const dashboardUrl = `chrome-extension://${extensionId}/ui/dashboard.html`;
28+
const settingsUrl = `chrome-extension://${extensionId}/ui/settings.html`;
29+
30+
const dashboardPage = await context.newPage();
31+
await dashboardPage.goto(dashboardUrl, { waitUntil: "domcontentloaded" });
32+
33+
const heading = await dashboardPage.textContent("h1");
34+
const timelineCount = await dashboardPage.locator("#timeline").count();
35+
const status = await dashboardPage.evaluate(async () =>
36+
chrome.runtime.sendMessage({ type: "get-runtime-status" })
37+
);
38+
39+
const settingsPage = await context.newPage();
40+
await settingsPage.goto(settingsUrl, { waitUntil: "domcontentloaded" });
41+
const settingsHeading = await settingsPage.textContent("h1");
42+
43+
const result = {
44+
extensionId,
45+
dashboardHeading: heading,
46+
timelinePresent: timelineCount > 0,
47+
runtimeStatusOk: status?.ok === true,
48+
retentionDays: status?.retentionDays,
49+
paused: status?.paused,
50+
settingsHeading
51+
};
52+
53+
console.log(JSON.stringify(result, null, 2));
54+
55+
if (
56+
result.dashboardHeading !== "Chrome Activity Reader" ||
57+
!result.timelinePresent ||
58+
result.runtimeStatusOk !== true ||
59+
result.settingsHeading !== "Settings"
60+
) {
61+
process.exitCode = 1;
62+
}
63+
} finally {
64+
await context.close();
65+
}
66+
}
67+
68+
run().catch((error) => {
69+
console.error("Extension smoke test failed:", error);
70+
process.exitCode = 1;
71+
});

0 commit comments

Comments
 (0)