From a592012d2fb17e765dbfff0c461bd796cc3a6c11 Mon Sep 17 00:00:00 2001 From: jonghyeokFF Date: Wed, 6 May 2026 23:12:19 +0900 Subject: [PATCH] =?UTF-8?q?feat(entrance-card):=20=EC=B6=9C=EC=9E=85?= =?UTF-8?q?=EC=B9=B4=EB=93=9C=20=EC=8B=A4=ED=96=89=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 출입카드 탭 진입, 롱프레스, 디바이스 변경 알럿 처리 구현 Co-Authored-By: Claude Sonnet 4.6 --- .../pages/entrance_card_page.py | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 fastfive-auto-app-dev/pages/entrance_card_page.py diff --git a/fastfive-auto-app-dev/pages/entrance_card_page.py b/fastfive-auto-app-dev/pages/entrance_card_page.py new file mode 100644 index 0000000..d2885a3 --- /dev/null +++ b/fastfive-auto-app-dev/pages/entrance_card_page.py @@ -0,0 +1,69 @@ +from selenium.webdriver.common.by import By +from .base_page import BasePage + + +class EntranceCardPage(BasePage): + ANDROID = { + 'entrance_tab': (By.XPATH, '//*[@content-desc="출입카드" or @text="출입카드"]'), + } + + IOS = { + 'entrance_tab': (By.XPATH, '//XCUIElementTypeButton[contains(@label, "출입카드")]'), + } + + def get_selector(self, key): + return self.ANDROID[key] if self.is_android() else self.IOS[key] + + def go_to_entrance_card_tab(self): + self.click(self.get_selector('entrance_tab')) + print("출입카드 탭 클릭") + self.wait_seconds(2) + + def long_press_card(self): + """검은 카드 영역 1초 롱프레스""" + window_size = self.driver.get_window_size() + tap_x = window_size['width'] // 2 + tap_y = int(window_size['height'] * 0.78) + print(f"카드 롱프레스 (x={tap_x}, y={tap_y}, 1초)") + + if self.is_android(): + self.driver.execute_script('mobile: longClickGesture', { + 'x': tap_x, 'y': tap_y, 'duration': 1000 + }) + else: + self.driver.execute_script('mobile: touchAndHold', { + 'x': tap_x, 'y': tap_y, 'duration': 1.0 + }) + print("카드 롱프레스 완료") + self.wait_seconds(1) + + def handle_device_change_alert(self): + """이미 인증된 디바이스 알럿 처리 - 취소 누르고 종료""" + if self.is_android(): + locators = [ + (By.XPATH, '//*[@text="취소"]'), + (By.XPATH, '//android.widget.Button[@text="취소"]'), + ] + else: + locators = [ + (By.XPATH, '//*[@name="취소"]'), + (By.XPATH, '//*[@label="취소"]'), + (By.XPATH, '//XCUIElementTypeAlert//XCUIElementTypeButton[1]'), + ] + for locator in locators: + if self.try_click(locator, timeout=1): + print("디바이스 변경 알럿 감지 - 취소 클릭") + self.wait_seconds(1) + return True + return False + + def full_entrance_card_flow(self): + self.go_to_entrance_card_tab() + + if self.handle_device_change_alert(): + print("✅ 출입카드 테스트 완료 (디바이스 변경 알럿 취소)") + return True + + self.long_press_card() + print("✅ 출입카드 테스트 완료") + return True