Пример #1
0
    def test_bookmark_sort(self, main, download_moscow_map, steps,
                           bookmark_steps, system_steps):
        steps.download_map(LocalizedMapsNames.RUSSIA, None,
                           LocalizedMapsNames.VORONEZH)
        bookmark_steps.delete_all_groups()
        group_name = get_random_string(10)
        bookmark_steps.click_bookmarks()
        bookmark_steps.create_group(group_name)
        bookmarks = [
            "Домодедово",
            LocalizedCategories.FASTFOOD.get(),
            LocalizedCategories.RESTAURANT.get(),
            LocalizedCategories.BAR.get(), "Якитория",
            LocalizedCategories.HOTEL.get()
        ]
        for b in bookmarks:
            bookmark_steps.create_bookmark(b)
        bookmark_steps.click_bookmarks()
        bookmark_steps.click_bookmark_group(group_name)
        bookmark_steps.click_sort()
        assert steps.try_get_by_text(LocalizedSettings.BY_DEFAULT.get(),
                                     strict=False)
        assert steps.try_get_by_text(LocalizedSettings.BY_DISTANCE.get(),
                                     strict=False)
        assert steps.try_get_by_text(LocalizedSettings.BY_DATE.get(),
                                     strict=False)
        assert steps.try_get_by_text(LocalizedSettings.BY_TYPE.get(),
                                     strict=False)

        steps.try_get_by_text(LocalizedSettings.BY_DISTANCE.get(),
                              strict=False).click()

        sleep(2)

        # TODO вынести секции а отдельный метод
        bookmark_steps.assert_section(LocalizedButtons.NEAR_ME.get())

        bookmark_steps.click_sort()
        steps.try_get_by_text(LocalizedSettings.BY_DATE.get(),
                              strict=False).click()

        sleep(2)

        bookmark_steps.assert_section(LocalizedButtons.A_WEEK_AGO.get())

        bookmark_steps.click_sort()
        steps.try_get_by_text(LocalizedSettings.BY_TYPE.get(),
                              strict=False).click()

        sleep(2)
        bookmark_steps.assert_section(LocalizedCategories.HOTELS.get())
        bookmark_steps.assert_section(LocalizedCategories.FOODS.get())

        bookmark_steps.click_sort()
        steps.try_get_by_text(LocalizedSettings.BY_DEFAULT.get(),
                              strict=False).click()

        sleep(2)

        bookmark_steps.assert_section(LocalizedButtons.BOOKMARKS.get())
Пример #2
0
 def test_bookmark_sort_no_type(self, main, download_moscow_map, steps,
                                bookmark_steps, system_steps):
     steps.download_map(LocalizedMapsNames.RUSSIA, None,
                        LocalizedMapsNames.VORONEZH)
     bookmark_steps.delete_all_groups()
     group_name = get_random_string(10)
     bookmark_steps.click_bookmarks()
     bookmark_steps.create_group(group_name)
     bookmarks = [
         "Домодедово",
         LocalizedCategories.CAFE.get(), "метро Динамо",
         LocalizedCategories.PARK.get()
     ]
     for b in bookmarks:
         bookmark_steps.create_bookmark(b)
     bookmark_steps.click_bookmarks()
     bookmark_steps.click_bookmark_group(group_name)
     bookmark_steps.click_sort()
     assert steps.try_get_by_text(LocalizedSettings.BY_DEFAULT.get(),
                                  strict=False)
     assert steps.try_get_by_text(LocalizedSettings.BY_DISTANCE.get(),
                                  strict=False)
     assert steps.try_get_by_text(LocalizedSettings.BY_DATE.get(),
                                  strict=False)
     assert not steps.try_get_by_text(LocalizedSettings.BY_TYPE.get(),
                                      strict=False)
