Beispiel #1
0
def test_browse_all_button_loads_correct_page(base_url, selenium):
    page = Home(selenium, base_url).open()
    page.recommended_extensions.browse_all()
    assert 'type=extension' in selenium.current_url
    search_page = Search(selenium, base_url)
    for result in search_page.result_list.extensions:
        assert result.promoted_badge
def test_browse_more_top_rated_themes(base_url, selenium):
    themes = Themes(selenium, base_url).open()
    themes.shelves.top_rated_addons.browse_all()
    assert 'sort=rating&type=statictheme' in selenium.current_url
    search_results = Search(selenium, base_url)
    ratings = search_results.result_list.themes
    for rating in ratings:
        assert rating.rating >= 4
def test_browse_more_trending_themes(base_url, selenium):
    themes = Themes(selenium, base_url).open()
    themes.shelves.trending_addons.browse_all()
    assert 'sort=hotness&type=statictheme' in selenium.current_url
    search_results = Search(selenium, base_url)
    # trending add-ons don't have a predictable order so we
    # check that search results are displayed for this sort type
    assert len(search_results.result_list.themes) == 25
Beispiel #4
0
 def search_for(self, term):
     textbox = self.find_element(*self._search_textbox_locator)
     textbox.click()
     textbox.send_keys(term)
     # Send 'enter' since the mobile page does not have a submit button
     textbox.send_keys(u'\ue007')
     from pages.desktop.search import Search
     return Search(self.selenium, self.page).wait_for_page_to_load()
Beispiel #5
0
def test_filter_themes(base_url, selenium):
    page = Home(selenium, base_url).open()
    term = 'fox'
    page.search.search_for(term)
    search_page = Search(selenium, base_url)
    select = Select(search_page.filter_by_type)
    select.select_by_value('statictheme')
    search_page.wait_for_contextcard_update("themes")
    assert len(search_page.result_list.themes) == 25
def test_browse_more_recommended_extensions(base_url, selenium):
    extensions = Extensions(selenium, base_url).open()
    extensions.shelves.recommended_addons.browse_all()
    assert 'type=extension' in selenium.current_url
    search_results = Search(selenium, base_url)
    select = Select(search_results.filter_by_badging)
    assert select.first_selected_option.text == 'Recommended'
    for result in search_results.result_list.extensions:
        assert 'Recommended' in result.promoted_badge_label
def test_extensions_categories(base_url, selenium, count, category):
    extensions = Extensions(selenium, base_url).open()
    # clicking through each Category listed on Extensions homepage
    extensions.categories.category_list[count].click()
    category_results = Search(selenium, base_url)
    # checking that category search results are loaded and sorted by users
    category_results.wait_for_contextcard_update(category)
    select = Select(category_results.filter_by_sort)
    assert 'Most Users' in select.first_selected_option.text
def test_themes_categories(base_url, selenium, count, category):
    themes = Themes(selenium, base_url).open()
    # clicking through each Theme Category
    themes.categories.category_list[count].click()
    category_results = Search(selenium, base_url)
    # checking that search results within that category are sorted correctly
    category_results.wait_for_contextcard_update(category)
    select = Select(category_results.filter_by_sort)
    assert 'Most Users' in select.first_selected_option.text
Beispiel #9
0
 def search_for(self, term, execute=True):
     textbox = self.find_element(*self._search_textbox_locator)
     textbox.click()
     textbox.send_keys(term)
     # Send 'enter' since the mobile page does not have a submit button
     if execute:
         textbox.send_keys(Keys.ENTER)
         from pages.desktop.search import Search
         return Search(self.selenium, self.page).wait_for_page_to_load()
     return self.search_suggestions
Beispiel #10
0
def test_filter_by_users(base_url, selenium):
    Home(selenium, base_url).open()
    term = 'fox'
    sort = 'users'
    selenium.get(f'{base_url}/search/?&q={term}&sort={sort}')
    search_page = Search(selenium, base_url)
    results = [
        getattr(result, sort) for result in search_page.result_list.extensions
    ]
    assert sorted(results, reverse=True) == results
