diff --git a/fastfive-auto-app-dev/pages/my_account_page.py b/fastfive-auto-app-dev/pages/my_account_page.py new file mode 100644 index 0000000..4f2223a --- /dev/null +++ b/fastfive-auto-app-dev/pages/my_account_page.py @@ -0,0 +1,62 @@ +from selenium.webdriver.common.by import By +from .base_page import BasePage + + +class MyAccountPage(BasePage): + ANDROID = { + 'my_account_tab': (By.XPATH, '//*[@content-desc="내 계정" or @text="내 계정"]'), + 'edit_profile_btn': (By.XPATH, '//*[@content-desc="편집" or @content-desc="프로필 편집"]'), + 'withdraw_btn': (By.XPATH, '//*[@text="회원 탈퇴"]'), + 'withdraw_checkbox': (By.XPATH, '//*[contains(@content-desc, "회원탈퇴 유의")]'), + 'confirm_btn': (By.XPATH, '//*[@text="탈퇴하기"]'), + } + + IOS = { + 'my_account_tab': (By.XPATH, '//XCUIElementTypeButton[contains(@label, "내 계정")]'), + 'edit_profile_btn': (By.XPATH, '//XCUIElementTypeButton[contains(@label, "편집")]'), + 'withdraw_btn': (By.XPATH, '//XCUIElementTypeOther[@name="회원 탈퇴"]'), + 'withdraw_checkbox': (By.XPATH, '//XCUIElementTypeOther[@name="WithdrawalCheckBox"]'), + 'confirm_btn': (By.XPATH, '//XCUIElementTypeOther[@name="탈퇴하기"]'), + } + + def get_selector(self, key): + return self.ANDROID[key] if self.is_android() else self.IOS[key] + + def go_to_my_account_tab(self): + self.click(self.get_selector('my_account_tab')) + print("내 계정 탭 클릭") + self.wait_seconds(2) + + def click_edit_profile(self): + window = self.driver.get_window_size() + tap_x = int(window['width'] * 0.57) + tap_y = int(window['height'] * 0.18) + print(f"편집 버튼 탭 (x={tap_x}, y={tap_y})") + self.tap(tap_x, tap_y) + print("프로필 편집 아이콘 클릭") + self.wait_seconds(2) + + def click_withdraw(self): + if self.is_ios(): + # 페이지소스 기준 고정 좌표: x=327+27=354, y=776+5=781 (탭바 경계 위) + self.driver.execute_script('mobile: tap', {'x': 354, 'y': 781}) + else: + self.click(self.get_selector('withdraw_btn')) + print("회원탈퇴 클릭") + self.wait_seconds(2) + + def click_checkbox(self): + if self.is_android(): + with open("page_source_android_checkbox2.xml", "w", encoding="utf-8") as f: + f.write(self.driver.page_source) + self.click(self.get_selector('withdraw_checkbox')) + print("체크박스 선택") + self.wait_seconds(1) + + def full_withdraw_flow(self): + self.go_to_my_account_tab() + self.click_edit_profile() + self.click_withdraw() + self.click_checkbox() + print("✅ 회원탈퇴 테스트 완료") + return True