Пример #3
0
    def test_share_bookmark(self, main, download_moscow_map, steps,
                            bookmark_steps, system_steps):
        bookmark_steps.delete_all_groups()
        bookmark_steps.delele_all_bookmarks_in_group(
            LocalizedButtons.MY_BOOKMARKS.get())
        steps.press_back_until_main_page()
        bookmark_name = "проспект Мира, 78"
        new_name = get_random_string(10)
        bookmark_steps.create_bookmark(bookmark_name)
        bookmark_steps.click_bookmarks()
        bookmark_steps.click_bookmark_group(
            LocalizedButtons.MY_BOOKMARKS.get())
        bookmark_steps.click_edit_bookmark(bookmark_name)
        bookmark_steps.change_bookmark_name(new_name)
        steps.try_get_by_text(LocalizedButtons.SAVE.get()).click()

        bookmark_steps.share_bookmark(new_name)
        loc = steps.driver.get_window_size()
        try:
            TouchAction(steps.driver).tap(x=loc["width"] / 2,
                                          y=loc["height"] / 2).perform()
        except:
            pass
        bookmark_steps.delete_bookmark(LocalizedButtons.MY_BOOKMARKS.get(),
                                       new_name)

        system_steps.start_mail_app()
        sleep(5)
        bookmark_steps.import_bookmark_from_mail(new_name)

        steps.assert_pp(bookmark_name)

        assert steps.try_get(Locator.ZOOM_OUT.get()), "Отсутсвуют кнопки зума!"
        assert steps.try_get(Locator.ZOOM_IN.get())
Пример #4
0
    def test_backup_bookmarks(self, main, download_moscow_map, steps,
                              bookmark_steps, system_steps, authorize,
                              turn_off_backup):
        bookmark_steps.delete_all_groups()
        bookmark_steps.delete_bookmark(LocalizedButtons.MY_BOOKMARKS.get(),
                                       "проспект Мира, 78")
        group_name = get_random_string(10)
        bookmark_steps.click_bookmarks()
        bookmark_steps.create_group(group_name)
        bookmarks = [
            "проспект Мира, 78", "метро Динамо", "Якитория", "Белорусская"
        ]
        for b in bookmarks:
            bookmark_steps.create_bookmark(b)
        bookmark_steps.click_bookmarks()
        bookmark_steps.click_bookmark_group(group_name)
        sleep(1)
        bookmark_steps.click_edit_bookmark(bookmarks[0])
        bookmark_steps.change_bookmark_group(
            LocalizedButtons.MY_BOOKMARKS.get())
        steps.try_get_by_text(LocalizedButtons.SAVE.get()).click()
        steps.press_back_until_main_page()

        bookmark_steps.click_bookmarks()
        button = steps.try_get(Locator.BACKUP_BUTTON.get()) or steps.try_get(
            LocalizedButtons.ENABLE_BACKUP.get())
        button.click()
        system_steps.restart_app()

        steps.close_first_time_frame()
        bookmark_steps.click_bookmarks()
        assert steps.try_get_by_text(LocalizedButtons.LAST_BACKUP.get().format(datetime.now().strftime("%d.%m.%Y")),
                                     strict=False) or \
               steps.try_get_by_text(LocalizedButtons.LAST_BACKUP.get().format(datetime.now().strftime("%d/%m/%y")),
                                     strict=False) or \
               steps.try_get_by_text(
                   LocalizedButtons.LAST_BACKUP.get().format(datetime.now().strftime("%m/%d/%y").split("0")[0]
                                                             if datetime.now().strftime("%m/%d/%y").startswith(
                       "0") else datetime.now().strftime("%m/%d/%y")),
                   strict=False)
        group_size = bookmark_steps.get_group_size(group_name)
        my_group_size = bookmark_steps.get_group_size(
            LocalizedButtons.MY_BOOKMARKS.get())

        bookmark_steps.delete_all_groups()
        bookmark_steps.delete_bookmark(LocalizedButtons.MY_BOOKMARKS.get(),
                                       "проспект Мира, 78")
        bookmark_steps.click_bookmarks()
        sleep(1)

        steps.try_get(Locator.RESTORE_BUTTON.get()).click()
        sleep(1)
        steps.try_get_by_text(LocalizedButtons.RESTORE.get()).click()

        group = bookmark_steps.try_get(group_name)
        if group:
            assert group_size == bookmark_steps.get_group_size(group_name)
        else:
            assert my_group_size == bookmark_steps.get_group_size(
                LocalizedButtons.MY_BOOKMARKS.get())
