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
class TestSpinBtn(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_start_btn(self):
        """ 横屏旋转按钮默认显示 """
        self.common.loading_pass()
        sleep(3)
        visible = self.common.start_btn_visible()
        touchable = self.common.start_btn_touchable()
        status = self.common.start_btn_status()
        rolling = self.common.slot_machine_rolling()
        banner = self.common.info_bar_view_banner_tips_label()
        try:
            self.assertEqual(visible, True, "横屏进入游戏,旋转按钮默认不会显示!")
            self.assertEqual(touchable, True, "横屏进入游戏,旋转按钮默认不可点击!")
            self.assertEqual(status, "stopped", "横屏进入游戏,旋转按钮默认显示停止按钮!")
            self.assertEqual(rolling, False, "横屏进入游戏,滚轴默认处于滚动状态!")
            self.assertEqual(banner, "滑动转轴或按旋转", "横屏进入游戏,下导航栏默认的提示文字错误!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_start_btn_click(self):
        """ 横屏点击旋转按钮 """
        self.common.loading_pass()
        sleep(1)
        self.common.start_btn_click()
        self.common.wait_for_rolling(15)

        slot_rolling = self.common.slot_machine_rolling()
        start_btn_status = self.common.start_btn_status()
        setting_btn = self.common.setting_btn_visible()
        auto_game_btn = self.common.auto_game_btn_visible()
        main_menu_expand = self.common.main_menu_expand()
        main_menu = self.common.main_menu_touchable()
        banner = self.common.info_bar_view_banner_tips_label()
        try:
            self.assertEqual(slot_rolling, True, "横屏点击旋转按钮,滚轴不会滚动!")
            self.assertEqual(start_btn_status, "playing",
                             "横屏点击旋转按钮,旋转按钮不会变成停止按钮!")
            self.assertEqual(setting_btn, False, "横屏点击旋转按钮,线数线注设置按钮不会消失!")
            self.assertEqual(auto_game_btn, False, "横屏点击旋转按钮,自动游戏按钮不会消失!")
            self.assertEqual(main_menu_expand, "retractL",
                             "横屏点击旋转按钮,左侧选项菜单不会折叠!")
            self.assertEqual(main_menu, False, "横屏点击旋转按钮,左侧选项菜单可以点击!")
            self.assertEqual(banner, "触摸转轴来提前停止", "横屏点击旋转按钮,下导航栏的提示文字错误!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

        self.common.wait_for_rolling_stop(15)
        game_status = self.common.get_game_current_status()

        coin = self.common.total_win()

        if game_status is None:
            if coin == 0:
                start_btn_status = self.common.start_btn_status()
                setting_btn = self.common.setting_btn_visible()
                auto_game_btn = self.common.auto_game_btn_visible()
                main_menu_expand = self.common.main_menu_expand()
                main_menu = self.common.main_menu_touchable()
                banner = self.common.info_bar_view_banner_tips_label()
                try:
                    self.assertEqual(start_btn_status, "stopped",
                                     "横屏点击旋转按钮,等待滚轴停下后,停止按钮不会恢复成旋转按钮!")
                    self.assertEqual(setting_btn, True,
                                     "横屏点击旋转按钮,等待滚轴停下后,线数线注设置按钮不会恢复显示!")
                    self.assertEqual(auto_game_btn, True,
                                     "横屏点击旋转按钮,等待滚轴停下后,自动游戏按钮不会恢复显示!")
                    self.assertEqual(main_menu_expand, "retractL",
                                     "横屏点击旋转按钮,等待滚轴停下后,左侧选项菜单不会折叠!")
                    self.assertEqual(main_menu, True,
                                     "横屏点击旋转按钮,等待滚轴停下后,左侧选项菜单不会恢复可点击状态!")
                    self.assertEqual(banner, "滑动转轴或按旋转",
                                     "横屏点击旋转按钮,等待滚轴停下后,下导航栏的提示文字错误!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise
            else:
                start_btn_status = self.common.start_btn_status()
                setting_btn = self.common.setting_btn_visible()
                auto_game_btn = self.common.auto_game_btn_visible()
                main_menu_expand = self.common.main_menu_expand()
                main_menu = self.common.main_menu_touchable()
                banner = self.common.info_bar_view_banner_tips_label()

                locale.setlocale(locale.LC_ALL, "")
                coin = "奖金 ¥" + locale.format("%.2f", coin / 100, 1)
                try:
                    self.assertEqual(start_btn_status, "stopped",
                                     "横屏点击旋转按钮,等待滚轴停下后,停止按钮不会恢复成旋转按钮!")
                    self.assertEqual(setting_btn, True,
                                     "横屏点击旋转按钮,等待滚轴停下后,线数线注设置按钮不会恢复显示!")
                    self.assertEqual(auto_game_btn, True,
                                     "横屏点击旋转按钮,等待滚轴停下后,自动游戏按钮不会恢复显示!")
                    self.assertEqual(main_menu_expand, "retractL",
                                     "横屏点击旋转按钮,等待滚轴停下后,左侧选项菜单不会折叠!")
                    self.assertEqual(main_menu, True,
                                     "横屏点击旋转按钮,等待滚轴停下后,左侧选项菜单不会恢复可点击状态!")
                    self.assertEqual(banner, coin,
                                     "横屏点击旋转按钮,等待滚轴停下后,下导航栏提示文字错误!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise
        else:
            if coin == 0:
                start_btn_status = self.common.start_btn_status()
                setting_btn = self.common.setting_btn_visible()
                auto_game_btn = self.common.auto_game_btn_visible()
                main_menu_expand = self.common.main_menu_expand()
                main_menu = self.common.main_menu_touchable()
                banner = self.common.info_bar_view_banner_tips_label()
                try:
                    self.assertEqual(start_btn_status, "stopped",
                                     "横屏点击旋转按钮,等待滚轴停下后中了特殊玩法,停止按钮不会恢复成旋转按钮!")
                    self.assertEqual(setting_btn, False,
                                     "横屏点击旋转按钮,等待滚轴停下后中了特殊玩法,线数线注设置按钮会恢复显示!")
                    self.assertEqual(auto_game_btn, False,
                                     "横屏点击旋转按钮,等待滚轴停下后中了特殊玩法,自动游戏按钮会恢复显示!")
                    self.assertEqual(main_menu_expand, "retractL",
                                     "横屏点击旋转按钮,等待滚轴停下后中了特殊玩法,左侧选项菜单不会折叠!")
                    self.assertEqual(main_menu, False,
                                     "横屏点击旋转按钮,等待滚轴停下后中了特殊玩法,左侧选项菜单会恢复可点击状态!")
                    self.assertEqual(banner, "滑动转轴或按旋转",
                                     "横屏点击旋转按钮,等待滚轴停下后中了特殊玩法,下导航栏的提示文字错误!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise
            else:
                start_btn_status = self.common.start_btn_status()
                setting_btn = self.common.setting_btn_visible()
                auto_game_btn = self.common.auto_game_btn_visible()
                main_menu_expand = self.common.main_menu_expand()
                main_menu = self.common.main_menu_touchable()
                banner = self.common.info_bar_view_banner_tips_label()

                locale.setlocale(locale.LC_ALL, "")
                coin = "奖金 ¥" + locale.format("%.2f", coin / 100, 1)
                try:
                    self.assertEqual(start_btn_status, "stopped",
                                     "横屏点击旋转按钮,等待滚轴停下后中了特殊玩法,停止按钮不会恢复成旋转按钮!")
                    self.assertEqual(setting_btn, False,
                                     "横屏点击旋转按钮,等待滚轴停下后中了特殊玩法,线数线注设置按钮会恢复显示!")
                    self.assertEqual(auto_game_btn, False,
                                     "横屏点击旋转按钮,等待滚轴停下后中了特殊玩法,自动游戏按钮会恢复显示!")
                    self.assertEqual(main_menu_expand, "retractL",
                                     "横屏点击旋转按钮,等待滚轴停下后中了特殊玩法,左侧选项菜单不会折叠!")
                    self.assertEqual(main_menu, False,
                                     "横屏点击旋转按钮,等待滚轴停下后中了特殊玩法,左侧选项菜单会恢复可点击状态!")
                    self.assertEqual(banner, coin,
                                     "横屏点击旋转按钮,等待滚轴停下后中了特殊玩法,下导航栏的提示文字错误!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise

    def test_stop_btn_click(self):
        """ 横屏旋转过程点击停止按钮 """
        self.common.loading_pass()
        sleep(1)
        self.common.start_btn_click()
        self.common.wait_for_rolling(15)
        sleep(0.5)
        self.common.start_btn_click()
        sleep(0.5)
        rolling = self.common.slot_machine_rolling()
        try:
            self.assertEqual(rolling, False, "横屏旋转过程,点击停止按钮,滚轴没有立刻停下!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

        self.common.wait_for_rolling_stop(15)
        game_status = self.common.get_game_current_status()

        coin = self.common.total_win()

        if game_status is None:
            if coin == 0:
                start_btn_status = self.common.start_btn_status()
                setting_btn = self.common.setting_btn_visible()
                auto_game_btn = self.common.auto_game_btn_visible()
                main_menu_expand = self.common.main_menu_expand()
                main_menu = self.common.main_menu_touchable()
                banner = self.common.info_bar_view_banner_tips_label()
                try:
                    self.assertEqual(start_btn_status, "stopped",
                                     "横屏旋转过程,点击停止按钮,停止按钮不会恢复成旋转按钮!")
                    self.assertEqual(setting_btn, True,
                                     "横屏旋转过程,点击停止按钮,线数线注设置按钮不会恢复显示!")
                    self.assertEqual(auto_game_btn, True,
                                     "横屏旋转过程,点击停止按钮,自动游戏按钮不会恢复显示!")
                    self.assertEqual(main_menu_expand, "retractL",
                                     "横屏旋转过程,点击停止按钮,左侧选项菜单不会折叠!")
                    self.assertEqual(main_menu, True,
                                     "横屏旋转过程,点击停止按钮,左侧选项菜单不会恢复可点击状态!")
                    self.assertEqual(banner, "滑动转轴或按旋转",
                                     "横屏旋转过程,点击停止按钮,下导航栏的提示文字错误!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise
            else:
                start_btn_status = self.common.start_btn_status()
                setting_btn = self.common.setting_btn_visible()
                auto_game_btn = self.common.auto_game_btn_visible()
                main_menu_expand = self.common.main_menu_expand()
                main_menu = self.common.main_menu_touchable()
                banner = self.common.info_bar_view_banner_tips_label()

                locale.setlocale(locale.LC_ALL, "")
                coin = "奖金 ¥" + locale.format("%.2f", coin / 100, 1)
                try:
                    self.assertEqual(start_btn_status, "stopped",
                                     "横屏旋转过程,点击停止按钮,停止按钮不会恢复成旋转按钮!")
                    self.assertEqual(setting_btn, True,
                                     "横屏旋转过程,点击停止按钮,线数线注设置按钮不会恢复显示!")
                    self.assertEqual(auto_game_btn, True,
                                     "横屏旋转过程,点击停止按钮,自动游戏按钮不会恢复显示!")
                    self.assertEqual(main_menu_expand, "retractL",
                                     "横屏旋转过程,点击停止按钮,左侧选项菜单不会折叠!")
                    self.assertEqual(main_menu, True,
                                     "横屏旋转过程,点击停止按钮,左侧选项菜单不会恢复可点击状态!")
                    self.assertEqual(banner, coin,
                                     "横屏旋转过程,点击停止按钮,下导航栏的提示文字错误!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise
        else:
            if coin == 0:
                start_btn_status = self.common.start_btn_status()
                setting_btn = self.common.setting_btn_visible()
                auto_game_btn = self.common.auto_game_btn_visible()
                main_menu_expand = self.common.main_menu_expand()
                main_menu = self.common.main_menu_touchable()
                banner = self.common.info_bar_view_banner_tips_label()
                try:
                    self.assertEqual(start_btn_status, "stopped",
                                     "横屏旋转过程,点击停止按钮后中了特殊玩法,停止按钮不会恢复成旋转按钮!")
                    self.assertEqual(setting_btn, False,
                                     "横屏旋转过程,点击停止按钮后中了特殊玩法,线数线注设置按钮会恢复显示!")
                    self.assertEqual(auto_game_btn, False,
                                     "横屏旋转过程,点击停止按钮后中了特殊玩法,自动游戏按钮会恢复显示!")
                    self.assertEqual(main_menu_expand, "retractL",
                                     "横屏旋转过程,点击停止按钮后中了特殊玩法,左侧选项菜单不会折叠!")
                    self.assertEqual(main_menu, False,
                                     "横屏旋转过程,点击停止按钮后中了特殊玩法,左侧选项菜单会恢复可点击状态!")
                    self.assertEqual(banner, "滑动转轴或按旋转",
                                     "横屏旋转过程,点击停止按钮后中了特殊玩法,下导航栏的提示文字错误!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise
            else:
                start_btn_status = self.common.start_btn_status()
                setting_btn = self.common.setting_btn_visible()
                auto_game_btn = self.common.auto_game_btn_visible()
                main_menu_expand = self.common.main_menu_expand()
                main_menu = self.common.main_menu_touchable()
                banner = self.common.info_bar_view_banner_tips_label()

                locale.setlocale(locale.LC_ALL, "")
                coin = "奖金 ¥" + locale.format("%.2f", coin / 100, 1)
                try:
                    self.assertEqual(start_btn_status, "stopped",
                                     "横屏旋转过程,点击停止按钮后中了特殊玩法,停止按钮不会恢复成旋转按钮!")
                    self.assertEqual(setting_btn, False,
                                     "横屏旋转过程,点击停止按钮后中了特殊玩法,线数线注设置按钮会恢复显示!")
                    self.assertEqual(auto_game_btn, False,
                                     "横屏旋转过程,点击停止按钮后了特殊玩法,自动游戏按钮会恢复显示!")
                    self.assertEqual(main_menu_expand, "retractL",
                                     "横屏旋转过程,点击停止按钮后了特殊玩法,左侧选项菜单不会折叠!")
                    self.assertEqual(main_menu, False,
                                     "横屏旋转过程,点击停止按钮后中了特殊玩法,左侧选项菜单会恢复可点击状态!")
                    self.assertEqual(banner, coin,
                                     "横屏旋转过程,点击停止按钮后中了特殊玩法,下导航栏的提示文字错误!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise

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

    def test_spin_btn_portrait(self):
        """ 竖屏旋转按钮默认显示 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        visible = self.common.start_btn_visible()
        touchable = self.common.start_btn_touchable()
        status = self.common.start_btn_status()
        rolling = self.common.slot_machine_rolling()
        banner = self.common.info_bar_view_banner_tips_label()
        try:
            self.assertEqual(visible, True, "竖屏进入游戏,旋转按钮默认不会显示!")
            self.assertEqual(touchable, True, "竖屏进入游戏,旋转按钮默认不可点击!")
            self.assertEqual(status, "stopped", "竖屏进入游戏,旋转按钮默认显示停止按钮!")
            self.assertEqual(rolling, False, "竖屏进入游戏,滚轴默认处于滚动状态!")
            self.assertEqual(banner, "滑动转轴或按旋转", "横屏进入游戏,下导航栏默认的提示文字错误!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_start_btn_click_portrait(self):
        """ 竖屏点击旋转按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        self.common.start_btn_click()
        self.common.wait_for_rolling(15)

        slot_rolling = self.common.slot_machine_rolling()
        start_btn_status = self.common.start_btn_status()
        setting_btn = self.common.setting_btn_visible()
        auto_game_btn = self.common.auto_game_btn_visible()
        main_menu_expand = self.common.main_menu_expand()
        main_menu = self.common.main_menu_touchable()
        try:
            self.assertEqual(slot_rolling, True, "竖屏点击旋转按钮,滚轴不会滚动!")
            self.assertEqual(start_btn_status, "playing",
                             "竖屏点击旋转按钮,旋转按钮不会变成停止按钮!")
            self.assertEqual(setting_btn, False, "竖屏点击旋转按钮,线数线注设置按钮不会消失!")
            self.assertEqual(auto_game_btn, False, "竖屏点击旋转按钮,自动游戏按钮不会消失!")
            self.assertEqual(main_menu_expand, "retractP",
                             "竖屏点击旋转按钮,左侧选项菜单不会折叠!")
            self.assertEqual(main_menu, False, "竖屏点击旋转按钮,左侧选项菜单可以点击!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

        self.common.wait_for_rolling_stop(15)
        game_status = self.common.get_game_current_status()

        coin = self.common.total_win()

        if game_status is None:
            if coin == 0:
                start_btn_status = self.common.start_btn_status()
                setting_btn = self.common.setting_btn_visible()
                auto_game_btn = self.common.auto_game_btn_visible()
                main_menu_expand = self.common.main_menu_expand()
                main_menu = self.common.main_menu_touchable()
                banner = self.common.info_bar_view_banner_tips_label()
                try:
                    self.assertEqual(start_btn_status, "stopped",
                                     "竖屏点击旋转按钮,等待滚轴停下后,停止按钮不会恢复成旋转按钮!")
                    self.assertEqual(setting_btn, True,
                                     "竖屏点击旋转按钮,等待滚轴停下后,线数线注设置按钮不会恢复显示!")
                    self.assertEqual(auto_game_btn, True,
                                     "竖屏点击旋转按钮,等待滚轴停下后,自动游戏按钮不会恢复显示!")
                    self.assertEqual(main_menu_expand, "retractP",
                                     "竖屏点击旋转按钮,等待滚轴停下后,左侧选项菜单不会折叠!")
                    self.assertEqual(main_menu, True,
                                     "竖屏点击旋转按钮,等待滚轴停下后,左侧选项菜单不会恢复可点击状态!")
                    self.assertEqual(banner, "滑动转轴或按旋转",
                                     "竖屏点击旋转按钮,等待滚轴停下后,下导航栏的提示文字错误!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise
            else:
                start_btn_status = self.common.start_btn_status()
                setting_btn = self.common.setting_btn_visible()
                auto_game_btn = self.common.auto_game_btn_visible()
                main_menu_expand = self.common.main_menu_expand()
                main_menu = self.common.main_menu_touchable()
                banner = self.common.info_bar_view_banner_tips_label()

                locale.setlocale(locale.LC_ALL, "")
                coin = "奖金 ¥" + locale.format("%.2f", coin / 100, 1)
                try:
                    self.assertEqual(start_btn_status, "stopped",
                                     "竖屏点击旋转按钮,等待滚轴停下后,停止按钮不会恢复成旋转按钮!")
                    self.assertEqual(setting_btn, True,
                                     "竖屏点击旋转按钮,等待滚轴停下后,线数线注设置按钮不会恢复显示!")
                    self.assertEqual(auto_game_btn, True,
                                     "竖屏点击旋转按钮,等待滚轴停下后,自动游戏按钮不会恢复显示!")
                    self.assertEqual(main_menu_expand, "retractP",
                                     "竖屏点击旋转按钮,等待滚轴停下后,左侧选项菜单不会折叠!")
                    self.assertEqual(main_menu, True,
                                     "竖屏点击旋转按钮,等待滚轴停下后,左侧选项菜单不会恢复可点击状态!")
                    self.assertEqual(banner, coin,
                                     "竖屏点击旋转按钮,等待滚轴停下后,下导航栏的提示文字错误!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise
        else:
            if coin == 0:
                start_btn_status = self.common.start_btn_status()
                setting_btn = self.common.setting_btn_visible()
                auto_game_btn = self.common.auto_game_btn_visible()
                main_menu_expand = self.common.main_menu_expand()
                main_menu = self.common.main_menu_touchable()
                banner = self.common.info_bar_view_banner_tips_label()
                try:
                    self.assertEqual(start_btn_status, "stopped",
                                     "竖屏点击旋转按钮,等待滚轴停下后中了特殊玩法,停止按钮不会恢复成旋转按钮!")
                    self.assertEqual(setting_btn, False,
                                     "竖屏点击旋转按钮,等待滚轴停下后中了特殊玩法,线数线注设置按钮会恢复显示!")
                    self.assertEqual(auto_game_btn, False,
                                     "竖屏点击旋转按钮,等待滚轴停下后中了特殊玩法,自动游戏按钮会恢复显示!")
                    self.assertEqual(main_menu_expand, "retractP",
                                     "竖屏点击旋转按钮,等待滚轴停下后中了特殊玩法,左侧选项菜单不会折叠!")
                    self.assertEqual(main_menu, False,
                                     "竖屏点击旋转按钮,等待滚轴停下后中了特殊玩法,左侧选项菜单会恢复可点击状态!")
                    self.assertEqual(banner, "滑动转轴或按旋转",
                                     "竖屏点击旋转按钮,等待滚轴停下后中了特殊玩法,下导航栏的提示文字错误!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise
            else:
                start_btn_status = self.common.start_btn_status()
                setting_btn = self.common.setting_btn_visible()
                auto_game_btn = self.common.auto_game_btn_visible()
                main_menu_expand = self.common.main_menu_expand()
                main_menu = self.common.main_menu_touchable()
                banner = self.common.info_bar_view_banner_tips_label()

                locale.setlocale(locale.LC_ALL, "")
                coin = "奖金 ¥" + locale.format("%.2f", coin / 100, 1)
                try:
                    self.assertEqual(start_btn_status, "stopped",
                                     "竖屏点击旋转按钮,等待滚轴停下后中了特殊玩法,停止按钮不会恢复成旋转按钮!")
                    self.assertEqual(setting_btn, False,
                                     "竖屏点击旋转按钮,等待滚轴停下后中了特殊玩法,线数线注设置按钮会恢复显示!")
                    self.assertEqual(auto_game_btn, False,
                                     "竖屏点击旋转按钮,等待滚轴停下后中了特殊玩法,自动游戏按钮会恢复显示!")
                    self.assertEqual(main_menu_expand, "retractP",
                                     "竖屏点击旋转按钮,等待滚轴停下后中了特殊玩法,左侧选项菜单不会折叠!")
                    self.assertEqual(main_menu, False,
                                     "竖屏点击旋转按钮,等待滚轴停下后中了特殊玩法,左侧选项菜单会恢复可点击状态!")
                    self.assertEqual(banner, coin,
                                     "竖屏点击旋转按钮,等待滚轴停下后中了特殊玩法,下导航栏的提示文字错误!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise

    def test_stop_btn_click_portrait(self):
        """ 竖屏旋转过程点击停止按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        self.common.start_btn_click()
        self.common.wait_for_rolling(15)
        sleep(0.5)
        self.common.start_btn_click()
        sleep(0.5)
        rolling = self.common.slot_machine_rolling()
        try:
            self.assertEqual(rolling, False, "竖屏旋转过程,点击停止按钮,滚轴没有立刻停下!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

        self.common.wait_for_rolling_stop(15)
        game_status = self.common.get_game_current_status()

        coin = self.common.total_win()

        if game_status is None:
            if coin == 0:
                start_btn_status = self.common.start_btn_status()
                setting_btn = self.common.setting_btn_visible()
                auto_game_btn = self.common.auto_game_btn_visible()
                main_menu_expand = self.common.main_menu_expand()
                main_menu = self.common.main_menu_touchable()
                banner = self.common.info_bar_view_banner_tips_label()
                try:
                    self.assertEqual(start_btn_status, "stopped",
                                     "竖屏点击旋转按钮,点击停止按钮,停止按钮不会恢复成旋转按钮!")
                    self.assertEqual(setting_btn, True,
                                     "竖屏点击旋转按钮,点击停止按钮,线数线注设置按钮不会恢复显示!")
                    self.assertEqual(auto_game_btn, True,
                                     "竖屏点击旋转按钮,点击停止按钮,自动游戏按钮不会恢复显示!")
                    self.assertEqual(main_menu_expand, "retractP",
                                     "竖屏点击旋转按钮,点击停止按钮,左侧选项菜单不会折叠!")
                    self.assertEqual(main_menu, True,
                                     "竖屏点击旋转按钮,点击停止按钮,左侧选项菜单不会恢复可点击状态!")
                    self.assertEqual(banner, "滑动转轴或按旋转",
                                     "竖屏点击旋转按钮,点击停止按钮,下导航栏的提示文字错误!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise
            else:
                start_btn_status = self.common.start_btn_status()
                setting_btn = self.common.setting_btn_visible()
                auto_game_btn = self.common.auto_game_btn_visible()
                main_menu_expand = self.common.main_menu_expand()
                main_menu = self.common.main_menu_touchable()
                banner = self.common.info_bar_view_banner_tips_label()

                locale.setlocale(locale.LC_ALL, "")
                coin = "奖金 ¥" + locale.format("%.2f", coin / 100, 1)
                try:
                    self.assertEqual(start_btn_status, "stopped",
                                     "竖屏点击旋转按钮,点击停止按钮,停止按钮不会恢复成旋转按钮!")
                    self.assertEqual(setting_btn, True,
                                     "竖屏点击旋转按钮,点击停止按钮,线数线注设置按钮不会恢复显示!")
                    self.assertEqual(auto_game_btn, True,
                                     "竖屏点击旋转按钮,点击停止按钮,自动游戏按钮不会恢复显示!")
                    self.assertEqual(main_menu_expand, "retractP",
                                     "竖屏点击旋转按钮,点击停止按钮,左侧选项菜单不会折叠!")
                    self.assertEqual(main_menu, True,
                                     "竖屏点击旋转按钮,点击停止按钮,左侧选项菜单不会恢复可点击状态!")
                    self.assertEqual(banner, coin,
                                     "竖屏点击旋转按钮,点击停止按钮,下导航栏的提示文字错误!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise
        else:
            if coin == 0:
                start_btn_status = self.common.start_btn_status()
                setting_btn = self.common.setting_btn_visible()
                auto_game_btn = self.common.auto_game_btn_visible()
                main_menu_expand = self.common.main_menu_expand()
                main_menu = self.common.main_menu_touchable()
                banner = self.common.info_bar_view_banner_tips_label()
                try:
                    self.assertEqual(start_btn_status, "stopped",
                                     "竖屏点击旋转按钮,点击停止按钮后中了特殊玩法,停止按钮不会恢复成旋转按钮!")
                    self.assertEqual(setting_btn, False,
                                     "竖屏点击旋转按钮,点击停止按钮后中了特殊玩法,线数线注设置按钮会恢复显示!")
                    self.assertEqual(auto_game_btn, False,
                                     "竖屏点击旋转按钮,点击停止按钮后中了特殊玩法,自动游戏按钮会恢复显示!")
                    self.assertEqual(main_menu_expand, "retractP",
                                     "竖屏点击旋转按钮,点击停止按钮后中了特殊玩法,左侧选项菜单不会折叠!")
                    self.assertEqual(main_menu, False,
                                     "竖屏点击旋转按钮,点击停止按钮后中了特殊玩法,左侧选项菜单会恢复可点击状态!")
                    self.assertEqual(banner, "滑动转轴或按旋转",
                                     "竖屏点击旋转按钮,点击停止按钮后中了特殊玩法,下导航栏的提示文字错误!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise
            else:
                start_btn_status = self.common.start_btn_status()
                setting_btn = self.common.setting_btn_visible()
                auto_game_btn = self.common.auto_game_btn_visible()
                main_menu_expand = self.common.main_menu_expand()
                main_menu = self.common.main_menu_touchable()
                banner = self.common.info_bar_view_banner_tips_label()

                locale.setlocale(locale.LC_ALL, "")
                coin = "奖金 ¥" + locale.format("%.2f", coin / 100, 1)
                try:
                    self.assertEqual(start_btn_status, "stopped",
                                     "竖屏点击旋转按钮,点击停止按钮后中了特殊玩法,停止按钮不会恢复成旋转按钮!")
                    self.assertEqual(setting_btn, False,
                                     "竖屏点击旋转按钮,点击停止按钮后中了特殊玩法,线数线注设置按钮会恢复显示!")
                    self.assertEqual(auto_game_btn, False,
                                     "竖屏点击旋转按钮,点击停止按钮后中了特殊玩法,自动游戏按钮会恢复显示!")
                    self.assertEqual(main_menu_expand, "retractP",
                                     "竖屏点击旋转按钮,点击停止按钮后中了特殊玩法,左侧选项菜单不会折叠!")
                    self.assertEqual(main_menu, False,
                                     "竖屏点击旋转按钮,点击停止按钮后中了特殊玩法,左侧选项菜单会恢复可点击状态!")
                    self.assertEqual(banner, coin,
                                     "竖屏点击旋转按钮,点击停止按钮后中了特殊玩法,下导航栏的提示文字错误!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise

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

    def test_start_btn_click_switch_screen(self):
        """ 横竖屏点击旋转按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        self.common.start_btn_click()
        sleep(0.5)
        self.common.landscape()
        sleep(0.5)
        self.common.wait_for_rolling(15)

        slot_rolling = self.common.slot_machine_rolling()
        start_btn_status = self.common.start_btn_status()
        setting_btn = self.common.setting_btn_visible()
        auto_game_btn = self.common.auto_game_btn_visible()
        main_menu_expand = self.common.main_menu_expand()
        main_menu = self.common.main_menu_touchable()
        try:
            self.assertEqual(slot_rolling, True, "横屏点击旋转按钮,滚轴不会滚动!")
            self.assertEqual(start_btn_status, "playing",
                             "横屏点击旋转按钮,旋转按钮不会变成停止按钮!")
            self.assertEqual(setting_btn, False, "横屏点击旋转按钮,线数线注设置按钮不会消失!")
            self.assertEqual(auto_game_btn, False, "横屏点击旋转按钮,自动游戏按钮不会消失!")
            self.assertEqual(main_menu_expand, "retractL",
                             "横屏点击旋转按钮,左侧选项菜单不会折叠!")
            self.assertEqual(main_menu, False, "横屏点击旋转按钮,左侧选项菜单可以点击!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

        self.common.wait_for_rolling_stop(15)
        self.common.portrait()
        sleep(0.5)

        game_status = self.common.get_game_current_status()
        coin = self.common.total_win()

        if game_status is None:
            if coin == 0:
                start_btn_status = self.common.start_btn_status()
                setting_btn = self.common.setting_btn_visible()
                auto_game_btn = self.common.auto_game_btn_visible()
                main_menu_expand = self.common.main_menu_expand()
                main_menu = self.common.main_menu_touchable()
                banner = self.common.info_bar_view_banner_tips_label()
                try:
                    self.assertEqual(start_btn_status, "stopped",
                                     "点击旋转按钮,切换横竖屏,等待滚轴停下后,停止按钮不会恢复成旋转按钮!")
                    self.assertEqual(setting_btn, True,
                                     "点击旋转按钮,切换横竖屏,等待滚轴停下后,线数线注设置按钮不会恢复显示!")
                    self.assertEqual(auto_game_btn, True,
                                     "点击旋转按钮,切换横竖屏,等待滚轴停下后,自动游戏按钮不会恢复显示!")
                    self.assertEqual(main_menu_expand, "retractP",
                                     "点击旋转按钮,切换横竖屏,等待滚轴停下后,左侧选项菜单不会折叠!")
                    self.assertEqual(main_menu, True,
                                     "点击旋转按钮,切换横竖屏,等待滚轴停下后,左侧选项菜单不会恢复可点击状态!")
                    self.assertEqual(banner, "滑动转轴或按旋转",
                                     "点击旋转按钮,切换横竖屏,等待滚轴停下后,下导航栏的提示文字错误!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise
            else:
                start_btn_status = self.common.start_btn_status()
                setting_btn = self.common.setting_btn_visible()
                auto_game_btn = self.common.auto_game_btn_visible()
                main_menu_expand = self.common.main_menu_expand()
                main_menu = self.common.main_menu_touchable()
                banner = self.common.info_bar_view_banner_tips_label()

                locale.setlocale(locale.LC_ALL, "")
                coin = "奖金 ¥" + locale.format("%.2f", coin / 100, 1)
                try:
                    self.assertEqual(start_btn_status, "stopped",
                                     "点击旋转按钮,切换横竖屏,等待滚轴停下后,停止按钮不会恢复成旋转按钮!")
                    self.assertEqual(setting_btn, True,
                                     "点击旋转按钮,切换横竖屏,等待滚轴停下后,线数线注设置按钮不会恢复显示!")
                    self.assertEqual(auto_game_btn, True,
                                     "点击旋转按钮,切换横竖屏,等待滚轴停下后,自动游戏按钮不会恢复显示!")
                    self.assertEqual(main_menu_expand, "retractP",
                                     "点击旋转按钮,切换横竖屏,等待滚轴停下后,左侧选项菜单不会折叠!")
                    self.assertEqual(main_menu, True,
                                     "点击旋转按钮,切换横竖屏,等待滚轴停下后,左侧选项菜单不会恢复可点击状态!")
                    self.assertEqual(banner, coin,
                                     "点击旋转按钮,切换横竖屏,等待滚轴停下后,下导航栏的提示文字错误!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise
        else:
            if coin == 0:
                start_btn_status = self.common.start_btn_status()
                setting_btn = self.common.setting_btn_visible()
                auto_game_btn = self.common.auto_game_btn_visible()
                main_menu_expand = self.common.main_menu_expand()
                main_menu = self.common.main_menu_touchable()
                banner = self.common.info_bar_view_banner_tips_label()
                try:
                    self.assertEqual(
                        start_btn_status, "stopped",
                        "点击旋转按钮,切换横竖屏,等待滚轴停下后中了特殊玩法,停止按钮不会恢复成旋转按钮!")
                    self.assertEqual(
                        setting_btn, False,
                        "点击旋转按钮,切换横竖屏,等待滚轴停下后中了特殊玩法,线数线注设置按钮会恢复显示!")
                    self.assertEqual(
                        auto_game_btn, False,
                        "点击旋转按钮,切换横竖屏,等待滚轴停下后中了特殊玩法,自动游戏按钮会恢复显示!")
                    self.assertEqual(main_menu_expand, "retractP",
                                     "点击旋转按钮,切换横竖屏,等待滚轴停下后中了特殊玩法,左侧选项菜单不会折叠!")
                    self.assertEqual(
                        main_menu, False,
                        "点击旋转按钮,切换横竖屏,等待滚轴停下后中了特殊玩法,左侧选项菜单会恢复可点击状态!")
                    self.assertEqual(
                        banner, "滑动转轴或按旋转",
                        "点击旋转按钮,切换横竖屏,等待滚轴停下后中了特殊玩法,下导航栏的提示文字错误!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise
            else:
                start_btn_status = self.common.start_btn_status()
                setting_btn = self.common.setting_btn_visible()
                auto_game_btn = self.common.auto_game_btn_visible()
                main_menu_expand = self.common.main_menu_expand()
                main_menu = self.common.main_menu_touchable()
                banner = self.common.info_bar_view_banner_tips_label()

                locale.setlocale(locale.LC_ALL, "")
                coin = "奖金 ¥" + locale.format("%.2f", coin / 100, 1)
                try:
                    self.assertEqual(
                        start_btn_status, "stopped",
                        "点击旋转按钮,切换横竖屏,等待滚轴停下后中了特殊玩法,停止按钮不会恢复成旋转按钮!")
                    self.assertEqual(
                        setting_btn, False,
                        "点击旋转按钮,切换横竖屏,等待滚轴停下后中了特殊玩法,线数线注设置按钮会恢复显示!")
                    self.assertEqual(
                        auto_game_btn, False,
                        "点击旋转按钮,切换横竖屏,等待滚轴停下后中了特殊玩法,自动游戏按钮会恢复显示!")
                    self.assertEqual(main_menu_expand, "retractP",
                                     "点击旋转按钮,切换横竖屏,等待滚轴停下后中了特殊玩法,左侧选项菜单不会折叠!")
                    self.assertEqual(
                        main_menu, False,
                        "点击旋转按钮,切换横竖屏,等待滚轴停下后中了特殊玩法,左侧选项菜单会恢复可点击状态!")
                    self.assertEqual(
                        banner, coin,
                        "点击旋转按钮,切换横竖屏,等待滚轴停下后中了特殊玩法,下导航栏的提示文字错误!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise

    def test_stop_btn_click_switch_screen(self):
        """ 横竖屏旋转过程点击停止按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(1)
        self.common.start_btn_click()
        self.common.wait_for_rolling(15)
        sleep(0.5)
        self.common.landscape()
        sleep(0.5)
        self.common.start_btn_click()
        sleep(0.5)
        self.common.portrait()
        sleep(0.5)
        rolling = self.common.slot_machine_rolling()
        try:
            self.assertEqual(rolling, False, "旋转过程,点击停止按钮,横竖屏切换,滚轴没有立刻停下!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

        self.common.wait_for_rolling_stop(15)
        game_status = self.common.get_game_current_status()

        coin = self.common.total_win()

        if game_status is None:
            if coin == 0:
                start_btn_status = self.common.start_btn_status()
                setting_btn = self.common.setting_btn_visible()
                auto_game_btn = self.common.auto_game_btn_visible()
                main_menu_expand = self.common.main_menu_expand()
                main_menu = self.common.main_menu_touchable()
                banner = self.common.info_bar_view_banner_tips_label()
                try:
                    self.assertEqual(start_btn_status, "stopped",
                                     "旋转过程,点击停止按钮,横竖屏切换,停止按钮不会恢复成旋转按钮!")
                    self.assertEqual(setting_btn, True,
                                     "旋转过程,点击停止按钮,横竖屏切换,线数线注设置按钮不会恢复显示!")
                    self.assertEqual(auto_game_btn, True,
                                     "旋转过程,点击停止按钮,横竖屏切换,自动游戏按钮不会恢复显示!")
                    self.assertEqual(main_menu_expand, "retractP",
                                     "旋转过程,点击停止按钮,横竖屏切换,左侧选项菜单不会折叠!")
                    self.assertEqual(main_menu, True,
                                     "旋转过程,点击停止按钮,横竖屏切换,左侧选项菜单不会恢复可点击状态!")
                    self.assertEqual(banner, "滑动转轴或按旋转",
                                     "旋转过程,点击停止按钮,横竖屏切换,下导航栏默认的提示文字错误!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise
            else:
                start_btn_status = self.common.start_btn_status()
                setting_btn = self.common.setting_btn_visible()
                auto_game_btn = self.common.auto_game_btn_visible()
                main_menu_expand = self.common.main_menu_expand()
                main_menu = self.common.main_menu_touchable()
                banner = self.common.info_bar_view_banner_tips_label()

                locale.setlocale(locale.LC_ALL, "")
                coin = "奖金 ¥" + locale.format("%.2f", coin / 100, 1)
                try:
                    self.assertEqual(start_btn_status, "stopped",
                                     "旋转过程,点击停止按钮,横竖屏切换,停止按钮不会恢复成旋转按钮!")
                    self.assertEqual(setting_btn, True,
                                     "旋转过程,点击停止按钮,横竖屏切换,线数线注设置按钮不会恢复显示!")
                    self.assertEqual(auto_game_btn, True,
                                     "旋转过程,点击停止按钮,横竖屏切换,自动游戏按钮不会恢复显示!")
                    self.assertEqual(main_menu_expand, "retractP",
                                     "旋转过程,点击停止按钮,横竖屏切换,左侧选项菜单不会折叠!")
                    self.assertEqual(main_menu, True,
                                     "旋转过程,点击停止按钮,横竖屏切换,左侧选项菜单不会恢复可点击状态!")
                    self.assertEqual(banner, coin,
                                     "旋转过程,点击停止按钮,横竖屏切换,下导航栏提示文字错误!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise
        else:
            if coin == 0:
                start_btn_status = self.common.start_btn_status()
                setting_btn = self.common.setting_btn_visible()
                auto_game_btn = self.common.auto_game_btn_visible()
                main_menu_expand = self.common.main_menu_expand()
                main_menu = self.common.main_menu_touchable()
                banner = self.common.info_bar_view_banner_tips_label()
                try:
                    self.assertEqual(
                        start_btn_status, "stopped",
                        "旋转过程,点击停止按钮后中了特殊玩法,横竖屏切换,停止按钮不会恢复成旋转按钮!")
                    self.assertEqual(
                        setting_btn, False,
                        "旋转过程,点击停止按钮后中了特殊玩法,横竖屏切换,线数线注设置按钮会恢复显示!")
                    self.assertEqual(auto_game_btn, False,
                                     "旋转过程,点击停止按钮后中了特殊玩法,横竖屏切换,自动游戏按钮会恢复显示!")
                    self.assertEqual(main_menu_expand, "retractP",
                                     "旋转过程,点击停止按钮后中了特殊玩法,横竖屏切换,左侧选项菜单不会折叠!")
                    self.assertEqual(
                        main_menu, False,
                        "旋转过程,点击停止按钮,横竖屏切换后中了特殊玩法,左侧选项菜单会恢复可点击状态!")
                    self.assertEqual(
                        banner, "滑动转轴或按旋转",
                        "旋转过程,点击停止按钮后中了特殊玩法,横竖屏切换,下导航栏默认的提示文字错误!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise
            else:
                start_btn_status = self.common.start_btn_status()
                setting_btn = self.common.setting_btn_visible()
                auto_game_btn = self.common.auto_game_btn_visible()
                main_menu_expand = self.common.main_menu_expand()
                main_menu = self.common.main_menu_touchable()
                banner = self.common.info_bar_view_banner_tips_label()

                locale.setlocale(locale.LC_ALL, "")
                coin = "奖金 ¥" + locale.format("%.2f", coin / 100, 1)
                try:
                    self.assertEqual(
                        start_btn_status, "stopped",
                        "旋转过程,点击停止按钮后中了特殊玩法,横竖屏切换,停止按钮不会恢复成旋转按钮!")
                    self.assertEqual(
                        setting_btn, False,
                        "旋转过程,点击停止按钮后中了特殊玩法,横竖屏切换,线数线注设置按钮会恢复显示!")
                    self.assertEqual(auto_game_btn, False,
                                     "旋转过程,点击停止按钮后中了特殊玩法,横竖屏切换,自动游戏按钮会恢复显示!")
                    self.assertEqual(main_menu_expand, "retractP",
                                     "旋转过程,点击停止按钮后中了特殊玩法,横竖屏切换,左侧选项菜单不会折叠!")
                    self.assertEqual(
                        main_menu, False,
                        "旋转过程,点击停止按钮后中了特殊玩法,横竖屏切换,左侧选项菜单会恢复可点击状态!")
                    self.assertEqual(banner, coin,
                                     "旋转过程,点击停止按钮后中了特殊玩法,横竖屏切换,下导航栏提示文字错误!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise