def test_basic_duckduckgo_search(browser,mydata):
  search_page = DuckDuckGoSearchPage(browser)
  result_page = DuckDuckGoResultPage(browser)

  # Given the DuckDuckGo home page is displayed
  search_page.load()

  phrase = mydata[0]

  print(phrase)

  # When the user searches for "panda"
  search_page.search(phrase)

  getData()
 
  # Changes made to main branch.
  # And the search result query is "panda"
  assert phrase == result_page.search_input_value()
  
  # And the search result links pertain to "panda"
  #for title in result_page.result_link_titles():
  #  assert phrase.lower() in title.lower()

  # Then the search result title contains "panda"
  assert phrase in result_page.title()
示例#2
0
def test_basic_duckduckgo_search(browser):

    # initialize page object and phrase to search
    search_page = DuckDuckGoSearchPage(browser)
    result_page = DuckDuckGoResultPage(browser)
    PHRASE = "panda"
    # given duckduckgo homepage
    search_page.load()

    # when user searches for "panda"
    search_page.search(PHRASE)

    # then the search result query is "panda"
    assert PHRASE == result_page.search_input_value()

    # and the search result links pertain to "panda"
    titles = result_page.result_link_titles()
    matches = []
    for t in titles:
        if PHRASE.lower() in t.lower():
            matches.append(t)
    assert len(matches) > 0  # return true when there is title in the matches

    # And search result title contain "panda"
    assert PHRASE in result_page.title()
示例#3
0
    def test_basic_duckduckgo_search(self, phrase):

        self.LOGGER.info("Inside Test")
        search_page = DuckDuckGoSearchPage(self.driver)
        result_page = DuckDuckGoResultPage(self.driver)
        # phrase = "panda"

        # Given the DuckDuckGo home page is displayed
        search_page.load()

        # assert if the page loaded successfully
        assert search_page.is_loaded() is True

        # When the user searches the title
        search_page.search(phrase)

        # And the search result query is "phrase"
        assert phrase in result_page.search_input_value()

        # And the search result links pertain to "phrase"
        titles = result_page.result_link_titles()
        matches = [t for t in titles if phrase.lower() in t.lower()]
        print(matches)
        assert len(matches) > 0

        # Then the search result title contains "phrase"
        assert phrase in result_page.title()
        self.LOGGER.info("Finishing Test")
示例#4
0
def test_duckduckgo_search_manual(browser):
    search_page = DuckDuckGoSearchPage(browser)
    result_page = DuckDuckGoResultPage(browser)
    PHRASE = "panda"

    search_page.load()

    search_page.search_manual(PHRASE)

    assert PHRASE in result_page.title()
def test_click_search_button_leads_to_results(browser):
    search_page = DuckDuckGoSearchPage(browser)
    result_page = DuckDuckGoResultPage(browser)
    phrase = "Antarctica"

    search_page.load()

    search_page.search_and_click_button(phrase)

    assert phrase in result_page.title()
def test_basic_duckduckgo_search(browser, phrase):
    search_page = DuckDuckGoSearchPage(browser)
    result_page = DuckDuckGoResultPage(browser)

    search_page.load()

    search_page.search(phrase)

    assert phrase == result_page.search_input_value()

    titles = result_page.result_link_titles()
    matches = [title for title in titles if phrase.lower() in title.lower()]
    assert len(matches) > 0

    assert phrase in result_page.title()
示例#7
0
def test_basic_duckduckgo_search(browser):
    search_page = DuckDuckGoSearchPage(browser)
    result_page = DuckDuckGoResultPage(browser)

    #Given DDG home page is displayed
    search_page.load()

    search_page.search("panda")

    #Given the DuckDuckGo home page is displayed
    assert "panda" in result_page.title()

    #When the user searches ofr "Panda"
    assert "panda" == result_page.search_input_value()

    #Then the search result title contains "Panda"
    assert result_page.result_count_for_phrase("panda") > 0

    assert True
def test_basic_duckduckgo_search(browser, phrase):
    search_page = DuckDuckGoSearchPage(browser)
    result_page = DuckDuckGoResultPage(browser)

    # Given the DuckDuckGo home page is displayed
    search_page.load()

    # When the user searches for the phrase
    search_page.search(phrase)

    # Then the search result query is the phrase
    assert phrase == result_page.search_input_value()

    # And the search result title contains the phrase
    assert phrase.lower() in result_page.title()

    # And the search result links pertain to the phrase
    for title in result_page.result_link_titles():
        assert phrase.lower() in title.lower()
def test_basic_duckduckgo_search(browser):
  search_page = DuckDuckGoSearchPage(browser)
  result_page = DuckDuckGoResultPage(browser)
  PHRASE = "panda"

  # Given the DuckDuckGo home page is displayed
  search_page.load()

  # When the user searches for "panda"
  search_page.search(PHRASE)

  # And the search result links pertain to "panda"
  titles = result_page.result_link_titles()
  matches = [t for t in titles if PHRASE.lower() in t.lower()]
  assert len(matches) > 0

  # And the search result title contains "panda"
  # (Putting this assertion last guarantees that the page title will be ready)
  assert PHRASE in result_page.title()
