Files
Aislo/resources/tester/test_221_2_loupe_scroll.py
T

43 lines
1.3 KiB
Python

# -*- coding: utf-8 -*-
"""돋보기 스크롤 따라감(계획서 221-2) 회귀검증 — 스크롤해 둔 뒤 켜도 원 = 지금 화면 ·
켠 채 스크롤하면 다음 화면 틀(rAF 한 번)에 위치만 맞춤 · 0.5 초 뒤 다시 뜸 · 끄면 예약 없음.
218-1 헬퍼(`helper_218_1_loupe.cjs`)의 스크롤 장면을 판정함(숨긴 원 안에선 스크롤이 안 먹는 실제 동작 흉내).
"""
import json
import os
import subprocess
import pytest
HERE = os.path.dirname(os.path.abspath(__file__))
@pytest.fixture(scope="module")
def s():
proc = subprocess.run(
["node", os.path.join(HERE, "helper_218_1_loupe.cjs")],
capture_output=True,
text=True,
encoding="utf-8",
timeout=60,
)
assert proc.returncode == 0, proc.stderr
return json.loads(proc.stdout)["scroll"]
def test_스크롤한_뒤_켬(s):
assert s["zero"] == 0
assert s["before"] == 260 # 다시 켤 때도 지금 스크롤 그대로
def test_켠_채_스크롤_위치만_맞춤(s):
assert s["rafs"] == 1 # 스크롤 두 번 → 한 틀에 한 번
assert s["during"] == {"top": 400, "same": True, "pageTop": "-50px"} # 칸 · 문서 스크롤
def test_켠_채_스크롤_0_5초_뒤_다시_뜸(s):
assert s["recaptured"] == {"same": False, "top": 400}
assert s["timersAfterHide"] == 0