From 72ea8e5e6ad88d0ebadd281e4d2d0bd74ce187dd Mon Sep 17 00:00:00 2001 From: Jonatan Heyman Date: Sun, 18 Jan 2026 19:04:57 +0100 Subject: [PATCH] Move Playwright tests into tests/playwright --- playwright.config.ts | 2 +- tests/{ => playwright}/auto-closing-brackets.spec.js | 0 tests/{ => playwright}/basic-editing.spec.js | 0 tests/{ => playwright}/block-creation-time.spec.js | 0 tests/{ => playwright}/block-creation.spec.js | 0 tests/{ => playwright}/block-parsing.spec.js | 4 ++-- tests/{ => playwright}/buffer-creation.spec.js | 4 ++-- tests/{ => playwright}/content-persistence.spec.js | 0 tests/{ => playwright}/cursor-document-navigation.spec.js | 0 tests/{ => playwright}/custom-font.spec.js | 0 tests/{ => playwright}/custom-key-bindings.spec.js | 0 tests/{ => playwright}/delete-block.spec.js | 4 ++-- tests/{ => playwright}/delete-line.spec.js | 0 tests/playwright/electron-runner.cjs | 8 ++++++++ tests/{ => playwright}/emacs-clipboard-keys.spec.js | 0 tests/{ => playwright}/folding.spec.js | 2 +- tests/{ => playwright}/formatting.spec.js | 0 tests/{ => playwright}/language-detection.spec.js | 0 tests/{ => playwright}/language-selector.spec.js | 0 tests/{ => playwright}/markdown.spec.js | 0 tests/{ => playwright}/math.spec.js | 0 tests/{ => playwright}/move-block-between-buffers.spec.js | 4 ++-- tests/{ => playwright}/move-block.spec.js | 0 tests/{ => playwright}/multiple-cursors.spec.js | 0 tests/{ => playwright}/note-format.spec.js | 2 +- tests/{ => playwright}/scroll-margin.spec.js | 0 tests/{ => playwright}/search-replace.spec.js | 0 tests/{ => playwright}/search.spec.js | 0 tests/{ => playwright}/selection-matching.spec.js | 0 tests/{ => playwright}/settings.spec.js | 0 tests/{ => playwright}/show-whitespace.spec.js | 0 tests/{ => playwright}/tab-size-setting.spec.js | 0 tests/{ => playwright}/tabs.spec.js | 0 tests/{ => playwright}/test-utils.js | 2 +- 34 files changed, 20 insertions(+), 12 deletions(-) rename tests/{ => playwright}/auto-closing-brackets.spec.js (100%) rename tests/{ => playwright}/basic-editing.spec.js (100%) rename tests/{ => playwright}/block-creation-time.spec.js (100%) rename tests/{ => playwright}/block-creation.spec.js (100%) rename tests/{ => playwright}/block-parsing.spec.js (78%) rename tests/{ => playwright}/buffer-creation.spec.js (97%) rename tests/{ => playwright}/content-persistence.spec.js (100%) rename tests/{ => playwright}/cursor-document-navigation.spec.js (100%) rename tests/{ => playwright}/custom-font.spec.js (100%) rename tests/{ => playwright}/custom-key-bindings.spec.js (100%) rename tests/{ => playwright}/delete-block.spec.js (90%) rename tests/{ => playwright}/delete-line.spec.js (100%) create mode 100644 tests/playwright/electron-runner.cjs rename tests/{ => playwright}/emacs-clipboard-keys.spec.js (100%) rename tests/{ => playwright}/folding.spec.js (99%) rename tests/{ => playwright}/formatting.spec.js (100%) rename tests/{ => playwright}/language-detection.spec.js (100%) rename tests/{ => playwright}/language-selector.spec.js (100%) rename tests/{ => playwright}/markdown.spec.js (100%) rename tests/{ => playwright}/math.spec.js (100%) rename tests/{ => playwright}/move-block-between-buffers.spec.js (96%) rename tests/{ => playwright}/move-block.spec.js (100%) rename tests/{ => playwright}/multiple-cursors.spec.js (100%) rename tests/{ => playwright}/note-format.spec.js (96%) rename tests/{ => playwright}/scroll-margin.spec.js (100%) rename tests/{ => playwright}/search-replace.spec.js (100%) rename tests/{ => playwright}/search.spec.js (100%) rename tests/{ => playwright}/selection-matching.spec.js (100%) rename tests/{ => playwright}/settings.spec.js (100%) rename tests/{ => playwright}/show-whitespace.spec.js (100%) rename tests/{ => playwright}/tab-size-setting.spec.js (100%) rename tests/{ => playwright}/tabs.spec.js (100%) rename tests/{ => playwright}/test-utils.js (98%) diff --git a/playwright.config.ts b/playwright.config.ts index 2d3cd65..8a4460d 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -12,7 +12,7 @@ process.env["HEYNOTE_TESTS"] = "1" * See https://playwright.dev/docs/test-configuration. */ export default defineConfig({ - testDir: './tests', + testDir: './tests/playwright', /* Run tests in files in parallel */ fullyParallel: true, /* Fail the build on CI if you accidentally left test.only in the source code. */ diff --git a/tests/auto-closing-brackets.spec.js b/tests/playwright/auto-closing-brackets.spec.js similarity index 100% rename from tests/auto-closing-brackets.spec.js rename to tests/playwright/auto-closing-brackets.spec.js diff --git a/tests/basic-editing.spec.js b/tests/playwright/basic-editing.spec.js similarity index 100% rename from tests/basic-editing.spec.js rename to tests/playwright/basic-editing.spec.js diff --git a/tests/block-creation-time.spec.js b/tests/playwright/block-creation-time.spec.js similarity index 100% rename from tests/block-creation-time.spec.js rename to tests/playwright/block-creation-time.spec.js diff --git a/tests/block-creation.spec.js b/tests/playwright/block-creation.spec.js similarity index 100% rename from tests/block-creation.spec.js rename to tests/playwright/block-creation.spec.js diff --git a/tests/block-parsing.spec.js b/tests/playwright/block-parsing.spec.js similarity index 78% rename from tests/block-parsing.spec.js rename to tests/playwright/block-parsing.spec.js index 9e81ffc..27cbbde 100644 --- a/tests/block-parsing.spec.js +++ b/tests/playwright/block-parsing.spec.js @@ -1,8 +1,8 @@ import { expect, test } from "@playwright/test" import { EditorState } from "@codemirror/state" -import { heynoteLang } from "../src/editor/lang-heynote/heynote.js" -import { getBlocksFromSyntaxTree, getBlocksFromString } from "../src/editor/block/block-parsing.js" +import { heynoteLang } from "@/src/editor/lang-heynote/heynote.js" +import { getBlocksFromSyntaxTree, getBlocksFromString } from "@/src/editor/block/block-parsing.js" test("parse blocks from both syntax tree and string contents", async ({page}) => { const contents = ` diff --git a/tests/buffer-creation.spec.js b/tests/playwright/buffer-creation.spec.js similarity index 97% rename from tests/buffer-creation.spec.js rename to tests/playwright/buffer-creation.spec.js index 22687ca..05003d3 100644 --- a/tests/buffer-creation.spec.js +++ b/tests/playwright/buffer-creation.spec.js @@ -1,8 +1,8 @@ import {expect, test} from "@playwright/test"; import {HeynotePage} from "./test-utils.js"; -import { AUTO_SAVE_INTERVAL } from "../src/common/constants.js" -import { NoteFormat } from "../src/common/note-format.js" +import { AUTO_SAVE_INTERVAL } from "@/src/common/constants.js" +import { NoteFormat } from "@/src/common/note-format.js" let heynotePage diff --git a/tests/content-persistence.spec.js b/tests/playwright/content-persistence.spec.js similarity index 100% rename from tests/content-persistence.spec.js rename to tests/playwright/content-persistence.spec.js diff --git a/tests/cursor-document-navigation.spec.js b/tests/playwright/cursor-document-navigation.spec.js similarity index 100% rename from tests/cursor-document-navigation.spec.js rename to tests/playwright/cursor-document-navigation.spec.js diff --git a/tests/custom-font.spec.js b/tests/playwright/custom-font.spec.js similarity index 100% rename from tests/custom-font.spec.js rename to tests/playwright/custom-font.spec.js diff --git a/tests/custom-key-bindings.spec.js b/tests/playwright/custom-key-bindings.spec.js similarity index 100% rename from tests/custom-key-bindings.spec.js rename to tests/playwright/custom-key-bindings.spec.js diff --git a/tests/delete-block.spec.js b/tests/playwright/delete-block.spec.js similarity index 90% rename from tests/delete-block.spec.js rename to tests/playwright/delete-block.spec.js index 8599eb3..cc515db 100644 --- a/tests/delete-block.spec.js +++ b/tests/playwright/delete-block.spec.js @@ -1,8 +1,8 @@ import {expect, test} from "@playwright/test"; import {HeynotePage} from "./test-utils.js"; -import { AUTO_SAVE_INTERVAL } from "../src/common/constants.js" -import { NoteFormat } from "../src/common/note-format.js" +import { AUTO_SAVE_INTERVAL } from "@/src/common/constants.js" +import { NoteFormat } from "@/src/common/note-format.js" let heynotePage diff --git a/tests/delete-line.spec.js b/tests/playwright/delete-line.spec.js similarity index 100% rename from tests/delete-line.spec.js rename to tests/playwright/delete-line.spec.js diff --git a/tests/playwright/electron-runner.cjs b/tests/playwright/electron-runner.cjs new file mode 100644 index 0000000..13ea87d --- /dev/null +++ b/tests/playwright/electron-runner.cjs @@ -0,0 +1,8 @@ +const path = require('node:path') +const { app } = require('electron') + +if (process.env.HEYNOTE_TEST_USER_DATA_DIR) { + app.setPath('userData', process.env.HEYNOTE_TEST_USER_DATA_DIR) +} + +require(path.join(process.cwd(), 'dist-electron', 'main', 'index.js')) diff --git a/tests/emacs-clipboard-keys.spec.js b/tests/playwright/emacs-clipboard-keys.spec.js similarity index 100% rename from tests/emacs-clipboard-keys.spec.js rename to tests/playwright/emacs-clipboard-keys.spec.js diff --git a/tests/folding.spec.js b/tests/playwright/folding.spec.js similarity index 99% rename from tests/folding.spec.js rename to tests/playwright/folding.spec.js index 4c0bffc..44c9a63 100644 --- a/tests/folding.spec.js +++ b/tests/playwright/folding.spec.js @@ -1,6 +1,6 @@ import { test, expect } from "@playwright/test"; import { HeynotePage } from "./test-utils.js"; -import { NoteFormat } from "../src/common/note-format.js"; +import { NoteFormat } from "@/src/common/note-format.js"; import { formatDate, formatFullDate } from "@/src/common/format-date.js" export const delimiterRegex = /\nāˆžāˆžāˆž[a-z]+(-a)?(?:;[^\\n]+)*\n/ diff --git a/tests/formatting.spec.js b/tests/playwright/formatting.spec.js similarity index 100% rename from tests/formatting.spec.js rename to tests/playwright/formatting.spec.js diff --git a/tests/language-detection.spec.js b/tests/playwright/language-detection.spec.js similarity index 100% rename from tests/language-detection.spec.js rename to tests/playwright/language-detection.spec.js diff --git a/tests/language-selector.spec.js b/tests/playwright/language-selector.spec.js similarity index 100% rename from tests/language-selector.spec.js rename to tests/playwright/language-selector.spec.js diff --git a/tests/markdown.spec.js b/tests/playwright/markdown.spec.js similarity index 100% rename from tests/markdown.spec.js rename to tests/playwright/markdown.spec.js diff --git a/tests/math.spec.js b/tests/playwright/math.spec.js similarity index 100% rename from tests/math.spec.js rename to tests/playwright/math.spec.js diff --git a/tests/move-block-between-buffers.spec.js b/tests/playwright/move-block-between-buffers.spec.js similarity index 96% rename from tests/move-block-between-buffers.spec.js rename to tests/playwright/move-block-between-buffers.spec.js index bc3511c..07313c2 100644 --- a/tests/move-block-between-buffers.spec.js +++ b/tests/playwright/move-block-between-buffers.spec.js @@ -1,8 +1,8 @@ import {expect, test} from "@playwright/test"; import {HeynotePage} from "./test-utils.js"; -import { AUTO_SAVE_INTERVAL } from "../src/common/constants.js" -import { NoteFormat } from "../src/common/note-format.js" +import { AUTO_SAVE_INTERVAL } from "@/src/common/constants.js" +import { NoteFormat } from "@/src/common/note-format.js" let heynotePage diff --git a/tests/move-block.spec.js b/tests/playwright/move-block.spec.js similarity index 100% rename from tests/move-block.spec.js rename to tests/playwright/move-block.spec.js diff --git a/tests/multiple-cursors.spec.js b/tests/playwright/multiple-cursors.spec.js similarity index 100% rename from tests/multiple-cursors.spec.js rename to tests/playwright/multiple-cursors.spec.js diff --git a/tests/note-format.spec.js b/tests/playwright/note-format.spec.js similarity index 96% rename from tests/note-format.spec.js rename to tests/playwright/note-format.spec.js index d074e5a..5bdbb90 100644 --- a/tests/note-format.spec.js +++ b/tests/playwright/note-format.spec.js @@ -1,6 +1,6 @@ import { test, expect } from "@playwright/test"; import { HeynotePage } from "./test-utils.js"; -import { NoteFormat } from "../src/common/note-format.js"; +import { NoteFormat } from "@/src/common/note-format.js"; let heynotePage diff --git a/tests/scroll-margin.spec.js b/tests/playwright/scroll-margin.spec.js similarity index 100% rename from tests/scroll-margin.spec.js rename to tests/playwright/scroll-margin.spec.js diff --git a/tests/search-replace.spec.js b/tests/playwright/search-replace.spec.js similarity index 100% rename from tests/search-replace.spec.js rename to tests/playwright/search-replace.spec.js diff --git a/tests/search.spec.js b/tests/playwright/search.spec.js similarity index 100% rename from tests/search.spec.js rename to tests/playwright/search.spec.js diff --git a/tests/selection-matching.spec.js b/tests/playwright/selection-matching.spec.js similarity index 100% rename from tests/selection-matching.spec.js rename to tests/playwright/selection-matching.spec.js diff --git a/tests/settings.spec.js b/tests/playwright/settings.spec.js similarity index 100% rename from tests/settings.spec.js rename to tests/playwright/settings.spec.js diff --git a/tests/show-whitespace.spec.js b/tests/playwright/show-whitespace.spec.js similarity index 100% rename from tests/show-whitespace.spec.js rename to tests/playwright/show-whitespace.spec.js diff --git a/tests/tab-size-setting.spec.js b/tests/playwright/tab-size-setting.spec.js similarity index 100% rename from tests/tab-size-setting.spec.js rename to tests/playwright/tab-size-setting.spec.js diff --git a/tests/tabs.spec.js b/tests/playwright/tabs.spec.js similarity index 100% rename from tests/tabs.spec.js rename to tests/playwright/tabs.spec.js diff --git a/tests/test-utils.js b/tests/playwright/test-utils.js similarity index 98% rename from tests/test-utils.js rename to tests/playwright/test-utils.js index c4cd950..930008f 100644 --- a/tests/test-utils.js +++ b/tests/playwright/test-utils.js @@ -1,5 +1,5 @@ import { test, expect } from '@playwright/test'; -import { NoteFormat } from '../src/common/note-format.js'; +import { NoteFormat } from '@/src/common/note-format.js'; export function pageErrorGetter(page) { let messages = [];