Esempio n. 1
0
def get_journal_state(node_wnd_journal):
    if get_node_child(node_wnd_journal, wnd_quests, False).exists():
        return js_quests
    if get_node_child(node_wnd_journal, wnd_legends, False).exists():
        return js_legends
    if get_node_child(node_wnd_journal, wnd_goods, False).exists():
        return js_goods
    if get_node_child(node_wnd_journal, wnd_status, False).exists():
        return js_status
    if get_node_child(node_wnd_journal, wnd_stats, False).exists():
        return js_stats

    return js_unknow
Esempio n. 2
0
def test_reward_packages(poco, dev, row0, row1):
    # ## tood: вынести в отдельную функцию
    i = row0
    while i <= row1:
        time.sleep(1)
        # это обновляем постоянно
        node = wait_for_node_visible(poco, dr_wnd, 5)
        if not node.exists():
            out('Window not showed', dr_wnd)
            return False
        node = get_node_child(node, content)
        lst_days = node.child()

        # в общемто тут все элементы надо получать заново
        lst_rewards = lst_days[i].child('Rewards')
        ii = 0
        for btn in lst_rewards.child():
            out('touch reward[' + str(i) + '][' + str(ii) + ']')
            touch_center(dev, btn)
            time.sleep(1)
            node = wait_for_node_visible(poco, back_descr_bg, 0)
            if node.exists():
                touch_center(dev, wait_for_node_visible(poco, back_btn, 5))
            ii = ii + 1
        i = i + 1

    return True
Esempio n. 3
0
def test_journal_stats(dev, poco):

    node_wnd_journal = wait_for_node_visible(poco, wnd_journal, 2)
    if not node_wnd_journal.exists():
        out('Window not showed', wnd_journal)
        return False

    if get_journal_state(node_wnd_journal) != js_stats:
        out('переходим во вкладку статистики')
        touch_center(dev, get_node_child(node_wnd_journal, btn_stats))
        time.sleep(1)

    # получаем заново, т.к. сцена обновилась
    node_wnd_journal = wait_for_node_visible(poco, wnd_journal, 2)
    if not node_wnd_journal.exists():
        out('Window not showed', wnd_journal)
        return False

    if get_journal_state(node_wnd_journal) != js_stats:
        out('не перешли во вкладку статистики', '')
        return False

    ### ------------------------------------------------------------
    # тут тестов по сути нет, просто переход на вкладку

    return True
Esempio n. 4
0
def test_swipe_reward_packages(poco, row_from, row_to):
    node = wait_for_node_visible(poco, dr_wnd, 5)
    if not node.exists():
        out('Window not showed', dr_wnd)
        return False
    node = get_node_child(node, content)
    lst_days = node.child()

    out('свайпаем экран с колонки ' + str(row_from + 1) + ' до колонки ' +
        str(row_to + 1))
    lst_days[row_from].drag_to(lst_days[row_to])
    return True
Esempio n. 5
0
def test_journal_legends(dev, poco):

    node_wnd_journal = wait_for_node_visible(poco, wnd_journal, 2)
    if not node_wnd_journal.exists():
        out('Window not showed', wnd_journal)
        return False

    if get_journal_state(node_wnd_journal) != js_legends:
        out('переходим во вкладку легенд')
        touch_center(dev, get_node_child(node_wnd_journal, btn_legends))
        time.sleep(1)

    # получаем заново, т.к. сцена обновилась
    node_wnd_journal = wait_for_node_visible(poco, wnd_journal, 2)
    if not node_wnd_journal.exists():
        out('Window not showed', wnd_journal)
        return False

    if get_journal_state(node_wnd_journal) != js_legends:
        out('не перешли во вкладку легенд', '')
        return False

    ### ------------------------------------------------------------

    node_legends_list = get_node_child(node_wnd_journal, wnd_legends)

    # перебераем всё по замороженной структуре
    i = 0
    for node_quest in node_legends_list.child():
        if node_quest.attr('type') == 'Button':
            i = i + 1
            out('legend[' + str(i) + ']: ' + node_quest.attr('text'))
            touch_center(dev, node_quest)
            time.sleep(0.5)
            # новый экземпляр ибо опять всё обновилось
            # journal = wait_for_node_visible(poco, wnd_journal, 2)
            # node = get_node_child(journal, wnd_descr)
            # out('quest descr: ' + node.attr('text'))

    return True
