From 895cae7bce4e3db0b97d291892dba44c71a2b1b1 Mon Sep 17 00:00:00 2001 From: Junichi Hayashi <2093896+nahcnuj@users.noreply.github.com> Date: Sun, 23 Aug 2026 05:29:50 +0900 Subject: [PATCH 1/7] test: add readability compatibility test to CI --- tests/e2e/readability.vrt.test.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/e2e/readability.vrt.test.ts diff --git a/tests/e2e/readability.vrt.test.ts b/tests/e2e/readability.vrt.test.ts new file mode 100644 index 00000000..89bc18a9 --- /dev/null +++ b/tests/e2e/readability.vrt.test.ts @@ -0,0 +1,22 @@ +import { expect, test } from '@playwright/test' + +const FIXTURE_ROUTES = [ + '/essays/is-sqrt-of-squared-x-pm-x', + '/essays/scroll-depth-test', +] as const + +test.describe('Readability compatibility tests', () => { + for (const route of FIXTURE_ROUTES) { + test(`should be readerable for ${route}`, async ({ page }) => { + await page.goto(route, { waitUntil: 'domcontentloaded' }) + + // Evaluate readability check within the browser context using CDN module import. + const isReadable = await page.evaluate(async () => { + const { isProbablyReaderable } = await import('https://cdn.jsdelivr.net/npm/@mozilla/readability@0.5.0/+esm') + return isProbablyReaderable(document) + }) + + expect(isReadable).toBe(true) + }) + } +}) From 92fff92c3c2bd5b94b66ecf82da6032efeb59fbb Mon Sep 17 00:00:00 2001 From: Junichi Hayashi <2093896+nahcnuj@users.noreply.github.com> Date: Sun, 23 Aug 2026 05:40:15 +0900 Subject: [PATCH 2/7] Add readability CI script and update Update workflow to run it --- .github/workflows/update.yml | 14 ++++++++++++ scripts/run-readability-test.mjs | 39 ++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 scripts/run-readability-test.mjs diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index 2dfd4ef7..14404e5b 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -69,7 +69,21 @@ jobs: # Content update pushed to gh-pages. No Deploy dispatch here โ€” # Promote merges main and dispatches Deploy (may run before or after us). fi + - name: Setup Node + uses: actions/setup-node@v7 + with: + node-version-file: '.nvmrc' + cache: 'npm' + - name: Install dependencies + run: npm ci --omit dev --ignore-scripts --prefer-offline + - name: Build site + run: npm run build + - name: Run readability test on built site + run: node scripts/run-readability-test.mjs - if: failure() uses: ./.github/actions/notify-failure with: slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} + uses: ./.github/actions/notify-failure + with: + slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/scripts/run-readability-test.mjs b/scripts/run-readability-test.mjs new file mode 100644 index 00000000..90c7d7d1 --- /dev/null +++ b/scripts/run-readability-test.mjs @@ -0,0 +1,39 @@ +// run-readability-test.mjs +// This script starts a temporary static server for the built site (dist) +// and runs the existing Playwright VRT test suite which includes the +// readability compatibility checks. + +import { spawn } from 'child_process'; +import { setTimeout } from 'timers/promises'; + +async function main() { + console.log('๐Ÿš€ Starting static server for dist...'); + // "serve" is invoked via npx; it will be fetched onโ€‘theโ€‘fly if not installed. + const server = spawn('npx', ['serve', 'dist', '-l', '5173'], { + stdio: 'inherit', + shell: true, + }); + + // Give the server a moment to start listening. + await setTimeout(5000); + + try { + console.log('๐Ÿงช Running readability VRT tests...'); + const test = spawn('npm', ['run', 'test:vrt'], { + stdio: 'inherit', + shell: true, + }); + await new Promise((resolve, reject) => { + test.on('close', code => (code === 0 ? resolve() : reject(new Error(`test:vrt exited with code ${code}`)))); + }); + } finally { + console.log('๐Ÿ›‘ Stopping static server'); + // Ensure the server process is terminated even if the tests fail. + server.kill(); + } +} + +main().catch(err => { + console.error('โŒ Readability CI script failed:', err); + process.exit(1); +}); From c9d83d379979d39a2cd594e0ea553ee5531d2c84 Mon Sep 17 00:00:00 2001 From: Junichi Hayashi <2093896+nahcnuj@users.noreply.github.com> Date: Sun, 23 Aug 2026 05:45:24 +0900 Subject: [PATCH 3/7] Update CI to use reading-mode test script and rename script --- .github/workflows/ci.yml | 2 +- package.json | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b5ed2b9f..e37009aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -182,7 +182,7 @@ jobs: - name: Install Playwright browsers run: npx playwright install chromium - name: VRT Test - run: npm run test:vrt + run: npm run test:reading - name: Upload test results on failure if: failure() uses: actions/upload-artifact@v7 diff --git a/package.json b/package.json index c32782d3..5a0b1841 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,7 @@ "lint:biome:fix": "npm run lint:biome -- --write", "test": "vitest run", "test:e2e": "vitest run --config vitest.config.e2e.ts", - "test:vrt": "playwright test", - "test:vrt:update": "playwright test --update-snapshots", + "test:reading": "playwright test", "verify:client-script": "node scripts/verify-client-script.mjs" }, "dependencies": { From 0a9e79e660ed4e5c3fce40ba6224ad074a05869f Mon Sep 17 00:00:00 2001 From: Junichi Hayashi <2093896+nahcnuj@users.noreply.github.com> Date: Sun, 23 Aug 2026 05:46:30 +0900 Subject: [PATCH 4/7] Run readability helper script directly in CI VRT job --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e37009aa..8c634a1f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -182,7 +182,7 @@ jobs: - name: Install Playwright browsers run: npx playwright install chromium - name: VRT Test - run: npm run test:reading + run: node scripts/run-readability-test.mjs - name: Upload test results on failure if: failure() uses: actions/upload-artifact@v7 From 0db0f30835932b7b13b300ab9212b1e7091e4c20 Mon Sep 17 00:00:00 2001 From: Junichi Hayashi <2093896+nahcnuj@users.noreply.github.com> Date: Sun, 23 Aug 2026 05:52:00 +0900 Subject: [PATCH 5/7] Restore VRT test scripts and CI workflow from main --- .github/workflows/ci.yml | 2 +- package.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8c634a1f..b5ed2b9f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -182,7 +182,7 @@ jobs: - name: Install Playwright browsers run: npx playwright install chromium - name: VRT Test - run: node scripts/run-readability-test.mjs + run: npm run test:vrt - name: Upload test results on failure if: failure() uses: actions/upload-artifact@v7 diff --git a/package.json b/package.json index 5a0b1841..c32782d3 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,8 @@ "lint:biome:fix": "npm run lint:biome -- --write", "test": "vitest run", "test:e2e": "vitest run --config vitest.config.e2e.ts", - "test:reading": "playwright test", + "test:vrt": "playwright test", + "test:vrt:update": "playwright test --update-snapshots", "verify:client-script": "node scripts/verify-client-script.mjs" }, "dependencies": { From fff4d86b498d5ab7ef986615c880fabb08b8e4a9 Mon Sep 17 00:00:00 2001 From: Junichi Hayashi <2093896+nahcnuj@users.noreply.github.com> Date: Sun, 23 Aug 2026 05:55:26 +0900 Subject: [PATCH 6/7] Update update.yml to use test:reading script --- .github/workflows/ci.yml | 2 ++ .github/workflows/update.yml | 5 +---- app/routes/essays/test.pdf | Bin 0 -> 298 bytes package.json | 1 + 4 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 app/routes/essays/test.pdf diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b5ed2b9f..613c1e2d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -181,6 +181,8 @@ jobs: Start-Sleep -Seconds 10 - name: Install Playwright browsers run: npx playwright install chromium + - name: Reading Mode Test + run: npm run test:reading - name: VRT Test run: npm run test:vrt - name: Upload test results on failure diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index 14404e5b..bed76aa1 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -79,11 +79,8 @@ jobs: - name: Build site run: npm run build - name: Run readability test on built site - run: node scripts/run-readability-test.mjs + run: npm run test:reading - if: failure() uses: ./.github/actions/notify-failure with: slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} - uses: ./.github/actions/notify-failure - with: - slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/app/routes/essays/test.pdf b/app/routes/essays/test.pdf new file mode 100644 index 0000000000000000000000000000000000000000..86b553550204faf83720a1f7d11f9e39b45bbd15 GIT binary patch literal 298 zcmZ8c%MOAt5WM#*_QFxy3iwC}2T?A@NYI<%P(vXYLQSa&`t@!}1axmZGrKe6B)fRV z=N{p}K;7;^KrgR{q>(V9RwYeDDO*?|nTDZka+DCeO{BeqM(WuZ;Pg=C?bWsVY&fv% z-vK?!yb@d0T^W)txEWe$i7$S=IxP#rz$0uJSo*%}LjfbUfu4nC#C-f?XM%BtCBK-_ iqN=6FzUS&K!K0~CnBN8uL(&?dP4CTDYvMTjQ~Uvb|4)7Z literal 0 HcmV?d00001 diff --git a/package.json b/package.json index c32782d3..df5b39fe 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "test": "vitest run", "test:e2e": "vitest run --config vitest.config.e2e.ts", "test:vrt": "playwright test", + "test:reading": "playwright test", "test:vrt:update": "playwright test --update-snapshots", "verify:client-script": "node scripts/verify-client-script.mjs" }, From 5c85c315a175e954c598c34ee2b14febeacbe832 Mon Sep 17 00:00:00 2001 From: Junichi Hayashi <2093896+nahcnuj@users.noreply.github.com> Date: Sun, 23 Aug 2026 05:57:43 +0900 Subject: [PATCH 7/7] Remove test.pdf --- app/routes/essays/test.pdf | Bin 298 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 app/routes/essays/test.pdf diff --git a/app/routes/essays/test.pdf b/app/routes/essays/test.pdf deleted file mode 100644 index 86b553550204faf83720a1f7d11f9e39b45bbd15..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 298 zcmZ8c%MOAt5WM#*_QFxy3iwC}2T?A@NYI<%P(vXYLQSa&`t@!}1axmZGrKe6B)fRV z=N{p}K;7;^KrgR{q>(V9RwYeDDO*?|nTDZka+DCeO{BeqM(WuZ;Pg=C?bWsVY&fv% z-vK?!yb@d0T^W)txEWe$i7$S=IxP#rz$0uJSo*%}LjfbUfu4nC#C-f?XM%BtCBK-_ iqN=6FzUS&K!K0~CnBN8uL(&?dP4CTDYvMTjQ~Uvb|4)7Z