Files
webstudio/.github/workflows/fixtures-test.yml
T
Oleg Isonen b153fb3890 fix: Persist nested MDX heading edits (#6692)
Editing a heading inside a nested MDX template appeared in the canvas
but was lost after refreshing the Builder. Explicit line breaks in
copied headings also disappeared when text editing began, including in
Design mode outside Content Blocks.

This PR keeps Markdown block structure when serializing edits inside
nested named templates, preserves inline formatting inside headings, and
keeps existing `br` instances through text editing. Self-closing
template instances continue using their defaults.

Ref #6306

## Checklist
- [x] Reproduce the heading edit and refresh failure in the shared
project.
- [x] Add regression coverage for a heading nested through multiple
templates and verify it survives serialization and reload.
- [x] Add regression coverage for inline formatting in a self-closing
heading template; confirmed the test failed before the fix.
- [x] Preserve explicit `br` instances when entering and saving text
editing in either Builder mode; confirmed the test failed before the
fix.
- [x] Review the authoritative Content Block documentation; the existing
guidance already covers this behavior, so no documentation change is
needed.
- [x] Run the relevant tests, Builder typecheck, lint, and formatting
checks.
- [x] Review the final diff and worktree for unrelated changes.
- [x] Wait for the PR Builder compatibility endpoint before fixture
sync; fixture sync passed on Ubuntu and Windows.
- [x] Verify all GitHub checks for the latest commit.

## Verification
- Text editor interop and component tests: 21 passed.
- Builder typecheck, focused lint, formatting, and `git diff --check`
passed.
- The new line-break regression failed before the fix and passed after
it.
- Latest CI passed: Main workflow, visual regression, lint, and staging
fixtures on Ubuntu and Windows.
2026-11-15 11:07:56 +01:00

128 lines
4.3 KiB
YAML

name: Fixtures tests
on:
workflow_call:
inputs:
builder-host:
required: true
type: string
environment:
required: true
type: string
secrets:
PRIVATE_GITHUB_DEPLOY_TOKEN:
required: true
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
checks:
timeout-minutes: 20
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
environment:
name: ${{ inputs.environment }}
env:
DATABASE_URL: postgres://
AUTH_SECRET: test
BUILDER_HOST: ${{ inputs.builder-host }}
steps:
- uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
allow-unsafe-pr-checkout: ${{ github.event_name == 'pull_request_target' && github.event.action == 'labeled' && github.event.label.name == 'safe-to-deploy' }}
# Test that everything is working with submodules
- uses: ./.github/actions/submodules-checkout
with:
submodules-ssh-key: ${{ secrets.PRIVATE_GITHUB_DEPLOY_TOKEN }}
- uses: ./.github/actions/ci-setup
# Testing fixtures for vercel template
- name: Test cli --help flag
working-directory: ./fixtures/webstudio-features
run: pnpm cli:local --help
- name: Testing cli link command
run: pnpm --filter='./fixtures/*' --sequential run fixtures:link
- name: Wait for Builder deployment
shell: bash
run: |
node --input-type=module <<'NODE'
const url = `https://${process.env.BUILDER_HOST}/rest/cli-compatibility`;
for (let attempt = 1; attempt <= 30; attempt++) {
try {
const response = await fetch(url, {
headers: { "x-webstudio-automation": "webstudio" },
signal: AbortSignal.timeout(5_000),
});
await response.body?.cancel();
if (response.ok) {
console.log(`Builder is ready at ${url}`);
process.exit(0);
}
console.log(
`Builder returned HTTP ${response.status} (attempt ${attempt}/30)`
);
} catch (error) {
console.log(
`Builder is not reachable yet (attempt ${attempt}/30): ${error.cause?.code ?? error.message}`
);
}
if (attempt < 30) {
await new Promise((resolve) => setTimeout(resolve, 5_000));
}
}
throw new Error(`Builder did not become ready at ${url} within 5 minutes`);
NODE
- name: Testing cli sync command
shell: bash
run: |
set +e
# Build webstudio-features from its checked-in snapshot; its remote data is mutable.
pnpm --filter='./fixtures/*' --filter='!./fixtures/webstudio-features' --sequential run fixtures:sync 2>&1 | tee fixtures-sync.log
sync_status=${PIPESTATUS[0]}
if [ "$sync_status" -ne 0 ]; then
message=$(tail -n 40 fixtures-sync.log | sed -e 's/%/%25/g' -e 's/\r/%0D/g' -e 's/$/%0A/' | tr -d '\n')
echo "::error title=Fixture sync failed::$message"
exit "$sync_status"
fi
- name: Testing fixture build command
run: pnpm -r fixtures:build
- name: Prepare for diffing
shell: bash
run: |
find . -type f -path "./fixtures/*/.webstudio/data.json" -exec sed -i 's|"origin": ".*"|"origin": "https://main.development.webstudio.is"|g' {} +
- name: Test git diff
# Submodule checkout can move the pinned commit to its current branch.
run: |
git diff --name-only HEAD --exit-code -- . ':(exclude)packages/sdk-components-animation/private-src'
git -C packages/sdk-components-animation/private-src diff --name-only HEAD --exit-code
- name: Show changed files and diff
if: ${{ failure() }}
run: |
echo "Changed files are:"
git diff --name-only HEAD -- . ':(exclude)packages/sdk-components-animation/private-src'
git -C packages/sdk-components-animation/private-src diff --name-only HEAD
git diff HEAD -- . ':(exclude)packages/sdk-components-animation/private-src' | head -n 1000
git -C packages/sdk-components-animation/private-src diff HEAD | head -n 1000