Esempio n. 1
0
class TestLoginMode(unittest.TestCase):
    """ 登录状态模块 """
    def setUp(self):
        self.browser = Browser().browser()
        self.common = Common(self.browser)
        self.common.get_lobby()
        self.common.login()
        self.daf = DirAndFiles()

    def tearDown(self):
        self.browser.quit()

    #
    #
    # ------------------------------------------------------------------------ 横屏模式 ------------------------------------------------------------------------
    #
    #

    def test_login(self):
        """ 横屏登录状态 """
        sleep(1)
        lobby_chips = self.common.lobby_chips()["lobby_chips"]
        self.common.switch_page()
        self.common.find_game()
        self.common.switch_game_window()
        self.common.loading_pass()
        sleep(1)

        has_money_title = self.common.info_bar_view_has_money_title()
        has_money_label = self.common.info_bar_view_has_money_label()
        game_record = self.common.game_record_btn_enable()
        game_record_touchable = self.common.game_record_btn_touchable()

        try:
            self.assertEqual(has_money_title, "我的余额", "横屏登录下导航栏余额标题错误!")
            self.assertEqual(has_money_label, lobby_chips,
                             "横屏登录下导航栏余额数值与大厅的不一致!")
            self.assertEqual(game_record, True, "横屏登录选项菜单不会显示游戏记录按钮!")
            self.assertEqual(game_record_touchable, True, "横屏登录游戏记录按钮不可点击!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

        sleep(1)
        self.common.set_chips_to_zero()
        self.browser.refresh()
        self.common.loading_pass()
        sleep(1)
        self.common.start_btn_click()
        sleep(1)

        slot_status = self.common.slot_machine_rolling()
        setting_btn = self.common.setting_btn_visible()
        auto_game_btn = self.common.auto_game_btn_visible()
        start_btn = self.common.start_btn_status()
        lack_of_money_view = self.common.lack_of_money_view_showing()
        mask_view = self.common.mask_view_showing()
        lack_of_money_title = self.common.lack_of_money_title()
        lack_of_money_ok_btn = self.common.lack_of_money_ok_btn_visible()
        lack_of_money_ok_btn_title = self.common.lack_of_money_ok_btn_title()
        lack_of_money_ok_btn_touchable = self.common.lack_of_money_ok_btn_touchable(
        )

        try:
            self.assertEqual(slot_status, False, "横屏余额为0时点击旋转按钮,滚轴会滚动!")
            self.assertEqual(setting_btn, True, "横屏余额为0时点击旋转按钮,线数线注设置按钮消失!")
            self.assertEqual(auto_game_btn, True, "横屏余额为0时点击旋转按钮,自动游戏按钮消失!")
            self.assertEqual(start_btn, "stopped", "横屏余额为0时点击旋转按钮,旋转按钮不是停止状态!")
            self.assertEqual(lack_of_money_view, True,
                             "横屏余额为0时点击旋转按钮,不会弹出余额不足窗口!")
            self.assertEqual(mask_view, True, "横屏余额为0时点击旋转按钮,不会显示灰色蒙板!")
            self.assertEqual(lack_of_money_title, "您的额度不足,无法完成您所请求的下注",
                             "横屏弹出余额不足窗口,提示文字错误!")
            self.assertEqual(lack_of_money_ok_btn, True,
                             "横屏弹出余额不足窗口,不会显示确定按钮!")
            self.assertEqual(lack_of_money_ok_btn_title, "确定",
                             "横屏弹出余额不足窗口,确定按钮文字错误!")
            self.assertEqual(lack_of_money_ok_btn_touchable, True,
                             "横屏弹出余额不足窗口,确定按钮不可点击!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

        self.common.mask_view_click()
        sleep(1)

        lack_of_money_view = self.common.lack_of_money_view_showing()
        mask_view = self.common.mask_view_showing()

        try:
            self.assertEqual(lack_of_money_view, True,
                             "横屏弹出余额不足窗口时,点击灰色蒙板,窗口会消失!")
            self.assertEqual(mask_view, True, "横屏弹出余额不足窗口时,点击灰色蒙板,灰色蒙板会消失!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

        self.common.lack_of_money_ok_btn_click()
        sleep(1)

        lack_of_money_view = self.common.lack_of_money_view_dispear()
        mask_view = self.common.mask_view_showing()

        try:
            self.assertEqual(lack_of_money_view, None,
                             "横屏弹出余额不足窗口时,点击确定按钮,窗口不会消失!")
            self.assertEqual(mask_view, False, "横屏弹出余额不足窗口时,点击确定按钮,灰色蒙板不会消失!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    #
    #
    # ------------------------------------------------------------------------ 竖屏模式 ------------------------------------------------------------------------
    #
    #

    def test_login_portrait(self):
        """ 竖屏登录状态 """
        sleep(1)
        lobby_chips = self.common.lobby_chips()["lobby_chips"]
        self.common.switch_page()
        self.common.find_game()
        self.common.switch_game_window()
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)

        has_money_title = self.common.info_bar_view_has_money_title()
        has_money_label = self.common.info_bar_view_has_money_label()
        game_record = self.common.game_record_btn_enable()
        game_record_touchable = self.common.game_record_btn_touchable()

        try:
            self.assertEqual(has_money_title, "我的余额", "竖屏登录下导航栏余额标题错误!")
            self.assertEqual(has_money_label, lobby_chips,
                             "竖屏登录下导航栏余额数值与大厅的不一致!")
            self.assertEqual(game_record, True, "竖屏登录选项菜单不会显示游戏记录按钮!")
            self.assertEqual(game_record_touchable, True, "竖屏登录游戏记录按钮不可点击!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

        sleep(1)
        self.common.set_chips_to_zero()
        self.browser.refresh()
        self.common.loading_pass()
        sleep(1)
        self.common.start_btn_click()
        sleep(1)

        slot_status = self.common.slot_machine_rolling()
        setting_btn = self.common.setting_btn_visible()
        auto_game_btn = self.common.auto_game_btn_visible()
        start_btn = self.common.start_btn_status()
        lack_of_money_view = self.common.lack_of_money_view_showing()
        mask_view = self.common.mask_view_showing()
        lack_of_money_title = self.common.lack_of_money_title()
        lack_of_money_ok_btn = self.common.lack_of_money_ok_btn_visible()
        lack_of_money_ok_btn_title = self.common.lack_of_money_ok_btn_title()
        lack_of_money_ok_btn_touchable = self.common.lack_of_money_ok_btn_touchable(
        )

        try:
            self.assertEqual(slot_status, False, "竖屏余额为0时点击旋转按钮,滚轴会滚动!")
            self.assertEqual(setting_btn, True, "竖屏余额为0时点击旋转按钮,线数线注设置按钮消失!")
            self.assertEqual(auto_game_btn, True, "竖屏余额为0时点击旋转按钮,自动游戏按钮消失!")
            self.assertEqual(start_btn, "stopped", "竖屏余额为0时点击旋转按钮,旋转按钮不是停止状态!")
            self.assertEqual(lack_of_money_view, True,
                             "竖屏余额为0时点击旋转按钮,不会弹出余额不足窗口!")
            self.assertEqual(mask_view, True, "竖屏余额为0时点击旋转按钮,不会显示灰色蒙板!")
            self.assertEqual(lack_of_money_title, "您的额度不足,无法完成您所请求的下注",
                             "竖屏弹出余额不足窗口,提示文字错误!")
            self.assertEqual(lack_of_money_ok_btn, True,
                             "竖屏弹出余额不足窗口,不会显示确定按钮!")
            self.assertEqual(lack_of_money_ok_btn_title, "确定",
                             "竖屏弹出余额不足窗口,确定按钮文字错误!")
            self.assertEqual(lack_of_money_ok_btn_touchable, True,
                             "竖屏弹出余额不足窗口,确定按钮不可点击!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

        self.common.mask_view_click()
        sleep(1)

        lack_of_money_view = self.common.lack_of_money_view_showing()
        mask_view = self.common.mask_view_showing()

        try:
            self.assertEqual(lack_of_money_view, True,
                             "竖屏弹出余额不足窗口时,点击灰色蒙板,窗口会消失!")
            self.assertEqual(mask_view, True, "竖屏弹出余额不足窗口时,点击灰色蒙板,灰色蒙板会消失!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

        self.common.lack_of_money_ok_btn_click()
        sleep(1)

        lack_of_money_view = self.common.lack_of_money_view_dispear()
        mask_view = self.common.mask_view_showing()

        try:
            self.assertEqual(lack_of_money_view, None,
                             "竖屏弹出余额不足窗口时,点击确定按钮,窗口不会消失!")
            self.assertEqual(mask_view, False, "竖屏弹出余额不足窗口时,点击确定按钮,灰色蒙板不会消失!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    #
    #
    # ------------------------------------------------------------------------ 横竖屏模式 ------------------------------------------------------------------------
    #
    #

    def test_login_switch_screen(self):
        """ 横竖屏登录状态 """
        sleep(1)
        lobby_chips = self.common.lobby_chips()["lobby_chips"]
        self.common.switch_page()
        self.common.find_game()
        self.common.switch_game_window()
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        self.common.landscape()
        sleep(0.5)
        self.common.portrait()
        sleep(0.5)

        has_money_title = self.common.info_bar_view_has_money_title()
        has_money_label = self.common.info_bar_view_has_money_label()
        game_record = self.common.game_record_btn_enable()
        game_record_touchable = self.common.game_record_btn_touchable()

        try:
            self.assertEqual(has_money_title, "我的余额", "登录后横竖屏切换,下导航栏余额标题错误!")
            self.assertEqual(has_money_label, lobby_chips,
                             "登录后横竖屏切换,下导航栏余额数值与大厅的不一致!")
            self.assertEqual(game_record, True, "登录后横竖屏切换,选项菜单不会显示游戏记录按钮!")
            self.assertEqual(game_record_touchable, True,
                             "登录后横竖屏切换,游戏记录按钮不可点击!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

        sleep(1)
        self.common.set_chips_to_zero()
        self.browser.refresh()
        self.common.loading_pass()
        sleep(1)
        self.common.start_btn_click()
        sleep(1)

        self.common.landscape()
        sleep(0.5)
        self.common.portrait()
        sleep(0.5)

        slot_status = self.common.slot_machine_rolling()
        setting_btn = self.common.setting_btn_visible()
        auto_game_btn = self.common.auto_game_btn_visible()
        start_btn = self.common.start_btn_status()
        lack_of_money_view = self.common.lack_of_money_view_showing()
        mask_view = self.common.mask_view_showing()
        lack_of_money_title = self.common.lack_of_money_title()
        lack_of_money_ok_btn = self.common.lack_of_money_ok_btn_visible()
        lack_of_money_ok_btn_title = self.common.lack_of_money_ok_btn_title()
        lack_of_money_ok_btn_touchable = self.common.lack_of_money_ok_btn_touchable(
        )

        try:
            self.assertEqual(slot_status, False, "登录后余额为0时点击旋转按钮,横竖屏切换,滚轴会滚动!")
            self.assertEqual(setting_btn, True,
                             "登录后余额为0时点击旋转按钮,横竖屏切换,线数线注设置按钮消失!")
            self.assertEqual(auto_game_btn, True,
                             "登录后余额为0时点击旋转按钮,横竖屏切换,自动游戏按钮消失!")
            self.assertEqual(start_btn, "stopped",
                             "登录后余额为0时点击旋转按钮,横竖屏切换,旋转按钮不是停止状态!")
            self.assertEqual(lack_of_money_view, True,
                             "登录后余额为0时点击旋转按钮,横竖屏切换,不会弹出余额不足窗口!")
            self.assertEqual(mask_view, True, "登录后余额为0时点击旋转按钮,横竖屏切换,不会显示灰色蒙板!")
            self.assertEqual(lack_of_money_title, "您的额度不足,无法完成您所请求的下注",
                             "登录后弹出余额不足窗口,横竖屏切换,提示文字错误!")
            self.assertEqual(lack_of_money_ok_btn, True,
                             "登录后弹出余额不足窗口,横竖屏切换,不会显示确定按钮!")
            self.assertEqual(lack_of_money_ok_btn_title, "确定",
                             "登录后弹出余额不足窗口,横竖屏切换,确定按钮文字错误!")
            self.assertEqual(lack_of_money_ok_btn_touchable, True,
                             "登录后弹出余额不足窗口,横竖屏切换,确定按钮不可点击!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

        self.common.mask_view_click()
        sleep(1)
        self.common.landscape()
        sleep(0.5)
        self.common.portrait()
        sleep(0.5)

        lack_of_money_view = self.common.lack_of_money_view_showing()
        mask_view = self.common.mask_view_showing()

        try:
            self.assertEqual(lack_of_money_view, True,
                             "登录后弹出余额不足窗口时,点击灰色蒙板,横竖屏切换,窗口会消失!")
            self.assertEqual(mask_view, True,
                             "登录后弹出余额不足窗口时,点击灰色蒙板,横竖屏切换,灰色蒙板会消失!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

        self.common.lack_of_money_ok_btn_click()
        sleep(1)
        self.common.landscape()
        sleep(0.5)
        self.common.portrait()
        sleep(0.5)

        lack_of_money_view = self.common.lack_of_money_view_dispear()
        mask_view = self.common.mask_view_showing()

        try:
            self.assertEqual(lack_of_money_view, None,
                             "录后弹出余额不足窗口时,点击确定按钮,横竖屏切换,窗口不会消失!")
            self.assertEqual(mask_view, False,
                             "录后弹出余额不足窗口时,点击确定按钮,横竖屏切换,灰色蒙板不会消失!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise
Esempio n. 2
0
class TestMainMenu(unittest.TestCase):
    """ 左侧选项菜单模块 """
    def setUp(self):
        self.browser = Browser().browser()
        self.common = Common(self.browser)
        self.common.start()
        self.daf = DirAndFiles()

    def tearDown(self):
        self.browser.quit()

    #
    #
    # ------------------------------------------------------------------------ 横屏模式 ------------------------------------------------------------------------
    #
    #

    def test_main_menu_default_status(self):
        """ 横屏左侧主菜单及按钮的默认状态 """
        self.common.loading_pass()
        sleep(1)
        # 显示
        main_menu = self.common.main_menu_btn_visible()
        expand = self.common.main_menu_expand()
        info_btn = self.common.info_btn_visible()
        help_btn = self.common.help_btn_visible()
        voice_btn = self.common.voice_btn_visible()
        turbo_btn = self.common.turbo_btn_visible()
        home_btn = self.common.home_btn_visible()
        game_record_btn = self.common.game_record_btn_enable()
        # 可点击否
        main_menu_touchable = self.common.main_menu_touchable()
        info_btn_touchable = self.common.info_btn_touchable()
        help_btn_touchable = self.common.help_btn_touchable()
        voice_btn_touchable = self.common.voice_btn_touchable()
        turbo_btn_touchable = self.common.turbo_btn_touchable()
        try:
            self.assertEqual(main_menu, True, "横屏不会显示主菜单按钮!")
            self.assertEqual(expand, "expandLPC", "横屏左侧主菜单默认不是展开状态!")
            self.assertEqual(info_btn, True, "横屏左侧主菜单展开时不会显示奖金表按钮!")
            self.assertEqual(help_btn, True, "横屏左侧主菜单展开时不会显示帮助按钮!")
            self.assertEqual(voice_btn, True, "横屏左侧主菜单展开时不会显示声音按钮!")
            self.assertEqual(turbo_btn, True, "横屏左侧主菜单展开时不会显示快速按钮!")
            self.assertEqual(home_btn, False, "横屏PC端左侧主菜单展开时,会显示返回大厅按钮!")
            self.assertEqual(game_record_btn, False, "横屏试玩左侧主菜单展开时,会显示游戏记录按钮!")
            self.assertEqual(main_menu_touchable, True, "横屏整个左侧主菜单不能点击!")
            self.assertEqual(info_btn_touchable, True, "横屏奖金表按钮不能点击!")
            self.assertEqual(help_btn_touchable, True, "横屏帮助按钮不可点击!")
            self.assertEqual(voice_btn_touchable, True, "横屏声音开关按钮不可点击!")
            self.assertEqual(turbo_btn_touchable, True, "横屏快速模式按钮不可点击!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_main_menu_btn_click(self):
        """ 横屏点击左侧主菜单按钮 """
        self.common.loading_pass()
        sleep(1)
        self.common.main_menu_btn_click()
        sleep(1)
        status = self.common.main_menu_expand()
        info_btn = self.common.info_btn_visible()
        help_btn = self.common.help_btn_visible()
        voice_btn = self.common.voice_btn_visible()
        turbo_btn = self.common.turbo_btn_visible()
        home_btn = self.common.home_btn_visible()
        game_record_btn = self.common.game_record_btn_enable()
        try:
            self.assertEqual(status, "retractL", "横屏点击左侧主菜单按钮后不会折叠!")
            self.assertEqual(info_btn, False, "横屏左侧主菜单折叠时会显示奖金表按钮!")
            self.assertEqual(help_btn, False, "横屏左侧主菜单折叠时会显示帮助按钮!")
            self.assertEqual(voice_btn, False, "横屏左侧主菜单折叠时会显示声音按钮!")
            self.assertEqual(turbo_btn, False, "横屏左侧主菜单折叠时会显示快速按钮!")
            self.assertEqual(home_btn, False, "横屏PC端左侧主菜单折叠时会显示返回大厅按钮!")
            self.assertEqual(game_record_btn, False, "横屏试玩左侧主菜单折叠时会显示游戏记录按钮!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_main_menu_btn_click_twice(self):
        """ 横屏点击左侧主菜单按钮两次 """
        self.common.loading_pass()
        sleep(1)
        self.common.main_menu_btn_click()
        sleep(1)
        self.common.main_menu_btn_click()
        sleep(1)
        status = self.common.main_menu_expand()
        info_btn = self.common.info_btn_visible()
        help_btn = self.common.help_btn_visible()
        voice_btn = self.common.voice_btn_visible()
        turbo_btn = self.common.turbo_btn_visible()
        home_btn = self.common.home_btn_visible()
        game_record_btn = self.common.game_record_btn_enable()
        try:
            self.assertEqual(status, "expandLPC", "横屏点击左侧主菜单按钮两次后不会恢复展开状态!")
            self.assertEqual(info_btn, True, "横屏点击左侧主菜单按钮两次后不会显示奖金表按钮!")
            self.assertEqual(help_btn, True, "横屏点击左侧主菜单按钮两次后不会显示帮助按钮!")
            self.assertEqual(voice_btn, True, "横屏点击左侧主菜单按钮两次后不会显示声音按钮!")
            self.assertEqual(turbo_btn, True, "横屏点击左侧主菜单按钮两次后不会显示快速按钮!")
            self.assertEqual(home_btn, False, "横屏PC端点击左侧主菜单按钮两次后,会显示返回大厅按钮!")
            self.assertEqual(game_record_btn, False,
                             "横屏试玩点击左侧主菜单按钮两次后,会显示游戏记录按钮!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_info_btn_click(self):
        """ 横屏点击奖金表按钮 """
        self.common.loading_pass()
        sleep(1)
        self.common.info_btn_click()
        sleep(1)
        showing = self.common.info_view_showing()
        try:
            self.assertEqual(showing, True, "横屏点击奖金表按钮后,不会显示奖金表场景!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_info_view_return_btn(self):
        """ 横屏奖金表场景返回按钮 """
        self.common.loading_pass()
        sleep(1)
        self.common.info_btn_click()
        sleep(1)
        visible = self.common.info_view_return_btn_visible()
        touchable = self.common.info_view_return_btn_touchable()
        try:
            self.assertEqual(visible, True, "横屏奖金表场景,不会显示返回按钮!")
            self.assertEqual(touchable, True, "横屏奖金表场景返回按钮不可点击!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_info_view_return_btn_click(self):
        """ 横屏点击奖金表返回按钮 """
        self.common.loading_pass()
        sleep(1)
        self.common.info_btn_click()
        sleep(1)
        self.common.info_view_return_btn_click()
        sleep(1)
        dispear = self.common.info_view_dispear()
        try:
            self.assertEqual(dispear, None, "横屏点击奖金表返回按钮,奖金表场景不会消失!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_help_btn_click(self):
        """ 横屏点击帮助按钮 """
        self.common.loading_pass()
        sleep(1)
        self.common.help_btn_click()
        sleep(1)
        showing = self.common.help_view_showing()
        try:
            self.assertEqual(showing, True, "横屏点击帮助按钮后,不会显示帮助场景!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_help_view_return_btn(self):
        """ 横屏帮助场景返回按钮 """
        self.common.loading_pass()
        sleep(1)
        self.common.help_btn_click()
        sleep(1)
        visible = self.common.help_view_return_btn_visible()
        touchable = self.common.help_view_return_btn_touchable()
        try:
            self.assertEqual(visible, True, "横屏帮助场景不会显示返回按钮!")
            self.assertEqual(touchable, True, "横屏帮助场景返回按钮不可点击!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_help_view_return_btn_click(self):
        """ 横屏点击帮助场景返回按钮 """
        self.common.loading_pass()
        sleep(1)
        self.common.help_btn_click()
        sleep(1)
        self.common.help_view_return_btn_click()
        sleep(1)
        dispear = self.common.help_view_dispear()
        try:
            self.assertEqual(dispear, None, "横屏点击帮助场景返回按钮,帮助场景不会消失!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_voice_btn_click(self):
        """ 横屏声音开关按钮点击 """
        self.common.loading_pass()
        sleep(1)
        self.common.voice_btn_click()
        sleep(1)
        voice_status = self.common.voice_btn_status()
        sound_status = self.common.sound_status()
        try:
            self.assertEqual(voice_status, "silience", "横屏声音开关按钮点击后,按钮状态不会改变!")
            self.assertEqual(sound_status, True, "横屏声音开关按钮点击后,声音不会关闭!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_voice_btn_click_twice(self):
        """ 横屏点击两次声音开关按钮 """
        self.common.loading_pass()
        sleep(1)
        self.common.voice_btn_click()
        sleep(1)
        self.common.voice_btn_click()
        sleep(1)
        voice_status = self.common.voice_btn_status()
        sound_status = self.common.sound_status()
        try:
            self.assertEqual(voice_status, "normal",
                             "横屏声音开关按钮点击两次后,按钮状态没有恢复打开!")
            self.assertEqual(sound_status, False, "横屏声音开关按钮点击两次后,声音没有开启!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_voice_btn_click_refresh(self):
        """ 横屏点击声音按钮后刷新页面 """
        self.common.loading_pass()
        sleep(1)
        self.common.voice_btn_click()
        sleep(1)
        self.browser.refresh()
        self.common.loading_pass()
        sleep(1)
        voice_status = self.common.voice_btn_status()
        sound_status = self.common.sound_status()
        try:
            self.assertEqual(voice_status, "silience", "横屏关闭声音按钮后刷新,按钮变成打开!")
            self.assertEqual(sound_status, True, "横屏关闭声音后刷新,声音变成打开!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

        sleep(1)
        self.common.voice_btn_click()
        sleep(1)
        self.browser.refresh()
        self.common.loading_pass()
        sleep(1)
        voice_status = self.common.voice_btn_status()
        sound_status = self.common.sound_status()
        try:
            self.assertEqual(voice_status, "normal", "横屏打开声音按钮后刷新,按钮变成关闭!")
            self.assertEqual(sound_status, False, "横屏打开声音后刷新,声音变成关闭!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_turbo_btn_default(self):
        """ 横屏快速模式按钮默认状态 """
        self.common.loading_pass()
        sleep(1)
        turbo_btn_status = self.common.turbo_btn_status()
        spin_status = self.common.spin_is_in_turbo()
        try:
            self.assertEqual(turbo_btn_status, "1x", "横屏快速模式按钮默认状态不是1x!")
            self.assertEqual(spin_status, False, "横屏滚轴默认滚动方式不是普通速度!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_turbo_btn_click(self):
        """ 横屏点击快速模式按钮 """
        self.common.loading_pass()
        sleep(1)
        # 用于判断当前是什么模式
        i = 0

        while True:
            if i == 1:
                self.common.turbo_btn_click()
                i -= 1
                sleep(3)

            start_time = datetime.now()
            self.common.start_btn_click()
            self.common.wait_for_rolling(15)
            speed_up = self.common.get_scroller_speed_up()
            self.common.wait_for_rolling_stop(15, just_rolling=True)
            end_time = datetime.now()
            self.common.wait_for_rolling_stop(15)

            normal_spin_time = (end_time - start_time).seconds

            game_status = self.common.get_game_current_status()
            if game_status is not None or speed_up is True:
                self.browser.refresh()
                self.common.loading_pass()
                sleep(1)
                continue
            else:

                sleep(1)
                self.common.main_menu_btn_click()
                sleep(1)

                if i == 0:
                    self.common.turbo_btn_click()
                    i += 1
                    sleep(0.5)

                turbo_btn_status = self.common.turbo_btn_status()
                spin_status = self.common.spin_is_in_turbo()
                info_bar_banner = self.common.info_bar_view_banner_tips_label()

                start_time = datetime.now()
                self.common.start_btn_click()
                self.common.wait_for_rolling(15)
                speed_up = self.common.get_scroller_speed_up()
                self.common.wait_for_rolling_stop(15, just_rolling=True)
                end_time = datetime.now()
                self.common.wait_for_rolling_stop(15)

                turbo_spin_time = (end_time - start_time).seconds

                game_status = self.common.get_game_current_status()
                if game_status is not None or speed_up is True:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    continue
                else:
                    try:
                        self.assertEqual(turbo_btn_status, "2x",
                                         "横屏启动快速模式,快速模式按钮状态不是2x!")
                        self.assertEqual(spin_status, True,
                                         "横屏启动快速模式,滚轴滚动方式不是快速!")
                        self.assertEqual(info_bar_banner, "快速模式已启用",
                                         "横屏启动快速模式,下导航栏提示文字错误!")
                        self.assertEqual(turbo_spin_time < normal_spin_time,
                                         True, "横屏启动快速模式,滚轴停止速度不会变快!")
                        break
                    except AssertionError:
                        self.daf.get_screenshot(self.browser)
                        raise

    def test_turbo_btn_click_twice(self):
        """ 横屏点击快速模式按钮两次 """
        self.common.loading_pass()
        sleep(1)
        self.common.turbo_btn_click()
        sleep(1)
        self.common.turbo_btn_click()
        sleep(0.5)
        turbo_btn_status = self.common.turbo_btn_status()
        spin_status = self.common.spin_is_in_turbo()
        info_bar_banner = self.common.info_bar_view_banner_tips_label()
        try:
            self.assertEqual(turbo_btn_status, "1x",
                             "横屏点击快速模式按钮两次,快速模式按钮状态不是1x!")
            self.assertEqual(spin_status, False, "横屏点击快速模式按钮两次,滚轴滚动方式不是慢速!")
            self.assertEqual(info_bar_banner, "快速模式已禁用",
                             "横屏点击快速模式按钮两次,下导航栏提示文字错误!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_turbo_btn_click_refresh(self):
        """ 横屏点击快速按钮后刷新页面 """
        self.common.loading_pass()
        sleep(1)
        self.common.turbo_btn_click()
        sleep(1)
        self.browser.refresh()
        self.common.loading_pass()
        sleep(1)
        turbo_btn_status = self.common.turbo_btn_status()
        spin_status = self.common.spin_is_in_turbo()
        try:
            self.assertEqual(turbo_btn_status, "2x",
                             "横屏启动快速模式后刷新,快速模式按钮状态不是2x!")
            self.assertEqual(spin_status, True, "横屏启动快速模式后刷新,滚轴滚动方式不是快速!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

        sleep(1)
        self.common.turbo_btn_click()
        sleep(1)
        self.browser.refresh()
        self.common.loading_pass()
        sleep(1)
        turbo_btn_status = self.common.turbo_btn_status()
        spin_status = self.common.spin_is_in_turbo()
        try:
            self.assertEqual(turbo_btn_status, "1x",
                             "横屏关闭快速模式后刷新,快速模式按钮状态不是1x!")
            self.assertEqual(spin_status, False, "横屏关闭快速模式后刷新,滚轴滚动方式不是慢速!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    #
    #
    # ------------------------------------------------------------------------ 竖屏模式 ------------------------------------------------------------------------
    #
    #

    def test_main_menu_default_portrait(self):
        """ 竖屏左侧主菜单及按钮的默认状态 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        # 显示
        main_menu = self.common.main_menu_btn_visible()
        expand = self.common.main_menu_expand()
        info_btn = self.common.info_btn_visible()
        help_btn = self.common.help_btn_visible()
        voice_btn = self.common.voice_btn_visible()
        turbo_btn = self.common.turbo_btn_visible()
        home_btn = self.common.home_btn_visible()
        game_record_btn = self.common.game_record_btn_enable()
        # 可点击否
        main_menu_touchable = self.common.main_menu_touchable()
        info_btn_touchable = self.common.info_btn_touchable()
        help_btn_touchable = self.common.help_btn_touchable()
        voice_btn_touchable = self.common.voice_btn_touchable()
        turbo_btn_touchable = self.common.turbo_btn_touchable()
        try:
            self.assertEqual(main_menu, True, "竖屏不会显示主菜单按钮!")
            self.assertEqual(expand, "expandPPC", "竖屏左侧主菜单默认不是展开状态!")
            self.assertEqual(info_btn, True, "竖屏左侧主菜单展开时不会显示奖金表按钮!")
            self.assertEqual(help_btn, True, "竖屏左侧主菜单展开时不会显示帮助按钮!")
            self.assertEqual(voice_btn, True, "竖屏左侧主菜单展开时不会显示声音按钮!")
            self.assertEqual(turbo_btn, True, "竖屏左侧主菜单展开时不会显示快速按钮!")
            self.assertEqual(home_btn, False, "竖屏PC端上方主菜单展开时,会显示返回大厅按钮!")
            self.assertEqual(game_record_btn, False, "竖屏试玩上方主菜单展开时,会显示游戏记录按钮!")
            self.assertEqual(main_menu_touchable, True, "横屏整个左侧主菜单不能点击!")
            self.assertEqual(info_btn_touchable, True, "横屏奖金表按钮不能点击!")
            self.assertEqual(help_btn_touchable, True, "横屏帮助按钮不可点击!")
            self.assertEqual(voice_btn_touchable, True, "横屏声音开关按钮不可点击!")
            self.assertEqual(turbo_btn_touchable, True, "横屏快速模式按钮不可点击!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_main_menu_btn_click_portrait(self):
        """ 竖屏点击左侧主菜单按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        self.common.main_menu_btn_click()
        sleep(1)
        status = self.common.main_menu_expand()
        info_btn = self.common.info_btn_visible()
        help_btn = self.common.help_btn_visible()
        voice_btn = self.common.voice_btn_visible()
        turbo_btn = self.common.turbo_btn_visible()
        home_btn = self.common.home_btn_visible()
        game_record_btn = self.common.game_record_btn_enable()
        try:
            self.assertEqual(status, "retractP", "竖屏点击左侧主菜单按钮后不会折叠!")
            self.assertEqual(info_btn, False, "竖屏左侧主菜单折叠时会显示奖金表按钮!")
            self.assertEqual(help_btn, False, "竖屏左侧主菜单折叠时会显示帮助按钮!")
            self.assertEqual(voice_btn, False, "竖屏左侧主菜单折叠时会显示声音按钮!")
            self.assertEqual(turbo_btn, False, "竖屏左侧主菜单折叠时会显示快速按钮!")
            self.assertEqual(home_btn, False, "竖屏PC端左侧主菜单折叠时会显示返回大厅按钮!")
            self.assertEqual(game_record_btn, False, "竖屏试玩左侧主菜单折叠时会显示游戏记录按钮!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_main_menu_btn_click_twice_portrait(self):
        """ 竖屏点击左侧主菜单按钮两次 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        self.common.main_menu_btn_click()
        sleep(1)
        self.common.main_menu_btn_click()
        sleep(1)
        status = self.common.main_menu_expand()
        info_btn = self.common.info_btn_visible()
        help_btn = self.common.help_btn_visible()
        voice_btn = self.common.voice_btn_visible()
        turbo_btn = self.common.turbo_btn_visible()
        home_btn = self.common.home_btn_visible()
        game_record_btn = self.common.game_record_btn_enable()
        try:
            self.assertEqual(status, "expandPPC", "竖屏点击左侧主菜单按钮两次后不会恢复展开状态!")
            self.assertEqual(info_btn, True, "竖屏点击左侧主菜单按钮两次后不会显示奖金表按钮!")
            self.assertEqual(help_btn, True, "竖屏点击左侧主菜单按钮两次后不会显示帮助按钮!")
            self.assertEqual(voice_btn, True, "竖屏点击左侧主菜单按钮两次后不会显示声音按钮!")
            self.assertEqual(turbo_btn, True, "竖屏点击左侧主菜单按钮两次后不会显示快速按钮!")
            self.assertEqual(home_btn, False, "竖屏PC端点击左侧主菜单按钮两次后,会显示返回大厅按钮!")
            self.assertEqual(game_record_btn, False,
                             "竖屏试玩点击左侧主菜单按钮两次后,会显示游戏记录按钮!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_info_btn_click_portrait(self):
        """ 竖屏点击奖金表按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        self.common.info_btn_click()
        sleep(1)
        showing = self.common.info_view_showing()
        try:
            self.assertEqual(showing, True, "竖屏点击奖金表按钮后,不会显示奖金表场景!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_info_view_return_btn_portrait(self):
        """ 竖屏奖金表场景返回按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        self.common.info_btn_click()
        sleep(1)
        visible = self.common.info_view_return_btn_visible()
        touchable = self.common.info_view_return_btn_touchable()
        try:
            self.assertEqual(visible, True, "竖屏奖金表场景,不会显示返回按钮!")
            self.assertEqual(touchable, True, "竖屏奖金表场景返回按钮不可点击!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_info_view_return_btn_click_portrait(self):
        """ 竖屏点击奖金表返回按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        self.common.info_btn_click()
        sleep(1)
        self.common.info_view_return_btn_click()
        sleep(1)
        dispear = self.common.info_view_dispear()
        try:
            self.assertEqual(dispear, None, "竖屏点击奖金表返回按钮,奖金表场景不会消失!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_help_btn_click_portrait(self):
        """ 竖屏点击帮助按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        self.common.help_btn_click()
        sleep(1)
        showing = self.common.help_view_showing()
        try:
            self.assertEqual(showing, True, "竖屏点击帮助按钮后,不会显示帮助场景!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_help_view_return_btn_portrait(self):
        """ 竖屏帮助场景返回按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        self.common.help_btn_click()
        sleep(1)
        visible = self.common.help_view_return_btn_visible()
        touchable = self.common.help_view_return_btn_touchable()
        try:
            self.assertEqual(visible, True, "竖屏帮助场景不会显示返回按钮!")
            self.assertEqual(touchable, True, "竖屏帮助场景返回按钮不可点击!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_help_view_return_btn_click_portrait(self):
        """ 竖屏点击帮助场景返回按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        self.common.help_btn_click()
        sleep(1)
        self.common.help_view_return_btn_click()
        sleep(1)
        dispear = self.common.help_view_dispear()
        try:
            self.assertEqual(dispear, None, "竖屏点击帮助场景返回按钮,帮助场景不会消失!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_voice_btn_click_portrait(self):
        """ 竖屏点击声音开关按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        self.common.voice_btn_click()
        sleep(1)
        voice_status = self.common.voice_btn_status()
        sound_status = self.common.sound_status()
        try:
            self.assertEqual(voice_status, "silience", "竖屏声音开关按钮点击后,按钮状态不会改变!")
            self.assertEqual(sound_status, True, "竖屏声音开关按钮点击后,声音不会关闭!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_voice_btn_click_twice_portrait(self):
        """ 竖屏点击两次声音开关按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        self.common.voice_btn_click()
        sleep(1)
        self.common.voice_btn_click()
        sleep(1)
        voice_status = self.common.voice_btn_status()
        sound_status = self.common.sound_status()
        try:
            self.assertEqual(voice_status, "normal",
                             "竖屏声音开关按钮点击两次后,按钮状态没有恢复打开!")
            self.assertEqual(sound_status, False, "竖屏声音开关按钮点击两次后,声音没有开启!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_voice_btn_click_refresh_portrait(self):
        """ 竖屏点击声音按钮后刷新页面 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        self.common.voice_btn_click()
        sleep(1)
        self.browser.refresh()
        self.common.loading_pass()
        sleep(1)
        voice_status = self.common.voice_btn_status()
        sound_status = self.common.sound_status()
        try:
            self.assertEqual(voice_status, "silience", "竖屏关闭声音按钮后刷新,按钮变成打开!")
            self.assertEqual(sound_status, True, "竖屏关闭声音后刷新,声音变成打开!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

        sleep(1)
        self.common.voice_btn_click()
        sleep(1)
        self.browser.refresh()
        self.common.loading_pass()
        sleep(1)
        voice_status = self.common.voice_btn_status()
        sound_status = self.common.sound_status()
        try:
            self.assertEqual(voice_status, "normal", "竖屏打开声音按钮后刷新,按钮变成关闭!")
            self.assertEqual(sound_status, False, "竖屏打开声音后刷新,声音变成关闭!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_turbo_btn_default_portrait(self):
        """ 竖屏快速模式按钮默认状态 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        turbo_btn_status = self.common.turbo_btn_status()
        spin_status = self.common.spin_is_in_turbo()
        try:
            self.assertEqual(turbo_btn_status, "1x", "竖屏快速模式按钮默认状态不是1x!")
            self.assertEqual(spin_status, False, "竖屏滚轴默认滚动方式不是普通速度!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_turbo_btn_click_portrait(self):
        """ 竖屏点击快速模式按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        # 用于判断当前是什么模式
        i = 0

        while True:
            if i == 1:
                self.common.turbo_btn_click()
                i -= 1
                sleep(3)

            start_time = datetime.now()
            self.common.start_btn_click()
            self.common.wait_for_rolling(15)
            speed_up = self.common.get_scroller_speed_up()
            self.common.wait_for_rolling_stop(15, just_rolling=True)
            end_time = datetime.now()
            self.common.wait_for_rolling_stop(15)

            normal_spin_time = (end_time - start_time).seconds

            game_status = self.common.get_game_current_status()
            if game_status is not None or speed_up is True:
                self.browser.refresh()
                self.common.loading_pass()
                sleep(1)
                continue
            else:

                sleep(1)
                self.common.main_menu_btn_click()
                sleep(1)

                if i == 0:
                    self.common.turbo_btn_click()
                    i += 1
                    sleep(0.5)

                turbo_btn_status = self.common.turbo_btn_status()
                spin_status = self.common.spin_is_in_turbo()
                info_bar_banner = self.common.info_bar_view_banner_tips_label()

                start_time = datetime.now()
                self.common.start_btn_click()
                self.common.wait_for_rolling(15)
                speed_up = self.common.get_scroller_speed_up()
                self.common.wait_for_rolling_stop(15, just_rolling=True)
                end_time = datetime.now()
                self.common.wait_for_rolling_stop(15)

                turbo_spin_time = (end_time - start_time).seconds

                game_status = self.common.get_game_current_status()
                if game_status is not None or speed_up is True:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    continue
                else:
                    try:
                        self.assertEqual(turbo_btn_status, "2x",
                                         "竖屏启动快速模式,快速模式按钮状态不是2x!")
                        self.assertEqual(spin_status, True,
                                         "竖屏启动快速模式,滚轴滚动方式不是快速!")
                        self.assertEqual(info_bar_banner, "快速模式已启用",
                                         "竖屏启动快速模式,下导航栏提示文字错误!")
                        self.assertEqual(turbo_spin_time < normal_spin_time,
                                         True, "竖屏启动快速模式,滚轴停止速度不会变快!")
                        break
                    except AssertionError:
                        self.daf.get_screenshot(self.browser)
                        raise

    def test_turbo_btn_click_twice_portrait(self):
        """ 竖屏点击快速模式按钮两次 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        self.common.turbo_btn_click()
        sleep(1)
        self.common.turbo_btn_click()
        sleep(0.5)
        turbo_btn_status = self.common.turbo_btn_status()
        spin_status = self.common.spin_is_in_turbo()
        info_bar_banner = self.common.info_bar_view_banner_tips_label()
        try:
            self.assertEqual(turbo_btn_status, "1x",
                             "竖屏点击快速模式按钮两次,快速模式按钮状态不是1x!")
            self.assertEqual(spin_status, False, "竖屏点击快速模式按钮两次,滚轴滚动方式不是慢速!")
            self.assertEqual(info_bar_banner, "快速模式已禁用",
                             "竖屏点击快速模式按钮两次,下导航栏提示文字错误!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_turbo_btn_click_refresh_portrait(self):
        """ 竖屏点击快速按钮后刷新页面 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        self.common.turbo_btn_click()
        sleep(1)
        self.browser.refresh()
        self.common.loading_pass()
        sleep(1)
        turbo_btn_status = self.common.turbo_btn_status()
        spin_status = self.common.spin_is_in_turbo()
        try:
            self.assertEqual(turbo_btn_status, "2x",
                             "竖屏启动快速模式后刷新,快速模式按钮状态不是2x!")
            self.assertEqual(spin_status, True, "竖屏启动快速模式后刷新,滚轴滚动方式不是快速!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

        sleep(1)
        self.common.turbo_btn_click()
        sleep(1)
        self.browser.refresh()
        self.common.loading_pass()
        sleep(1)
        turbo_btn_status = self.common.turbo_btn_status()
        spin_status = self.common.spin_is_in_turbo()
        try:
            self.assertEqual(turbo_btn_status, "1x",
                             "竖屏关闭快速模式后刷新,快速模式按钮状态不是1x!")
            self.assertEqual(spin_status, False, "竖屏关闭快速模式后刷新,滚轴滚动方式不是慢速!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    #
    #
    # ------------------------------------------------------------------------ 横竖屏模式 ------------------------------------------------------------------------
    #
    #

    def test_main_menu_default_switch_screen(self):
        """ 横竖屏切换,左侧主菜单状态 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        self.common.landscape()
        sleep(1)
        info_btn1 = self.common.info_btn_visible()
        help_btn1 = self.common.help_btn_visible()
        voice_btn1 = self.common.voice_btn_visible()
        turbo_btn1 = self.common.turbo_btn_visible()
        home_btn1 = self.common.home_btn_visible()
        game_record_btn1 = self.common.game_record_btn_enable()

        self.common.portrait()
        sleep(1)
        expand2 = self.common.main_menu_expand()
        info_btn2 = self.common.info_btn_visible()
        help_btn2 = self.common.help_btn_visible()
        voice_btn2 = self.common.voice_btn_visible()
        turbo_btn2 = self.common.turbo_btn_visible()
        home_btn2 = self.common.home_btn_visible()
        game_record_btn2 = self.common.game_record_btn_enable()

        try:
            self.assertEqual(expand2, "expandPPC", "横竖屏切换,主菜单默认不是展开状态!")
            self.assertEqual(info_btn2, info_btn1,
                             "横竖屏切换,主菜单展开时,奖金表按钮与横屏时的状态不一致!")
            self.assertEqual(help_btn2, help_btn1,
                             "横竖屏切换,主菜单展开时,帮助按钮与横屏时的状态不一致!")
            self.assertEqual(voice_btn2, voice_btn1,
                             "横竖屏切换,主菜单展开时,声音按钮与横屏时的状态不一致!")
            self.assertEqual(turbo_btn2, turbo_btn1,
                             "横竖屏切换,主菜单展开时,快速按钮与横屏时的状态不一致!")
            self.assertEqual(home_btn2, home_btn1,
                             "横竖屏切换,PC端上方主菜单展开时,会显示返回大厅按钮!")
            self.assertEqual(game_record_btn2, game_record_btn1,
                             "横竖屏切换,竖屏试玩上方主菜单展开时,会显示游戏记录按钮!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_main_menu_btn_click_switch_screen(self):
        """ 横竖屏切换,点击左侧主菜单按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        self.common.landscape()
        sleep(1)
        self.common.main_menu_btn_click()
        sleep(1)
        info_btn1 = self.common.info_btn_visible()
        help_btn1 = self.common.help_btn_visible()
        voice_btn1 = self.common.voice_btn_visible()
        turbo_btn1 = self.common.turbo_btn_visible()
        home_btn1 = self.common.home_btn_visible()
        game_record_btn1 = self.common.game_record_btn_enable()

        self.common.portrait()
        sleep(1)
        status2 = self.common.main_menu_expand()
        info_btn2 = self.common.info_btn_visible()
        help_btn2 = self.common.help_btn_visible()
        voice_btn2 = self.common.voice_btn_visible()
        turbo_btn2 = self.common.turbo_btn_visible()
        home_btn2 = self.common.home_btn_visible()
        game_record_btn2 = self.common.game_record_btn_enable()
        try:
            self.assertEqual(status2, "retractP", "横屏关闭左侧主菜单,横竖屏切换,主菜单不会折叠!")
            self.assertEqual(info_btn2, info_btn1,
                             "横屏关闭左侧主菜单,横竖屏切换,主菜单折叠时会显示奖金表按钮!")
            self.assertEqual(help_btn2, help_btn1,
                             "横屏关闭左侧主菜单,横竖屏切换,主菜单折叠时会显示帮助按钮!")
            self.assertEqual(voice_btn2, voice_btn1,
                             "横屏关闭左侧主菜单,横竖屏切换,主菜单折叠时会显示声音按钮!")
            self.assertEqual(turbo_btn2, turbo_btn1,
                             "横屏关闭左侧主菜单,横竖屏切换,主菜单折叠时会显示快速按钮!")
            self.assertEqual(home_btn2, home_btn1,
                             "横屏关闭左侧主菜单,横竖屏切换,PC端会显示返回大厅按钮!")
            self.assertEqual(game_record_btn2, game_record_btn1,
                             "横屏关闭左侧主菜单,横竖屏切换,试玩会显示游戏记录按钮!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_main_menu_btn_click_twice_switch_screen(self):
        """ 横竖屏切换,点击左侧主菜单按钮两次 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        self.common.landscape()
        sleep(1)
        self.common.main_menu_btn_click()
        sleep(1)
        self.common.main_menu_btn_click()
        sleep(1)
        info_btn1 = self.common.info_btn_visible()
        help_btn1 = self.common.help_btn_visible()
        voice_btn1 = self.common.voice_btn_visible()
        turbo_btn1 = self.common.turbo_btn_visible()
        home_btn1 = self.common.home_btn_visible()
        game_record_btn1 = self.common.game_record_btn_enable()

        self.common.portrait()
        sleep(1)
        status2 = self.common.main_menu_expand()
        info_btn2 = self.common.info_btn_visible()
        help_btn2 = self.common.help_btn_visible()
        voice_btn2 = self.common.voice_btn_visible()
        turbo_btn2 = self.common.turbo_btn_visible()
        home_btn2 = self.common.home_btn_visible()
        game_record_btn2 = self.common.game_record_btn_enable()

        try:
            self.assertEqual(status2, "expandPPC",
                             "横屏关闭主菜单后又打开,横竖屏切换,主菜单不是展开状态!")
            self.assertEqual(info_btn2, info_btn1,
                             "横屏关闭主菜单后又打开,横竖屏切换,不会显示奖金表按钮!")
            self.assertEqual(help_btn2, help_btn1,
                             "横屏关闭主菜单后又打开,横竖屏切换,不会显示帮助按钮!")
            self.assertEqual(voice_btn2, voice_btn1,
                             "横屏关闭主菜单后又打开,横竖屏切换,关闭主菜单后又打开,不会显示声音按钮!")
            self.assertEqual(turbo_btn2, turbo_btn1,
                             "横屏关闭主菜单后又打开,横竖屏切换,不会显示快速按钮!")
            self.assertEqual(home_btn2, home_btn1,
                             "横屏关闭主菜单后又打开,横竖屏切换,PC端会显示返回大厅按钮!")
            self.assertEqual(game_record_btn2, game_record_btn1,
                             "横屏关闭主菜单后又打开,横竖屏切换,试玩会显示游戏记录按钮!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_info_view_return_btn_switch_screen(self):
        """ 横竖屏切换,奖金表场景返回按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        self.common.info_btn_click()
        sleep(1)
        self.common.landscape()
        sleep(1)
        self.common.portrait()
        sleep(1)
        visible = self.common.info_view_return_btn_visible()
        touchable = self.common.info_view_return_btn_touchable()
        try:
            self.assertEqual(visible, True, "横竖屏切换,奖金表场景,返回按钮不会显示!")
            self.assertEqual(touchable, True, "横竖屏切换,奖金表场景,返回按钮不可点击!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_info_view_return_btn_click_switch_screen(self):
        """ 横竖屏切换,点击奖金表返回按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        self.common.info_btn_click()
        sleep(1)
        self.common.landscape()
        sleep(1)
        self.common.info_view_return_btn_click()
        sleep(1)
        self.common.portrait()
        sleep(1)
        dispear = self.common.info_view_dispear()
        try:
            self.assertEqual(dispear, None, "横竖屏切换,竖屏点击奖金表返回按钮,奖金表场景不会消失!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_help_view_return_btn_switch_screen(self):
        """ 横竖屏切换,帮助场景返回按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        self.common.help_btn_click()
        sleep(1)
        self.common.landscape()
        sleep(1)
        self.common.portrait()
        sleep(1)
        visible = self.common.help_view_return_btn_visible()
        touchable = self.common.help_view_return_btn_touchable()
        try:
            self.assertEqual(visible, True, "横竖屏切换,不会显示返回按钮!")
            self.assertEqual(touchable, True, "横竖屏切换,返回按钮不可点击!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_help_view_return_btn_click_switch_screen(self):
        """ 横竖屏切换,点击帮助场景返回按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        self.common.help_btn_click()
        sleep(1)
        self.common.landscape()
        sleep(1)
        self.common.help_view_return_btn_click()
        sleep(1)
        self.common.portrait()
        sleep(1)
        dispear = self.common.help_view_dispear()
        try:
            self.assertEqual(dispear, None, "横竖屏切换,点击帮助场景返回按钮,帮助场景不会消失!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_voice_btn_click_switch_screen(self):
        """ 横竖屏切换,点击声音开关按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        self.common.landscape()
        sleep(1)
        self.common.voice_btn_click()
        sleep(1)
        self.common.portrait()
        sleep(1)
        voice_status = self.common.voice_btn_status()
        sound_status = self.common.sound_status()
        try:
            self.assertEqual(voice_status, "silience",
                             "横竖屏切换,声音开关按钮点击后,竖屏按钮状态不会改变!")
            self.assertEqual(sound_status, True, "横竖屏切换,声音开关按钮点击后,竖屏声音不会关闭!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_voice_btn_click_twice_switch_screen(self):
        """ 横竖屏切换,点击声音开关按钮两次 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        self.common.landscape()
        sleep(1)
        self.common.voice_btn_click()
        sleep(1)
        self.common.voice_btn_click()
        sleep(1)
        self.common.portrait()
        sleep(1)
        voice_status = self.common.voice_btn_status()
        sound_status = self.common.sound_status()
        try:
            self.assertEqual(voice_status, "normal",
                             "横竖屏切换,声音开关按钮点击两次后,竖屏按钮状态没有恢复打开!")
            self.assertEqual(sound_status, False,
                             "横竖屏切换,声音开关按钮点击两次后,竖屏声音没有开启!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_turbo_btn_click_switch_screen(self):
        """ 横竖屏切换,点击快速模式按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        # 用于判断当前是什么模式
        i = 0

        while True:
            if i == 1:
                self.common.turbo_btn_click()
                i -= 1
                sleep(3)

            sleep(1)
            start_time = datetime.now()
            self.common.start_btn_click()
            self.common.wait_for_rolling(15)
            speed_up = self.common.get_scroller_speed_up()
            self.common.wait_for_rolling_stop(15, just_rolling=True)
            end_time = datetime.now()
            self.common.wait_for_rolling_stop(15)

            normal_spin_time = (end_time - start_time).seconds

            game_status = self.common.get_game_current_status()
            if game_status is not None or speed_up is True:
                self.browser.refresh()
                self.common.portrait()
                self.common.loading_pass()
                sleep(1)
                continue
            else:
                self.common.landscape()
                sleep(1)
                self.common.main_menu_btn_click()
                sleep(1)

                if i == 0:
                    self.common.turbo_btn_click()
                    i += 1
                    sleep(0.5)

                self.common.portrait()
                sleep(0.5)
                turbo_btn_status = self.common.turbo_btn_status()
                spin_status = self.common.spin_is_in_turbo()
                info_bar_banner = self.common.info_bar_view_banner_tips_label()

                start_time = datetime.now()
                self.common.start_btn_click()
                self.common.wait_for_rolling(15)
                speed_up = self.common.get_scroller_speed_up()
                self.common.wait_for_rolling_stop(15, just_rolling=True)
                end_time = datetime.now()
                self.common.wait_for_rolling_stop(15)

                turbo_spin_time = (end_time - start_time).seconds

                game_status = self.common.get_game_current_status()
                if game_status is not None or speed_up is True:
                    self.browser.refresh()
                    self.common.portrait()
                    self.common.loading_pass()
                    sleep(1)
                    continue
                else:
                    try:
                        self.assertEqual(turbo_btn_status, "2x",
                                         "横竖屏切换,启动快速模式,快速模式按钮状态不是2x!")
                        self.assertEqual(spin_status, True,
                                         "横竖屏切换,启动快速模式,滚轴滚动方式不是快速!")
                        self.assertEqual(info_bar_banner, "快速模式已启用",
                                         "横竖屏切换,启动快速模式,下导航栏提示文字错误!")
                        self.assertEqual(turbo_spin_time < normal_spin_time,
                                         True, "横竖屏切换,启动快速模式,滚轴停止速度不会变快!")
                        break
                    except AssertionError:
                        self.daf.get_screenshot(self.browser)
                        raise

    def test_turbo_btn_click_twice_switch_screen(self):
        """ 横竖屏切换,点击快速模式按钮两次 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        self.common.turbo_btn_click()
        sleep(1)
        self.common.turbo_btn_click()
        self.common.landscape()
        sleep(0.5)
        turbo_btn_status = self.common.turbo_btn_status()
        spin_status = self.common.spin_is_in_turbo()
        info_bar_banner = self.common.info_bar_view_banner_tips_label()
        try:
            self.assertEqual(turbo_btn_status, "1x",
                             "竖屏点击快速模式按钮两次,快速模式按钮状态不是1x!")
            self.assertEqual(spin_status, False, "竖屏点击快速模式按钮两次,滚轴滚动方式不是慢速!")
            self.assertEqual(info_bar_banner, "快速模式已禁用",
                             "竖屏点击快速模式按钮两次,下导航栏提示文字错误!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise
Esempio n. 3
0
class TestTurboView(unittest.TestCase):
    """ 快速模式窗口模块 """
    def setUp(self):
        self.browser = Browser().browser()
        self.common = Common(self.browser)
        self.common.start()
        self.daf = DirAndFiles()

    def tearDown(self):
        self.browser.quit()

    #
    #
    # ------------------------------------------------------------------------ 横屏模式 ------------------------------------------------------------------------
    #
    #

    def test_turbo_view(self):
        """ 横屏快速模式窗口显示 """
        self.common.loading_pass()
        sleep(1)
        while True:
            i = 0
            game_status = None
            total_win = 0
            for i in range(2):
                self.common.start_btn_click()
                self.common.wait_for_rolling(30)
                sleep(0.5)
                self.common.start_btn_click()
                sleep(0.5)
                game_status = self.common.get_game_current_status()
                total_win = self.common.total_win()

                if game_status is not None or total_win != 0:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    break

            if i == 1 and game_status is None and total_win == 0:
                break

        turbo_view = self.common.turbo_mode_view_showing()
        mask_view = self.common.mask_view_showing()
        close_btn = self.common.turbo_mode_view_close_btn_visible()
        close_btn_touchable = self.common.turbo_mode_view_close_btn_touchable()
        title_long = self.common.turbo_mode_view_title_long()
        title_short = self.common.turbo_mode_view_title_short()
        enable_btn = self.common.turbo_mode_view_enable_btn_visible()
        enable_btn_text = self.common.turbo_mode_view_enable_btn_text()
        enable_btn_touchable = self.common.turbo_mode_view_enable_btn_touchable(
        )

        try:
            self.assertEqual(turbo_view, True, "横屏快速旋转停止两次,不会弹出快速模式窗口!")
            self.assertEqual(mask_view, True, "横屏弹出快速模式窗口,不会显示灰色蒙板!")
            self.assertEqual(close_btn, True, "横屏弹出快速模式窗口,不会显示关闭按钮!")
            self.assertEqual(close_btn_touchable, True, "横屏弹出快速模式窗口,关闭按钮不可点击!")
            self.assertEqual(title_long, "看来您喜欢更快速的玩游戏。\n你想启用快速模式吗?",
                             "横屏弹出快速模式窗口,长的提示文字错误!")
            self.assertEqual(title_short, "您可以随时在菜单中将其禁用",
                             "横屏弹出快速模式窗口,短的提示文字错误!")
            self.assertEqual(enable_btn, True, "横屏弹出快速模式窗口,不会显示启动快速按钮!")
            self.assertEqual(enable_btn_text, "启用快速模式",
                             "横屏弹出快速模式窗口,启动快速模式按钮上的文字错误!")
            self.assertEqual(enable_btn_touchable, True,
                             "横屏弹出快速模式窗口,启动快速模式按钮不可点击!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_close_btn_click(self):
        """ 横屏点击关闭按钮 """
        self.common.loading_pass()
        sleep(1)
        while True:
            i = 0
            game_status = None
            total_win = 0
            for i in range(2):
                self.common.start_btn_click()
                self.common.wait_for_rolling(30)
                sleep(0.5)
                self.common.start_btn_click()
                sleep(0.5)
                game_status = self.common.get_game_current_status()
                total_win = self.common.total_win()

                if game_status is not None or total_win != 0:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    break

            if i == 1 and game_status is None and total_win == 0:
                break

        sleep(1)
        self.common.turbo_mode_view_close_btn_click()
        sleep(0.5)
        turbo_view = self.common.turbo_mode_view_dispear()
        mask_view = self.common.mask_view_showing()
        turbo_btn_status = self.common.turbo_btn_status()
        spin_status = self.common.spin_is_in_turbo()
        try:
            self.assertEqual(turbo_view, None, "横屏点击快速模式窗口关闭按钮,窗口不会消失!")
            self.assertEqual(mask_view, False, "横屏点击快速模式窗口关闭按钮,灰色蒙板不会消失!")
            self.assertEqual(turbo_btn_status, "1x",
                             "横屏点击快速模式窗口关闭按钮,快速模式按钮状态不是1x!")
            self.assertEqual(spin_status, False,
                             "横屏点击快速模式窗口关闭按钮,滚轴滚动方式不是普通速度!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_mask_click(self):
        """ 横屏点击灰色蒙板 """
        self.common.loading_pass()
        sleep(1)
        while True:
            i = 0
            game_status = None
            total_win = 0
            for i in range(2):
                self.common.start_btn_click()
                self.common.wait_for_rolling(30)
                sleep(0.5)
                self.common.start_btn_click()
                sleep(0.5)
                game_status = self.common.get_game_current_status()
                total_win = self.common.total_win()

                if game_status is not None or total_win != 0:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    break

            if i == 1 and game_status is None and total_win == 0:
                break

        sleep(1)
        self.common.mask_view_click()
        sleep(0.5)
        turbo_view = self.common.turbo_mode_view_dispear()
        mask_view = self.common.mask_view_showing()
        turbo_btn_status = self.common.turbo_btn_status()
        spin_status = self.common.spin_is_in_turbo()
        try:
            self.assertEqual(turbo_view, None, "横屏点击灰色蒙板,快速模式窗口不会消失!")
            self.assertEqual(mask_view, False, "横屏点击灰色蒙板,蒙板不会消失!")
            self.assertEqual(turbo_btn_status, "1x", "横屏点击灰色蒙板,快速模式按钮状态不是1x!")
            self.assertEqual(spin_status, False, "横屏点击灰色蒙板,滚轴滚动方式不是普通速度!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_auto_dispear(self):
        """ 横屏窗口自动消失 """
        self.common.loading_pass()
        sleep(1)
        while True:
            i = 0
            game_status = None
            total_win = 0
            for i in range(2):
                self.common.start_btn_click()
                self.common.wait_for_rolling(30)
                sleep(0.5)
                self.common.start_btn_click()
                sleep(0.5)
                game_status = self.common.get_game_current_status()
                total_win = self.common.total_win()

                if game_status is not None or total_win != 0:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    break

            if i == 1 and game_status is None and total_win == 0:
                break

        sleep(7)
        turbo_view = self.common.turbo_mode_view_dispear()
        mask_view = self.common.mask_view_showing()
        turbo_btn_status = self.common.turbo_btn_status()
        spin_status = self.common.spin_is_in_turbo()
        try:
            self.assertEqual(turbo_view, None, "横屏等待6秒,快速模式窗口不会消失!")
            self.assertEqual(mask_view, False, "横屏等待6秒,灰色蒙板不会消失!")
            self.assertEqual(turbo_btn_status, "1x",
                             "横屏快速模式窗口自动消失后,快速模式按钮状态不是1x!")
            self.assertEqual(spin_status, False, "横屏快速模式窗口自动消失后,滚轴滚动方式不是普通速度!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_enable_btn_click(self):
        """ 横屏点击启用快速模式按钮 """
        self.common.loading_pass()
        sleep(1)
        while True:
            i = 0
            game_status = None
            total_win = 0
            for i in range(2):
                self.common.start_btn_click()
                self.common.wait_for_rolling(30)
                sleep(0.5)
                self.common.start_btn_click()
                sleep(0.5)
                game_status = self.common.get_game_current_status()
                total_win = self.common.total_win()

                if game_status is not None or total_win != 0:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    break

            if i == 1 and game_status is None and total_win == 0:
                break

        sleep(1)
        self.common.turbo_mode_view_enable_btn_click()
        sleep(0.5)
        turbo_view = self.common.turbo_mode_view_dispear()
        mask_view = self.common.mask_view_showing()
        turbo_btn_status = self.common.turbo_btn_status()
        spin_status = self.common.spin_is_in_turbo()
        try:
            self.assertEqual(turbo_view, None, "横屏点击快速模式窗口启用按钮,窗口不会消失!")
            self.assertEqual(mask_view, False, "横屏点击快速模式窗口启用按钮,灰色蒙板不会消失!")
            self.assertEqual(turbo_btn_status, "2x",
                             "横屏点击快速模式窗口启用按钮,快速模式按钮状态不是2x!")
            self.assertEqual(spin_status, True, "横屏点击快速模式窗口启用按钮,滚轴滚动方式不是快速速度!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_enable_btn_click_refresh(self):
        """ 横屏点击启用快速模式按钮后刷新页面 """
        self.common.loading_pass()
        sleep(1)
        while True:
            i = 0
            game_status = None
            total_win = 0
            for i in range(2):
                self.common.start_btn_click()
                self.common.wait_for_rolling(30)
                sleep(0.5)
                self.common.start_btn_click()
                sleep(0.5)
                game_status = self.common.get_game_current_status()
                total_win = self.common.total_win()

                if game_status is not None or total_win != 0:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    break

            if i == 1 and game_status is None and total_win == 0:
                break

        sleep(1)
        self.common.turbo_mode_view_enable_btn_click()
        sleep(1)
        self.browser.refresh()
        self.common.loading_pass()
        sleep(1)

        turbo_btn_status = self.common.turbo_btn_status()
        spin_status = self.common.spin_is_in_turbo()
        try:
            self.assertEqual(turbo_btn_status, "2x",
                             "横屏点击启用快速模式按钮后刷新,快速模式按钮状态不是2x!")
            self.assertEqual(spin_status, True,
                             "横屏点击启用快速模式按钮后刷新,滚轴滚动方式不是快速速度!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    #
    #
    # ------------------------------------------------------------------------ 竖屏模式 ------------------------------------------------------------------------
    #
    #

    def test_turbo_view_portrait(self):
        """ 竖屏快速模式窗口显示 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        while True:
            i = 0
            game_status = None
            total_win = 0
            for i in range(2):
                self.common.start_btn_click()
                self.common.wait_for_rolling(30)
                sleep(0.5)
                self.common.start_btn_click()
                sleep(0.5)
                game_status = self.common.get_game_current_status()
                total_win = self.common.total_win()

                if game_status is not None or total_win != 0:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    break

            if i == 1 and game_status is None and total_win == 0:
                break

        turbo_view = self.common.turbo_mode_view_showing()
        mask_view = self.common.mask_view_showing()
        close_btn = self.common.turbo_mode_view_close_btn_visible()
        close_btn_touchable = self.common.turbo_mode_view_close_btn_touchable()
        title_long = self.common.turbo_mode_view_title_long()
        title_short = self.common.turbo_mode_view_title_short()
        enable_btn = self.common.turbo_mode_view_enable_btn_visible()
        enable_btn_text = self.common.turbo_mode_view_enable_btn_text()
        enable_btn_touchable = self.common.turbo_mode_view_enable_btn_touchable(
        )

        try:
            self.assertEqual(turbo_view, True, "竖屏快速旋转停止两次,不会弹出快速模式窗口!")
            self.assertEqual(mask_view, True, "竖屏弹出快速模式窗口,不会显示灰色蒙板!")
            self.assertEqual(close_btn, True, "竖屏弹出快速模式窗口,不会显示关闭按钮!")
            self.assertEqual(close_btn_touchable, True, "竖屏弹出快速模式窗口,关闭按钮不可点击!")
            self.assertEqual(title_long, "看来您喜欢更快速的玩游戏。\n你想启用快速模式吗?",
                             "竖屏弹出快速模式窗口,长的提示文字错误!")
            self.assertEqual(title_short, "您可以随时在菜单中将其禁用",
                             "竖屏弹出快速模式窗口,短的提示文字错误!")
            self.assertEqual(enable_btn, True, "竖屏弹出快速模式窗口,不会显示启动快速按钮!")
            self.assertEqual(enable_btn_text, "启用快速模式",
                             "竖屏弹出快速模式窗口,启动快速模式按钮上的文字错误!")
            self.assertEqual(enable_btn_touchable, True,
                             "竖屏弹出快速模式窗口,启动快速模式按钮不可点击!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_close_btn_click_portrait(self):
        """ 竖屏点击关闭按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        while True:
            i = 0
            game_status = None
            total_win = 0
            for i in range(2):
                self.common.start_btn_click()
                self.common.wait_for_rolling(30)
                sleep(0.5)
                self.common.start_btn_click()
                sleep(0.5)
                game_status = self.common.get_game_current_status()
                total_win = self.common.total_win()

                if game_status is not None or total_win != 0:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    break

            if i == 1 and game_status is None and total_win == 0:
                break

        sleep(1)
        self.common.turbo_mode_view_close_btn_click()
        sleep(0.5)
        turbo_view = self.common.turbo_mode_view_dispear()
        mask_view = self.common.mask_view_showing()
        turbo_btn_status = self.common.turbo_btn_status()
        spin_status = self.common.spin_is_in_turbo()
        try:
            self.assertEqual(turbo_view, None, "竖屏点击快速模式窗口关闭按钮,窗口不会消失!")
            self.assertEqual(mask_view, False, "竖屏点击快速模式窗口关闭按钮,灰色蒙板不会消失!")
            self.assertEqual(turbo_btn_status, "1x",
                             "竖屏点击快速模式窗口关闭按钮,快速模式按钮状态不是1x!")
            self.assertEqual(spin_status, False,
                             "竖屏点击快速模式窗口关闭按钮,滚轴滚动方式不是普通速度!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_mask_click_portrait(self):
        """ 竖屏点击灰色蒙板 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        while True:
            i = 0
            game_status = None
            total_win = 0
            for i in range(2):
                self.common.start_btn_click()
                self.common.wait_for_rolling(30)
                sleep(0.5)
                self.common.start_btn_click()
                sleep(0.5)
                game_status = self.common.get_game_current_status()
                total_win = self.common.total_win()

                if game_status is not None or total_win != 0:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    break

            if i == 1 and game_status is None and total_win == 0:
                break

        sleep(1)
        self.common.mask_view_click()
        sleep(0.5)
        turbo_view = self.common.turbo_mode_view_dispear()
        mask_view = self.common.mask_view_showing()
        turbo_btn_status = self.common.turbo_btn_status()
        spin_status = self.common.spin_is_in_turbo()
        try:
            self.assertEqual(turbo_view, None, "竖屏点击灰色蒙板,快速模式窗口不会消失!")
            self.assertEqual(mask_view, False, "竖屏点击灰色蒙板,蒙板不会消失!")
            self.assertEqual(turbo_btn_status, "1x", "竖屏点击灰色蒙板,快速模式按钮状态不是1x!")
            self.assertEqual(spin_status, False, "竖屏点击灰色蒙板,滚轴滚动方式不是普通速度!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_auto_dispear_portrait(self):
        """ 竖屏窗口自动消失 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        while True:
            i = 0
            game_status = None
            total_win = 0
            for i in range(2):
                self.common.start_btn_click()
                self.common.wait_for_rolling(30)
                sleep(0.5)
                self.common.start_btn_click()
                sleep(0.5)
                game_status = self.common.get_game_current_status()
                total_win = self.common.total_win()

                if game_status is not None or total_win != 0:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    break

            if i == 1 and game_status is None and total_win == 0:
                break

        sleep(7)
        turbo_view = self.common.turbo_mode_view_dispear()
        mask_view = self.common.mask_view_showing()
        turbo_btn_status = self.common.turbo_btn_status()
        spin_status = self.common.spin_is_in_turbo()
        try:
            self.assertEqual(turbo_view, None, "竖屏等待6秒,快速模式窗口不会消失!")
            self.assertEqual(mask_view, False, "竖屏等待6秒,灰色蒙板不会消失!")
            self.assertEqual(turbo_btn_status, "1x",
                             "竖屏快速模式窗口自动消失后,快速模式按钮状态不是1x!")
            self.assertEqual(spin_status, False, "竖屏快速模式窗口自动消失后,滚轴滚动方式不是普通速度!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_enable_btn_click_portrait(self):
        """ 竖屏点击启用快速模式按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        while True:
            i = 0
            game_status = None
            total_win = 0
            for i in range(2):
                self.common.start_btn_click()
                self.common.wait_for_rolling(30)
                sleep(0.5)
                self.common.start_btn_click()
                sleep(0.5)
                game_status = self.common.get_game_current_status()
                total_win = self.common.total_win()

                if game_status is not None or total_win != 0:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    break

            if i == 1 and game_status is None and total_win == 0:
                break

        sleep(1)
        self.common.turbo_mode_view_enable_btn_click()
        sleep(0.5)
        turbo_view = self.common.turbo_mode_view_dispear()
        mask_view = self.common.mask_view_showing()
        turbo_btn_status = self.common.turbo_btn_status()
        spin_status = self.common.spin_is_in_turbo()
        try:
            self.assertEqual(turbo_view, None, "竖屏点击快速模式窗口启用按钮,窗口不会消失!")
            self.assertEqual(mask_view, False, "竖屏点击快速模式窗口启用按钮,灰色蒙板不会消失!")
            self.assertEqual(turbo_btn_status, "2x",
                             "竖屏点击快速模式窗口启用按钮,快速模式按钮状态不是2x!")
            self.assertEqual(spin_status, True, "竖屏点击快速模式窗口启用按钮,滚轴滚动方式不是快速速度!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_enable_btn_click_refresh_portrait(self):
        """ 竖屏点击启用快速模式按钮后刷新页面 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        while True:
            i = 0
            game_status = None
            total_win = 0
            for i in range(2):
                self.common.start_btn_click()
                self.common.wait_for_rolling(30)
                sleep(0.5)
                self.common.start_btn_click()
                sleep(0.5)
                game_status = self.common.get_game_current_status()
                total_win = self.common.total_win()

                if game_status is not None or total_win != 0:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    break

            if i == 1 and game_status is None and total_win == 0:
                break

        sleep(1)
        self.common.turbo_mode_view_enable_btn_click()
        sleep(1)
        self.browser.refresh()
        self.common.loading_pass()
        sleep(1)

        turbo_btn_status = self.common.turbo_btn_status()
        spin_status = self.common.spin_is_in_turbo()
        try:
            self.assertEqual(turbo_btn_status, "2x",
                             "竖屏点击启用快速模式按钮后刷新,快速模式按钮状态不是2x!")
            self.assertEqual(spin_status, True,
                             "竖屏点击启用快速模式按钮后刷新,滚轴滚动方式不是快速速度!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    #
    #
    # ------------------------------------------------------------------------ 横竖屏模式 ------------------------------------------------------------------------
    #
    #

    def test_turbo_view_switch_screen(self):
        """ 横竖屏快速模式窗口显示 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        while True:
            i = 0
            game_status = None
            total_win = 0
            for i in range(2):
                self.common.start_btn_click()
                self.common.wait_for_rolling(30)
                sleep(0.5)
                self.common.start_btn_click()
                sleep(0.5)
                game_status = self.common.get_game_current_status()
                total_win = self.common.total_win()

                if game_status is not None or total_win != 0:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    break

            if i == 1 and game_status is None and total_win == 0:
                break

        self.common.landscape()
        sleep(0.5)
        self.common.portrait()
        sleep(0.5)

        turbo_view = self.common.turbo_mode_view_showing()
        mask_view = self.common.mask_view_showing()
        close_btn = self.common.turbo_mode_view_close_btn_visible()
        close_btn_touchable = self.common.turbo_mode_view_close_btn_touchable()
        title_long = self.common.turbo_mode_view_title_long()
        title_short = self.common.turbo_mode_view_title_short()
        enable_btn = self.common.turbo_mode_view_enable_btn_visible()
        enable_btn_text = self.common.turbo_mode_view_enable_btn_text()
        enable_btn_touchable = self.common.turbo_mode_view_enable_btn_touchable(
        )

        try:
            self.assertEqual(turbo_view, True, "竖屏快速旋转停止两次,横竖屏切换,不会弹出快速模式窗口!")
            self.assertEqual(mask_view, True, "竖屏弹出快速模式窗口,横竖屏切换,不会显示灰色蒙板!")
            self.assertEqual(close_btn, True, "竖屏弹出快速模式窗口,横竖屏切换,不会显示关闭按钮!")
            self.assertEqual(close_btn_touchable, True,
                             "竖屏弹出快速模式窗口,横竖屏切换,关闭按钮不可点击!")
            self.assertEqual(title_long, "看来您喜欢更快速的玩游戏。\n你想启用快速模式吗?",
                             "竖屏弹出快速模式窗口,横竖屏切换,长的提示文字错误!")
            self.assertEqual(title_short, "您可以随时在菜单中将其禁用",
                             "竖屏弹出快速模式窗口,横竖屏切换,短的提示文字错误!")
            self.assertEqual(enable_btn, True, "竖屏弹出快速模式窗口,横竖屏切换,不会显示启动快速按钮!")
            self.assertEqual(enable_btn_text, "启用快速模式",
                             "竖屏弹出快速模式窗口,横竖屏切换,启动快速模式按钮上的文字错误!")
            self.assertEqual(enable_btn_touchable, True,
                             "竖屏弹出快速模式窗口,横竖屏切换,启动快速模式按钮不可点击!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_close_btn_click_switch_screen(self):
        """ 横竖屏点击关闭按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        while True:
            i = 0
            game_status = None
            total_win = 0
            for i in range(2):
                self.common.start_btn_click()
                self.common.wait_for_rolling(30)
                sleep(0.5)
                self.common.start_btn_click()
                sleep(0.5)
                game_status = self.common.get_game_current_status()
                total_win = self.common.total_win()

                if game_status is not None or total_win != 0:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    break

            if i == 1 and game_status is None and total_win == 0:
                break

        sleep(1)
        self.common.turbo_mode_view_close_btn_click()
        sleep(0.5)
        self.common.landscape()
        sleep(0.5)
        self.common.portrait()
        sleep(0.5)
        turbo_view = self.common.turbo_mode_view_dispear()
        mask_view = self.common.mask_view_showing()
        turbo_btn_status = self.common.turbo_btn_status()
        spin_status = self.common.spin_is_in_turbo()
        try:
            self.assertEqual(turbo_view, None, "竖屏点击快速模式窗口关闭按钮,横竖屏切换,窗口不会消失!")
            self.assertEqual(mask_view, False,
                             "竖屏点击快速模式窗口关闭按钮,横竖屏切换,灰色蒙板不会消失!")
            self.assertEqual(turbo_btn_status, "1x",
                             "竖屏点击快速模式窗口关闭按钮,横竖屏切换,快速模式按钮状态不是1x!")
            self.assertEqual(spin_status, False,
                             "竖屏点击快速模式窗口关闭按钮,横竖屏切换,滚轴滚动方式不是普通速度!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_auto_dispear_switch_screen(self):
        """ 横竖屏窗口自动消失 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        while True:
            i = 0
            game_status = None
            total_win = 0
            for i in range(2):
                self.common.start_btn_click()
                self.common.wait_for_rolling(30)
                sleep(0.5)
                self.common.start_btn_click()
                sleep(0.5)
                game_status = self.common.get_game_current_status()
                total_win = self.common.total_win()

                if game_status is not None or total_win != 0:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    break

            if i == 1 and game_status is None and total_win == 0:
                break

        self.common.landscape()
        sleep(0.5)
        self.common.portrait()
        sleep(6.5)
        turbo_view = self.common.turbo_mode_view_dispear()
        mask_view = self.common.mask_view_showing()
        turbo_btn_status = self.common.turbo_btn_status()
        spin_status = self.common.spin_is_in_turbo()
        try:
            self.assertEqual(turbo_view, None, "竖屏等待6秒,横竖屏切换,快速模式窗口不会消失!")
            self.assertEqual(mask_view, False, "竖屏等待6秒,横竖屏切换,灰色蒙板不会消失!")
            self.assertEqual(turbo_btn_status, "1x",
                             "竖屏快速模式窗口自动消失后,横竖屏切换,快速模式按钮状态不是1x!")
            self.assertEqual(spin_status, False,
                             "竖屏快速模式窗口自动消失后,横竖屏切换,滚轴滚动方式不是普通速度!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_enable_btn_click_switch_screen(self):
        """ 横竖屏点击启用快速模式按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        while True:
            i = 0
            game_status = None
            total_win = 0
            for i in range(2):
                self.common.start_btn_click()
                self.common.wait_for_rolling(30)
                sleep(0.5)
                self.common.start_btn_click()
                sleep(0.5)
                game_status = self.common.get_game_current_status()
                total_win = self.common.total_win()

                if game_status is not None or total_win != 0:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    break

            if i == 1 and game_status is None and total_win == 0:
                break

        sleep(1)
        self.common.turbo_mode_view_enable_btn_click()
        sleep(0.5)
        self.common.landscape()
        sleep(0.5)
        self.common.portrait()
        sleep(0.5)
        turbo_view = self.common.turbo_mode_view_dispear()
        mask_view = self.common.mask_view_showing()
        turbo_btn_status = self.common.turbo_btn_status()
        spin_status = self.common.spin_is_in_turbo()
        try:
            self.assertEqual(turbo_view, None, "竖屏点击快速模式窗口启用按钮,横竖屏切换,窗口不会消失!")
            self.assertEqual(mask_view, False,
                             "竖屏点击快速模式窗口启用按钮,横竖屏切换,灰色蒙板不会消失!")
            self.assertEqual(turbo_btn_status, "2x",
                             "竖屏点击快速模式窗口启用按钮,横竖屏切换,快速模式按钮状态不是2x!")
            self.assertEqual(spin_status, True,
                             "竖屏点击快速模式窗口启用按钮,横竖屏切换,滚轴滚动方式不是快速速度!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise