Fix test on linux/windows

Change Playwright reporter when running in Github action

Change default emacs meta key to Alt on non Linux and Windows

Always set emacsMetaKey to "alt" if not on Mac, since the option is only available on Mac
This commit is contained in:
Jonatan Heyman 2024-01-05 16:53:00 +01:00
parent 17091d323c
commit 554e04ea67
7 changed files with 16 additions and 10 deletions

View File

@ -1,4 +1,5 @@
import Store from "electron-store"
import { isMac } from "./detect-platform"
const isDev = !!process.env.VITE_DEV_SERVER_URL
@ -50,7 +51,7 @@ const schema = {
const defaults = {
settings: {
keymap: "default",
emacsMetaKey: "meta",
emacsMetaKey: isMac ? "meta" : "alt",
showLineNumberGutter: true,
showFoldGutter: true,
autoUpdate: true,

View File

@ -20,7 +20,7 @@ export default defineConfig({
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
reporter: process.env.CI ? [['github'], ['html']] : 'list',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */

View File

@ -13,7 +13,7 @@
},
emacsMetaKey: {
type: String,
default: "Meta",
default: "alt",
},
showLineNumberGutter: {
type: Boolean,

View File

@ -60,7 +60,7 @@
showLineNumberGutter: this.showLineNumberGutter,
showFoldGutter: this.showFoldGutter,
keymap: this.keymap,
emacsMetaKey: this.metaKey,
emacsMetaKey: window.heynote.platform.isMac ? this.metaKey : "alt",
allowBetaVersions: this.allowBetaVersions,
enableGlobalHotkey: this.enableGlobalHotkey,
globalHotkey: this.globalHotkey,

View File

@ -40,7 +40,7 @@ export class HeynoteEditor {
theme="light",
saveFunction=null,
keymap="default",
emacsMetaKey="Meta",
emacsMetaKey,
showLineNumberGutter=true,
showFoldGutter=true,
bracketClosing=false,

View File

@ -17,17 +17,22 @@ test("test emacs copy/pase/cut key bindings", async ({ page, browserName }) => {
await page.locator("css=.status-block.settings").click()
//await page.locator("css=li.tab-editing").click()
await page.locator("css=select.keymap").selectOption("emacs")
if (heynotePage.isMac) {
await page.locator("css=select.metaKey").selectOption("alt")
}
await page.locator("body").press("Escape")
await page.locator("body").pressSequentially("test")
await page.locator("body").press(heynotePage.isMac ? "Meta+A" : "Control+A")
await page.locator("body").press("Control+Space")
await page.locator("body").press("Control+A")
await page.locator("body").press("Alt+W")
expect(await heynotePage.getBlockContent(0)).toBe("test")
await page.locator("body").press("Control+Y")
expect(await heynotePage.getBlockContent(0)).toBe("testtest")
await page.locator("body").press(heynotePage.isMac ? "Meta+A" : "Control+A")
await page.locator("body").press("Control+E")
await page.locator("body").press("Control+Space")
await page.locator("body").press("Control+A")
await page.locator("body").press("Control+W")
expect(await heynotePage.getBlockContent(0)).toBe("")
await page.locator("body").press("Control+Y")

View File

@ -61,7 +61,7 @@ const ipcRenderer = new IpcRenderer()
let settingsData = localStorage.getItem("settings")
let initialSettings = {
keymap: "default",
emacsMetaKey: "meta",
emacsMetaKey: "alt",
showLineNumberGutter: true,
showFoldGutter: true,
bracketClosing: false,