Beispiel #11
0
def test_filter_default(base_url, selenium, variables):
    page = Home(selenium, base_url).open()
    term = variables['search_term']
    page.search.search_for(term)
    search_page = Search(selenium, base_url)
    select = Select(search_page.filter_by_sort)
    assert select.first_selected_option.text == 'Relevance'
    select = Select(search_page.filter_by_type)
    assert select.first_selected_option.text == 'All'
    select = Select(search_page.filter_by_badging)
    assert select.first_selected_option.text == 'Any'
Beispiel #12
0
def test_sorting_by(base_url, selenium, category, sort_attr):
    """Test searching for an addon and sorting."""
    Home(selenium, base_url).open()
    addon_name = 'Ui-Addon'
    selenium.get('{}/search/?&q={}&sort={}'.format(base_url, addon_name,
                                                   sort_attr))
    search_page = Search(selenium, base_url)
    results = [
        getattr(i, sort_attr) for i in search_page.result_list.extensions
    ]
    assert sorted(results, reverse=True) == results
Beispiel #13
0
def test_theme_categories_shelf(base_url, selenium, count, category):
    page = Home(selenium, base_url).open()
    # verifying the elements present in the homepage Theme Category shelf
    assert 'Change the way Firefox looks' in page.theme_category.shelf_summary
    categories = page.theme_category.list
    categories[count].category_icon.is_displayed()
    assert category in categories[count].name
    # checking that search results within that category are loaded
    categories[count].click()
    category_results = Search(selenium, base_url)
    category_results.wait_for_contextcard_update(category)
Beispiel #14
0
def test_filter_by_rating_and_hotness(base_url, selenium, category, sort_attr):
    """Test searching for an addon and sorting."""
    Home(selenium, base_url).open()
    addon_name = 'fox'
    selenium.get(f'{base_url}/search/?&q={addon_name}&sort={sort_attr}')
    search_page = Search(selenium, base_url)
    results = search_page.result_list.extensions
    if sort_attr == 'rating':
        for result in search_page.result_list.extensions:
            assert result.rating > 4
    else:
        assert len(results) == 25
Beispiel #15
0
 def search_for(self, term, execute=True):
     textbox = self.find_element(*self._search_textbox_locator)
     textbox.click()
     textbox.send_keys(term)
     # Send 'enter' since the mobile page does not have a submit button
     if execute:
         textbox.send_keys(Keys.ENTER)
         from pages.desktop.search import Search
         return Search(self.selenium, self.page).wait_for_page_to_load()
     WebDriverWait(self.selenium, 30).until(
         EC.invisibility_of_element_located(self._search_item_name))
     return self.search_suggestions
Beispiel #16
0
def test_filter_promoted(base_url, selenium, sort_attr, title):
    page = Home(selenium, base_url).open()
    term = ""
    page.search.search_for(term)
    search_page = Search(selenium, base_url)
    select = Select(search_page.filter_by_badging)
    select.select_by_value(sort_attr)
    search_page.wait_for_contextcard_update('results found')
    results = search_page.result_list.extensions
    for result in results:
        assert result.promoted_badge
        if title != 'Reviewed':
            assert title.title() in result.promoted_badge_label
def test_browse_more_top_rated_extensions(base_url, selenium):
    extensions = Extensions(selenium, base_url).open()
    extensions.shelves.top_rated_addons.browse_all()
    assert 'sort=rating&type=extension' in selenium.current_url
    search_results = Search(selenium, base_url)
    select = Select(search_results.filter_by_badging)
    assert select.first_selected_option.text == 'Recommended'
    for result in search_results.result_list.extensions:
        assert 'Recommended' in result.promoted_badge_label
    # using a list slice below (normal len is 25) to validate rating ordering
    # because not all addons in the list have a rating on stage
    ratings = search_results.result_list.extensions[0:16]
    for rating in ratings:
        assert rating.rating >= 4
Beispiel #18
0
 def browse_all(self):
     self.find_element(*self._browse_all_locator).click()
     from pages.desktop.search import Search
     search = Search(self.selenium, self.page.base_url)
     return search.wait_for_page_to_load()
 def click(self):
     self.root.click()
     from pages.desktop.search import Search
     return Search(self.selenium, self.page.base_url)