def __init__(self, man): self.man = man self.button = ButtonsHelper(man) self.function = CommonFunctions() self.action = ActionChains self.locator = Locators(man) self.__wait = Wait(man)
def __init__(self, man): self.man = man self.button = ButtonsHelper(man) self.forms = FormsHelper(man) self.function = CommonFunctions() self.action = ActionChains self.__wait = Wait(man) self.__locator_xxlarge = "//*[@class='text-size-xxlarge']"
class FunctionMemorized: def __init__(self, man): self.man = man self.button = ButtonsHelper(man) self.function = CommonFunctions() self.locator = Locators(man) self.__wait = Wait(man) # Проверка функции "Запомнено" def check_remember_goods(self, query): wd = self.man.wd self.button.search_goods(wd, query) self.button.click_magnifier(wd) self.button.go_to_list(wd) with allure.step("Кликаю на любую пиктограмму 'Запомнено'"): self.select_random_element(wd) header = self.locator.click_header_button() header[0].click() self.locator.open_left_panel() h1 = "//*[@class='cell']/h1" self.__wait.until_visible_by_xpath_locator(h1) get_h1 = wd.find_element_by_xpath(h1).text link_left = "//*[@id='wishlist_link_left']//span[@class='badge']" self.__wait.until_visible_by_xpath_locator(link_left) badge_left_wishlist = wd.find_element_by_xpath(link_left).text wishlist_link = "//*[@id='wishlist_link']//span" self.__wait.until_visible_by_xpath_locator(wishlist_link) badge_header_wishlist = wd.find_element_by_xpath(wishlist_link).text count = len(wd.find_elements_by_xpath(self.locator.in_table_wishlist)) return get_h1, int(badge_left_wishlist), int(badge_header_wishlist), int(count) # Проверка функции "Запомнено" снять товар def check_remember_disable_item(self, query): wd = self.man.wd self.button.search_goods(wd, query) self.button.click_magnifier(wd) with allure.step("Кликаю на любую пиктограмму 'Запомнено'"): self.select_random_element(wd) header = self.locator.click_header_button() header[0].click() with allure.step("Отключаю все запомненные товары"): all_buttons = wd.find_elements_by_xpath("//*[@class='product-line__link wish_button has-tip']/i") len(all_buttons) for button in all_buttons: button.click() time.sleep(0.3) with allure.step("Кликаю на вкладку 'Товары', чтобы обновить страницу"): wd.find_element_by_xpath("//*[@class='tabs-title desc-tabs__title active']").click() count = len(wd.find_elements_by_xpath(self.locator.in_table_wishlist)) return int(count) def select_random_element(self, wd): try: self.function.click_random_element(wd, "//*[@class='prod__img-buttons']/li[1]") except Exception: self.function.click_random_element(wd, "//*[@class='margin-bottom-6']/a[1]")
class FunctionComparison: def __init__(self, man): self.man = man self.button = ButtonsHelper(man) self.function = CommonFunctions() self.locator = Locators(man) # Проверка функции "Сравнение" добавить товар def check_comparison_enable_item(self, query): wd = self.man.wd self.button.search_goods(wd, query) self.button.click_enter_keys(wd) time.sleep(2) with allure.step("Кликаю на любую пиктограмму 'Сравнение'"): self.select_random_element(wd) header = self.locator.click_header_button() header[1].click() self.locator.open_left_panel() time.sleep(1) get_h1 = wd.find_element_by_xpath(self.locator.get_h1).text badge_left = wd.find_element_by_xpath("//*[@id='comparelist_link_left']//span[@class='badge']").text return get_h1, int(badge_left) # Проверка функции "Сравнение" снять товары def check_comparison_disable_item(self, query): wd = self.man.wd self.button.search_goods(wd, query) self.button.click_enter_keys(wd) with allure.step("Кликаю на любую пиктограмму 'Сравнение'"): self.select_random_element(wd) header = self.locator.click_header_button() header[1].click() with allure.step("Полностью очищаю список товаров"): wd.find_element_by_id("compare_delete_all").click() is_numeral = self.function.is_element_present(wd, By.XPATH, "//*[@id='comparelist_link']//span[@class='badge']") if is_numeral: return True else: return False def select_random_element(self, wd): try: self.function.click_random_element(wd, "//*[@class='prod__img-buttons']/li[2]") except Exception: self.function.click_random_element(wd, "//*[@class='product-line__link compare_button has-tip']")
class SearchGoods: def __init__(self, man): self.man = man self.button = ButtonsHelper(man) self.function = CommonFunctions() self.__wait = Wait(man) # Поиск товаров/услуг и автокомплит def search_goods_autocomplit_to_rubrics(self, query): wd = self.man.wd self.button.search_goods(wd, query) id3 = "//*[@id='ui-id-3']" self.__wait.until_visible_by_xpath_locator(id3) wd.find_element_by_xpath(id3).click() count = self.function.count_in_result(wd) return int(count) # Поиск товаров/услуг с негативным сценарием - запросы с разными лишнеми символами def search_goods_click_to_button(self, query): wd = self.man.wd self.button.search_goods(wd, query) self.button.click_magnifier(wd) count = self.function.count_in_result(wd) return int(count) def check_tabs_in_main_result(self, query): ''' TODO: загатовка для нового теста, чтобы кликать по табам в карточке компании получать и сверять количество товаров в табах ''' wd = self.man.wd self.button.search_goods(wd, query) self.button.click_magnifier(wd) tabs = wd.find_elements_by_xpath(".//div[@id='ui-tabs-1']/ul//li") for tab in tabs: tab.click() count = self.function.count_in_result(wd) return count
class ShowData: def __init__(self, man): self.man = man self.button = ButtonsHelper(man) self.function = CommonFunctions() # WS-d-016 Проверка телефонов на сайте и в БД в карточке товара # проверка раскрытия телефонов при клике # передаёт id товара, номер телефона для проверки в тест кейс def check_phone_in_goods(self, query_order): wd = self.man.wd self.button.search_goods(wd, query_order) self.button.click_magnifier(wd) time.sleep(2) id_goods = self.click_random_goods(wd) phone = wd.find_element_by_xpath( "//*[@class='seller__info']/a[2]").text return self.function.req_phone(phone), id_goods # клик на любой товар в товарной выдаче не зависимо от позицианирования - списоком или галереей # передаёт id товара def click_random_goods(self, wd): try: elements = wd.find_elements_by_xpath("//*[@id='goods']//h5/a") id_goods = self.random_click(elements) except: elements = wd.find_elements_by_xpath( "//*[@class='prod-container']/div[1]/a[1]") id_goods = self.random_click(elements) return id_goods def random_click(self, elements): random_element = random.choice(elements) href = random_element.get_attribute("href") spl = href.split('/')[-1] random_element.click() return spl
def test_check_show_phones(man, db, n=None): phone_on_site = man.check_data.check_phone_in_goods(query_goods) get_phone = db.get_id_goods(phone_on_site[1]).split(',')[0] phone_in_db = CommonFunctions.req_phone(n, get_phone) assert phone_on_site[0] == phone_in_db
def __init__(self, man): self.man = man self.button = ButtonsHelper(man) self.function = CommonFunctions() self.locator = Locators(man)
class FunctonCart: def __init__(self, man): self.man = man self.button = ButtonsHelper(man) self.function = CommonFunctions() self.action = ActionChains self.locator = Locators(man) self.__wait = Wait(man) # Проверка функции "Корзина" def check_goods_cart(self, query): wd = self.man.wd self.button.search_goods(wd, query) self.button.click_magnifier(wd) self.button.go_to_list(wd) with allure.step("Кликаю на любую кнопку 'В корзину'"): self.function.select_card_or_book(wd) self.button.go_to_cart(wd) self.locator.open_left_panel() self.__wait.until_visible_by_xpath_locator(self.locator.get_h1) get_h1 = wd.find_element_by_xpath(self.locator.get_h1).text badge = "//*[@class='off-canvas__user-link cart-icon']//span[@class='badge']" self.__wait.until_visible_by_xpath_locator(badge) badge_left_cart = wd.find_element_by_xpath(badge).text has_tip = "//*[@class='header__buttons-link has-tip']//span" self.__wait.until_visible_by_xpath_locator(has_tip) badge_header_cart = wd.find_element_by_xpath(has_tip).text div_cart = "//*[@class='div_cart']" count = len(wd.find_elements_by_xpath(div_cart)) return get_h1, int(badge_left_cart), int(badge_header_cart), int(count) # Проверка функции "Корзина" снять товар def check_cart_disable_item(self, query): wd = self.man.wd self.button.search_goods(wd, query) self.button.click_magnifier(wd) self.button.go_to_list(wd) with allure.step("Кликаю на любую кнопку 'В корзину'"): self.function.select_card_or_book(wd) try: self.button.go_to_cart(wd) except ElementNotInteractableException: wd.find_element_by_xpath("//*[@id='one-click-order']//span[@aria-hidden='true']").click() all_buttons = wd.find_elements_by_xpath("//*[@class='cart_del_button']") len(all_buttons) for button in all_buttons: button.click() time.sleep(0.3) count = len(wd.find_elements_by_xpath("//*[@class='div_cart']")) return int(count) def check_send_order_from_cart(self, query, data): wd = self.man.wd self.button.search_goods(wd, query) self.button.click_magnifier(wd) title = "//*[@title='Косметика для лица и тела']" self.__wait.until_visible_by_xpath_locator(title) wd.find_element_by_xpath(title).click() self.button.go_to_list(wd) with allure.step("Кликаю на любую кнопку 'В корзину'"): self.function.select_card_or_book(wd) self.button.go_to_cart(wd) margin = "//*[@class='button text-size-default margin-bottom-8']" self.__wait.until_visible_by_xpath_locator(margin) wd.find_element_by_xpath(margin).click() self.fill_form(data, wd) lead = "//*[@class='grid-container']//p[@class='lead']" self.__wait.until_visible_by_xpath_locator(lead) text_message = wd.find_element_by_xpath(lead).text return text_message def fill_order(self, query_order, data): wd = self.man.wd self.button.search_goods(wd, query_order) self.button.click_magnifier(wd) self.button.go_to_list(wd) self.function.select_card_or_book(wd) with allure.step("Заполняю форму тестовыми данными"): self.fill_form(data, wd) # Проверка функции "Оформление заказа" def check_send_order(self, query_order, data): wd = self.man.wd self.fill_order(query_order, data) confirmation = "//*[@id='order-confirmation']//p" self.__wait.until_visible_by_xpath_locator(confirmation) return wd.find_element_by_xpath(confirmation).text def check_send_order_negative(self, query_order, data): wd = self.man.wd self.fill_order(query_order, data) red_error = "//*[@class='red red_error']" self.__wait.until_visible_by_xpath_locator(red_error) return wd.find_element_by_xpath(red_error).text def fill_form(self, data, wd): try: wd.find_element_by_id("one_click_name").send_keys(data.order_name) except ElementNotInteractableException: wd.find_element_by_id("order_name").send_keys(data.order_name) try: wd.find_element_by_id("one_click_email").send_keys(data.order_email) except ElementNotInteractableException: wd.find_element_by_id("order_email").send_keys(data.order_email) try: wd.find_element_by_id("one_click_phone").send_keys(data.order_phone) except ElementNotInteractableException: wd.find_element_by_id("order_phone").send_keys(data.order_phone) try: wd.find_element_by_id("one_click_comment").send_keys(data.commit_window) except ElementNotInteractableException: wd.find_element_by_id("order_comment").send_keys(data.order_comment) try: wd.find_element_by_id("one_click_send").click() except (ElementNotInteractableException, NoSuchElementException): wd.find_element_by_id("order_send").click()
def __init__(self, man): self.man = man self.function = CommonFunctions() self.__wait = Wait(man)
class PrivateOffice: def __init__(self, man): self.man = man self.function = CommonFunctions() self.__wait = Wait(man) def locator_message(self): wd = self.man.wd message = "message" self.__wait.until_not_visible_by_id(message) send_message = wd.find_element_by_id(message).text with allure.step(f"Отправил текст для проверки - {send_message}"): return send_message # метод для заполнения полей def fill_company(self): wd = self.man.wd self.select_add_company() data = get_new_company() with allure.step("Открываю форму и заполняю все необходимые поля"): wd.find_element_by_id("name_urid").send_keys(data[0]) wd.find_element_by_id("name").send_keys(data[1]) wd.find_element_by_xpath( "//*[@id='phones']/div/input[1]").send_keys(data[2]) wd.find_element_by_xpath( "//*[@id='phones']/div/input[2]").send_keys(data[3]) wd.find_element_by_id("add_phone").click() wd.find_element_by_xpath( "//*[@id='phones']/div[2]/input[1]").send_keys(data[4]) wd.find_element_by_xpath( "//*[@id='phones']/div[2]/input[2]").send_keys(data[5]) wd.find_element_by_id("mail").send_keys(data[6]) wd.find_element_by_xpath("//*[@id='sites']/div/input").send_keys( data[7]) wd.find_element_by_id("city").send_keys(data[8]) wd.find_element_by_id("street").send_keys(data[9]) wd.find_element_by_id("house").send_keys(data[10]) wd.find_element_by_id("way").send_keys(data[11]) self.scrolling() wd.find_element_by_id("position").send_keys(data[12]) wd.find_element_by_id("manager").send_keys(data[13]) wd.find_element_by_xpath( "//*[@id='busines_annoninput']/input").send_keys(data[14]) # метод выбор меню Зарегистрировать компанию def select_add_company(self): wd = self.man.wd with allure.step("Кликаю на кнопку 'Добавить компанию'"): button_add = "button_add" self.__wait.until_visible_by_class_name(button_add) wd.find_element_by_class_name(button_add).click() # метод для прокрутки страницы def scrolling(self): wd = self.man.wd wd.find_element_by_xpath( "//*[@id='registercompanyform']//input[@id='reg_auth']").send_keys( Keys.PAGE_DOWN) # Тест-кейс WS - 014 test_cab_add_company. Добавить новую компанию в БД bis_core_seven.company_register def add_company(self): wd = self.man.wd self.fill_company() busines_feed = "//*[@id='busines_feed']/li/em" self.__wait.until_visible_by_xpath_locator(busines_feed) wd.find_element_by_xpath(busines_feed).click() wd.find_element_by_id("reg_auth").click() return self.locator_message().split('.')[0] # Тест-кейс WS - 015 test_cab_check_company. Проверка функции на наличие существующей компании в БД БИС def check_company(self): wd = self.man.wd self.select_add_company() data = get_current_company() with allure.step("Открываю форму и заполняю поля"): wd.find_element_by_id("name_urid").send_keys(data[0]) wd.find_element_by_xpath( "//*[@id='phones']/div/input[1]").send_keys(data[1]) wd.find_element_by_xpath( "//*[@id='phones']/div/input[2]").send_keys(data[2]) wd.find_element_by_xpath("//*[@id='sites']/div/input").send_keys( data[4]) wd.find_element_by_id("mail").send_keys(data[3]) wd.find_element_by_id("city").send_keys(data[5]) wd.find_element_by_id("street").send_keys(data[6]) wd.find_element_by_id("house").send_keys(data[7]) wd.find_element_by_id("office").click() exist_company = "//*[@id='exist_company']/p[1]" self.__wait.until_visible_by_xpath_locator(exist_company) message = wd.find_element_by_xpath(exist_company).text.split(',')[0] self.click_my_companies(wd) with allure.step(f"Отправил текст для проверки - {message}"): return message def click_my_companies(self, wd): with allure.step("Перешёл в общий список компаний"): my_company = "//*[contains(text(), 'Мои Компании')]" self.__wait.until_visible_by_xpath_locator(my_company) wd.find_element_by_xpath(my_company).click() # Тест-кейс WS - 016 test_cab_confirm_company. Подтверждение обновления действующей компании. def confirm_active_company(self): wd = self.man.wd self.select_firm() wd.find_element_by_xpath( "//*[@id='center_cont_content']//a[contains(text(), 'Редактировать данные компании')]" ).click() wd.find_element_by_id("without_refresh").click() message = self.locator_message() self.click_my_companies(wd) return message # Для проверки даты в Тест-кейс WS - 016 test_cab_confirm_company. def check_date(self): with allure.step( f"Отправил текущею дату на проверку - {date_changed}"): return date_changed def select_firm(self): """ Вспомогательный метод для выбора из списка фирмы Если фирма отсутствует в списке, то првязывает фирму к пользователю в админке """ wd = self.man.wd is_company = "//*[@class='menu_company_list']//a[contains(text(), '" + name_company_D + "')]" self.__wait.until_visible_by_xpath_locator(is_company) if self.function.is_element_present(wd, By.XPATH, is_company): with allure.step(f"Выбераю фирму {name_company_D}"): wd.find_element_by_xpath(is_company).click() else: wd.find_element_by_xpath( "//*[@class='menu_office']//a[contains(text(),'Мой профиль')]" ).click() self.binding_company() wd.find_element_by_xpath(is_company).click() # Тест-кейс WS - 017 test_cab_edit_company. Редактирование действующей компании. def edit_active_company(self): wd = self.man.wd self.select_firm() data = get_edit_company() with allure.step( "Открываю форму и редактирую поля в действующей компании"): wd.find_element_by_xpath( "//*[@id='center_cont_content']/div[1]/div[1]/div[3]/a[1]" ).click() wd.find_element_by_id("add_phone").click() wd.find_element_by_xpath( "//*[@id='phones']/div[2]/input[1]").clear() wd.find_element_by_xpath( "//*[@id='phones']/div[2]/input[1]").send_keys(data[0]) wd.find_element_by_xpath( "//*[@id='phones']/div[2]/input[2]").clear() wd.find_element_by_xpath( "//*[@id='phones']/div[2]/input[2]").send_keys(data[1]) wd.find_element_by_id("street").clear() wd.find_element_by_id("street").send_keys(data[2]) wd.find_element_by_id("house").clear() wd.find_element_by_id("house").send_keys(data[3]) wd.find_element_by_id("manager").clear() wd.find_element_by_id("manager").send_keys(data[4]) with allure.step("Регистрирую форму"): wd.find_element_by_id("reg_auth").click() message = self.locator_message().split('.')[0] self.click_my_companies(wd) return message # если отсутствует привязка копмпании в ЛК, привязываем к пользователю def binding_company(self): wd = self.man.wd wd.find_element_by_xpath( "//*[@class='menu_office']//a[contains(text(),'Привязка компаний к личному кабинету')]" ).send_keys(Keys.PAGE_DOWN) wd.find_element_by_xpath( "//*[@class='menu_office']//a[contains(text(),'Привязка компаний к личному кабинету')]" ).click() wd.find_element_by_id("company_id").send_keys(id_company_D) wd.find_element_by_xpath( "//*[@id='center_cont_content']/table[2]/tbody/tr/td/span[2]/a" ).click() wd.find_element_by_id("addPerson").click() wd.find_element_by_id("user").send_keys('*****@*****.**') wd.find_element_by_xpath( "//*[@id='center_cont_content']//a[contains(text(),'Добавить')]" ).click() wd.find_element_by_xpath("//*[@id='center_cont_content']/a").click() self.click_my_companies(wd) def send_price(self): wd = self.man.wd self.select_firm() wd.find_element_by_xpath( "//*[contains(text(), 'Мои товары/услуги')]").click() # Тест-кейс WS - 018. Отправка статистики на эл. ящик def send_stat_no_contract(self): wd = self.man.wd with allure.step("Выбераю фирму 'Балканская къшта'"): self.select_firm() with allure.step("Перехожу в статистику компании"): wd.find_element_by_xpath( "//*[contains(text(), 'Cтатистика компании')]").click() with allure.step("Заказал статистику"): wd.find_element_by_id("order_stat").click() message = self.locator_message().split('.')[0] return message def check_stat(self): wd = self.man.wd with allure.step("Перешёл в список Заказные документы"): wd.find_element_by_xpath( "//*[contains(text(), 'Заказанные документы')]").click() get_date = wd.find_element_by_xpath( "//*[@class='contacts']//tr//td[@align='center'][1]").text.split( )[0] with allure.step(f"Отправил дату на проверку {get_date}"): return get_date def delete_order_document(self): wd = self.man.wd with allure.step("Удалил документ в списке Заказные документы"): wd.find_element_by_xpath( "//*[@class='contacts']//tr//td[@align='center'][2]//img" ).click() return self.locator_message()
def __init__(self, man): self.man = man self.button = ButtonsHelper(man) self.function = CommonFunctions() self.__wait = Wait(man)
class HelperCompanies: def __init__(self, man): self.man = man self.button = ButtonsHelper(man) self.forms = FormsHelper(man) self.function = CommonFunctions() self.action = ActionChains self.__wait = Wait(man) self.__locator_xxlarge = "//*[@class='text-size-xxlarge']" # WS-d-014 Проверка карточки компании def check_company_card(self, query): wd = self.man.wd self.button.search_goods(wd, query) self.button.click_magnifier(wd) prods = len( wd.find_elements_by_xpath( "//*[@class='grid-x grid-margin-x small-up-1 medium-up-2 large-up-4']/div" )) return int(prods) def check_form_error(self): wd = self.man.wd self.forms.form_error_main() report_error = "//*[@id='report-error']//h2" self.__wait.until_visible_by_xpath_locator(report_error) return wd.find_element_by_xpath(report_error).text def check_form_error_goods(self, query): wd = self.man.wd self.button.search_goods(wd, query) self.button.click_magnifier(wd) self.click_tab_goods(wd) self.forms.form_error_goods() wd.find_element_by_xpath("//*[@class='content']//button").click() invalid = ".is-invalid-label" self.__wait.until_visible_by_css_selector(invalid) label = wd.find_element_by_css_selector(invalid).text return label def check_company_price(self, query): wd = self.man.wd self.button.search_goods(wd, query) self.button.click_magnifier(wd) self.click_tab_goods(wd) self.button.go_to_list(wd) with allure.step('Кликаю Запомнить'): wish_button = "//*[@class='product-line__link wish_button has-tip']" self.__wait.until_visible_by_xpath_locator(wish_button) self.function.click_random_element(wd, wish_button) with allure.step('Кликаю Сравнить'): compare_button = "//*[@class='product-line__link compare_button has-tip']" self.__wait.until_visible_by_xpath_locator(compare_button) self.function.click_random_element(wd, compare_button) numeral_wishlist = "//*[@id='wishlist_link']//span" self.__wait.until_visible_by_xpath_locator(numeral_wishlist) count_wishlist = wd.find_element_by_xpath(numeral_wishlist).text numeral_cart = "//*[@id='comparelist_link']/span" self.__wait.until_visible_by_xpath_locator(numeral_cart) count_cart = wd.find_element_by_xpath(numeral_cart).text return int(count_wishlist), int(count_cart) def click_tab_goods(self, wd): with allure.step('Перехожу по вкладке "Товары и услуги"'): tabs = "//*[@class='desc-tabs tabs']/li[2]" self.__wait.until_visible_by_xpath_locator(tabs) wd.find_element_by_xpath( "//*[@class='desc-tabs tabs']/li[2]").click() def check_search_price(self, query, query_goods): wd = self.man.wd self.button.search_goods(wd, query) self.button.click_magnifier(wd) self.click_tab_goods(wd) wd.find_element_by_xpath( "//*[@class='border-none main-search__input ui-autocomplete-input']" ).send_keys(query_goods) self.button.click_magnifier(wd) margin = wd.find_elements_by_xpath( "//*[@class='margin-vertical-0']//span[@class='ellip']") goods = [g.text[:18] for g in margin] return goods def check_address(self, query): wd = self.man.wd self.button.search_goods(wd, query) self.button.click_magnifier(wd) with allure.step('Кликаю на карте Яндекс, на балун и получаю адрес'): ymaps = "//*[@id='map1']//ymaps[@class='ymaps-2-1-75-svg-icon-content']" element = wd.find_element_by_xpath(ymaps) self.__wait.until_visible_by_xpath_locator(ymaps) self.action(wd).move_to_element(element).click(element).perform() map1 = "//*[@id='map1']//ymaps/h3" self.__wait.until_visible_by_xpath_locator(map1) get_address_in_maps = wd.find_element_by_xpath(map1).text info = "//*[@class='margin-bottom-2 font-info']//tr[1]/td[2]" self.__wait.until_visible_by_xpath_locator(info) get_addess_in_card = wd.find_element_by_xpath(info).text with allure.step( f'Получил адреса и отправил на сверку \'{get_address_in_maps}\' и \'{get_addess_in_card}\'' ): return get_address_in_maps, get_addess_in_card def get_prices_ascending(self, query): wd = self.man.wd self.button.search_goods(wd, query) self.button.click_magnifier(wd) self.click_tab_goods(wd) self.button.go_to_list(wd) with allure.step('Сортирую По возрастанию'): wd.find_element_by_xpath( "//*[@class='padding-2 sort_price_asc']").click() self.__wait.until_visible_by_xpath_locator(self.__locator_xxlarge) elements = wd.find_elements_by_xpath(self.__locator_xxlarge) prices_ascending = [price.text.strip() for price in elements] with allure.step('Передал на проверку отсортированные цены'): return prices_ascending def get_prices_descending(self, query): wd = self.man.wd self.button.search_goods(wd, query) self.button.click_magnifier(wd) self.click_tab_goods(wd) self.button.go_to_list(wd) with allure.step('Сортирую По убыванию'): wd.find_element_by_xpath( "//*[@class='padding-2 sort_price_desc']").click() self.__wait.until_visible_by_xpath_locator(self.__locator_xxlarge) elements = wd.find_elements_by_xpath(self.__locator_xxlarge) prices_descending = [price.text.strip() for price in elements] with allure.step('Передал на проверку отсортированные цены'): return prices_descending