Fix: use the platform-correct redo chord in e2e tests
This commit is contained in:
@@ -5,6 +5,7 @@ import { join } from "node:path";
|
|||||||
import {
|
import {
|
||||||
gotoSilverBulletPage,
|
gotoSilverBulletPage,
|
||||||
mod,
|
mod,
|
||||||
|
redoChord,
|
||||||
spawnServerProcess,
|
spawnServerProcess,
|
||||||
test,
|
test,
|
||||||
waitForServer,
|
waitForServer,
|
||||||
@@ -120,7 +121,7 @@ test("undo after moving the cursor past an external edit restores the user's cur
|
|||||||
selection: { anchor: 3 },
|
selection: { anchor: 3 },
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
await sbPage.keyboard.press(`${mod}+Shift+z`);
|
await sbPage.keyboard.press(redoChord);
|
||||||
await expect(editor).toContainText("External line");
|
await expect(editor).toContainText("External line");
|
||||||
const afterRedo = await sbPage.evaluate(
|
const afterRedo = await sbPage.evaluate(
|
||||||
() => (globalThis as any).client.editorView.state.selection.main.head,
|
() => (globalThis as any).client.editorView.state.selection.main.head,
|
||||||
|
|||||||
@@ -8,6 +8,15 @@ import { test as base, type Page } from "@playwright/test";
|
|||||||
/** The platform-appropriate modifier key: Meta on macOS, Control elsewhere. */
|
/** The platform-appropriate modifier key: Meta on macOS, Control elsewhere. */
|
||||||
export const mod = platform() === "darwin" ? "Meta" : "Control";
|
export const mod = platform() === "darwin" ? "Meta" : "Control";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Full redo chord, per the "Editor: Redo" binding in editor_commands.ts:
|
||||||
|
* Cmd-Shift-z on macOS, Ctrl-y elsewhere. `${mod}+Shift+z` is NOT a redo
|
||||||
|
* anywhere but macOS -- it silently does nothing on Linux.
|
||||||
|
*/
|
||||||
|
export const redoChord = platform() === "darwin"
|
||||||
|
? "Meta+Shift+z"
|
||||||
|
: "Control+y";
|
||||||
|
|
||||||
/** The admin account every multi-space e2e test provisions via `silverbullet setup`. */
|
/** The admin account every multi-space e2e test provisions via `silverbullet setup`. */
|
||||||
export const ADMIN_USER = "admin";
|
export const ADMIN_USER = "admin";
|
||||||
export const ADMIN_PASSWORD = "adminpw123";
|
export const ADMIN_PASSWORD = "adminpw123";
|
||||||
|
|||||||
Reference in New Issue
Block a user