def test_routing_walk(self, main, download_moscow_map, steps, r_steps): """ Текущее местоположение -> метро Сокол -> метро Беляево -> Сергиев-Посад -> метро Алексеевская """ panel = BottomPanel() steps.search("метро Алексеевская") steps.choose_first_search_result() panel.to().click() el = steps.try_get_by_text(LocalizedButtons.ACCEPT.get()) if el: el.click() steps.search("метро Сокол") steps.choose_first_search_result() r_steps.click_add_stop() r_steps.wait_route_start() steps.search("метро Беляево") steps.choose_first_search_result() r_steps.click_add_stop() r_steps.wait_route_start() steps.search("Сергиев-Посад") steps.choose_first_search_result() r_steps.click_add_stop() r_steps.download_additional_maps() r_steps.wait_route_start() steps.try_get(Locator.ROUTING_WALK.get()).click() r_steps.wait_route_start()
def test_toll_roads(self, main, steps, r_steps): """https://testrail.corp.mail.ru/index.php?/tests/view/36653882 https://testrail.corp.mail.ru/index.php?/tests/view/36653900""" panel = BottomPanel() steps.search("Воронеж") steps.choose_first_search_result( category=LocalizedCategories.CITY.get()) panel.to().click() el = steps.try_get_by_text(LocalizedButtons.ACCEPT.get()) if el: el.click() r_steps.download_additional_maps() r_steps.wait_route_start() steps.try_get(Locator.ZOOM_IN.get()).click() assert steps.try_get(Locator.DRIVING_OPTIONS.get()) sleep(5) filename = "toll_road.png" steps.driver.get_screenshot_as_file(filename) coor = self.get_coords_proportions( filename, proportions=steps.driver.get_window_size()) TouchAction(steps.driver).tap( x=round(coor[0] * steps.driver.get_window_size()["width"]), y=round(coor[1] * steps.driver.get_window_size()["height"])).perform() assert steps.try_get_by_text(LocalizedButtons.AVOID_TOLL_ROADS.get()) assert steps.try_get_by_text(LocalizedButtons.TOLL_ROAD.get(), strict=False)
def assert_route_points(self, count, p2p=True, *points): panel = BottomPanel() for point in [x for x in points if x is not None]: self.search(point) self.choose_first_search_result() assert panel.delete() el = self.driver.find_element_by_id(Locator.PP_ANCHOR.get()) self.scroll_up(from_el=el)
def test_routing_base(self, main, download_moscow_map, steps): panel = BottomPanel() steps.search("Проспект Мира 78") steps.choose_first_search_result() panel.to().click() el = steps.try_get_by_text(LocalizedButtons.ACCEPT.get()) if el: el.click() assert steps.try_get_by_text( LocalizedButtons.START.get()) or steps.try_get(Locator.START.get())
def test_routing_metro_taxi_back(self, main, download_moscow_map, steps, r_steps, search_steps): """Метро Динамо -> метро Парк Победы -> метро Строгино -> метро Алексеевская""" panel = BottomPanel() points = [] if get_settings("System", "platform") == "Android": points = ["метро Парк Победы", "метро Строгино"] steps.search("метро Динамо") steps.choose_first_search_result() points.append(steps.pp_get_title()) panel.route_from().click() el = steps.try_get_by_text(LocalizedButtons.ACCEPT.get()) if el: el.click() steps.try_get(Locator.ROUTING_CHOOSE_POINT.get()).click() steps.search("метро Алексеевская", click_search_button=False) points.append(search_steps.get_first_search_name()) sleep(1) steps.choose_first_search_result() steps.search("метро Парк Победы") steps.choose_first_search_result() points.append(steps.pp_get_title()) r_steps.click_add_stop() steps.search("метро Строгино") steps.choose_first_search_result() points.append(steps.pp_get_title()) r_steps.click_add_stop() steps.try_get(Locator.ROUTING_METRO.get()).click() r_steps.wait_metro_panel() r_steps.assert_route_points(2, True, *points) sleep(1) steps.try_get(Locator.ROUTING_TAXI.get()).click() r_steps.wait_taxi_panel() steps.try_get(Locator.ROUTING_METRO.get()).click() r_steps.wait_metro_panel() r_steps.assert_route_points(2, True, *points)
def test_walk_routing_bookmark(self, main, download_moscow_map, steps, r_steps, bookmark_steps): panel = BottomPanel() bookmark_steps.delete_all_groups() bookmark_steps.delete_bookmark(LocalizedButtons.MY_BOOKMARKS.get(), "проспект Мира, 78") bookmark_name = "проспект Мира, 78" bookmark_steps.create_bookmark(bookmark_name) steps.search("метро Алексеевская") steps.choose_first_search_result() panel.to().click() el = steps.try_get_by_text(LocalizedButtons.ACCEPT.get()) if el: el.click() steps.try_get(Locator.ROUTING_WALK.get()).click() r_steps.wait_route_start() steps.press_back_until_main_page() panel.bookmarks().click() bookmark_steps.click_bookmark_group( LocalizedButtons.MY_BOOKMARKS.get()) bookmark = bookmark_steps.try_find_bookmark_with_scroll(bookmark_name) sleep(1) bookmark.click() panel.to().click() el = steps.try_get_by_text(LocalizedButtons.ACCEPT.get()) if el: el.click() r_steps.wait_route_start() assert not steps.try_get(Locator.ROUTING_WALK.get())
def test_discovery_hotels(self, main, download_moscow_map, steps, b_steps): panel = BottomPanel() panel.discovery().click() page = DiscoveryPage() steps.scroll_down() hotel_name = page.first_hotel_name().text hotel_type = page.first_hotel_type().text steps.scroll_down() page.first_hotel_type().click() steps.assert_pp(hotel_name) steps.assert_category_on_pp(hotel_type) b_steps.scroll_down(from_el=b_steps.try_get(Locator.PP_ANCHOR.get())) assert b_steps.find_booking_button_on_pp(Locator.DETAILS_ON_BOOKING) steps.press_back_until_main_page() panel.discovery().click() steps.scroll_down() page.first_hotel_route_to().click() el = steps.try_get_by_text(LocalizedButtons.ACCEPT.get()) if el: el.click() RoutingSteps().get().wait_route_start() steps.press_back_until_main_page() panel.discovery().click() steps.scroll_down() coord_y = page.first_hotel_name().location["y"] page.slide_left(coord_y, 3) page.click_more(coord_y) assert SearchFilter().check_out()
def test_routing_taxi_route_to(self, main, download_moscow_map, steps, r_steps): """Текущее местоположение -> метро Алексеевская""" panel = BottomPanel() steps.search("метро Алексеевская") steps.choose_first_search_result() panel.to().click() el = steps.try_get_by_text(LocalizedButtons.ACCEPT.get()) if el: el.click() sleep(2) steps.try_get(Locator.ROUTING_TAXI.get()).click() r_steps.wait_taxi_panel()
def test_browser_booking_poor_button(self, main, download_moscow_map, steps, b_steps, testitem_booking, find_osm_hotels): result = False while not result: hotel = None while True: try: hotel = find_osm_hotels.pop() b_steps.search_osm_hotel(hotel) break except (TimeoutException, AssertionError): b_steps.press_back_until_main_page() BottomPanel().book().click() WebDriverWait(main, 20).until(EC2.web_view_context_enabled()) contexts = main.contexts cons = [x.split("_")[-1] for x in contexts if x != "NATIVE_APP"] main.switch_to.context("WEBVIEW_{}".format(cons[-1])) WebDriverWait(main, 20).until(EC.url_contains("booking.com")) url = main.current_url hotel = "SkyPoint" booking = Booking(testitem_booking.id) booking.create(hotel, url) result = self.browser_steps(booking, hotel) booking.result("Booked" if result else "Failure") b_steps.switch_to_native() b_steps.close_first_time_frame() b_steps.press_back_until_main_page()
def test_search_banner(self, main, steps, bookmark_steps): BottomPanel().bookmarks().click() steps.try_get_by_text(LocalizedButtons.GUIDES.get()).click() bookmark_steps.click_download_guides() guides_page = GuidesCatalog() sleep(2) guides_page.filter_by_tag().send_keys(LocalizedMapsNames.MOSCOW.get()) sleep(2) guides_page.search_result_dropdown( LocalizedMapsNames.MOSCOW.get()).click() sleep(2) guides_page.clear_search().click() sleep(2) guides_page.filter_by_tag().send_keys(LocalizedMapsNames.LONDON.get()) sleep(2) guides_page.search_result_dropdown( LocalizedMapsNames.LONDON.get()).click() sleep(2) guides_page.clear_search().click() sleep(2) guides_page.filter_by_tag().send_keys(LocalizedMapsNames.BERLIN.get()) sleep(2) guides_page.search_result_dropdown( LocalizedMapsNames.BERLIN.get()).click() sleep(2) guides_page.clear_search().click() sleep(2) assert guides_page.subscribe_result_banner()
def test_routing_auto_taxi_back(self, main, download_moscow_map, steps, r_steps, search_steps): """Метро Динамо -> метро Сокол -> метро Беляево -> метро Алексеевская https://testrail.corp.mail.ru/index.php?/tests/view/36653927""" panel = BottomPanel() points = [] if get_settings("System", "platform") == "Android": points = ["метро Сокол", "метро Беляево"] steps.search("метро Динамо") steps.choose_first_search_result() points.append(steps.pp_get_title()) panel.route_from().click() el = steps.try_get_by_text(LocalizedButtons.ACCEPT.get()) if el: el.click() steps.try_get(Locator.ROUTING_CHOOSE_POINT.get()).click() steps.search("метро Алексеевская", click_search_button=False) points.append(search_steps.get_first_search_name()) steps.choose_first_search_result() sleep(1) steps.search("метро Сокол") steps.choose_first_search_result() points.append(steps.pp_get_title()) r_steps.click_add_stop() sleep(1) steps.search("метро Беляево") steps.choose_first_search_result() points.append(steps.pp_get_title()) r_steps.click_add_stop() r_steps.wait_route_start() sleep(1) steps.try_get(Locator.ROUTING_TAXI.get()).click() r_steps.wait_taxi_panel() steps.try_get(Locator.ROUTING_CAR.get()).click() r_steps.assert_route_points(2, True, *points)
def test_discovery_attractions(self, main, download_moscow_map, steps): panel = BottomPanel() panel.discovery().click() page = DiscoveryPage() sleep(5) attr_name = page.first_attraction_name().text attr_type = page.first_attraction_type().text assert page.first_attraction_popular() page.first_attraction_name().click() steps.assert_pp(attr_name) steps.assert_category_on_pp(attr_type) assert steps.try_get_by_text( LocalizedButtons.LEAVE_A_REVIEW.get(), strict=False) or steps.try_get_by_text( LocalizedButtons.LEAVE_A_REVIEW.get().upper(), strict=False) steps.press_back_until_main_page() try: BottomPanel().to() actions = TouchAction(steps.driver) coord_x = steps.driver.get_window_size()['width'] * 0.5 coord_y = steps.driver.get_window_size()['height'] * 0.5 actions.tap(None, coord_x, coord_y).perform() sleep(1) steps.press_back_until_main_page() except: pass panel.discovery().click() page.first_attraction_route_to().click() el = steps.try_get_by_text(LocalizedButtons.ACCEPT.get()) if el: el.click() RoutingSteps().get().wait_route_start() steps.press_back_until_main_page() panel.discovery().click() coord_y = page.first_attraction_name().location["y"] page.slide_left(coord_y, 3) page.click_more(coord_y) assert steps.try_get_by_xpath("//*[contains(@{},'{}')]".format( attributes.TEXT_VALUE.get(), LocalizedCategories.SIGHTS.get()))
def delete_guide(self, steps): if get_settings("System", "platform") == "IOS": BottomPanel().bookmarks().click() steps.try_get(LocalizedButtons.GUIDES.get().upper()).click() sleep(2) while steps.try_get("ic24PxMore"): steps.try_get("ic24PxMore").click() steps.try_get(LocalizedButtons.DELETE.get()).click() sleep(2)
def test_discovery_eat_and_drink(self, main, download_moscow_map, steps, b_steps): panel = BottomPanel() panel.discovery().click() steps.scroll_down() page = DiscoveryPage() steps.scroll_down(small=True) sleep(2) eat_name = page.first_eat_name().text eat_type = page.first_eat_type().text assert page.first_eat_popular() page.first_eat_name().click() b_steps.scroll_down(from_el=b_steps.try_get(Locator.PP_ANCHOR.get())) steps.assert_pp(eat_name) steps.assert_category_on_pp(eat_type) assert steps.try_get_by_text( LocalizedButtons.LEAVE_A_REVIEW.get(), strict=False) or steps.try_get_by_text( LocalizedButtons.LEAVE_A_REVIEW.get().upper(), strict=False) steps.press_back_until_main_page() panel.discovery().click() steps.scroll_down() sleep(5) r_to = page.first_eat_route_to() sleep(1) r_to.click() el = steps.try_get_by_text(LocalizedButtons.ACCEPT.get()) if el: el.click() RoutingSteps().get().wait_route_start() steps.press_back_until_main_page() panel.discovery().click() steps.scroll_down() sleep(5) coord_y = page.first_eat_name().location["y"] page.slide_left(coord_y, 3) page.click_more(coord_y) assert steps.try_get_by_xpath("//*[contains(@{},'{}')]".format( attributes.TEXT_VALUE.get(), LocalizedCategories.WHERE_TO_EAT.get()))
def test_routing_taxi_p2p(self, main, download_moscow_map, steps, r_steps): """Метро Строгино -> метро Алексеевская""" panel = BottomPanel() steps.search("метро Строгино") steps.choose_first_search_result() sleep(1) panel.route_from().click() el = steps.try_get_by_text(LocalizedButtons.ACCEPT.get()) if el: el.click() steps.try_get(Locator.ROUTING_CHOOSE_POINT.get()).click() steps.search("метро Алексеевская", click_search_button=False) steps.choose_first_search_result() sleep(2) steps.try_get(Locator.ROUTING_TAXI.get()).click() r_steps.wait_taxi_panel() r_steps.assert_taxi_install_button()
def test_routing_metro_two_maps(self, main, download_moscow_map, steps, r_steps): """ Метро Динамо -> Чехов. Ожидается ошибка построения маршрута https://testrail.corp.mail.ru/index.php?/tests/view/36653589""" panel = BottomPanel() steps.search("метро Динамо") steps.choose_first_search_result() panel.route_from().click() el = steps.try_get_by_text(LocalizedButtons.ACCEPT.get()) if el: el.click() steps.try_get(Locator.ROUTING_CHOOSE_POINT.get()).click() steps.search("Чехов", click_search_button=False) steps.choose_first_search_result() r_steps.download_additional_maps() steps.try_get(Locator.ROUTING_METRO.get()).click() r_steps.wait_route_too_long()
def test_routing_metro_one_map(self, main, download_moscow_map, steps, r_steps): """ Метро Динамо -> метро Технопарк """ panel = BottomPanel() steps.search("метро Динамо") steps.choose_first_search_result() panel.route_from().click() el = steps.try_get_by_text(LocalizedButtons.ACCEPT.get()) if el: el.click() steps.try_get(Locator.ROUTING_CHOOSE_POINT.get()).click() steps.search("метро Технопарк", click_search_button=False) steps.choose_first_search_result() r_steps.wait_route_start() steps.try_get(Locator.ROUTING_METRO.get()).click() r_steps.wait_metro_panel() steps.press_back_until_main_page() steps.search("метро Динамо") steps.choose_first_search_result() panel.route_from().click() el = steps.try_get_by_text(LocalizedButtons.ACCEPT.get()) if el: el.click() steps.try_get(Locator.ROUTING_CHOOSE_POINT.get()).click() steps.search("метро Технопарк", click_search_button=False) steps.choose_first_search_result() r_steps.wait_metro_panel()
def test_taxi_not_installed(self, main, uninstall_taxi, steps, r_steps, system_steps): steps.search("Кунцевская") steps.choose_first_search_result() BottomPanel().to().click() el = steps.try_get_by_text(LocalizedButtons.ACCEPT.get()) if el: el.click() sleep(2) steps.try_get(Locator.ROUTING_TAXI.get()).click() assert steps.try_get(Locator.TAXI_VEZET.get()) assert steps.try_get_by_text(LocalizedButtons.INSTALL_BUTTON.get()) steps.try_get_by_text(LocalizedButtons.INSTALL_BUTTON.get()).click() if steps.try_get_by_text("Google Play", strict=False): steps.try_get_by_text("Google Play", strict=False).click() if steps.try_get_by_text(LocalizedSettings.ALWAYS.get()): steps.try_get_by_text(LocalizedSettings.ALWAYS.get()).click() sleep(3) steps.try_get_by_text(LocalizedButtons.INSTALL_BUTTON.get()).click() sleep(15) system_steps.restart_app() steps.press_back_until_main_page() steps.search("Кунцевская") steps.choose_first_search_result() BottomPanel().to().click() el = steps.try_get_by_text(LocalizedButtons.ACCEPT.get()) if el: el.click() sleep(2) steps.try_get(Locator.ROUTING_TAXI.get()).click() assert steps.try_get(Locator.TAXI_VEZET.get()) assert steps.try_get_by_text(LocalizedButtons.ORDER_TAXI.get()) steps.try_get_by_text(LocalizedButtons.ORDER_TAXI.get()).click() sleep(5) r_steps.assert_taxi_opened() r_steps.terminate_taxi_app()
def test_unpaved_roads(self, main, steps, r_steps): """https://testrail.corp.mail.ru/index.php?/tests/view/36653901""" steps.download_map(LocalizedMapsNames.SPAIN, None, LocalizedMapsNames.SEVILLE) panel = BottomPanel() steps.press_back_until_main_page() steps.search( "Huerto de Cubiches") #Huerta Vieja El Algarobbo El Chaparro Puyol steps.choose_first_search_result() panel.route_from().click() el = steps.try_get_by_text(LocalizedButtons.ACCEPT.get()) if el: el.click() steps.try_get(Locator.ROUTING_CHOOSE_POINT.get()).click() steps.search("Sierra de Ojen", click_search_button=False) steps.choose_first_search_result( category=LocalizedCategories.MOUNTAIN.get()) r_steps.download_additional_maps() r_steps.wait_route_start() #steps.try_get(Locator.ZOOM_IN.get()).click() #steps.try_get(Locator.ZOOM_IN.get()).click() assert steps.try_get(Locator.DRIVING_OPTIONS.get()) sleep(5) filename = "unpaved_road.png" steps.driver.get_screenshot_as_file(filename) coor = self.get_coords_proportions( filename, proportions=steps.driver.get_window_size()) TouchAction(steps.driver).tap( x=round(coor[0] * steps.driver.get_window_size()["width"]), y=round(coor[1] * steps.driver.get_window_size()["height"])).perform() assert steps.try_get_by_text( LocalizedButtons.AVOID_UNPAVED_ROADS.get()) assert steps.try_get_by_text(LocalizedButtons.UNPAVED_ROAD.get(), strict=False)
def test_ferry_roads(self, main, steps, r_steps): """https://testrail.corp.mail.ru/index.php?/tests/view/36653902""" steps.download_map(LocalizedMapsNames.ITALY, None, LocalizedMapsNames.SICILY) panel = BottomPanel() steps.press_back_until_main_page() steps.search("Cascate Cataolo") steps.choose_first_search_result() panel.route_from().click() el = steps.try_get_by_text(LocalizedButtons.ACCEPT.get()) if el: el.click() steps.try_get(Locator.ROUTING_CHOOSE_POINT.get()).click() steps.search("Vulcano Porto", click_search_button=False) steps.choose_first_search_result() r_steps.download_additional_maps() r_steps.wait_route_start() # steps.try_get(Locator.ZOOM_IN.get()).click() assert steps.try_get(Locator.DRIVING_OPTIONS.get()) sleep(5) filename = "ferry_road.png" steps.driver.get_screenshot_as_file(filename) coor = self.get_coords_proportions( filename, proportions=steps.driver.get_window_size()) logging.info(str(coor)) TouchAction(steps.driver).tap( x=round(coor[0] * steps.driver.get_window_size()["width"]) + 10, y=round(coor[1] * steps.driver.get_window_size()["height"]) + 10).perform() assert steps.try_get_by_text(LocalizedButtons.AVOID_FERRY_ROADS.get()) assert steps.try_get_by_text(LocalizedButtons.FERRY_ROAD.get(), strict=False)
def test_routing_pay_and_bad_roads_only_auto(self, main, steps, r_steps): """https://testrail.corp.mail.ru/index.php?/tests/view/36653881""" steps.download_map(LocalizedMapsNames.GREAT_BRITAIN, None, LocalizedMapsNames.LONDON) panel = BottomPanel() steps.search("метро Алексеевская") steps.choose_first_search_result() panel.to().click() el = steps.try_get_by_text(LocalizedButtons.ACCEPT.get()) if el: el.click() r_steps.wait_route_start() assert steps.try_get(Locator.DRIVING_OPTIONS.get( )) is None or steps.try_get( Locator.DRIVING_OPTIONS.get()).get_attribute("visible") == 'false' steps.press_back_until_main_page() steps.search("Compton Park") sleep(10) steps.choose_first_search_result( category=LocalizedCategories.PARK.get()) panel.route_from().click() steps.try_get(Locator.ROUTING_CHOOSE_POINT.get()).click() steps.search("Errol Street", click_search_button=False) steps.choose_first_search_result() r_steps.wait_route_start() steps.try_get(Locator.DRIVING_OPTIONS.get()).click() sleep(2) steps.driver.back() steps.try_get(Locator.ROUTING_BIKE.get()).click() r_steps.wait_route_start() assert steps.try_get(Locator.DRIVING_OPTIONS.get( )) is None or steps.try_get( Locator.DRIVING_OPTIONS.get()).get_attribute("visible") == 'false' steps.try_get(Locator.ROUTING_WALK.get()).click() r_steps.wait_route_start() assert steps.try_get(Locator.DRIVING_OPTIONS.get( )) is None or steps.try_get( Locator.DRIVING_OPTIONS.get()).get_attribute("visible") == 'false' steps.try_get(Locator.ROUTING_METRO.get()).click() r_steps.wait_metro_panel() assert steps.try_get(Locator.DRIVING_OPTIONS.get( )) is None or steps.try_get( Locator.DRIVING_OPTIONS.get()).get_attribute("visible") == 'false' steps.try_get(Locator.ROUTING_TAXI.get()).click() r_steps.wait_taxi_panel() assert steps.try_get(Locator.DRIVING_OPTIONS.get( )) is None or steps.try_get( Locator.DRIVING_OPTIONS.get()).get_attribute("visible") == 'false'
def test_subscription_banner(self, main, steps, bookmark_steps): BottomPanel().bookmarks().click() steps.try_get_by_text(LocalizedButtons.GUIDES.get()).click() bookmark_steps.click_download_guides() guides_page = GuidesCatalog() guides_page.try_subscription().click() banner = SubscriptionBanner() assert banner.title() assert banner.city_outdoor() assert banner.monthly() assert banner.yearly() banner.yearly().click() assert steps.try_get(Locator.TERM_OF_USE_CHECKBOX.get()) assert steps.try_get(Locator.POLICY_CHECKBOX.get()) if steps.try_get(LocalizedButtons.SIGN_IN_WITH.get()): TouchAction(steps.driver).tap(x=100, y=100).perform() assert banner.close() banner.close().click() assert not banner.title()
def test_hotels_aid_browser_poor_button(self, main, download_moscow_map, b_steps, return_back_to_mapsme, switch_to_native): b_steps.search_osm_hotel("Аэрополис") BottomPanel().book().click() WebDriverWait(b_steps.driver, 20).until(EC2.web_view_context_enabled()) contexts = b_steps.driver.contexts cons = [x.split("_")[-1] for x in contexts if x != "NATIVE_APP"] b_steps.driver.switch_to.context("WEBVIEW_{}".format(cons[-1])) WebDriverWait(b_steps.driver, 20).until(EC.url_contains("booking.com")) url = b_steps.driver.current_url url_params = dict(parse.parse_qsl(parse.urlsplit(url).query)) logging.info(str(url_params)) aid = url_params["aid"] if get_settings("System", "Platform") == "Android": assert aid == "1595466" else: assert aid == "1595464" b_steps.switch_to_native() b_steps.close_first_time_frame() b_steps.press_back_until_main_page()
def test_app_booking_rich_button(self, find_booking_hotels, main, download_moscow_map, steps, b_steps, testitem_booking): hotel = None result = False while not result: while True: try: hotel = find_booking_hotels.pop() b_steps.search_booking_hotel(hotel) break except (TimeoutException, AssertionError): b_steps.press_back_until_main_page() BottomPanel().book().click() booking = Booking(testitem_booking.id) booking.create(hotel, None) result = self.app_steps(steps, booking) booking.result("Booked" if result else "Failure") b_steps.close_after_booked_window() b_steps.close_first_time_frame() b_steps.press_back_until_main_page()
def test_discovery_guides(self, main, download_moscow_map, steps): panel = BottomPanel() panel.discovery().click() page = DiscoveryPage() sleep(5) guide_name = page.first_guide_name().text guide_type = page.first_guide_type().text page.first_guide_name().click() guides_page = GuidesCatalog() assert guides_page.navigation_bar_title() if len([ x for x in steps.driver.contexts if x != "NATIVE_APP" and "chrome" not in x ]) > 0: assert guides_page.guide_title().text == guide_name assert guides_page.guide_author().text == guide_type else: sleep(3) assert steps.try_get_by_text(guide_name) sleep(3) assert steps.try_get_by_text(guide_type, strict=False) guides_page.close().click() steps.press_back_until_main_page() panel.discovery().click() sleep(5) coord_y = page.first_guide_name().location["y"] page.slide_left(coord_y, 3) page.click_more(coord_y) assert guides_page.navigation_bar_title() if len([ x for x in steps.driver.contexts if x != "NATIVE_APP" and "chrome" not in x ]) > 0: assert guides_page.breadcrumbs_active_item( ).text == LocalizedMapsNames.MOSCOW.get() assert guides_page.see_all() guides_page.close().click()
def test_pp_sight_guides(self, main, steps, bookmark_steps): bookmark_steps.delete_all_groups() bookmark_steps.delete_bookmark(LocalizedButtons.MY_BOOKMARKS.get(), LocalizedButtons.TRETYAKOV.get()) steps.search("Московский Кремль") steps.choose_first_search_result() steps.scroll_down() steps.assert_catalog_promo() assert steps.try_get_by_text(LocalizedButtons.GUIDES_BY_TITLE.get()) # steps.assert_poi_description(LocalizedButtons.VLADIMIR_MEMORIAL_DESCRIPTION.get()) assert steps.try_get_by_text(LocalizedButtons.DETAILS.get()) steps.press_back_until_main_page() steps.search(LocalizedButtons.TRETYAKOV.get()) steps.choose_first_search_result() steps.scroll_down() steps.assert_promo_card() assert not steps.try_get(Locator.AD_BANNER.get()) BottomPanel().bookmark().click() steps.press_back_until_main_page() steps.search(LocalizedButtons.TRETYAKOV.get()) steps.choose_first_search_result() sleep(2) steps.scroll_down() steps.assert_promo_card(no=True) #assert steps.try_get(Locator.POI_DESCRIPTION.get()) steps.press_back_until_main_page() steps.search("Дон Кихот") sleep(2) steps.choose_first_search_result( category=LocalizedCategories.MEMORIAL.get()) steps.scroll_down() steps.assert_promo_card(no=True)
def test_auto_routing_bookmark(self, main, download_moscow_map, steps, r_steps, bookmark_steps): panel = BottomPanel() bookmark_steps.delete_all_groups() bookmark_steps.delete_bookmark(LocalizedButtons.MY_BOOKMARKS.get(), "проспект Мира, 78") bookmark_name = "проспект Мира, 78" bookmark_steps.create_bookmark(bookmark_name) panel.bookmarks().click() bookmark_steps.click_bookmark_group( LocalizedButtons.MY_BOOKMARKS.get()) bookmark = bookmark_steps.try_find_bookmark_with_scroll(bookmark_name) sleep(1) bookmark.click() panel.to().click() el = steps.try_get_by_text(LocalizedButtons.ACCEPT.get()) if el: el.click() r_steps.wait_route_start()
def click_add_stop(self): BottomPanel().add_stop().click()
def test_routing_bike_stops_limit(self, main, steps, r_steps): """https://testrail.corp.mail.ru/index.php?/tests/view/36653637""" panel = BottomPanel() steps.search("метро Алексеевская") steps.choose_first_search_result() panel.to().click() el = steps.try_get_by_text(LocalizedButtons.ACCEPT.get()) if el: el.click() steps.try_get(Locator.ROUTING_BIKE.get()).click() r_steps.wait_route_start() steps.search("метро Сокол") steps.choose_first_search_result() panel.add_stop().click() r_steps.wait_route_start() steps.search("метро Беляево") steps.choose_first_search_result() panel.add_stop().click() r_steps.wait_route_start() steps.search("метро Тульская") steps.choose_first_search_result() panel.add_stop().click() r_steps.wait_route_start() r_steps.wait_route_start() steps.search("метро Сокольники") steps.choose_first_search_result() assert panel.add_stop() is None
def test_route_manager(self, main, download_moscow_map, steps, r_steps, search_steps): """Метро Динамо -> метро Парк Победы -> метро Строгино -> метро Алексеевская""" panel = BottomPanel() points = [] steps.search("метро Динамо") steps.choose_first_search_result() points.append(steps.pp_get_title()) panel.route_from().click() el = steps.try_get_by_text(LocalizedButtons.ACCEPT.get()) if el: el.click() steps.try_get(Locator.ROUTING_CHOOSE_POINT.get()).click() steps.search("метро Алексеевская", click_search_button=False) points.append(search_steps.get_first_search_name()) sleep(1) steps.choose_first_search_result() steps.search("метро Парк Победы") steps.choose_first_search_result() points.append(steps.pp_get_title()) r_steps.click_add_stop() steps.search("метро Строгино") steps.choose_first_search_result() points.append(steps.pp_get_title()) r_steps.click_add_stop() steps.try_get(LocalizedButtons.MANAGE_ROUTE.get()).click() stop_a = steps.driver.find_elements_by_xpath( "//*[@type='XCUIElementTypeCell']")[1] stop_a_name = stop_a.find_element_by_xpath( "./*[@type='XCUIElementTypeStaticText']").text coords_a = stop_a.find_elements_by_xpath( "./*[@type='XCUIElementTypeImage']")[1].location stop_start = steps.driver.find_elements_by_xpath( "//*[@type='XCUIElementTypeCell']")[0] stop_start_name = stop_start.find_element_by_xpath( "./*[@type='XCUIElementTypeStaticText']").text stop_b = steps.driver.find_elements_by_xpath( "//*[@type='XCUIElementTypeCell']")[2] stop_b_name = stop_b.find_element_by_xpath( "./*[@type='XCUIElementTypeStaticText']").text stop_finish = steps.driver.find_elements_by_xpath( "//*[@type='XCUIElementTypeCell']")[3] stop_finish_name = stop_finish.find_element_by_xpath( "./*[@type='XCUIElementTypeStaticText']").text coords_finish = stop_finish.find_elements_by_xpath( "./*[@type='XCUIElementTypeImage']")[1].location actions = TouchAction(steps.driver) try: actions.press(None, coords_a["x"], coords_a["y"]) \ .wait(4000).move_to(None, coords_finish["x"], coords_finish["y"]).release().perform() except WebDriverException: pass steps.try_get(LocalizedButtons.PLAN.get()).click() sleep(5) steps.try_get(LocalizedButtons.MANAGE_ROUTE.get()).click() stop_start = steps.driver.find_elements_by_xpath( "//*[@type='XCUIElementTypeCell']")[0] assert stop_start_name == stop_start.find_element_by_xpath( "./*[@type='XCUIElementTypeStaticText']").text stop_a = steps.driver.find_elements_by_xpath( "//*[@type='XCUIElementTypeCell']")[1] assert stop_b_name == stop_a.find_element_by_xpath( "./*[@type='XCUIElementTypeStaticText']").text stop_b = steps.driver.find_elements_by_xpath( "//*[@type='XCUIElementTypeCell']")[2] assert stop_finish_name == stop_b.find_element_by_xpath( "./*[@type='XCUIElementTypeStaticText']").text stop_finish = steps.driver.find_elements_by_xpath( "//*[@type='XCUIElementTypeCell']")[3] assert stop_a_name == stop_finish.find_element_by_xpath( "./*[@type='XCUIElementTypeStaticText']").text