Repository navigation
test(og): OG 이미지 렌더링 레이아웃 회귀를 픽셀로 검사한다 - #220
Merged
Merged
Conversation
기존 og-image.spec.ts는 메타 태그만 봐서 satori 0.47이 OG 이미지 40장을 깨뜨려도 통과했다(#208). 앞 카드 위 점의 색, 앞 카드 테두리 위치, 글자 줄의 세로 위치를 canvas로 읽어 그때 깨진 세 가지를 각각 잡는다.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
리뷰: OG 레이아웃 픽셀 회귀 테스트 전반적으로 좋습니다. #208에서 CI가 놓친 회귀(카드 z-order, boxSizing, p 여백 기준)를 정확히 겨냥했고, 새 의존성 없이 OffscreenCanvas로 구현했습니다. TEST_POST_URL을 /posts/ 전체 URL로 쓴 것도 e2e-scope 규약에 맞습니다. 변경이 스펙 파일 하나라 보안·성능 우려는 없습니다. 제안 (블로커 아님)
테스트 커버리지
머지해도 좋다고 봅니다. 🤖 Generated with Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
요약
OG 이미지(링크 공유 시 뜨는 미리보기 그림)가 실제로 제대로 그려졌는지 픽셀로 검사하는 E2E 테스트를 추가합니다. 지금까지 OG 테스트(
e2e/og-image.spec.ts)는 메타 태그와 응답 형식만 봤습니다. 그래서 satori 0.33 → 0.47 업그레이드(#208)가 OG 이미지 40장을 전부 깨뜨렸는데도 CI는 초록이었습니다. 이 테스트가 있으면 다음 satori 업데이트에서는 CI가 실패합니다.무엇을 검사하나
e2e/og-image-layout.spec.ts는 dev 서버의 OG 엔드포인트에서 PNG를 받아 브라우저 canvas로 픽셀을 읽습니다. 새 의존성은 없습니다. #218에서 실제로 깨진 세 가지를 하나씩 잡습니다.boxSizing기본값 변경으로 카드 크기가 바뀜<p>기본 여백1em의 기준이 바뀜대상 이미지는 사이트 기본(
/og.png), 시리즈 목록(/series/og.png), 공용 테스트 포스트(TEST_POST_URL)입니다. 앞의 둘은 글 내용과 무관한 고정 문구라서 값을 정확히 비교합니다. 포스트는 제목에 따라 글자 위쪽 y가 23px 달라지므로 105127 범위로만 봅니다. 그래서 테스트 포스트 제목을 바꿔도 깨지지 않습니다.실제로 회귀를 잡는지 확인
satori 0.47.1에서 #218의 템플릿 수정을 하나씩 빼 가며 돌렸습니다.
position: relative만 추가relative+border-box,<p>여백 미수정#218과의 관계
기대값이 main(satori 0.33.4)과 #218(0.47.1 + 템플릿 수정)에서 같아서 이 PR은 main 기준으로 따로 만들었습니다. #218보다 먼저 머지되든 나중에 머지되든 상관없습니다. 이 PR을 먼저 머지한 뒤 #218을 최신 main으로 갱신하면, #218의 템플릿 수정이 맞다는 것을 CI가 직접 확인하게 됩니다.
실행 범위
satori를 올리는 PR은
package.json을 바꾸므로 E2E 전체가 돌고, 이 스펙도 포함됩니다.node scripts/e2e-scope.mjs --check는 이 스펙을 테스트 포스트에 묶인 스펙으로 인식합니다(통과).검증
node scripts/e2e-scope.mjs --check: 통과