Skip to content

Commit 5bc16e8

Browse files
committed
port browser CI, offline shell, and neuron translation fixes from drowse#62
stdlogits/drowse#62 was opened against the pre-split layout; this applies its site changes here, with shared-module paths pointed at the submodule. Its shared header change lands in drowse (split/website), which the pin follows. Also track drowse's main branch for Dependabot submodule bumps, which otherwise follow the latest release tag.
1 parent 82f5548 commit 5bc16e8

40 files changed

Lines changed: 482 additions & 225 deletions

‎.gitmodules‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[submodule "drowse"]
22
path = drowse
33
url = https://github.com/stdlogits/drowse.git
4+
branch = main

‎webui/e2e/button-gradients.spec.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,12 @@ async function expectGradients(page: Page) {
1111

1212
test("filled actions have visible but restrained top-down shading", async ({ page }, testInfo) => {
1313
await page.emulateMedia({ reducedMotion: "reduce" });
14+
await page.addLocatorHandler(page.locator(".pwa-notice.passive"), async notice => {
15+
await notice.getByRole("button", { name: "Dismiss", exact: true }).click();
16+
});
1417
await page.goto("/credits");
15-
const action = page.getByRole("link", { name: "Contribute on GitHub" });
18+
const action = page.getByRole("link", { name: "Ways to contribute", exact: true });
19+
await expect(action).toHaveAttribute("href", "/contribute");
1620
for (const theme of ["light", "dark"]) {
1721
await setAppearance(page, theme);
1822
for (const width of [1440, 390]) {

‎webui/e2e/chunk-recovery.ios-layout.spec.ts‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,10 @@ test("the recovery button repairs a repeat-on-reload failure without removing sa
121121
await breakCachedShell(page, true);
122122
await page.evaluate(async () => {
123123
localStorage.setItem("drowse.saved-data-test", "keep chats");
124-
for (const name of ["webllm/model", "webllm/wasm", "unrelated-cache", "drowse-hosted-on-demand-wasm-v1"]) {
124+
for (const name of ["webllm/model", "webllm/wasm", "unrelated-cache"]) {
125125
await (await caches.open(name)).put("/keep-model", new Response("keep model"));
126126
}
127+
await (await caches.open("drowse-hosted-on-demand-wasm-v1")).put("/stale-app-code.wasm", new Response("stale app code"));
127128
await new Promise<void>((resolve, reject) => {
128129
const request = indexedDB.open("drowse-saved-conversations", 1);
129130
request.onupgradeneeded = () => request.result.createObjectStore("conversations");
@@ -137,21 +138,25 @@ test("the recovery button repairs a repeat-on-reload failure without removing sa
137138
};
138139
});
139140
});
140-
const cachedModels = () => page.evaluate(async () => Promise.all(["webllm/model", "webllm/wasm", "unrelated-cache", "drowse-hosted-on-demand-wasm-v1"].map(async name =>
141+
const cachedModels = () => page.evaluate(async () => Promise.all(["webllm/model", "webllm/wasm", "unrelated-cache"].map(async name =>
141142
(await (await caches.open(name)).match("/keep-model"))?.text())));
142-
expect(await cachedModels()).toEqual(Array(4).fill("keep model"));
143+
expect(await cachedModels()).toEqual(Array(3).fill("keep model"));
143144
await page.reload();
144145
await expect(page.getByRole("heading", { name: "Drowse could not open" })).toBeVisible();
145-
expect(await cachedModels()).toEqual(Array(4).fill("keep model"));
146+
expect(await cachedModels()).toEqual(Array(3).fill("keep model"));
146147
await page.reload();
147148
await expect(page.getByRole("heading", { name: "Drowse could not open" })).toBeVisible();
148-
expect(await cachedModels()).toEqual(Array(4).fill("keep model"));
149+
expect(await cachedModels()).toEqual(Array(3).fill("keep model"));
150+
expect(await page.evaluate(async () => (await (await caches.open("drowse-hosted-on-demand-wasm-v1")).match("/stale-app-code.wasm"))?.text())).toBe("stale app code");
149151
await page.getByRole("button", { name: "Reload Drowse", exact: true }).click();
150152
await expect(page.locator("#hero-title")).toBeVisible();
151-
expect(await page.evaluate(() => JSON.parse(localStorage.getItem("deleted-test-caches") ?? "[]"))).toEqual([expect.stringMatching(/^drowse-hosted-precache-v2-/)]);
153+
expect(await page.evaluate(() => JSON.parse(localStorage.getItem("deleted-test-caches") ?? "[]"))).toEqual([
154+
expect.stringMatching(/^drowse-hosted-precache-v2-/), "drowse-hosted-on-demand-wasm-v1",
155+
]);
156+
expect(await page.evaluate(async () => (await caches.open("drowse-hosted-on-demand-wasm-v1")).match("/stale-app-code.wasm").then(Boolean))).toBe(false);
152157
expect(await page.evaluate(async () => ({
153158
local: localStorage.getItem("drowse.saved-data-test"),
154-
cached: await Promise.all(["webllm/model", "webllm/wasm", "unrelated-cache", "drowse-hosted-on-demand-wasm-v1"].map(async name =>
159+
cached: await Promise.all(["webllm/model", "webllm/wasm", "unrelated-cache"].map(async name =>
155160
(await (await caches.open(name)).match("/keep-model"))?.text())),
156161
chat: await new Promise(resolve => {
157162
const request = indexedDB.open("drowse-saved-conversations", 1);
@@ -161,7 +166,7 @@ test("the recovery button repairs a repeat-on-reload failure without removing sa
161166
read.onsuccess = () => { db.close(); resolve(read.result); };
162167
};
163168
}),
164-
}))).toEqual({ local: "keep chats", cached: Array(4).fill("keep model"), chat: "keep conversation" });
169+
}))).toEqual({ local: "keep chats", cached: Array(3).fill("keep model"), chat: "keep conversation" });
165170
});
166171

167172
test("offline recovery keeps the cached app and gives an actionable retry", async ({ context, page }) => {

‎webui/e2e/contact.spec.ts‎

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ test("contact email is available in public footers, feedback, help, and the work
2525
const address = "[email protected]";
2626
for (const path of ["/", "/contact", "/credits"]) {
2727
await page.goto(`${dev}${path}`);
28-
await expect(page.getByRole("navigation", { name: "Footer", exact: true }).getByRole("link", { name: address, exact: true })).toHaveAttribute("href", `mailto:${address}`);
28+
await expect(page.getByRole("navigation", { name: "Footer", exact: true }).getByRole("link", { name: "Email us", exact: true })).toHaveAttribute("href", `mailto:${address}`);
2929
expect(await page.evaluate(() => document.documentElement.scrollWidth - innerWidth)).toBeLessThanOrEqual(1);
3030
}
3131
await openFeedback(page);
@@ -83,7 +83,7 @@ test("offline and failed sends retain text and retry the same reference before s
8383
expect(requests).toHaveLength(0);
8484
await context.setOffline(false);
8585
await page.getByRole("button", { name: "Send message", exact: true }).click();
86-
await expect(page.getByRole("alert")).toContainText("couldn't confirm");
86+
await expect(page.getByRole("alert")).toContainText("contact service isn't responding");
8787
await expect(page.getByRole("textbox", { name: "Message", exact: true })).toHaveValue("Synthetic test content. No real email is sent.");
8888
await page.getByRole("button", { name: "Check delivery", exact: true }).click();
8989
await expect(page.getByRole("heading", { name: "Message sent" })).toBeVisible();
@@ -135,7 +135,7 @@ test("unconfirmed, rate-limited, and invalid success responses never lose the dr
135135
];
136136
await route.fulfill({ ...responses[references.length - 1], headers: { "Access-Control-Allow-Origin": dev } });
137137
});
138-
for (const message of ["couldn't confirm", "haven't confirmed", "Too many attempts", "couldn't confirm"]) {
138+
for (const message of ["couldn't send this", "haven't confirmed", "Too many attempts", "couldn't send this"]) {
139139
await page.getByRole("button", { name: /^(Send message|Check delivery)$/ }).click();
140140
await expect(page.getByRole("alert")).toContainText(message);
141141
await expect(page.getByRole("heading", { name: "Message sent" })).not.toBeVisible();
@@ -196,8 +196,10 @@ test("topics follow the reason, preserve shared choices, and submit the matching
196196
await page.emulateMedia({ reducedMotion: "reduce" });
197197
await page.goto(`${dev}/contact`);
198198
await fillMessage(page);
199-
const reason = page.getByRole("button", { name: "Reason", exact: true });
200-
const topic = page.getByRole("button", { name: "Topic", exact: true });
199+
const reason = page.getByRole("button", { name: /^Reason / });
200+
const topic = page.getByRole("button", { name: /^Topic / });
201+
await expect(reason).toHaveAccessibleName("Reason General feedback");
202+
await expect(topic).toHaveAccessibleName("Topic Drowse in general");
201203
async function chooseReason(label: string) {
202204
await reason.click();
203205
await page.getByRole("option", { name: label, exact: true }).click();
@@ -223,10 +225,15 @@ test("topics follow the reason, preserve shared choices, and submit the matching
223225
expect(await topicLabels()).toEqual(["Interview request", "Coverage and fact checking", "Images and press materials", "Something else"]);
224226
await chooseReason("Research and collaboration");
225227
await expect(topic).toContainText("Research collaboration");
226-
expect(await topicLabels()).toEqual(["Research collaboration", "Using Drowse in a study", "Methods and validation", "Sharing results", "Funding & Sponsorship", "Something else"]);
228+
expect(await topicLabels()).toEqual(["Research collaboration", "Using Drowse in a study", "Methods and validation", "Sharing results", "Grants and research funding", "Something else"]);
227229
await topic.click();
228-
await page.getByRole("option", { name: "Funding & Sponsorship", exact: true }).click();
229-
await expect(topic).toContainText("Funding & Sponsorship");
230+
await page.getByRole("option", { name: "Grants and research funding", exact: true }).click();
231+
await chooseReason("Funding and sponsorship");
232+
await expect(topic).toContainText("Grants and research funding");
233+
expect(await topicLabels()).toEqual(["Sponsoring Drowse", "Grants and research funding", "Something else"]);
234+
await chooseReason("Teaching with Drowse");
235+
await expect(topic).toContainText("Using Drowse in a course");
236+
expect(await topicLabels()).toEqual(["Using Drowse in a course", "Teaching materials", "Something else"]);
230237
await topic.click();
231238
await page.getByRole("option", { name: "Something else", exact: true }).click();
232239
await chooseReason("Media and press");
@@ -295,7 +302,7 @@ for (const viewportWidth of [390, 1280]) {
295302
await page.setViewportSize({ width: viewportWidth, height: 720 });
296303
await page.emulateMedia({ reducedMotion: "no-preference" });
297304
await page.goto(`${dev}/contact`);
298-
const field = page.getByRole("button", { name: "Reason", exact: true });
305+
const field = page.getByRole("button", { name: /^Reason / });
299306
await field.click({ delay: 160 });
300307
const list = page.getByRole("listbox", { name: "Reason", exact: true });
301308
await expect(list).toHaveCSS("transform", "matrix(1, 0, 0, 1, 0, 0)");

‎webui/e2e/contrast-audit.ios-layout.spec.ts‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@ const storesUrl = moduleUrl("../drowse/webui/src/lib/stores.svelte.ts");
99

1010
test.describe.configure({ mode: "parallel" });
1111

12+
const appEntryUrl = (page: Page) => page.locator('script[type="module"][src*="/main.ts"]')
13+
.evaluate(script => (script as HTMLScriptElement).src);
14+
1215
async function openPage(page: Page, path: string) {
1316
await page.goto(`${devUrl}${path}`);
14-
await page.evaluate(async () => { await import("/main.ts"); });
17+
// Vite adds a timestamp after source edits; importing the bare path would mount a second app.
18+
await page.evaluate(async url => { await import(url); }, await appEntryUrl(page));
1519
}
1620

1721
async function setTheme(page: Page, theme: string) {
@@ -79,9 +83,9 @@ async function expectActionContrast(button: Locator, label: string) {
7983

8084
async function mountStorageHome(page: Page) {
8185
await openPage(page, "/outside-the-workbench");
82-
await page.evaluate(async ({ componentUrl, libraryUrl }) => {
86+
await page.evaluate(async ({ componentUrl, libraryUrl, entryUrl }) => {
8387
const [{ default: HostedHome }, { mount, unmount }, { conversationLibrary }, { default: app }] = await Promise.all([
84-
import(componentUrl), import("/e2e/svelte-runtime.ts"), import(libraryUrl), import("/main.ts"),
88+
import(componentUrl), import("/e2e/svelte-runtime.ts"), import(libraryUrl), import(entryUrl),
8589
]);
8690
await unmount(app);
8791
conversationLibrary.listSummaries = async () => ({ conversations: [], issues: [] });
@@ -104,6 +108,7 @@ async function mountStorageHome(page: Page) {
104108
}, {
105109
componentUrl: moduleUrl("src/hosted/ui/HostedHome.svelte"),
106110
libraryUrl: moduleUrl("../drowse/webui/src/lib/stores/savedConversations.svelte.ts"),
111+
entryUrl: await appEntryUrl(page),
107112
});
108113
}
109114

@@ -196,9 +201,9 @@ for (const theme of ["dark", "light"]) {
196201
test(`disabled button labels remain discernible in ${theme}`, async ({ page }, testInfo) => {
197202
await openPage(page, "/outside-the-workbench");
198203
await setTheme(page, theme);
199-
await page.evaluate(async ({ buttonUrl, numberUrl }) => {
204+
await page.evaluate(async ({ buttonUrl, numberUrl, entryUrl }) => {
200205
const [{ mount, unmount, createRawSnippet }, { default: Button }, { default: NumberInput }, { default: app }] = await Promise.all([
201-
import("/e2e/svelte-runtime.ts"), import(buttonUrl), import(numberUrl), import("/main.ts"),
206+
import("/e2e/svelte-runtime.ts"), import(buttonUrl), import(numberUrl), import(entryUrl),
202207
]);
203208
await unmount(app);
204209
document.body.replaceChildren();
@@ -209,7 +214,7 @@ for (const theme of ["dark", "light"]) {
209214
mount(Button, { target, props: { variant, disabled: true, children: createRawSnippet(() => ({ render: () => `<span>${variant}</span>` })) } });
210215
}
211216
mount(NumberInput, { target, props: { value: 42, disabled: true, ariaLabel: "Disabled numeric value" } });
212-
}, { buttonUrl: moduleUrl("../drowse/webui/src/lib/ui/Button.svelte"), numberUrl: moduleUrl("../drowse/webui/src/lib/NumberInput.svelte") });
217+
}, { buttonUrl: moduleUrl("../drowse/webui/src/lib/ui/Button.svelte"), numberUrl: moduleUrl("../drowse/webui/src/lib/NumberInput.svelte"), entryUrl: await appEntryUrl(page) });
213218
await expect(page.getByRole("spinbutton", { name: "Disabled numeric value" })).toBeDisabled();
214219
await expect(page.locator(".sk-number")).toHaveCSS("opacity", "0.65");
215220
await expect(page.locator(".sk-number-input")).toHaveCSS("opacity", "1");

‎webui/e2e/cursor-states.spec.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ test("workbench cursors describe editing, inspecting, adjusting and navigating",
1212
await expect(page.locator(".shell")).toBeVisible();
1313
await expect(page.locator(".page-brand")).toHaveCSS("cursor", "pointer");
1414
await openWorkspaceMenu(page);
15-
await expect(page.getByRole("button", { name: "Switch to light theme", exact: true }).locator("svg").first()).toHaveCSS("cursor", "pointer");
15+
await expect(page.getByRole("button", { name: /^Switch to (light|dark) theme$/ }).locator("svg").first()).toHaveCSS("cursor", "pointer");
1616
await page.getByRole("button", { name: "Show chat tools", exact: true }).click();
1717
await expect(page.getByRole("button", { name: "About word colors", exact: true })).toHaveCSS("cursor", "help");
1818
const composer = page.getByRole("textbox", { name: /^Compose as / });

‎webui/e2e/desktop-browser-compat.spec.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,10 @@ test("desktop landing documents supported browsers and supplies runtime prerequi
153153
}
154154

155155
const browserSupport = page.locator(".hero-action-row > span");
156-
await expect(browserSupport).toHaveText("Chrome or Safari · compatible device required");
156+
await expect(browserSupport).toHaveAttribute("data-webgpu", /^(available|unavailable)$/);
157+
await expect(browserSupport).toHaveText(await browserSupport.getAttribute("data-webgpu") === "available"
158+
? "WebGPU is available in this browser. Drowse checks your device's memory next."
159+
: "This browser can't run Drowse yet. Try a current version of Chrome, Edge or Safari 26 or later on a computer with a graphics processor.");
157160
expect(pageErrors).toEqual([]);
158161
});
159162

‎webui/e2e/entry-flow.spec.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ test("first use chooses a model and later visits open the chat home", async ({ p
2121

2222
await page.goto(`${devUrl}/app?fixture=1`);
2323
await expect(page.getByRole("heading", { name: "Your chats", exact: true })).toBeVisible();
24-
await expect(page.getByRole("button", { name: "New Instance", exact: true })).toBeVisible();
25-
await expect(page.getByRole("button", { name: "Continue", exact: true })).toBeVisible();
24+
await expect(page.locator(".home-shell .hero").getByRole("button", { name: "New chat", exact: true })).toBeVisible();
25+
await expect(page.getByRole("button", { name: /^Continue with / })).toBeVisible();
2626
await expect(page.getByRole("heading", { name: "This device is ready" })).toHaveCount(0);
2727

28-
await page.getByRole("link", { name: "Models", exact: true }).click();
28+
await page.getByRole("navigation", { name: "Primary navigation" }).getByRole("link", { name: "Models", exact: true }).click();
2929
await expect(page.getByRole("heading", { name: "Models", exact: true })).toBeVisible();
30-
await page.locator('.page-route[data-route="models"]').getByRole("link", { name: "Chats", exact: true }).click();
30+
await page.locator('.page-route[data-route="models"]').getByRole("navigation", { name: "Primary navigation" }).getByRole("link", { name: "Chats", exact: true }).click();
3131
await expect(page.getByRole("heading", { name: "Your chats", exact: true })).toBeVisible();
3232
});
3333

@@ -189,7 +189,7 @@ test("returning home remains usable at narrow phone widths", async ({ page }) =>
189189
await page.goto(`${devUrl}/app?fixture=1`);
190190
await expect(page.getByRole("heading", { name: "Your chats", exact: true })).toBeVisible();
191191
await expect(page.getByRole("button", { name: "Download a model", exact: true })).toBeVisible();
192-
await expect(page.getByRole("link", { name: "Models", exact: true })).toBeVisible();
192+
await expect(page.getByRole("navigation", { name: "Primary navigation" }).getByRole("link", { name: "Models", exact: true })).toBeVisible();
193193
expect(await page.evaluate(() =>
194194
document.documentElement.scrollWidth <= window.innerWidth + 1
195195
)).toBe(true);

‎webui/e2e/header-layout.spec.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { expect, test } from "@playwright/test";
33
const devUrl = "http://127.0.0.1:4176";
44

55
test("sidebar leads with chats and compact navigation stays centered", async ({ page }, testInfo) => {
6-
await page.emulateMedia({ reducedMotion: "reduce" });
6+
await page.emulateMedia({ reducedMotion: "reduce", colorScheme: "light" });
77
await page.setViewportSize({ width: 1440, height: 900 });
88
await page.goto(`${devUrl}/app?layoutFixture=base`);
99
const sidebar = page.getByRole("complementary", { name: "Workspace sidebar" });
@@ -50,7 +50,7 @@ for (const viewport of [
5050
]) {
5151
test(`contextual header and menu fit at ${viewport.width}x${viewport.height}`, async ({ page }) => {
5252
await page.setViewportSize(viewport);
53-
await page.emulateMedia({ reducedMotion: "reduce" });
53+
await page.emulateMedia({ reducedMotion: "reduce", colorScheme: "light" });
5454
await page.goto(`${devUrl}/app?layoutFixture=base`);
5555
const trigger = page.getByRole("button", { name: "Workspace menu", exact: true });
5656
const menu = page.getByRole("dialog", { name: "Workspace menu", exact: true });
@@ -71,7 +71,7 @@ for (const viewport of [
7171
await expect(page.getByRole("dialog", { name: "Command palette" })).toHaveCount(0);
7272
}
7373

74-
for (const theme of ["Light", "Dark"]) {
74+
for (const theme of ["Dark", "Light"]) {
7575
await trigger.click();
7676
const backToChats = menu.getByRole("button", { name: "Back to Chats", exact: true });
7777
await expect(backToChats).toBeFocused();

0 commit comments

Comments
 (0)