def test_basic_duckduckgo_search(browser):  #, cbt_uploader
    search_page = DuckDuckGoSearchPage(browser)
    result_page = DuckDuckGoResultPage(browser)
    PHRASE = "panda"

    # Given the DuckDuckGo home page is displayed
    search_page.load()

    # When the user searches for "panda"
    search_page.search(PHRASE)

    # Then the search result title contains "panda"
    assert PHRASE in result_page.title()

    # And the search result query is "panda"
    assert PHRASE == result_page.search_input_value()

    # And the search result links pertain to "panda"
    assert result_page.result_count_for_phrase(PHRASE) > 0
示例#11
0
def test_duckduckgo_selecting_autocomplete_sugestion(browser):
    search_page = DuckDuckGoSearchPage(browser)
    result_page = DuckDuckGoResultPage(browser)
    PHRASE = "panda"
    
    search_page.load()
    search_page.search_by_letter(PHRASE)
    items = search_page.get_autocomplete_items()
    NEW_PHRASE = search_page.select_random_option(items)


    assert NEW_PHRASE in result_page.title()

    assert NEW_PHRASE == result_page.search_input_value()


    titles = result_page.result_link_titles()
    matches = [t for t in titles if NEW_PHRASE.lower() in t.lower()]
    assert len(matches) > 0
示例#12
0
def test_basic_duckduckgo_search(browser, phrase):
    search_page = DuckDuckGoSearchPage(browser)
    result_page = DuckDuckGoResultPage(browser)

    # Given the DuckDuckGo home page is displayed
    search_page.load()

    # When the user searches for "panda"
    search_page.search(phrase)

    # Then the search result query is "panda"
    assert phrase == result_page.search_input_value()

    # And the search result links pertain to "panda"
    titles = result_page.result_link_titles()
    matches = [t for t in titles if phrase.lower() in t.lower()]
    assert len(matches) > 0

    # And the search result title contains "panda"
    # Putting this assertion last to guarantee that the page title will be ready
    assert phrase in result_page.title()
示例#13
0
def test_basic_duckduckgo_searh(browser, phrase):
    search_page = DuckDuckGoSearchPage(browser)
    result_page = DuckDuckGoResultPage(browser)
    PHRASE = "panda"
    
    #Given the DuckDuckGo home page is displayed
    search_page.load()

    #When the user searches for "panda"
    search_page.search(PHRASE)

    #Then the search result title contains "panda"
    assert PHRASE in result_page.title()

    #And the search result query is "panda"
    assert PHRASE == result_page.search_input_value()

    # And the search result links pertain to "panda"
    titles = result_page.result_link_titles()
    matches = [t for t in titles if PHRASE.lower() in t.lower()]
    assert len(matches) > 0
示例#14
0
def test_basic_search(browser, phrase):
	search_page = DuckDuckGoSearchPage(browser)
	result_page = DuckDuckGoResultPage(browser)

	#load page
	search_page.load()

	#enter search phrase
	search_page.search(phrase)

	#make sure phrase in results page results
	assert phrase == result_page.search_input_values()

	#make sure phrase is in result links
	titles = result_page.result_link_titles()
	matches = [t for t in titles if phrase.lower() in t.lower()]
	#make suer there is at least one match
	assert len(matches) > 0

	#make sure phrase is in results page title
	assert phrase in result_page.title()
def test_basic_duckduckgo_search(browser, phrase1, phrase2):
    search_page = DuckDuckGoSearchPage(browser)
    result_page = DuckDuckGoResultPage(browser)
    phrase = phrase1 + phrase2
    # Given the DuckDuckGo home page is displayed
    search_page.load()

    # When the user searches for "panda"
    search_page.search(phrase)

    # Then the search result title contains "panda"
    assert phrase in result_page.title()

    # And the search result query is "panda"
    assert phrase == result_page.search_input_value()

    # And the search result links pertain to "panda"
    titles = result_page.result_link_titles()
    matches = [t for t in titles if phrase.lower() in t.lower()]
    assert len(matches) > 0

    result_page.print_info()
示例#16
0
def test_basic_duckduckgo_search(browser,phrase):
    
    searchPage       = DuckDuckGoSearchPage(browser)
    serachResultPage = DuckDuckGoResultPage(browser)
    
    # Given the DuckDuckGo home page is displayed
    searchPage.load()


    # When the user searches for "panda"
    searchPage.search(phrase)

    # Then the search result is "panda"
    assert phrase == serachResultPage.search_input_value()

    browser.get_screenshot_as_png()
    # And the search result links pertain to "panda"
    for title in serachResultPage.result_link_titles():
        assert phrase.lower() in title.lower()

    
    # And the search result title contains "panda"
    assert phrase in serachResultPage.title()
示例#17
0
def test_basic_duckduckgo_search(browser):
    search_page = DuckDuckGoSearchPage(browser)
    result_page = DuckDuckGoResultPage(browser)
    PHRASE = "panda"

    # Given the DuckDuckGo home page is displayed
    search_page.load()

    # When the user searches for "panda"
    search_page.search(PHRASE)

    # Then the search result title contains "panda"
    assert PHRASE in result_page.title()

    # And the search result query is "panda"
    assert PHRASE == result_page.search_input_value()

    # And the search result links pertain to "panda"
    titles = result_page.result_link_titles()
    matches = [t for t in titles if PHRASE.lower() in t.lower()]
    assert len(matches) > 0

    # TODO: Remove this exception once the test is complete
    raise Exception("Incomplete Test")