예제 #1
0
class TestClass(unittest.TestCase):
    """ UI自动化测试 """

    def setUp(self):
        self.browser = webdriver.Chrome(executable_path="../../lib/chromedriver.exe")
        self.browser.get("https://www.baidu.com")
        self.daf = DirAndFiles()

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

    def test1_find_input(self):
        """ UI自动化测试1 """
        try:
            # 正确值为 //input[@id='kw']
            self.browser.find_element_by_xpath("//input[@id='kw1']")
        except Exception:
            self.daf.get_screenshot(self.browser)
            raise

    def test2_assert_equal(self):
        """ UI自动化测试2 """
        a = 1
        b = 2
        try:
            self.assertEqual(a, b, "a ≠ b!")
        except AssertionError:
            raise

    def test3_title(self):
        """ UI自动化测试3 """
        title = self.browser.title
        try:
            # 加了个感叹号 !
            self.assertEqual(title, "百度一下,你就知道!", "Title不一致!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise
예제 #2
0
class TestInfoBar(unittest.TestCase):
    """ 下导航栏模块 """
    def setUp(self):
        self.browser = webdriver.Chrome(
            executable_path="../../lib/chromedriver.exe")
        self.common = Common(self.browser)
        self.common.start()
        self.daf = DirAndFiles()

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

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

    def test_info_bar_default(self):
        """ 横屏下导航栏内容 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        locale.setlocale(locale.LC_ALL, "")

        # 目标线数
        target_line_num = self.common.line_num_max

        # 目标线注
        line_cost = self.common.line_cost[0] / 100
        target_line_cost = "¥" + locale.format("%.2f", line_cost, 1)

        # 目标总赌注
        bet = self.common.line_num_max * line_cost
        target_bet_money = "¥" + locale.format("%.2f", bet, 1)

        banner_tips = self.common.info_bar_view_banner_tips_label()
        has_money_title = self.common.info_bar_view_has_money_title()
        has_money = self.common.info_bar_view_has_money_label()
        line_num_title = self.common.info_bar_view_line_num_title()
        line_num = self.common.info_bar_view_line_num_label()
        line_cost_title = self.common.info_bar_view_line_cost_title()
        line_cost = self.common.info_bar_view_line_cost_label()
        bet_money_title = self.common.info_bar_view_bet_money_title()
        bet_money = self.common.info_bar_view_bet_money_label()

        try:
            self.assertEqual(banner_tips, "滑动转轴或按旋转", "横屏下导航栏默认提示文字错误!")
            self.assertEqual(has_money_title, "试玩余额", "横屏试玩下导航栏余额标题文字错误!")
            self.assertEqual(has_money, "¥2,000.00", "横屏试玩下导航栏余额数值错误!")
            self.assertEqual(line_num_title, "线", "横屏试玩下导航栏线数标题文字错误!")
            self.assertEqual(line_num, str(target_line_num),
                             "横屏试玩下导航栏默认线数数值错误!")
            self.assertEqual(line_cost_title, "线注", "横屏试玩下导航栏线注标题错误!")
            self.assertEqual(line_cost, target_line_cost, "横屏试玩下导航栏线注数值错误!")
            self.assertEqual(bet_money_title, "总赌注", "横屏试玩下导航栏总赌注标题文字错误!")
            self.assertEqual(bet_money, target_bet_money, "横屏试玩下导航栏总赌注数值错误!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_line_num_effect_bet_money(self):
        """ 横屏点击线数按钮后计算总赌注 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.setting_btn_click()
        sleep(1)
        locale.setlocale(locale.LC_ALL, "")

        # 点击线数 - 按钮
        for i in range(3):
            target_line_cost = self.common.setting_view_line_cost()

            self.common.setting_view_line_num_min_btn_click()
            sleep(1)

            info_bar_line_num = self.common.info_bar_view_line_num_label()
            info_bar_line_cost = self.common.info_bar_view_line_cost_label()
            info_bar_bet_money = self.common.info_bar_view_bet_money_label()

            bet_money = eval(info_bar_line_num) * eval(info_bar_line_cost[1:])
            target_bet_money = "¥" + locale.format("%.2f", bet_money, 1)
            target_line_num = self.common.setting_view_line_num()

            try:
                self.assertEqual(info_bar_line_cost, target_line_cost,
                                 "横屏点击线数 - 按钮,线注会改变!")
                self.assertEqual(info_bar_line_num, target_line_num,
                                 "横屏点击线数 - 按钮,设置窗口的线数与下导航栏的不一致!")
                self.assertEqual(info_bar_bet_money, target_bet_money,
                                 "横屏点击线数 - 按钮,总赌注数值错误!")
            except AssertionError:
                self.daf.get_screenshot(self.browser)
                raise

        sleep(1)

        # 点击线数 + 按钮
        for i in range(3):
            target_line_cost = self.common.setting_view_line_cost()

            self.common.setting_view_line_num_plus_btn_click()
            sleep(1)

            info_bar_line_num = self.common.info_bar_view_line_num_label()
            info_bar_line_cost = self.common.info_bar_view_line_cost_label()
            info_bar_bet_money = self.common.info_bar_view_bet_money_label()

            bet_money = eval(info_bar_line_num) * eval(info_bar_line_cost[1:])
            target_bet_money = "¥" + locale.format("%.2f", bet_money, 1)
            target_line_num = self.common.setting_view_line_num()

            try:
                self.assertEqual(info_bar_line_cost, target_line_cost,
                                 "横屏点击线数 + 按钮,线注会改变!")
                self.assertEqual(info_bar_line_num, target_line_num,
                                 "横屏点击线数 + 按钮,设置窗口的线数与下导航栏的不一致!")
                self.assertEqual(info_bar_bet_money, target_bet_money,
                                 "横屏点击线数 + 按钮,总赌注数值错误!")
            except AssertionError:
                self.daf.get_screenshot(self.browser)
                raise

    def test_line_cost_effect_bet_money(self):
        """ 横屏点击线注按钮后计算总赌注 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.setting_btn_click()
        sleep(1)
        locale.setlocale(locale.LC_ALL, "")

        # 点击线注 + 按钮
        for i in range(3):
            target_line_num = self.common.setting_view_line_num()

            self.common.setting_view_line_cost_plus_btn_click()
            sleep(1)

            info_bar_line_num = self.common.info_bar_view_line_num_label()
            info_bar_line_cost = self.common.info_bar_view_line_cost_label()
            info_bar_bet_money = self.common.info_bar_view_bet_money_label()

            bet_money = eval(info_bar_line_num) * eval(info_bar_line_cost[1:])
            target_bet_money = "¥" + locale.format("%.2f", bet_money, 1)
            target_line_cost = self.common.setting_view_line_cost()

            try:
                self.assertEqual(info_bar_line_num, target_line_num,
                                 "横屏点击线注 + 按钮,线数会改变!")
                self.assertEqual(info_bar_line_cost, target_line_cost,
                                 "横屏点击线注 + 按钮,设置窗口的线注与下导航栏的不一致!")
                self.assertEqual(info_bar_bet_money, target_bet_money,
                                 "横屏点击线注 + 按钮,总赌注数值错误!")
            except AssertionError:
                self.daf.get_screenshot(self.browser)
                raise

        sleep(1)

        # 点击线注 - 按钮
        for i in range(3):
            target_line_num = self.common.setting_view_line_num()

            self.common.setting_view_line_cost_min_btn_click()
            sleep(1)

            info_bar_line_num = self.common.info_bar_view_line_num_label()
            info_bar_line_cost = self.common.info_bar_view_line_cost_label()
            info_bar_bet_money = self.common.info_bar_view_bet_money_label()

            bet_money = eval(info_bar_line_num) * eval(info_bar_line_cost[1:])
            target_bet_money = "¥" + locale.format("%.2f", bet_money, 1)
            target_line_cost = self.common.setting_view_line_cost()

            try:
                self.assertEqual(info_bar_line_num, target_line_num,
                                 "横屏点击线注 - 按钮,线数会改变!")
                self.assertEqual(info_bar_line_cost, target_line_cost,
                                 "横屏点击线注 - 按钮,设置窗口的线注与下导航栏的不一致!")
                self.assertEqual(info_bar_bet_money, target_bet_money,
                                 "横屏点击线注 - 按钮,总赌注数值错误!")
            except AssertionError:
                self.daf.get_screenshot(self.browser)
                raise

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

    def test_info_bar_default_portrait(self):
        """ 竖屏下导航栏内容 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        locale.setlocale(locale.LC_ALL, "")

        # 目标线数
        target_line_num = self.common.line_num_max

        # 目标线注
        line_cost = self.common.line_cost[0] / 100
        target_line_cost = "¥" + locale.format("%.2f", line_cost, 1)

        # 目标总赌注
        bet = self.common.line_num_max * line_cost
        target_bet_money = "¥" + locale.format("%.2f", bet, 1)

        banner_tips = self.common.info_bar_view_banner_tips_label()
        has_money_title = self.common.info_bar_view_has_money_title()
        has_money = self.common.info_bar_view_has_money_label()
        line_num_title = self.common.info_bar_view_line_num_title()
        line_num = self.common.info_bar_view_line_num_label()
        line_cost_title = self.common.info_bar_view_line_cost_title()
        line_cost = self.common.info_bar_view_line_cost_label()
        bet_money_title = self.common.info_bar_view_bet_money_title()
        bet_money = self.common.info_bar_view_bet_money_label()

        try:
            self.assertEqual(banner_tips, "滑动转轴或按旋转", "竖屏下导航栏默认提示文字错误!")
            self.assertEqual(has_money_title, "试玩余额", "竖屏试玩下导航栏余额标题文字错误!")
            self.assertEqual(has_money, "¥2,000.00", "竖屏试玩下导航栏余额数值错误!")
            self.assertEqual(line_num_title, "线", "竖屏试玩下导航栏线数标题文字错误!")
            self.assertEqual(line_num, str(target_line_num),
                             "竖屏试玩下导航栏默认线数数值错误!")
            self.assertEqual(line_cost_title, "线注", "竖屏试玩下导航栏线注标题错误!")
            self.assertEqual(line_cost, target_line_cost, "竖屏试玩下导航栏线注数值错误!")
            self.assertEqual(bet_money_title, "总赌注", "竖屏试玩下导航栏总赌注标题文字错误!")
            self.assertEqual(bet_money, target_bet_money, "竖屏试玩下导航栏总赌注数值错误!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_line_num_effect_bet_money_portrait(self):
        """ 竖屏点击线数按钮后计算总赌注 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.setting_btn_click()
        sleep(1)
        locale.setlocale(locale.LC_ALL, "")

        # 点击线数 - 按钮
        for i in range(3):
            target_line_cost = self.common.setting_view_line_cost()

            self.common.setting_view_line_num_min_btn_click()
            sleep(1)

            info_bar_line_num = self.common.info_bar_view_line_num_label()
            info_bar_line_cost = self.common.info_bar_view_line_cost_label()
            info_bar_bet_money = self.common.info_bar_view_bet_money_label()

            bet_money = eval(info_bar_line_num) * eval(info_bar_line_cost[1:])
            target_bet_money = "¥" + locale.format("%.2f", bet_money, 1)
            target_line_num = self.common.setting_view_line_num()

            try:
                self.assertEqual(info_bar_line_cost, target_line_cost,
                                 "竖屏点击线数 - 按钮,线注会改变!")
                self.assertEqual(info_bar_line_num, target_line_num,
                                 "竖屏点击线数 - 按钮,设置窗口的线数与下导航栏的不一致!")
                self.assertEqual(info_bar_bet_money, target_bet_money,
                                 "竖屏点击线数 - 按钮,总赌注数值错误!")
            except AssertionError:
                self.daf.get_screenshot(self.browser)
                raise

        sleep(1)

        # 点击线数 + 按钮
        for i in range(3):
            target_line_cost = self.common.setting_view_line_cost()

            self.common.setting_view_line_num_plus_btn_click()
            sleep(1)

            info_bar_line_num = self.common.info_bar_view_line_num_label()
            info_bar_line_cost = self.common.info_bar_view_line_cost_label()
            info_bar_bet_money = self.common.info_bar_view_bet_money_label()

            bet_money = eval(info_bar_line_num) * eval(info_bar_line_cost[1:])
            target_bet_money = "¥" + locale.format("%.2f", bet_money, 1)
            target_line_num = self.common.setting_view_line_num()

            try:
                self.assertEqual(info_bar_line_cost, target_line_cost,
                                 "竖屏点击线数 + 按钮,线注会改变!")
                self.assertEqual(info_bar_line_num, target_line_num,
                                 "竖屏点击线数 + 按钮,设置窗口的线数与下导航栏的不一致!")
                self.assertEqual(info_bar_bet_money, target_bet_money,
                                 "竖屏点击线数 + 按钮,总赌注数值错误!")
            except AssertionError:
                self.daf.get_screenshot(self.browser)
                raise

    def test_line_cost_effect_bet_money_portrait(self):
        """ 竖屏点击线注按钮后计算总赌注 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.setting_btn_click()
        sleep(1)
        locale.setlocale(locale.LC_ALL, "")

        # 点击线注 + 按钮
        for i in range(3):
            target_line_num = self.common.setting_view_line_num()

            self.common.setting_view_line_cost_plus_btn_click()
            sleep(1)

            info_bar_line_num = self.common.info_bar_view_line_num_label()
            info_bar_line_cost = self.common.info_bar_view_line_cost_label()
            info_bar_bet_money = self.common.info_bar_view_bet_money_label()

            bet_money = eval(info_bar_line_num) * eval(info_bar_line_cost[1:])
            target_bet_money = "¥" + locale.format("%.2f", bet_money, 1)
            target_line_cost = self.common.setting_view_line_cost()

            try:
                self.assertEqual(info_bar_line_num, target_line_num,
                                 "竖屏点击线注 + 按钮,线数会改变!")
                self.assertEqual(info_bar_line_cost, target_line_cost,
                                 "竖屏点击线注 + 按钮,设置窗口的线注与下导航栏的不一致!")
                self.assertEqual(info_bar_bet_money, target_bet_money,
                                 "竖屏点击线注 + 按钮,总赌注数值错误!")
            except AssertionError:
                self.daf.get_screenshot(self.browser)
                raise

        sleep(1)

        # 点击线注 - 按钮
        for i in range(3):
            target_line_num = self.common.setting_view_line_num()

            self.common.setting_view_line_cost_min_btn_click()
            sleep(1)

            info_bar_line_num = self.common.info_bar_view_line_num_label()
            info_bar_line_cost = self.common.info_bar_view_line_cost_label()
            info_bar_bet_money = self.common.info_bar_view_bet_money_label()

            bet_money = eval(info_bar_line_num) * eval(info_bar_line_cost[1:])
            target_bet_money = "¥" + locale.format("%.2f", bet_money, 1)
            target_line_cost = self.common.setting_view_line_cost()

            try:
                self.assertEqual(info_bar_line_num, target_line_num,
                                 "竖屏点击线注 - 按钮,线数会改变!")
                self.assertEqual(info_bar_line_cost, target_line_cost,
                                 "竖屏点击线注 - 按钮,设置窗口的线注与下导航栏的不一致!")
                self.assertEqual(info_bar_bet_money, target_bet_money,
                                 "竖屏点击线注 - 按钮,总赌注数值错误!")
            except AssertionError:
                self.daf.get_screenshot(self.browser)
                raise

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

    def test_info_bar_default_switch_screen(self):
        """ 横竖屏下导航栏内容 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.landscape()
        sleep(1)
        self.common.portrait()
        sleep(1)
        locale.setlocale(locale.LC_ALL, "")

        # 目标线数
        target_line_num = self.common.line_num_max

        # 目标线注
        line_cost = self.common.line_cost[0] / 100
        target_line_cost = "¥" + locale.format("%.2f", line_cost, 1)

        # 目标总赌注
        bet = self.common.line_num_max * line_cost
        target_bet_money = "¥" + locale.format("%.2f", bet, 1)

        banner_tips = self.common.info_bar_view_banner_tips_label()
        has_money_title = self.common.info_bar_view_has_money_title()
        has_money = self.common.info_bar_view_has_money_label()
        line_num_title = self.common.info_bar_view_line_num_title()
        line_num = self.common.info_bar_view_line_num_label()
        line_cost_title = self.common.info_bar_view_line_cost_title()
        line_cost = self.common.info_bar_view_line_cost_label()
        bet_money_title = self.common.info_bar_view_bet_money_title()
        bet_money = self.common.info_bar_view_bet_money_label()

        try:
            self.assertEqual(banner_tips, "滑动转轴或按旋转", "横竖屏切换,下导航栏默认提示文字错误!")
            self.assertEqual(has_money_title, "试玩余额", "横竖屏切换,试玩下导航栏余额标题文字错误!")
            self.assertEqual(has_money, "¥2,000.00", "横竖屏切换,试玩下导航栏余额数值错误!")
            self.assertEqual(line_num_title, "线", "横竖屏切换,试玩下导航栏线数标题文字错误!")
            self.assertEqual(line_num, str(target_line_num),
                             "横竖屏切换,试玩下导航栏默认线数数值错误!")
            self.assertEqual(line_cost_title, "线注", "横竖屏切换,试玩下导航栏线注标题错误!")
            self.assertEqual(line_cost, target_line_cost,
                             "横竖屏切换,试玩下导航栏线注数值错误!")
            self.assertEqual(bet_money_title, "总赌注", "横竖屏切换,试玩下导航栏总赌注标题文字错误!")
            self.assertEqual(bet_money, target_bet_money,
                             "横竖屏切换,试玩下导航栏总赌注数值错误!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_line_num_effect_bet_money_switch_screen(self):
        """ 横竖屏点击线数按钮后计算总赌注 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.setting_btn_click()
        sleep(1)
        locale.setlocale(locale.LC_ALL, "")

        # 点击线数 - 按钮
        for i in range(3):
            if i % 2 == 0:
                self.common.landscape()
            else:
                self.common.portrait()
            target_line_cost = self.common.setting_view_line_cost()

            self.common.setting_view_line_num_min_btn_click()
            sleep(1)

            info_bar_line_num = self.common.info_bar_view_line_num_label()
            info_bar_line_cost = self.common.info_bar_view_line_cost_label()
            info_bar_bet_money = self.common.info_bar_view_bet_money_label()

            bet_money = eval(info_bar_line_num) * eval(info_bar_line_cost[1:])
            target_bet_money = "¥" + locale.format("%.2f", bet_money, 1)
            target_line_num = self.common.setting_view_line_num()

            try:
                self.assertEqual(info_bar_line_cost, target_line_cost,
                                 "横竖屏切换,点击线数 - 按钮,线注会改变!")
                self.assertEqual(info_bar_line_num, target_line_num,
                                 "横竖屏切换,点击线数 - 按钮,设置窗口的线数与下导航栏的不一致!")
                self.assertEqual(info_bar_bet_money, target_bet_money,
                                 "横竖屏切换,点击线数 - 按钮,总赌注数值错误!")
            except AssertionError:
                self.daf.get_screenshot(self.browser)
                raise

        sleep(1)

        # 点击线数 + 按钮
        for i in range(3):
            if i % 2 == 0:
                self.common.portrait()
            else:
                self.common.landscape()
            target_line_cost = self.common.setting_view_line_cost()

            self.common.setting_view_line_num_plus_btn_click()
            sleep(1)

            info_bar_line_num = self.common.info_bar_view_line_num_label()
            info_bar_line_cost = self.common.info_bar_view_line_cost_label()
            info_bar_bet_money = self.common.info_bar_view_bet_money_label()

            bet_money = eval(info_bar_line_num) * eval(info_bar_line_cost[1:])
            target_bet_money = "¥" + locale.format("%.2f", bet_money, 1)
            target_line_num = self.common.setting_view_line_num()

            try:
                self.assertEqual(info_bar_line_cost, target_line_cost,
                                 "横竖屏切换,点击线数 + 按钮,线注会改变!")
                self.assertEqual(info_bar_line_num, target_line_num,
                                 "横竖屏切换,点击线数 + 按钮,设置窗口的线数与下导航栏的不一致!")
                self.assertEqual(info_bar_bet_money, target_bet_money,
                                 "横竖屏切换,点击线数 + 按钮,总赌注数值错误!")
            except AssertionError:
                self.daf.get_screenshot(self.browser)
                raise

    def test_line_cost_effect_bet_money_switch_screen(self):
        """ 横竖屏点击线注按钮后计算总赌注 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.setting_btn_click()
        sleep(1)
        locale.setlocale(locale.LC_ALL, "")

        # 点击线注 + 按钮
        for i in range(3):
            if i % 2 == 0:
                self.common.landscape()
            else:
                self.common.portrait()
            target_line_num = self.common.setting_view_line_num()

            self.common.setting_view_line_cost_plus_btn_click()
            sleep(1)

            info_bar_line_num = self.common.info_bar_view_line_num_label()
            info_bar_line_cost = self.common.info_bar_view_line_cost_label()
            info_bar_bet_money = self.common.info_bar_view_bet_money_label()

            bet_money = eval(info_bar_line_num) * eval(info_bar_line_cost[1:])
            target_bet_money = "¥" + locale.format("%.2f", bet_money, 1)
            target_line_cost = self.common.setting_view_line_cost()

            try:
                self.assertEqual(info_bar_line_num, target_line_num,
                                 "横竖屏切换,点击线注 + 按钮,线数会改变!")
                self.assertEqual(info_bar_line_cost, target_line_cost,
                                 "横竖屏切换,点击线注 + 按钮,设置窗口的线注与下导航栏的不一致!")
                self.assertEqual(info_bar_bet_money, target_bet_money,
                                 "横竖屏切换,点击线注 + 按钮,总赌注数值错误!")
            except AssertionError:
                self.daf.get_screenshot(self.browser)
                raise

        sleep(1)

        # 点击线注 - 按钮
        for i in range(3):
            if i % 2 == 0:
                self.common.portrait()
            else:
                self.common.landscape()
            target_line_num = self.common.setting_view_line_num()

            self.common.setting_view_line_cost_min_btn_click()
            sleep(1)

            info_bar_line_num = self.common.info_bar_view_line_num_label()
            info_bar_line_cost = self.common.info_bar_view_line_cost_label()
            info_bar_bet_money = self.common.info_bar_view_bet_money_label()

            bet_money = eval(info_bar_line_num) * eval(info_bar_line_cost[1:])
            target_bet_money = "¥" + locale.format("%.2f", bet_money, 1)
            target_line_cost = self.common.setting_view_line_cost()

            try:
                self.assertEqual(info_bar_line_num, target_line_num,
                                 "横竖屏切换,点击线注 - 按钮,线数会改变!")
                self.assertEqual(info_bar_line_cost, target_line_cost,
                                 "横竖屏切换,点击线注 - 按钮,设置窗口的线注与下导航栏的不一致!")
                self.assertEqual(info_bar_bet_money, target_bet_money,
                                 "横竖屏切换,点击线注 - 按钮,总赌注数值错误!")
            except AssertionError:
                self.daf.get_screenshot(self.browser)
                raise
class TestAutoGameView(unittest.TestCase):
    """ 自动游戏设置模块 """
    def setUp(self):
        self.browser = webdriver.Chrome(
            executable_path="../../lib/chromedriver.exe")
        self.common = Common(self.browser)
        self.common.start()
        self.daf = DirAndFiles()

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

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

    def test_auto_game_btn(self):
        """ 横屏自动游戏按钮 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        visible = self.common.auto_game_btn_visible()
        touchable = self.common.auto_game_btn_touchable()
        try:
            self.assertEqual(visible, True, "横屏不会显示自动游戏按钮!")
            self.assertEqual(touchable, True, "横屏自动游戏按钮不能点击!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_auto_game_btn_click(self):
        """ 横屏点击自动游戏按钮 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.auto_game_btn_click()
        sleep(1)
        visible = self.common.auto_game_view_visible()
        mask = self.common.mask_view_showing()
        try:
            self.assertEqual(visible, True, "横屏点击自动游戏按钮,不会显示自动游戏设置面板!")
            self.assertEqual(mask, True, "横屏点击自动游戏按钮,不会显示灰色蒙板!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_click_mask_view_dispear(self):
        """ 横屏点击灰色蒙板,设置面板消失 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.auto_game_btn_click()
        sleep(1)
        self.common.mask_view_click()
        sleep(1)
        dispear = self.common.auto_game_view_dispear()
        mask = self.common.mask_view_showing()
        try:
            self.assertEqual(dispear, None, "横屏显示自动游戏设置面板时,点击灰色蒙板,设置面板不会消失!")
            self.assertEqual(mask, False, "横屏显示自动游戏设置面板时,点击灰色蒙板,灰色蒙板不会消失!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_close_btn_click(self):
        """ 横屏点击设置面板关闭按钮,面板消失 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.auto_game_btn_click()
        sleep(1)
        self.common.auto_game_view_close_btn_click()
        sleep(1)
        dispear = self.common.auto_game_view_dispear()
        mask = self.common.mask_view_showing()
        try:
            self.assertEqual(dispear, None, "横屏显示自动游戏设置面板时,点击灰色蒙板,设置面板不会消失!")
            self.assertEqual(mask, False, "横屏显示自动游戏设置面板时,点击灰色蒙板,灰色蒙板不会消失!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_auto_game_view(self):
        """ 横屏设置面板按钮文字显示 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.auto_game_btn_click()
        sleep(1)
        icon = self.common.auto_game_view_icon_visible()
        slider_bar = self.common.auto_game_view_slider_bar_visible()
        slider_btn = self.common.auto_game_view_slider_btn_visible()

        current_auto_game_time = self.common.auto_game_view_auto_time_text()
        target_auto_game_time = self.common.auto_game_times[-1]
        current_value = self.common.auto_game_view_slider_value()

        start_btn = self.common.auto_game_view_start_btn_visible()
        start_btn_text = self.common.auto_game_view_start_btn_text()
        start_btn_touchable = self.common.auto_game_view_start_btn_touchable()

        close_btn = self.common.auto_game_view_close_btn_visible()
        close_btn_touchable = self.common.auto_game_view_close_btn_touchable()

        if target_auto_game_time == -1:
            target_auto_game_time = "直到环节"
        else:
            target_auto_game_time = str(target_auto_game_time) + "次旋转"
        try:
            self.assertEqual(icon, True, "横屏自动游戏设置面板,不会显示小图标!")
            self.assertEqual(slider_bar, True, "横屏自动游戏设置面板,没有显示拖动条!")
            self.assertEqual(slider_btn, True, "横屏自动游戏设置面板,不会显示拖动条按钮!")
            self.assertEqual(current_auto_game_time, target_auto_game_time,
                             "横屏自动游戏设置面板,默认的自动次数不是最大值!")
            self.assertEqual(current_value, 100, "横屏自动游戏设置面板,默认的拖动条按钮没有在最右边!")
            self.assertEqual(start_btn, True, "横屏自动游戏设置面板,不会显示开始按钮!")
            self.assertEqual(start_btn_text, "开始旋转", "横屏自动游戏设置面板,开始按钮文字错误!")
            self.assertEqual(start_btn_touchable, True, "横屏自动游戏设置面板,开始按钮不能点击!")
            self.assertEqual(close_btn, True, "横屏自动游戏设置面板,没有显示关闭按钮!")
            self.assertEqual(close_btn_touchable, True, "横屏自动游戏设置面板,关闭按钮不能点击!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_change_auto_time(self):
        """ 横屏设置面板改变自动次数,次数显示正确 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.auto_game_btn_click()
        sleep(1)

        target_time_len = len(self.common.auto_game_times)

        # 根据读取到的自动次数,分别改变自动次数
        for i in reversed(range(target_time_len)):
            self.common.auto_game_view_change_auto_time(i)
            sleep(1)

            current_time = self.common.auto_game_view_auto_time_text()
            target_time = self.common.auto_game_times[i]

            if target_time == -1:
                target_time = "直到环节"
            else:
                target_time = str(target_time) + "次旋转"

            try:
                self.assertEqual(current_time, target_time,
                                 "横屏自动游戏设置面板,改变自动次数后与策划的不一致!")
            except AssertionError:
                self.daf.get_screenshot(self.browser)
                raise

    def test_start_btn_click(self):
        """ 横屏点击开始自动游戏按钮 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.auto_game_btn_click()
        sleep(1)
        self.common.auto_game_view_start_btn_click()
        sleep(1)

        # 获取自动游戏设置面板和蒙板状态
        view_dispear = self.common.auto_game_view_dispear()
        mask_dispear = self.common.mask_view_showing()
        # 获取滚轴滚动状态
        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(view_dispear, None, "横屏启动自动游戏,自动游戏设置面板不会消失!")
            self.assertEqual(mask_dispear, False, "横屏启动自动游戏,灰色蒙板不会消失!")
            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

    def test_auto_spin_time(self):
        """ 横屏改变自动次数,点击开始旋转按钮 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)

        target_time_len = len(self.common.auto_game_times)

        # 根据配置数据分别设置自动次数,并启动自动游戏,验证次数是否依次减少
        for i in reversed(range(target_time_len)):
            self.common.auto_game_btn_click()
            sleep(1)
            self.common.auto_game_view_change_auto_time(i)
            sleep(1)

            target_spin_btn_time = self.common.auto_game_times[i]

            self.common.auto_game_view_start_btn_click()
            sleep(1)

            game_status = None

            # 用这个循环来防止自动游戏过程触发特殊玩法,影响用例执行和验证
            while True:
                # 累计自动旋转次数
                y = 0
                # 自动游戏需要旋转的次数
                loop_time = 3
                for y in range(loop_time):

                    # 等待到滚轴旋转了再进入下一步
                    self.common.wait_for_rolling(30)

                    # 判断是否中了特殊玩法游戏,若中了则刷新游戏重来
                    game_status = self.common.get_game_current_status()
                    if game_status is not None:
                        self.browser.refresh()
                        self.common.loading_pass()
                        sleep(1)
                        self.common.sound_view_yes_btn_click()
                        sleep(1)
                        self.common.auto_game_btn_click()
                        sleep(1)
                        self.common.auto_game_view_change_auto_time(i)
                        sleep(1)

                        target_spin_btn_time = self.common.auto_game_times[i]

                        self.common.auto_game_view_start_btn_click()
                        sleep(1)
                        break

                    # 获取停止旋转按钮和下导航栏上的剩余次数
                    current_spin_time = self.common.in_auto_spin_btn_text()
                    current_info_bar_spin_time = self.common.info_bar_view_banner_tips_label(
                    )

                    if target_spin_btn_time == -1 or target_spin_btn_time == "直到":
                        target_spin_btn_time = "直到"
                        target_info_bar_spin_time = "直到环节自动旋转"
                    else:
                        target_spin_btn_time = target_spin_btn_time - 1
                        target_info_bar_spin_time = "剩余" + str(
                            target_spin_btn_time) + "次自动旋转"

                    try:
                        self.assertEqual(current_spin_time,
                                         str(target_spin_btn_time),
                                         "横屏启动自动游戏,停止按钮上的剩余次数错误!")
                        self.assertEqual(current_info_bar_spin_time,
                                         target_info_bar_spin_time,
                                         "横屏启动自动游戏,下导航栏上的剩余次数错误!")
                    except AssertionError:
                        self.daf.get_screenshot(self.browser)
                        raise

                    # 等待到滚轴停止了再进入下一步
                    self.common.wait_for_rolling_stop(30)

                if y == (loop_time - 1) and game_status is None:
                    self.common.start_btn_click()
                    sleep(1)
                    break

    def test_auto_spin_time_is_zero(self):
        """ 横屏自动次数为0时停止 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)

        self.common.auto_game_btn_click()
        sleep(1)
        self.common.auto_game_view_change_auto_time(0)
        sleep(1)

        self.common.auto_game_view_start_btn_click()
        sleep(1)

        # 用这个循环来防止自动游戏过程触发特殊玩法
        while True:

            self.common.wait_for_rolling(30)

            # 获取停止旋转按钮上的剩余次数
            current_spin_time = self.common.in_auto_spin_btn_text()

            # 判断自动游戏最后一局是否中了特殊玩法,若中了则刷新游戏重来
            if current_spin_time == "0":
                game_status = self.common.get_game_current_status()
                if game_status is not None:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    self.common.sound_view_yes_btn_click()
                    sleep(1)

                    self.common.auto_game_btn_click()
                    sleep(1)
                    self.common.auto_game_view_change_auto_time(0)
                    sleep(1)

                    self.common.auto_game_view_start_btn_click()
                    sleep(1)
                    continue
                else:
                    self.common.wait_for_rolling_stop(30)

                    for i in range(10):  # 循环10秒验证是否还会继续自动旋转
                        sleep(1)
                        # 获取滚轴滚动状态
                        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, False,
                                             "横屏自动游戏次数为0后,滚轴不会停止滚动!")
                            self.assertEqual(start_btn_status, "stopped",
                                             "横屏自动游戏次数为0后,旋转按钮不会变成旋转按钮状态!")
                            self.assertEqual(setting_btn, True,
                                             "横屏自动游戏次数为0后,线数线注设置按钮不会重新显示!")
                            self.assertEqual(auto_game_btn, True,
                                             "横屏自动游戏次数为0后,自动游戏按钮不会重新显示!")
                            self.assertEqual(main_menu_expand, "retractL",
                                             "横屏自动游戏次数为0后,左侧选项菜单不会依然折叠!")
                            self.assertEqual(main_menu, True,
                                             "横屏自动游戏次数为0后,左侧选项菜单不可以点击!")
                        except AssertionError:
                            self.daf.get_screenshot(self.browser)
                            raise
                    break
            else:
                game_status = self.common.get_game_current_status()
                if game_status is not None:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    self.common.sound_view_yes_btn_click()
                    sleep(1)

                    self.common.auto_game_btn_click()
                    sleep(1)
                    self.common.auto_game_view_change_auto_time(0)
                    sleep(1)

                    self.common.auto_game_view_start_btn_click()
                    sleep(1)

            self.common.wait_for_rolling_stop(30)

    def test_in_auto_game_click_start_btn(self):
        """ 横屏自动游戏过程,点击停止按钮 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)

        self.common.auto_game_btn_click()
        sleep(1)

        self.common.auto_game_view_start_btn_click()
        sleep(1)

        while True:

            self.common.wait_for_rolling(30)

            # 自动游戏过程,点击停止按钮
            self.common.start_btn_click()

            slot_rolling = self.common.slot_machine_rolling()
            start_btn_text = self.common.in_auto_spin_btn_text()
            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_text, "",
                                 "横屏自动游戏过程点击停止按钮,按钮上依然显示自动次数!")
                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

            # 验证游戏是否触发特殊玩法,若触发了则刷新重来
            while True:
                self.common.wait_for_rolling_stop(30)

                sleep(1)
                game_status = self.common.get_game_current_status()
                if game_status is not None:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    self.common.sound_view_yes_btn_click()
                    sleep(1)

                    self.common.auto_game_btn_click()
                    sleep(1)

                    self.common.auto_game_view_start_btn_click()
                    sleep(1)
                    break
                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()

                    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,
                            "横屏自动游戏过程点击停止按钮,滚轴自动停下后,左侧选项菜单不会变成可点击状态!")
                    except AssertionError:
                        self.daf.get_screenshot(self.browser)
                        raise

                    # 滚轴停止后,循环10秒验证是否还会自动旋转
                    for i in range(10):
                        sleep(1)
                        # 获取滚轴滚动状态
                        slot_rolling = self.common.slot_machine_rolling()

                        try:
                            self.assertEqual(
                                slot_rolling, False,
                                "横屏自动游戏过程点击停止按钮,滚轴自动停下后,还会继续自动旋转!")
                        except AssertionError:
                            self.daf.get_screenshot(self.browser)
                            raise
                    break

            if game_status is None:
                break

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

    def test_auto_game_btn_portrait(self):
        """ 竖屏自动游戏按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        visible = self.common.auto_game_btn_visible()
        touchable = self.common.auto_game_btn_touchable()
        try:
            self.assertEqual(visible, True, "竖屏不会显示自动游戏按钮!")
            self.assertEqual(touchable, True, "竖屏自动游戏按钮不能点击!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_auto_game_btn_click_portrait(self):
        """ 竖屏点击自动游戏按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.auto_game_btn_click()
        sleep(1)
        visible = self.common.auto_game_view_visible()
        mask = self.common.mask_view_showing()
        try:
            self.assertEqual(visible, True, "竖屏点击自动游戏按钮,不会显示自动游戏设置面板!")
            self.assertEqual(mask, True, "竖屏点击自动游戏按钮,不会显示灰色蒙板!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_click_mask_view_dispear_portrait(self):
        """ 竖屏点击灰色蒙板,设置面板消失 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.auto_game_btn_click()
        sleep(1)
        self.common.mask_view_click()
        sleep(1)
        dispear = self.common.auto_game_view_dispear()
        mask = self.common.mask_view_showing()
        try:
            self.assertEqual(dispear, None, "竖屏显示自动游戏设置面板时,点击灰色蒙板,设置面板不会消失!")
            self.assertEqual(mask, False, "竖屏显示自动游戏设置面板时,点击灰色蒙板,灰色蒙板不会消失!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_close_btn_click_portrait(self):
        """ 竖屏点击设置面板关闭按钮,面板消失 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.auto_game_btn_click()
        sleep(1)
        self.common.auto_game_view_close_btn_click()
        sleep(1)
        dispear = self.common.auto_game_view_dispear()
        mask = self.common.mask_view_showing()
        try:
            self.assertEqual(dispear, None, "竖屏显示自动游戏设置面板时,点击灰色蒙板,设置面板不会消失!")
            self.assertEqual(mask, False, "竖屏显示自动游戏设置面板时,点击灰色蒙板,灰色蒙板不会消失!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_auto_game_view_portrait(self):
        """ 竖屏设置面板按钮文字显示 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.auto_game_btn_click()
        sleep(1)
        icon = self.common.auto_game_view_icon_visible()
        slider_bar = self.common.auto_game_view_slider_bar_visible()
        slider_btn = self.common.auto_game_view_slider_btn_visible()

        current_auto_game_time = self.common.auto_game_view_auto_time_text()
        target_auto_game_time = self.common.auto_game_times[-1]
        current_value = self.common.auto_game_view_slider_value()

        start_btn = self.common.auto_game_view_start_btn_visible()
        start_btn_text = self.common.auto_game_view_start_btn_text()
        start_btn_touchable = self.common.auto_game_view_start_btn_touchable()

        close_btn = self.common.auto_game_view_close_btn_visible()
        close_btn_touchable = self.common.auto_game_view_close_btn_touchable()

        if target_auto_game_time == -1:
            target_auto_game_time = "直到环节"
        else:
            target_auto_game_time = str(target_auto_game_time) + "次旋转"
        try:
            self.assertEqual(icon, True, "竖屏自动游戏设置面板,不会显示小图标!")
            self.assertEqual(slider_bar, True, "竖屏自动游戏设置面板,没有显示拖动条!")
            self.assertEqual(slider_btn, True, "竖屏自动游戏设置面板,不会显示拖动条按钮!")
            self.assertEqual(current_auto_game_time, target_auto_game_time,
                             "竖屏自动游戏设置面板,默认的自动次数不是最大值!")
            self.assertEqual(current_value, 100, "竖屏自动游戏设置面板,默认的拖动条按钮没有在最右边!")
            self.assertEqual(start_btn, True, "竖屏自动游戏设置面板,不会显示开始按钮!")
            self.assertEqual(start_btn_text, "开始旋转", "竖屏自动游戏设置面板,开始按钮文字错误!")
            self.assertEqual(start_btn_touchable, True, "竖屏自动游戏设置面板,开始按钮不能点击!")
            self.assertEqual(close_btn, True, "竖屏自动游戏设置面板,没有显示关闭按钮!")
            self.assertEqual(close_btn_touchable, True, "竖屏自动游戏设置面板,关闭按钮不能点击!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_change_auto_time_portrait(self):
        """ 竖屏设置面板改变自动次数,次数显示正确 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.auto_game_btn_click()
        sleep(1)

        target_time_len = len(self.common.auto_game_times)

        # 根据读取到的自动次数,分别改变自动次数
        for i in reversed(range(target_time_len)):
            self.common.auto_game_view_change_auto_time(i)
            sleep(1)

            current_time = self.common.auto_game_view_auto_time_text()
            target_time = self.common.auto_game_times[i]

            if target_time == -1:
                target_time = "直到环节"
            else:
                target_time = str(target_time) + "次旋转"

            try:
                self.assertEqual(current_time, target_time,
                                 "竖屏自动游戏设置面板,改变自动次数后与策划的不一致!")
            except AssertionError:
                self.daf.get_screenshot(self.browser)
                raise

    def test_start_btn_click_portrait(self):
        """ 竖屏点击开始自动游戏按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.auto_game_btn_click()
        sleep(1)
        self.common.auto_game_view_start_btn_click()
        sleep(1)

        # 获取自动游戏设置面板和蒙板状态
        view_dispear = self.common.auto_game_view_dispear()
        mask_dispear = self.common.mask_view_showing()
        # 获取滚轴滚动状态
        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(view_dispear, None, "竖屏启动自动游戏,自动游戏设置面板不会消失!")
            self.assertEqual(mask_dispear, False, "竖屏启动自动游戏,灰色蒙板不会消失!")
            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

    def test_auto_spin_time_portrait(self):
        """ 竖屏改变自动次数,点击开始旋转按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)

        target_time_len = len(self.common.auto_game_times)

        # 根据配置数据分别设置自动次数,并启动自动游戏,验证次数是否依次减少
        for i in reversed(range(target_time_len)):
            self.common.auto_game_btn_click()
            sleep(1)
            self.common.auto_game_view_change_auto_time(i)
            sleep(1)

            target_spin_btn_time = self.common.auto_game_times[i]

            self.common.auto_game_view_start_btn_click()
            sleep(1)

            game_status = None

            # 用这个循环来防止自动游戏过程触发特殊玩法,影响用例执行和验证
            while True:
                # 累计自动旋转次数
                y = 0
                # 自动游戏需要旋转的次数
                loop_time = 3
                for y in range(loop_time):

                    # 等待到滚轴旋转了再进入下一步
                    self.common.wait_for_rolling(30)

                    # 判断是否中了特殊玩法游戏,若中了则刷新游戏重来
                    game_status = self.common.get_game_current_status()
                    if game_status is not None:
                        self.browser.refresh()
                        self.common.loading_pass()
                        sleep(1)
                        self.common.sound_view_yes_btn_click()
                        sleep(1)
                        self.common.auto_game_btn_click()
                        sleep(1)
                        self.common.auto_game_view_change_auto_time(i)
                        sleep(1)

                        target_spin_btn_time = self.common.auto_game_times[i]

                        self.common.auto_game_view_start_btn_click()
                        sleep(1)
                        break

                    # 获取停止旋转按钮和下导航栏上的剩余次数
                    current_spin_time = self.common.in_auto_spin_btn_text()
                    current_info_bar_spin_time = self.common.info_bar_view_banner_tips_label(
                    )

                    if target_spin_btn_time == -1 or target_spin_btn_time == "直到":
                        target_spin_btn_time = "直到"
                        target_info_bar_spin_time = "直到环节自动旋转"
                    else:
                        target_spin_btn_time = target_spin_btn_time - 1
                        target_info_bar_spin_time = "剩余" + str(
                            target_spin_btn_time) + "次自动旋转"

                    try:
                        self.assertEqual(current_spin_time,
                                         str(target_spin_btn_time),
                                         "竖屏启动自动游戏,停止按钮上的剩余次数错误!")
                        self.assertEqual(current_info_bar_spin_time,
                                         target_info_bar_spin_time,
                                         "竖屏启动自动游戏,下导航栏上的剩余次数错误!")
                    except AssertionError:
                        self.daf.get_screenshot(self.browser)
                        raise

                    # 等待到滚轴停止了再进入下一步
                    self.common.wait_for_rolling_stop(30)

                if y == (loop_time - 1) and game_status is None:
                    self.common.start_btn_click()
                    sleep(1)
                    break

    def test_auto_spin_time_is_zero_portrait(self):
        """ 竖屏自动次数为0时停止 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)

        self.common.auto_game_btn_click()
        sleep(1)
        self.common.auto_game_view_change_auto_time(0)
        sleep(1)

        self.common.auto_game_view_start_btn_click()
        sleep(1)

        # 用这个循环来防止自动游戏过程触发特殊玩法
        while True:

            self.common.wait_for_rolling(30)

            # 获取停止旋转按钮上的剩余次数
            current_spin_time = self.common.in_auto_spin_btn_text()

            # 判断自动游戏最后一局是否中了特殊玩法,若中了则刷新游戏重来
            if current_spin_time == "0":
                game_status = self.common.get_game_current_status()
                if game_status is not None:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    self.common.sound_view_yes_btn_click()
                    sleep(1)

                    self.common.auto_game_btn_click()
                    sleep(1)
                    self.common.auto_game_view_change_auto_time(0)
                    sleep(1)

                    self.common.auto_game_view_start_btn_click()
                    sleep(1)
                    continue
                else:
                    self.common.wait_for_rolling_stop(30)

                    for i in range(10):  # 循环10秒验证是否还会继续自动旋转
                        sleep(1)
                        # 获取滚轴滚动状态
                        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, False,
                                             "竖屏自动游戏次数为0后,滚轴不会停止滚动!")
                            self.assertEqual(start_btn_status, "stopped",
                                             "竖屏自动游戏次数为0后,旋转按钮不会变成旋转按钮状态!")
                            self.assertEqual(setting_btn, True,
                                             "竖屏自动游戏次数为0后,线数线注设置按钮不会重新显示!")
                            self.assertEqual(auto_game_btn, True,
                                             "竖屏自动游戏次数为0后,自动游戏按钮不会重新显示!")
                            self.assertEqual(main_menu_expand, "retractP",
                                             "竖屏自动游戏次数为0后,左侧选项菜单不会依然折叠!")
                            self.assertEqual(main_menu, True,
                                             "竖屏自动游戏次数为0后,左侧选项菜单不可以点击!")
                        except AssertionError:
                            self.daf.get_screenshot(self.browser)
                            raise
                    break
            else:
                game_status = self.common.get_game_current_status()
                if game_status is not None:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    self.common.sound_view_yes_btn_click()
                    sleep(1)

                    self.common.auto_game_btn_click()
                    sleep(1)
                    self.common.auto_game_view_change_auto_time(0)
                    sleep(1)

                    self.common.auto_game_view_start_btn_click()
                    sleep(1)

            self.common.wait_for_rolling_stop(30)

    def test_in_auto_game_click_start_btn_portrait(self):
        """ 竖屏自动游戏过程,点击停止按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)

        self.common.auto_game_btn_click()
        sleep(1)

        self.common.auto_game_view_start_btn_click()
        sleep(1)

        while True:

            self.common.wait_for_rolling(30)

            # 自动游戏过程,点击停止按钮
            self.common.start_btn_click()

            slot_rolling = self.common.slot_machine_rolling()
            start_btn_text = self.common.in_auto_spin_btn_text()
            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_text, "",
                                 "竖屏自动游戏过程点击停止按钮,按钮上依然显示自动次数!")
                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

            # 验证游戏是否触发特殊玩法,若触发了则刷新重来
            while True:
                self.common.wait_for_rolling_stop(30)

                sleep(1)
                game_status = self.common.get_game_current_status()
                if game_status is not None:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    self.common.sound_view_yes_btn_click()
                    sleep(1)

                    self.common.auto_game_btn_click()
                    sleep(1)

                    self.common.auto_game_view_start_btn_click()
                    sleep(1)
                    break
                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()

                    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,
                            "竖屏自动游戏过程点击停止按钮,滚轴自动停下后,左侧选项菜单不会变成可点击状态!")
                    except AssertionError:
                        self.daf.get_screenshot(self.browser)
                        raise

                    # 滚轴停止后,循环10秒验证是否还会自动旋转
                    for i in range(10):
                        sleep(1)
                        # 获取滚轴滚动状态
                        slot_rolling = self.common.slot_machine_rolling()

                        try:
                            self.assertEqual(
                                slot_rolling, False,
                                "竖屏自动游戏过程点击停止按钮,滚轴自动停下后,还会继续自动旋转!")
                        except AssertionError:
                            self.daf.get_screenshot(self.browser)
                            raise
                    break

            if game_status is None:
                break

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

    def test_change_auto_time_switch_screen(self):
        """ 横竖屏设置面板改变自动次数,次数显示正确 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.auto_game_btn_click()
        sleep(1)

        target_time_len = len(self.common.auto_game_times)

        # 根据读取到的自动次数,分别改变自动次数
        for i in reversed(range(target_time_len)):
            self.common.auto_game_view_change_auto_time(i)
            sleep(1)
            auto_time1 = self.common.auto_game_view_auto_time_text()
            if i % 2 == 0:
                self.common.portrait()
            else:
                self.common.landscape()

            sleep(1)

            auto_time2 = self.common.auto_game_view_auto_time_text()

            try:
                self.assertEqual(auto_time1, auto_time2,
                                 "自动游戏设置面板,改变自动次数后切换横竖屏,自动次数不一致!")
            except AssertionError:
                self.daf.get_screenshot(self.browser)
                raise

    def test_auto_spin_time_switch_screen(self):
        """ 横竖屏改变自动次数,点击开始旋转按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)

        self.common.auto_game_btn_click()
        sleep(1)
        self.common.auto_game_view_change_auto_time(0)
        sleep(1)

        target_spin_btn_time = self.common.auto_game_times[0]

        self.common.auto_game_view_start_btn_click()
        sleep(1)

        # 用这个循环来防止自动游戏过程触发特殊玩法,影响用例执行和验证
        while True:
            i = 0

            for i in range(target_spin_btn_time):

                # 等待到滚轴旋转了再进入下一步
                self.common.wait_for_rolling(30)

                sleep(0.5)

                if i % 2 == 0:
                    self.common.landscape()
                else:
                    self.common.portrait()

                sleep(0.5)

                # 判断是否中了特殊玩法游戏,若中了则刷新游戏重来
                game_status = self.common.get_game_current_status()
                if i != 4 and game_status is not None:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    self.common.sound_view_yes_btn_click()
                    sleep(1)
                    self.common.auto_game_btn_click()
                    sleep(1)
                    self.common.auto_game_view_change_auto_time(0)
                    sleep(1)
                    target_spin_btn_time = self.common.auto_game_times[0]
                    self.common.auto_game_view_start_btn_click()
                    sleep(1)
                    break

                # 获取停止旋转按钮和下导航栏上的剩余次数
                current_spin_time = self.common.in_auto_spin_btn_text()
                current_info_bar_spin_time = self.common.info_bar_view_banner_tips_label(
                )

                target_spin_btn_time -= 1
                target_info_bar_spin_time = "剩余" + str(
                    target_spin_btn_time) + "次自动旋转"

                try:
                    self.assertEqual(current_spin_time,
                                     str(target_spin_btn_time),
                                     "启动自动游戏,切换横竖屏,停止按钮上的剩余次数错误!")
                    self.assertEqual(current_info_bar_spin_time,
                                     target_info_bar_spin_time,
                                     "启动自动游戏,切换横竖屏,下导航栏上的剩余次数错误!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise

                # 等待到滚轴停止了再进入下一步
                self.common.wait_for_rolling_stop(30)

                # 验证5次即可
                if i == 4:
                    break

            if i == 4:
                break

    def test_auto_spin_click_btn_switch_screen(self):
        """ 横竖屏自动游戏过程点击停止按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)

        self.common.auto_game_btn_click()
        sleep(1)

        self.common.auto_game_view_start_btn_click()
        sleep(1)

        while True:

            self.common.wait_for_rolling(30)

            # 自动游戏过程,点击停止按钮
            self.common.start_btn_click()
            sleep(0.5)
            self.common.landscape()
            sleep(0.5)

            slot_rolling = self.common.slot_machine_rolling()
            start_btn_text = self.common.in_auto_spin_btn_text()
            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_text, "",
                                 "自动游戏过程点击停止按钮,横竖屏切换,按钮上依然显示自动次数!")
                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

            # 验证游戏是否触发特殊玩法,若触发了则刷新重来
            while True:
                self.common.wait_for_rolling_stop(30)

                sleep(1)
                game_status = self.common.get_game_current_status()
                if game_status is not None:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    self.common.sound_view_yes_btn_click()
                    sleep(1)

                    self.common.auto_game_btn_click()
                    sleep(1)

                    self.common.auto_game_view_start_btn_click()
                    sleep(1)
                    break
                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()

                    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,
                            "自动游戏过程点击停止按钮,横竖屏切换,滚轴自动停下后,左侧选项菜单不会变成可点击状态!")
                    except AssertionError:
                        self.daf.get_screenshot(self.browser)
                        raise

                    # 滚轴停止后,循环10秒验证是否还会自动旋转
                    for i in range(10):
                        sleep(1)
                        # 获取滚轴滚动状态
                        slot_rolling = self.common.slot_machine_rolling()

                        try:
                            self.assertEqual(
                                slot_rolling, False,
                                "自动游戏过程点击停止按钮,横竖屏切换,滚轴自动停下后,还会继续自动旋转!")
                        except AssertionError:
                            self.daf.get_screenshot(self.browser)
                            raise
                    break

            if game_status is None:
                break
예제 #4
0
class TestSpinBtn(unittest.TestCase):
    """ 旋转按钮模块 """
    def setUp(self):
        self.browser = webdriver.Chrome(
            executable_path="../../lib/chromedriver.exe")
        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)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        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(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_btn_click()
        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)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        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(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_btn_click()
        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
예제 #5
0
class TestMainMenu(unittest.TestCase):
    """ 左侧选项菜单模块 """

    def setUp(self):
        self.browser = webdriver.Chrome(executable_path="../../lib/chromedriver.exe")
        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(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_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, "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(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_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, "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(3)
        self.common.sound_view_yes_btn_click()
        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_turbo_btn_default(self):
        """ 横屏快速模式按钮默认状态 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)

        while True:
            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)
                self.common.sound_view_yes_btn_click()
                sleep(1)
                continue
            else:

                sleep(1)
                self.common.main_menu_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()

                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)
                    self.common.sound_view_yes_btn_click()
                    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(3)
        self.common.sound_view_yes_btn_click()
        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_main_menu_default_portrait(self):
        """ 竖屏左侧主菜单及按钮的默认状态 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_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, "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(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_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, "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(3)
        self.common.sound_view_yes_btn_click()
        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_turbo_btn_default_portrait(self):
        """ 竖屏快速模式按钮默认状态 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)

        while True:
            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)
                self.common.sound_view_yes_btn_click()
                sleep(1)
                continue
            else:

                sleep(1)
                self.common.main_menu_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()

                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)
                    self.common.sound_view_yes_btn_click()
                    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(3)
        self.common.sound_view_yes_btn_click()
        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_main_menu_default_switch_screen(self):
        """ 横竖屏切换,左侧主菜单状态 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)

        while True:
            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)
                self.common.sound_view_yes_btn_click()
                sleep(1)
                continue
            else:
                self.common.landscape()
                sleep(1)
                self.common.main_menu_btn_click()
                sleep(1)

                self.common.turbo_btn_click()
                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)
                    self.common.sound_view_yes_btn_click()
                    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(3)
        self.common.sound_view_yes_btn_click()
        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
