fix(frontend) : Chromatic 불안정 스냅샷 수정 - #79
Draft
zhwltlr wants to merge 2 commits into
Draft
Conversation
Comment on lines
+52
to
+54
| parameters: { | ||
| chromatic: { disableSnapshot: true }, | ||
| }, |
Contributor
There was a problem hiding this comment.
스냅샷을 비활성화하면 Loading 상태에 대한 시각적 회귀 테스트가 완전히 제외되어, 향후 로딩 스피너의 스타일이 깨지더라도 감지할 수 없게 됩니다.
더 나은 대안은 스냅샷을 비활성화하는 대신, Chromatic 환경에서만 CSS 애니메이션을 중지시키는 것입니다. 이렇게 하면 스냅샷을 안정적으로 유지하면서 시각적 테스트의 이점을 계속 누릴 수 있습니다.
이 스토리 파일에 데코레이터를 추가하여 이 문제를 해결할 수 있습니다.
import isChromatic from "chromatic/isChromatic";
// ...
export const Loading: Story = {
args: {
...defaultArgs,
value:
"I'm selling a MacBook Pro 2021 for $1,200. Contact me at email@example.com",
isLoading: true,
},
decorators: [
(Story) => (
<>
{isChromatic() && <style>{`.loading { animation: none !important; }`}</style>}
<Story />
</>
),
],
};이 방법을 적용하기 위해 현재 추가하신 parameters를 제거하고 위와 같이 decorators를 추가하는 것을 고려해 보세요. 이렇게 하면 테스트 커버리지를 유지하면서 Chromatic 빌드를 안정시킬 수 있습니다.
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.
fix(frontend) : Chromatic 불안정 스냅샷 수정
요약
HomeHeroSection의 Loading 스토리에서 발생한 Chromatic 불안정 스냅샷 문제를 parameters.chromatic.disableSnapshot: true 설정으로 해결했습니다.
목적
Loading 스토리에서 Chromatic이 불안정한 스냅샷 감지
예: 기존 템플릿이 복잡하여 팀원들이 작성에 어려움을 겪는 문제를 해결합니다.
변경 사항
Chromatic 공식 문서 권장사항을 토대로 스냅샷 비활성화를 합니다.
→ 애니메이션은 의도적으로 예측 불가능한 렌더링
→ 스토리를 무시하는 것이 권장됨
테스트