diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f73c4bdf5d..f495b2f9be 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -67,11 +67,12 @@ jobs: run: npx playwright install --with-deps - name: Run Playwright tests + working-directory: ./tests run: npx playwright test - uses: actions/upload-artifact@v3 if: always() with: name: playwright-report - path: playwright-report/ + path: tests/playwright-report/ retention-days: 30 diff --git a/examples/editor/serve.json b/examples/editor/serve.json new file mode 100644 index 0000000000..b07c32029e --- /dev/null +++ b/examples/editor/serve.json @@ -0,0 +1,3 @@ +{ + "rewrites": [{ "source": "/*", "destination": "/index.html" }] +} diff --git a/examples/editor/src/main.tsx b/examples/editor/src/main.tsx index 3d13ac7755..fa77e23551 100644 --- a/examples/editor/src/main.tsx +++ b/examples/editor/src/main.tsx @@ -69,15 +69,19 @@ function Root() { - - {editors.map((editor, i) => ( -
- {editor.title} -
- ))} + window.location.search.includes("hideMenu") ? undefined : ( + + + {editors.map((editor, i) => ( +
+ {editor.title} +
+ ))} - {/* manitne } // rightSection={} /> */} -
-
+
+ + ) } header={<>} // header={
diff --git a/examples/editor/src/style.css b/examples/editor/src/style.css index 8918687e58..6e003ac1f3 100644 --- a/examples/editor/src/style.css +++ b/examples/editor/src/style.css @@ -1,13 +1,14 @@ .editor { margin: 0 calc((100% - 731px) / 2); - height: 100%; + margin-top: 8px; + /* height: 100%; */ } body { margin: 0; } -.root { +/* .root { height: 100%; width: 100%; -} +} */ diff --git a/package-lock.json b/package-lock.json index a14117e164..76459a1ffb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,11 +7,10 @@ "name": "root", "workspaces": [ "packages/*", - "examples/*" + "examples/*", + "tests" ], "devDependencies": { - "@playwright/experimental-ct-react": "^1.38.1", - "@playwright/test": "^1.38.1", "@typescript-eslint/eslint-plugin": "^5.5.0", "@typescript-eslint/parser": "^5.5.0", "eslint": "^8.22.0", @@ -2856,6 +2855,10 @@ "resolved": "packages/react", "link": true }, + "node_modules/@blocknote/tests": { + "resolved": "tests", + "link": true + }, "node_modules/@codemirror/autocomplete": { "version": "6.7.1", "dev": true, @@ -10064,6 +10067,7 @@ "dev": true, "license": "BSD-3-Clause", "optional": true, + "peer": true, "engines": { "node": ">=0.10.0" } @@ -21194,6 +21198,22 @@ "y-protocols": "^1.0.5", "yjs": "^13.5.44" } + }, + "tests": { + "name": "@blocknote/tests", + "version": "0.9.6", + "dependencies": { + "react": "^18.2.0", + "react-dom": "^18.2.0" + }, + "devDependencies": { + "@blocknote/core": "^0.9.6", + "@blocknote/react": "^0.9.6", + "@playwright/experimental-ct-react": "^1.38.1", + "@playwright/test": "^1.38.1", + "eslint": "^8.10.0", + "react-icons": "^4.3.1" + } } } } diff --git a/package.json b/package.json index 170c4a0c2a..bbb18ef9ea 100644 --- a/package.json +++ b/package.json @@ -3,11 +3,10 @@ "private": true, "workspaces": [ "packages/*", - "examples/*" + "examples/*", + "tests" ], "devDependencies": { - "@playwright/experimental-ct-react": "^1.38.1", - "@playwright/test": "^1.38.1", "eslint": "^8.22.0", "eslint-plugin-import": "^2.28.0", "eslint-config-react-app": "^7.0.0", @@ -19,21 +18,17 @@ }, "scripts": { "start": "lerna run --stream --scope @blocknote/example-editor dev", - "start:built": "npx serve examples/editor/dist", - "test:updateSnaps": "docker run --rm -e RUN_IN_DOCKER=true --network host -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/playwright:v1.38.1-focal npx playwright test -u", + "start:built": "npx serve examples/editor/dist -c ../serve.json", "build": "lerna run --stream build --concurrency 1", "build:site": "lerna run --stream docs:build --concurrency 1", "lint": "lerna run --stream lint", "bootstrap": "lerna bootstrap --ci -- --force && patch-package", "install-new-packages": "lerna bootstrap -- --force && patch-package", - "playwright": "npx playwright test", "test": "lerna run --stream test", "install-playwright": "npx playwright install --with-deps", "deploy": "lerna publish -- --access public", "prepublishOnly": "npm run build && cp README.md packages/core/README.md && cp README.md packages/react/README.md", - "postpublish": "rm -rf packages/core/README.md && rm -rf packages/react/README.md", - "test-ct": "playwright test -c playwright-ct.config.ts --headed", - "test-ct:updateSnaps": "docker run --rm -e RUN_IN_DOCKER=true --network host -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/playwright:v1.35.1-focal npm install && playwright test -c playwright-ct.config.ts -u" + "postpublish": "rm -rf packages/core/README.md && rm -rf packages/react/README.md" }, "overrides": { "react": "18.2.0", diff --git a/packages/core/src/api/exporters/markdown/markdownExporter.test.ts b/packages/core/src/api/exporters/markdown/markdownExporter.test.ts index 63ca32c2fa..11cafad595 100644 --- a/packages/core/src/api/exporters/markdown/markdownExporter.test.ts +++ b/packages/core/src/api/exporters/markdown/markdownExporter.test.ts @@ -1,6 +1,7 @@ +import fs from "node:fs"; +import path from "node:path"; import { afterEach, beforeEach, describe, expect, it } from "vitest"; import { BlockNoteEditor } from "../../../BlockNoteEditor"; - import { BlockSchema, PartialBlock, @@ -34,6 +35,16 @@ async function convertToMarkdownAndCompareSnapshots< "/" + snapshotName + "/markdown.md"; + + // vitest empty snapshots are broken on CI. might be fixed on next vitest, use workaround for now + if (!md.length && process.env.CI) { + if ( + fs.readFileSync(path.join(__dirname, snapshotPath), "utf8").length === 0 + ) { + // both are empty, so it's fine + return; + } + } expect(md).toMatchFileSnapshot(snapshotPath); } diff --git a/packages/core/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts b/packages/core/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts index 1af1cc2328..645d90b59b 100644 --- a/packages/core/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +++ b/packages/core/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts @@ -1,4 +1,4 @@ -import { isNodeSelection, isTextSelection, posToDOMRect } from "@tiptap/core"; +import { isNodeSelection, posToDOMRect } from "@tiptap/core"; import { EditorState, Plugin, PluginKey } from "prosemirror-state"; import { EditorView } from "prosemirror-view"; @@ -29,15 +29,7 @@ export class FormattingToolbarView { state: EditorState; from: number; to: number; - }) => boolean = ({ state }) => { - const { selection } = state; - const { empty } = selection; - - if (!isTextSelection(selection)) { - return false; - } - return !empty; - }; + }) => boolean = ({ state }) => !state.selection.empty; constructor( private readonly editor: BlockNoteEditor< diff --git a/packages/core/src/extensions/SlashMenu/defaultSlashMenuItems.ts b/packages/core/src/extensions/SlashMenu/defaultSlashMenuItems.ts index 52a9bc9337..54a8e4390e 100644 --- a/packages/core/src/extensions/SlashMenu/defaultSlashMenuItems.ts +++ b/packages/core/src/extensions/SlashMenu/defaultSlashMenuItems.ts @@ -19,18 +19,15 @@ function setSelectionToNextContentEditableBlock< S extends StyleSchema >(editor: BlockNoteEditor) { let block = editor.getTextCursorPosition().block; - let contentType = editor.blockSchema[block.type].content as - | "inline" - | "table" - | "none"; + let contentType = editor.blockSchema[block.type].content; while (contentType === "none") { - editor.setTextCursorPosition(block, "end"); block = editor.getTextCursorPosition().nextBlock!; contentType = editor.blockSchema[block.type].content as | "inline" | "table" | "none"; + editor.setTextCursorPosition(block, "end"); } } diff --git a/packages/website/docs/docs/block-types.md b/packages/website/docs/docs/block-types.md index 4327b121c8..1f20be8026 100644 --- a/packages/website/docs/docs/block-types.md +++ b/packages/website/docs/docs/block-types.md @@ -109,10 +109,10 @@ type ImageBlock = { id: string; type: "image"; props: { - url: string = "", - caption: string = "", + url: string = ""; + caption: string = ""; width: number = 512; - } & Omit + } & Omit; content: InlineContent[]; children: Block[]; }; @@ -180,7 +180,7 @@ export default function App() { default: "image", }, }, - containsInlineContent: true, + content: "inline", render: ({ block }) => (
(
; - }, + alert: BlockSpec<"alert", typeof alertPropSchema, true>; + }, "alert" >; editor: BlockNoteEditor< DefaultBlockSchema & { - alert: BlockSpec<"alert", typeof alertPropSchema, true>; - } + alert: BlockSpec<"alert", typeof alertPropSchema, true>; + } >; theme: "light" | "dark"; }) => { @@ -210,7 +210,7 @@ export const Alert = (props: { {Object.entries(alertTypes).map(([key, value]) => { const ItemIcon = value.icon; - + return ( values: ["warning", "error", "info", "success"], }, } as const, - containsInlineContent: true, + content: "inline", render: (props) => , }); @@ -331,4 +331,4 @@ const inlineContentStyles = { {{ getStyles(isDark) }} ``` -::: \ No newline at end of file +::: diff --git a/tests/end-to-end/theming/theming.test.ts-snapshots/dark-slash-menu-chromium-linux.png b/tests/end-to-end/theming/theming.test.ts-snapshots/dark-slash-menu-chromium-linux.png deleted file mode 100644 index b7f35913d5..0000000000 Binary files a/tests/end-to-end/theming/theming.test.ts-snapshots/dark-slash-menu-chromium-linux.png and /dev/null differ diff --git a/tests/end-to-end/theming/theming.test.ts-snapshots/dark-slash-menu-firefox-linux.png b/tests/end-to-end/theming/theming.test.ts-snapshots/dark-slash-menu-firefox-linux.png deleted file mode 100644 index a92a186668..0000000000 Binary files a/tests/end-to-end/theming/theming.test.ts-snapshots/dark-slash-menu-firefox-linux.png and /dev/null differ diff --git a/tests/end-to-end/theming/theming.test.ts-snapshots/dark-slash-menu-webkit-linux.png b/tests/end-to-end/theming/theming.test.ts-snapshots/dark-slash-menu-webkit-linux.png deleted file mode 100644 index 9cbdd307db..0000000000 Binary files a/tests/end-to-end/theming/theming.test.ts-snapshots/dark-slash-menu-webkit-linux.png and /dev/null differ diff --git a/tests/package.json b/tests/package.json new file mode 100644 index 0000000000..9141c59938 --- /dev/null +++ b/tests/package.json @@ -0,0 +1,30 @@ +{ + "name": "@blocknote/tests", + "private": true, + "version": "0.9.6", + "scripts": { + "build": "tsc", + "lint": "eslint src --max-warnings 0", + "playwright": "npx playwright test", + "test:updateSnaps": "docker run --rm -e RUN_IN_DOCKER=true --network host -v $(pwd)/..:/work/ -w /work/tests -it mcr.microsoft.com/playwright:v1.38.1-focal npx playwright test -u", + "test-ct": "playwright test -c playwright-ct.config.ts --headed", + "test-ct:updateSnaps": "docker run --rm -e RUN_IN_DOCKER=true --network host -v $(pwd)/..:/work/ -w /work/tests -it mcr.microsoft.com/playwright:v1.35.1-focal npm install && playwright test -c playwright-ct.config.ts -u" + }, + "dependencies": { + "react": "^18.2.0", + "react-dom": "^18.2.0" + }, + "devDependencies": { + "eslint": "^8.10.0", + "@blocknote/core": "^0.9.6", + "@blocknote/react": "^0.9.6", + "@playwright/experimental-ct-react": "^1.38.1", + "@playwright/test": "^1.38.1", + "react-icons": "^4.3.1" + }, + "eslintConfig": { + "extends": [ + "../.eslintrc.js" + ] + } +} diff --git a/playwright-ct.config.ts b/tests/playwright-ct.config.ts similarity index 94% rename from playwright-ct.config.ts rename to tests/playwright-ct.config.ts index 9eb80ef591..d21dc064b1 100644 --- a/playwright-ct.config.ts +++ b/tests/playwright-ct.config.ts @@ -4,9 +4,9 @@ import { defineConfig, devices } from "@playwright/experimental-ct-react"; * See https://playwright.dev/docs/test-configuration. */ export default defineConfig({ - testDir: "./tests/component/", + testDir: "./src/component/", /* The base directory, relative to the config file, for snapshot files created with toMatchSnapshot and toHaveScreenshot. */ - snapshotDir: "./tests/component/snapshots", + snapshotDir: "./src/component/snapshots", /* Maximum time one test can run for. */ timeout: 10 * 1000, /* Run tests in files in parallel */ diff --git a/playwright.config.ts b/tests/playwright.config.ts similarity index 98% rename from playwright.config.ts rename to tests/playwright.config.ts index f3dddcdeb9..d9c8966d82 100644 --- a/playwright.config.ts +++ b/tests/playwright.config.ts @@ -11,7 +11,7 @@ import { devices } from "@playwright/test"; * See https://playwright.dev/docs/test-configuration. */ const config: PlaywrightTestConfig = { - testDir: "./tests/end-to-end", + testDir: "./src/end-to-end", /* Maximum time one test can run for. */ timeout: 30 * 1000, expect: { diff --git a/playwright/index.html b/tests/playwright/index.html similarity index 100% rename from playwright/index.html rename to tests/playwright/index.html diff --git a/playwright/index.tsx b/tests/playwright/index.tsx similarity index 100% rename from playwright/index.tsx rename to tests/playwright/index.tsx diff --git a/tests/component/copypaste-external.spec.tsx b/tests/src/component/copypaste-external.spec.tsx similarity index 99% rename from tests/component/copypaste-external.spec.tsx rename to tests/src/component/copypaste-external.spec.tsx index 8eee66d176..120c4ed557 100644 --- a/tests/component/copypaste-external.spec.tsx +++ b/tests/src/component/copypaste-external.spec.tsx @@ -1,15 +1,16 @@ import { expect, test } from "../setup/setupScriptComponent"; -import { focusOnEditor } from "../utils/editor"; -import { executeSlashCommand } from "../utils/slashmenu"; +import EditorWithTextArea from "../utils/components/EditorWithTextArea"; import { copyPasteAllExternal, removeClassesFromHTML, removeMetaFromHTML, } from "../utils/copypaste"; -import EditorWithTextArea from "../utils/components/EditorWithTextArea"; +import { focusOnEditor } from "../utils/editor"; +import { executeSlashCommand } from "../utils/slashmenu"; test.describe.configure({ mode: "serial" }); +// eslint-disable-next-line no-empty-pattern test.beforeEach(async ({}, testInfo) => { testInfo.snapshotSuffix = ""; }); diff --git a/tests/component/copypaste-internal.spec.tsx b/tests/src/component/copypaste-internal.spec.tsx similarity index 99% rename from tests/component/copypaste-internal.spec.tsx rename to tests/src/component/copypaste-internal.spec.tsx index 1f03addb52..89e36d93a9 100644 --- a/tests/component/copypaste-internal.spec.tsx +++ b/tests/src/component/copypaste-internal.spec.tsx @@ -1,11 +1,12 @@ import { expect, test } from "../setup/setupScriptComponent"; import Editor from "../utils/components/Editor"; +import { copyPasteAll } from "../utils/copypaste"; import { compareDocToSnapshot, focusOnEditor } from "../utils/editor"; import { executeSlashCommand } from "../utils/slashmenu"; -import { copyPasteAll } from "../utils/copypaste"; test.describe.configure({ mode: "serial" }); +// eslint-disable-next-line no-empty-pattern test.beforeEach(async ({}, testInfo) => { testInfo.snapshotSuffix = ""; }); diff --git a/tests/component/snapshots/copypaste-external.spec.tsx-snapshots/alert-external-chromium.html b/tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/alert-external-chromium.html similarity index 100% rename from tests/component/snapshots/copypaste-external.spec.tsx-snapshots/alert-external-chromium.html rename to tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/alert-external-chromium.html diff --git a/tests/component/snapshots/copypaste-external.spec.tsx-snapshots/alert-external-firefox.html b/tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/alert-external-firefox.html similarity index 100% rename from tests/component/snapshots/copypaste-external.spec.tsx-snapshots/alert-external-firefox.html rename to tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/alert-external-firefox.html diff --git a/tests/component/snapshots/copypaste-external.spec.tsx-snapshots/alert-external-webkit.html b/tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/alert-external-webkit.html similarity index 100% rename from tests/component/snapshots/copypaste-external.spec.tsx-snapshots/alert-external-webkit.html rename to tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/alert-external-webkit.html diff --git a/tests/component/snapshots/copypaste-external.spec.tsx-snapshots/button-external-chromium.html b/tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/button-external-chromium.html similarity index 100% rename from tests/component/snapshots/copypaste-external.spec.tsx-snapshots/button-external-chromium.html rename to tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/button-external-chromium.html diff --git a/tests/component/snapshots/copypaste-external.spec.tsx-snapshots/button-external-firefox.html b/tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/button-external-firefox.html similarity index 100% rename from tests/component/snapshots/copypaste-external.spec.tsx-snapshots/button-external-firefox.html rename to tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/button-external-firefox.html diff --git a/tests/component/snapshots/copypaste-external.spec.tsx-snapshots/button-external-webkit.html b/tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/button-external-webkit.html similarity index 100% rename from tests/component/snapshots/copypaste-external.spec.tsx-snapshots/button-external-webkit.html rename to tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/button-external-webkit.html diff --git a/tests/component/snapshots/copypaste-external.spec.tsx-snapshots/embed-external-chromium.html b/tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/embed-external-chromium.html similarity index 100% rename from tests/component/snapshots/copypaste-external.spec.tsx-snapshots/embed-external-chromium.html rename to tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/embed-external-chromium.html diff --git a/tests/component/snapshots/copypaste-external.spec.tsx-snapshots/embed-external-firefox.html b/tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/embed-external-firefox.html similarity index 100% rename from tests/component/snapshots/copypaste-external.spec.tsx-snapshots/embed-external-firefox.html rename to tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/embed-external-firefox.html diff --git a/tests/component/snapshots/copypaste-external.spec.tsx-snapshots/embed-external-webkit.html b/tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/embed-external-webkit.html similarity index 100% rename from tests/component/snapshots/copypaste-external.spec.tsx-snapshots/embed-external-webkit.html rename to tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/embed-external-webkit.html diff --git a/tests/component/snapshots/copypaste-external.spec.tsx-snapshots/image-external-chromium.html b/tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/image-external-chromium.html similarity index 100% rename from tests/component/snapshots/copypaste-external.spec.tsx-snapshots/image-external-chromium.html rename to tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/image-external-chromium.html diff --git a/tests/component/snapshots/copypaste-external.spec.tsx-snapshots/image-external-firefox.html b/tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/image-external-firefox.html similarity index 100% rename from tests/component/snapshots/copypaste-external.spec.tsx-snapshots/image-external-firefox.html rename to tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/image-external-firefox.html diff --git a/tests/component/snapshots/copypaste-external.spec.tsx-snapshots/image-external-webkit.html b/tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/image-external-webkit.html similarity index 100% rename from tests/component/snapshots/copypaste-external.spec.tsx-snapshots/image-external-webkit.html rename to tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/image-external-webkit.html diff --git a/tests/component/snapshots/copypaste-external.spec.tsx-snapshots/separator-external-chromium.html b/tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/separator-external-chromium.html similarity index 100% rename from tests/component/snapshots/copypaste-external.spec.tsx-snapshots/separator-external-chromium.html rename to tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/separator-external-chromium.html diff --git a/tests/component/snapshots/copypaste-external.spec.tsx-snapshots/separator-external-firefox.html b/tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/separator-external-firefox.html similarity index 100% rename from tests/component/snapshots/copypaste-external.spec.tsx-snapshots/separator-external-firefox.html rename to tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/separator-external-firefox.html diff --git a/tests/component/snapshots/copypaste-external.spec.tsx-snapshots/separator-external-webkit.html b/tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/separator-external-webkit.html similarity index 100% rename from tests/component/snapshots/copypaste-external.spec.tsx-snapshots/separator-external-webkit.html rename to tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/separator-external-webkit.html diff --git a/tests/component/snapshots/copypaste-external.spec.tsx-snapshots/toc-external-chromium.html b/tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/toc-external-chromium.html similarity index 100% rename from tests/component/snapshots/copypaste-external.spec.tsx-snapshots/toc-external-chromium.html rename to tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/toc-external-chromium.html diff --git a/tests/component/snapshots/copypaste-external.spec.tsx-snapshots/toc-external-firefox.html b/tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/toc-external-firefox.html similarity index 100% rename from tests/component/snapshots/copypaste-external.spec.tsx-snapshots/toc-external-firefox.html rename to tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/toc-external-firefox.html diff --git a/tests/component/snapshots/copypaste-external.spec.tsx-snapshots/toc-external-webkit.html b/tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/toc-external-webkit.html similarity index 100% rename from tests/component/snapshots/copypaste-external.spec.tsx-snapshots/toc-external-webkit.html rename to tests/src/component/snapshots/copypaste-external.spec.tsx-snapshots/toc-external-webkit.html diff --git a/tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/alert-internal-chromium.json b/tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/alert-internal-chromium.json similarity index 100% rename from tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/alert-internal-chromium.json rename to tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/alert-internal-chromium.json diff --git a/tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/alert-internal-firefox.json b/tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/alert-internal-firefox.json similarity index 100% rename from tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/alert-internal-firefox.json rename to tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/alert-internal-firefox.json diff --git a/tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/alert-internal-webkit.json b/tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/alert-internal-webkit.json similarity index 100% rename from tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/alert-internal-webkit.json rename to tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/alert-internal-webkit.json diff --git a/tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/button-internal-chromium.json b/tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/button-internal-chromium.json similarity index 100% rename from tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/button-internal-chromium.json rename to tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/button-internal-chromium.json diff --git a/tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/button-internal-firefox.json b/tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/button-internal-firefox.json similarity index 100% rename from tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/button-internal-firefox.json rename to tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/button-internal-firefox.json diff --git a/tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/button-internal-webkit.json b/tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/button-internal-webkit.json similarity index 100% rename from tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/button-internal-webkit.json rename to tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/button-internal-webkit.json diff --git a/tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/embed-internal-chromium.json b/tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/embed-internal-chromium.json similarity index 100% rename from tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/embed-internal-chromium.json rename to tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/embed-internal-chromium.json diff --git a/tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/embed-internal-firefox.json b/tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/embed-internal-firefox.json similarity index 100% rename from tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/embed-internal-firefox.json rename to tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/embed-internal-firefox.json diff --git a/tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/embed-internal-webkit.json b/tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/embed-internal-webkit.json similarity index 100% rename from tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/embed-internal-webkit.json rename to tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/embed-internal-webkit.json diff --git a/tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/image-internal-chromium.json b/tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/image-internal-chromium.json similarity index 100% rename from tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/image-internal-chromium.json rename to tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/image-internal-chromium.json diff --git a/tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/image-internal-firefox.json b/tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/image-internal-firefox.json similarity index 100% rename from tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/image-internal-firefox.json rename to tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/image-internal-firefox.json diff --git a/tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/image-internal-webkit.json b/tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/image-internal-webkit.json similarity index 100% rename from tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/image-internal-webkit.json rename to tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/image-internal-webkit.json diff --git a/tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/separator-internal-chromium.json b/tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/separator-internal-chromium.json similarity index 100% rename from tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/separator-internal-chromium.json rename to tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/separator-internal-chromium.json diff --git a/tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/separator-internal-firefox.json b/tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/separator-internal-firefox.json similarity index 100% rename from tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/separator-internal-firefox.json rename to tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/separator-internal-firefox.json diff --git a/tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/separator-internal-webkit.json b/tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/separator-internal-webkit.json similarity index 100% rename from tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/separator-internal-webkit.json rename to tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/separator-internal-webkit.json diff --git a/tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/toc-internal-chromium.json b/tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/toc-internal-chromium.json similarity index 100% rename from tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/toc-internal-chromium.json rename to tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/toc-internal-chromium.json diff --git a/tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/toc-internal-firefox.json b/tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/toc-internal-firefox.json similarity index 100% rename from tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/toc-internal-firefox.json rename to tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/toc-internal-firefox.json diff --git a/tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/toc-internal-webkit.json b/tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/toc-internal-webkit.json similarity index 100% rename from tests/component/snapshots/copypaste-internal.spec.tsx-snapshots/toc-internal-webkit.json rename to tests/src/component/snapshots/copypaste-internal.spec.tsx-snapshots/toc-internal-webkit.json diff --git a/tests/end-to-end/basics/basics.test.ts b/tests/src/end-to-end/basics/basics.test.ts similarity index 100% rename from tests/end-to-end/basics/basics.test.ts rename to tests/src/end-to-end/basics/basics.test.ts diff --git a/tests/end-to-end/colors/colors.test.ts b/tests/src/end-to-end/colors/colors.test.ts similarity index 97% rename from tests/end-to-end/colors/colors.test.ts rename to tests/src/end-to-end/colors/colors.test.ts index 101beb79b6..59f2998942 100644 --- a/tests/end-to-end/colors/colors.test.ts +++ b/tests/src/end-to-end/colors/colors.test.ts @@ -1,3 +1,4 @@ +import { expect } from "@playwright/test"; import { test } from "../../setup/setupScript"; import { BACKGROUND_COLOR_SELECTOR, @@ -8,9 +9,8 @@ import { H_TWO_BLOCK_SELECTOR, TEXT_COLOR_SELECTOR, } from "../../utils/const"; -import { focusOnEditor } from "../../utils/editor"; import { insertHeading, insertParagraph } from "../../utils/copypaste"; -import { expect } from "@playwright/test"; +import { focusOnEditor } from "../../utils/editor"; test.beforeEach(async ({ page }) => { await page.goto(BASE_URL, { waitUntil: "networkidle" }); @@ -76,7 +76,7 @@ test.describe("Check Background & Text Color Functionality", () => { await page.hover("text=Colors"); const element = await page.locator(TEXT_COLOR_SELECTOR("red")); - const boundingBox = await element.boundingBox(); + const boundingBox = (await element.boundingBox())!; const { x, y } = boundingBox; await page.mouse.click(x + 10, y + 10); @@ -100,7 +100,7 @@ test.describe("Check Background & Text Color Functionality", () => { await page.hover("text=Colors"); const element = await page.locator(BACKGROUND_COLOR_SELECTOR("red")); - const boundingBox = await element.boundingBox(); + const boundingBox = (await element.boundingBox())!; const { x, y } = boundingBox; await page.mouse.click(x + 10, y + 10); diff --git a/tests/end-to-end/colors/colors.test.ts-snapshots/backgroundColorMark-chromium-linux.png b/tests/src/end-to-end/colors/colors.test.ts-snapshots/backgroundColorMark-chromium-linux.png similarity index 100% rename from tests/end-to-end/colors/colors.test.ts-snapshots/backgroundColorMark-chromium-linux.png rename to tests/src/end-to-end/colors/colors.test.ts-snapshots/backgroundColorMark-chromium-linux.png diff --git a/tests/end-to-end/colors/colors.test.ts-snapshots/backgroundColorMark-firefox-linux.png b/tests/src/end-to-end/colors/colors.test.ts-snapshots/backgroundColorMark-firefox-linux.png similarity index 100% rename from tests/end-to-end/colors/colors.test.ts-snapshots/backgroundColorMark-firefox-linux.png rename to tests/src/end-to-end/colors/colors.test.ts-snapshots/backgroundColorMark-firefox-linux.png diff --git a/tests/end-to-end/colors/colors.test.ts-snapshots/backgroundColorMark-webkit-linux.png b/tests/src/end-to-end/colors/colors.test.ts-snapshots/backgroundColorMark-webkit-linux.png similarity index 100% rename from tests/end-to-end/colors/colors.test.ts-snapshots/backgroundColorMark-webkit-linux.png rename to tests/src/end-to-end/colors/colors.test.ts-snapshots/backgroundColorMark-webkit-linux.png diff --git a/tests/end-to-end/colors/colors.test.ts-snapshots/blockBackgroundColor-chromium-linux.png b/tests/src/end-to-end/colors/colors.test.ts-snapshots/blockBackgroundColor-chromium-linux.png similarity index 100% rename from tests/end-to-end/colors/colors.test.ts-snapshots/blockBackgroundColor-chromium-linux.png rename to tests/src/end-to-end/colors/colors.test.ts-snapshots/blockBackgroundColor-chromium-linux.png diff --git a/tests/end-to-end/colors/colors.test.ts-snapshots/blockBackgroundColor-firefox-linux.png b/tests/src/end-to-end/colors/colors.test.ts-snapshots/blockBackgroundColor-firefox-linux.png similarity index 100% rename from tests/end-to-end/colors/colors.test.ts-snapshots/blockBackgroundColor-firefox-linux.png rename to tests/src/end-to-end/colors/colors.test.ts-snapshots/blockBackgroundColor-firefox-linux.png diff --git a/tests/end-to-end/colors/colors.test.ts-snapshots/blockBackgroundColor-webkit-linux.png b/tests/src/end-to-end/colors/colors.test.ts-snapshots/blockBackgroundColor-webkit-linux.png similarity index 100% rename from tests/end-to-end/colors/colors.test.ts-snapshots/blockBackgroundColor-webkit-linux.png rename to tests/src/end-to-end/colors/colors.test.ts-snapshots/blockBackgroundColor-webkit-linux.png diff --git a/tests/end-to-end/colors/colors.test.ts-snapshots/blockTextColor-chromium-linux.png b/tests/src/end-to-end/colors/colors.test.ts-snapshots/blockTextColor-chromium-linux.png similarity index 100% rename from tests/end-to-end/colors/colors.test.ts-snapshots/blockTextColor-chromium-linux.png rename to tests/src/end-to-end/colors/colors.test.ts-snapshots/blockTextColor-chromium-linux.png diff --git a/tests/end-to-end/colors/colors.test.ts-snapshots/blockTextColor-firefox-linux.png b/tests/src/end-to-end/colors/colors.test.ts-snapshots/blockTextColor-firefox-linux.png similarity index 100% rename from tests/end-to-end/colors/colors.test.ts-snapshots/blockTextColor-firefox-linux.png rename to tests/src/end-to-end/colors/colors.test.ts-snapshots/blockTextColor-firefox-linux.png diff --git a/tests/end-to-end/colors/colors.test.ts-snapshots/blockTextColor-webkit-linux.png b/tests/src/end-to-end/colors/colors.test.ts-snapshots/blockTextColor-webkit-linux.png similarity index 100% rename from tests/end-to-end/colors/colors.test.ts-snapshots/blockTextColor-webkit-linux.png rename to tests/src/end-to-end/colors/colors.test.ts-snapshots/blockTextColor-webkit-linux.png diff --git a/tests/end-to-end/colors/colors.test.ts-snapshots/textColorMark-chromium-linux.png b/tests/src/end-to-end/colors/colors.test.ts-snapshots/textColorMark-chromium-linux.png similarity index 100% rename from tests/end-to-end/colors/colors.test.ts-snapshots/textColorMark-chromium-linux.png rename to tests/src/end-to-end/colors/colors.test.ts-snapshots/textColorMark-chromium-linux.png diff --git a/tests/end-to-end/colors/colors.test.ts-snapshots/textColorMark-firefox-linux.png b/tests/src/end-to-end/colors/colors.test.ts-snapshots/textColorMark-firefox-linux.png similarity index 100% rename from tests/end-to-end/colors/colors.test.ts-snapshots/textColorMark-firefox-linux.png rename to tests/src/end-to-end/colors/colors.test.ts-snapshots/textColorMark-firefox-linux.png diff --git a/tests/end-to-end/colors/colors.test.ts-snapshots/textColorMark-webkit-linux.png b/tests/src/end-to-end/colors/colors.test.ts-snapshots/textColorMark-webkit-linux.png similarity index 100% rename from tests/end-to-end/colors/colors.test.ts-snapshots/textColorMark-webkit-linux.png rename to tests/src/end-to-end/colors/colors.test.ts-snapshots/textColorMark-webkit-linux.png diff --git a/tests/end-to-end/copypaste/copypaste.test.ts b/tests/src/end-to-end/copypaste/copypaste.test.ts similarity index 98% rename from tests/end-to-end/copypaste/copypaste.test.ts rename to tests/src/end-to-end/copypaste/copypaste.test.ts index f4563a2c23..d39c357210 100644 --- a/tests/end-to-end/copypaste/copypaste.test.ts +++ b/tests/src/end-to-end/copypaste/copypaste.test.ts @@ -1,14 +1,15 @@ +/* eslint-disable jest/valid-title */ import { test } from "../../setup/setupScript"; import { BASE_URL } from "../../utils/const"; -import { compareDocToSnapshot, focusOnEditor } from "../../utils/editor"; import { copyPasteAll, insertHeading, - startList, insertListItems, insertNestedListItems, insertParagraph, + startList, } from "../../utils/copypaste"; +import { compareDocToSnapshot, focusOnEditor } from "../../utils/editor"; import { executeSlashCommand } from "../../utils/slashmenu"; test.describe.configure({ mode: "serial" }); @@ -164,7 +165,7 @@ test.describe("Check Copy/Paste Functionality", () => { const resizeHandle = page.locator( `[class*="bn-image-resize-handle"][style*="right"]` ); - const resizeHandleBoundingBox = await resizeHandle.boundingBox(); + const resizeHandleBoundingBox = (await resizeHandle.boundingBox())!; await page.mouse.move( resizeHandleBoundingBox.x + resizeHandleBoundingBox.width / 2, resizeHandleBoundingBox.y + resizeHandleBoundingBox.height / 2, diff --git a/tests/end-to-end/copypaste/copypaste.test.ts-snapshots/headings-json-chromium-linux.json b/tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/headings-json-chromium-linux.json similarity index 100% rename from tests/end-to-end/copypaste/copypaste.test.ts-snapshots/headings-json-chromium-linux.json rename to tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/headings-json-chromium-linux.json diff --git a/tests/end-to-end/copypaste/copypaste.test.ts-snapshots/headings-json-webkit-linux.json b/tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/headings-json-webkit-linux.json similarity index 100% rename from tests/end-to-end/copypaste/copypaste.test.ts-snapshots/headings-json-webkit-linux.json rename to tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/headings-json-webkit-linux.json diff --git a/tests/end-to-end/copypaste/copypaste.test.ts-snapshots/images-json-chromium-linux.json b/tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/images-json-chromium-linux.json similarity index 96% rename from tests/end-to-end/copypaste/copypaste.test.ts-snapshots/images-json-chromium-linux.json rename to tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/images-json-chromium-linux.json index 8ddb0e9f23..04c7045205 100644 --- a/tests/end-to-end/copypaste/copypaste.test.ts-snapshots/images-json-chromium-linux.json +++ b/tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/images-json-chromium-linux.json @@ -38,7 +38,6 @@ "type": "image", "attrs": { "textAlignment": "left", - "backgroundColor": "default", "url": "https://www.pulsecarshalton.co.uk/wp-content/uploads/2016/08/jk-placeholder-image.jpg", "caption": "", "width": 462 @@ -96,7 +95,6 @@ "type": "image", "attrs": { "textAlignment": "left", - "backgroundColor": "default", "url": "https://www.pulsecarshalton.co.uk/wp-content/uploads/2016/08/jk-placeholder-image.jpg", "caption": "", "width": 462 diff --git a/tests/end-to-end/copypaste/copypaste.test.ts-snapshots/nestedOrderedLists-json-chromium-linux.json b/tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/nestedOrderedLists-json-chromium-linux.json similarity index 100% rename from tests/end-to-end/copypaste/copypaste.test.ts-snapshots/nestedOrderedLists-json-chromium-linux.json rename to tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/nestedOrderedLists-json-chromium-linux.json diff --git a/tests/end-to-end/copypaste/copypaste.test.ts-snapshots/nestedOrderedLists-json-webkit-linux.json b/tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/nestedOrderedLists-json-webkit-linux.json similarity index 100% rename from tests/end-to-end/copypaste/copypaste.test.ts-snapshots/nestedOrderedLists-json-webkit-linux.json rename to tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/nestedOrderedLists-json-webkit-linux.json diff --git a/tests/end-to-end/copypaste/copypaste.test.ts-snapshots/nestedParagraphs-json-chromium-linux.json b/tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/nestedParagraphs-json-chromium-linux.json similarity index 100% rename from tests/end-to-end/copypaste/copypaste.test.ts-snapshots/nestedParagraphs-json-chromium-linux.json rename to tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/nestedParagraphs-json-chromium-linux.json diff --git a/tests/end-to-end/copypaste/copypaste.test.ts-snapshots/nestedParagraphs-json-webkit-linux.json b/tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/nestedParagraphs-json-webkit-linux.json similarity index 100% rename from tests/end-to-end/copypaste/copypaste.test.ts-snapshots/nestedParagraphs-json-webkit-linux.json rename to tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/nestedParagraphs-json-webkit-linux.json diff --git a/tests/end-to-end/copypaste/copypaste.test.ts-snapshots/nestedUnorderedLists-json-chromium-linux.json b/tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/nestedUnorderedLists-json-chromium-linux.json similarity index 100% rename from tests/end-to-end/copypaste/copypaste.test.ts-snapshots/nestedUnorderedLists-json-chromium-linux.json rename to tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/nestedUnorderedLists-json-chromium-linux.json diff --git a/tests/end-to-end/copypaste/copypaste.test.ts-snapshots/nestedUnorderedLists-json-webkit-linux.json b/tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/nestedUnorderedLists-json-webkit-linux.json similarity index 100% rename from tests/end-to-end/copypaste/copypaste.test.ts-snapshots/nestedUnorderedLists-json-webkit-linux.json rename to tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/nestedUnorderedLists-json-webkit-linux.json diff --git a/tests/end-to-end/copypaste/copypaste.test.ts-snapshots/orderedLists-json-chromium-linux.json b/tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/orderedLists-json-chromium-linux.json similarity index 100% rename from tests/end-to-end/copypaste/copypaste.test.ts-snapshots/orderedLists-json-chromium-linux.json rename to tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/orderedLists-json-chromium-linux.json diff --git a/tests/end-to-end/copypaste/copypaste.test.ts-snapshots/orderedLists-json-webkit-linux.json b/tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/orderedLists-json-webkit-linux.json similarity index 100% rename from tests/end-to-end/copypaste/copypaste.test.ts-snapshots/orderedLists-json-webkit-linux.json rename to tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/orderedLists-json-webkit-linux.json diff --git a/tests/end-to-end/copypaste/copypaste.test.ts-snapshots/paragraphs-json-chromium-linux.json b/tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/paragraphs-json-chromium-linux.json similarity index 100% rename from tests/end-to-end/copypaste/copypaste.test.ts-snapshots/paragraphs-json-chromium-linux.json rename to tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/paragraphs-json-chromium-linux.json diff --git a/tests/end-to-end/copypaste/copypaste.test.ts-snapshots/paragraphs-json-webkit-linux.json b/tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/paragraphs-json-webkit-linux.json similarity index 100% rename from tests/end-to-end/copypaste/copypaste.test.ts-snapshots/paragraphs-json-webkit-linux.json rename to tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/paragraphs-json-webkit-linux.json diff --git a/tests/end-to-end/copypaste/copypaste.test.ts-snapshots/unorderedLists-json-chromium-linux.json b/tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/unorderedLists-json-chromium-linux.json similarity index 100% rename from tests/end-to-end/copypaste/copypaste.test.ts-snapshots/unorderedLists-json-chromium-linux.json rename to tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/unorderedLists-json-chromium-linux.json diff --git a/tests/end-to-end/copypaste/copypaste.test.ts-snapshots/unorderedLists-json-webkit-linux.json b/tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/unorderedLists-json-webkit-linux.json similarity index 100% rename from tests/end-to-end/copypaste/copypaste.test.ts-snapshots/unorderedLists-json-webkit-linux.json rename to tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/unorderedLists-json-webkit-linux.json diff --git a/tests/end-to-end/dragdrop/dragdrop.test.ts b/tests/src/end-to-end/dragdrop/dragdrop.test.ts similarity index 100% rename from tests/end-to-end/dragdrop/dragdrop.test.ts rename to tests/src/end-to-end/dragdrop/dragdrop.test.ts diff --git a/tests/end-to-end/dragdrop/dragdrop.test.ts-snapshots/dragdropnested-chromium-linux.json b/tests/src/end-to-end/dragdrop/dragdrop.test.ts-snapshots/dragdropnested-chromium-linux.json similarity index 100% rename from tests/end-to-end/dragdrop/dragdrop.test.ts-snapshots/dragdropnested-chromium-linux.json rename to tests/src/end-to-end/dragdrop/dragdrop.test.ts-snapshots/dragdropnested-chromium-linux.json diff --git a/tests/end-to-end/dragdrop/dragdrop.test.ts-snapshots/dragdropnested-webkit-linux.json b/tests/src/end-to-end/dragdrop/dragdrop.test.ts-snapshots/dragdropnested-webkit-linux.json similarity index 100% rename from tests/end-to-end/dragdrop/dragdrop.test.ts-snapshots/dragdropnested-webkit-linux.json rename to tests/src/end-to-end/dragdrop/dragdrop.test.ts-snapshots/dragdropnested-webkit-linux.json diff --git a/tests/end-to-end/dragdrop/dragdrop.test.ts-snapshots/dragdropsingle-chromium-linux.json b/tests/src/end-to-end/dragdrop/dragdrop.test.ts-snapshots/dragdropsingle-chromium-linux.json similarity index 100% rename from tests/end-to-end/dragdrop/dragdrop.test.ts-snapshots/dragdropsingle-chromium-linux.json rename to tests/src/end-to-end/dragdrop/dragdrop.test.ts-snapshots/dragdropsingle-chromium-linux.json diff --git a/tests/end-to-end/dragdrop/dragdrop.test.ts-snapshots/dragdropsingle-webkit-linux.json b/tests/src/end-to-end/dragdrop/dragdrop.test.ts-snapshots/dragdropsingle-webkit-linux.json similarity index 100% rename from tests/end-to-end/dragdrop/dragdrop.test.ts-snapshots/dragdropsingle-webkit-linux.json rename to tests/src/end-to-end/dragdrop/dragdrop.test.ts-snapshots/dragdropsingle-webkit-linux.json diff --git a/tests/end-to-end/draghandle/draghandle.test.ts b/tests/src/end-to-end/draghandle/draghandle.test.ts similarity index 100% rename from tests/end-to-end/draghandle/draghandle.test.ts rename to tests/src/end-to-end/draghandle/draghandle.test.ts diff --git a/tests/end-to-end/draghandle/draghandle.test.ts-snapshots/addnonselectedemptyblock-chromium-linux.json b/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/addnonselectedemptyblock-chromium-linux.json similarity index 100% rename from tests/end-to-end/draghandle/draghandle.test.ts-snapshots/addnonselectedemptyblock-chromium-linux.json rename to tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/addnonselectedemptyblock-chromium-linux.json diff --git a/tests/end-to-end/draghandle/draghandle.test.ts-snapshots/addnonselectedemptyblock-firefox-linux.json b/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/addnonselectedemptyblock-firefox-linux.json similarity index 100% rename from tests/end-to-end/draghandle/draghandle.test.ts-snapshots/addnonselectedemptyblock-firefox-linux.json rename to tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/addnonselectedemptyblock-firefox-linux.json diff --git a/tests/end-to-end/draghandle/draghandle.test.ts-snapshots/addnonselectedemptyblock-webkit-linux.json b/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/addnonselectedemptyblock-webkit-linux.json similarity index 100% rename from tests/end-to-end/draghandle/draghandle.test.ts-snapshots/addnonselectedemptyblock-webkit-linux.json rename to tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/addnonselectedemptyblock-webkit-linux.json diff --git a/tests/end-to-end/draghandle/draghandle.test.ts-snapshots/dragHandleDocStructure-chromium-linux.json b/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/dragHandleDocStructure-chromium-linux.json similarity index 100% rename from tests/end-to-end/draghandle/draghandle.test.ts-snapshots/dragHandleDocStructure-chromium-linux.json rename to tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/dragHandleDocStructure-chromium-linux.json diff --git a/tests/end-to-end/draghandle/draghandle.test.ts-snapshots/dragHandleDocStructure-firefox-linux.json b/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/dragHandleDocStructure-firefox-linux.json similarity index 100% rename from tests/end-to-end/draghandle/draghandle.test.ts-snapshots/dragHandleDocStructure-firefox-linux.json rename to tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/dragHandleDocStructure-firefox-linux.json diff --git a/tests/end-to-end/draghandle/draghandle.test.ts-snapshots/dragHandleDocStructure-webkit-linux.json b/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/dragHandleDocStructure-webkit-linux.json similarity index 100% rename from tests/end-to-end/draghandle/draghandle.test.ts-snapshots/dragHandleDocStructure-webkit-linux.json rename to tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/dragHandleDocStructure-webkit-linux.json diff --git a/tests/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandleadd-chromium-linux.json b/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandleadd-chromium-linux.json similarity index 100% rename from tests/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandleadd-chromium-linux.json rename to tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandleadd-chromium-linux.json diff --git a/tests/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandleadd-firefox-linux.json b/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandleadd-firefox-linux.json similarity index 100% rename from tests/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandleadd-firefox-linux.json rename to tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandleadd-firefox-linux.json diff --git a/tests/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandleadd-webkit-linux.json b/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandleadd-webkit-linux.json similarity index 100% rename from tests/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandleadd-webkit-linux.json rename to tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandleadd-webkit-linux.json diff --git a/tests/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandledelete-chromium-linux.json b/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandledelete-chromium-linux.json similarity index 100% rename from tests/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandledelete-chromium-linux.json rename to tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandledelete-chromium-linux.json diff --git a/tests/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandledelete-firefox-linux.json b/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandledelete-firefox-linux.json similarity index 100% rename from tests/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandledelete-firefox-linux.json rename to tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandledelete-firefox-linux.json diff --git a/tests/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandledelete-webkit-linux.json b/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandledelete-webkit-linux.json similarity index 100% rename from tests/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandledelete-webkit-linux.json rename to tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandledelete-webkit-linux.json diff --git a/tests/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandlemenu-chromium-linux.png b/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandlemenu-chromium-linux.png similarity index 100% rename from tests/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandlemenu-chromium-linux.png rename to tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandlemenu-chromium-linux.png diff --git a/tests/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandlemenu-firefox-linux.png b/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandlemenu-firefox-linux.png similarity index 100% rename from tests/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandlemenu-firefox-linux.png rename to tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandlemenu-firefox-linux.png diff --git a/tests/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandlemenu-webkit-linux.png b/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandlemenu-webkit-linux.png similarity index 100% rename from tests/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandlemenu-webkit-linux.png rename to tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandlemenu-webkit-linux.png diff --git a/tests/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandlenesteddelete-chromium-linux.json b/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandlenesteddelete-chromium-linux.json similarity index 100% rename from tests/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandlenesteddelete-chromium-linux.json rename to tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandlenesteddelete-chromium-linux.json diff --git a/tests/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandlenesteddelete-firefox-linux.json b/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandlenesteddelete-firefox-linux.json similarity index 100% rename from tests/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandlenesteddelete-firefox-linux.json rename to tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandlenesteddelete-firefox-linux.json diff --git a/tests/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandlenesteddelete-webkit-linux.json b/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandlenesteddelete-webkit-linux.json similarity index 100% rename from tests/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandlenesteddelete-webkit-linux.json rename to tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandlenesteddelete-webkit-linux.json diff --git a/tests/end-to-end/images/images.test.ts b/tests/src/end-to-end/images/images.test.ts similarity index 95% rename from tests/end-to-end/images/images.test.ts rename to tests/src/end-to-end/images/images.test.ts index b4ed873c4d..e4df321a94 100644 --- a/tests/end-to-end/images/images.test.ts +++ b/tests/src/end-to-end/images/images.test.ts @@ -1,16 +1,16 @@ +import { FileChooser, expect } from "@playwright/test"; import { test } from "../../setup/setupScript"; import { BASE_URL, H_ONE_BLOCK_SELECTOR, IMAGE_SELECTOR, } from "../../utils/const"; +import { insertHeading } from "../../utils/copypaste"; import { compareDocToSnapshot, focusOnEditor } from "../../utils/editor"; -import { expect, FileChooser } from "@playwright/test"; import { dragAndDropBlock } from "../../utils/mouse"; import { executeSlashCommand } from "../../utils/slashmenu"; -import { insertHeading } from "../../utils/copypaste"; -const IMAGE_UPLOAD_PATH = "tests/end-to-end/images/placeholder.png"; +const IMAGE_UPLOAD_PATH = "src/end-to-end/images/placeholder.png"; const IMAGE_EMBED_URL = "https://www.pulsecarshalton.co.uk/wp-content/uploads/2016/08/jk-placeholder-image.jpg"; @@ -76,7 +76,7 @@ test.describe("Check Image Block and Toolbar functionality", () => { const resizeHandle = page.locator( `[class*="bn-image-resize-handle"][style*="right"]` ); - const resizeHandleBoundingBox = await resizeHandle.boundingBox(); + const resizeHandleBoundingBox = (await resizeHandle.boundingBox())!; await page.mouse.move( resizeHandleBoundingBox.x + resizeHandleBoundingBox.width / 2, resizeHandleBoundingBox.y + resizeHandleBoundingBox.height / 2, diff --git a/tests/end-to-end/images/images.test.ts-snapshots/create-image-chromium-linux.png b/tests/src/end-to-end/images/images.test.ts-snapshots/create-image-chromium-linux.png similarity index 100% rename from tests/end-to-end/images/images.test.ts-snapshots/create-image-chromium-linux.png rename to tests/src/end-to-end/images/images.test.ts-snapshots/create-image-chromium-linux.png diff --git a/tests/end-to-end/images/images.test.ts-snapshots/create-image-firefox-linux.png b/tests/src/end-to-end/images/images.test.ts-snapshots/create-image-firefox-linux.png similarity index 100% rename from tests/end-to-end/images/images.test.ts-snapshots/create-image-firefox-linux.png rename to tests/src/end-to-end/images/images.test.ts-snapshots/create-image-firefox-linux.png diff --git a/tests/end-to-end/images/images.test.ts-snapshots/create-image-webkit-linux.png b/tests/src/end-to-end/images/images.test.ts-snapshots/create-image-webkit-linux.png similarity index 100% rename from tests/end-to-end/images/images.test.ts-snapshots/create-image-webkit-linux.png rename to tests/src/end-to-end/images/images.test.ts-snapshots/create-image-webkit-linux.png diff --git a/tests/end-to-end/images/images.test.ts-snapshots/createImage-chromium-linux.json b/tests/src/end-to-end/images/images.test.ts-snapshots/createImage-chromium-linux.json similarity index 100% rename from tests/end-to-end/images/images.test.ts-snapshots/createImage-chromium-linux.json rename to tests/src/end-to-end/images/images.test.ts-snapshots/createImage-chromium-linux.json diff --git a/tests/end-to-end/images/images.test.ts-snapshots/createImage-firefox-linux.json b/tests/src/end-to-end/images/images.test.ts-snapshots/createImage-firefox-linux.json similarity index 100% rename from tests/end-to-end/images/images.test.ts-snapshots/createImage-firefox-linux.json rename to tests/src/end-to-end/images/images.test.ts-snapshots/createImage-firefox-linux.json diff --git a/tests/end-to-end/images/images.test.ts-snapshots/createImage-webkit-linux.json b/tests/src/end-to-end/images/images.test.ts-snapshots/createImage-webkit-linux.json similarity index 100% rename from tests/end-to-end/images/images.test.ts-snapshots/createImage-webkit-linux.json rename to tests/src/end-to-end/images/images.test.ts-snapshots/createImage-webkit-linux.json diff --git a/tests/end-to-end/images/images.test.ts-snapshots/deleteImage-chromium-linux.json b/tests/src/end-to-end/images/images.test.ts-snapshots/deleteImage-chromium-linux.json similarity index 100% rename from tests/end-to-end/images/images.test.ts-snapshots/deleteImage-chromium-linux.json rename to tests/src/end-to-end/images/images.test.ts-snapshots/deleteImage-chromium-linux.json diff --git a/tests/end-to-end/images/images.test.ts-snapshots/deleteImage-firefox-linux.json b/tests/src/end-to-end/images/images.test.ts-snapshots/deleteImage-firefox-linux.json similarity index 100% rename from tests/end-to-end/images/images.test.ts-snapshots/deleteImage-firefox-linux.json rename to tests/src/end-to-end/images/images.test.ts-snapshots/deleteImage-firefox-linux.json diff --git a/tests/end-to-end/images/images.test.ts-snapshots/deleteImage-webkit-linux.json b/tests/src/end-to-end/images/images.test.ts-snapshots/deleteImage-webkit-linux.json similarity index 100% rename from tests/end-to-end/images/images.test.ts-snapshots/deleteImage-webkit-linux.json rename to tests/src/end-to-end/images/images.test.ts-snapshots/deleteImage-webkit-linux.json diff --git a/tests/end-to-end/images/images.test.ts-snapshots/dragImage-chromium-linux.json b/tests/src/end-to-end/images/images.test.ts-snapshots/dragImage-chromium-linux.json similarity index 100% rename from tests/end-to-end/images/images.test.ts-snapshots/dragImage-chromium-linux.json rename to tests/src/end-to-end/images/images.test.ts-snapshots/dragImage-chromium-linux.json diff --git a/tests/end-to-end/images/images.test.ts-snapshots/dragImage-firefox-linux.json b/tests/src/end-to-end/images/images.test.ts-snapshots/dragImage-firefox-linux.json similarity index 100% rename from tests/end-to-end/images/images.test.ts-snapshots/dragImage-firefox-linux.json rename to tests/src/end-to-end/images/images.test.ts-snapshots/dragImage-firefox-linux.json diff --git a/tests/end-to-end/images/images.test.ts-snapshots/dragImage-webkit-linux.json b/tests/src/end-to-end/images/images.test.ts-snapshots/dragImage-webkit-linux.json similarity index 100% rename from tests/end-to-end/images/images.test.ts-snapshots/dragImage-webkit-linux.json rename to tests/src/end-to-end/images/images.test.ts-snapshots/dragImage-webkit-linux.json diff --git a/tests/end-to-end/images/images.test.ts-snapshots/embed-image-chromium-linux.png b/tests/src/end-to-end/images/images.test.ts-snapshots/embed-image-chromium-linux.png similarity index 100% rename from tests/end-to-end/images/images.test.ts-snapshots/embed-image-chromium-linux.png rename to tests/src/end-to-end/images/images.test.ts-snapshots/embed-image-chromium-linux.png diff --git a/tests/end-to-end/images/images.test.ts-snapshots/embed-image-firefox-linux.png b/tests/src/end-to-end/images/images.test.ts-snapshots/embed-image-firefox-linux.png similarity index 100% rename from tests/end-to-end/images/images.test.ts-snapshots/embed-image-firefox-linux.png rename to tests/src/end-to-end/images/images.test.ts-snapshots/embed-image-firefox-linux.png diff --git a/tests/end-to-end/images/images.test.ts-snapshots/embed-image-webkit-linux.png b/tests/src/end-to-end/images/images.test.ts-snapshots/embed-image-webkit-linux.png similarity index 100% rename from tests/end-to-end/images/images.test.ts-snapshots/embed-image-webkit-linux.png rename to tests/src/end-to-end/images/images.test.ts-snapshots/embed-image-webkit-linux.png diff --git a/tests/end-to-end/images/images.test.ts-snapshots/embedImage-chromium-linux.json b/tests/src/end-to-end/images/images.test.ts-snapshots/embedImage-chromium-linux.json similarity index 100% rename from tests/end-to-end/images/images.test.ts-snapshots/embedImage-chromium-linux.json rename to tests/src/end-to-end/images/images.test.ts-snapshots/embedImage-chromium-linux.json diff --git a/tests/end-to-end/images/images.test.ts-snapshots/embedImage-firefox-linux.json b/tests/src/end-to-end/images/images.test.ts-snapshots/embedImage-firefox-linux.json similarity index 100% rename from tests/end-to-end/images/images.test.ts-snapshots/embedImage-firefox-linux.json rename to tests/src/end-to-end/images/images.test.ts-snapshots/embedImage-firefox-linux.json diff --git a/tests/end-to-end/images/images.test.ts-snapshots/embedImage-webkit-linux.json b/tests/src/end-to-end/images/images.test.ts-snapshots/embedImage-webkit-linux.json similarity index 100% rename from tests/end-to-end/images/images.test.ts-snapshots/embedImage-webkit-linux.json rename to tests/src/end-to-end/images/images.test.ts-snapshots/embedImage-webkit-linux.json diff --git a/tests/end-to-end/images/images.test.ts-snapshots/resize-image-chromium-linux.png b/tests/src/end-to-end/images/images.test.ts-snapshots/resize-image-chromium-linux.png similarity index 100% rename from tests/end-to-end/images/images.test.ts-snapshots/resize-image-chromium-linux.png rename to tests/src/end-to-end/images/images.test.ts-snapshots/resize-image-chromium-linux.png diff --git a/tests/end-to-end/images/images.test.ts-snapshots/resize-image-firefox-linux.png b/tests/src/end-to-end/images/images.test.ts-snapshots/resize-image-firefox-linux.png similarity index 100% rename from tests/end-to-end/images/images.test.ts-snapshots/resize-image-firefox-linux.png rename to tests/src/end-to-end/images/images.test.ts-snapshots/resize-image-firefox-linux.png diff --git a/tests/end-to-end/images/images.test.ts-snapshots/resize-image-webkit-linux.png b/tests/src/end-to-end/images/images.test.ts-snapshots/resize-image-webkit-linux.png similarity index 100% rename from tests/end-to-end/images/images.test.ts-snapshots/resize-image-webkit-linux.png rename to tests/src/end-to-end/images/images.test.ts-snapshots/resize-image-webkit-linux.png diff --git a/tests/end-to-end/images/images.test.ts-snapshots/resizeImage-chromium-linux.json b/tests/src/end-to-end/images/images.test.ts-snapshots/resizeImage-chromium-linux.json similarity index 100% rename from tests/end-to-end/images/images.test.ts-snapshots/resizeImage-chromium-linux.json rename to tests/src/end-to-end/images/images.test.ts-snapshots/resizeImage-chromium-linux.json diff --git a/tests/end-to-end/images/images.test.ts-snapshots/resizeImage-firefox-linux.json b/tests/src/end-to-end/images/images.test.ts-snapshots/resizeImage-firefox-linux.json similarity index 100% rename from tests/end-to-end/images/images.test.ts-snapshots/resizeImage-firefox-linux.json rename to tests/src/end-to-end/images/images.test.ts-snapshots/resizeImage-firefox-linux.json diff --git a/tests/end-to-end/images/images.test.ts-snapshots/resizeImage-webkit-linux.json b/tests/src/end-to-end/images/images.test.ts-snapshots/resizeImage-webkit-linux.json similarity index 100% rename from tests/end-to-end/images/images.test.ts-snapshots/resizeImage-webkit-linux.json rename to tests/src/end-to-end/images/images.test.ts-snapshots/resizeImage-webkit-linux.json diff --git a/tests/end-to-end/images/images.test.ts-snapshots/upload-image-chromium-linux.png b/tests/src/end-to-end/images/images.test.ts-snapshots/upload-image-chromium-linux.png similarity index 100% rename from tests/end-to-end/images/images.test.ts-snapshots/upload-image-chromium-linux.png rename to tests/src/end-to-end/images/images.test.ts-snapshots/upload-image-chromium-linux.png diff --git a/tests/end-to-end/images/images.test.ts-snapshots/upload-image-firefox-linux.png b/tests/src/end-to-end/images/images.test.ts-snapshots/upload-image-firefox-linux.png similarity index 100% rename from tests/end-to-end/images/images.test.ts-snapshots/upload-image-firefox-linux.png rename to tests/src/end-to-end/images/images.test.ts-snapshots/upload-image-firefox-linux.png diff --git a/tests/end-to-end/images/images.test.ts-snapshots/upload-image-webkit-linux.png b/tests/src/end-to-end/images/images.test.ts-snapshots/upload-image-webkit-linux.png similarity index 100% rename from tests/end-to-end/images/images.test.ts-snapshots/upload-image-webkit-linux.png rename to tests/src/end-to-end/images/images.test.ts-snapshots/upload-image-webkit-linux.png diff --git a/tests/end-to-end/images/placeholder.png b/tests/src/end-to-end/images/placeholder.png similarity index 100% rename from tests/end-to-end/images/placeholder.png rename to tests/src/end-to-end/images/placeholder.png diff --git a/tests/end-to-end/indentation/indentation.test.ts b/tests/src/end-to-end/indentation/indentation.test.ts similarity index 92% rename from tests/end-to-end/indentation/indentation.test.ts rename to tests/src/end-to-end/indentation/indentation.test.ts index 46916c415b..bee2e72d1a 100644 --- a/tests/end-to-end/indentation/indentation.test.ts +++ b/tests/src/end-to-end/indentation/indentation.test.ts @@ -1,13 +1,13 @@ import { test } from "../../setup/setupScript"; import { BASE_URL, - UNNEST_BLOCK_BUTTON_SELECTOR, H_THREE_BLOCK_SELECTOR, H_TWO_BLOCK_SELECTOR, NEST_BLOCK_BUTTON_SELECTOR, + UNNEST_BLOCK_BUTTON_SELECTOR, } from "../../utils/const"; -import { compareDocToSnapshot, focusOnEditor } from "../../utils/editor"; import { insertHeading, insertParagraph } from "../../utils/copypaste"; +import { compareDocToSnapshot, focusOnEditor } from "../../utils/editor"; test.beforeEach(async ({ page }) => { await page.goto(BASE_URL, { waitUntil: "networkidle" }); @@ -28,7 +28,7 @@ test.describe("Check Block Indentation Functionality", () => { await insertHeading(page, 3); const element = await page.locator(H_TWO_BLOCK_SELECTOR); - const boundingBox = await element.boundingBox(); + const boundingBox = (await element.boundingBox())!; const { x, y, height } = boundingBox; await page.mouse.click(x + 10, y + height / 2, { clickCount: 2 }); @@ -57,7 +57,7 @@ test.describe("Check Block Indentation Functionality", () => { await insertHeading(page, 3); const element = await page.locator(H_TWO_BLOCK_SELECTOR); - const boundingBox = await element.boundingBox(); + const boundingBox = (await element.boundingBox())!; const { x, y, height } = boundingBox; await page.mouse.click(x + 10, y + height / 2, { clickCount: 2 }); @@ -86,14 +86,14 @@ test.describe("Check Block Indentation Functionality", () => { await insertHeading(page, 3); const firstElement = await page.locator(H_TWO_BLOCK_SELECTOR); - const firstElementBoundingBox = await firstElement.boundingBox(); + const firstElementBoundingBox = (await firstElement.boundingBox())!; await page.mouse.click( firstElementBoundingBox.x + 20, firstElementBoundingBox.y + firstElementBoundingBox.height / 2 ); const secondElement = await page.locator(H_THREE_BLOCK_SELECTOR); - const secondElementBoundingBox = await secondElement.boundingBox(); + const secondElementBoundingBox = (await secondElement.boundingBox())!; await page.keyboard.down("Shift"); await page.mouse.click( secondElementBoundingBox.x + 20, @@ -128,14 +128,14 @@ test.describe("Check Block Indentation Functionality", () => { await insertHeading(page, 3); const firstElement = await page.locator(H_TWO_BLOCK_SELECTOR); - const firstElementBoundingBox = await firstElement.boundingBox(); + const firstElementBoundingBox = (await firstElement.boundingBox())!; await page.mouse.click( firstElementBoundingBox.x + 20, firstElementBoundingBox.y + firstElementBoundingBox.height / 2 ); const secondElement = await page.locator(H_THREE_BLOCK_SELECTOR); - const secondElementBoundingBox = await secondElement.boundingBox(); + const secondElementBoundingBox = (await secondElement.boundingBox())!; await page.keyboard.down("Shift"); await page.mouse.click( secondElementBoundingBox.x + 20, diff --git a/tests/end-to-end/indentation/indentation.test.ts-snapshots/decreaseIndentMultipleBlocks-chromium-linux.json b/tests/src/end-to-end/indentation/indentation.test.ts-snapshots/decreaseIndentMultipleBlocks-chromium-linux.json similarity index 100% rename from tests/end-to-end/indentation/indentation.test.ts-snapshots/decreaseIndentMultipleBlocks-chromium-linux.json rename to tests/src/end-to-end/indentation/indentation.test.ts-snapshots/decreaseIndentMultipleBlocks-chromium-linux.json diff --git a/tests/end-to-end/indentation/indentation.test.ts-snapshots/decreaseIndentMultipleBlocks-firefox-linux.json b/tests/src/end-to-end/indentation/indentation.test.ts-snapshots/decreaseIndentMultipleBlocks-firefox-linux.json similarity index 100% rename from tests/end-to-end/indentation/indentation.test.ts-snapshots/decreaseIndentMultipleBlocks-firefox-linux.json rename to tests/src/end-to-end/indentation/indentation.test.ts-snapshots/decreaseIndentMultipleBlocks-firefox-linux.json diff --git a/tests/end-to-end/indentation/indentation.test.ts-snapshots/decreaseIndentMultipleBlocks-webkit-linux.json b/tests/src/end-to-end/indentation/indentation.test.ts-snapshots/decreaseIndentMultipleBlocks-webkit-linux.json similarity index 100% rename from tests/end-to-end/indentation/indentation.test.ts-snapshots/decreaseIndentMultipleBlocks-webkit-linux.json rename to tests/src/end-to-end/indentation/indentation.test.ts-snapshots/decreaseIndentMultipleBlocks-webkit-linux.json diff --git a/tests/end-to-end/indentation/indentation.test.ts-snapshots/decreaseIndentSingleBlock-chromium-linux.json b/tests/src/end-to-end/indentation/indentation.test.ts-snapshots/decreaseIndentSingleBlock-chromium-linux.json similarity index 100% rename from tests/end-to-end/indentation/indentation.test.ts-snapshots/decreaseIndentSingleBlock-chromium-linux.json rename to tests/src/end-to-end/indentation/indentation.test.ts-snapshots/decreaseIndentSingleBlock-chromium-linux.json diff --git a/tests/end-to-end/indentation/indentation.test.ts-snapshots/decreaseIndentSingleBlock-firefox-linux.json b/tests/src/end-to-end/indentation/indentation.test.ts-snapshots/decreaseIndentSingleBlock-firefox-linux.json similarity index 100% rename from tests/end-to-end/indentation/indentation.test.ts-snapshots/decreaseIndentSingleBlock-firefox-linux.json rename to tests/src/end-to-end/indentation/indentation.test.ts-snapshots/decreaseIndentSingleBlock-firefox-linux.json diff --git a/tests/end-to-end/indentation/indentation.test.ts-snapshots/decreaseIndentSingleBlock-webkit-linux.json b/tests/src/end-to-end/indentation/indentation.test.ts-snapshots/decreaseIndentSingleBlock-webkit-linux.json similarity index 100% rename from tests/end-to-end/indentation/indentation.test.ts-snapshots/decreaseIndentSingleBlock-webkit-linux.json rename to tests/src/end-to-end/indentation/indentation.test.ts-snapshots/decreaseIndentSingleBlock-webkit-linux.json diff --git a/tests/end-to-end/indentation/indentation.test.ts-snapshots/increaseIndentMultipleBlocks-chromium-linux.json b/tests/src/end-to-end/indentation/indentation.test.ts-snapshots/increaseIndentMultipleBlocks-chromium-linux.json similarity index 100% rename from tests/end-to-end/indentation/indentation.test.ts-snapshots/increaseIndentMultipleBlocks-chromium-linux.json rename to tests/src/end-to-end/indentation/indentation.test.ts-snapshots/increaseIndentMultipleBlocks-chromium-linux.json diff --git a/tests/end-to-end/indentation/indentation.test.ts-snapshots/increaseIndentMultipleBlocks-firefox-linux.json b/tests/src/end-to-end/indentation/indentation.test.ts-snapshots/increaseIndentMultipleBlocks-firefox-linux.json similarity index 100% rename from tests/end-to-end/indentation/indentation.test.ts-snapshots/increaseIndentMultipleBlocks-firefox-linux.json rename to tests/src/end-to-end/indentation/indentation.test.ts-snapshots/increaseIndentMultipleBlocks-firefox-linux.json diff --git a/tests/end-to-end/indentation/indentation.test.ts-snapshots/increaseIndentMultipleBlocks-webkit-linux.json b/tests/src/end-to-end/indentation/indentation.test.ts-snapshots/increaseIndentMultipleBlocks-webkit-linux.json similarity index 100% rename from tests/end-to-end/indentation/indentation.test.ts-snapshots/increaseIndentMultipleBlocks-webkit-linux.json rename to tests/src/end-to-end/indentation/indentation.test.ts-snapshots/increaseIndentMultipleBlocks-webkit-linux.json diff --git a/tests/end-to-end/indentation/indentation.test.ts-snapshots/increaseIndentSingleBlock-chromium-linux.json b/tests/src/end-to-end/indentation/indentation.test.ts-snapshots/increaseIndentSingleBlock-chromium-linux.json similarity index 100% rename from tests/end-to-end/indentation/indentation.test.ts-snapshots/increaseIndentSingleBlock-chromium-linux.json rename to tests/src/end-to-end/indentation/indentation.test.ts-snapshots/increaseIndentSingleBlock-chromium-linux.json diff --git a/tests/end-to-end/indentation/indentation.test.ts-snapshots/increaseIndentSingleBlock-firefox-linux.json b/tests/src/end-to-end/indentation/indentation.test.ts-snapshots/increaseIndentSingleBlock-firefox-linux.json similarity index 100% rename from tests/end-to-end/indentation/indentation.test.ts-snapshots/increaseIndentSingleBlock-firefox-linux.json rename to tests/src/end-to-end/indentation/indentation.test.ts-snapshots/increaseIndentSingleBlock-firefox-linux.json diff --git a/tests/end-to-end/indentation/indentation.test.ts-snapshots/increaseIndentSingleBlock-webkit-linux.json b/tests/src/end-to-end/indentation/indentation.test.ts-snapshots/increaseIndentSingleBlock-webkit-linux.json similarity index 100% rename from tests/end-to-end/indentation/indentation.test.ts-snapshots/increaseIndentSingleBlock-webkit-linux.json rename to tests/src/end-to-end/indentation/indentation.test.ts-snapshots/increaseIndentSingleBlock-webkit-linux.json diff --git a/tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts b/tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts similarity index 92% rename from tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts rename to tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts index 0a03efd59e..15500f99e9 100644 --- a/tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts +++ b/tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts @@ -1,12 +1,12 @@ import { test } from "../../setup/setupScript"; import { BASE_URL, - ITALIC_BUTTON_SELECTOR, H_ONE_BLOCK_SELECTOR, H_TWO_BLOCK_SELECTOR, + ITALIC_BUTTON_SELECTOR, } from "../../utils/const"; -import { compareDocToSnapshot, focusOnEditor } from "../../utils/editor"; import { insertHeading, insertParagraph } from "../../utils/copypaste"; +import { compareDocToSnapshot, focusOnEditor } from "../../utils/editor"; test.describe.configure({ mode: "serial" }); @@ -22,13 +22,13 @@ test.describe("Check Keyboard Handlers' Behaviour", () => { await page.waitForTimeout(500); const startElement = await page.locator(H_ONE_BLOCK_SELECTOR); - let boundingBox = await startElement.boundingBox(); + let boundingBox = (await startElement.boundingBox())!; let { x, y, height } = boundingBox; await page.mouse.move(x + 35, y + height / 2, { steps: 5 }); await page.mouse.down(); const endElement = await page.locator(H_TWO_BLOCK_SELECTOR); - boundingBox = await endElement.boundingBox(); + boundingBox = (await endElement.boundingBox())!; ({ x, y, height } = boundingBox); await page.mouse.move(x + 105, y + height / 2, { steps: 5 }); await page.mouse.up(); @@ -43,8 +43,8 @@ test.describe("Check Keyboard Handlers' Behaviour", () => { await page.waitForTimeout(500); const element = await page.locator(H_ONE_BLOCK_SELECTOR); - let boundingBox = await element.boundingBox(); - let { x, y, height } = boundingBox; + const boundingBox = (await element.boundingBox())!; + const { x, y, height } = boundingBox; await page.mouse.click(x + 35, y + height / 2, { clickCount: 2 }); await page.locator(ITALIC_BUTTON_SELECTOR).click(); @@ -64,8 +64,8 @@ test.describe("Check Keyboard Handlers' Behaviour", () => { await page.waitForTimeout(500); const element = await page.locator(H_ONE_BLOCK_SELECTOR); - let boundingBox = await element.boundingBox(); - let { x, y, height } = boundingBox; + const boundingBox = (await element.boundingBox())!; + const { x, y, height } = boundingBox; await page.mouse.click(x + 35, y + height / 2); await page.keyboard.press("Enter"); diff --git a/tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspacePreservesMarks-json-chromium-linux.json b/tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspacePreservesMarks-json-chromium-linux.json similarity index 100% rename from tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspacePreservesMarks-json-chromium-linux.json rename to tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspacePreservesMarks-json-chromium-linux.json diff --git a/tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspacePreservesMarks-json-firefox-linux.json b/tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspacePreservesMarks-json-firefox-linux.json similarity index 100% rename from tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspacePreservesMarks-json-firefox-linux.json rename to tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspacePreservesMarks-json-firefox-linux.json diff --git a/tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspacePreservesMarks-json-webkit-linux.json b/tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspacePreservesMarks-json-webkit-linux.json similarity index 100% rename from tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspacePreservesMarks-json-webkit-linux.json rename to tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspacePreservesMarks-json-webkit-linux.json diff --git a/tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspacePreservesNestedBlocks-json-chromium-linux.json b/tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspacePreservesNestedBlocks-json-chromium-linux.json similarity index 100% rename from tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspacePreservesNestedBlocks-json-chromium-linux.json rename to tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspacePreservesNestedBlocks-json-chromium-linux.json diff --git a/tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspacePreservesNestedBlocks-json-firefox-linux.json b/tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspacePreservesNestedBlocks-json-firefox-linux.json similarity index 100% rename from tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspacePreservesNestedBlocks-json-firefox-linux.json rename to tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspacePreservesNestedBlocks-json-firefox-linux.json diff --git a/tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspacePreservesNestedBlocks-json-webkit-linux.json b/tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspacePreservesNestedBlocks-json-webkit-linux.json similarity index 100% rename from tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspacePreservesNestedBlocks-json-webkit-linux.json rename to tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspacePreservesNestedBlocks-json-webkit-linux.json diff --git a/tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspaceStartOfBlock-json-chromium-linux.json b/tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspaceStartOfBlock-json-chromium-linux.json similarity index 100% rename from tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspaceStartOfBlock-json-chromium-linux.json rename to tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspaceStartOfBlock-json-chromium-linux.json diff --git a/tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspaceStartOfBlock-json-firefox-linux.json b/tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspaceStartOfBlock-json-firefox-linux.json similarity index 100% rename from tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspaceStartOfBlock-json-firefox-linux.json rename to tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspaceStartOfBlock-json-firefox-linux.json diff --git a/tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspaceStartOfBlock-json-webkit-linux.json b/tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspaceStartOfBlock-json-webkit-linux.json similarity index 100% rename from tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspaceStartOfBlock-json-webkit-linux.json rename to tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/backspaceStartOfBlock-json-webkit-linux.json diff --git a/tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterPreservesMarks-json-chromium-linux.json b/tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterPreservesMarks-json-chromium-linux.json similarity index 100% rename from tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterPreservesMarks-json-chromium-linux.json rename to tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterPreservesMarks-json-chromium-linux.json diff --git a/tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterPreservesMarks-json-firefox-linux.json b/tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterPreservesMarks-json-firefox-linux.json similarity index 100% rename from tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterPreservesMarks-json-firefox-linux.json rename to tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterPreservesMarks-json-firefox-linux.json diff --git a/tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterPreservesMarks-json-webkit-linux.json b/tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterPreservesMarks-json-webkit-linux.json similarity index 100% rename from tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterPreservesMarks-json-webkit-linux.json rename to tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterPreservesMarks-json-webkit-linux.json diff --git a/tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterPreservesNestedBlocks-json-chromium-linux.json b/tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterPreservesNestedBlocks-json-chromium-linux.json similarity index 100% rename from tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterPreservesNestedBlocks-json-chromium-linux.json rename to tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterPreservesNestedBlocks-json-chromium-linux.json diff --git a/tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterPreservesNestedBlocks-json-firefox-linux.json b/tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterPreservesNestedBlocks-json-firefox-linux.json similarity index 100% rename from tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterPreservesNestedBlocks-json-firefox-linux.json rename to tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterPreservesNestedBlocks-json-firefox-linux.json diff --git a/tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterPreservesNestedBlocks-json-webkit-linux.json b/tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterPreservesNestedBlocks-json-webkit-linux.json similarity index 100% rename from tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterPreservesNestedBlocks-json-webkit-linux.json rename to tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterPreservesNestedBlocks-json-webkit-linux.json diff --git a/tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterSelectionNotEmpty-json-chromium-linux.json b/tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterSelectionNotEmpty-json-chromium-linux.json similarity index 100% rename from tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterSelectionNotEmpty-json-chromium-linux.json rename to tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterSelectionNotEmpty-json-chromium-linux.json diff --git a/tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterSelectionNotEmpty-json-firefox-linux.json b/tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterSelectionNotEmpty-json-firefox-linux.json similarity index 100% rename from tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterSelectionNotEmpty-json-firefox-linux.json rename to tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterSelectionNotEmpty-json-firefox-linux.json diff --git a/tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterSelectionNotEmpty-json-webkit-linux.json b/tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterSelectionNotEmpty-json-webkit-linux.json similarity index 100% rename from tests/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterSelectionNotEmpty-json-webkit-linux.json rename to tests/src/end-to-end/keyboardhandlers/keyboardhandlers.test.ts-snapshots/enterSelectionNotEmpty-json-webkit-linux.json diff --git a/tests/end-to-end/placeholder/placeholder.test.ts b/tests/src/end-to-end/placeholder/placeholder.test.ts similarity index 100% rename from tests/end-to-end/placeholder/placeholder.test.ts rename to tests/src/end-to-end/placeholder/placeholder.test.ts diff --git a/tests/end-to-end/placeholder/placeholder.test.ts-snapshots/initial-placeholder-chromium-darwin.png b/tests/src/end-to-end/placeholder/placeholder.test.ts-snapshots/initial-placeholder-chromium-darwin.png similarity index 100% rename from tests/end-to-end/placeholder/placeholder.test.ts-snapshots/initial-placeholder-chromium-darwin.png rename to tests/src/end-to-end/placeholder/placeholder.test.ts-snapshots/initial-placeholder-chromium-darwin.png diff --git a/tests/end-to-end/placeholder/placeholder.test.ts-snapshots/initial-placeholder-chromium-linux.png b/tests/src/end-to-end/placeholder/placeholder.test.ts-snapshots/initial-placeholder-chromium-linux.png similarity index 100% rename from tests/end-to-end/placeholder/placeholder.test.ts-snapshots/initial-placeholder-chromium-linux.png rename to tests/src/end-to-end/placeholder/placeholder.test.ts-snapshots/initial-placeholder-chromium-linux.png diff --git a/tests/end-to-end/placeholder/placeholder.test.ts-snapshots/initial-placeholder-firefox-darwin.png b/tests/src/end-to-end/placeholder/placeholder.test.ts-snapshots/initial-placeholder-firefox-darwin.png similarity index 100% rename from tests/end-to-end/placeholder/placeholder.test.ts-snapshots/initial-placeholder-firefox-darwin.png rename to tests/src/end-to-end/placeholder/placeholder.test.ts-snapshots/initial-placeholder-firefox-darwin.png diff --git a/tests/end-to-end/placeholder/placeholder.test.ts-snapshots/initial-placeholder-firefox-linux.png b/tests/src/end-to-end/placeholder/placeholder.test.ts-snapshots/initial-placeholder-firefox-linux.png similarity index 100% rename from tests/end-to-end/placeholder/placeholder.test.ts-snapshots/initial-placeholder-firefox-linux.png rename to tests/src/end-to-end/placeholder/placeholder.test.ts-snapshots/initial-placeholder-firefox-linux.png diff --git a/tests/end-to-end/placeholder/placeholder.test.ts-snapshots/initial-placeholder-webkit-darwin.png b/tests/src/end-to-end/placeholder/placeholder.test.ts-snapshots/initial-placeholder-webkit-darwin.png similarity index 100% rename from tests/end-to-end/placeholder/placeholder.test.ts-snapshots/initial-placeholder-webkit-darwin.png rename to tests/src/end-to-end/placeholder/placeholder.test.ts-snapshots/initial-placeholder-webkit-darwin.png diff --git a/tests/end-to-end/placeholder/placeholder.test.ts-snapshots/initial-placeholder-webkit-linux.png b/tests/src/end-to-end/placeholder/placeholder.test.ts-snapshots/initial-placeholder-webkit-linux.png similarity index 100% rename from tests/end-to-end/placeholder/placeholder.test.ts-snapshots/initial-placeholder-webkit-linux.png rename to tests/src/end-to-end/placeholder/placeholder.test.ts-snapshots/initial-placeholder-webkit-linux.png diff --git a/tests/end-to-end/slashmenu/slashmenu.test.ts b/tests/src/end-to-end/slashmenu/slashmenu.test.ts similarity index 100% rename from tests/end-to-end/slashmenu/slashmenu.test.ts rename to tests/src/end-to-end/slashmenu/slashmenu.test.ts diff --git a/tests/end-to-end/slashmenu/slashmenu.test.ts-snapshots/docStructureSnapshot-chromium-linux.json b/tests/src/end-to-end/slashmenu/slashmenu.test.ts-snapshots/docStructureSnapshot-chromium-linux.json similarity index 100% rename from tests/end-to-end/slashmenu/slashmenu.test.ts-snapshots/docStructureSnapshot-chromium-linux.json rename to tests/src/end-to-end/slashmenu/slashmenu.test.ts-snapshots/docStructureSnapshot-chromium-linux.json diff --git a/tests/end-to-end/slashmenu/slashmenu.test.ts-snapshots/docStructureSnapshot-firefox-linux.json b/tests/src/end-to-end/slashmenu/slashmenu.test.ts-snapshots/docStructureSnapshot-firefox-linux.json similarity index 100% rename from tests/end-to-end/slashmenu/slashmenu.test.ts-snapshots/docStructureSnapshot-firefox-linux.json rename to tests/src/end-to-end/slashmenu/slashmenu.test.ts-snapshots/docStructureSnapshot-firefox-linux.json diff --git a/tests/end-to-end/slashmenu/slashmenu.test.ts-snapshots/docStructureSnapshot-webkit-linux.json b/tests/src/end-to-end/slashmenu/slashmenu.test.ts-snapshots/docStructureSnapshot-webkit-linux.json similarity index 100% rename from tests/end-to-end/slashmenu/slashmenu.test.ts-snapshots/docStructureSnapshot-webkit-linux.json rename to tests/src/end-to-end/slashmenu/slashmenu.test.ts-snapshots/docStructureSnapshot-webkit-linux.json diff --git a/tests/end-to-end/slashmenu/slashmenu.test.ts-snapshots/slash-menu-end-product-chromium-darwin.png b/tests/src/end-to-end/slashmenu/slashmenu.test.ts-snapshots/slash-menu-end-product-chromium-darwin.png similarity index 100% rename from tests/end-to-end/slashmenu/slashmenu.test.ts-snapshots/slash-menu-end-product-chromium-darwin.png rename to tests/src/end-to-end/slashmenu/slashmenu.test.ts-snapshots/slash-menu-end-product-chromium-darwin.png diff --git a/tests/end-to-end/slashmenu/slashmenu.test.ts-snapshots/slash-menu-end-product-chromium-linux.png b/tests/src/end-to-end/slashmenu/slashmenu.test.ts-snapshots/slash-menu-end-product-chromium-linux.png similarity index 100% rename from tests/end-to-end/slashmenu/slashmenu.test.ts-snapshots/slash-menu-end-product-chromium-linux.png rename to tests/src/end-to-end/slashmenu/slashmenu.test.ts-snapshots/slash-menu-end-product-chromium-linux.png diff --git a/tests/end-to-end/slashmenu/slashmenu.test.ts-snapshots/slash-menu-end-product-firefox-darwin.png b/tests/src/end-to-end/slashmenu/slashmenu.test.ts-snapshots/slash-menu-end-product-firefox-darwin.png similarity index 100% rename from tests/end-to-end/slashmenu/slashmenu.test.ts-snapshots/slash-menu-end-product-firefox-darwin.png rename to tests/src/end-to-end/slashmenu/slashmenu.test.ts-snapshots/slash-menu-end-product-firefox-darwin.png diff --git a/tests/end-to-end/slashmenu/slashmenu.test.ts-snapshots/slash-menu-end-product-firefox-linux.png b/tests/src/end-to-end/slashmenu/slashmenu.test.ts-snapshots/slash-menu-end-product-firefox-linux.png similarity index 100% rename from tests/end-to-end/slashmenu/slashmenu.test.ts-snapshots/slash-menu-end-product-firefox-linux.png rename to tests/src/end-to-end/slashmenu/slashmenu.test.ts-snapshots/slash-menu-end-product-firefox-linux.png diff --git a/tests/end-to-end/slashmenu/slashmenu.test.ts-snapshots/slash-menu-end-product-webkit-darwin.png b/tests/src/end-to-end/slashmenu/slashmenu.test.ts-snapshots/slash-menu-end-product-webkit-darwin.png similarity index 100% rename from tests/end-to-end/slashmenu/slashmenu.test.ts-snapshots/slash-menu-end-product-webkit-darwin.png rename to tests/src/end-to-end/slashmenu/slashmenu.test.ts-snapshots/slash-menu-end-product-webkit-darwin.png diff --git a/tests/end-to-end/slashmenu/slashmenu.test.ts-snapshots/slash-menu-end-product-webkit-linux.png b/tests/src/end-to-end/slashmenu/slashmenu.test.ts-snapshots/slash-menu-end-product-webkit-linux.png similarity index 100% rename from tests/end-to-end/slashmenu/slashmenu.test.ts-snapshots/slash-menu-end-product-webkit-linux.png rename to tests/src/end-to-end/slashmenu/slashmenu.test.ts-snapshots/slash-menu-end-product-webkit-linux.png diff --git a/tests/end-to-end/textalignment/textAlignment.test.ts b/tests/src/end-to-end/textalignment/textAlignment.test.ts similarity index 93% rename from tests/end-to-end/textalignment/textAlignment.test.ts rename to tests/src/end-to-end/textalignment/textAlignment.test.ts index 700721b1c4..d948347141 100644 --- a/tests/end-to-end/textalignment/textAlignment.test.ts +++ b/tests/src/end-to-end/textalignment/textAlignment.test.ts @@ -1,13 +1,8 @@ +import { expect } from "@playwright/test"; import { test } from "../../setup/setupScript"; -import { - ALIGN_TEXT_RIGHT_BUTTON_SELECTOR, - BASE_URL, - H_ONE_BLOCK_SELECTOR, - H_TWO_BLOCK_SELECTOR, -} from "../../utils/const"; -import { focusOnEditor } from "../../utils/editor"; +import { ALIGN_TEXT_RIGHT_BUTTON_SELECTOR, BASE_URL } from "../../utils/const"; import { insertHeading } from "../../utils/copypaste"; -import { expect } from "@playwright/test"; +import { focusOnEditor } from "../../utils/editor"; test.beforeEach(async ({ page }) => { await page.goto(BASE_URL, { waitUntil: "networkidle" }); diff --git a/tests/end-to-end/textalignment/textAlignment.test.ts-snapshots/alignTextMultipleBlocks-chromium-linux.png b/tests/src/end-to-end/textalignment/textAlignment.test.ts-snapshots/alignTextMultipleBlocks-chromium-linux.png similarity index 100% rename from tests/end-to-end/textalignment/textAlignment.test.ts-snapshots/alignTextMultipleBlocks-chromium-linux.png rename to tests/src/end-to-end/textalignment/textAlignment.test.ts-snapshots/alignTextMultipleBlocks-chromium-linux.png diff --git a/tests/end-to-end/textalignment/textAlignment.test.ts-snapshots/alignTextMultipleBlocks-firefox-linux.png b/tests/src/end-to-end/textalignment/textAlignment.test.ts-snapshots/alignTextMultipleBlocks-firefox-linux.png similarity index 100% rename from tests/end-to-end/textalignment/textAlignment.test.ts-snapshots/alignTextMultipleBlocks-firefox-linux.png rename to tests/src/end-to-end/textalignment/textAlignment.test.ts-snapshots/alignTextMultipleBlocks-firefox-linux.png diff --git a/tests/end-to-end/textalignment/textAlignment.test.ts-snapshots/alignTextMultipleBlocks-webkit-linux.png b/tests/src/end-to-end/textalignment/textAlignment.test.ts-snapshots/alignTextMultipleBlocks-webkit-linux.png similarity index 100% rename from tests/end-to-end/textalignment/textAlignment.test.ts-snapshots/alignTextMultipleBlocks-webkit-linux.png rename to tests/src/end-to-end/textalignment/textAlignment.test.ts-snapshots/alignTextMultipleBlocks-webkit-linux.png diff --git a/tests/end-to-end/textalignment/textAlignment.test.ts-snapshots/alignTextSingleBlock-chromium-linux.png b/tests/src/end-to-end/textalignment/textAlignment.test.ts-snapshots/alignTextSingleBlock-chromium-linux.png similarity index 100% rename from tests/end-to-end/textalignment/textAlignment.test.ts-snapshots/alignTextSingleBlock-chromium-linux.png rename to tests/src/end-to-end/textalignment/textAlignment.test.ts-snapshots/alignTextSingleBlock-chromium-linux.png diff --git a/tests/end-to-end/textalignment/textAlignment.test.ts-snapshots/alignTextSingleBlock-firefox-linux.png b/tests/src/end-to-end/textalignment/textAlignment.test.ts-snapshots/alignTextSingleBlock-firefox-linux.png similarity index 100% rename from tests/end-to-end/textalignment/textAlignment.test.ts-snapshots/alignTextSingleBlock-firefox-linux.png rename to tests/src/end-to-end/textalignment/textAlignment.test.ts-snapshots/alignTextSingleBlock-firefox-linux.png diff --git a/tests/end-to-end/textalignment/textAlignment.test.ts-snapshots/alignTextSingleBlock-webkit-linux.png b/tests/src/end-to-end/textalignment/textAlignment.test.ts-snapshots/alignTextSingleBlock-webkit-linux.png similarity index 100% rename from tests/end-to-end/textalignment/textAlignment.test.ts-snapshots/alignTextSingleBlock-webkit-linux.png rename to tests/src/end-to-end/textalignment/textAlignment.test.ts-snapshots/alignTextSingleBlock-webkit-linux.png diff --git a/tests/end-to-end/theming/theming.test.ts b/tests/src/end-to-end/theming/theming.test.ts similarity index 100% rename from tests/end-to-end/theming/theming.test.ts rename to tests/src/end-to-end/theming/theming.test.ts diff --git a/tests/end-to-end/theming/theming.test.ts-snapshots/dark-drag-handle-menu-chromium-linux.png b/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-drag-handle-menu-chromium-linux.png similarity index 100% rename from tests/end-to-end/theming/theming.test.ts-snapshots/dark-drag-handle-menu-chromium-linux.png rename to tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-drag-handle-menu-chromium-linux.png diff --git a/tests/end-to-end/theming/theming.test.ts-snapshots/dark-drag-handle-menu-firefox-linux.png b/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-drag-handle-menu-firefox-linux.png similarity index 100% rename from tests/end-to-end/theming/theming.test.ts-snapshots/dark-drag-handle-menu-firefox-linux.png rename to tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-drag-handle-menu-firefox-linux.png diff --git a/tests/end-to-end/theming/theming.test.ts-snapshots/dark-drag-handle-menu-webkit-linux.png b/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-drag-handle-menu-webkit-linux.png similarity index 100% rename from tests/end-to-end/theming/theming.test.ts-snapshots/dark-drag-handle-menu-webkit-linux.png rename to tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-drag-handle-menu-webkit-linux.png diff --git a/tests/end-to-end/theming/theming.test.ts-snapshots/dark-editor-chromium-linux.png b/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-editor-chromium-linux.png similarity index 100% rename from tests/end-to-end/theming/theming.test.ts-snapshots/dark-editor-chromium-linux.png rename to tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-editor-chromium-linux.png diff --git a/tests/end-to-end/theming/theming.test.ts-snapshots/dark-editor-firefox-linux.png b/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-editor-firefox-linux.png similarity index 100% rename from tests/end-to-end/theming/theming.test.ts-snapshots/dark-editor-firefox-linux.png rename to tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-editor-firefox-linux.png diff --git a/tests/end-to-end/theming/theming.test.ts-snapshots/dark-editor-webkit-linux.png b/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-editor-webkit-linux.png similarity index 100% rename from tests/end-to-end/theming/theming.test.ts-snapshots/dark-editor-webkit-linux.png rename to tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-editor-webkit-linux.png diff --git a/tests/end-to-end/theming/theming.test.ts-snapshots/dark-formatting-toolbar-chromium-linux.png b/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-formatting-toolbar-chromium-linux.png similarity index 100% rename from tests/end-to-end/theming/theming.test.ts-snapshots/dark-formatting-toolbar-chromium-linux.png rename to tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-formatting-toolbar-chromium-linux.png diff --git a/tests/end-to-end/theming/theming.test.ts-snapshots/dark-formatting-toolbar-firefox-linux.png b/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-formatting-toolbar-firefox-linux.png similarity index 100% rename from tests/end-to-end/theming/theming.test.ts-snapshots/dark-formatting-toolbar-firefox-linux.png rename to tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-formatting-toolbar-firefox-linux.png diff --git a/tests/end-to-end/theming/theming.test.ts-snapshots/dark-formatting-toolbar-webkit-linux.png b/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-formatting-toolbar-webkit-linux.png similarity index 100% rename from tests/end-to-end/theming/theming.test.ts-snapshots/dark-formatting-toolbar-webkit-linux.png rename to tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-formatting-toolbar-webkit-linux.png diff --git a/tests/end-to-end/theming/theming.test.ts-snapshots/dark-hyperlink-toolbar-chromium-linux.png b/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-hyperlink-toolbar-chromium-linux.png similarity index 100% rename from tests/end-to-end/theming/theming.test.ts-snapshots/dark-hyperlink-toolbar-chromium-linux.png rename to tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-hyperlink-toolbar-chromium-linux.png diff --git a/tests/end-to-end/theming/theming.test.ts-snapshots/dark-hyperlink-toolbar-firefox-linux.png b/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-hyperlink-toolbar-firefox-linux.png similarity index 100% rename from tests/end-to-end/theming/theming.test.ts-snapshots/dark-hyperlink-toolbar-firefox-linux.png rename to tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-hyperlink-toolbar-firefox-linux.png diff --git a/tests/end-to-end/theming/theming.test.ts-snapshots/dark-hyperlink-toolbar-webkit-linux.png b/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-hyperlink-toolbar-webkit-linux.png similarity index 100% rename from tests/end-to-end/theming/theming.test.ts-snapshots/dark-hyperlink-toolbar-webkit-linux.png rename to tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-hyperlink-toolbar-webkit-linux.png diff --git a/tests/end-to-end/theming/theming.test.ts-snapshots/dark-image-toolbar-chromium-linux.png b/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-image-toolbar-chromium-linux.png similarity index 100% rename from tests/end-to-end/theming/theming.test.ts-snapshots/dark-image-toolbar-chromium-linux.png rename to tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-image-toolbar-chromium-linux.png diff --git a/tests/end-to-end/theming/theming.test.ts-snapshots/dark-image-toolbar-firefox-linux.png b/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-image-toolbar-firefox-linux.png similarity index 100% rename from tests/end-to-end/theming/theming.test.ts-snapshots/dark-image-toolbar-firefox-linux.png rename to tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-image-toolbar-firefox-linux.png diff --git a/tests/end-to-end/theming/theming.test.ts-snapshots/dark-image-toolbar-webkit-linux.png b/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-image-toolbar-webkit-linux.png similarity index 100% rename from tests/end-to-end/theming/theming.test.ts-snapshots/dark-image-toolbar-webkit-linux.png rename to tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-image-toolbar-webkit-linux.png diff --git a/tests/end-to-end/theming/theming.test.ts-snapshots/dark-side-menu-chromium-linux.png b/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-side-menu-chromium-linux.png similarity index 100% rename from tests/end-to-end/theming/theming.test.ts-snapshots/dark-side-menu-chromium-linux.png rename to tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-side-menu-chromium-linux.png diff --git a/tests/end-to-end/theming/theming.test.ts-snapshots/dark-side-menu-firefox-linux.png b/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-side-menu-firefox-linux.png similarity index 100% rename from tests/end-to-end/theming/theming.test.ts-snapshots/dark-side-menu-firefox-linux.png rename to tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-side-menu-firefox-linux.png diff --git a/tests/end-to-end/theming/theming.test.ts-snapshots/dark-side-menu-webkit-linux.png b/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-side-menu-webkit-linux.png similarity index 100% rename from tests/end-to-end/theming/theming.test.ts-snapshots/dark-side-menu-webkit-linux.png rename to tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-side-menu-webkit-linux.png diff --git a/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-slash-menu-chromium-linux.png b/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-slash-menu-chromium-linux.png new file mode 100644 index 0000000000..afb3383394 Binary files /dev/null and b/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-slash-menu-chromium-linux.png differ diff --git a/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-slash-menu-firefox-linux.png b/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-slash-menu-firefox-linux.png new file mode 100644 index 0000000000..2a62207d0a Binary files /dev/null and b/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-slash-menu-firefox-linux.png differ diff --git a/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-slash-menu-webkit-linux.png b/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-slash-menu-webkit-linux.png new file mode 100644 index 0000000000..28f1a28e03 Binary files /dev/null and b/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-slash-menu-webkit-linux.png differ diff --git a/tests/setup/setupScript.ts b/tests/src/setup/setupScript.ts similarity index 98% rename from tests/setup/setupScript.ts rename to tests/src/setup/setupScript.ts index 3fa0a38de1..1eb448aa0a 100644 --- a/tests/setup/setupScript.ts +++ b/tests/src/setup/setupScript.ts @@ -2,7 +2,6 @@ import { BrowserContext, BrowserContextOptions, test as base, - expect, } from "@playwright/test"; export type TestOptions = { diff --git a/tests/setup/setupScriptComponent.ts b/tests/src/setup/setupScriptComponent.ts similarity index 90% rename from tests/setup/setupScriptComponent.ts rename to tests/src/setup/setupScriptComponent.ts index 6d92b67ee1..27c14bd192 100644 --- a/tests/setup/setupScriptComponent.ts +++ b/tests/src/setup/setupScriptComponent.ts @@ -1,4 +1,4 @@ -import { test as base, expect } from "@playwright/experimental-ct-react"; +import { test as base } from "@playwright/experimental-ct-react"; export type TestOptions = { mockID: number | undefined; diff --git a/tests/src/types/styles.d.ts b/tests/src/types/styles.d.ts new file mode 100644 index 0000000000..f57bdaee63 --- /dev/null +++ b/tests/src/types/styles.d.ts @@ -0,0 +1 @@ +declare module "*.module.css"; \ No newline at end of file diff --git a/tests/utils/components/Editor.module.css b/tests/src/utils/components/Editor.module.css similarity index 100% rename from tests/utils/components/Editor.module.css rename to tests/src/utils/components/Editor.module.css diff --git a/tests/utils/components/Editor.tsx b/tests/src/utils/components/Editor.tsx similarity index 65% rename from tests/utils/components/Editor.tsx rename to tests/src/utils/components/Editor.tsx index d719605e44..7f244b7961 100644 --- a/tests/utils/components/Editor.tsx +++ b/tests/src/utils/components/Editor.tsx @@ -1,4 +1,4 @@ -import { defaultBlockSchema } from "@blocknote/core"; +import { defaultBlockSpecs } from "@blocknote/core"; import "@blocknote/core/style.css"; import { BlockNoteView, @@ -9,25 +9,21 @@ import { Alert, insertAlert } from "../customblocks/Alert"; import { Button, insertButton } from "../customblocks/Button"; import { Embed, insertEmbed } from "../customblocks/Embed"; import { Image, insertImage } from "../customblocks/Image"; -import { insertSeparator, Separator } from "../customblocks/Separator"; -import { - insertTableOfContents, - TableOfContents, -} from "../customblocks/TableOfContents"; +import { Separator, insertSeparator } from "../customblocks/Separator"; import styles from "./Editor.module.css"; type WindowWithProseMirror = Window & typeof globalThis & { ProseMirror: any }; export default function Editor() { - const blockSchema = { - ...defaultBlockSchema, + const blockSpecs = { + ...defaultBlockSpecs, alert: Alert, button: Button, embed: Embed, image: Image, separator: Separator, - toc: TableOfContents, - } as const; + // toc: TableOfContents, + }; const slashMenuItems = [ insertAlert, @@ -35,16 +31,18 @@ export default function Editor() { insertEmbed, insertImage, insertSeparator, - insertTableOfContents, + // insertTableOfContents, ]; const editor = useBlockNote({ - editorDOMAttributes: { - class: styles.editor, - "data-test": "editor", + domAttributes: { + editor: { class: styles.editor, "data-test": "editor" }, }, - blockSchema: blockSchema, - slashMenuItems: [...getDefaultReactSlashMenuItems(), ...slashMenuItems], + blockSpecs, + slashMenuItems: [ + ...getDefaultReactSlashMenuItems(), + ...slashMenuItems, + ] as any, // TODO }); console.log(editor); diff --git a/tests/utils/components/EditorWithTextArea.tsx b/tests/src/utils/components/EditorWithTextArea.tsx similarity index 100% rename from tests/utils/components/EditorWithTextArea.tsx rename to tests/src/utils/components/EditorWithTextArea.tsx diff --git a/tests/utils/components/TextArea.module.css b/tests/src/utils/components/TextArea.module.css similarity index 100% rename from tests/utils/components/TextArea.module.css rename to tests/src/utils/components/TextArea.module.css diff --git a/tests/utils/const.ts b/tests/src/utils/const.ts similarity index 94% rename from tests/utils/const.ts rename to tests/src/utils/const.ts index b16e32ca89..fdbdbf0c40 100644 --- a/tests/utils/const.ts +++ b/tests/src/utils/const.ts @@ -1,7 +1,7 @@ const PORT = 3000; export const BASE_URL = !process.env.RUN_IN_DOCKER - ? `http://localhost:${PORT}` - : `http://host.docker.internal:${PORT}`; + ? `http://localhost:${PORT}/simple?hideMenu` + : `http://host.docker.internal:${PORT}/simple?hideMenu`; export const PASTE_ZONE_SELECTOR = "#pasteZone"; diff --git a/tests/utils/copypaste.ts b/tests/src/utils/copypaste.ts similarity index 100% rename from tests/utils/copypaste.ts rename to tests/src/utils/copypaste.ts diff --git a/tests/src/utils/customblocks/Alert.tsx b/tests/src/utils/customblocks/Alert.tsx new file mode 100644 index 0000000000..1585f81de3 --- /dev/null +++ b/tests/src/utils/customblocks/Alert.tsx @@ -0,0 +1,149 @@ +import { BlockSchema, createBlockSpec, defaultProps } from "@blocknote/core"; +import { ReactSlashMenuItem } from "@blocknote/react"; +import { RiAlertFill } from "react-icons/ri"; +const values = { + warning: { + icon: "⚠️", + backgroundColor: "#fbf3db", + }, + error: { + icon: "❌", + backgroundColor: "#fbe4e4", + }, + info: { + icon: "ℹ️", + backgroundColor: "#ddebf1", + }, + success: { + icon: "✅", + backgroundColor: "#ddedea", + }, +} as const; + +export const Alert = createBlockSpec( + { + type: "alert" as const, + propSchema: { + textAlignment: defaultProps.textAlignment, + textColor: defaultProps.textColor, + type: { + default: "warning", + values: ["warning", "error", "info", "success"], + }, + }, + content: "inline", + }, + { + render: (block, editor) => { + // Tests to see if types are correct: + + const test: "alert" = block.type; + console.log(test); + + // @ts-expect-error + const test1: "othertype" = block.type; + console.log(test1); + + const parent = document.createElement("div"); + parent.setAttribute( + "style", + `display: flex; background-color: ${ + values[block.props.type as keyof typeof values].backgroundColor + }` + ); + + const icon = document.createElement("div"); + icon.innerText = values[block.props.type as keyof typeof values].icon; + icon.setAttribute("contenteditable", "false"); + icon.setAttribute( + "style", + "margin-right: 0.5rem; user-select: none; cursor: pointer;" + ); + icon.addEventListener("click", () => { + const type = editor.getBlock(block)!.props.type; + + if (type === "warning") { + parent.setAttribute( + "style", + `display: flex; background-color: ${values["error"].backgroundColor}` + ); + editor.updateBlock(editor.getBlock(block)!, { + props: { + type: "error", + }, + }); + } else if (type === "error") { + parent.setAttribute( + "style", + `display: flex; background-color: ${values["info"].backgroundColor}` + ); + editor.updateBlock(editor.getBlock(block)!, { + props: { + type: "info", + }, + }); + } else if (type === "info") { + parent.setAttribute( + "style", + `display: flex; background-color: ${values["success"].backgroundColor}` + ); + editor.updateBlock(editor.getBlock(block)!, { + props: { + type: "success", + }, + }); + } else if (type === "success") { + parent.setAttribute( + "style", + `display: flex; background-color: ${values["warning"].backgroundColor}` + ); + editor.updateBlock(editor.getBlock(block)!, { + props: { + type: "warning", + }, + }); + } else { + throw new Error("Unknown alert type"); + } + }); + + const text = document.createElement("div"); + + parent.appendChild(icon); + parent.appendChild(text); + + return { + dom: parent, + contentDOM: text, + }; + }, + } +); + +export const insertAlert: ReactSlashMenuItem = { + name: "Insert Alert", + execute: (editor) => { + // editor.topLevelBlocks[0] + editor.insertBlocks( + [ + { + type: "alert", + }, + ], + editor.getTextCursorPosition().block, + "after" + ); + }, + aliases: [ + "alert", + "notification", + "emphasize", + "warning", + "error", + "info", + "success", + ], + group: "Media", + icon: , + hint: "Insert an alert block to emphasize text", +}; diff --git a/tests/src/utils/customblocks/Button.tsx b/tests/src/utils/customblocks/Button.tsx new file mode 100644 index 0000000000..7e2a46d5ac --- /dev/null +++ b/tests/src/utils/customblocks/Button.tsx @@ -0,0 +1,62 @@ +import { + BlockSchemaWithBlock, + createBlockSpec, + defaultProps, +} from "@blocknote/core"; +import { ReactSlashMenuItem } from "@blocknote/react"; +import { RiRadioButtonFill } from "react-icons/ri"; + +export const Button = createBlockSpec( + { + type: "button" as const, + propSchema: { + backgroundColor: defaultProps.backgroundColor, + } as const, + content: "none", + }, + { + render: (block, editor) => { + const button = document.createElement("button"); + button.innerText = "Insert Block Below"; + button.addEventListener("click", () => { + editor.insertBlocks( + [ + { + type: "paragraph", + content: "Hello World", + } as any, // TODO + ], + editor.getBlock(block)!, + "after" + ); + }); + + return { + dom: button, + }; + }, + } +); + +export const insertButton: ReactSlashMenuItem< + BlockSchemaWithBlock<"button", typeof Button.config>, + any, + any +> = { + name: "Insert Button", + execute: (editor) => { + editor.insertBlocks( + [ + { + type: "button", + }, + ], + editor.getTextCursorPosition().block, + "after" + ); + }, + aliases: ["button", "click", "action"], + group: "Media", + icon: , + hint: "Insert a button which inserts a block below it", +}; diff --git a/tests/src/utils/customblocks/Embed.tsx b/tests/src/utils/customblocks/Embed.tsx new file mode 100644 index 0000000000..d63d022122 --- /dev/null +++ b/tests/src/utils/customblocks/Embed.tsx @@ -0,0 +1,56 @@ +import { BlockSchemaWithBlock, createBlockSpec } from "@blocknote/core"; +import { ReactSlashMenuItem } from "@blocknote/react"; +import { RiLayout5Fill } from "react-icons/ri"; + +export const Embed = createBlockSpec( + { + type: "embed" as const, + propSchema: { + src: { + default: "https://www.youtube.com/embed/wjfuB8Xjhc4", + }, + } as const, + content: "none", + }, + { + render: (block) => { + const embed = document.createElement("iframe"); + embed.setAttribute("src", block.props.src); + embed.setAttribute("contenteditable", "false"); + embed.setAttribute("border", "1px solid black"); + embed.setAttribute("width", "500px"); + embed.setAttribute("height", "300px"); + + return { + dom: embed, + }; + }, + } +); + +export const insertEmbed: ReactSlashMenuItem< + BlockSchemaWithBlock<"embed", typeof Embed.config>, + any, + any +> = { + name: "Insert Embedded Website", + execute: (editor) => { + const src = prompt("Enter website URL"); + editor.insertBlocks( + [ + { + type: "embed", + props: { + src: src || "https://www.youtube.com/embed/wjfuB8Xjhc4", + }, + }, + ], + editor.getTextCursorPosition().block, + "after" + ); + }, + aliases: ["embedded", "website", "site", "link", "url"], + group: "Media", + icon: , + hint: "Insert an embedded website", +}; diff --git a/tests/src/utils/customblocks/Image.tsx b/tests/src/utils/customblocks/Image.tsx new file mode 100644 index 0000000000..789a1900d5 --- /dev/null +++ b/tests/src/utils/customblocks/Image.tsx @@ -0,0 +1,77 @@ +import { + BlockSchemaWithBlock, + createBlockSpec, + defaultProps, +} from "@blocknote/core"; +import { ReactSlashMenuItem } from "@blocknote/react"; +import { RiImage2Fill } from "react-icons/ri"; +export const Image = createBlockSpec( + { + type: "image" as const, + propSchema: { + ...defaultProps, + src: { + default: "https://via.placeholder.com/1000", + }, + } as const, + content: "inline", + }, + { + render: (block) => { + const image = document.createElement("img"); + image.setAttribute("src", block.props.src); + image.setAttribute("contenteditable", "false"); + image.setAttribute("style", "width: 100%"); + image.setAttribute("alt", "Image"); + + const caption = document.createElement("div"); + caption.setAttribute("style", "flex-grow: 1"); + + const parent = document.createElement("div"); + parent.setAttribute("style", "display: flex; flex-direction: column;"); + parent.appendChild(image); + parent.appendChild(caption); + + return { + dom: parent, + contentDOM: caption, + }; + }, + parse: (element) => { + if (element.hasAttribute("src")) { + return { + src: element.getAttribute("src")!, + }; + } + + return; + }, + } +); + +export const insertImage: ReactSlashMenuItem< + BlockSchemaWithBlock<"image", typeof Image.config>, + any, + any +> = { + name: "Insert Image", + execute: (editor) => { + const src = prompt("Enter image URL") || "https://via.placeholder.com/1000"; + editor.insertBlocks( + [ + { + type: "image", + props: { + src, + }, + }, + ], + editor.getTextCursorPosition().block, + "after" + ); + }, + aliases: ["image", "img", "picture", "media"], + group: "Media", + icon: , + hint: "Insert an image", +}; diff --git a/tests/src/utils/customblocks/ReactAlert.tsx b/tests/src/utils/customblocks/ReactAlert.tsx new file mode 100644 index 0000000000..263281a32e --- /dev/null +++ b/tests/src/utils/customblocks/ReactAlert.tsx @@ -0,0 +1,146 @@ +import { BlockSchemaWithBlock, defaultProps } from "@blocknote/core"; +import { ReactSlashMenuItem, createReactBlockSpec } from "@blocknote/react"; +import { useEffect, useState } from "react"; +import { RiAlertFill } from "react-icons/ri"; + +const values = { + warning: { + icon: "⚠️", + backgroundColor: "#fbf3db", + }, + error: { + icon: "❌", + backgroundColor: "#fbe4e4", + }, + info: { + icon: "ℹ️", + backgroundColor: "#ddebf1", + }, + success: { + icon: "✅", + backgroundColor: "#ddedea", + }, +} as const; + +export const ReactAlert = createReactBlockSpec( + { + type: "reactAlert" as const, + propSchema: { + textAlignment: defaultProps.textAlignment, + textColor: defaultProps.textColor, + type: { + default: "warning", + values: ["warning", "error", "info", "success"], + }, + } as const, + content: "inline", + }, + { + render: function Render(props) { + const [type, setType] = useState(props.block.props.type); + + useEffect(() => { + console.log("ReactAlert initialize"); + return () => { + console.log(" ReactAlert cleanup"); + }; + }, []); + + console.log("ReactAlert render"); + + // Tests to see if types are correct: + + const test: "reactAlert" = props.block.type; + console.log(test); + + // @ts-expect-error + const test1: "othertype" = props.block.type; + console.log(test1); + + return ( +
+
{ + if (type === "warning") { + props.editor.updateBlock(props.block, { + props: { + type: "error", + }, + }); + setType("error"); + } else if (type === "error") { + props.editor.updateBlock(props.block, { + props: { + type: "info", + }, + }); + setType("info"); + } else if (type === "info") { + props.editor.updateBlock(props.block, { + props: { + type: "success", + }, + }); + setType("success"); + } else if (type === "success") { + props.editor.updateBlock(props.block, { + props: { + type: "warning", + }, + }); + setType("warning"); + } else { + throw new Error("Unknown alert type"); + } + }}> + {values[type as keyof typeof values].icon} +
+ +
+ ); + }, + } +); +export const insertReactAler: ReactSlashMenuItem< + BlockSchemaWithBlock<"reactAlert", typeof ReactAlert.config> +> = { + name: "Insert React Alert", + execute: (editor) => { + editor.insertBlocks( + [ + { + type: "reactAlert", + }, + ], + editor.getTextCursorPosition().block, + "after" + ); + }, + aliases: [ + "react", + "reactAlert", + "react alert", + "alert", + "notification", + "emphasize", + "warning", + "error", + "info", + "success", + ], + group: "Media", + icon: , + hint: "Insert an alert block to emphasize text", +}; diff --git a/tests/src/utils/customblocks/ReactImage.tsx b/tests/src/utils/customblocks/ReactImage.tsx new file mode 100644 index 0000000000..5de8b4f56f --- /dev/null +++ b/tests/src/utils/customblocks/ReactImage.tsx @@ -0,0 +1,70 @@ +import { BlockSchemaWithBlock, defaultProps } from "@blocknote/core"; +import { ReactSlashMenuItem, createReactBlockSpec } from "@blocknote/react"; +import { RiImage2Fill } from "react-icons/ri"; + +export const ReactImage = createReactBlockSpec( + { + type: "reactImage" as const, + propSchema: { + ...defaultProps, + src: { + default: "https://via.placeholder.com/1000", + }, + } as const, + content: "inline", + }, + { + render: ({ block, contentRef }) => { + return ( +
+ {"test"} + +
+ ); + }, + } +); + +export const insertReactImage: ReactSlashMenuItem< + BlockSchemaWithBlock<"reactImage", typeof ReactImage.config> +> = { + name: "Insert React Image", + execute: (editor) => { + const src = prompt("Enter image URL") || "https://via.placeholder.com/1000"; + editor.insertBlocks( + [ + { + type: "reactImage", + props: { + src, + }, + }, + ], + editor.getTextCursorPosition().block, + "after" + ); + }, + aliases: [ + "react", + "reactImage", + "react image", + "image", + "img", + "picture", + "media", + ], + group: "Media", + icon: , + hint: "Insert an image", +}; diff --git a/tests/src/utils/customblocks/Separator.tsx b/tests/src/utils/customblocks/Separator.tsx new file mode 100644 index 0000000000..d01e6c5ca7 --- /dev/null +++ b/tests/src/utils/customblocks/Separator.tsx @@ -0,0 +1,53 @@ +import { BlockSchemaWithBlock, createBlockSpec } from "@blocknote/core"; +import { ReactSlashMenuItem } from "@blocknote/react"; +import { RiSeparator } from "react-icons/ri"; + +export const Separator = createBlockSpec( + { + type: "separator" as const, + propSchema: {} as const, + content: "none", + }, + { + render: () => { + const separator = document.createElement("div"); + separator.setAttribute( + "style", + "height: 1px; background-color: black; width: 100%;" + ); + + const parent = document.createElement("div"); + parent.setAttribute( + "style", + "height: 1rem; display: flex; justify-content: center; align-items: center;" + ); + parent.appendChild(separator); + + return { + dom: parent, + }; + }, + } +); + +export const insertSeparator: ReactSlashMenuItem< + BlockSchemaWithBlock<"separator", typeof Separator.config> +> = { + name: "Insert Separator", + execute: (editor) => { + editor.insertBlocks( + [ + { + type: "separator", + }, + ], + editor.getTextCursorPosition().block, + "after" + ); + }, + + aliases: ["separator", "horizontal", "line", "rule"], + group: "Media", + icon: , + hint: "Insert a button which inserts a block below it", +}; diff --git a/tests/utils/customblocks/TableOfContents.tsx b/tests/src/utils/customblocks/TableOfContents.tsx.bak similarity index 52% rename from tests/utils/customblocks/TableOfContents.tsx rename to tests/src/utils/customblocks/TableOfContents.tsx.bak index e29844d952..eb98686834 100644 --- a/tests/utils/customblocks/TableOfContents.tsx +++ b/tests/src/utils/customblocks/TableOfContents.tsx.bak @@ -1,13 +1,13 @@ import { Block, - BlockSchema, + BlockSchemaWithBlock, createBlockSpec, InlineContent, } from "@blocknote/core"; import { ReactSlashMenuItem } from "@blocknote/react"; import { RiLayout5Fill } from "react-icons/ri"; -function inlineContentToText(inlineContent: InlineContent[]) { +function inlineContentToText(inlineContent: InlineContent[]) { return inlineContent.reduce((string, content) => { if (content.type === "link") { return ( @@ -22,7 +22,7 @@ function inlineContentToText(inlineContent: InlineContent[]) { }, ""); } -function createHeadingElements(block: Block) { +function createHeadingElements(block: Block) { const heading: HTMLElement = document.createElement("li"); const text = document.createElement("p"); text.innerText = inlineContentToText(block.content); @@ -41,33 +41,37 @@ function createHeadingElements(block: Block) { return heading; } -export const TableOfContents = createBlockSpec({ - type: "toc" as const, - propSchema: {} as const, - containsInlineContent: false, - render: (_, editor) => { - const toc = document.createElement("ol"); +export const TableOfContents = createBlockSpec( + { + type: "toc" as const, + propSchema: {} as const, + content: "none", + }, + { + render: (_, editor) => { + const toc = document.createElement("ol"); - editor.onEditorContentChange(() => { - toc.innerHTML = ""; - for (const block of editor.topLevelBlocks) { - if (block.type === "heading") { - toc.appendChild(createHeadingElements(block)); + editor.onEditorContentChange(() => { + toc.innerHTML = ""; + for (const block of editor.topLevelBlocks) { + if (block.type === "heading") { + toc.appendChild(createHeadingElements(block)); + } } - } - }); + }); - return { - dom: toc, - }; - }, -}); + return { + dom: toc, + }; + }, + } +); -export const insertTableOfContents = new ReactSlashMenuItem<{ - toc: typeof TableOfContents; -}>( - "Insert Table of Contents", - (editor) => { +export const insertTableOfContents: ReactSlashMenuItem< + BlockSchemaWithBlock<"toc", typeof TableOfContents.config> +> = { + name: "Insert Separator", + execute: (editor) => { editor.insertBlocks( [ { @@ -78,8 +82,9 @@ export const insertTableOfContents = new ReactSlashMenuItem<{ "after" ); }, - ["toc", "table", "contents", "navigation", "headings"], - "Media", - , - "Insert a table of contents" -); + + aliases: ["toc", "table", "contents", "navigation", "headings"], + group: "Media", + icon: , + hint: "Insert a table of contents", +}; diff --git a/tests/utils/debug.ts b/tests/src/utils/debug.ts similarity index 92% rename from tests/utils/debug.ts rename to tests/src/utils/debug.ts index 42dfe5866f..687aa5313f 100644 --- a/tests/utils/debug.ts +++ b/tests/src/utils/debug.ts @@ -2,9 +2,9 @@ import { Page } from "@playwright/test"; export async function showMouseCursor(page: Page) { await page.evaluate(() => { - if (window !== window.parent) return; + if (window !== window.parent) {return;} - let cursorStyle = { + const cursorStyle = { position: "absolute", left: "0", top: "0", @@ -20,7 +20,7 @@ export async function showMouseCursor(page: Page) { }; let cssString = ""; - for (let [key, value] of Object.entries(cursorStyle)) { + for (const [key, value] of Object.entries(cursorStyle)) { cssString += key + ":" + value + ";"; } diff --git a/tests/utils/draghandle.ts b/tests/src/utils/draghandle.ts similarity index 85% rename from tests/utils/draghandle.ts rename to tests/src/utils/draghandle.ts index a576070b85..ea0c55d711 100644 --- a/tests/utils/draghandle.ts +++ b/tests/src/utils/draghandle.ts @@ -1,5 +1,5 @@ import { Page } from "@playwright/test"; -import { DRAG_HANDLE_SELECTOR, DRAG_HANDLE_ADD_SELECTOR } from "./const"; +import { DRAG_HANDLE_ADD_SELECTOR, DRAG_HANDLE_SELECTOR } from "./const"; import { moveMouseOverElement } from "./mouse"; export async function addBlockFromDragHandle(page: Page, blockQuery: string) { @@ -22,6 +22,6 @@ export async function getDragHandleYCoord(page: Page, selector: string) { const element = await page.locator(selector); await moveMouseOverElement(page, element); await page.waitForSelector(DRAG_HANDLE_SELECTOR); - const boundingBox = await page.locator(DRAG_HANDLE_SELECTOR).boundingBox(); + const boundingBox = (await page.locator(DRAG_HANDLE_SELECTOR).boundingBox())!; return boundingBox.y; } diff --git a/tests/utils/editor.ts b/tests/src/utils/editor.ts similarity index 89% rename from tests/utils/editor.ts rename to tests/src/utils/editor.ts index 4885df016a..168a229c39 100644 --- a/tests/utils/editor.ts +++ b/tests/src/utils/editor.ts @@ -22,8 +22,8 @@ export async function getDoc(page: Page) { return doc; } -export function removeAttFromDoc(doc: unknown, att: string) { - if (typeof doc !== "object" || doc === null) return; +export function removeAttFromDoc(doc: any, att: string) { + if (typeof doc !== "object" || doc === null) {return;} if (Object.keys(doc).includes(att)) { delete doc[att]; } diff --git a/tests/utils/mouse.ts b/tests/src/utils/mouse.ts similarity index 77% rename from tests/utils/mouse.ts rename to tests/src/utils/mouse.ts index 308b4f39b7..2f9037293c 100644 --- a/tests/utils/mouse.ts +++ b/tests/src/utils/mouse.ts @@ -1,22 +1,22 @@ import { Locator, Page } from "@playwright/test"; import { DRAG_HANDLE_SELECTOR } from "./const"; -async function getElementLeftCoords(page: Page, element: Locator) { - const boundingBox = await element.boundingBox(); +async function getElementLeftCoords(_page: Page, element: Locator) { + const boundingBox = (await element.boundingBox())!; const centerY = boundingBox.y + boundingBox.height / 2; return { x: boundingBox.x + 1, y: centerY }; } -async function getElementRightCoords(page: Page, element: Locator) { - const boundingBox = await element.boundingBox(); +async function getElementRightCoords(_page: Page, element: Locator) { + const boundingBox = (await element.boundingBox())!; const centerY = boundingBox.y + boundingBox.height / 2; return { x: boundingBox.x + boundingBox.width - 1, y: centerY }; } -async function getElementCenterCoords(page: Page, element: Locator) { - const boundingBox = await element.boundingBox(); +async function getElementCenterCoords(_page: Page, element: Locator) { + const boundingBox = (await element.boundingBox())!; const centerX = boundingBox.x + boundingBox.width / 2; const centerY = boundingBox.y + boundingBox.height / 2; @@ -24,7 +24,7 @@ async function getElementCenterCoords(page: Page, element: Locator) { } export async function moveMouseOverElement(page: Page, element: Locator) { - const boundingBox = await element.boundingBox(); + const boundingBox = (await element.boundingBox())!; const coords = { x: boundingBox.x, y: boundingBox.y }; await page.mouse.move(coords.x, coords.y, { steps: 5 }); } diff --git a/tests/utils/slashmenu.ts b/tests/src/utils/slashmenu.ts similarity index 100% rename from tests/utils/slashmenu.ts rename to tests/src/utils/slashmenu.ts diff --git a/tests/tsconfig.json b/tests/tsconfig.json new file mode 100644 index 0000000000..3e9d8d8cf2 --- /dev/null +++ b/tests/tsconfig.json @@ -0,0 +1,32 @@ +{ + "compilerOptions": { + "target": "ESNext", + "useDefineForClassFields": true, + "module": "ESNext", + "lib": ["ESNext", "DOM"], + "moduleResolution": "Node", + "jsx": "react-jsx", + "strict": true, + "sourceMap": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "noEmit": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "outDir": "dist", + "declaration": true, + "declarationDir": "types", + "composite": true, + "skipLibCheck": true + }, + "include": ["src"], + "references": [ + { + "path": "../packages/core" + }, + { + "path": "../packages/react" + } + ] +} diff --git a/tests/utils/customblocks/Alert.tsx b/tests/utils/customblocks/Alert.tsx deleted file mode 100644 index 8df5df14f1..0000000000 --- a/tests/utils/customblocks/Alert.tsx +++ /dev/null @@ -1,139 +0,0 @@ -import { createBlockSpec, defaultProps } from "@blocknote/core"; -import { ReactSlashMenuItem } from "@blocknote/react"; -import { RiAlertFill } from "react-icons/ri"; - -const values = { - warning: { - icon: "⚠️", - backgroundColor: "#fbf3db", - }, - error: { - icon: "❌", - backgroundColor: "#fbe4e4", - }, - info: { - icon: "ℹ️", - backgroundColor: "#ddebf1", - }, - success: { - icon: "✅", - backgroundColor: "#ddedea", - }, -} as const; - -export const Alert = createBlockSpec({ - type: "alert" as const, - propSchema: { - textAlignment: defaultProps.textAlignment, - textColor: defaultProps.textColor, - type: { - default: "warning", - values: ["warning", "error", "info", "success"], - }, - } as const, - containsInlineContent: true, - render: (block, editor) => { - // Tests to see if types are correct: - - let test: "alert" = block.type; - console.log(test); - - // @ts-expect-error - let test1: "othertype" = block.type; - console.log(test1); - - const parent = document.createElement("div"); - parent.setAttribute( - "style", - `display: flex; background-color: ${ - values[block.props.type as keyof typeof values].backgroundColor - }` - ); - - const icon = document.createElement("div"); - icon.innerText = values[block.props.type as keyof typeof values].icon; - icon.setAttribute("contenteditable", "false"); - icon.setAttribute( - "style", - "margin-right: 0.5rem; user-select: none; cursor: pointer;" - ); - icon.addEventListener("click", () => { - const type = editor.getBlock(block)!.props.type; - - if (type === "warning") { - parent.setAttribute( - "style", - `display: flex; background-color: ${values["error"].backgroundColor}` - ); - editor.updateBlock(editor.getBlock(block)!, { - props: { - type: "error", - }, - }); - } else if (type === "error") { - parent.setAttribute( - "style", - `display: flex; background-color: ${values["info"].backgroundColor}` - ); - editor.updateBlock(editor.getBlock(block)!, { - props: { - type: "info", - }, - }); - } else if (type === "info") { - parent.setAttribute( - "style", - `display: flex; background-color: ${values["success"].backgroundColor}` - ); - editor.updateBlock(editor.getBlock(block)!, { - props: { - type: "success", - }, - }); - } else if (type === "success") { - parent.setAttribute( - "style", - `display: flex; background-color: ${values["warning"].backgroundColor}` - ); - editor.updateBlock(editor.getBlock(block)!, { - props: { - type: "warning", - }, - }); - } else { - throw new Error("Unknown alert type"); - } - }); - - const text = document.createElement("div"); - - parent.appendChild(icon); - parent.appendChild(text); - - return { - dom: parent, - contentDOM: text, - }; - }, -}); - -export const insertAlert = new ReactSlashMenuItem<{ - alert: typeof Alert; -}>( - "Insert Alert", - (editor) => { - editor.insertBlocks( - [ - { - type: "alert", - }, - ], - editor.getTextCursorPosition().block, - "after" - ); - }, - ["alert", "notification", "emphasize", "warning", "error", "info", "success"], - "Media", - , - "Insert an alert block to emphasize text" -); diff --git a/tests/utils/customblocks/Button.tsx b/tests/utils/customblocks/Button.tsx deleted file mode 100644 index 5e861e63ae..0000000000 --- a/tests/utils/customblocks/Button.tsx +++ /dev/null @@ -1,52 +0,0 @@ -import { createBlockSpec, defaultProps } from "@blocknote/core"; -import { ReactSlashMenuItem } from "@blocknote/react"; -import { RiRadioButtonFill } from "react-icons/ri"; - -export const Button = createBlockSpec({ - type: "button" as const, - propSchema: { - backgroundColor: defaultProps.backgroundColor, - } as const, - containsInlineContent: false, - render: (block, editor) => { - const button = document.createElement("button"); - button.innerText = "Insert Block Below"; - button.addEventListener("click", () => { - editor.insertBlocks( - [ - { - type: "paragraph", - content: "Hello World", - }, - ], - editor.getBlock(block)!, - "after" - ); - }); - - return { - dom: button, - }; - }, -}); - -export const insertButton = new ReactSlashMenuItem<{ - button: typeof Button; -}>( - "Insert Button", - (editor) => { - editor.insertBlocks( - [ - { - type: "button", - }, - ], - editor.getTextCursorPosition().block, - "after" - ); - }, - ["button", "click", "action"], - "Media", - , - "Insert a button which inserts a block below it" -); diff --git a/tests/utils/customblocks/Embed.tsx b/tests/utils/customblocks/Embed.tsx deleted file mode 100644 index 9fbd822012..0000000000 --- a/tests/utils/customblocks/Embed.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import { createBlockSpec } from "@blocknote/core"; -import { ReactSlashMenuItem } from "@blocknote/react"; -import { RiLayout5Fill } from "react-icons/ri"; - -export const Embed = createBlockSpec({ - type: "embed" as const, - propSchema: { - src: { - default: "https://www.youtube.com/embed/wjfuB8Xjhc4", - }, - } as const, - containsInlineContent: false, - render: (block) => { - const embed = document.createElement("iframe"); - embed.setAttribute("src", block.props.src); - embed.setAttribute("contenteditable", "false"); - embed.setAttribute("border", "1px solid black"); - embed.setAttribute("width", "500px"); - embed.setAttribute("height", "300px"); - - return { - dom: embed, - }; - }, -}); - -export const insertEmbed = new ReactSlashMenuItem<{ - embed: typeof Embed; -}>( - "Insert Embedded Website", - (editor) => { - const src = prompt("Enter website URL"); - editor.insertBlocks( - [ - { - type: "embed", - props: { - src: src || "https://www.youtube.com/embed/wjfuB8Xjhc4", - }, - }, - ], - editor.getTextCursorPosition().block, - "after" - ); - }, - ["embedded", "website", "site", "link", "url"], - "Media", - , - "Insert an embedded website" -); diff --git a/tests/utils/customblocks/Image.tsx b/tests/utils/customblocks/Image.tsx deleted file mode 100644 index cf426d38e0..0000000000 --- a/tests/utils/customblocks/Image.tsx +++ /dev/null @@ -1,69 +0,0 @@ -import { BlockSchema, createBlockSpec, defaultProps } from "@blocknote/core"; -import { ReactSlashMenuItem } from "@blocknote/react"; -import { RiImage2Fill } from "react-icons/ri"; - -export const Image = createBlockSpec({ - type: "image" as const, - propSchema: { - ...defaultProps, - src: { - default: "https://via.placeholder.com/1000", - }, - } as const, - containsInlineContent: true, - render: (block) => { - const image = document.createElement("img"); - image.setAttribute("src", block.props.src); - image.setAttribute("contenteditable", "false"); - image.setAttribute("style", "width: 100%"); - image.setAttribute("alt", "Image"); - - const caption = document.createElement("div"); - caption.setAttribute("style", "flex-grow: 1"); - - const parent = document.createElement("div"); - parent.setAttribute("style", "display: flex; flex-direction: column;"); - parent.appendChild(image); - parent.appendChild(caption); - - return { - dom: parent, - contentDOM: caption, - }; - }, - parse: (element) => { - if (element.hasAttribute("src")) { - return { - type: "image", - props: { - src: element.getAttribute("src")!, - }, - }; - } - - return; - }, -}); - -export const insertImage = { - name: "Insert Image", - execute: (editor) => { - const src = prompt("Enter image URL"); - editor.insertBlocks( - [ - { - type: "image", - props: { - src: src || "https://via.placeholder.com/1000", - }, - }, - ], - editor.getTextCursorPosition().block, - "after" - ); - }, - aliases: ["image", "img", "picture", "media"], - group: "Media", - icon: , - hint: "Insert an image", -} satisfies ReactSlashMenuItem; diff --git a/tests/utils/customblocks/ReactAlert.tsx b/tests/utils/customblocks/ReactAlert.tsx deleted file mode 100644 index e89b8586c4..0000000000 --- a/tests/utils/customblocks/ReactAlert.tsx +++ /dev/null @@ -1,145 +0,0 @@ -import { defaultProps } from "@blocknote/core"; -import { - createReactBlockSpec, - InlineContent, - ReactSlashMenuItem, -} from "@blocknote/react"; -import { useEffect, useState } from "react"; -import { RiAlertFill } from "react-icons/ri"; - -const values = { - warning: { - icon: "⚠️", - backgroundColor: "#fbf3db", - }, - error: { - icon: "❌", - backgroundColor: "#fbe4e4", - }, - info: { - icon: "ℹ️", - backgroundColor: "#ddebf1", - }, - success: { - icon: "✅", - backgroundColor: "#ddedea", - }, -} as const; - -export const ReactAlert = createReactBlockSpec({ - type: "reactAlert" as const, - propSchema: { - textAlignment: defaultProps.textAlignment, - textColor: defaultProps.textColor, - type: { - default: "warning", - values: ["warning", "error", "info", "success"], - }, - } as const, - containsInlineContent: true, - render: (props) => { - const [type, setType] = useState(props.block.props.type); - - useEffect(() => { - console.log("ReactAlert initialize"); - return () => { - console.log(" ReactAlert cleanup"); - }; - }, []); - - console.log("ReactAlert render"); - - // Tests to see if types are correct: - - let test: "reactAlert" = props.block.type; - console.log(test); - - // @ts-expect-error - let test1: "othertype" = props.block.type; - console.log(test1); - - return ( -
-
{ - if (type === "warning") { - props.editor.updateBlock(props.block, { - props: { - type: "error", - }, - }); - setType("error"); - } else if (type === "error") { - props.editor.updateBlock(props.block, { - props: { - type: "info", - }, - }); - setType("info"); - } else if (type === "info") { - props.editor.updateBlock(props.block, { - props: { - type: "success", - }, - }); - setType("success"); - } else if (type === "success") { - props.editor.updateBlock(props.block, { - props: { - type: "warning", - }, - }); - setType("warning"); - } else { - throw new Error("Unknown alert type"); - } - }}> - {values[type as keyof typeof values].icon} -
- -
- ); - }, -}); -export const insertReactAlert = new ReactSlashMenuItem<{ - reactAlert: typeof ReactAlert; -}>( - "Insert React Alert", - (editor) => { - editor.insertBlocks( - [ - { - type: "reactAlert", - }, - ], - editor.getTextCursorPosition().block, - "after" - ); - }, - [ - "react", - "reactAlert", - "react alert", - "alert", - "notification", - "emphasize", - "warning", - "error", - "info", - "success", - ], - "Media", - , - "Insert an alert block to emphasize text" -); diff --git a/tests/utils/customblocks/ReactImage.tsx b/tests/utils/customblocks/ReactImage.tsx deleted file mode 100644 index 735f592b82..0000000000 --- a/tests/utils/customblocks/ReactImage.tsx +++ /dev/null @@ -1,68 +0,0 @@ -import { - InlineContent, - createReactBlockSpec, - ReactSlashMenuItem, -} from "@blocknote/react"; -import { BlockSchema, defaultProps } from "@blocknote/core"; -import { RiImage2Fill } from "react-icons/ri"; - -export const ReactImage = createReactBlockSpec({ - type: "reactImage" as const, - propSchema: { - ...defaultProps, - src: { - default: "https://via.placeholder.com/1000", - }, - } as const, - containsInlineContent: true, - render: ({ block }) => { - return ( -
- {"Image"} - -
- ); - }, -}); - -export const insertReactImage = { - name: "Insert React Image", - execute: (editor) => { - const src = prompt("Enter image URL"); - editor.insertBlocks( - [ - { - type: "reactImage", - props: { - src: src || "https://via.placeholder.com/1000", - }, - }, - ], - editor.getTextCursorPosition().block, - "after" - ); - }, - aliases: [ - "react", - "reactImage", - "react image", - "image", - "img", - "picture", - "media", - ], - group: "Media", - icon: , - hint: "Insert an image", -} satisfies ReactSlashMenuItem; diff --git a/tests/utils/customblocks/Separator.tsx b/tests/utils/customblocks/Separator.tsx deleted file mode 100644 index 39e84067d7..0000000000 --- a/tests/utils/customblocks/Separator.tsx +++ /dev/null @@ -1,48 +0,0 @@ -import { createBlockSpec } from "@blocknote/core"; -import { ReactSlashMenuItem } from "@blocknote/react"; -import { RiSeparator } from "react-icons/ri"; - -export const Separator = createBlockSpec({ - type: "separator" as const, - propSchema: {} as const, - containsInlineContent: false, - render: () => { - const separator = document.createElement("div"); - separator.setAttribute( - "style", - "height: 1px; background-color: black; width: 100%;" - ); - - const parent = document.createElement("div"); - parent.setAttribute( - "style", - "height: 1rem; display: flex; justify-content: center; align-items: center;" - ); - parent.appendChild(separator); - - return { - dom: parent, - }; - }, -}); - -export const insertSeparator = new ReactSlashMenuItem<{ - separator: typeof Separator; -}>( - "Insert Separator", - (editor) => { - editor.insertBlocks( - [ - { - type: "separator", - }, - ], - editor.getTextCursorPosition().block, - "after" - ); - }, - ["separator", "horizontal", "line", "rule"], - "Media", - , - "Insert a button which inserts a block below it" -);