Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Fix main after the Nov 7 trains: three tests that only fail together or on Windows (#4805)

Milind Soni29bf9ab3163e
diff --git a/scripts/testing/mobile-code-blocks-ui.e2e.test.ts b/scripts/testing/mobile-code-blocks-ui.e2e.test.ts
index b65849a2f6..375ffbd17d 100644
--- a/scripts/testing/mobile-code-blocks-ui.e2e.test.ts
+++ b/scripts/testing/mobile-code-blocks-ui.e2e.test.ts
@@ -207,12 +207,13 @@ async function connect(url: string) {
}
const feedbackLayout = () => evaluate(`(() => { const card=${blocks}[0]; const button=card.querySelectorAll('button')[2]; const c=card.getBoundingClientRect(), b=button.getBoundingClientRect(); return {height:c.height,buttonWidth:b.width,buttonHeight:b.height,left:b.left-c.left,top:b.top-c.top}; })()`);
const beforeFeedback = await feedbackLayout();
- await evaluate(`Object.defineProperty(navigator.clipboard, 'writeText', { configurable:true,value:async()=>{throw new Error('fixture denial');} }); true`);
+ // Both ways to copy refuse: the clipboard API, and the legacy execCommand a phone on plain http falls back to.
+ await evaluate(`Object.defineProperty(navigator.clipboard, 'writeText', { configurable:true,value:async()=>{throw new Error('fixture denial');} }); Object.defineProperty(document, 'execCommand', { configurable:true,value:()=>false }); true`);
await tap(0, "copy");
await expect.poll(() => evaluate(`${blocks}[0].querySelector('[role="status"]')?.textContent`)).toBe("Could not copy");
expect(await feedbackLayout()).toEqual(beforeFeedback);
receipts.failureFeedback = true;
- await evaluate(`Object.defineProperty(navigator.clipboard, 'writeText', { configurable:true,value:window.fixtureClipboardWrite }); true`);
+ await evaluate(`Object.defineProperty(navigator.clipboard, 'writeText', { configurable:true,value:window.fixtureClipboardWrite }); delete document.execCommand; true`);
await tap(0, "copy");
await expect.poll(() => evaluate(`${blocks}[0].querySelector('[role="status"]')?.textContent`)).toBe("Copied");
expect(await feedbackLayout()).toEqual(beforeFeedback);
diff --git a/server/chat-apps.test.ts b/server/chat-apps.test.ts
index 622bc3accf..27389e7607 100644
--- a/server/chat-apps.test.ts
+++ b/server/chat-apps.test.ts
@@ -745,7 +745,7 @@ describe("a live folder page", () => {
await apps.refreshLive();
// Files a page never takes (hidden, badly named, not a page file) are not a change.
writeFileSync(join(dash, ".notes"), "x");
- writeFileSync(join(dash, "a?b.html"), "x");
+ writeFileSync(join(dash, "a#b.html"), "x");
writeFileSync(join(dash, "build.zip"), "x");
expect(await apps.refreshLive()).toBe(0);
patch(THREAD, "m1", { app: { ...row("m1").app!, title: "Sales" } });
diff --git a/server/pages/bundle.test.ts b/server/pages/bundle.test.ts
index 90816d0b64..3fdbcc4fc8 100644
--- a/server/pages/bundle.test.ts
+++ b/server/pages/bundle.test.ts
@@ -100,7 +100,8 @@ describe("readPageBundle", () => {
describe("pageSignature", () => {
it("counts videos only for a page that carries them", async () => {
- const page = folder();
+ // As the page's own source is named: the native realpath, which on Windows expands a short (8.3) temp path.
+ const page = realpathSync.native(folder());
writeFileSync(join(page, "index.html"), "<h1>Clip</h1>");
writeFileSync(join(page, "clip.mp4"), "a");
const plain = await pageSignature(page), withVideos = await pageSignature(page, { videos: true });