def test_check_word_in_search_results(appdriver):
    if IS_IOS or IS_ANDROID:
        OnboardingElements(appdriver).press_skip_onboarding_button()
    Search(appdriver).click_to_the_search_field()
    Search(appdriver).input_text_to_the_search_field(Keywords.search_python)

    Search(appdriver).find_keyword_in_search_results('Python')
def test_check_word_in_search_results(appdriver):
    if IS_IOS or IS_ANDROID:
        OnboardingElements(appdriver).press_skip_onboarding_button()
    Search(appdriver).click_to_the_search_field()
    Search(appdriver).input_text_to_the_search_field(Keywords.search_gta_title)

    Search(appdriver).wait_for_element_by_title_and_description(
        Keywords.search_gta_title, Keywords.search_gta_description)
def test_get_text_from_search_field(appdriver):
    if not IS_MOBILE_WEB:
        OnboardingElements(appdriver).press_skip_onboarding_button()

    if IS_ANDROID:
        assert Search(appdriver).get_text_in_the_search_field() == 'Поиск по Википедии',\
            'Text isn\'t presented in the Search field'
    else:
        assert Search(appdriver).get_text_in_the_search_field() == 'Search Wikipedia',\
            'Text isn\'t presented in the Search field'
Example #4
0
def test_assert_title(appdriver):
    OnboardingElements(appdriver).press_skip_onboarding_button()
    Search(appdriver).click_to_the_search_field()
    Search(appdriver).input_text_to_the_search_field('Python')
    Search(appdriver).open_programming_language_page()

    assert appdriver.find_element_by_xpath(
        '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/'
        'android.widget.FrameLayout/android.widget.FrameLayout/android.widget'
        '.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/'
        'android.view.ViewGroup/android.webkit.WebView/android.webkit.WebView/'
        'android.view.View/android.view.View[1]').is_displayed()
def test_cancel_search(appdriver):
    OnboardingElements(appdriver).press_skip_onboarding_button()
    Search(appdriver).click_to_the_search_field()
    Search(appdriver).input_text_to_the_search_field('Python')

    assert appdriver.find_element_by_android_uiautomator('new UiSelector().text("Python")').text == 'Python', \
        'Search results is different, than request'

    Search(appdriver).press_to_cancel_search_button()

    assert Search(appdriver).get_text_in_the_search_field() == 'Поиск по Википедии',\
        'Text isn\'t presented in the Search field'
    assert Search(appdriver).get_text_in_the_empty_search() == \
        'Ищите и читайте свободную энциклопедию на своём языке', 'Search results aren\'t vanished'
def test_cancel_search(appdriver):
    if IS_IOS or IS_ANDROID:
        OnboardingElements(appdriver).press_skip_onboarding_button()
    Search(appdriver).click_to_the_search_field()
    Search(appdriver).input_text_to_the_search_field('Python')

    assert 'Python' in Search(appdriver).get_text_from_the_searched_result(), \
        'Can\'t find Python article in your reading list'

    Search(appdriver).press_to_clear_search_button()

    assert Search(
        appdriver).get_text_in_the_search_field() == AssertTexts.search_in_wiki

    if IS_ANDROID:
        assert Search(appdriver).get_text_in_the_empty_search() ==\
           'Ищите и читайте свободную энциклопедию на своём языке', 'Search results aren\'t vanished'
def test_save_two_articles(appdriver):
    # FIND AND SAVE THE FIRST ARTICLE
    OnboardingElements(appdriver).press_skip_onboarding_button()
    Search(appdriver).click_to_the_search_field()
    Search(appdriver).input_text_to_the_search_field(credo.search_python)
    Search(appdriver).open_programming_language_page()

    Article(appdriver).press_save_article_to_my_list()
    OnboardingElements(appdriver).press_to_got_it_button(
    )  # Нажатие на кнопку "Понятно" в инфо об оффлайн статьях
    Article(appdriver).press_create_new_list()
    Article(appdriver).input_my_list_name()
    Article(appdriver).press_ok_to_create_new_list()

    # FIND AND SAVE THE SECOND ARTICLE
    for back in range(2):
        appdriver.back()

    Search(appdriver).clear_the_search_field()
    Search(appdriver).input_text_to_the_search_field(credo.search_java)
    Search(appdriver).open_programming_language_page()

    Article(appdriver).press_save_article_to_my_list()
    Article(appdriver).open_my_list()

    # CHECK SAVED ARTICLES
    for back in range(3):
        appdriver.back()

    OnboardingElements(appdriver).press_no_thanks_button_sign_up_pop_up()
    NavigationUI(appdriver).open_my_lists()
    MyLists(appdriver).open_my_list()

    assert ArticlesNames(appdriver).python_article(
    ) == 'Python', 'Can\'t find Python article in your reading list'
    assert ArticlesNames(appdriver).java_article(
    ) == 'Java', 'Can\'t find Java article in your reading list'

    # DELETE JAVA ARTICLE WITH SWIPE
    ArticlesNames(appdriver).delete_java_with_swipe()

    assert ArticlesNames(appdriver).java_article_no_shown(
    ) is None, 'Java\'s article isn\'t deleted'
