From 221735095d30d5ec65ed35316cf7b32b62876729 Mon Sep 17 00:00:00 2001 From: Caio Pizzol Date: Thu, 19 Mar 2026 18:54:51 -0300 Subject: [PATCH 1/3] feat(ci): run demo tests against local workspace code Mirrors the examples approach: - Add pnpm overrides for superdoc and @superdoc-dev/react so demos resolve from local workspace instead of npm - Add demos/* and demos/*/* to pnpm workspace - Rewrite ci-demos workflow: shared build job with pnpm workspace install, expanded path triggers (packages/superdoc, super-editor, layout-engine, react), Playwright browser cache - Increase smoke test timeouts for SPA hydration and dev server startup --- .github/workflows/ci-demos.yml | 69 ++++++++++++++++++++++------ demos/__tests__/playwright.config.ts | 2 +- demos/__tests__/smoke.spec.ts | 4 +- pnpm-lock.yaml | 12 +++-- 4 files changed, 66 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci-demos.yml b/.github/workflows/ci-demos.yml index e7553e147a..9d02af75fa 100644 --- a/.github/workflows/ci-demos.yml +++ b/.github/workflows/ci-demos.yml @@ -4,10 +4,47 @@ on: pull_request: paths: - 'demos/**' + - 'packages/superdoc/**' + - 'packages/react/**' + - 'packages/super-editor/**' + - 'packages/layout-engine/**' + - 'shared/**' workflow_dispatch: jobs: - validate: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - uses: pnpm/action-setup@v4 + + - name: Setup Node.js + uses: actions/setup-node@v6 + with: + node-version: '20' + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Build superdoc + run: pnpm build:superdoc + + - name: Install Playwright + working-directory: demos/__tests__ + run: npx playwright install chromium + + - name: Cache workspace + uses: actions/cache/save@v4 + with: + path: | + . + ~/.cache/ms-playwright + key: demos-workspace-${{ github.sha }} + + smoke-test: + needs: build runs-on: ubuntu-latest strategy: fail-fast: false @@ -32,21 +69,25 @@ jobs: - vanilla - vue steps: - - uses: actions/checkout@v6 - - - name: Setup Node.js - uses: actions/setup-node@v6 + - name: Restore workspace + uses: actions/cache/restore@v4 with: - node-version: '20' - - - name: Install demo dependencies - working-directory: demos/${{ matrix.demo }} - run: npm install - - - name: Install smoke test dependencies - working-directory: demos/__tests__ - run: npm install && npx playwright install chromium + path: | + . + ~/.cache/ms-playwright + key: demos-workspace-${{ github.sha }} - name: Run smoke test working-directory: demos/__tests__ run: DEMO=${{ matrix.demo }} npx playwright test + + validate: + if: always() + needs: [smoke-test] + runs-on: ubuntu-latest + steps: + - name: Check results + run: | + if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" ]]; then + exit 1 + fi diff --git a/demos/__tests__/playwright.config.ts b/demos/__tests__/playwright.config.ts index e2cf1b0b68..5edac71df2 100644 --- a/demos/__tests__/playwright.config.ts +++ b/demos/__tests__/playwright.config.ts @@ -34,7 +34,7 @@ export default defineConfig({ webServer: { command, url: `http://localhost:${port}`, - timeout: 30_000, + timeout: 120_000, reuseExistingServer: !process.env.CI, }, use: { diff --git a/demos/__tests__/smoke.spec.ts b/demos/__tests__/smoke.spec.ts index 72172785e9..c4b3e1dcd4 100644 --- a/demos/__tests__/smoke.spec.ts +++ b/demos/__tests__/smoke.spec.ts @@ -15,7 +15,9 @@ test('demo loads without errors', async ({ page }) => { ); await page.goto('/'); - await expect(page.locator('body')).toBeVisible(); + // SPA frameworks (e.g. Next.js) may hide the body during hydration; + // give them enough time to mount before checking visibility. + await expect(page.locator('body')).toBeVisible({ timeout: 30_000 }); // Give the app a moment to initialize (SuperDoc is async) await page.waitForTimeout(2000); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index dc17aee42a..9f6d6a961f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -984,7 +984,7 @@ importers: version: 19.2.4(react@19.2.4) styled-jsx: specifier: ^5.1.7 - version: 5.1.7(react@19.2.4) + version: 5.1.7(@babel/core@7.29.0)(react@19.2.4) superdoc: specifier: workspace:* version: link:../../packages/superdoc @@ -1053,7 +1053,7 @@ importers: version: 19.2.4(react@19.2.4) styled-jsx: specifier: ^5.1.7 - version: 5.1.7(react@19.2.4) + version: 5.1.7(@babel/core@7.29.0)(react@19.2.4) superdoc: specifier: workspace:* version: link:../../packages/superdoc @@ -1088,7 +1088,7 @@ importers: version: 19.2.4(react@19.2.4) styled-jsx: specifier: ^5.1.7 - version: 5.1.7(react@19.2.4) + version: 5.1.7(@babel/core@7.29.0)(react@19.2.4) superdoc: specifier: workspace:* version: link:../../packages/superdoc @@ -36079,7 +36079,7 @@ snapshots: hosted-git-info@9.0.2: dependencies: - lru-cache: 11.2.5 + lru-cache: 11.2.7 hpack.js@2.1.6: dependencies: @@ -43389,10 +43389,12 @@ snapshots: client-only: 0.0.1 react: 19.2.4 - styled-jsx@5.1.7(react@19.2.4): + styled-jsx@5.1.7(@babel/core@7.29.0)(react@19.2.4): dependencies: client-only: 0.0.1 react: 19.2.4 + optionalDependencies: + '@babel/core': 7.29.0 stylehacks@7.0.8(postcss@8.5.8): dependencies: From fc445aaad32b5edc574deb084bcdec8a91265709 Mon Sep 17 00:00:00 2001 From: Caio Pizzol Date: Thu, 19 Mar 2026 19:04:31 -0300 Subject: [PATCH 2/3] fix(ci): trigger demos CI on root config file changes Changes to package.json, pnpm-lock.yaml, or pnpm-workspace.yaml affect workspace resolution and can break demo installs. --- .github/workflows/ci-demos.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci-demos.yml b/.github/workflows/ci-demos.yml index 9d02af75fa..2e3b0e1ed2 100644 --- a/.github/workflows/ci-demos.yml +++ b/.github/workflows/ci-demos.yml @@ -9,6 +9,9 @@ on: - 'packages/super-editor/**' - 'packages/layout-engine/**' - 'shared/**' + - 'package.json' + - 'pnpm-lock.yaml' + - 'pnpm-workspace.yaml' workflow_dispatch: jobs: From 09c65e93623d11c198c9446e985dcc148b047ece Mon Sep 17 00:00:00 2001 From: Caio Pizzol Date: Thu, 19 Mar 2026 19:09:47 -0300 Subject: [PATCH 3/3] fix(demos): add missing prosemirror-state dependency to toolbar demo The toolbar demo imports prosemirror-state directly but never declared it. Worked with npm's flat hoisting but fails with pnpm's strict module resolution. --- demos/toolbar/package.json | 1 + pnpm-lock.yaml | 3 +++ 2 files changed, 4 insertions(+) diff --git a/demos/toolbar/package.json b/demos/toolbar/package.json index 5436efd00b..95f693e9c9 100644 --- a/demos/toolbar/package.json +++ b/demos/toolbar/package.json @@ -7,6 +7,7 @@ "dev": "vite" }, "dependencies": { + "prosemirror-state": "^1.4.3", "superdoc": "latest" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9f6d6a961f..a12a022c89 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1070,6 +1070,9 @@ importers: demos/toolbar: dependencies: + prosemirror-state: + specifier: ^1.4.3 + version: 1.4.4 superdoc: specifier: workspace:* version: link:../../packages/superdoc