[app] Rose: Wire identity and the care log into the garden; e2e and offline tend the rose

This commit is contained in:
2026-11-02 00:20:59 +01:00
parent 6a3ca84aaa
commit 21f4496910
6 changed files with 138 additions and 8 deletions
+30
View File
@@ -34,3 +34,33 @@ export async function storedTown(page: Page, name: string): Promise<void> {
{ timeout: 5_000 }
);
}
/** Waits until the care log holds at least `count` events, for the same reason as above. */
export async function storedCare(page: Page, count: number): Promise<void> {
await page.waitForFunction(
(expected) =>
new Promise<boolean>((resolve) => {
const req = indexedDB.open('rosea');
req.onerror = () => resolve(false);
req.onsuccess = () => {
const db = req.result;
if (!db.objectStoreNames.contains('events')) {
db.close();
resolve(false);
return;
}
const n = db.transaction('events').objectStore('events').count();
n.onsuccess = () => {
db.close();
resolve(n.result >= expected);
};
n.onerror = () => {
db.close();
resolve(false);
};
};
}),
count,
{ timeout: 5_000 }
);
}