def test_get_text_from_search_field(appdriver):
    OnboardingElements(appdriver).press_skip_onboarding_button()

    assert Search(appdriver).get_text_in_the_search_field() == 'Поиск по Википедии',\
        'Text isn\'t presented in the Search field'
Example #9
0
def test_save_two_articles(appdriver):

    if IS_MOBILE_WEB:
        # LOGIN AS USER
        NavigationUI(appdriver).open_web_menu()
        NavigationUI(appdriver).open_login_page()
        LoginPage(appdriver).login_to_wiki()
        assert MainPage(appdriver).get_welcome_text() == f'Welcome, {Users.username}!'
    else:
        # SKIP ONBOARDING ON IOS/ANDROID
        OnboardingElements(appdriver).press_skip_onboarding_button()

    # FIND THE FIRST ARTICLE
    Search(appdriver).click_to_the_search_field()
    Search(appdriver).input_text_to_the_search_field(Keywords.search_python)

    if IS_IOS or IS_ANDROID:
        # OPEN ARTICLE PAGE
        Search(appdriver).open_programming_language_page()

    # SAVE ARTICLE TO FAVORITES
    Article(appdriver).press_save_article_to_my_list()

    if IS_ANDROID:
        # CREATE USER LIST FOR ARTICLE
        OnboardingElements(appdriver).press_to_got_it_button()  # Нажатие на кнопку "Понятно" в инфо об оффлайн статьях
        Article(appdriver).press_create_new_list()
        Article(appdriver).input_my_list_name()
        Article(appdriver).press_ok_to_create_new_list()

        # RETURN BACK
        for back in range(2):
            appdriver.back()

    elif IS_IOS:
        # RETURN BACK
        Article(appdriver).press_go_back_button()

    # CLEAR SEARCH FIELD
    Search(appdriver).clear_the_search_field()

    # FIND THE SECOND ARTICLE
    Search(appdriver).input_text_to_the_search_field(Keywords.search_java)

    if IS_IOS or IS_ANDROID:
        # OPEN ARTICLE PAGE
        Search(appdriver).open_programming_language_page()

    # SAVE ARTICLE TO FAVORITES
    Article(appdriver).press_save_article_to_my_list()

    # OPEN FAVORITES
    if IS_ANDROID:
        Article(appdriver).open_my_list()
        for back in range(3):
            appdriver.back()
        OnboardingElements(appdriver).press_no_thanks_button_sign_up_pop_up()
    elif IS_IOS:
        Article(appdriver).press_go_back_button()
        Search(appdriver).press_to_cancel_search_button()
    else:
        NavigationUI(appdriver).open_web_menu()

    NavigationUI(appdriver).open_my_lists()

    # CHECK SAVED ARTICLES
    if IS_ANDROID:
        MyLists(appdriver).open_my_list()
    elif IS_IOS:
        OnboardingElements(appdriver).press_no_thanks_button_sign_up_pop_up()

    assert 'Python' in ArticlesNames(appdriver).python_article(), 'Can\'t find Python article in your reading list'
    assert 'Java' in ArticlesNames(appdriver).java_article(), 'Can\'t find Java article in your reading list'

    if IS_IOS or IS_ANDROID:
        # DELETE JAVA ARTICLE WITH SWIPE
        ArticlesNames(appdriver).delete_java_with_swipe()
        assert ArticlesNames(appdriver).java_article_no_shown() is None, 'Java\'s article isn\'t deleted'
    else:
        # UNSTAR ARTICLE
        Article(appdriver).press_save_article_to_my_list()  # метод тот же

        # OPEN WATCHLIST AGAIN AND CHECK DELETED ARTICLE
        NavigationUI(appdriver).open_web_menu()
        NavigationUI(appdriver).open_my_lists()
        assert ArticlesNames(appdriver).java_article_no_shown() is None, 'Java\'s article isn\'t deleted'