Beispiel #1
0
    def test_ru_button_tips_locale(self):
        ''''''
        pyautogui.moveTo(5, 5, 1)
        '''choose language'''

        if not browser.monosearch_10('ru_language_selected.png', samples_dir):
            browser.change_lanuage('ru_language_selected.png', samples_dir)
            time.sleep(40)

        pyautogui.moveTo(5, 5, 1)
        '''close_all_bonus_windows'''
        browser.close_all_bonus_windows(samples_dir,
                                        self.driver,
                                        self.height_screen,
                                        self.left_coord_top_menu,
                                        self.top_coord_top_menu
                                        )

        '''set_full_screen'''
        browser.set_full_screen(samples_dir, self.REGIONS_ON_WINDOW)

        '''get lists of buttons and locales'''
        self.buttons = os.listdir('{}{}'.format(os.getcwd(), ru_buttons_dir))
        self.locales = os.listdir('{}{}'.format(os.getcwd(), ru_locales_dir))

        '''check locales when focus to buttons'''
        for button, locale in zip(self.buttons, self.locales):
            button_coord = browser.monosearch_10(button, ru_buttons_dir)
            with self.subTest():
                self.assertTrue(button_coord, msg="{} not finded".format(button))
            if button_coord:
                browser.move_mouse_to(button_coord)
                with self.subTest():
                    self.assertTrue(browser.monosearch_10(locale, ru_locales_dir), msg="{} not finded".format(locale))
Beispiel #2
0
 def test_faq(self):
     ''''''
     '''find button_faq'''
     self.button_faq = browser.monosearch_10('button_faq.png', samples_dir)
     if self.button_faq:
         '''click to invite top_menu_py_files button'''
         browser.click_to_center(self.button_faq)
         '''check image'''
         time.sleep(5)
         self.assertTrue(
             browser.monosearch_10('sample_faq_window.png', samples_dir))
     else:
         browser.get_screen(screens_dir)
         raise ValueError("isn't fiding button_faq")
Beispiel #3
0
 def test_language_select(self):
     ''''''
     '''find language_select'''
     self.language_select = browser.monosearch_10('language_select.png',
                                                  samples_dir)
     if self.language_select:
         '''click to language_select'''
         browser.click_to_center(self.language_select)
         '''find list_of_languages'''
         # time.sleep(15)
         '''check image'''
         time.sleep(5)
         self.assertTrue(
             browser.monosearch_10('list_of_languages.png', samples_dir))
Beispiel #4
0
 def test_invite_friends(self):
     ''''''
     '''find button_button_inv_friend'''
     self.button_button_inv_friend = browser.monosearch_10(
         'button_inv_friend.png', samples_dir)
     if self.button_button_inv_friend:
         '''click to invite top_menu_py_files button'''
         browser.click_to_center(self.button_button_inv_friend)
         '''check image'''
         self.assertTrue(
             browser.monosearch_10('sample_invite_friend_window.png',
                                   samples_dir))
     else:
         browser.get_screen(screens_dir)
         raise ValueError("isn't fiding button_inv_friend")
Beispiel #5
0
def go_1(img):
    # print('{}'.format(datetime.datetime.now().strftime('%d/%m/%Y__%H:%M:%S')))
    # s = datetime.datetime.now()
    result = monosearch_10(img)
    # print(result)
    # f = datetime.datetime.now()
    # print('go_1', f - s, '\n')
    return result