Esempio n. 6
0
def my_swipe(dev, poco, path_root, subpath_from, subpath_to):
    node_root = wait_for_node_visible(poco, path_root)
    if not node_root.exists():
        out('not ready to swipe, can\'t find node', path_root)
        return False

    node_from = get_node_child(node_root, subpath_from)
    if not node_from.exists():
        out('not ready to swipe, can\'t find node',
            path_root + '/' + node_from)
        return False
    pos_from = pos_center(dev, node_from)

    node_to = get_node_child(node_root, subpath_to)
    if not node_to.exists():
        out('not ready to swipe, can\'t find node', path_root + '/' + node_to)
        return False
    pos_to = pos_center(dev, node_to)

    swipe(pos_from, pos_to, duration=2)

    return True
Esempio n. 7
0
def test_journal_status(dev, poco):

    btn_hawk = 'HAWK'
    btn_baran = 'BARAN'
    btn_spider = 'SPIDER'
    btn_rabbit = 'RABBIT'
    btn_snake = 'SNAKE'

    node_wnd_journal = wait_for_node_visible(poco, wnd_journal, 2)
    if not node_wnd_journal.exists():
        out('Window not showed', wnd_journal)
        return False

    if get_journal_state(node_wnd_journal) != js_status:
        out('переходим во вкладку статуса игрока')
        touch_center(dev, get_node_child(node_wnd_journal, btn_status))
        time.sleep(1)

    # получаем заново, т.к. сцена обновилась
    node_wnd_journal = wait_for_node_visible(poco, wnd_journal, 2)
    if not node_wnd_journal.exists():
        out('Window not showed', wnd_journal)
        return False

    if get_journal_state(node_wnd_journal) != js_status:
        out('не перешли во вкладку статуса игрока', '')
        return False

    ### ------------------------------------------------------------

    node_wnd_status = get_node_child(node_wnd_journal, wnd_status)

    touch_center(dev, get_node_child(node_wnd_status, btn_hawk))
    time.sleep(0.5)
    touch_center(dev, get_node_child(node_wnd_status, btn_baran))
    time.sleep(0.5)
    touch_center(dev, get_node_child(node_wnd_status, btn_spider))
    time.sleep(0.5)
    touch_center(dev, get_node_child(node_wnd_status, btn_rabbit))
    time.sleep(0.5)
    touch_center(dev, get_node_child(node_wnd_status, btn_snake))
    time.sleep(0.5)

    return True
Esempio n. 8
0
def run_test_faction(dev, poco):

    out("нажимаем кнопку Fraction")
    node = wait_for_node_visible(poco, btn_faction, 5)
    if not node.exists():
        out('Button not showed', btn_faction)
        return False
    touch_center(dev, node)
    time.sleep(1)

    # проверочка
    node_wnd_faction = wait_for_node_visible(poco, wnd_faction, 2)
    if not node_wnd_faction.exists():
        out('Window not showed', wnd_faction)
        return False

    ### ---------------------------------------

    node_lst = get_node_child(node_wnd_faction, _faction_lst)
    if not node_lst.exists():
        out('Window not showed', node_lst)
        return False

    for item in node_lst.child():
        touch_center(dev, item)
        time.sleep(0.5)

    ### ---------------------------------------

    out('нажимаем кнопку выхода из окна выбора фракции')
    node = wait_for_node_visible(poco, btn_back, 5)
    if not node.exists():
        out('Button not showed', btn_back)
        return False
    touch_center(dev, node)
    time.sleep(1)

    return True