예제 #6
0
class TestGameAttr(unittest.TestCase):
    """ 游戏基本属性模块 """
    def setUp(self):
        self.browser = webdriver.Chrome(
            executable_path="../../lib/chromedriver.exe")
        self.common = Common(self.browser)
        self.common.start()
        self.daf = DirAndFiles()
        self.common.loading_pass()

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

    def test_game_id(self):
        """ 游戏id """
        sleep(1)
        current_game_id = self.common.get_game_id()
        target_game_id = self.common.game_id
        try:
            self.assertEqual(current_game_id, target_game_id, "游戏ID错误!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_game_name(self):
        """ 游戏名字 """
        sleep(1)
        current_game_name = self.common.get_game_name()
        target_game_name = self.common.game_name
        try:
            self.assertEqual(current_game_name, target_game_name, "游戏名字错误!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_min_line_num(self):
        """ 最小线数 """
        sleep(1)
        current_min_line_num = self.common.get_min_line_num()
        target_min_line_num = self.common.line_num_min
        try:
            self.assertEqual(current_min_line_num, target_min_line_num,
                             "最小线数配置错误!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_max_line_num(self):
        """ 最大线数 """
        sleep(1)
        current_max_line_num = self.common.get_max_line_num()
        target_max_line_num = self.common.line_num_max
        try:
            self.assertEqual(current_max_line_num, target_max_line_num,
                             "最大线数配置错误!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_line_cost(self):
        """ 线注 """
        sleep(1)
        current_line_cost = self.common.get_line_cost_list()
        target_line_cost = self.common.line_cost
        try:
            self.assertEqual(current_line_cost, target_line_cost, "线注不一致!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_auto_game_times(self):
        """ 自动次数 """
        sleep(1)
        current_auto_game_times = self.common.get_auto_game_times_list()
        target_auto_game_times = self.common.auto_game_times
        try:
            self.assertEqual(current_auto_game_times, target_auto_game_times,
                             "自动次数不一致!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise
예제 #7
0
class TestMainAndComView(unittest.TestCase):
    """ 主场景视图模块 """
    def setUp(self):
        self.browser = webdriver.Chrome(
            executable_path="../../lib/chromedriver.exe")
        self.common = Common(self.browser)
        self.common.start()
        self.daf = DirAndFiles()

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

    def test_main_scence_visible(self):
        """ 横屏显示主场景 """
        self.common.loading_pass()

        sleep(1)
        main_view = self.common.main_view_visible()
        common_view = self.common.common_view_visible()
        slot_machine_view = self.common.slot_machine_view_visible()
        bg_view = self.common.bg_view_visible()
        bottom_bg_view = self.common.bottom_bg_view_visible()

        try:
            self.assertEqual(main_view, True, "横屏没有显示主视图!")
            self.assertEqual(common_view, True, "横屏没有显示公共视图!")
            self.assertEqual(slot_machine_view, True, "横屏没有显示滚轴!")
            self.assertEqual(bg_view, True, "横屏没有显示背景图片!")
            self.assertEqual(bottom_bg_view, False, "横屏会显示竖屏背景图片!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_main_scence_in_portrait(self):
        """ 竖屏显示主场景 """
        self.common.portrait()
        self.common.loading_pass()

        sleep(1)
        main_view = self.common.main_view_visible()
        common_view = self.common.common_view_visible()
        slot_machine_view = self.common.slot_machine_view_visible()
        bg_view = self.common.bg_view_visible()
        bottom_bg_view = self.common.bottom_bg_view_visible()

        try:
            self.assertEqual(main_view, True, "竖屏没有显示主视图!")
            self.assertEqual(common_view, True, "竖屏没有显示公共视图!")
            self.assertEqual(slot_machine_view, True, "竖屏没有显示滚轴!")
            self.assertEqual(bg_view, False, "竖屏会显示横屏背景图片!")
            self.assertEqual(bottom_bg_view, True, "竖屏没有显示背景图片!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_main_scence_landscape_switch_screen(self):
        """ 横竖屏主场景显示正常 """
        self.common.loading_pass()

        sleep(1)
        main_view = self.common.main_view_visible()
        common_view = self.common.common_view_visible()
        slot_machine_view = self.common.slot_machine_view_visible()
        bg_view = self.common.bg_view_visible()
        bottom_bg_view = self.common.bottom_bg_view_visible()

        try:
            self.assertEqual(main_view, True, "横屏没有显示主视图!")
            self.assertEqual(common_view, True, "横屏没有显示公共视图!")
            self.assertEqual(slot_machine_view, True, "横屏没有显示滚轴!")
            self.assertEqual(bg_view, True, "横屏没有显示背景图片!")
            self.assertEqual(bottom_bg_view, False, "横屏会显示竖屏背景图片!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

        self.common.portrait()
        sleep(1)
        main_view = self.common.main_view_visible()
        common_view = self.common.common_view_visible()
        slot_machine_view = self.common.slot_machine_view_visible()
        bg_view = self.common.bg_view_visible()
        bottom_bg_view = self.common.bottom_bg_view_visible()

        try:
            self.assertEqual(main_view, True, "竖屏没有显示主视图!")
            self.assertEqual(common_view, True, "竖屏没有显示公共视图!")
            self.assertEqual(slot_machine_view, True, "竖屏没有显示滚轴!")
            self.assertEqual(bg_view, False, "竖屏会显示横屏背景图片!")
            self.assertEqual(bottom_bg_view, True, "竖屏没有显示背景图片!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_main_scence_portrait_switch_screen(self):
        """ 横竖屏主场景显示正常 """
        self.common.portrait()
        self.common.loading_pass()

        sleep(1)
        main_view = self.common.main_view_visible()
        common_view = self.common.common_view_visible()
        slot_machine_view = self.common.slot_machine_view_visible()
        bg_view = self.common.bg_view_visible()
        bottom_bg_view = self.common.bottom_bg_view_visible()

        try:
            self.assertEqual(main_view, True, "竖屏没有显示主视图!")
            self.assertEqual(common_view, True, "竖屏没有显示公共视图!")
            self.assertEqual(slot_machine_view, True, "竖屏没有显示滚轴!")
            self.assertEqual(bg_view, False, "竖屏会显示横屏背景图片!")
            self.assertEqual(bottom_bg_view, True, "竖屏没有显示背景图片!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

        self.common.landscape()
        sleep(1)
        main_view = self.common.main_view_visible()
        common_view = self.common.common_view_visible()
        slot_machine_view = self.common.slot_machine_view_visible()
        bg_view = self.common.bg_view_visible()
        bottom_bg_view = self.common.bottom_bg_view_visible()

        try:
            self.assertEqual(main_view, True, "横屏没有显示主视图!")
            self.assertEqual(common_view, True, "横屏没有显示公共视图!")
            self.assertEqual(slot_machine_view, True, "横屏没有显示滚轴!")
            self.assertEqual(bg_view, True, "横屏没有显示背景图片!")
            self.assertEqual(bottom_bg_view, False, "横屏会显示竖屏背景图片!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise
예제 #8
0
class TestTurboView(unittest.TestCase):
    """ 快速模式窗口模块 """

    def setUp(self):
        self.browser = webdriver.Chrome(executable_path="../../lib/chromedriver.exe")
        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(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        while True:
            i = 0
            game_status = None
            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()

                if game_status is not None:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    self.common.sound_view_yes_btn_click()
                    sleep(1)

            if i == 1 and game_status is None:
                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(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        while True:
            i = 0
            game_status = None
            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()

                if game_status is not None:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    self.common.sound_view_yes_btn_click()
                    sleep(1)

            if i == 1 and game_status is None:
                break

        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(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        while True:
            i = 0
            game_status = None
            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()

                if game_status is not None:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    self.common.sound_view_yes_btn_click()
                    sleep(1)

            if i == 1 and game_status is None:
                break

        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(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        while True:
            i = 0
            game_status = None
            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()

                if game_status is not None:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    self.common.sound_view_yes_btn_click()
                    sleep(1)

            if i == 1 and game_status is None:
                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(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        while True:
            i = 0
            game_status = None
            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()

                if game_status is not None:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    self.common.sound_view_yes_btn_click()
                    sleep(1)

            if i == 1 and game_status is None:
                break

        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_turbo_view_portrait(self):
        """ 竖屏快速模式窗口显示 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        while True:
            i = 0
            game_status = None
            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()

                if game_status is not None:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    self.common.sound_view_yes_btn_click()
                    sleep(1)

            if i == 1 and game_status is None:
                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(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        while True:
            i = 0
            game_status = None
            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()

                if game_status is not None:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    self.common.sound_view_yes_btn_click()
                    sleep(1)

            if i == 1 and game_status is None:
                break

        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(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        while True:
            i = 0
            game_status = None
            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()

                if game_status is not None:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    self.common.sound_view_yes_btn_click()
                    sleep(1)

            if i == 1 and game_status is None:
                break

        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(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        while True:
            i = 0
            game_status = None
            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()

                if game_status is not None:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    self.common.sound_view_yes_btn_click()
                    sleep(1)

            if i == 1 and game_status is None:
                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(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        while True:
            i = 0
            game_status = None
            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()

                if game_status is not None:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    self.common.sound_view_yes_btn_click()
                    sleep(1)

            if i == 1 and game_status is None:
                break

        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_turbo_view_switch_screen(self):
        """ 横竖屏快速模式窗口显示 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        while True:
            i = 0
            game_status = None
            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()

                if game_status is not None:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    self.common.sound_view_yes_btn_click()
                    sleep(1)

            if i == 1 and game_status is None:
                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(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        while True:
            i = 0
            game_status = None
            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()

                if game_status is not None:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    self.common.sound_view_yes_btn_click()
                    sleep(1)

            if i == 1 and game_status is None:
                break

        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(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        while True:
            i = 0
            game_status = None
            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()

                if game_status is not None:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    self.common.sound_view_yes_btn_click()
                    sleep(1)

            if i == 1 and game_status is None:
                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(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        while True:
            i = 0
            game_status = None
            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()

                if game_status is not None:
                    self.browser.refresh()
                    self.common.loading_pass()
                    sleep(1)
                    self.common.sound_view_yes_btn_click()
                    sleep(1)

            if i == 1 and game_status is None:
                break

        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
예제 #9
0
class TestSoundView(unittest.TestCase):
    """ 声音提示窗口模块 """
    def setUp(self):
        self.browser = webdriver.Chrome(
            executable_path="../../lib/chromedriver.exe")
        self.common = Common(self.browser)
        self.common.start()
        self.daf = DirAndFiles()

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

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

    def test_sound_view(self):
        """ 横屏声音窗口内容 """
        self.common.loading_pass()
        sleep(3)
        # 显示
        sound_view_showing = self.common.sound_view_showing()
        mask_view_showing = self.common.mask_view_showing()
        title = self.common.sound_view_text()
        toggle_btn_visible = self.common.sound_view_toggle_btn_visible()
        toggle_text = self.common.sound_view_toggle_text()
        yes_btn_showing = self.common.sound_view_yes_btn_showing()
        yes_btn_text = self.common.sound_view_yes_btn_text()
        no_btn_showing = self.common.sound_view_no_btn_showing()
        no_btn_text = self.common.sound_view_no_btn_text()
        toggle_btn_default_status = self.common.sound_view_toggle_status()
        # 能否点击
        toggle_btn_touchable = self.common.sound_view_toggle_btn_touchable()
        yes_btn_touchable = self.common.sound_view_yes_btn_touchable()
        no_btn_touchable = self.common.sound_view_no_btn_touchable()

        try:
            self.assertEqual(sound_view_showing, True, "横屏声音提示窗口没有显示!")
            self.assertEqual(mask_view_showing, True, "横屏弹出声音提示窗口,灰色蒙板没有显示!")
            self.assertEqual(title, "您想在游戏中打开声音吗?", "横屏声音提示窗口的提示文字错误!")
            self.assertEqual(toggle_btn_visible, True, "横屏声音提示窗口没有显示切换按钮!")
            self.assertEqual(toggle_text, "不再为我显示", "横屏声音提示窗口切换按钮的提示文字错误!")
            self.assertEqual(yes_btn_showing, True, "横屏声音提示窗口没有显示“是”按钮!")
            self.assertEqual(yes_btn_text, "是", "横屏声音提示窗口“是”按钮文字错误!")
            self.assertEqual(no_btn_showing, True, "横屏声音提示窗口没有显示“否”按钮!")
            self.assertEqual(no_btn_text, "否", "横屏声音提示窗口“否”按钮文字错误!")
            self.assertEqual(toggle_btn_default_status, "down",
                             "横屏声音提示窗口切换按钮默认状态为开启!")
            self.assertEqual(toggle_btn_touchable, True, "横屏声音提示窗口切换按钮不能点击!")
            self.assertEqual(yes_btn_touchable, True, "横屏声音提示窗口“是”按钮不可以点击!")
            self.assertEqual(no_btn_touchable, True, "横屏声音提示窗口“否”按钮不可以点击!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_toggle_click(self):
        """ 横屏切换按钮点击 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_toggle_click()
        status = self.common.sound_view_toggle_status()
        try:
            self.assertEqual(status, "up", "横屏声音提示窗口切换按钮点击后,状态不会改变!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_toggle_click_twice(self):
        """ 横屏点击切换按钮两次 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_toggle_click()
        sleep(0.5)
        self.common.sound_view_toggle_click()
        status = self.common.sound_view_toggle_status()
        try:
            self.assertEqual(status, "down", "横屏声音提示窗口切换按钮点击两次后,状态不会恢复!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_toggle_click_refresh_imm(self):
        """ 横屏点击切换按钮后立刻刷新 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_toggle_click()
        sound_status1 = self.common.sound_status()
        voice_btn_status1 = self.common.voice_btn_status()
        self.browser.refresh()
        sleep(1)
        self.common.loading_pass()
        sleep(3)
        dispear = self.common.sound_view_dispear()
        mask_view = self.common.mask_view_showing()
        sound_status2 = self.common.sound_status()
        voice_btn_status2 = self.common.voice_btn_status()
        try:
            self.assertEqual(dispear, None, "横屏点击切换按钮,然后立刻刷新,声音提示窗口依然弹出!")
            self.assertEqual(mask_view, False, "横屏点击切换按钮,然后立刻刷新,灰色蒙板依然显示!")
            self.assertEqual(sound_status2, sound_status1,
                             "横屏点击切换按钮,然后立刻刷新,声音状态刷新前后不一致!")
            self.assertEqual(voice_btn_status2, voice_btn_status1,
                             "横屏点击切换按钮,然后立刻刷新,声音按钮状态刷新前后不一致!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_toggle_click_twice_refresh_imm(self):
        """ 横屏点击切换按钮两次后立刻刷新 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_toggle_click()
        sleep(0.5)
        self.common.sound_view_toggle_click()
        sound_status1 = self.common.sound_status()
        voice_btn_status1 = self.common.voice_btn_status()
        self.browser.refresh()
        sleep(1)
        self.common.loading_pass()
        sleep(3)
        showing = self.common.sound_view_showing()
        mask_view = self.common.mask_view_showing()
        sound_status2 = self.common.sound_status()
        voice_btn_status2 = self.common.voice_btn_status()
        try:
            self.assertEqual(showing, True, "横屏点击切换按钮两次,然后立刻刷新,声音提示窗口不会弹出!")
            self.assertEqual(mask_view, True, "横屏点击切换按钮两次,然后立刻刷新,灰色蒙板不会显示!")
            self.assertEqual(sound_status2, sound_status1,
                             "横屏点击切换按钮两次,然后立刻刷新,声音状态刷新前后不一致!")
            self.assertEqual(voice_btn_status2, voice_btn_status1,
                             "横屏点击切换按钮两次,然后立刻刷新,声音按钮状态刷新前后不一致!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_toggle_click_refresh(self):
        """ 横屏点击切换按钮,窗口自动消失刷新游戏 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_toggle_click()
        sound_status1 = self.common.sound_status()
        voice_btn_status1 = self.common.voice_btn_status()
        sleep(9)
        self.browser.refresh()
        sleep(1)
        self.common.loading_pass()
        sleep(3)
        dispear = self.common.sound_view_dispear()
        mask_view_showing = self.common.mask_view_showing()
        sound_status2 = self.common.sound_status()
        voice_btn_status2 = self.common.voice_btn_status()
        try:
            self.assertEqual(dispear, None,
                             "横屏点击切换按钮,然后等窗口自动消失,刷新后声音提示窗口依然弹出!")
            self.assertEqual(mask_view_showing, False,
                             "横屏点击切换按钮,然后等窗口自动消失,刷新后灰色蒙板依然显示!")
            self.assertEqual(sound_status2, sound_status1,
                             "横屏点击切换按钮,然后等窗口自动消失,刷新后声音状态与刷新前不一致!")
            self.assertEqual(voice_btn_status2, voice_btn_status1,
                             "横屏点击切换按钮,然后等窗口自动消失,刷新后声音按钮状态与刷新前不一致!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_toggle_click_twice_refresh(self):
        """ 横屏点击切换按钮两次,窗口自动消失刷新游戏 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_toggle_click()
        sleep(0.5)
        self.common.sound_view_toggle_click()
        sound_status1 = self.common.sound_status()
        voice_btn_status1 = self.common.voice_btn_status()
        sleep(9)
        self.browser.refresh()
        sleep(1)
        self.common.loading_pass()
        sleep(3)
        showing = self.common.mask_view_showing()
        mask_view_showing = self.common.mask_view_showing()
        sound_status2 = self.common.sound_status()
        voice_btn_status2 = self.common.voice_btn_status()
        try:
            self.assertEqual(showing, True,
                             "横屏点击切换按钮两次,然后等窗口自动消失,刷新后声音提示窗口没有弹出!")
            self.assertEqual(mask_view_showing, True,
                             "横屏点击切换按钮两次,然后等窗口自动消失,刷新后灰色蒙板不会显示!")
            self.assertEqual(sound_status2, sound_status1,
                             "横屏点击切换按钮两次,然后等窗口自动消失,刷新后声音状态余额刷新前不一致!")
            self.assertEqual(voice_btn_status2, voice_btn_status1,
                             "横屏点击切换按钮两次,然后等窗口自动消失,刷新后声音按钮状态与刷新前不一致!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_toggle_click_yes_refresh(self):
        """ 横屏点击切换按钮,点击是按钮刷新游戏 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_toggle_click()
        self.common.sound_view_yes_btn_click()
        sound_status1 = self.common.sound_status()
        voice_btn_status1 = self.common.voice_btn_status()
        self.browser.refresh()
        sleep(1)
        self.common.loading_pass()
        sleep(3)
        dispear = self.common.sound_view_dispear()
        mask_view = self.common.mask_view_showing()
        sound_status2 = self.common.sound_status()
        voice_btn_status2 = self.common.voice_btn_status()
        try:
            self.assertEqual(dispear, None, "横屏点击切换按钮,然后点击是按钮,刷新后声音提示窗口依然弹出!")
            self.assertEqual(mask_view, False, "横屏点击切换按钮,然后点击是按钮,刷新后灰色蒙板依然显示!")
            self.assertEqual(sound_status2, sound_status1,
                             "横屏点击切换按钮,然后点击是按钮,刷新后声音状态与刷新前不一致!")
            self.assertEqual(voice_btn_status2, voice_btn_status1,
                             "横屏点击切换按钮,然后点击是按钮,刷新后声音按钮状态与刷新前不一致!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_toggle_click_twice_yes_refresh(self):
        """ 横屏点击切换按钮两次,点击是按钮刷新游戏 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_toggle_click()
        sleep(0.5)
        self.common.sound_view_toggle_click()
        self.common.sound_view_yes_btn_click()
        sound_status1 = self.common.sound_status()
        voice_btn_status1 = self.common.voice_btn_status()
        self.browser.refresh()
        sleep(1)
        self.common.loading_pass()
        sleep(3)
        showing = self.common.sound_view_showing()
        mask_view = self.common.mask_view_showing()
        sound_status2 = self.common.sound_status()
        voice_btn_status2 = self.common.voice_btn_status()
        try:
            self.assertEqual(showing, True,
                             "横屏点击切换按钮两次,然后点击是按钮,刷新后声音提示窗口不会弹出!")
            self.assertEqual(mask_view, True,
                             "横屏点击切换按钮两次,然后点击是按钮,刷新后灰色蒙板不会显示!")
            self.assertEqual(sound_status2, sound_status1,
                             "横屏点击切换按钮两次,然后点击是按钮,刷新后声音状态与刷新前不一致!")
            self.assertEqual(voice_btn_status2, voice_btn_status1,
                             "横屏点击切换按钮两次,然后点击是按钮,刷新后声音按钮状态与刷新前不一致!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_toggle_click_no_refresh(self):
        """ 横屏点击切换按钮,点击否按钮刷新游戏 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_toggle_click()
        self.common.sound_view_no_btn_click()
        sound_status1 = self.common.sound_status()
        voice_btn_status1 = self.common.voice_btn_status()
        self.browser.refresh()
        sleep(1)
        self.common.loading_pass()
        sleep(3)
        dispear = self.common.sound_view_dispear()
        mask_view = self.common.mask_view_showing()
        sound_status2 = self.common.sound_status()
        voice_btn_status2 = self.common.voice_btn_status()
        try:
            self.assertEqual(dispear, None, "横屏点击切换按钮,然后点击否按钮,刷新后声音提示窗口依然弹出!")
            self.assertEqual(mask_view, False, "横屏点击切换按钮,然后点击否按钮,刷新后灰色蒙板依然显示!")
            self.assertEqual(sound_status2, sound_status1,
                             "横屏点击切换按钮,然后点击否按钮,刷新后声音状态与刷新前不一致!")
            self.assertEqual(voice_btn_status2, voice_btn_status1,
                             "横屏点击切换按钮,然后点击否按钮,刷新后声音按钮状态与刷新前不一致!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_toggle_click_twice_no_refresh(self):
        """ 横屏点击切换按钮两次,点击否按钮刷新游戏 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_toggle_click()
        sleep(0.5)
        self.common.sound_view_toggle_click()
        self.common.sound_view_no_btn_click()
        sound_status1 = self.common.sound_status()
        voice_btn_status1 = self.common.voice_btn_status()
        self.browser.refresh()
        sleep(1)
        self.common.loading_pass()
        sleep(3)
        showing = self.common.sound_view_showing()
        mask_view = self.common.mask_view_showing()
        sound_status2 = self.common.sound_status()
        voice_btn_status2 = self.common.voice_btn_status()
        try:
            self.assertEqual(showing, True,
                             "横屏点击切换按钮两次,然后点击否按钮,刷新后声音提示窗口不会弹出!")
            self.assertEqual(mask_view, True,
                             "横屏点击切换按钮两次,然后点击否按钮,刷新后灰色蒙板不会显示!")
            self.assertEqual(sound_status2, sound_status1,
                             "横屏点击切换按钮两次,然后点击否按钮,刷新后声音状态与刷新前不一致!")
            self.assertEqual(voice_btn_status2, voice_btn_status1,
                             "横屏点击切换按钮两次,然后点击否按钮,刷新后声音按钮状态与刷新前不一致!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_yes_btn_click(self):
        """ 横屏点击是按钮 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sound_view_dispear = self.common.sound_view_dispear()
        mask_view_showing = self.common.mask_view_showing()
        sound_status = self.common.sound_status()
        voice_btn_status = self.common.voice_btn_status()

        try:
            self.assertEqual(sound_view_dispear, None, "横屏点击“是”按钮,声音提示窗口不会消失!")
            self.assertEqual(mask_view_showing, False, "横屏点击“是”按钮,灰色蒙板不会消失!")
            self.assertEqual(sound_status, False, "横屏点击“是”按钮,声音不会播放!")
            self.assertEqual(voice_btn_status, "normal",
                             "横屏点击“是”按钮,声音开关按钮显示关闭!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_no_btn_click(self):
        """ 横屏点击否按钮 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_no_btn_click()
        sound_view_dispear = self.common.sound_view_dispear()
        mask_view_showing = self.common.mask_view_showing()
        sound_status = self.common.sound_status()
        voice_btn_status = self.common.voice_btn_status()

        try:
            self.assertEqual(sound_view_dispear, None, "横屏点击“否”按钮,声音提示窗口不会消失!")
            self.assertEqual(mask_view_showing, False, "横屏点击“否”按钮,灰色蒙板不会消失!")
            self.assertEqual(sound_status, True, "横屏点击“否”按钮,声音会播放!")
            self.assertEqual(voice_btn_status, "silience",
                             "横屏点击“否”按钮,声音开关按钮显示开启!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_turn_on_sound_view_dispear(self):
        """ 横屏开启声音刷新,窗口8秒后自动消失 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        self.browser.refresh()
        sleep(1)
        self.common.loading_pass()
        sleep(9)
        sound_view_dispear = self.common.sound_view_dispear()
        mask_view_showing = self.common.mask_view_showing()
        voice_btn_status = self.common.voice_btn_status()
        sound_status = self.common.sound_status()

        try:
            self.assertEqual(sound_view_dispear, None, "横屏8秒后声音提示窗口没有消失!")
            self.assertEqual(mask_view_showing, False, "横屏8秒后灰色蒙板不会消失!")
            self.assertEqual(voice_btn_status, "normal", "横屏声音按钮状态是关闭!")
            self.assertEqual(sound_status, False, "横屏声音没有播放!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_turn_off_sound_view_dispear(self):
        """ 横屏关闭声音刷新,窗口8秒后自动消失 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_no_btn_click()
        self.browser.refresh()
        sleep(1)
        self.common.loading_pass()
        sleep(9)
        sound_view_dispear = self.common.sound_view_dispear()
        mask_view_showing = self.common.mask_view_showing()
        voice_btn_status = self.common.voice_btn_status()
        sound_status = self.common.sound_status()

        try:
            self.assertEqual(sound_view_dispear, None, "横屏8秒后声音提示窗口没有消失!")
            self.assertEqual(mask_view_showing, False, "横屏8秒后灰色蒙板不会消失!")
            self.assertEqual(voice_btn_status, "normal", "横屏声音按钮状态是关闭!")
            self.assertEqual(sound_status, False, "横屏声音没有播放!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

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

    def test_sound_view_portrait(self):
        """ 竖屏声音窗口内容 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        # 显示
        sound_view_showing = self.common.sound_view_showing()
        mask_view_showing = self.common.mask_view_showing()
        title = self.common.sound_view_text()
        toggle_btn_visible = self.common.sound_view_toggle_btn_visible()
        toggle_text = self.common.sound_view_toggle_text()
        yes_btn_showing = self.common.sound_view_yes_btn_showing()
        yes_btn_text = self.common.sound_view_yes_btn_text()
        no_btn_showing = self.common.sound_view_no_btn_showing()
        no_btn_text = self.common.sound_view_no_btn_text()
        toggle_btn_default_status = self.common.sound_view_toggle_status()
        # 能否点击
        toggle_btn_touchable = self.common.sound_view_toggle_btn_touchable()
        yes_btn_touchable = self.common.sound_view_yes_btn_touchable()
        no_btn_touchable = self.common.sound_view_no_btn_touchable()

        try:
            self.assertEqual(sound_view_showing, True, "竖屏声音提示窗口没有显示!")
            self.assertEqual(mask_view_showing, True, "竖屏弹出声音提示窗口,灰色蒙板没有显示!")
            self.assertEqual(title, "您想在游戏中打开声音吗?", "竖屏声音提示窗口的提示文字错误!")
            self.assertEqual(toggle_btn_visible, True, "竖屏声音提示窗口没有显示切换按钮!")
            self.assertEqual(toggle_text, "不再为我显示", "竖屏声音提示窗口切换按钮的提示文字错误!")
            self.assertEqual(yes_btn_showing, True, "竖屏声音提示窗口没有显示“是”按钮!")
            self.assertEqual(yes_btn_text, "是", "竖屏声音提示窗口“是”按钮文字错误!")
            self.assertEqual(no_btn_showing, True, "竖屏声音提示窗口没有显示“否”按钮!")
            self.assertEqual(no_btn_text, "否", "竖屏声音提示窗口“否”按钮文字错误!")
            self.assertEqual(toggle_btn_default_status, "down",
                             "竖屏声音提示窗口切换按钮默认状态为开启!")
            self.assertEqual(toggle_btn_touchable, True, "竖屏声音提示窗口切换按钮不能点击!")
            self.assertEqual(yes_btn_touchable, True, "竖屏声音提示窗口“是”按钮不可以点击!")
            self.assertEqual(no_btn_touchable, True, "竖屏声音提示窗口“否”按钮不可以点击!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_toggle_click_portrait(self):
        """ 竖屏切换按钮点击 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_toggle_click()
        status = self.common.sound_view_toggle_status()
        try:
            self.assertEqual(status, "up", "竖屏声音提示窗口切换按钮点击后,状态不会改变!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_toggle_click_twice_portrait(self):
        """ 竖屏点击切换按钮两次 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_toggle_click()
        sleep(0.5)
        self.common.sound_view_toggle_click()
        status = self.common.sound_view_toggle_status()
        try:
            self.assertEqual(status, "down", "竖屏声音提示窗口切换按钮点击两次后,状态不会恢复!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_toggle_click_refresh_imm_portrait(self):
        """ 竖屏点击切换按钮后立刻刷新 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_toggle_click()
        sound_status1 = self.common.sound_status()
        voice_btn_status1 = self.common.voice_btn_status()
        self.browser.refresh()
        sleep(1)
        self.common.loading_pass()
        sleep(3)
        dispear = self.common.sound_view_dispear()
        mask_view = self.common.mask_view_showing()
        sound_status2 = self.common.sound_status()
        voice_btn_status2 = self.common.voice_btn_status()
        try:
            self.assertEqual(dispear, None, "竖屏点击切换按钮,然后立刻刷新,声音提示窗口依然弹出!")
            self.assertEqual(mask_view, False, "竖屏点击切换按钮,然后立刻刷新,灰色蒙板依然显示!")
            self.assertEqual(sound_status2, sound_status1,
                             "竖屏点击切换按钮,然后立刻刷新,声音状态刷新前后不一致!")
            self.assertEqual(voice_btn_status2, voice_btn_status1,
                             "竖屏点击切换按钮,然后立刻刷新,声音按钮状态刷新前后不一致!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_toggle_click_twice_refresh_imm_portrait(self):
        """ 竖屏点击切换按钮两次后立刻刷新 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_toggle_click()
        sleep(0.5)
        self.common.sound_view_toggle_click()
        sound_status1 = self.common.sound_status()
        voice_btn_status1 = self.common.voice_btn_status()
        self.browser.refresh()
        sleep(1)
        self.common.loading_pass()
        sleep(3)
        showing = self.common.sound_view_showing()
        mask_view = self.common.mask_view_showing()
        sound_status2 = self.common.sound_status()
        voice_btn_status2 = self.common.voice_btn_status()
        try:
            self.assertEqual(showing, True, "竖屏点击切换按钮两次,然后立刻刷新,声音提示窗口不会弹出!")
            self.assertEqual(mask_view, True, "竖屏点击切换按钮两次,然后立刻刷新,灰色蒙板不会显示!")
            self.assertEqual(sound_status2, sound_status1,
                             "竖屏点击切换按钮两次,然后立刻刷新,声音状态刷新前后不一致!")
            self.assertEqual(voice_btn_status2, voice_btn_status1,
                             "竖屏点击切换按钮两次,然后立刻刷新,声音按钮状态刷新前后不一致!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_toggle_click_refresh_portrait(self):
        """ 竖屏点击切换按钮,窗口自动消失刷新游戏 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_toggle_click()
        sound_status1 = self.common.sound_status()
        voice_btn_status1 = self.common.voice_btn_status()
        sleep(9)
        self.browser.refresh()
        sleep(1)
        self.common.loading_pass()
        sleep(3)
        dispear = self.common.sound_view_dispear()
        mask_view_showing = self.common.mask_view_showing()
        sound_status2 = self.common.sound_status()
        voice_btn_status2 = self.common.voice_btn_status()
        try:
            self.assertEqual(dispear, None,
                             "竖屏点击切换按钮,然后等窗口自动消失,刷新后声音提示窗口依然弹出!")
            self.assertEqual(mask_view_showing, False,
                             "竖屏点击切换按钮,然后等窗口自动消失,刷新后灰色蒙板依然显示!")
            self.assertEqual(sound_status2, sound_status1,
                             "竖屏点击切换按钮,然后等窗口自动消失,刷新后声音状态与刷新前不一致!")
            self.assertEqual(voice_btn_status2, voice_btn_status1,
                             "竖屏点击切换按钮,然后等窗口自动消失,刷新后声音按钮状态与刷新前不一致!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_toggle_click_twice_refresh_portrait(self):
        """ 竖屏点击切换按钮两次,窗口自动消失刷新游戏 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_toggle_click()
        sleep(0.5)
        self.common.sound_view_toggle_click()
        sound_status1 = self.common.sound_status()
        voice_btn_status1 = self.common.voice_btn_status()
        sleep(9)
        self.browser.refresh()
        sleep(1)
        self.common.loading_pass()
        sleep(3)
        showing = self.common.mask_view_showing()
        mask_view_showing = self.common.mask_view_showing()
        sound_status2 = self.common.sound_status()
        voice_btn_status2 = self.common.voice_btn_status()
        try:
            self.assertEqual(showing, True,
                             "竖屏点击切换按钮两次,然后等窗口自动消失,刷新后声音提示窗口没有弹出!")
            self.assertEqual(mask_view_showing, True,
                             "竖屏点击切换按钮两次,然后等窗口自动消失,刷新后灰色蒙板不会显示!")
            self.assertEqual(sound_status2, sound_status1,
                             "竖屏点击切换按钮两次,然后等窗口自动消失,刷新后声音状态余额刷新前不一致!")
            self.assertEqual(voice_btn_status2, voice_btn_status1,
                             "竖屏点击切换按钮两次,然后等窗口自动消失,刷新后声音按钮状态与刷新前不一致!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_toggle_click_yes_refresh_portrait(self):
        """ 竖屏点击切换按钮,点击是按钮刷新游戏 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_toggle_click()
        self.common.sound_view_yes_btn_click()
        sound_status1 = self.common.sound_status()
        voice_btn_status1 = self.common.voice_btn_status()
        self.browser.refresh()
        sleep(1)
        self.common.loading_pass()
        sleep(3)
        dispear = self.common.sound_view_dispear()
        mask_view = self.common.mask_view_showing()
        sound_status2 = self.common.sound_status()
        voice_btn_status2 = self.common.voice_btn_status()
        try:
            self.assertEqual(dispear, None, "竖屏点击切换按钮,然后点击是按钮,刷新后声音提示窗口依然弹出!")
            self.assertEqual(mask_view, False, "竖屏点击切换按钮,然后点击是按钮,刷新后灰色蒙板依然显示!")
            self.assertEqual(sound_status2, sound_status1,
                             "竖屏点击切换按钮,然后点击是按钮,刷新后声音状态与刷新前不一致!")
            self.assertEqual(voice_btn_status2, voice_btn_status1,
                             "竖屏点击切换按钮,然后点击是按钮,刷新后声音按钮状态与刷新前不一致!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_toggle_click_twice_yes_refresh_portrait(self):
        """ 竖屏点击切换按钮两次,点击是按钮刷新游戏 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_toggle_click()
        sleep(0.5)
        self.common.sound_view_toggle_click()
        self.common.sound_view_yes_btn_click()
        sound_status1 = self.common.sound_status()
        voice_btn_status1 = self.common.voice_btn_status()
        self.browser.refresh()
        sleep(1)
        self.common.loading_pass()
        sleep(3)
        showing = self.common.sound_view_showing()
        mask_view = self.common.mask_view_showing()
        sound_status2 = self.common.sound_status()
        voice_btn_status2 = self.common.voice_btn_status()
        try:
            self.assertEqual(showing, True,
                             "竖屏点击切换按钮两次,然后点击是按钮,刷新后声音提示窗口不会弹出!")
            self.assertEqual(mask_view, True,
                             "竖屏点击切换按钮两次,然后点击是按钮,刷新后灰色蒙板不会显示!")
            self.assertEqual(sound_status2, sound_status1,
                             "竖屏点击切换按钮两次,然后点击是按钮,刷新后声音状态与刷新前不一致!")
            self.assertEqual(voice_btn_status2, voice_btn_status1,
                             "竖屏点击切换按钮两次,然后点击是按钮,刷新后声音按钮状态与刷新前不一致!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_toggle_click_no_refresh_portrait(self):
        """ 竖屏点击切换按钮,点击否按钮刷新游戏 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_toggle_click()
        self.common.sound_view_no_btn_click()
        sound_status1 = self.common.sound_status()
        voice_btn_status1 = self.common.voice_btn_status()
        self.browser.refresh()
        sleep(1)
        self.common.loading_pass()
        sleep(3)
        dispear = self.common.sound_view_dispear()
        mask_view = self.common.mask_view_showing()
        sound_status2 = self.common.sound_status()
        voice_btn_status2 = self.common.voice_btn_status()
        try:
            self.assertEqual(dispear, None, "竖屏点击切换按钮,然后点击否按钮,刷新后声音提示窗口依然弹出!")
            self.assertEqual(mask_view, False, "竖屏点击切换按钮,然后点击否按钮,刷新后灰色蒙板依然显示!")
            self.assertEqual(sound_status2, sound_status1,
                             "竖屏点击切换按钮,然后点击否按钮,刷新后声音状态与刷新前不一致!")
            self.assertEqual(voice_btn_status2, voice_btn_status1,
                             "竖屏点击切换按钮,然后点击否按钮,刷新后声音按钮状态与刷新前不一致!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_toggle_click_twice_no_refresh_portrait(self):
        """ 竖屏点击切换按钮两次,点击否按钮刷新游戏 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_toggle_click()
        sleep(0.5)
        self.common.sound_view_toggle_click()
        self.common.sound_view_no_btn_click()
        sound_status1 = self.common.sound_status()
        voice_btn_status1 = self.common.voice_btn_status()
        self.browser.refresh()
        sleep(1)
        self.common.loading_pass()
        sleep(3)
        showing = self.common.sound_view_showing()
        mask_view = self.common.mask_view_showing()
        sound_status2 = self.common.sound_status()
        voice_btn_status2 = self.common.voice_btn_status()
        try:
            self.assertEqual(showing, True,
                             "竖屏点击切换按钮两次,然后点击否按钮,刷新后声音提示窗口不会弹出!")
            self.assertEqual(mask_view, True,
                             "竖屏点击切换按钮两次,然后点击否按钮,刷新后灰色蒙板不会显示!")
            self.assertEqual(sound_status2, sound_status1,
                             "竖屏点击切换按钮两次,然后点击否按钮,刷新后声音状态与刷新前不一致!")
            self.assertEqual(voice_btn_status2, voice_btn_status1,
                             "竖屏点击切换按钮两次,然后点击否按钮,刷新后声音按钮状态与刷新前不一致!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_yes_btn_click_portrait(self):
        """ 竖屏点击是按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sound_view_dispear = self.common.sound_view_dispear()
        mask_view_showing = self.common.mask_view_showing()
        sound_status = self.common.sound_status()
        voice_btn_status = self.common.voice_btn_status()

        try:
            self.assertEqual(sound_view_dispear, None, "竖屏点击“是”按钮,声音提示窗口不会消失!")
            self.assertEqual(mask_view_showing, False, "竖屏点击“是”按钮,灰色蒙板不会消失!")
            self.assertEqual(sound_status, False, "竖屏点击“是”按钮,声音不会播放!")
            self.assertEqual(voice_btn_status, "normal",
                             "竖屏点击“是”按钮,声音开关按钮显示关闭!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_no_btn_click_portrait(self):
        """ 竖屏点击否按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_no_btn_click()
        sound_view_dispear = self.common.sound_view_dispear()
        mask_view_showing = self.common.mask_view_showing()
        sound_status = self.common.sound_status()
        voice_btn_status = self.common.voice_btn_status()

        try:
            self.assertEqual(sound_view_dispear, None, "竖屏点击“否”按钮,声音提示窗口不会消失!")
            self.assertEqual(mask_view_showing, False, "竖屏点击“否”按钮,灰色蒙板不会消失!")
            self.assertEqual(sound_status, True, "竖屏点击“否”按钮,声音会播放!")
            self.assertEqual(voice_btn_status, "silience",
                             "竖屏点击“否”按钮,声音开关按钮显示开启!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_turn_on_sound_portrait(self):
        """ 竖屏开启声音刷新,窗口8秒后自动消失 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        self.browser.refresh()
        sleep(1)
        self.common.loading_pass()
        sleep(9)
        sound_view_dispear = self.common.sound_view_dispear()
        mask_view_showing = self.common.mask_view_showing()
        voice_btn_status = self.common.voice_btn_status()
        sound_status = self.common.sound_status()

        try:
            self.assertEqual(sound_view_dispear, None, "竖屏8秒后声音提示窗口没有消失!")
            self.assertEqual(mask_view_showing, False, "竖屏8秒后灰色蒙板不会消失!")
            self.assertEqual(voice_btn_status, "normal", "竖屏声音按钮状态是关闭!")
            self.assertEqual(sound_status, False, "竖屏声音没有播放!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_turn_off_sound_portrait(self):
        """ 竖屏关闭声音刷新,窗口8秒后自动消失 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_no_btn_click()
        self.browser.refresh()
        sleep(1)
        self.common.loading_pass()
        sleep(9)
        sound_view_dispear = self.common.sound_view_dispear()
        mask_view_showing = self.common.mask_view_showing()
        voice_btn_status = self.common.voice_btn_status()
        sound_status = self.common.sound_status()

        try:
            self.assertEqual(sound_view_dispear, None, "竖屏8秒后声音提示窗口没有消失!")
            self.assertEqual(mask_view_showing, False, "竖屏8秒后灰色蒙板不会消失!")
            self.assertEqual(voice_btn_status, "normal", "竖屏声音按钮状态是关闭!")
            self.assertEqual(sound_status, False, "竖屏声音没有播放!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    #
    #
    # ------------------------------------------------------------------------ 横竖屏切换 ------------------------------------------------------------------------
    #
    #

    def test_sound_view_switch_screen(self):
        """ 横竖屏声音窗口内容 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.landscape()
        sleep(1)
        self.common.portrait()
        sleep(1)
        # 显示
        sound_view_showing = self.common.sound_view_showing()
        mask_view_showing = self.common.mask_view_showing()
        title = self.common.sound_view_text()
        toggle_btn_visible = self.common.sound_view_toggle_btn_visible()
        toggle_text = self.common.sound_view_toggle_text()
        yes_btn_showing = self.common.sound_view_yes_btn_showing()
        yes_btn_text = self.common.sound_view_yes_btn_text()
        no_btn_showing = self.common.sound_view_no_btn_showing()
        no_btn_text = self.common.sound_view_no_btn_text()
        toggle_btn_default_status = self.common.sound_view_toggle_status()
        # 能否点击
        toggle_btn_touchable = self.common.sound_view_toggle_btn_touchable()
        yes_btn_touchable = self.common.sound_view_yes_btn_touchable()
        no_btn_touchable = self.common.sound_view_no_btn_touchable()

        try:
            self.assertEqual(sound_view_showing, True, "横竖屏切换,声音提示窗口没有显示!")
            self.assertEqual(mask_view_showing, True,
                             "横竖屏切换,弹出声音提示窗口,灰色蒙板没有显示!")
            self.assertEqual(title, "您想在游戏中打开声音吗?", "横竖屏切换,声音提示窗口的提示文字错误!")
            self.assertEqual(toggle_btn_visible, True, "横竖屏切换,声音提示窗口没有显示切换按钮!")
            self.assertEqual(toggle_text, "不再为我显示", "横竖屏切换,声音提示窗口切换按钮的提示文字错误!")
            self.assertEqual(yes_btn_showing, True, "横竖屏切换,声音提示窗口没有显示“是”按钮!")
            self.assertEqual(yes_btn_text, "是", "横竖屏切换,声音提示窗口“是”按钮文字错误!")
            self.assertEqual(no_btn_showing, True, "横竖屏切换,声音提示窗口没有显示“否”按钮!")
            self.assertEqual(no_btn_text, "否", "横竖屏切换,声音提示窗口“否”按钮文字错误!")
            self.assertEqual(toggle_btn_default_status, "down",
                             "横竖屏切换,声音提示窗口切换按钮默认状态为开启!")
            self.assertEqual(toggle_btn_touchable, True,
                             "横竖屏切换,声音提示窗口切换按钮不能点击!")
            self.assertEqual(yes_btn_touchable, True,
                             "横竖屏切换,声音提示窗口“是”按钮不可以点击!")
            self.assertEqual(no_btn_touchable, True, "横竖屏切换,声音提示窗口“否”按钮不可以点击!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_toggle_click_switch_screen(self):
        """ 横竖屏点击切换按钮 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_toggle_click()
        self.common.portrait()
        sleep(1)
        self.common.landscape()
        sleep(1)
        self.common.portrait()
        sleep(1)
        status = self.common.sound_view_toggle_status()
        try:
            self.assertEqual(status, "up", "声音提示窗口切换按钮点击后,横竖屏切换,状态不会改变!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_toggle_click_refresh_imm_switch_screen(self):
        """ 横竖屏点击切换按钮后立刻刷新 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_toggle_click()
        sound_status1 = self.common.sound_status()
        voice_btn_status1 = self.common.voice_btn_status()
        self.browser.refresh()
        sleep(1)
        self.common.loading_pass()
        sleep(3)
        self.common.portrait()
        sleep(1)
        self.common.landscape()
        sleep(1)
        self.common.portrait()
        sleep(1)
        dispear = self.common.sound_view_dispear()
        mask_view_showing = self.common.mask_view_showing()
        sound_status2 = self.common.sound_status()
        voice_btn_status2 = self.common.voice_btn_status()
        try:
            self.assertEqual(dispear, None, "点击切换按钮后立刻刷新,横竖屏切换,声音提示窗口依然弹出!")
            self.assertEqual(mask_view_showing, False,
                             "点击切换按钮后立刻刷新,横竖屏切换,灰色蒙板会显示!")
            self.assertEqual(sound_status2, sound_status1,
                             "点击切换按钮后立刻刷新,横竖屏切换,声音状态刷新前后不一致!")
            self.assertEqual(voice_btn_status2, voice_btn_status1,
                             "点击切换按钮后立刻刷新,横竖屏切换,声音按钮状态刷新前后不一致!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_toggle_click_refresh_switch_screen(self):
        """ 横竖屏点击切换按钮,窗口自动消失刷新游戏 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_toggle_click()
        sound_status1 = self.common.sound_status()
        voice_btn_status1 = self.common.voice_btn_status()
        sleep(9)
        self.browser.refresh()
        sleep(1)
        self.common.loading_pass()
        sleep(3)
        self.common.portrait()
        sleep(1)
        self.common.landscape()
        sleep(1)
        self.common.portrait()
        sleep(1)
        dispear = self.common.sound_view_dispear()
        mask_view_showing = self.common.mask_view_showing()
        sound_status2 = self.common.sound_status()
        voice_btn_status2 = self.common.voice_btn_status()
        try:
            self.assertEqual(dispear, None,
                             "点击切换按钮后等待窗口自动消失,刷新游戏然后横竖屏切换,声音提示窗口依然弹出!")
            self.assertEqual(mask_view_showing, False,
                             "点击切换按钮后等待窗口自动消失,刷新游戏然后横竖屏切换,灰色蒙板依然显示!")
            self.assertEqual(sound_status2, sound_status1,
                             "点击切换按钮后等待窗口自动消失,刷新游戏然后横竖屏切换,声音状态刷新前后不一致!")
            self.assertEqual(voice_btn_status2, voice_btn_status1,
                             "点击切换按钮后等待窗口自动消失,刷新游戏然后横竖屏切换,声音按钮状态刷新前后不一致!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_toggle_click_yes_refresh_switch_screen(self):
        """ 横竖屏点击切换按钮,点击是按钮刷新游戏 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_toggle_click()
        self.common.sound_view_yes_btn_click()
        sound_status1 = self.common.sound_status()
        voice_btn_status1 = self.common.voice_btn_status()
        self.browser.refresh()
        sleep(1)
        self.common.loading_pass()
        sleep(3)
        self.common.portrait()
        sleep(1)
        self.common.landscape()
        sleep(1)
        self.common.portrait()
        sleep(1)
        dispear = self.common.sound_view_dispear()
        mask_view_showing = self.common.mask_view_showing()
        sound_status2 = self.common.sound_status()
        voice_btn_status2 = self.common.voice_btn_status()
        try:
            self.assertEqual(dispear, None,
                             "点击切换按钮后点击是按钮,刷新游戏然后横竖屏切换,声音提示窗口依然弹出!")
            self.assertEqual(mask_view_showing, False,
                             "点击切换按钮后点击是按钮,刷新游戏然后横竖屏切换,灰色蒙板会显示!")
            self.assertEqual(sound_status2, sound_status1,
                             "点击切换按钮后点击是按钮,刷新游戏然后横竖屏切换,声音状态刷新前后不一致!")
            self.assertEqual(voice_btn_status2, voice_btn_status1,
                             "点击切换按钮后点击是按钮,刷新游戏然后横竖屏切换,声音按钮状态刷新前后不一致!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_toggle_click_no_refresh_switch_screen(self):
        """ 横竖屏点击切换按钮,点击否按钮刷新游戏 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_toggle_click()
        self.common.sound_view_no_btn_click()
        sound_status1 = self.common.sound_status()
        voice_btn_status1 = self.common.voice_btn_status()
        self.browser.refresh()
        sleep(1)
        self.common.loading_pass()
        sleep(3)
        self.common.portrait()
        sleep(1)
        self.common.landscape()
        sleep(1)
        self.common.portrait()
        sleep(1)
        dispear = self.common.sound_view_dispear()
        mask_view_showing = self.common.mask_view_showing()
        sound_status2 = self.common.sound_status()
        voice_btn_status2 = self.common.voice_btn_status()
        try:
            self.assertEqual(dispear, None,
                             "点击切换按钮后点击否按钮,刷新游戏然后横竖屏切换,声音提示窗口依然弹出!")
            self.assertEqual(mask_view_showing, False,
                             "点击切换按钮后点击否按钮,刷新游戏然后横竖屏切换,灰色蒙板会显示!")
            self.assertEqual(sound_status2, sound_status1,
                             "点击切换按钮后点击否按钮,刷新游戏然后横竖屏切换,声音状态刷新前后不一致!")
            self.assertEqual(voice_btn_status2, voice_btn_status1,
                             "点击切换按钮后点击否按钮,刷新游戏然后横竖屏切换,声音按钮状态刷新前后不一致!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_yes_btn_click_switch_screen(self):
        """ 横竖屏点击是按钮 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        self.common.portrait()
        sleep(1)
        self.common.landscape()
        sleep(1)
        self.common.portrait()
        sleep(1)
        sound_view_dispear = self.common.sound_view_dispear()
        mask_view_showing = self.common.mask_view_showing()
        sound_status = self.common.sound_status()
        voice_btn_status = self.common.voice_btn_status()

        try:
            self.assertEqual(sound_view_dispear, None,
                             "点击是按钮,横竖屏切换,声音提示窗口不会消失!")
            self.assertEqual(mask_view_showing, False, "点击是按钮,横竖屏切换,灰色蒙板不会消失!")
            self.assertEqual(sound_status, False, "点击是按钮,横竖屏切换,声音不会播放!")
            self.assertEqual(voice_btn_status, "normal",
                             "点击是按钮,横竖屏切换,声音开关按钮显示关闭!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_no_btn_click_switch_screen(self):
        """ 横竖屏点击否按钮 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_no_btn_click()
        self.common.portrait()
        sleep(1)
        self.common.landscape()
        sleep(1)
        self.common.portrait()
        sleep(1)
        sound_view_dispear = self.common.sound_view_dispear()
        mask_view_showing = self.common.mask_view_showing()
        sound_status = self.common.sound_status()
        voice_btn_status = self.common.voice_btn_status()

        try:
            self.assertEqual(sound_view_dispear, None,
                             "点击否按钮,横竖屏切换,声音提示窗口不会消失!")
            self.assertEqual(mask_view_showing, False, "点击否按钮,横竖屏切换,灰色蒙板不会消失!")
            self.assertEqual(sound_status, True, "点击否按钮,横竖屏切换,声音会播放!")
            self.assertEqual(voice_btn_status, "silience",
                             "点击否按钮,横竖屏切换,声音开关按钮显示开启!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_turn_on_sound_switch_screen(self):
        """ 横竖屏开启声音刷新游戏,窗口8秒后自动消失 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        self.browser.refresh()
        sleep(1)
        self.common.loading_pass()
        sleep(9)
        self.common.portrait()
        sleep(1)
        self.common.landscape()
        sleep(1)
        self.common.portrait()
        sleep(1)
        sound_view_dispear = self.common.sound_view_dispear()
        mask_view_showing = self.common.mask_view_showing()
        voice_btn_status = self.common.voice_btn_status()
        sound_status = self.common.sound_status()

        try:
            self.assertEqual(sound_view_dispear, None,
                             "开启声音刷新游戏,等待窗口自动消失,横竖屏切换,声音提示窗口没有消失!")
            self.assertEqual(mask_view_showing, False,
                             "开启声音刷新游戏,等待窗口自动消失,横竖屏切换,灰色蒙板不会消失!")
            self.assertEqual(voice_btn_status, "normal",
                             "开启声音刷新游戏,等待窗口自动消失,横竖屏切换,声音按钮状态是关闭!")
            self.assertEqual(sound_status, False,
                             "开启声音刷新游戏,等待窗口自动消失,横竖屏切换,声音没有播放!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_turn_off_sound_switch_screen(self):
        """ 横竖屏关闭声音刷新游戏,窗口8秒后自动消失 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_no_btn_click()
        self.browser.refresh()
        sleep(1)
        self.common.loading_pass()
        sleep(9)
        self.common.portrait()
        sleep(1)
        self.common.landscape()
        sleep(1)
        self.common.portrait()
        sleep(1)
        sound_view_dispear = self.common.sound_view_dispear()
        mask_view_showing = self.common.mask_view_showing()
        voice_btn_status = self.common.voice_btn_status()
        sound_status = self.common.sound_status()

        try:
            self.assertEqual(sound_view_dispear, None,
                             "关闭声音刷新游戏,等待窗口自动消失,横竖屏切换,声音提示窗口没有消失!")
            self.assertEqual(mask_view_showing, False,
                             "关闭声音刷新游戏,等待窗口自动消失,横竖屏切换,灰色蒙板不会消失!")
            self.assertEqual(voice_btn_status, "normal",
                             "关闭声音刷新游戏,等待窗口自动消失,横竖屏切换,声音按钮状态是关闭!")
            self.assertEqual(sound_status, False,
                             "关闭声音刷新游戏,等待窗口自动消失,横竖屏切换,声音没有播放!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise
예제 #10
0
class TestLoginMode(unittest.TestCase):
    """ 登录状态模块 """

    def setUp(self):
        self.browser = webdriver.Chrome(executable_path="../../lib/chromedriver.exe")
        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(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_btn_click()
        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(3)
        self.common.sound_view_yes_btn_click()
        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
예제 #11
0
class TestSettingView(unittest.TestCase):
    """ 线数线注设置模块 """
    def setUp(self):
        self.browser = webdriver.Chrome(
            executable_path="../../lib/chromedriver.exe")
        self.common = Common(self.browser)
        self.common.start()
        self.daf = DirAndFiles()

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

    # 初始化满线参数 True, False
    full_line = Common().full_line

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

    def test_setting_btn_visible(self):
        """ 横屏显示线数线注设置按钮 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        # 显示
        setting_btn = self.common.setting_btn_visible()
        # 能否点击
        setting_btn_touchable = self.common.setting_btn_touchable()
        try:
            self.assertEqual(setting_btn, True, "横屏没有显示线数线注设置按钮!")
            self.assertEqual(setting_btn_touchable, True, "横屏线数线注设置按钮无法点击!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_setting_btn_click_show_view(self):
        """ 横屏点击线数线注设置按钮 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.setting_btn_click()
        sleep(1)
        showing = self.common.setting_view_showing()
        mask = self.common.mask_view_showing()
        try:
            self.assertEqual(showing, True, "横屏点击线数线注设置按钮,不会弹出对应的面板!")
            self.assertEqual(mask, True, "横屏点击线数线注设置按钮,不会显示灰色蒙板!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_click_mask_setting_view_dispear(self):
        """ 横屏点击蒙板可以关闭面板 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.setting_btn_click()
        sleep(1)
        self.common.mask_view_click()
        sleep(1)
        dispear = self.common.setting_view_dispear()
        mask = self.common.mask_view_showing()
        try:
            self.assertEqual(dispear, None, "横屏点击灰色蒙板,线数线注设置面板不会消失!")
            self.assertEqual(mask, False, "横屏点击灰色蒙板,灰色蒙板不会消失!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_click_close_btn_view_dispear(self):
        """ 横屏点击关闭按钮面板消失 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.setting_btn_click()
        sleep(1)
        self.common.setting_view_close_btn_click()
        sleep(1)
        dispear = self.common.setting_view_dispear()
        mask = self.common.mask_view_showing()
        try:
            self.assertEqual(dispear, None, "横屏点击线数线注设置面板的关闭按钮,面板不会消失!")
            self.assertEqual(mask, False, "横屏点击线数线注设置面板的关闭按钮,灰色蒙板不会消失!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    @unittest.skipIf(full_line is True, "满线项目不测试线数设置")
    def test_setting_view_line_num(self):
        """ 横屏面板线数标题文字按钮 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.setting_btn_click()
        sleep(1)
        # 文本
        line_num_text = self.common.setting_view_line_num_text()
        current_line_num = self.common.setting_view_line_num()
        target_line_num = str(self.common.line_num_max)
        info_bar_line_num = self.common.info_bar_view_line_num_label()
        # 显示
        line_num_min_btn = self.common.setting_view_line_num_min_btn_visible()
        line_num_plus_btn = self.common.setting_view_line_num_plus_btn_visible(
        )
        # 能否点击
        line_num_min_btn_touchable = self.common.setting_view_line_num_min_btn_touchable(
        )
        line_num_plus_btn_touchable = self.common.setting_view_line_num_plus_btn_touchable(
        )
        try:
            self.assertEqual(line_num_text, "线", "横屏线数线注设置面板,线数的标题错误!")
            self.assertEqual(current_line_num, target_line_num,
                             "横屏线数线注设置面板,默认显示的线数不是最大值!")
            self.assertEqual(info_bar_line_num, current_line_num,
                             "横屏线数线注设置面板,线数数值与下导航栏的不一致!")
            self.assertEqual(line_num_min_btn, True, "横屏线数线注设置面板,不会显示线数 - 按钮!")
            self.assertEqual(line_num_min_btn_touchable, True,
                             "横屏线数线注设置面板,线数 - 按钮默认不能点击!")
            self.assertEqual(line_num_plus_btn, True,
                             "横屏线数线注设置面板,不会显示线数 + 按钮!")
            self.assertEqual(line_num_plus_btn_touchable, False,
                             "横屏线数线注设置面板,线数 + 按钮默认可以点击!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    @unittest.skipIf(full_line is True, "满线项目不测试线数设置")
    def test_line_num_min_btn_click(self):
        """ 横屏面板线数 - 按钮点击 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.setting_btn_click()
        sleep(1)

        target_line_num = self.common.line_num_max
        for i in reversed(range(1, int(target_line_num))):
            self.common.setting_view_line_num_min_btn_click()
            sleep(1)
            current_line_num = self.common.setting_view_line_num()
            info_bar_line_num = self.common.info_bar_view_line_num_label()
            line_num_min_touchable = self.common.setting_view_line_num_min_btn_touchable(
            )
            line_num_plus_touchable = self.common.setting_view_line_num_plus_btn_touchable(
            )
            if i > 1:
                try:
                    self.assertEqual(current_line_num, str(i),
                                     "横屏点击线数线注设置面板的 - 按钮,线数错误!")
                    self.assertEqual(info_bar_line_num, current_line_num,
                                     "横屏点击线数线注设置面板的 - 按钮,面板线数与下导航栏的线数不一致!")
                    self.assertEqual(line_num_min_touchable, True,
                                     "横屏点击线数线注设置面板的 - 按钮,线数不是最小值,- 按钮不可以点击!")
                    self.assertEqual(line_num_plus_touchable, True,
                                     "横屏点击线数线注设置面板的 - 按钮,线数不是最大值,+ 按钮不可以点击!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise
            else:
                try:
                    self.assertEqual(current_line_num, str(i),
                                     "横屏点击线数线注设置面板的 - 按钮,线数错误!")
                    self.assertEqual(info_bar_line_num, current_line_num,
                                     "横屏点击线数线注设置面板的 - 按钮,面板线数与下导航栏的线数不一致!")
                    self.assertEqual(line_num_min_touchable, False,
                                     "横屏点击线数线注设置面板的 - 按钮,线数是最小值,- 按钮可以点击!")
                    self.assertEqual(line_num_plus_touchable, True,
                                     "横屏点击线数线注设置面板的 - 按钮,线数不是最大值,+ 按钮不可以点击!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise

    @unittest.skipIf(full_line is True, "满线项目不测试线数设置")
    def test_line_num_plus_btn_click(self):
        """ 横屏面板线数 + 按钮点击 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.setting_btn_click()
        sleep(1)

        target_line_num = self.common.line_num_max

        for i in range(1, int(target_line_num)):
            self.common.setting_view_line_num_min_btn_click()

        sleep(1)

        for i in range(2, int(target_line_num) + 1):
            self.common.setting_view_line_num_plus_btn_click()
            sleep(1)
            current_line_num = self.common.setting_view_line_num()
            info_bar_line_num = self.common.info_bar_view_line_num_label()
            line_num_min_touchable = self.common.setting_view_line_num_min_btn_touchable(
            )
            line_num_plus_touchable = self.common.setting_view_line_num_plus_btn_touchable(
            )
            if i < int(target_line_num):
                try:
                    self.assertEqual(current_line_num, str(i),
                                     "横屏点击线数线注设置面板的 + 按钮,线数错误!")
                    self.assertEqual(info_bar_line_num, current_line_num,
                                     "横屏点击线数线注设置面板的 + 按钮,面板线数与下导航栏的线数不一致!")
                    self.assertEqual(line_num_min_touchable, True,
                                     "横屏点击线数线注设置面板的 + 按钮,线数不是最小值,- 按钮不可以点击!")
                    self.assertEqual(line_num_plus_touchable, True,
                                     "横屏点击线数线注设置面板的 + 按钮,线数不是最大值,+ 按钮不可以点击!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise
            else:
                try:
                    self.assertEqual(current_line_num, str(i),
                                     "横屏点击线数线注设置面板的 + 按钮,线数错误!")
                    self.assertEqual(info_bar_line_num, current_line_num,
                                     "横屏点击线数线注设置面板的 + 按钮,面板线数与下导航栏的线数不一致!")
                    self.assertEqual(line_num_min_touchable, True,
                                     "横屏点击线数线注设置面板的 + 按钮,线数不是最小值,- 按钮不可以点击!")
                    self.assertEqual(line_num_plus_touchable, False,
                                     "横屏点击线数线注设置面板的 + 按钮,线数是最大值,+ 按钮可以点击!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise

    def test_setting_view_btn_status(self):
        """ 横屏面板按钮状态 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.setting_btn_click()
        sleep(1)
        # 文本
        line_cost_text = self.common.setting_view_line_cost_text()

        current_line_cost = self.common.setting_view_line_cost()
        # 转化为货币格式
        locale.setlocale(locale.LC_ALL, "")
        target_line_cost = "¥" + locale.format(
            "%.2f", self.common.line_cost[0] / 100, 1)
        info_bar_line_cost = self.common.info_bar_view_line_cost_label()

        # 显示
        close_btn = self.common.setting_view_close_btn_visible()
        line_cost_min_btn = self.common.setting_view_line_cost_min_btn_visible(
        )
        line_cost_plus_btn = self.common.setting_view_line_cost_plus_btn_visible(
        )

        # 能否点击
        close_btn_touchable = self.common.setting_view_close_btn_touchable()
        line_cost_min_btn_touchable = self.common.setting_view_line_cost_min_btn_touchable(
        )
        line_cost_plus_btn_touchable = self.common.setting_view_line_cost_plus_btn_touchable(
        )
        try:
            self.assertEqual(close_btn, True, "横屏线数线注设置面板不会显示关闭按钮!")
            self.assertEqual(close_btn_touchable, True, "横屏线数线注设置面板,关闭按钮不能点击!")
            self.assertEqual(line_cost_text, "线注", "横屏线数线注设置面板,线注的标题错误!")
            self.assertEqual(current_line_cost, target_line_cost,
                             "横屏线数线注设置面板,默认显示的线注不是最小值!")
            self.assertEqual(info_bar_line_cost, current_line_cost,
                             "横屏线数线注设置面板,线注数值与下导航栏的不一致!")
            self.assertEqual(line_cost_min_btn, True,
                             "横屏线数线注设置面板,不会显示线注 - 按钮!")
            self.assertEqual(line_cost_min_btn_touchable, False,
                             "横屏线数线注设置面板,线注 - 按钮默认可以点击!")
            self.assertEqual(line_cost_plus_btn, True,
                             "横屏线数线注设置面板,不会显示线注 + 按钮!")
            self.assertEqual(line_cost_plus_btn_touchable, True,
                             "横屏线数线注设置面板,线注 + 按钮默认不可以点击!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_line_cost_plus_btn_click(self):
        """ 横屏面板线注 + 按钮点击 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.setting_btn_click()
        sleep(1)

        # 转化为货币格式
        locale.setlocale(locale.LC_ALL, "")
        cost_len = len(self.common.line_cost)
        for i in range(1, cost_len):
            self.common.setting_view_line_cost_plus_btn_click()
            sleep(1)
            current_line_cost = self.common.setting_view_line_cost()
            target_line_cost = "¥" + locale.format(
                "%.2f", self.common.line_cost[i] / 100, 1)
            info_bar_line_cost = self.common.info_bar_view_line_cost_label()
            line_cost_min_btn_touchable = self.common.setting_view_line_cost_min_btn_touchable(
            )
            line_cost_plus_btn_touchable = self.common.setting_view_line_cost_plus_btn_touchable(
            )

            if i < (cost_len - 1):
                try:
                    self.assertEqual(current_line_cost, target_line_cost,
                                     "横屏点击线数线注设置面板的 + 按钮,线注错误!")
                    self.assertEqual(info_bar_line_cost, current_line_cost,
                                     "横屏点击线数线注设置面板的 + 按钮,面板线注与下导航栏的不一致!")
                    self.assertEqual(
                        line_cost_min_btn_touchable, True,
                        "横屏点击线数线注设置面板的 + 按钮,线注不是最小值,线注 - 按钮不能点击!")
                    self.assertEqual(
                        line_cost_plus_btn_touchable, True,
                        "横屏点击线数线注设置面板的 + 按钮,线注不是最大值,线注 + 按钮不能点击!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise
            else:
                try:
                    self.assertEqual(current_line_cost, target_line_cost,
                                     "横屏点击线数线注设置面板的 + 按钮,线注错误!")
                    self.assertEqual(info_bar_line_cost, current_line_cost,
                                     "横屏点击线数线注设置面板的 + 按钮,面板线注与下导航栏的不一致!")
                    self.assertEqual(
                        line_cost_min_btn_touchable, True,
                        "横屏点击线数线注设置面板的 + 按钮,线注不是最小值,线注 - 按钮不能点击!")
                    self.assertEqual(line_cost_plus_btn_touchable, False,
                                     "横屏点击线数线注设置面板的 + 按钮,线注是最大值,线注 + 按钮可以点击!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise

    def test_line_cost_min_btn_click(self):
        """ 横屏面板线注 - 按钮点击 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.setting_btn_click()
        sleep(1)

        # 转化为货币格式
        locale.setlocale(locale.LC_ALL, "")
        cost_len = len(self.common.line_cost)

        for i in range(1, cost_len):
            self.common.setting_view_line_cost_plus_btn_click()

        sleep(1)

        for i in reversed(range(cost_len - 1)):
            self.common.setting_view_line_cost_min_btn_click()
            sleep(1)
            current_line_cost = self.common.setting_view_line_cost()
            target_line_cost = "¥" + locale.format(
                "%.2f", self.common.line_cost[i] / 100, 1)
            info_bar_line_cost = self.common.info_bar_view_line_cost_label()
            line_cost_min_btn_touchable = self.common.setting_view_line_cost_min_btn_touchable(
            )
            line_cost_plus_btn_touchable = self.common.setting_view_line_cost_plus_btn_touchable(
            )

            if i > 0:
                try:
                    self.assertEqual(current_line_cost, target_line_cost,
                                     "横屏点击线数线注设置面板的 - 按钮,线注错误!")
                    self.assertEqual(info_bar_line_cost, current_line_cost,
                                     "横屏点击线数线注设置面板的 - 按钮,面板线注与下导航栏的不一致!")
                    self.assertEqual(
                        line_cost_min_btn_touchable, True,
                        "横屏点击线数线注设置面板的 - 按钮,线注不是最小值,线注 - 按钮不能点击!")
                    self.assertEqual(
                        line_cost_plus_btn_touchable, True,
                        "横屏点击线数线注设置面板的 - 按钮,线注不是最大值,线注 + 按钮不能点击!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise
            else:
                try:
                    self.assertEqual(current_line_cost, target_line_cost,
                                     "横屏点击线数线注设置面板的 - 按钮,线注错误!")
                    self.assertEqual(info_bar_line_cost, current_line_cost,
                                     "横屏点击线数线注设置面板的 - 按钮,面板线注与下导航栏的不一致!")
                    self.assertEqual(line_cost_min_btn_touchable, False,
                                     "横屏点击线数线注设置面板的 - 按钮,线注是最小值,线注 - 按钮可以点击!")
                    self.assertEqual(
                        line_cost_plus_btn_touchable, True,
                        "横屏点击线数线注设置面板的 - 按钮,线注是最小值,线注 + 按钮不可以点击!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise

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

    def test_setting_btn_visible_portrait(self):
        """ 竖屏显示线数线注设置按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        # 显示
        setting_btn = self.common.setting_btn_visible()
        # 能否点击
        setting_btn_touchable = self.common.setting_btn_touchable()
        try:
            self.assertEqual(setting_btn, True, "竖屏没有显示线数线注设置按钮!")
            self.assertEqual(setting_btn_touchable, True, "竖屏线数线注设置按钮无法点击!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_setting_btn_click_show_view_portrait(self):
        """ 竖屏点击线数线注设置按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.setting_btn_click()
        sleep(1)
        showing = self.common.setting_view_showing()
        mask = self.common.mask_view_showing()
        try:
            self.assertEqual(showing, True, "竖屏点击线数线注设置按钮,不会弹出对应的面板!")
            self.assertEqual(mask, True, "竖屏点击线数线注设置按钮,不会显示灰色蒙板!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_click_mask_setting_view_dispear_portrait(self):
        """ 竖屏点击蒙板可以关闭面板 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.setting_btn_click()
        sleep(1)
        self.common.mask_view_click()
        sleep(1)
        dispear = self.common.setting_view_dispear()
        mask = self.common.mask_view_showing()
        try:
            self.assertEqual(dispear, None, "竖屏点击灰色蒙板,线数线注设置面板不会消失!")
            self.assertEqual(mask, False, "竖屏点击灰色蒙板,灰色蒙板不会消失!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_click_close_btn_view_dispear_portrait(self):
        """ 竖屏点击关闭按钮面板消失 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.setting_btn_click()
        sleep(1)
        self.common.setting_view_close_btn_click()
        sleep(1)
        dispear = self.common.setting_view_dispear()
        mask = self.common.mask_view_showing()
        try:
            self.assertEqual(dispear, None, "竖屏点击线数线注设置面板的关闭按钮,面板不会消失!")
            self.assertEqual(mask, False, "竖屏点击线数线注设置面板的关闭按钮,灰色蒙板不会消失!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    @unittest.skipIf(full_line is True, "满线项目不测试线数设置")
    def test_setting_view_line_num_portrait(self):
        """ 竖屏面板线数标题文字按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.setting_btn_click()
        sleep(1)
        # 文本
        line_num_text = self.common.setting_view_line_num_text()
        current_line_num = self.common.setting_view_line_num()
        target_line_num = str(self.common.line_num_max)
        info_bar_line_num = self.common.info_bar_view_line_num_label()
        # 显示
        line_num_min_btn = self.common.setting_view_line_num_min_btn_visible()
        line_num_plus_btn = self.common.setting_view_line_num_plus_btn_visible(
        )
        # 能否点击
        line_num_min_btn_touchable = self.common.setting_view_line_num_min_btn_touchable(
        )
        line_num_plus_btn_touchable = self.common.setting_view_line_num_plus_btn_touchable(
        )
        try:
            self.assertEqual(line_num_text, "线", "竖屏线数线注设置面板,线数的标题错误!")
            self.assertEqual(current_line_num, target_line_num,
                             "竖屏线数线注设置面板,默认显示的线数不是最大值!")
            self.assertEqual(info_bar_line_num, current_line_num,
                             "竖屏线数线注设置面板,线数数值与下导航栏的不一致!")
            self.assertEqual(line_num_min_btn, True, "竖屏线数线注设置面板,不会显示线数 - 按钮!")
            self.assertEqual(line_num_min_btn_touchable, True,
                             "竖屏线数线注设置面板,线数 - 按钮默认不能点击!")
            self.assertEqual(line_num_plus_btn, True,
                             "竖屏线数线注设置面板,不会显示线数 + 按钮!")
            self.assertEqual(line_num_plus_btn_touchable, False,
                             "竖屏线数线注设置面板,线数 + 按钮默认可以点击!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    @unittest.skipIf(full_line is True, "满线项目不测试线数设置")
    def test_line_num_min_btn_click_portrait(self):
        """ 竖屏面板线数 - 按钮点击 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.setting_btn_click()
        sleep(1)

        target_line_num = self.common.line_num_max
        for i in reversed(range(1, int(target_line_num))):
            self.common.setting_view_line_num_min_btn_click()
            sleep(1)
            current_line_num = self.common.setting_view_line_num()
            info_bar_line_num = self.common.info_bar_view_line_num_label()
            line_num_min_touchable = self.common.setting_view_line_num_min_btn_touchable(
            )
            line_num_plus_touchable = self.common.setting_view_line_num_plus_btn_touchable(
            )
            if i > 1:
                try:
                    self.assertEqual(current_line_num, str(i),
                                     "竖屏点击线数线注设置面板的 - 按钮,线数错误!")
                    self.assertEqual(info_bar_line_num, current_line_num,
                                     "竖屏点击线数线注设置面板的 - 按钮,面板线数与下导航栏的线数不一致!")
                    self.assertEqual(line_num_min_touchable, True,
                                     "竖屏点击线数线注设置面板的 - 按钮,线数不是最小值,- 按钮不可以点击!")
                    self.assertEqual(line_num_plus_touchable, True,
                                     "竖屏点击线数线注设置面板的 - 按钮,线数不是最大值,+ 按钮不可以点击!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise
            else:
                try:
                    self.assertEqual(current_line_num, str(i),
                                     "竖屏点击线数线注设置面板的 - 按钮,线数错误!")
                    self.assertEqual(info_bar_line_num, current_line_num,
                                     "竖屏点击线数线注设置面板的 - 按钮,面板线数与下导航栏的线数不一致!")
                    self.assertEqual(line_num_min_touchable, False,
                                     "竖屏点击线数线注设置面板的 - 按钮,线数是最小值,- 按钮可以点击!")
                    self.assertEqual(line_num_plus_touchable, True,
                                     "竖屏点击线数线注设置面板的 - 按钮,线数不是最大值,+ 按钮不可以点击!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise

    @unittest.skipIf(full_line is True, "满线项目不测试线数设置")
    def test_line_num_plus_btn_click_portrait(self):
        """ 竖屏面板线数 + 按钮点击 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.setting_btn_click()
        sleep(1)

        target_line_num = self.common.line_num_max

        for i in range(1, int(target_line_num)):
            self.common.setting_view_line_num_min_btn_click()

        sleep(1)

        for i in range(2, int(target_line_num) + 1):
            self.common.setting_view_line_num_plus_btn_click()
            sleep(1)
            current_line_num = self.common.setting_view_line_num()
            info_bar_line_num = self.common.info_bar_view_line_num_label()
            line_num_min_touchable = self.common.setting_view_line_num_min_btn_touchable(
            )
            line_num_plus_touchable = self.common.setting_view_line_num_plus_btn_touchable(
            )
            if i < int(target_line_num):
                try:
                    self.assertEqual(current_line_num, str(i),
                                     "竖屏点击线数线注设置面板的 + 按钮,线数错误!")
                    self.assertEqual(info_bar_line_num, current_line_num,
                                     "竖屏点击线数线注设置面板的 + 按钮,面板线数与下导航栏的线数不一致!")
                    self.assertEqual(line_num_min_touchable, True,
                                     "竖屏点击线数线注设置面板的 + 按钮,线数不是最小值,- 按钮不可以点击!")
                    self.assertEqual(line_num_plus_touchable, True,
                                     "竖屏点击线数线注设置面板的 + 按钮,线数不是最大值,+ 按钮不可以点击!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise
            else:
                try:
                    self.assertEqual(current_line_num, str(i),
                                     "竖屏点击线数线注设置面板的 + 按钮,线数错误!")
                    self.assertEqual(info_bar_line_num, current_line_num,
                                     "竖屏点击线数线注设置面板的 + 按钮,面板线数与下导航栏的线数不一致!")
                    self.assertEqual(line_num_min_touchable, True,
                                     "竖屏点击线数线注设置面板的 + 按钮,线数不是最小值,- 按钮不可以点击!")
                    self.assertEqual(line_num_plus_touchable, False,
                                     "竖屏点击线数线注设置面板的 + 按钮,线数是最大值,+ 按钮可以点击!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise

    def test_setting_view_btn_status_portrait(self):
        """ 竖屏面板按钮状态 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.setting_btn_click()
        sleep(1)
        # 文本
        line_cost_text = self.common.setting_view_line_cost_text()

        current_line_cost = self.common.setting_view_line_cost()
        # 转化为货币格式
        locale.setlocale(locale.LC_ALL, "")
        target_line_cost = "¥" + locale.format(
            "%.2f", self.common.line_cost[0] / 100, 1)
        info_bar_line_cost = self.common.info_bar_view_line_cost_label()

        # 显示
        close_btn = self.common.setting_view_close_btn_visible()
        line_cost_min_btn = self.common.setting_view_line_cost_min_btn_visible(
        )
        line_cost_plus_btn = self.common.setting_view_line_cost_plus_btn_visible(
        )

        # 能否点击
        close_btn_touchable = self.common.setting_view_close_btn_touchable()
        line_cost_min_btn_touchable = self.common.setting_view_line_cost_min_btn_touchable(
        )
        line_cost_plus_btn_touchable = self.common.setting_view_line_cost_plus_btn_touchable(
        )
        try:
            self.assertEqual(close_btn, True, "竖屏线数线注设置面板不会显示关闭按钮!")
            self.assertEqual(close_btn_touchable, True, "竖屏线数线注设置面板,关闭按钮不能点击!")
            self.assertEqual(line_cost_text, "线注", "竖屏线数线注设置面板,线注的标题错误!")
            self.assertEqual(current_line_cost, target_line_cost,
                             "竖屏线数线注设置面板,默认显示的线注不是最小值!")
            self.assertEqual(info_bar_line_cost, current_line_cost,
                             "竖屏线数线注设置面板,线注数值与下导航栏的不一致!")
            self.assertEqual(line_cost_min_btn, True,
                             "竖屏线数线注设置面板,不会显示线注 - 按钮!")
            self.assertEqual(line_cost_min_btn_touchable, False,
                             "竖屏线数线注设置面板,线注 - 按钮默认可以点击!")
            self.assertEqual(line_cost_plus_btn, True,
                             "竖屏线数线注设置面板,不会显示线注 + 按钮!")
            self.assertEqual(line_cost_plus_btn_touchable, True,
                             "竖屏线数线注设置面板,线注 + 按钮默认不可以点击!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_line_cost_plus_btn_click_portrait(self):
        """ 竖屏面板线注 + 按钮点击 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.setting_btn_click()
        sleep(1)

        # 转化为货币格式
        locale.setlocale(locale.LC_ALL, "")
        cost_len = len(self.common.line_cost)
        for i in range(1, cost_len):
            self.common.setting_view_line_cost_plus_btn_click()
            sleep(1)
            current_line_cost = self.common.setting_view_line_cost()
            target_line_cost = "¥" + locale.format(
                "%.2f", self.common.line_cost[i] / 100, 1)
            info_bar_line_cost = self.common.info_bar_view_line_cost_label()
            line_cost_min_btn_touchable = self.common.setting_view_line_cost_min_btn_touchable(
            )
            line_cost_plus_btn_touchable = self.common.setting_view_line_cost_plus_btn_touchable(
            )

            if i < (cost_len - 1):
                try:
                    self.assertEqual(current_line_cost, target_line_cost,
                                     "竖屏点击线数线注设置面板的 + 按钮,线注错误!")
                    self.assertEqual(info_bar_line_cost, current_line_cost,
                                     "竖屏点击线数线注设置面板的 + 按钮,面板线注与下导航栏的不一致!")
                    self.assertEqual(
                        line_cost_min_btn_touchable, True,
                        "竖屏点击线数线注设置面板的 + 按钮,线注不是最小值,线注 - 按钮不能点击!")
                    self.assertEqual(
                        line_cost_plus_btn_touchable, True,
                        "竖屏点击线数线注设置面板的 + 按钮,线注不是最大值,线注 + 按钮不能点击!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise
            else:
                try:
                    self.assertEqual(current_line_cost, target_line_cost,
                                     "竖屏点击线数线注设置面板的 + 按钮,线注错误!")
                    self.assertEqual(info_bar_line_cost, current_line_cost,
                                     "竖屏点击线数线注设置面板的 + 按钮,面板线注与下导航栏的不一致!")
                    self.assertEqual(
                        line_cost_min_btn_touchable, True,
                        "竖屏点击线数线注设置面板的 + 按钮,线注不是最小值,线注 - 按钮不能点击!")
                    self.assertEqual(line_cost_plus_btn_touchable, False,
                                     "竖屏点击线数线注设置面板的 + 按钮,线注是最大值,线注 + 按钮可以点击!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise

    def test_line_cost_min_btn_click_portrait(self):
        """ 竖屏面板线注 - 按钮点击 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.setting_btn_click()
        sleep(1)

        # 转化为货币格式
        locale.setlocale(locale.LC_ALL, "")
        cost_len = len(self.common.line_cost)

        for i in range(1, cost_len):
            self.common.setting_view_line_cost_plus_btn_click()

        sleep(1)

        for i in reversed(range(cost_len - 1)):
            self.common.setting_view_line_cost_min_btn_click()
            sleep(1)
            current_line_cost = self.common.setting_view_line_cost()
            target_line_cost = "¥" + locale.format(
                "%.2f", self.common.line_cost[i] / 100, 1)
            info_bar_line_cost = self.common.info_bar_view_line_cost_label()
            line_cost_min_btn_touchable = self.common.setting_view_line_cost_min_btn_touchable(
            )
            line_cost_plus_btn_touchable = self.common.setting_view_line_cost_plus_btn_touchable(
            )

            if i > 0:
                try:
                    self.assertEqual(current_line_cost, target_line_cost,
                                     "竖屏点击线数线注设置面板的 - 按钮,线注错误!")
                    self.assertEqual(info_bar_line_cost, current_line_cost,
                                     "竖屏点击线数线注设置面板的 - 按钮,面板线注与下导航栏的不一致!")
                    self.assertEqual(
                        line_cost_min_btn_touchable, True,
                        "竖屏点击线数线注设置面板的 - 按钮,线注不是最小值,线注 - 按钮不能点击!")
                    self.assertEqual(
                        line_cost_plus_btn_touchable, True,
                        "竖屏点击线数线注设置面板的 - 按钮,线注不是最大值,线注 + 按钮不能点击!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise
            else:
                try:
                    self.assertEqual(current_line_cost, target_line_cost,
                                     "竖屏点击线数线注设置面板的 - 按钮,线注错误!")
                    self.assertEqual(info_bar_line_cost, current_line_cost,
                                     "竖屏点击线数线注设置面板的 - 按钮,面板线注与下导航栏的不一致!")
                    self.assertEqual(line_cost_min_btn_touchable, False,
                                     "竖屏点击线数线注设置面板的 - 按钮,线注是最小值,线注 - 按钮可以点击!")
                    self.assertEqual(
                        line_cost_plus_btn_touchable, True,
                        "竖屏点击线数线注设置面板的 - 按钮,线注是最小值,线注 + 按钮不可以点击!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise

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

    def test_setting_btn_visible_switch_screen(self):
        """ 横竖屏线数线注按钮显示 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.landscape()
        sleep(1)
        self.common.portrait()
        sleep(1)
        visible = self.common.setting_btn_visible()
        try:
            self.assertEqual(visible, True, "横竖屏切换,没有显示线数线注设置按钮!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_show_view_switch_screen(self):
        """ 横竖屏弹出设置面板 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.setting_btn_click()
        sleep(1)
        self.common.landscape()
        sleep(1)
        self.common.portrait()
        sleep(1)
        showing = self.common.setting_view_showing()
        mask = self.common.mask_view_showing()
        try:
            self.assertEqual(showing, True, "横竖屏切换,线数线注设置面板显示不正常!")
            self.assertEqual(mask, True, "横竖屏切换,灰色蒙板显示不正常!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_setting_view_dispear_switch_screen(self):
        """ 横竖屏点击蒙板可以关闭面板 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.setting_btn_click()
        sleep(1)
        self.common.mask_view_click()
        sleep(1)
        self.common.landscape()
        sleep(1)
        self.common.portrait()
        sleep(1)
        dispear = self.common.setting_view_dispear()
        mask = self.common.mask_view_showing()
        try:
            self.assertEqual(dispear, None, "点击蒙板关闭线数线注设置面板后,横竖屏切换,面板不会消失!")
            self.assertEqual(mask, False, "点击蒙板关闭线数线注设置面板后,横竖屏切换,灰色蒙板不会消失!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    @unittest.skipIf(full_line is True, "满线项目不测试线数设置")
    def test_line_num_switch_screen(self):
        """ 横竖屏面板线数标题文字按钮 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.setting_btn_click()
        sleep(1)
        self.common.landscape()
        sleep(1)
        self.common.portrait()
        sleep(1)
        line_num_text = self.common.setting_view_line_num_text()
        current_line_num = self.common.setting_view_line_num()
        target_line_num = str(self.common.line_num_max)
        info_bar_line_num = self.common.info_bar_view_line_num_label()
        line_num_min_btn = self.common.setting_view_line_num_min_btn_visible()
        line_num_plus_btn = self.common.setting_view_line_num_plus_btn_visible(
        )
        try:
            self.assertEqual(line_num_text, "线", "横竖屏切换,设置面板线数的标题错误!")
            self.assertEqual(current_line_num, target_line_num,
                             "横竖屏切换,默认显示的线数不是最大值!")
            self.assertEqual(info_bar_line_num, current_line_num,
                             "横竖屏切换,线数数值与下导航栏的不一致!")
            self.assertEqual(line_num_min_btn, True, "横竖屏切换,不会显示线数 - 按钮!")
            self.assertEqual(line_num_plus_btn, True, "横竖屏切换,不会显示线数 + 按钮!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    @unittest.skipIf(full_line is True, "满线项目不测试线数设置")
    def test_line_num_min_btn_click_switch_screen(self):
        """ 横竖屏面板线数 - 按钮点击 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.setting_btn_click()
        sleep(1)

        target_line_num = self.common.line_num_max
        for i in reversed(range(1, int(target_line_num))):
            self.common.setting_view_line_num_min_btn_click()
            sleep(1)

            if i % 2 == 0:
                self.common.portrait()
            else:
                self.common.landscape()

            sleep(1)

            current_line_num = self.common.setting_view_line_num()
            info_bar_line_num = self.common.info_bar_view_line_num_label()
            line_num_min_touchable = self.common.setting_view_line_num_min_btn_touchable(
            )
            line_num_plus_touchable = self.common.setting_view_line_num_plus_btn_touchable(
            )
            if i > 1:
                try:
                    self.assertEqual(current_line_num, str(i),
                                     "点击线数线注设置面板的 - 按钮,横竖屏切换,线数错误!")
                    self.assertEqual(
                        info_bar_line_num, current_line_num,
                        "点击线数线注设置面板的 - 按钮,横竖屏切换,面板线数与下导航栏的线数不一致!")
                    self.assertEqual(
                        line_num_min_touchable, True,
                        "点击线数线注设置面板的 - 按钮,横竖屏切换,线数不是最小值,- 按钮不可以点击!")
                    self.assertEqual(
                        line_num_plus_touchable, True,
                        "点击线数线注设置面板的 - 按钮,横竖屏切换,线数不是最大值,+ 按钮不可以点击!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise
            else:
                try:
                    self.assertEqual(current_line_num, str(i),
                                     "点击线数线注设置面板的 - 按钮,横竖屏切换,线数错误!")
                    self.assertEqual(
                        info_bar_line_num, current_line_num,
                        "点击线数线注设置面板的 - 按钮,横竖屏切换,面板线数与下导航栏的线数不一致!")
                    self.assertEqual(
                        line_num_min_touchable, False,
                        "点击线数线注设置面板的 - 按钮,横竖屏切换,线数是最小值,- 按钮可以点击!")
                    self.assertEqual(
                        line_num_plus_touchable, True,
                        "点击线数线注设置面板的 - 按钮,横竖屏切换,线数不是最大值,+ 按钮不可以点击!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise

    @unittest.skipIf(full_line is True, "满线项目不测试线数设置")
    def test_line_num_plus_btn_click_switch_screen(self):
        """ 横竖屏面板线数 + 按钮点击 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.setting_btn_click()
        sleep(1)

        target_line_num = self.common.line_num_max

        for i in range(1, int(target_line_num)):
            self.common.setting_view_line_num_min_btn_click()

        sleep(1)

        for i in range(2, int(target_line_num) + 1):
            self.common.setting_view_line_num_plus_btn_click()
            sleep(1)

            if i % 2 == 0:
                self.common.portrait()
            else:
                self.common.landscape()

            sleep(1)

            current_line_num = self.common.setting_view_line_num()
            info_bar_line_num = self.common.info_bar_view_line_num_label()
            line_num_min_touchable = self.common.setting_view_line_num_min_btn_touchable(
            )
            line_num_plus_touchable = self.common.setting_view_line_num_plus_btn_touchable(
            )
            if i < int(target_line_num):
                try:
                    self.assertEqual(current_line_num, str(i),
                                     "点击线数线注设置面板的 + 按钮,横竖屏切换,线数错误!")
                    self.assertEqual(
                        info_bar_line_num, current_line_num,
                        "点击线数线注设置面板的 + 按钮,横竖屏切换,面板线数与下导航栏的线数不一致!")
                    self.assertEqual(
                        line_num_min_touchable, True,
                        "点击线数线注设置面板的 + 按钮,横竖屏切换,线数不是最小值,- 按钮不可以点击!")
                    self.assertEqual(
                        line_num_plus_touchable, True,
                        "点击线数线注设置面板的 + 按钮,横竖屏切换,线数不是最大值,+ 按钮不可以点击!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise
            else:
                try:
                    self.assertEqual(current_line_num, str(i),
                                     "点击线数线注设置面板的 + 按钮,横竖屏切换,线数错误!")
                    self.assertEqual(
                        info_bar_line_num, current_line_num,
                        "点击线数线注设置面板的 + 按钮,横竖屏切换,面板线数与下导航栏的线数不一致!")
                    self.assertEqual(
                        line_num_min_touchable, True,
                        "点击线数线注设置面板的 + 按钮,横竖屏切换,线数不是最小值,- 按钮不可以点击!")
                    self.assertEqual(
                        line_num_plus_touchable, False,
                        "点击线数线注设置面板的 + 按钮,横竖屏切换,线数是最大值,+ 按钮可以点击!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise

    def test_setting_view_btn_switch_screen(self):
        """ 横竖屏面板线注标题文字 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.setting_btn_click()
        sleep(1)
        self.common.landscape()
        sleep(1)
        self.common.portrait()
        sleep(1)
        view_line_cost_text = self.common.setting_view_line_cost_text()

        current_line_cost = self.common.setting_view_line_cost()
        # 转化为货币格式
        locale.setlocale(locale.LC_ALL, "")
        target_line_cost = "¥" + locale.format(
            "%.2f", self.common.line_cost[0] / 100, 1)
        info_bar_line_cost = self.common.info_bar_view_line_cost_label()

        line_cost_min_btn = self.common.setting_view_line_cost_min_btn_visible(
        )
        line_cost_plus_btn = self.common.setting_view_line_cost_plus_btn_visible(
        )
        try:
            self.assertEqual(view_line_cost_text, "线注", "横竖屏切换,线注的标题错误!")
            self.assertEqual(current_line_cost, target_line_cost,
                             "横竖屏切换,默认显示的线注不是最小值!")
            self.assertEqual(info_bar_line_cost, current_line_cost,
                             "横竖屏切换,线注数值与下导航栏的不一致!")
            self.assertEqual(line_cost_min_btn, True, "横竖屏切换,不会显示线注 - 按钮!")
            self.assertEqual(line_cost_plus_btn, True, "横竖屏切换,不会显示线注 + 按钮!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_line_cost_plus_btn_click_switch_screen(self):
        """ 横竖屏面板线注 + 按钮点击 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.setting_btn_click()
        sleep(1)

        # 转化为货币格式
        locale.setlocale(locale.LC_ALL, "")
        cost_len = len(self.common.line_cost)
        for i in range(1, cost_len):
            self.common.setting_view_line_cost_plus_btn_click()
            sleep(1)

            if i % 2 == 0:
                self.common.landscape()
            else:
                self.common.portrait()

            sleep(1)

            current_line_cost = self.common.setting_view_line_cost()
            target_line_cost = "¥" + locale.format(
                "%.2f", self.common.line_cost[i] / 100, 1)
            info_bar_line_cost = self.common.info_bar_view_line_cost_label()
            line_cost_min_btn_touchable = self.common.setting_view_line_cost_min_btn_touchable(
            )
            line_cost_plus_btn_touchable = self.common.setting_view_line_cost_plus_btn_touchable(
            )

            if i < (cost_len - 1):
                try:
                    self.assertEqual(current_line_cost, target_line_cost,
                                     "点击线数线注设置面板的 + 按钮,横竖屏切换,线注错误!")
                    self.assertEqual(info_bar_line_cost, current_line_cost,
                                     "点击线数线注设置面板的 + 按钮,横竖屏切换,面板线注与下导航栏的不一致!")
                    self.assertEqual(
                        line_cost_min_btn_touchable, True,
                        "点击线数线注设置面板的 + 按钮,横竖屏切换,线注不是最小值,线注 - 按钮不能点击!")
                    self.assertEqual(
                        line_cost_plus_btn_touchable, True,
                        "点击线数线注设置面板的 + 按钮,横竖屏切换,线注不是最大值,线注 + 按钮不能点击!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise
            else:
                try:
                    self.assertEqual(current_line_cost, target_line_cost,
                                     "点击线数线注设置面板的 + 按钮,横竖屏切换,线注错误!")
                    self.assertEqual(info_bar_line_cost, current_line_cost,
                                     "点击线数线注设置面板的 + 按钮,横竖屏切换,面板线注与下导航栏的不一致!")
                    self.assertEqual(
                        line_cost_min_btn_touchable, True,
                        "点击线数线注设置面板的 + 按钮,横竖屏切换,线注不是最小值,线注 - 按钮不能点击!")
                    self.assertEqual(
                        line_cost_plus_btn_touchable, False,
                        "点击线数线注设置面板的 + 按钮,横竖屏切换,线注是最大值,线注 + 按钮可以点击!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise

    def test_line_cost_min_btn_click_switch_screen(self):
        """ 横竖屏面板线注 - 按钮点击 """
        self.common.loading_pass()
        sleep(3)
        self.common.sound_view_yes_btn_click()
        sleep(1)
        self.common.setting_btn_click()
        sleep(1)

        # 转化为货币格式
        locale.setlocale(locale.LC_ALL, "")
        cost_len = len(self.common.line_cost)

        for i in range(1, cost_len):
            self.common.setting_view_line_cost_plus_btn_click()

        sleep(1)

        for i in reversed(range(cost_len - 1)):
            self.common.setting_view_line_cost_min_btn_click()
            sleep(1)

            if i % 2 == 0:
                self.common.landscape()
            else:
                self.common.portrait()

            sleep(1)

            current_line_cost = self.common.setting_view_line_cost()
            target_line_cost = "¥" + locale.format(
                "%.2f", self.common.line_cost[i] / 100, 1)
            info_bar_line_cost = self.common.info_bar_view_line_cost_label()
            line_cost_min_btn_touchable = self.common.setting_view_line_cost_min_btn_touchable(
            )
            line_cost_plus_btn_touchable = self.common.setting_view_line_cost_plus_btn_touchable(
            )

            if i > 0:
                try:
                    self.assertEqual(current_line_cost, target_line_cost,
                                     "点击线数线注设置面板的 - 按钮,横竖屏切换,线注错误!")
                    self.assertEqual(info_bar_line_cost, current_line_cost,
                                     "点击线数线注设置面板的 - 按钮,横竖屏切换,面板线注与下导航栏的不一致!")
                    self.assertEqual(
                        line_cost_min_btn_touchable, True,
                        "点击线数线注设置面板的 - 按钮,横竖屏切换,线注不是最小值,线注 - 按钮不能点击!")
                    self.assertEqual(
                        line_cost_plus_btn_touchable, True,
                        "点击线数线注设置面板的 - 按钮,横竖屏切换,线注不是最大值,线注 + 按钮不能点击!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise
            else:
                try:
                    self.assertEqual(current_line_cost, target_line_cost,
                                     "点击线数线注设置面板的 - 按钮,横竖屏切换,线注错误!")
                    self.assertEqual(info_bar_line_cost, current_line_cost,
                                     "点击线数线注设置面板的 - 按钮,横竖屏切换,面板线注与下导航栏的不一致!")
                    self.assertEqual(
                        line_cost_min_btn_touchable, False,
                        "点击线数线注设置面板的 - 按钮,横竖屏切换,线注是最小值,线注 - 按钮可以点击!")
                    self.assertEqual(
                        line_cost_plus_btn_touchable, True,
                        "点击线数线注设置面板的 - 按钮,横竖屏切换,线注是最小值,线注 + 按钮不可以点击!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise
예제 #12
0
class TestLoadingView(unittest.TestCase):
    """ 载入场景模块 """
    def setUp(self):
        self.browser = webdriver.Chrome(
            executable_path="../../lib/chromedriver.exe")
        self.common = Common(self.browser)
        self.common.start()
        self.daf = DirAndFiles()

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

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

    def test_loading_view_showing(self):
        """ 横屏进入载入场景 """
        self.common.wait_for_loading_view_showing()
        showing = self.common.loading_view_showing()
        try:
            self.assertEqual(showing, True, "横屏没有进入载入场景!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_loading_view_ui_showing(self):
        """ 横屏显示logo、进度条、版本号 """
        self.common.wait_for_loading_view_showing()
        bg = self.common.loading_view_background_visible()
        logo = self.common.loading_view_logo_visible()
        progress_title = self.common.loading_view_progress_title_visible()
        progress_bar = self.common.loading_view_progress_bar_visible()
        version = self.common.loading_view_version_visible()
        try:
            self.assertEqual(bg, True, "横屏载入场景没有显示背景图片!")
            self.assertEqual(logo, True, "横屏载入场景没有显示logo!")
            self.assertEqual(progress_title, True, "横屏载入场景没有显示当前进度百分比!")
            self.assertEqual(progress_bar, True, "横屏载入场景没有显示进度条!")
            self.assertEqual(version, True, "横屏载入场景没有显示版本号!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_progress_bar_is_loading(self):
        """ 横屏进度条会走动 """
        self.common.wait_for_loading_view_showing()
        time = 0
        title_value1 = self.common.loading_view_progress_title_value()
        bar_value1 = self.common.loading_view_progress_bar_value()
        while True:
            sleep(0.5)
            time = time + 0.5
            title_value2 = self.common.loading_view_progress_title_value()
            bar_value2 = self.common.loading_view_progress_bar_value()
            if title_value1 is not title_value2 and bar_value1 is not bar_value2:
                break
            elif time == 10:
                try:
                    self.assertNotEqual(title_value1, title_value2,
                                        "横屏载入场景经过10秒,百分比数值不会变!")
                    self.assertNotEqual(bar_value1, bar_value2,
                                        "横屏载入场景经过10秒,进度条不会动!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise

    def test_loading_bar_complete(self):
        """ 横屏进度条走完是100% """
        self.common.wait_for_loading_view_showing()
        start_time = datetime.now()
        while True:
            bar_value = self.common.loading_view_progress_bar_value()
            title_value = self.common.loading_view_progress_title_value()

            end_time = datetime.now()
            cost_time = (end_time - start_time).seconds
            if bar_value == 100:
                cost_time = True
                break
            else:
                if cost_time >= 15:
                    cost_time = False
                    break

        try:
            self.assertEqual(cost_time, True, "横屏等待15秒,进度条不会走满!")
            self.assertEqual(title_value, "100%", "横屏进度条走满后,百分比不是100%!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_loading_view_dispear(self):
        """ 横屏在进度条100%后载入消失 """
        self.common.loading_pass()
        sleep(3)
        showing = self.common.loading_view_dispear()
        try:
            self.assertEqual(showing, None, "横屏载入完成后载入场景不会消失!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

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

    def test_loading_view_showing_portrait(self):
        """ 竖屏进入载入场景 """
        self.common.portrait()
        self.common.wait_for_loading_view_showing()
        showing = self.common.loading_view_showing()
        try:
            self.assertEqual(showing, True, "竖屏没有进入载入场景!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_loading_view_ui_showing_portrait(self):
        """ 竖屏显示logo、进度条、版本号 """
        self.common.portrait()
        self.common.wait_for_loading_view_showing()
        bg = self.common.loading_view_background_visible()
        logo = self.common.loading_view_logo_visible()
        progress_title = self.common.loading_view_progress_title_visible()
        progress_bar = self.common.loading_view_progress_bar_visible()
        version = self.common.loading_view_version_visible()
        try:
            self.assertEqual(bg, True, "竖屏载入场景没有显示背景图片!")
            self.assertEqual(logo, True, "竖屏载入场景没有显示logo!")
            self.assertEqual(progress_title, True, "竖屏载入场景没有显示当前进度百分比!")
            self.assertEqual(progress_bar, True, "竖屏载入场景没有显示进度条!")
            self.assertEqual(version, True, "竖屏载入场景没有显示版本号!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_progress_bar_is_loading_portrait(self):
        """ 竖屏进度条会走动 """
        self.common.portrait()
        self.common.wait_for_loading_view_showing()
        time = 0
        title_value1 = self.common.loading_view_progress_title_value()
        bar_value1 = self.common.loading_view_progress_bar_value()
        while True:
            sleep(0.5)
            time = time + 0.5
            title_value2 = self.common.loading_view_progress_title_value()
            bar_value2 = self.common.loading_view_progress_bar_value()
            if title_value1 is not title_value2 and bar_value1 is not bar_value2:
                break
            elif time == 10:
                try:
                    self.assertNotEqual(title_value1, title_value2,
                                        "竖屏载入场景经过10秒,百分比数值不会变!")
                    self.assertNotEqual(bar_value1, bar_value2,
                                        "竖屏载入场景经过10秒,进度条不会动!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise

    def test_loading_bar_complete_portrait(self):
        """ 竖屏载入场景进度条走完是100% """
        self.common.portrait()
        self.common.wait_for_loading_view_showing()
        start_time = datetime.now()
        while True:
            bar_value = self.common.loading_view_progress_bar_value()
            title_value = self.common.loading_view_progress_title_value()

            end_time = datetime.now()
            cost_time = (end_time - start_time).seconds
            if bar_value == 100:
                cost_time = True
                break
            else:
                if cost_time >= 15:
                    cost_time = False
                    break

        try:
            self.assertEqual(cost_time, True, "竖屏等待15秒,进度条不会走满!")
            self.assertEqual(title_value, "100%", "竖屏进度条走满后,百分比不是100%!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_loading_view_dispear_portrait(self):
        """ 竖屏进度条100%后载入消失 """
        self.common.portrait()
        self.common.loading_pass()
        sleep(3)
        showing = self.common.loading_view_dispear()
        try:
            self.assertEqual(showing, None, "竖屏载入完成后载入场景不会消失!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

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

    def test_loading_view_showing_switch_screen(self):
        """ 横竖屏显示logo、进度条、版本号 """
        self.common.portrait()
        sleep(0.5)
        self.common.landscape()
        sleep(0.5)
        self.common.portrait()
        self.common.wait_for_loading_view_showing()
        bg = self.common.loading_view_background_visible()
        logo = self.common.loading_view_logo_visible()
        progress_title = self.common.loading_view_progress_title_visible()
        progress_bar = self.common.loading_view_progress_bar_visible()
        version = self.common.loading_view_version_visible()
        try:
            self.assertEqual(bg, True, "横竖屏切换,载入场景没有显示背景图片!")
            self.assertEqual(logo, True, "横竖屏切换,载入场景没有显示logo!")
            self.assertEqual(progress_title, True, "横竖屏切换,载入场景没有显示当前进度百分比!")
            self.assertEqual(progress_bar, True, "横竖屏切换,载入场景没有显示进度条!")
            self.assertEqual(version, True, "横竖屏切换,载入场景没有显示版本号!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise

    def test_progress_bar_is_loading_switch_screen(self):
        """ 横竖屏进度条会走动 """
        self.common.portrait()
        self.common.wait_for_loading_view_showing()
        time = 0
        title_value1 = self.common.loading_view_progress_title_value()
        bar_value1 = self.common.loading_view_progress_bar_value()
        while True:
            sleep(0.5)
            time = time + 0.5
            self.common.landscape()
            title_value2 = self.common.loading_view_progress_title_value()
            bar_value2 = self.common.loading_view_progress_bar_value()
            if title_value1 is not title_value2 and bar_value1 is not bar_value2:
                break
            elif time == 10:
                try:
                    self.assertNotEqual(title_value1, title_value2,
                                        "横竖屏切换,载入场景经过10秒,百分比数值不会变!")
                    self.assertNotEqual(bar_value1, bar_value2,
                                        "横竖屏切换,载入场景经过10秒,进度条不会动!")
                except AssertionError:
                    self.daf.get_screenshot(self.browser)
                    raise

    def test_loading_view_dispear_switch_screen(self):
        """ 横竖屏载入场景进度条100%后消失 """
        self.common.portrait()
        sleep(1)
        self.common.landscape()
        self.common.loading_pass()
        self.common.portrait()
        sleep(1)
        showing = self.common.loading_view_dispear()
        try:
            self.assertEqual(showing, None, "横竖屏切换,载入完成后载入场景不会消失!")
        except AssertionError:
            self.daf.get_screenshot(self.browser)
            raise