Пример #5
0
 def test_delete_all_groups(self, main, download_moscow_map, steps,
                            bookmark_steps):
     """Проверка, что можно удалить все группы, кроме последней"""
     bookmark_steps.delete_all_groups()
     first_group_name = get_random_string(10)
     second_group_name = get_random_string(10)
     steps.press_back_until_main_page()
     bookmark_steps.click_bookmarks()
     bookmark_steps.create_group(first_group_name)
     bookmark_steps.create_group(second_group_name)
     bookmark_steps.delete_all_groups()
     steps.press_back_until_main_page()
     bookmark_steps.click_bookmarks()
     assert steps.try_get_by_text(first_group_name) is None
     assert steps.try_get_by_text(second_group_name) is None
     bookmark_steps.click_more_group(LocalizedButtons.MY_BOOKMARKS.get())
     assert steps.try_get_by_text(LocalizedButtons.DELETE.get()) is None
Пример #6
0
 def test_create_new_group(self, main, download_moscow_map, steps,
                           bookmark_steps):
     bookmark_steps.delete_all_groups()
     group_name = get_random_string(10)
     steps.press_back_until_main_page()
     bookmark_steps.click_bookmarks()
     bookmark_steps.create_group(group_name)
     bookmark_steps.click_bookmark_group(group_name)
Пример #7
0
 def test_edit_group(self, main, download_moscow_map, steps,
                     bookmark_steps):
     bookmark_steps.delete_all_groups()
     group_name = get_random_string(10)
     steps.press_back_until_main_page()
     bookmark_steps.click_bookmarks()
     bookmark_steps.create_group(group_name)
     bookmark_steps.click_edit_group(group_name)
     new_name = get_random_string(10)
     new_description = get_random_string(30)
     bookmark_steps.change_group_name(new_name)
     bookmark_steps.change_group_description(new_description)
     button = steps.try_get(Locator.DONE.get()) or steps.try_get(
         LocalizedButtons.SAVE.get())
     button.click()
     assert steps.try_get_by_text(group_name) is None
     bookmark_steps.click_bookmark_group(new_name)
     bookmark_steps.assert_group_description(new_description)
Пример #8
0
 def test_bookmark_edit_60_symbols_name(self, main, download_moscow_map,
                                        steps, bookmark_steps):
     bookmark_steps.delete_all_groups()
     bookmark_name = "проспект Мира, 78"
     bookmark_steps.delete_bookmark(LocalizedButtons.MY_BOOKMARKS.get(),
                                    bookmark_name)
     bookmark_steps.click_bookmarks()
     new_group = get_random_string(10)
     new_name = get_random_string(61)
     bookmark_steps.create_group(new_group)
     bookmark_steps.create_bookmark(bookmark_name)
     bookmark_steps.click_bookmarks()
     bookmark_steps.click_bookmark_group(new_group)
     bookmark_steps.click_edit_bookmark(bookmark_name)
     bookmark_steps.change_bookmark_name(new_name)
     steps.click_by_text(LocalizedButtons.SAVE.get())
     steps.press_back_until_main_page()
     bookmark_steps.click_bookmarks()
     bookmark_steps.click_bookmark_group(new_group)
     assert not bookmark_steps.try_find_bookmark_with_scroll(new_name)