Esempio n. 9
0
def run_test(dev, poco):
    path_back = 'H_Canvas/USER_Main_UI/BACK_BUTTON_MOBILE'
    path_map = 'H_Canvas/USER_Main_UI/SWITCH_TO_MAP/Button_exit'
    # path_map = 'H_Canvas/USER_Main_UI/MAP_ADDON/SWITCH_TO_WORLD'
    
    path_quests_menu = 'H_Canvas/USER_Main_UI/CONFIG/AllButtons/Button_qwest'
    # path_quests_menu_lst = 'H_Canvas/USER_Main_UI/CONFIG_QWESTS/AVR_bg_paper/AVR_bg'
    path_quest_10 = 'H_Canvas/USER_Main_UI/CONFIG_QWESTS/AVR_bg_paper/AVR_bg/A1 (9)'
    path_accept_qst = 'H_Canvas/USER_Main_UI/EVENT_REVARD/Avr_paper/Avr_Accept'
    #path_cancel_qst = 'H_Canvas/USER_Main_UI/EVENT_REVARD/Avr_paper/Avr_Decline'

    path_event_reward = 'H_Canvas/USER_Main_UI/EVENT_REVARD'
    
    ### ---------------------------------------   
    
    if not go_to_academia(dev, poco):
        return False
    time.sleep(1)

    ### ---------------------------------------   
    # идем в меню выбора квеста
    # out('нажимаем кнопку квестов')
    if not wait_and_click_button(dev, poco, path_quests_menu): return False
    # тыкаем первый квест
    if not wait_and_click_button(dev, poco, path_quest_10): return False
    # тыкаем принять
    if not wait_and_click_button(dev, poco, path_accept_qst): return False
    
    # тыкаем 'умения капитана'
    path_node = 'H_Canvas/USER_Main_UI/CONFIG/AllButtons/Button_Xp_captain'
    if not wait_and_click_button(dev, poco, path_node): return False
    time.sleep(1);

    # сообщение 'выбрать умение чтобы его изучить'
    node = wait_for_node_visible(poco, path_event_reward, 5)
    if not node.exists():
        out('долгое ожидание сообщения', 'выбрать умение чтобы его изучить')
        return False
    if not wait_and_click_button(dev, poco, path_back): return False        
    time.sleep(1);

    # пробежимся по всем скилам
    path_root_skills = 'H_Canvas/USER_Main_UI/CONFIG_SKILLS'
    path_learn = 'H_Canvas/USER_Main_UI/CONFIG_SKILLS/Learn(Clone)'
    subpath_skills = ['Some Skill', 'Some Skill (14)', \
                      'Some Skill (1)', 'Some Skill (15)', \
                      'Some Skill (6)', 'Some Skill (20)', \
                      'Some Skill (3)', 'Some Skill (17)', \
                      'Some Skill (4)', 'Some Skill (18)', \
                      'Some Skill (5)', 'Some Skill (19)']
    
    node_root_skills = wait_for_node_visible(poco, path_root_skills, 5)
    if not node_root_skills.exists():
        out('долгое ожидание ноды списка', path_root_skills)
        return False
    
    for subpath in subpath_skills:
        # node = wait_for_node_visible(poco, path_root_skills + '/' + subpath)
        node = get_node_child(node_root_skills, subpath)
        if not node.exists():
            out('скилл не найден', path_root_skills + ' ' + subpath)
            return False
        touch_center(dev, node)
        # snapshot()
        time.sleep(0.5);

    # тыкаем "изучить"
    if not wait_and_click_button(dev, poco, path_learn): return False        

    time.sleep(2);

    # сообщение "вот ваша награда"
    node = wait_for_node_visible(poco, path_event_reward, 5)
    if not node.exists():
        out('долгое ожидание сообщения', '"вот ваша награда"')
        return False
    if not wait_and_click_button(dev, poco, path_back): return False        
    
    ### ---------------------------------------    
        
    out('нажимаем кнопку выхода из города на карту')
    node = wait_for_node_visible(poco, path_map, 5)
    if not node.exists():
        out('Button not showed', path_map)
        return False
    touch_center(dev, node)
    time.sleep(1)

    return True
