-
Notifications
You must be signed in to change notification settings - Fork 722
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Adding a new helper function in BasePage to extract the list of tex…
…tContent for a given locator. - Adding the https://support.allizom.org/en-US/kb/get-community-support?exit_aaq=1 page to test data. - Adding the AAQ widget text which is displayed when the "All Products" filter is applied to AAQWidgetMessage for further usage in tests. - Expanding the locators & actions for the ExploreByTopicsPage class. - Adding playwright coverage for the "Explore By Topic" page: - Verifying that the correct explore by topic page header is displayed when changing the topic via the "All Topics" side navbar. - Verifying that the "Filter by product" successfully updates the displayed list of articles with articles that belong to the chosen product from the "Filter by product" dropdown (by verifying the displayed metadata for each listed article) - Verifying that the correct AAQ widget text is displayed for each filtered product. - Verifying the correct AAQ widget redirect for each filtered product. - Added playwright coverage for the mozilla/sumo#1876 case - Adding the new test suite to playwright.yml
- Loading branch information
1 parent
99d6154
commit f92c0b9
Showing
9 changed files
with
216 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
136 changes: 136 additions & 0 deletions
136
..._tests/tests/explore_help_articles_tests/explore_by_topic_tests/test_explore_by_topics.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
import time | ||
|
||
import allure | ||
import pytest | ||
from playwright.sync_api import Page | ||
|
||
from playwright_tests.core.utilities import Utilities | ||
from playwright_tests.messages.ask_a_question_messages.AAQ_messages.aaq_widget import ( | ||
AAQWidgetMessages) | ||
from playwright_tests.messages.ask_a_question_messages.contact_support_messages import ( | ||
ContactSupportMessages) | ||
from playwright_tests.pages.sumo_pages import SumoPages | ||
|
||
troubleshooting_topic_url = ("https://support.allizom.org/en-US/topics/customize-settings-and" | ||
"-preferences") | ||
|
||
|
||
# C2663958, C2663959 | ||
@pytest.mark.exploreByTopics | ||
def test_explore_by_topic_product_filter(page: Page): | ||
sumo_pages = SumoPages(page) | ||
utilities = Utilities(page) | ||
with allure.step("Navigating to the /topics/ Customize settings and preferences page"): | ||
utilities.navigate_to_link(troubleshooting_topic_url) | ||
for topic in sumo_pages.explore_by_topic_page._get_all_topics_side_navbar_options(): | ||
topic = topic.strip() | ||
if topic != "Customize settings and preferences": | ||
sumo_pages.explore_by_topic_page._click_on_a_topic_filter(topic) | ||
with allure.step("Verifying that the correct page header is displayed"): | ||
assert topic == (sumo_pages.explore_by_topic_page | ||
._get_explore_by_topic_page_header().strip()) | ||
for product in sumo_pages.explore_by_topic_page._get_all_filter_by_product_options(): | ||
product = product.strip() | ||
if product.strip() == "All Products": | ||
continue | ||
else: | ||
sumo_pages.explore_by_topic_page._select_a_filter_by_product_option( | ||
product.strip()) | ||
time.sleep(2) | ||
# This currently fails due to https://github.com/mozilla/sumo/issues/1901. | ||
# Uncommenting after the issue is fixed. | ||
# if not sumo_pages.explore_by_topic_page._get_metadata_of_all_listed_articles(): | ||
# pytest.fail(f"There is no sublist for {product}") | ||
|
||
for sublist in (sumo_pages.explore_by_topic_page | ||
._get_metadata_of_all_listed_articles()): | ||
assert product in sublist | ||
|
||
|
||
# C2462867 | ||
@pytest.mark.exploreByTopics | ||
def test_explore_by_topic_aaq_widget_text(page: Page): | ||
sumo_pages = SumoPages(page) | ||
utilities = Utilities(page) | ||
|
||
with allure.step("Signing in to SUMO"): | ||
utilities.start_existing_session(utilities.username_extraction_from_email( | ||
utilities.user_secrets_accounts["TEST_ACCOUNT_12"] | ||
)) | ||
|
||
with allure.step("Navigating to the /topics/ Customize settings and preferences page"): | ||
utilities.navigate_to_link(troubleshooting_topic_url) | ||
for topic in sumo_pages.explore_by_topic_page._get_all_topics_side_navbar_options(): | ||
topic = topic.strip() | ||
if topic != "Customize settings and preferences": | ||
sumo_pages.explore_by_topic_page._click_on_a_topic_filter(topic) | ||
for product in sumo_pages.explore_by_topic_page._get_all_filter_by_product_options(): | ||
product = product.strip() | ||
sumo_pages.explore_by_topic_page._select_a_filter_by_product_option(product) | ||
time.sleep(2) | ||
with allure.step("Verifying the correct AAQ widget text is displayed for products"): | ||
if product == "All Products": | ||
assert (sumo_pages.explore_by_topic_page | ||
._get_text_of_aaq_widget() == AAQWidgetMessages | ||
.NEUTRAL_AAQ_SUBHEADING_TEXT) | ||
elif product in utilities.general_test_data['freemium_products']: | ||
assert (sumo_pages.explore_by_topic_page | ||
._get_text_of_aaq_widget() == AAQWidgetMessages | ||
.FREEMIUM_AAQ_SUBHEADING_TEXT) | ||
elif product in utilities.general_test_data['premium_products']: | ||
assert (sumo_pages.explore_by_topic_page | ||
._get_text_of_aaq_widget() == AAQWidgetMessages | ||
.PREMIUM_AAQ_SUBHEADING_TEXT) | ||
else: | ||
assert not sumo_pages.explore_by_topic_page._is_aaq_text_visible() | ||
|
||
|
||
# C2663960 | ||
@pytest.mark.exploreByTopics | ||
def test_explore_by_topic_aaq_widget_redirect(page: Page): | ||
sumo_pages = SumoPages(page) | ||
utilities = Utilities(page) | ||
|
||
with allure.step("Signing in to SUMO"): | ||
utilities.start_existing_session(utilities.username_extraction_from_email( | ||
utilities.user_secrets_accounts["TEST_ACCOUNT_12"] | ||
)) | ||
|
||
with allure.step("Navigating to the /topics/ Customize settings and preferences page"): | ||
utilities.navigate_to_link(troubleshooting_topic_url) | ||
|
||
for topic in sumo_pages.explore_by_topic_page._get_all_topics_side_navbar_options(): | ||
topic = topic.strip() | ||
if topic != "Customize settings and preferences": | ||
sumo_pages.explore_by_topic_page._click_on_a_topic_filter(topic) | ||
for product in sumo_pages.explore_by_topic_page._get_all_filter_by_product_options(): | ||
product = product.strip() | ||
current_url = utilities.get_page_url() | ||
sumo_pages.explore_by_topic_page._select_a_filter_by_product_option(product) | ||
print(f"This is the product: {product}") | ||
time.sleep(2) | ||
with page.expect_navigation() as navigation_info: | ||
sumo_pages.explore_by_topic_page._click_on_aaq_continue_button() | ||
response = navigation_info.value | ||
assert response.status == 200 | ||
if product == "All Products": | ||
assert ContactSupportMessages.PAGE_URL == utilities.get_page_url() | ||
elif product not in utilities.aaq_question_test_data['products_aaq_url']: | ||
assert (utilities.aaq_question_test_data['product_without_aaq_url'] == utilities. | ||
get_page_url()) | ||
else: | ||
assert (utilities. | ||
aaq_question_test_data['products_aaq_url'][product] == utilities. | ||
get_page_url()) | ||
|
||
utilities.navigate_to_link(current_url) | ||
|
||
|
||
# C2663961 | ||
@pytest.mark.exploreByTopics | ||
def test_incorrect_kb_topic_listing_redirect(page: Page): | ||
utilities = Utilities(page) | ||
with page.expect_navigation() as navigation_info: | ||
utilities.navigate_to_link("https://support.allizom.org/en-US/topics/get-started") | ||
response = navigation_info.value | ||
assert response.status == 404 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters