- Fixing some failing and flaky product solutions, AAQ questions and article tests.

This commit is contained in:
Emil Ghitta 2024-02-22 00:59:39 +02:00
Родитель 8a91a12a5a
Коммит 1c96d53820
8 изменённых файлов: 69 добавлений и 99 удалений

Просмотреть файл

@ -20,3 +20,7 @@ class QuestionPageMessages:
THUMBS_DOWN_VOTE_MESSAGE = "Sorry to hear that."
THUMBS_UP_VOTE_MESSAGE = "Glad to hear it!"
HELPFUL_VOTE_HEADER = "Helpful?"
AVOID_SCAM_SUPPORT_LEARN_MORE_LINK = ("https://support.mozilla.org/kb/avoid-and-report"
"-mozilla-tech-support-scams")
TRY_THESE_MANUAL_STEPS_LINK = ("https://support.mozilla.org/kb/use-troubleshooting"
"-information-page-fix-firefox")

Просмотреть файл

@ -1,4 +1,3 @@
class ProductSolutionsMessages:
PAGE_HEADER = " Solutions"
CURRENT_MILESTONE_TEXT = "Explore Solutions"
AVOID_TECH_SUPPORT_SCAMS_ARTICLE_TITLE = "Avoid and report Mozilla tech support scams"

Просмотреть файл

@ -169,8 +169,14 @@ class AAQFormPage(BasePage):
def _click_on_show_details_option(self):
super()._click(self.__show_details_option)
def _click_on_try_these_manual_steps_link(self):
super()._click(self.__try_these_manual_steps_link)
# Instead of clicking on the 'Try these manual steps' button we are going to perform the
# assertion by checking that the element has the correct href value. Navigating to prod can
# yield a 429 error which we want to avoid.
def _get_try_these_manual_steps_link(self) -> str:
return super()._get_element_attribute_value(
self.__try_these_manual_steps_link,
"href"
)
# Email me when someone answers the thread section actions.
def _click_on_email_me_when_someone_answers_the_thread_checkbox(self):

Просмотреть файл

@ -86,8 +86,15 @@ class ProductSolutionsPage(BasePage):
return super()._get_element_handle(self.__product_title_heading)
# Support scam banner actions
def _click_on_scam_alert_banner_learn_more(self):
super()._click(self.__support_scam_banner_learn_more_button)
# Instead of clicking on the 'Learn More' button we are going to perform the assertion
# by checking that the element has the correct href value. Navigating to prod can yield
# a 429 error which we want to avoid.
def _get_scam_alert_banner_link(self) -> str:
return super()._get_element_attribute_value(
self.__support_scam_banner_learn_more_button,
"href"
)
def _get_scam_banner_locator(self) -> Locator:
return super()._get_element_locator(self.__support_scams_banner)

Просмотреть файл

