def test_screen_schedule(self):
        helper = HelperBase(self.driver)

        # авторизация
        auth_helper.open_and_fill_login_pass_fields(self.driver)
        auth_helper.fill_office_shk_field(self.driver)

        # проверить каждую кнопку на экране "Распорядок дня"
        schedule_buttons_name_and_header_name = {
            'Прийти на работу': '//android.widget.Button[@text="Вход"]',
            'Прием коробок':
            '//android.widget.LinearLayout[@content-desc="Прием"]',
            'Прием вещей на волнорез':
            '//android.widget.LinearLayout[@content-desc="Сканирование"]',
            'Сканировать возвраты/отказы':
            '//android.widget.LinearLayout[@content-desc="Возврат на склад"]',
            'Переместить вещи':
            '//android.widget.LinearLayout[@content-desc="Перемещение"]',
            'Уйти с работы':
            '//android.widget.LinearLayout[@content-desc="Выход"]'
        }

        schedule_helper.schedule_buttons_iterator(
            self.driver, schedule_buttons_name_and_header_name)

        # проверить каждую кнопку в меню
        burger_menu_button = helper.find_by_xpath(
            '//android.widget.ImageButton[@content-desc="Open navigation drawer"]'
        )
        helper.click_by_element(burger_menu_button)
        helper.wait_activity('some.application.debug:id/tv_user_info')
        user_name = helper.get_text_by_id(
            'some.application.debug:id/tv_user_info')
        pvz_name = helper.get_text_by_id('some.application.debug:id/tv_office')
        assert user_name == InitConfig.fullUserName
        assert pvz_name == InitConfig.pvzName

        menu_buttons_name_and_header_name = {
            'Возврат товара':
            '//android.widget.EditText[@text="Поиск клиента"]',
            'Инвентаризация':
            '//android.widget.TextView[@text="Место хранения не выбрано"]',
            'Вещи в офисе': '//android.widget.EditText[@text="Поиск вещей"]',
            'Коробки в офисе': '//android.widget.TextView[@text="Список"]',
            'Движение вещей':
            f'//android.widget.TextView[@text="{date.today().strftime("%d.%m.%Y")}"]',
            'Отгрузки':
            '//android.widget.TextView[@text="Коробка не отсканирована"]',
            'Инструкции': '//android.widget.TextView[@text="Инструкции"]',
            'Уведомления': '//android.widget.CompoundButton[@text="Все"]',
            'Настройки':
            '//android.widget.TextView[@text="Режим сканирования"]',
            'Выход':
            '//android.widget.TextView[@text="Выход из учетной записи"]'
        }

        schedule_helper.menu_buttons_iterator(
            self.driver, menu_buttons_name_and_header_name)
Ejemplo n.º 2
0
def fill_office_shk_field(driver):
    helper = HelperBase(driver)

    office_shk_field = helper.find_by_id(
        'some.application.debug:id/et_office_shk')
    helper.click_by_element(office_shk_field)
    helper.set_value(office_shk_field, InitConfig.officeShK)

    continue_btn = helper.find_by_id('some.application.debug:id/btn_continue')
    helper.click_by_element(continue_btn)
def menu_buttons_iterator(driver, dictionary):
    helper = HelperBase(driver)

    for key, val in dictionary.items():
        menu_button_is_present = helper.is_element_present_by_xpath(
            f'//android.widget.CheckedTextView[@text="{key}"]')

        if menu_button_is_present is not True:
            continue

        menu_button = helper.find_by_xpath(
            f'//android.widget.CheckedTextView[@text="{key}"]')
        helper.click_by_element(menu_button)
        helper.wait_activity(val)
        element_in_screen = helper.find_by_xpath(val)

        if not (element_in_screen is None):
            helper.swipe_menu()
            helper.wait_activity('some.application.debug:id/tv_user_info')
            helper.swipe_menu_from_down_to_up()
Ejemplo n.º 4
0
    def test_shk_office_screen(self):
        helper = HelperBase(self.driver)

        # перейти на экран с вводом ШК офиса
        auth_helper.open_and_fill_login_pass_fields(self.driver)

        # открыть/закрыть сканер
        scanner_btn = helper.find_by_id('some.application.debug:id/tv_scan')
        helper.click_by_element(scanner_btn)

        close_scanner_btn = helper.find_by_id(
            'some.application.debug:id/iv_close')
        helper.click_by_element(close_scanner_btn)

        # провилидировать поле "ШК офиса"
        office_shk_list = [
            None, 'OFFC1', 'OFFC1234567890', 'OFFC12345678900',
            'офис1234567890', '@#%&++-&%$#@@$'
        ]

        auth_helper.office_shk_form_iterator(self.driver, office_shk_list)