Esempio n. 10
0
def run_test(dev, poco, big_test=False):
    path_back = 'H_Canvas/USER_Main_UI/BACK_BUTTON_MOBILE'
    path_map = 'H_Canvas/USER_Main_UI/SWITCH_TO_MAP/Button_exit'
    # path_map = 'H_Canvas/USER_Main_UI/MAP_ADDON/SWITCH_TO_WORLD'

    path_quests_menu = 'H_Canvas/USER_Main_UI/CONFIG/AllButtons/Button_qwest'
    # wnd_quests_menu_lst = 'H_Canvas/USER_Main_UI/CONFIG_QWESTS/AVR_bg_paper/AVR_bg'
    path_quest_6 = 'H_Canvas/USER_Main_UI/CONFIG_QWESTS/AVR_bg_paper/AVR_bg/A1 (5)'
    path_quest_7 = 'H_Canvas/USER_Main_UI/CONFIG_QWESTS/AVR_bg_paper/AVR_bg/A1 (6)'
    path_spec_pirate = 'H_Canvas/USER_Main_UI/CONFIG_QWESTS/AVR_bg_paper/AVR_bg/SPEC_Panel/SPEC_pirate'
    path_accept_qst = 'H_Canvas/USER_Main_UI/EVENT_REVARD/Avr_paper/Avr_Accept'
    path_cancel_qst = 'H_Canvas/USER_Main_UI/EVENT_REVARD/Avr_paper/Avr_Decline'

    path_event_reward = 'H_Canvas/USER_Main_UI/EVENT_REVARD'

    ### ---------------------------------------

    if not go_to_academia(dev, poco):
        return False
    time.sleep(1)

    ### ---------------------------------------
    # идем в меню выбора квеста
    # out('нажимаем кнопку квестов')
    if not wait_and_click_button(dev, poco, path_quests_menu): return False
    # тыкаем первый квест
    if not wait_and_click_button(dev, poco, path_quest_6): return False
    # тыкаем принять
    if not wait_and_click_button(dev, poco, path_accept_qst): return False

    # нажимаем кнопку выхода из города на карту
    node = wait_for_node_visible(poco, path_map, 5)
    if not node.exists():
        out('Button not showed', path_map)
        return False
    touch_center(dev, node)
    time.sleep(1)

    # поплыли на жанетту
    path = 'T_GLOBAL_MAP/EPTown_Janetta'
    node = wait_for_node_visible(poco, path, 5)
    touch_center(dev, node)

    # '''
    user_main_ui = 'H_Canvas/USER_Main_UI'
    fights = [
        'NEW_FIGHT/AUTOFIGHT', 'NEW_FIGHT (1)/AUTOFIGHT',
        'NEW_FIGHT (2)/AUTOFIGHT'
    ]
    f_exit = False
    i = 50
    while not f_exit:
        i -= 1
        if i < 0:
            out('долгое ожидание сообщения', 'корабль достаточно потрепало...')
            return False
        node = wait_for_node_visible(poco, user_main_ui)
        wnd_reward = get_node_child(node, 'EVENT_REVARD', False)
        if wnd_reward.exists():
            # по идее дождались сообщения о повреждённости корабля
            out('корабль достаточно потрепало...')
            if not wait_and_click_button(dev, poco, path_back): return False
            f_exit = True
        else:
            touched = False
            for fight in fights:
                node_fight = get_node_child(node, fight, False)
                if node_fight.exists() and not touched:
                    out('автобой... ' + fight)
                    touch_center(dev, node_fight)
                    touched = True
        if not f_exit:
            time.sleep(0.5)

    state = find_current_state(poco)
    while state != State.TOWN:
        out('ждём Жанетту (3 sec)')
        time.sleep(3)
        state = find_current_state(poco)
    # '''

    # идем в меню выбора квеста
    out('нажимаем кнопку квестов')
    if not wait_and_click_button(dev, poco, path_quests_menu): return False

    # чинимся за счёт пиратов
    out('чинимся за счёт пиратов')
    if not wait_and_click_button(dev, poco, path_spec_pirate): return False

    # сообщение "вот ваша награда"
    node = wait_for_node_visible(poco, path_event_reward, 5)
    if not node.exists():
        out('долгое ожидание сообщения', '"вот ваша награда"')
        return False
    if not wait_and_click_button(dev, poco, path_back): return False

    out('нажимаем кнопку выхода из города на карту')
    node = wait_for_node_visible(poco, path_map, 5)
    if not node.exists():
        out('Button not showed', path_map)
        return False
    touch_center(dev, node)
    time.sleep(1)

    out('плывём в академию')
    if not go_to_academia(dev, poco):
        return False

    time.sleep(2)

    if big_test:
        # идем в меню выбора квеста
        if not wait_and_click_button(dev, poco, path_quests_menu): return False
        # тыкаем третий квест
        if not wait_and_click_button(dev, poco, path_quest_7): return False
        # тыкаем отменить
        if not wait_and_click_button(dev, poco, path_cancel_qst): return False
        # тыкаем назад из меню квестов
        if not wait_and_click_button(dev, poco, path_back): return False
    ### ---------------------------------------

    out('нажимаем кнопку выхода из города на карту')
    node = wait_for_node_visible(poco, path_map, 5)
    if not node.exists():
        out('Button not showed', path_map)
        return False
    touch_center(dev, node)
    time.sleep(1)

    return True