Пример #9
0
    def test_bookmark_edit(self, main, download_moscow_map, steps,
                           bookmark_steps):
        """1. Проверка редактирования названия, группы, цвета, и описания метки.
        2. Проверка отображения имени, группы и описания на PP"""
        bookmark_steps.delete_all_groups()
        bookmark_name = "проспект Мира, 78"
        bookmark_steps.delete_bookmark(LocalizedButtons.MY_BOOKMARKS.get(),
                                       bookmark_name)
        bookmark_steps.create_bookmark(bookmark_name)
        bookmark_steps.click_bookmarks()
        new_group = get_random_string(10)
        new_name = get_random_string(10)
        new_description = get_random_string(20)
        bookmark_steps.create_group(new_group)
        bookmark_steps.click_bookmark_group(
            LocalizedButtons.MY_BOOKMARKS.get())
        bookmark_steps.click_edit_bookmark(bookmark_name)
        bookmark_steps.change_bookmark_name(new_name)
        bookmark_steps.change_bookmark_group(new_group)
        bookmark_steps.change_bookmark_description(new_description)
        bookmark_steps.change_bookmark_color()
        steps.click_by_text(LocalizedButtons.SAVE.get())
        steps.press_back_until_main_page()
        bookmark_steps.click_bookmarks()
        bookmark_steps.click_bookmark_group(
            LocalizedButtons.MY_BOOKMARKS.get())

        bookmark_steps.assert_no_bookmark(bookmark_name)
        bookmark_steps.assert_no_bookmark(new_name)

        steps.press_back_until_main_page()
        bookmark_steps.click_bookmarks()
        bookmark_steps.click_bookmark_group(new_group)
        b = bookmark_steps.try_find_bookmark_with_scroll(new_name)
        b.click()
        steps.scroll_down(small=True)

        assert steps.try_get_by_text(new_description)
        assert steps.try_get_by_text(new_group, strict=False)
Пример #10
0
    def test_bookmark_search(self, main, download_moscow_map, steps,
                             bookmark_steps, system_steps):
        bookmark_steps.delete_all_groups()
        group_name = get_random_string(10)
        bookmark_steps.click_bookmarks()
        bookmark_steps.create_group(group_name)
        bookmarks = ["метро Динамо", "Якитория", "Домодедово"]
        for b in bookmarks:
            bookmark_steps.create_bookmark(b)
        bookmark_steps.click_bookmarks()
        bookmark_steps.click_bookmark_group(group_name)

        assert steps.try_get(Locator.BOOKMARKS_SEARCH.get())
        bookmark_steps.search_in_bookmarks(
            LocalizedMapsNames.DOMODEDOVO.get()[:2])
        assert bookmark_steps.try_find_bookmark_with_scroll(
            LocalizedMapsNames.DOMODEDOVO.get())
        assert not bookmark_steps.try_find_bookmark_with_scroll("Динамо")
        assert not bookmark_steps.try_find_bookmark_with_scroll("Якитория")
        bookmark_steps.try_find_bookmark_with_scroll(
            LocalizedMapsNames.DOMODEDOVO.get()).click()
        steps.assert_pp(LocalizedMapsNames.DOMODEDOVO.get())
Пример #11
0
    def test_share_group(self, main, download_moscow_map, steps,
                         bookmark_steps, system_steps):
        bookmark_steps.delete_all_groups()
        group_name = get_random_string(10)
        bookmark_steps.click_bookmarks()
        bookmark_steps.create_group(group_name)
        bookmarks = ["метро Динамо", "Якитория", "Белорусская"]
        for b in bookmarks:
            bookmark_steps.create_bookmark(b)
        bookmark_steps.click_bookmarks()
        bookmark_steps.share_group(group_name)
        loc = steps.driver.get_window_size()
        try:
            TouchAction(steps.driver).tap(x=loc["width"] / 2,
                                          y=loc["height"] / 2).perform()
        except:
            pass
        bookmark_steps.delete_all_groups()

        system_steps.start_mail_app()
        bookmark_steps.import_group_from_mail(group_name)
        bookmark_steps.click_bookmarks()
        assert "3" in bookmark_steps.get_group_size(group_name)