Beispiel #6
0
    def test_add_gold(self):
        ''''''
        '''get screen resolution size'''
        width_screen, height_screen = pyautogui.size()
        '''find game's top menu'''
        left_coord_top_menu, top_coord_top_menu, width_top_menu, height_top_menu = browser.monosearch_10(
            'top_menu.png', samples_dir)
        '''scroll down'''
        self.driver.execute_script('scroll({},{});'.format(
            left_coord_top_menu, top_coord_top_menu - 150))
        '''click to game area'''
        time.sleep(1)
        pyautogui.click(x=width_top_menu - left_coord_top_menu,
                        y=top_coord_top_menu + height_screen / 2)
        '''accept flash running'''
        time.sleep(0.5)
        button_accept_flash_running = browser.monosearch_10(
            'accept_flash_running.png', samples_dir)
        if button_accept_flash_running:
            button_accept_flash_running_x, button_accept_flash_running_y = pyautogui.center(
                button_accept_flash_running)
            pyautogui.click(x=button_accept_flash_running_x,
                            y=button_accept_flash_running_y)

        time.sleep(30)
        '''find button_add_gold'''
        self.button_add_gold = browser.monosearch_10('button_add_gold.png',
                                                     samples_dir)
        if not self.button_add_gold:
            browser.get_screen(screens_dir)
        '''click to button_add_gold'''
        browser.click_to_center(self.button_add_gold)
        '''check image'''
        # with Pool(2) as p:
        #     for image in p.imap_unordered(self.find_image, ('sample_add_gold_window.png', )):
        #         if image:
        #             self.assertTrue(image)
        #             break
        self.assertTrue(
            browser.monosearch_10('sample_add_gold_action_window.png',
                                  samples_dir) or
            browser.monosearch_10('sample_add_gold_window.png', samples_dir),
            msg=
            "sample_add_gold_action_window.png and sample_add_gold_window.png aren't finded"
        )
Beispiel #7
0
 def test_community(self):
     ''''''
     '''find button_community'''
     self.button_community = browser.monosearch_10('button_community.png',
                                                   samples_dir)
     if self.button_community:
         '''click to community button'''
         browser.click_to_center(self.button_community)
         '''find button_not_accept_message'''
         # time.sleep(15)
         self.button_not_accept_message = browser.monosearch_10(
             'button_not_accept_message.png', samples_dir)
         if self.button_not_accept_message:
             browser.click_to_center(self.button_not_accept_message)
         '''check image'''
         time.sleep(5)
         self.assertTrue(
             browser.monosearch_10('sample_community_window.png',
                                   samples_dir))
         with self.subTest():
             self.assertTrue(browser.monosearch_10('a.png', samples_dir))
     else:
         browser.get_screen(screens_dir)
         raise ValueError("isn't fiding button_community")
Beispiel #8
0
    def setUp(self):
        dump_loader.load_max_lvl_dump(SOCIAL, SERVER, SOC_AUTH_INFO[SOCIAL]['ID'])
        ''''''
        '''ignore insides warnings'''
        warnings.simplefilter("ignore", ResourceWarning)
        warnings.simplefilter("ignore", DeprecationWarning)

        '''open chrome'''
        self.driver = browser.open_browser()

        '''go to social network'''
        browser.go_to_social_network(self.driver, SOC_NET_LINKS[SOCIAL])

        '''login'''
        browser.login(self.driver, SOC_AUTH_INFO[SOCIAL]['LOGIN'], SOC_AUTH_INFO[SOCIAL]['PASS'])

        '''go to game page'''
        browser.go_to_social_network(self.driver, SOC_NET_LINKS['{}_game'.format(SOCIAL)])

        '''get screen resolution size'''
        self.width_screen, self.height_screen = pyautogui.size()

        '''find game's top menu'''
        self.left_coord_top_menu, self.top_coord_top_menu, self.width_top_menu, self.height_top_menu = \
            browser.monosearch_1000('top_menu.png', samples_dir)

        '''scroll down'''
        self.driver.execute_script('scroll({},{});'.format(self.left_coord_top_menu, self.top_coord_top_menu - 150))

        '''click to game area'''
        time.sleep(1)
        pyautogui.click(x=self.width_top_menu - self.left_coord_top_menu, y=self.top_coord_top_menu + self.height_screen / 2)

        '''accept flash running'''
        time.sleep(0.5)
        button_accept_flash_running = browser.monosearch_10('accept_flash_running.png', samples_dir)
        if button_accept_flash_running:
            button_accept_flash_running_x, button_accept_flash_running_y = pyautogui.center(button_accept_flash_running)
            pyautogui.click(x=button_accept_flash_running_x, y=button_accept_flash_running_y)
        self.REGIONS_ON_WINDOW, self.REGIONS_ON_FULL_SCREEN = regions.get_regions(self.left_coord_top_menu,
                                                                                  self.width_top_menu,
                                                                                  self.height_screen,
                                                                                  self.width_screen
                                                                                  )
        time.sleep(40)