Esempio n. 11
0
def run_test_tutorial_2(dev, poco, big_test=False):
    btn_back = 'H_Canvas/USER_Main_UI/BACK_BUTTON_MOBILE'
    btn_map = 'H_Canvas/USER_Main_UI/SWITCH_TO_MAP/Button_exit'
    # btn_map = 'H_Canvas/USER_Main_UI/MAP_ADDON/SWITCH_TO_WORLD'
    
    btn_quests_menu = 'H_Canvas/USER_Main_UI/CONFIG/AllButtons/Button_qwest'
    # wnd_quests_menu_lst = 'H_Canvas/USER_Main_UI/CONFIG_QWESTS/AVR_bg_paper/AVR_bg'
    btn_quest_2 = 'H_Canvas/USER_Main_UI/CONFIG_QWESTS/AVR_bg_paper/AVR_bg/A1 (1)'
    btn_quest_3 = 'H_Canvas/USER_Main_UI/CONFIG_QWESTS/AVR_bg_paper/AVR_bg/A1 (2)'
    btn_accept_qst = 'H_Canvas/USER_Main_UI/EVENT_REVARD/Avr_paper/Avr_Accept'
    btn_cancel_qst = 'H_Canvas/USER_Main_UI/EVENT_REVARD/Avr_paper/Avr_Decline'

    wnd_event_reward = 'H_Canvas/USER_Main_UI/EVENT_REVARD'
    
    ### ---------------------------------------   
    
    if not go_to_academia(dev, poco):
        return False
    time.sleep(1)

    ### ---------------------------------------   
    # идем в меню выбора квеста
    # out('нажимаем кнопку квестов')
    if not wait_and_click_button(dev, poco, btn_quests_menu): return False
    # тыкаем первый квест
    if not wait_and_click_button(dev, poco, btn_quest_2): return False
    # тыкаем принять
    if not wait_and_click_button(dev, poco, btn_accept_qst): return False
    
    # тыкаем 'H_Canvas/USER_Main_UI/CONFIG/AllButtons/Button_team'
    btn_team = 'H_Canvas/USER_Main_UI/CONFIG/AllButtons/Button_team'
    if not wait_and_click_button(dev, poco, btn_team): return False
    
    # сообщение "Сначала наймем команду"
    node = wait_for_node_visible(poco, wnd_event_reward, 5)
    if not node.exists():
        out('долгое ожидание сообщения', 'нет сообщения "Сначала наймем команду"')
        return False
    if not wait_and_click_button(dev, poco, btn_back): return False

    # тыкаем 'H_Canvas/USER_Main_UI/CONFIG_TEAM_MOBILE/TeamManageShipMobile/ScrollingPanel/TavernButton'
    btn_tavern = 'H_Canvas/USER_Main_UI/CONFIG_TEAM_MOBILE/'\
        +'TeamManageShipMobile/ScrollingPanel/TavernButton'
    if not wait_and_click_button(dev, poco, btn_tavern): return False

    # сообщение "Найми 7 салаг."
    node = wait_for_node_visible(poco, wnd_event_reward, 5)
    if not node.exists():
        out('долгое ожидание сообщения', 'нет сообщения "Найми 7 салаг."')
        return False
    if not wait_and_click_button(dev, poco, btn_back): return False

    # тыкаем 7 раз на салагу "+" 
    # 'H_Canvas/USER_Main_UI/CONFIG_TEAM_MOBILE/TeamManageShipMobile/ScrollingPanel/TavernButton'
    btn_crewman_hire_0 = 'H_Canvas/USER_Main_UI/CONFIG_TEAM_MOBILE/'\
        +'TeamManageTavernMobile/TavernBgImage/Crewman_Hire_0/ActionButton'
    i = 7
    while i > 0:
        if not wait_and_click_button(dev, poco, btn_crewman_hire_0): return False
        i -= 1
    # тыкаем кнопку назад
    if not wait_and_click_button(dev, poco, btn_back): return False
        
    # сообщение "перетащите 2х матросов на паруса"
    node = wait_for_node_visible(poco, wnd_event_reward, 5)
    if not node.exists():
        out('долгое ожидание сообщения', 'перетащите 2х матросов на паруса')
        return False
    if not wait_and_click_button(dev, poco, btn_back): return False        
        
    # подготавливаемся к свайпам
    sn_tmp = 'H_Canvas/USER_Main_UI/CONFIG_TEAM_MOBILE/'\
        +'TeamManageShipMobile/ScrollingPanel/ShipDecks'
    sn_parus = 'ParuDeck/CrewmanDeck_Paru_3'
    sn_aboard = 'AboardDeck/CrewmanDeck_Aboard_3'
    sn_cannon = 'CanonDeck/CrewmanDeck_Canon_3'
    sn_from = 'AboardDeck/CrewmanDeck_Aboard_0'

    node_tmp = wait_for_node_visible(poco, sn_tmp, 5)
    pos_parus = get_node_child(node_tmp, sn_parus).attr('pos')
    pos_aboard = get_node_child(node_tmp, sn_aboard).attr('pos')
    pos_cannon = get_node_child(node_tmp, sn_cannon).attr('pos')
    
    pos_abs_from = pos_center(dev, get_node_child(node_tmp, sn_from))
    
    # перетаскиваем 2х матросов на паруса
    vec = [0, pos_parus[1] - pos_aboard[1]]
    print('vector ', pos_abs_from, vec)
    swipe(pos_abs_from, vector=vec, duration=3)
    sleep(1)
    swipe(pos_abs_from, vector=vec, duration=3)
    sleep(1)

    # сообщение "перетащите 2х матросов на паруса"
    node = wait_for_node_visible(poco, wnd_event_reward, 5)
    if not node.exists():
        out('долгое ожидание сообщения', 'перетащите 2х матросов на пушки')
        return False
    if not wait_and_click_button(dev, poco, btn_back): return False        

    # перетаскиваем 2х матросов на пушки
    vec = [0, pos_cannon[1] - pos_aboard[1]]
    print('vector ', pos_abs_from, vec)
    swipe(pos_abs_from, vector=vec, duration=3)
    sleep(1)
    swipe(pos_abs_from, vector=vec, duration=3)
    sleep(1)

    # сообщение "больше матросов на палубе, больше эффективность"
    node = wait_for_node_visible(poco, wnd_event_reward, 5)
    if not node.exists():
        out('долгое ожидание сообщения', 'больше матросов на палубе, больше эффективность')
        return False
    if not wait_and_click_button(dev, poco, btn_back): return False        

    # тыкаем на кнопку "Раненые" 
    btn_med = 'H_Canvas/USER_Main_UI/CONFIG_TEAM_MOBILE/'\
        +'TeamManageShipMobile/ScrollingPanel/MedbayButton'
    if not wait_and_click_button(dev, poco, btn_med): return False

    # тыкаем на кнопку "лечить матроса" 
    btn_med = 'H_Canvas/USER_Main_UI/CONFIG_TEAM_MOBILE/'\
        +'TeamManageShipMobile/ScrollingPanel/ShipDecks/'\
        +'Medbay/Crewman_Wounded_1/ActionButton'
    if not wait_and_click_button(dev, poco, btn_med): return False

    # сообщение "про офицеров, выбрать"
    node = wait_for_node_visible(poco, wnd_event_reward, 5)
    if not node.exists():
        out('долгое ожидание сообщения', 'про офицеров, выбрать')
        return False
    if not wait_and_click_button(dev, poco, btn_back): return False        

    # тыкаем на кнопку "слот офицера 1" 
    btn_med = 'H_Canvas/USER_Main_UI/CONFIG_TEAM_MOBILE/'\
        +'TeamManageShipMobile/ScrollingPanel/RightPanel/'\
        +'DeckStats_Paru/BorderImage/OfficerSlotsPanel/OfficerSlot1'
    if not wait_and_click_button(dev, poco, btn_med): return False
    
    # тыкаем на кнопку "боцман" 
    btn_med = 'H_Canvas/USER_Main_UI/CONFIG_TEAM_MOBILE/'\
        +'TeamManageShipMobile/OfficersWindow/BgImage/'\
        +'BorderImage/SlotsPanel/OfficerSlot1'
    if not wait_and_click_button(dev, poco, btn_med): return False

    # тыкаем на кнопку "назначить" 
    btn_med = 'H_Canvas/USER_Main_UI/CONFIG_TEAM_MOBILE/'\
        +'TeamManageShipMobile/OfficersWindow/BgImage/'\
        +'BorderImage/ActionButton(Clone)'
    if not wait_and_click_button(dev, poco, btn_med): return False

    time.sleep(2);

    # сообщение "вот ваша награда"
    node = wait_for_node_visible(poco, wnd_event_reward, 5)
    if not node.exists():
        out('долгое ожидание сообщения', '"вот ваша награда"')
        return False
    if not wait_and_click_button(dev, poco, btn_back): return False        
    
    if big_test:
        # идем в меню выбора квеста
        if not wait_and_click_button(dev, poco, btn_quests_menu): return False
        # тыкаем третий квест
        if not wait_and_click_button(dev, poco, btn_quest_3): return False
        # тыкаем отменить
        if not wait_and_click_button(dev, poco, btn_cancel_qst): return False
        # тыкаем назад из меню квестов
        if not wait_and_click_button(dev, poco, btn_back): return False
    ### ---------------------------------------    
        
    out('нажимаем кнопку выхода из города на карту')
    node = wait_for_node_visible(poco, btn_map, 5)
    if not node.exists():
        out('Button not showed', btn_map)
        return False
    touch_center(dev, node)
    time.sleep(1)

    return True
