Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions test/brief-regressions-browser.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,13 @@ try {
sameNode: editor === window.__briefNoteEditor,
value: [...document.querySelectorAll('[aria-label="Notes editor"] .cm-line')].map((line) => line.textContent).join("\n"),
focused: document.activeElement === editor,
selection: window.getSelection()?.toString(),
};
});
ok(durableNote.sameNode && durableNote.value.endsWith("Unsaved words survive.") && durableNote.focused && durableNote.selection === "Durable",
"shell refreshes preserve the exact note editor node, unsaved draft, focus, and selection");
ok(durableNote.sameNode && durableNote.value === "# Durable note\n\nStart here.\n\nUnsaved words survive." && durableNote.focused,
"shell refreshes preserve the exact note editor node, unsaved draft, and focus");
await page.keyboard.type("Steady");
ok(await page.$eval('[aria-label="Notes editor"] .cm-content', (editor) => editor.textContent.startsWith("# Steady note") && editor.textContent.endsWith("Unsaved words survive.")),
"shell refreshes preserve the authoritative CodeMirror selection");
await page.evaluate(() => [...document.querySelectorAll('.cowork-editor-toolbar button')].find((button) => button.textContent?.trim() === "Preview")?.click());
await page.waitForSelector('.cowork-markdown-preview:not(.hidden)');
ok(await page.$eval('.cowork-markdown-preview', (element) => /Unsaved words survive/.test(element.textContent)), "Cowork note preview renders the current unsaved Markdown draft");
Expand Down
6 changes: 4 additions & 2 deletions test/cowork-browser.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,11 @@ test("Cowork, Files, Quick Note, Markdown, and mobile continuity work as one fil
await page.waitForFunction(() => document.querySelector('[aria-label="Notes editor"] .cm-content') === window.__coworkEditor);
const continuity = await page.evaluate(() => {
const editor = document.querySelector('[aria-label="Notes editor"] .cm-content');
return { same: editor === window.__coworkEditor, focused: document.activeElement === editor, lines: [...document.querySelectorAll('[aria-label="Notes editor"] .cm-line')].map((line) => line.textContent), selection: window.getSelection()?.toString() };
return { same: editor === window.__coworkEditor, focused: document.activeElement === editor, lines: [...document.querySelectorAll('[aria-label="Notes editor"] .cm-line')].map((line) => line.textContent) };
});
assert.deepEqual(continuity, { same: true, focused: true, lines: ["# Field notes", "", "**Goal**", "", "Unsaved continuity proof."], selection: "ield not" });
assert.deepEqual(continuity, { same: true, focused: true, lines: ["# Field notes", "", "**Goal**", "", "Unsaved continuity proof."] });
await page.keyboard.type("PRESERVED");
assert.deepEqual(await page.$$eval('[aria-label="Notes editor"] .cm-line', (lines) => lines.map((line) => line.textContent)), ["# FPRESERVEDes", "", "**Goal**", "", "Unsaved continuity proof."]);
await page.keyboard.down(primaryModifier); await page.keyboard.press("s"); await page.keyboard.up(primaryModifier);
await waitFor(async () => (await api(`/api/channels/${channel.id}/files/text?path=notes%2Ffield-notes.md`, {}, token)).file.content.includes("Unsaved continuity proof"), "saved Cowork note");

Expand Down
Loading