@ -5,12 +5,12 @@ from playwright.sync_api import expect
from playwright_tests.core.testutilities import TestUtilities
from playwright_tests.messages.ask_a_question_messages.AAQ_messages.aaq_form_page_messages import (
AAQFormMessages)
from playwright_tests.messages.ask_a_question_messages.AAQ_messages.question_page_messages import \
QuestionPageMessages
from playwright_tests.messages.ask_a_question_messages.contact_support_messages import (
ContactSupportMessages)
from playwright_tests.messages.contribute_messages.con_pages.con_page_messages import (
ContributePageMessages)
from playwright_tests.messages.ask_a_question_messages.product_solutions_messages import (
ProductSolutionsMessages)
class TestAAQPage(TestUtilities):
@ -115,40 +115,24 @@ class TestAAQPage(TestUtilities):
super().general_test_data["product_solutions"][freemium_product]
)
self.logger.info("Clicking on the 'Learn More' button")
self.sumo_pages.product_solutions_page._click_on_scam_alert_banner_learn_more()
self.logger.info("Verifying that the correct kb article is displayed")
self.logger.info("Verifying that the 'Learn More' button contains the correct link")
check.equal(
self.sumo_pages.kb_article_page._get_text_of_article_title(),
ProductSolutionsMessages.AVOID_TECH_SUPPORT_SCAMS_ARTICLE_TITLE,
f"Incorrect KB article title. "
f"Expected: {ProductSolutionsMessages.AVOID_TECH_SUPPORT_SCAMS_ARTICLE_TITLE} "
f"Received: {self.sumo_pages.kb_article_page._get_text_of_article_title()}"
self.sumo_pages.product_solutions_page._get_scam_alert_banner_link(),
QuestionPageMessages.AVOID_SCAM_SUPPORT_LEARN_MORE_LINK
)
if username != '':
self.logger.info("Navigating back to the product solutions page")
self.navigate_back()
self.wait_for_url_to_be(
super().general_test_data["product_solutions"][freemium_product]
)
if username != '':
self.logger.info("Clicking on the ask now button")
self.sumo_pages.product_solutions_page._click_ask_now_button()
self.wait_for_url_to_be(
super().aaq_question_test_data["products_aaq_url"][freemium_product]
)
self.logger.info("Clicking on the 'Learn More' button")
self.sumo_pages.product_solutions_page._click_on_scam_alert_banner_learn_more()
self.logger.info("Verifying that the correct kb article is displayed")
self.logger.info(
"Verifying that the 'Learn More' button contains the correct link")
check.equal(
self.sumo_pages.kb_article_page._get_text_of_article_title(),
ProductSolutionsMessages.AVOID_TECH_SUPPORT_SCAMS_ARTICLE_TITLE,
f"Incorrect KB article title. "
f"Expected: {ProductSolutionsMessages.AVOID_TECH_SUPPORT_SCAMS_ARTICLE_TITLE} "
f"Received: {self.sumo_pages.kb_article_page._get_text_of_article_title()}"
self.sumo_pages.product_solutions_page._get_scam_alert_banner_link(),
QuestionPageMessages.AVOID_SCAM_SUPPORT_LEARN_MORE_LINK
)
# C890537
@ -364,19 +348,12 @@ class TestAAQPage(TestUtilities):
self.logger.info("Clicking on the 'Share Data' option")
self.sumo_pages.aaq_form_page._click_on_share_data_button()
self.logger.info(
"Clicking on the 'try these manual steps' option")
self.sumo_pages.aaq_form_page._click_on_try_these_manual_steps_link()
self.logger.info("Verifying that we are redirected to the correct page")
assert (
super().aaq_question_test_data["troubleshooting_information_kb_article_url"] in
self.get_page_url()
self.logger.info("Verifying that the 'try these manual steps' contains the correct link")
check.equal(
self.sumo_pages.aaq_form_page._get_try_these_manual_steps_link(),
QuestionPageMessages.TRY_THESE_MANUAL_STEPS_LINK
)
self.logger.info("Navigating back to the aaq form")
self.navigate_to_link(super().aaq_question_test_data["products_aaq_url"]["Firefox"])
self.logger.info("Adding data inside AAQ form fields without submitting the form")
self.sumo_pages.aaq_flow.add__valid_data_to_all_input_fields_without_submitting(
subject=super().aaq_question_test_data["valid_firefox_question"]["subject"],
@ -384,9 +361,6 @@ class TestAAQPage(TestUtilities):
body_text=super().aaq_question_test_data["valid_firefox_question"]["question_body"]
)
self.logger.info("Clicking on the 'Share Data' option")
self.sumo_pages.aaq_form_page._click_on_share_data_button()
self.logger.info("Adding text inside the troubleshooting information field")
self.sumo_pages.aaq_form_page._add_text_to_troubleshooting_information_textarea(
super().aaq_question_test_data["troubleshooting_information_textarea_field"]

Просмотреть файл

@ -13,8 +13,6 @@ from playwright_tests.messages.auth_pages_messages.fxa_page_messages import (
FxAPageMessages)
from playwright_tests.messages.ask_a_question_messages.contact_support_messages import (
ContactSupportMessages)
from playwright_tests.messages.ask_a_question_messages.product_solutions_messages import (
ProductSolutionsMessages)
class TestPostedQuestions(TestUtilities):
@ -45,20 +43,13 @@ class TestPostedQuestions(TestUtilities):
self.sumo_pages.product_solutions_page._get_still_need_help_locator()
).to_be_hidden()
self.logger.info("Clicking on the 'Learn More' button")
self.sumo_pages.product_solutions_page._click_on_scam_alert_banner_learn_more()
self.logger.info("Verifying that the correct kb article is displayed")
self.logger.info(
"Verifying that the 'Learn More' button contains the correct link")
check.equal(
self.sumo_pages.kb_article_page._get_text_of_article_title(),
ProductSolutionsMessages.AVOID_TECH_SUPPORT_SCAMS_ARTICLE_TITLE,
f"Incorrect KB article title. "
f"Expected: {ProductSolutionsMessages.AVOID_TECH_SUPPORT_SCAMS_ARTICLE_TITLE} "
f"Received: {self.sumo_pages.kb_article_page._get_text_of_article_title()}"
self.sumo_pages.product_solutions_page._get_scam_alert_banner_link(),
QuestionPageMessages.AVOID_SCAM_SUPPORT_LEARN_MORE_LINK
)
self.navigate_back()
self.logger.info("Deleting session cookies")
super().delete_cookies()
@ -77,20 +68,13 @@ class TestPostedQuestions(TestUtilities):
self.sumo_pages.product_solutions_page._get_still_need_help_locator()
).to_be_hidden()
self.logger.info("Clicking on the 'Learn More' button")
self.sumo_pages.product_solutions_page._click_on_scam_alert_banner_learn_more()
self.logger.info("Verifying that the correct kb article is displayed")
self.logger.info(
"Verifying that the 'Learn More' button contains the correct link")
check.equal(
self.sumo_pages.kb_article_page._get_text_of_article_title(),
ProductSolutionsMessages.AVOID_TECH_SUPPORT_SCAMS_ARTICLE_TITLE,
f"Incorrect KB article title. "
f"Expected: {ProductSolutionsMessages.AVOID_TECH_SUPPORT_SCAMS_ARTICLE_TITLE} "
f"Received: {self.sumo_pages.kb_article_page._get_text_of_article_title()}"
self.sumo_pages.product_solutions_page._get_scam_alert_banner_link(),
QuestionPageMessages.AVOID_SCAM_SUPPORT_LEARN_MORE_LINK
)
self.navigate_back()
self.logger.info("Deleting the posted question")
self.sumo_pages.question_page._click_delete_this_question_question_tools_option()
self.sumo_pages.question_page._click_delete_this_question_button()
@ -1900,7 +1884,7 @@ class TestPostedQuestions(TestUtilities):
# Using a user which doesn't have any special permissions applied & which doesn't belong to
# any group in order to catch cases like https://github.com/mozilla/sumo/issues/1676
posted_question = self.post_firefox_product_question_flow('TEST_ACCOUNT_MESSAGE_5')
posted_question = self.post_firefox_product_question_flow('TEST_ACCOUNT_MESSAGE_6')
question_id = self.sumo_pages.question_page._get_question_id()
if quote_on == "reply":