Esempio n. 12
0
def test_journal_goods(dev, poco):

    node_btn_back = wait_for_node_visible(poco, btn_back, 2)
    wnd_goods_opt = wnd_journal + '/' + wnd_goods

    node_wnd_journal = wait_for_node_visible(poco, wnd_journal, 2)
    if not node_wnd_journal.exists():
        out('Window not showed', wnd_journal)
        return False

    if get_journal_state(node_wnd_journal) != js_goods:
        out('переходим во вкладку имущества')
        touch_center(dev, get_node_child(node_wnd_journal, btn_goods))
        time.sleep(1)

    # получаем заново, т.к. сцена обновилась
    node_wnd_journal = wait_for_node_visible(poco, wnd_journal, 2)
    if not node_wnd_journal.exists():
        out('Window not showed', wnd_journal)
        return False

    if get_journal_state(node_wnd_journal) != js_goods:
        out('не перешли во вкладку имущества', '')
        return False

    ### ------------------------------------------------------------
    node_wnd_goods = wait_for_node_visible(poco, wnd_goods_opt, 2)
    node_btn_trum = get_node_child(node_wnd_goods, 'Trum')
    # node_btn_sklads = get_node_child(node_wnd_goods, 'Sklads')
    # node_btn_WhereToBuy = get_node_child(node_wnd_goods, 'WhereToBuy')

    # out('click:' + node_btn_trum.attr('text'))
    touch_center(dev, node_btn_trum)

    node_wnd_goods = wait_for_node_visible(poco, wnd_goods_opt, 2)
    items = node_wnd_goods.offspring('Towars')
    if len(items) > 0:
        i = 0
        for item in items:
            i = i + 1
            if i < 3:
                touch_center(dev, item)
                time.sleep(0.5)
                touch_center(dev, node_btn_back)
                time.sleep(0.5)
    else:
        out('trum list is empty')

    ### ------------------------------------------------------------
    node_wnd_goods = wait_for_node_visible(poco, wnd_goods_opt, 2)
    # node_btn_trum = get_node_child(node_wnd_goods, 'Trum')
    node_btn_sklads = get_node_child(node_wnd_goods, 'Sklads')
    # node_btn_WhereToBuy = get_node_child(node_wnd_goods, 'WhereToBuy')

    # out('click:' + node_btn_trum.attr('text'))
    touch_center(dev, node_btn_sklads)

    node_wnd_goods = wait_for_node_visible(poco, wnd_goods_opt, 2)
    items = node_wnd_goods.offspring('Towars')
    if len(items) > 0:
        i = 0
        for item in items:
            i = i + 1
            if i < 3:
                touch_center(dev, item)
                time.sleep(0.5)
                touch_center(dev, node_btn_back)
                time.sleep(0.5)
    else:
        out('sklads list is empty')

    ### ------------------------------------------------------------
    node_wnd_goods = wait_for_node_visible(poco, wnd_goods_opt, 2)
    # node_btn_trum = get_node_child(node_wnd_goods, 'Trum')
    # node_btn_sklads = get_node_child(node_wnd_goods, 'Sklads')
    node_btn_WhereToBuy = get_node_child(node_wnd_goods, 'WhereToBuy')

    # out('click:' + node_btn_trum.attr('text'))
    touch_center(dev, node_btn_WhereToBuy)

    node_wnd_goods = wait_for_node_visible(poco, wnd_goods_opt, 2)
    items = node_wnd_goods.offspring('Towars')
    if len(items) > 0:
        i = 0
        for item in items:
            i = i + 1
            if i < 3:
                touch_center(dev, item)
                time.sleep(0.5)
                touch_center(dev, node_btn_back)
                time.sleep(0.5)
    else:
        out('WhereToBuy list is empty')

    return True