"""司机安卓端 Page Object — 首页。"""

from tests.app._base_page import AppBasePage


class DriverHomePage(AppBasePage):
    """司机端 APP 首页。"""

    def __init__(self, driver, platform: str = "android"):
        super().__init__(driver, platform)
        self.order_tab = "tab_orders"
        self.mine_tab = "tab_mine"
        self.home_tab = "tab_home"

    def is_displayed(self) -> bool:
        try:
            self.wait_visible_by_id(self.home_tab, timeout_s=10)
            return True
        except Exception:
            return False

    def go_to_order_list(self) -> None:
        self.tap_by_id(self.order_tab)

    def go_to_mine(self) -> None:
        self.tap_by_id(self.mine_tab)