Ejemplo n.º 5
0
def office_shk_form_iterator(driver, office_shk_list):
    helper = HelperBase(driver)

    office_shk_field = helper.find_by_id(
        'some.application.debug:id/et_office_shk')

    for value in office_shk_list:
        helper.wait_activity(office_shk_field)
        helper.click_by_element(office_shk_field)
        helper.clear_field(office_shk_field)
        helper.set_value(office_shk_field, value)

        continue_btn = helper.find_by_id(
            'some.application.debug:id/btn_continue')

        if value is None or len(value) < 14 or len(value) > 14:
            continue_btn_enabled_state = helper.is_enabled(continue_btn)
            if continue_btn_enabled_state is False:
                continue

        helper.click_by_element(continue_btn)

        helper.wait_activity('some.application.debug:id/title')
        popup_header_text = helper.get_text_by_id(
            'some.application.debug:id/title')
        assert popup_header_text == "Ошибка"

        popup_ok_btn = helper.find_by_id('android:id/button1')
        helper.click_by_element(popup_ok_btn)
def schedule_buttons_iterator(driver, dictionary):
    helper = HelperBase(driver)

    for key, val in dictionary.items():
        schedule_button_is_present = helper.is_element_present_by_xpath(
            f'//android.widget.TextView[@text="{key}"]/../../android.widget.ImageView[3]'
        )

        if schedule_button_is_present is not True:
            continue

        schedule_button = helper.find_by_xpath(
            f'//android.widget.TextView[@text="{key}"]')
        helper.click_by_element(schedule_button)
        helper.wait_activity(val)
        back_button = helper.find_by_xpath(
            '//android.widget.ImageButton[@content-desc="Navigate up"]')
        helper.click_by_element(back_button)

        helper.wait_activity(
            '//android.widget.TextView[@text="Распорядок дня"]')
        helper.swipe_from_down_to_up()
Ejemplo n.º 7
0
def open_and_fill_phone_pass_fields(driver):
    helper = HelperBase(driver)

    login_by_phone_btn = helper.find_by_id(
        'some.application.debug:id/tv_login_by_phone')
    helper.click_by_element(login_by_phone_btn)

    helper.wait_activity('some.application.debug:id/et_login', 2, 1)

    phone_field = helper.find_by_id('some.application.debug:id/et_login')
    helper.click_by_element(phone_field)
    helper.set_value(phone_field, InitConfig.userPhone)

    sms_pass_field = helper.find_by_id('some.application.debug:id/et_password')
    helper.click_by_element(sms_pass_field)
    helper.set_value(sms_pass_field, InitConfig.userSmsPass)

    show_pass_btn = helper.find_by_id(
        'some.application.debug:id/text_input_end_icon')
    helper.click_by_element(show_pass_btn)

    continue_btn = helper.find_by_id('some.application.debug:id/btn_login')
    helper.click_by_element(continue_btn)
Ejemplo n.º 8
0
def login_pass_form_iterator(driver, dictionary):
    helper = HelperBase(driver)

    helper.wait_activity('some.application.debug:id/et_login')
    login_field = helper.find_by_id('some.application.debug:id/et_login')
    pass_field = helper.find_by_id('some.application.debug:id/et_password')

    for key, val in dictionary.items():
        helper.wait_activity(login_field)
        helper.click_by_element(login_field)
        helper.clear_field(login_field)
        helper.set_value(login_field, key)

        helper.click_by_element(pass_field)
        helper.clear_field(pass_field)
        helper.set_value(pass_field, val)

        show_pass_btn = helper.find_by_id(
            'some.application.debug:id/text_input_end_icon')
        helper.click_by_element(show_pass_btn)

        continue_btn = helper.find_by_id('some.application.debug:id/btn_login')

        if key is None or val is None:
            continue_btn_enabled_state = helper.is_enabled(continue_btn)
            if continue_btn_enabled_state is False:
                continue

        helper.click_by_element(continue_btn)

        helper.wait_activity('some.application.debug:id/title')
        popup_header_text = helper.get_text_by_id(
            'some.application.debug:id/title')
        assert popup_header_text == "Неверный логин или пароль"

        popup_ok_btn = helper.find_by_id('android:id/button1')
        helper.click_by_element(popup_ok_btn)
Ejemplo n.º 9
0
def open_and_fill_login_pass_fields(driver):
    helper = HelperBase(driver)

    login_field = helper.find_by_id('some.application.debug:id/et_login')
    helper.click_by_element(login_field)
    helper.set_value(login_field, InitConfig.userName)

    pass_field = helper.find_by_id('some.application.debug:id/et_password')
    helper.click_by_element(pass_field)
    helper.set_value(pass_field, InitConfig.userPass)

    continue_btn = helper.find_by_id('some.application.debug:id/btn_login')
    helper.click_by_element(continue_btn)