Просмотреть файл

@ -167,7 +167,7 @@ class TestArticleThreads(TestUtilities):
thread_info = (self.sumo_pages.post_kb_discussion_thread_flow.
add_new_kb_discussion_thread())
self.logger.info("Verifying that the thread counter is 0")
self.logger.info("Verifying that the thread counter is not 0")
check.equal(
self.number_extraction_from_string(
self.sumo_pages.kb_article_discussion_page._get_thread_page_counter_replies_text()
@ -1266,33 +1266,6 @@ class TestArticleThreads(TestUtilities):
self.__clearing_newly_created_thread(thread_info_one['thread_id'])
self.__clearing_newly_created_thread(thread_info_two['thread_id'])
# # Currently fails due to https://github.com/mozilla/sumo/issues/1221
# @pytest.mark.articleThreads
# @pytest.mark.parametrize("username", ['TEST_ACCOUNT_12', 'TEST_ACCOUNT_MODERATOR', ''])
# def test_article_thread_type_filter(self, username):
#
# @pytest.mark.articleThreads
# def test_article_thread_last_post_filter(self):
# @pytest.mark.articleThreads
# def test_article_thread_private_message(self):
# @pytest.mark.articleThreads
# def test_article_thread_reply_edit(self):
#
# @pytest.mark.articleThreads
# def test_article_thread_reply_deletion(self):
#
# @pytest.mark.articleThreads
# def test_quote_functionality(self):
#
# @pytest.mark.articleThreads
# def test_link_to_this_post_functionality(self):
#
# @pytest.mark.articleThreads
# def test_report_abuse_functionality(self):
# To be used in specific tests
def __posting_a_new_test_article_manually(self, approve_it: bool,
post_it: bool) -> str:

Просмотреть файл

@ -225,6 +225,9 @@ class TestKBArticleCreationAndAccess(TestUtilities, KBArticleRevision):
article_details['article_content_html']
)
self.logger.info("Deleting user session")
self.delete_cookies()
self.logger.info("Signing in with an admin account and deleting the article")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
@ -274,6 +277,10 @@ class TestKBArticleCreationAndAccess(TestUtilities, KBArticleRevision):
self.logger.info("Navigating to the article page")
self.navigate_to_link(article_url)
expect(
self.page
).to_have_url(article_url)
self.logger.info("Deleting session cookies")
self.delete_cookies()
@ -299,6 +306,10 @@ class TestKBArticleCreationAndAccess(TestUtilities, KBArticleRevision):
self.logger.info("Navigating to the article page")
self.navigate_to_link(article_url)
self.wait_for_url_to_be(
article_url
)
self.logger.info("Deleting user session")
self.delete_cookies()
@ -400,9 +411,13 @@ class TestKBArticleCreationAndAccess(TestUtilities, KBArticleRevision):
404
)
self.logger.info("Navigating back to the article page and signing in with an admin accout")
self.logger.info("Navigating back to the article page and signing in with admin")
self.navigate_back()
expect(
self.page
).to_have_url(article_url)
self.logger.info("Deleting user session")
self.delete_cookies()
@ -446,6 +461,10 @@ class TestKBArticleCreationAndAccess(TestUtilities, KBArticleRevision):
self.logger.info("Navigating back")
self.navigate_back()
expect(
self.page
).to_have_url(article_url)
self.logger.info("Deleting user session")
self.delete_cookies()
@ -468,6 +487,10 @@ class TestKBArticleCreationAndAccess(TestUtilities, KBArticleRevision):
self.logger.info("Navigating back to the article page")
self.navigate_back()
expect(
self.page
).to_have_url(article_url)
self.logger.info("Signing in with an admin account and deleting the article")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]