- Switching playwright reporting from HTML to Allure.

- Using allure.step() to define steps in allure report.
- Modifying the soft assertions to play nicely with allure reporting by interleaving check and step.
- Adding allure to poetry.
- Modifying the playwright.yml to exclude the HTML reporter & use Allure reporting instead.
- Attaching screencasts to Allure report on test failure.
This commit is contained in:
Emil Ghitta 2024-03-09 01:20:37 +02:00
Родитель b53aed0aab
Коммит 0e8a96866f
44 изменённых файлов: 7408 добавлений и 9808 удалений

57
.github/workflows/playwright.yml поставляемый
Просмотреть файл

@ -51,132 +51,135 @@ jobs:
id: create-sessions
working-directory: playwright_tests
run: |
poetry run pytest -m loginSessions --browser ${{ env.BROWSER }} --reruns 1 --html=reports/creating_user_sessions.html --capture=tee-sys
poetry run pytest -m loginSessions --browser ${{ env.BROWSER }} --reruns 1
- name: Run Homepage tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m homePageTests --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_homepage_tests_report.html --capture=tee-sys
poetry run pytest -m homePageTests --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run Top-Navbar tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m topNavbarTests --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_top_navbar_tests_report.html --capture=tee-sys
poetry run pytest -m topNavbarTests --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run Footer tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m footerSectionTests --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_footer_tests_report.html --capture=tee-sys
poetry run pytest -m footerSectionTests --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run Contribute Pages tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m contributePagesTests --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_contribute_page_tests_report.html --capture=tee-sys
poetry run pytest -m contributePagesTests --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run Messaging System Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m messagingSystem --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_messaging_system_tests_report.html --capture=tee-sys
poetry run pytest -m messagingSystem --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run User Contribution Page Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m userContributionTests --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_user_contribution_tests.html --capture=tee-sys
poetry run pytest -m userContributionTests --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run User Page Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m userProfile --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_user_page_tests.html --capture=tee-sys
poetry run pytest -m userProfile --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run User Settings Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m userSettings --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_user_settings_page_tests.html --capture=tee-sys
poetry run pytest -m userSettings --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run User Profile Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m editUserProfileTests --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_user_profile_page_tests.html --capture=tee-sys
poetry run pytest -m editUserProfileTests --browser ${{ env.BROWSER }} --reruns 1
- name: Run User Questions Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m userQuestions --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_user_questions_page_tests.html --capture=tee-sys
poetry run pytest -m userQuestions --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run Contact Support Page Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m contactSupportPage --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_contact_support_page_tests.html --capture=tee-sys
poetry run pytest -m contactSupportPage --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run Product Solutions Page Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m productSolutionsPage --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_product_solutions_page_tests.html --capture=tee-sys
poetry run pytest -m productSolutionsPage --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run Product Topics Page Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m productTopicsPage --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_product_topics_page_tests.html --capture=tee-sys
poetry run pytest -m productTopicsPage --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run AAQ Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m aaqPage --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_aaq_tests.html --capture=tee-sys
poetry run pytest -m aaqPage --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run AAQ Questions Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m postedQuestions --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_aaq_questions_tests.html --capture=tee-sys
poetry run pytest -m postedQuestions --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name : Run KB Products Page Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m kbProductsPage --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_kb_products_page.html --capture=tee-sys
poetry run pytest -m kbProductsPage --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run KB Article Creation And Access Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m kbArticleCreationAndAccess --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_kb_article_creation_and_access.html --capture=tee-sys
poetry run pytest -m kbArticleCreationAndAccess --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run before kb thread tests setup (${{ env.BROWSER }})
id: kb-threads-setup
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m beforeThreadTests --numprocesses 1 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_before_thread_tests_setup.html --capture=tee-sys
poetry run pytest -m beforeThreadTests --numprocesses 1 --browser ${{ env.BROWSER }} --reruns 1
- name: Run KB article threads Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success' && steps.kb-threads-setup.outcome == 'success'
run: |
poetry run pytest -m articleThreads --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_kb_article_threads.html --capture=tee-sys
poetry run pytest -m articleThreads --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run KB article threads tear down (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success' && steps.kb-threads-setup.outcome == 'success'
run: |
poetry run pytest -m afterThreadTests --numprocesses 1 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_kb_article_threads_tear_down.html --capture=tee-sys
poetry run pytest -m afterThreadTests --numprocesses 1 --browser ${{ env.BROWSER }} --reruns 1
- name: Run KB article show history Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m kbArticleShowHistory --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_kb_article_show_history.html --capture=tee-sys
poetry run pytest -m kbArticleShowHistory --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run KB article revisions dashboard Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m recentRevisionsDashboard --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_kb_article_recent_revisions.html --capture=tee-sys
poetry run pytest -m recentRevisionsDashboard --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run KB Dashboard Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m kbDashboard --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_kb_dashboard.html --capture=tee-sys
- name: Combine Reports
poetry run pytest -m kbDashboard --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Generating Allure Report
working-directory: playwright_tests
if: success() || failure()
run: |
cat reports/*.html > reports/combined_report_${{ env.BROWSER }}.html
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH"
brew install allure
allure generate --single-file reports/allure_reports
- name: Upload the combined test report as artifact
if: success() || failure()
uses: actions/upload-artifact@v2
with:
name: Playwright test report
path: |
playwright_tests/reports/
playwright_tests/allure-report

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

@ -13,13 +13,13 @@ class AAQFlow(AAQFormPage, ProductSolutionsPage, TopNavbar, TestUtilities, Quest
# Submitting an aaq question for a product flow.
# Mozilla VPN has an extra optional dropdown menu for choosing an operating system.
def submit_an_aaq_question_for_a_product(self,
subject: str,
topic_name: str,
body: str,
os="",
attach_image=False):
question_subject = self.add__valid_data_to_all_input_fields_without_submitting(
def submit_an_aaq_question(self,
subject: str,
topic_name: str,
body: str,
os="",
attach_image=False):
question_subject = self.add__valid_data_to_all_aaq_fields_without_submitting(
subject,
topic_name,
body,
@ -38,12 +38,12 @@ class AAQFlow(AAQFormPage, ProductSolutionsPage, TopNavbar, TestUtilities, Quest
# Populating the aaq form fields with given values without submitting the form.
# Mozilla VPN has an extra optional dropdown menu for choosing an operating system.
def add__valid_data_to_all_input_fields_without_submitting(self,
subject: str,
topic_value: str,
body_text: str,
os='',
attach_image=False):
def add__valid_data_to_all_aaq_fields_without_submitting(self,
subject: str,
topic_value: str,
body_text: str,
os='',
attach_image=False):
aaq_subject = subject + super().generate_random_number(min_value=0, max_value=5000)
# Adding text to subject field.
super()._add_text_to_aaq_form_subject_field(aaq_subject)

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

@ -331,7 +331,7 @@ class QuestionPage(BasePage):
def _click_on_more_system_details_option(self):
super()._click(self.__more_system_details_option)
def _click_on_the_additional_system_panel_close_button(self):
def _click_on_the_additional_system_panel_close(self):
super()._click(self.__close_additional_system_details_button)
def _get_reply_section_locator(self, answer_id: str) -> Locator:

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

@ -58,7 +58,7 @@ class ContributePage(BasePage):
def _get_way_to_contribute_header_text(self) -> str:
return super()._get_text_of_element(self.__way_to_contribute_header)
def _get_way_to_contribute_card_titles_text(self) -> list[str]:
def _get_way_to_contribute_cards(self) -> list[str]:
return super()._get_text_of_elements(self.__way_to_contribute_card_titles)
# About us

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

@ -56,10 +56,10 @@ class WaysToContributePages(BasePage):
def _get_how_to_contribute_header_text(self) -> str:
return super()._get_text_of_element(self.__how_to_contribute_header)
def _get_how_to_contribute_link_options_text(self) -> list[str]:
def _get_how_to_contribute_link_options(self) -> list[str]:
return super()._get_text_of_elements(self.__all_how_to_contribute_option_links)
def _get_how_to_contribute_option_four_text(self) -> str:
def _get_how_to_contribute_option_four(self) -> str:
return super()._get_text_of_element(self.__start_answering_how_to_contribute_option_text)
def _get_first_fact_text(self) -> str:
@ -72,7 +72,7 @@ class WaysToContributePages(BasePage):
def _get_other_ways_to_contribute_header(self) -> str:
return super()._get_text_of_element(self.__other_ways_to_contribute_header)
def _get_other_ways_to_contribute_card_title(self) -> list[str]:
def _get_other_ways_to_contribute_cards(self) -> list[str]:
return super()._get_text_of_elements(self.__other_ways_to_contribute_card_titles)
def _get_other_ways_to_contribute_card_list(self) -> list[ElementHandle]:

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

@ -69,7 +69,7 @@ class RecentRevisions(BasePage):
def _add_end_date(self, end_date: str):
super()._type(self.__end_date_input_field, end_date, 0)
def _get_recent_revision_based_on_article_locator(self, title: str) -> Locator:
def _get_recent_revision_based_on_article(self, title: str) -> Locator:
xpath = f"//div[@id='revisions-fragment']//div[@class='title']//a[text()='{title}']"
return super()._get_element_locator(xpath)

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

@ -146,7 +146,7 @@ class KBArticleDiscussionPage(BasePage):
def _get_thread_post_a_reply_textarea_field(self) -> Locator:
return super()._get_element_locator(self.__thread_post_a_reply_textarea_field)
def _fill_the_thread_post_a_reply_textarea_field(self, text: str):
def _fill_the_thread_post_a_reply_textarea(self, text: str):
super()._fill(self.__thread_post_a_reply_textarea_field, text)
def _get_thread_page_counter_replies_text(self) -> str:

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

@ -7,6 +7,7 @@ class KBArticlePage(BasePage):
__kb_article_content = "//section[@id='doc-content']"
__kb_article_content_approved_content = "//section[@id='doc-content']/p"
__kb_article_contributors = "//div[@class='document--contributors-list text-body-xs']/a"
__learn_more_kb_article_option = "//a[text()='Learn More']"
# Editing Tools options
__editing_tools_article_option = "//a[text()='Article']"
@ -53,3 +54,6 @@ class KBArticlePage(BasePage):
def _click_on_editing_tools_discussion_option(self):
super()._click(self.__editing_tools_discussion_option)
def _click_on_volunteer_learn_more_option(self):
super()._click(self.__learn_more_kb_article_option)

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

@ -18,10 +18,10 @@ class MessagingSystemUserNavbar(BasePage):
def _click_on_messaging_system_navbar_inbox(self):
super()._click(self.__messaging_system_user_navbar_inbox_option)
def _click_on_messaging_system_navbar_sent_messages(self):
def _click_on_messaging_system_nav_sent_messages(self):
super()._click(self.__messaging_system_user_navbar_sent_messages_option)
def _click_on_messaging_system_navbar_new_message(self):
def _click_on_messaging_system_nav_new_message(self):
super()._click(self.__messaging_system_user_navbar_new_message_option)
# Need to add logic for fetching the background color of selected navbar elements

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

@ -85,7 +85,7 @@ class MyProfileEditContributionAreasPage(BasePage):
return super()._is_checkbox_checked(
self.__edit_contribution_areas_mobile_support_contributors)
def _are_all_cont_pref_checkboxes_checked(self) -> bool:
def _are_all_cont_pref_checked(self) -> bool:
is_checked = [
self._is_kb_contributors_checkbox_checked(),
self._is_l10n_contributors_checkbox_checked(),

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

@ -196,6 +196,6 @@ class MyProfilePage(BasePage):
def _is_deactivate_this_user_button_displayed(self) -> Locator:
return super()._get_element_locator(self.__deactivate_this_user_button)
def _deactivate_this_user_and_mark_content_as_spam_elem(self) -> Locator:
def _deactivate_user_and_mark_content_as_spam_button(self) -> Locator:
return super()._get_element_locator(
self.__deactivate_this_user_and_mark_all_content_as_spam)

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

@ -25,3 +25,4 @@ markers =
kbArticleShowHistory: Tests belonging to the kb article show history section.
recentRevisionsDashboard: Tests belonging to the recent revisions dashboard.
kbDashboard: Tests belonging to the KB dashboard.
addopts = --alluredir=./reports/allure_reports

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

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

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

@ -1,5 +1,6 @@
import allure
import pytest
import pytest_check as check
from pytest_check import check
from playwright.sync_api import expect
from playwright_tests.core.testutilities import TestUtilities
@ -18,408 +19,374 @@ class TestAAQPage(TestUtilities):
# C2188694, C2188695
@pytest.mark.aaqPage
def test_community_card_and_helpful_tip_are_displayed_for_freemium_product(self):
self.logger.info("Signing in with a normal user account")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts['TEST_ACCOUNT_12']
))
with allure.step("Signing in with a non-admin user account"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts['TEST_ACCOUNT_12']
))
self.logger.info("Navigating to each freemium aaq form")
for freemium_product in super().general_test_data["freemium_products"]:
self.navigate_to_link(
super().aaq_question_test_data["products_aaq_url"][freemium_product]
)
with allure.step("Navigating to each freemium aaq form"):
for freemium_product in super().general_test_data["freemium_products"]:
self.navigate_to_link(
super().aaq_question_test_data["products_aaq_url"][freemium_product]
)
self.logger.info("Verifying that the helpful tip card is displayed")
expect(
self.sumo_pages.aaq_form_page._get_helpful_tip_locator()
).to_be_visible()
with allure.step(f"Verifying that the helpful tip card is displayed for the "
f"{freemium_product} product"):
expect(
self.sumo_pages.aaq_form_page._get_helpful_tip_locator()
).to_be_visible()
self.logger.info("Clicking on the 'Learn More' button from the community help card")
self.sumo_pages.aaq_form_page._click_on_learn_more_button()
self.logger.info("Verifying that we are on the contribute_messages page")
expect(
self.page
).to_have_url(ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL)
with allure.step("Clicking on the 'Learn More' button from the community help "
"card and verifying that we are on the contribute messages page"):
self.sumo_pages.aaq_form_page._click_on_learn_more_button()
expect(
self.page
).to_have_url(ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL)
# C2188694, C2188695
@pytest.mark.aaqPage
def test_community_card_and_helpful_tip_not_displayed_for_premium_products(self):
self.logger.info("Signing in with a normal user account")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts['TEST_ACCOUNT_12']
))
with allure.step("Signing in with a non-admin account"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts['TEST_ACCOUNT_12']
))
self.logger.info("Navigating to each premium aaq form")
for premium_product in super().general_test_data["premium_products"]:
self.navigate_to_link(
super().aaq_question_test_data["products_aaq_url"][premium_product]
)
with allure.step("Navigating to each premium aaq form"):
for premium_product in super().general_test_data["premium_products"]:
self.navigate_to_link(
super().aaq_question_test_data["products_aaq_url"][premium_product]
)
self.logger.info("Verifying that the helpful tip option is not displayed")
expect(
self.sumo_pages.aaq_form_page._get_helpful_tip_locator()
).to_be_hidden()
with allure.step(f"Verifying that the helpful tip options is displayed for the "
f"{premium_product}"):
expect(
self.sumo_pages.aaq_form_page._get_helpful_tip_locator()
).to_be_hidden()
self.logger.info("Verifying that the 'Learn More' button from the community help "
"banner is not displayed")
expect(
self.sumo_pages.aaq_form_page._get_learn_more_button_locator()
).to_be_hidden()
with allure.step("Verifying that the 'Learn More' button from the community help "
"banner is not displayed"):
expect(
self.sumo_pages.aaq_form_page._get_learn_more_button_locator()
).to_be_hidden()
# C1511570
@pytest.mark.aaqPage
@pytest.mark.parametrize("username", ['', 'TEST_ACCOUNT_12', 'TEST_ACCOUNT_MODERATOR'])
def test_scam_banner_premium_products_not_displayed(self, username):
if username != '':
self.logger.info("Signing in with a user account")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts[username]
))
self.logger.info("Navigating to each premium product solutions page")
for premium_product in super().general_test_data["premium_products"]:
self.navigate_to_link(
super().general_test_data["product_solutions"][premium_product]
)
with allure.step(f"Singing in with {username} user"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts[username]
))
self.logger.info("Verifying that the scam banner is not displayed")
expect(
self.sumo_pages.product_solutions_page._get_scam_banner_locator()
).to_be_hidden()
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"][premium_product]
with allure.step("Navigating to each premium product solutions page"):
for premium_product in super().general_test_data["premium_products"]:
self.navigate_to_link(
super().general_test_data["product_solutions"][premium_product]
)
self.logger.info("Verifying that the scam banner is not displayed")
expect(
self.sumo_pages.product_solutions_page._get_scam_banner_locator()
).to_be_hidden()
with allure.step(f"Verifying that the sam banner is not displayed for "
f"{premium_product} card"):
expect(
self.sumo_pages.product_solutions_page._get_scam_banner_locator()
).to_be_hidden()
if username != '':
with allure.step("Clicking on the Ask Now button and verifying that the scam "
"banner is not displayed"):
self.sumo_pages.product_solutions_page._click_ask_now_button()
self.wait_for_url_to_be(
super().aaq_question_test_data["products_aaq_url"][premium_product]
)
expect(
self.sumo_pages.product_solutions_page._get_scam_banner_locator()
).to_be_hidden()
# C2190040
@pytest.mark.aaqPage
@pytest.mark.parametrize("username", ['', 'TEST_ACCOUNT_12', 'TEST_ACCOUNT_MODERATOR'])
def test_scam_banner_for_freemium_products_is_displayed(self, username):
if username != '':
self.logger.info("Signing in with a user account")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts[username]
))
with allure.step(f"Signing in with {username} user"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts[username]
))
self.logger.info("Navigating to each freemium product solutions page")
for freemium_product in super().general_test_data["freemium_products"]:
self.navigate_to_link(
super().general_test_data["product_solutions"][freemium_product]
)
self.logger.info("Verifying that the 'Learn More' button contains the correct link")
check.equal(
self.sumo_pages.product_solutions_page._get_scam_alert_banner_link(),
QuestionPageMessages.AVOID_SCAM_SUPPORT_LEARN_MORE_LINK
)
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]
with allure.step("Navigating to each freemium product solutions page"):
for freemium_product in super().general_test_data["freemium_products"]:
self.navigate_to_link(
super().general_test_data["product_solutions"][freemium_product]
)
self.logger.info(
"Verifying that the 'Learn More' button contains the correct link")
check.equal(
self.sumo_pages.product_solutions_page._get_scam_alert_banner_link(),
QuestionPageMessages.AVOID_SCAM_SUPPORT_LEARN_MORE_LINK
)
with check, allure.step("Verifying that the 'Learn More' button contains the "
"correct link"):
assert self.sumo_pages.product_solutions_page._get_scam_alert_banner_link(
) == QuestionPageMessages.AVOID_SCAM_SUPPORT_LEARN_MORE_LINK
if username != '':
with check, allure.step("Clicking on the Ask Now button and verifying that "
"the 'Learn More' button contains the correct link"):
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]
)
assert self.sumo_pages.product_solutions_page._get_scam_alert_banner_link(
) == QuestionPageMessages.AVOID_SCAM_SUPPORT_LEARN_MORE_LINK
# C890537
@pytest.mark.aaqPage
def test_corresponding_aaq_product_name_and_image_are_displayed(self):
self.logger.info("Signing in with a normal user account")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts['TEST_ACCOUNT_12']
))
with allure.step("Signing in with a non-admin account"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts['TEST_ACCOUNT_12']
))
self.logger.info("Navigating to each product aaq form")
for product in super().aaq_question_test_data["products_aaq_url"]:
self.navigate_to_link(super().aaq_question_test_data["products_aaq_url"][product])
with allure.step("Navigating to each product aaq form"):
for product in super().aaq_question_test_data["products_aaq_url"]:
self.navigate_to_link(super().aaq_question_test_data["products_aaq_url"][product])
# This needs to change when we add the Mozilla Account icon/product.
if product != "Mozilla Account":
self.logger.info("Verifying that the product image is displayed")
expect(
self.sumo_pages.aaq_form_page._get_product_image_locator()
).to_be_visible()
else:
self.logger.info("Verifying that the product image is hidden for Mozilla Account "
"product")
expect(
self.sumo_pages.aaq_form_page._get_product_image_locator()
).to_be_visible()
# This needs to change when we add the Mozilla Account icon/product.
if product != "Mozilla Account":
with allure.step("Verifying that the product image is displayed"):
expect(
self.sumo_pages.aaq_form_page._get_product_image_locator()
).to_be_visible()
else:
with allure.step("Verifying that the product image is hidden for Mozilla "
"Account product"):
expect(
self.sumo_pages.aaq_form_page._get_product_image_locator()
).to_be_visible()
self.logger.info("Verifying that the correct product header is displayed")
check.equal(
self.sumo_pages.aaq_form_page._get_aaq_form_page_heading(),
product,
f"Incorrect form header displayed. "
f"Expected: {product} "
f"Received: {self.sumo_pages.aaq_form_page._get_aaq_form_page_heading()}"
)
with check, allure.step("Verifying that the correct product header is displayed"):
assert self.sumo_pages.aaq_form_page._get_aaq_form_page_heading() == product
# C890535, C890536
@pytest.mark.aaqPage
def test_progress_milestone_redirect(self):
self.logger.info("Signing in with a normal user account")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts['TEST_ACCOUNT_12']
))
with allure.step("Signing in with a non-admin user account"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts['TEST_ACCOUNT_12']
))
self.logger.info("Navigating to each product aaq form")
for product in super().aaq_question_test_data["products_aaq_url"]:
self.navigate_to_link(super().aaq_question_test_data["products_aaq_url"][product])
with allure.step("Navigating to each product AAQ form"):
for product in super().aaq_question_test_data["products_aaq_url"]:
self.navigate_to_link(super().aaq_question_test_data["products_aaq_url"][product])
self.logger.info("Verifying that the correct in progress milestone is displayed")
check.equal(
self.sumo_pages.aaq_form_page._get_in_progress_item_label(),
AAQFormMessages.IN_PROGRESS_MILESTONE,
f"Incorrect current milestone. "
f"Expected: {AAQFormMessages.IN_PROGRESS_MILESTONE} "
f"Received: {self.sumo_pages.aaq_form_page._get_in_progress_item_label()}"
)
with check, allure.step("Verifying that the correct in progress milestone is "
"displayed"):
assert self.sumo_pages.aaq_form_page._get_in_progress_item_label(
) == AAQFormMessages.IN_PROGRESS_MILESTONE
self.logger.info(
f"Clicking on the {AAQFormMessages.COMPLETED_MILESTONE_TWO} milestone'"
)
self.sumo_pages.aaq_form_page._click_on_a_particular_completed_milestone(
AAQFormMessages.COMPLETED_MILESTONE_TWO)
with allure.step(f"Clicking on the {AAQFormMessages.COMPLETED_MILESTONE_TWO} "
f"milestone and verifying that we are on the correct product "
f"solutions page"):
self.sumo_pages.aaq_form_page._click_on_a_particular_completed_milestone(
AAQFormMessages.COMPLETED_MILESTONE_TWO)
expect(
self.page
).to_have_url(super().general_test_data["product_solutions"][product])
self.logger.info("Verifying that the we are on the correct product solutions page")
expect(
self.page
).to_have_url(super().general_test_data["product_solutions"][product])
self.logger.info(
f"Navigating back to the aaq form and "
f"clicking on the {AAQFormMessages.COMPLETED_MILESTONE_ONE} milestone")
self.navigate_to_link(super().aaq_question_test_data["products_aaq_url"][product])
self.sumo_pages.aaq_form_page._click_on_a_particular_completed_milestone(
AAQFormMessages.COMPLETED_MILESTONE_ONE)
self.logger.info("Verifying that we are redirected to the correct page")
expect(
self.page
).to_have_url(ContactSupportMessages.PAGE_URL_CHANGE_PRODUCT_REDIRECT)
with allure.step(f"Navigating back to the aaq form and clicking on the "
f"{AAQFormMessages.COMPLETED_MILESTONE_ONE} milestone"):
self.navigate_to_link(super().aaq_question_test_data["products_aaq_url"]
[product])
self.sumo_pages.aaq_form_page._click_on_a_particular_completed_milestone(
AAQFormMessages.COMPLETED_MILESTONE_ONE)
expect(
self.page
).to_have_url(ContactSupportMessages.PAGE_URL_CHANGE_PRODUCT_REDIRECT)
# C890612
@pytest.mark.aaqPage
def test_aaq_form_cancel_button_freemium_products(self):
self.logger.info("Signing in with a admin user account")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MESSAGE_1"]
))
with allure.step("Signing in with a non-admin user account"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MESSAGE_1"]
))
self.logger.info("Accessing the 'My profile' page via the top-navbar menu")
self.sumo_pages.top_navbar._click_on_view_profile_option()
with allure.step("Accessing the 'My profile' page via the top-navbar menu and extracting "
"the original number of posted questions"):
self.sumo_pages.top_navbar._click_on_view_profile_option()
original_number_of_questions = self.number_extraction_from_string(
self.sumo_pages.my_profile_page._get_my_profile_questions_text()
)
self.logger.info("Extracting original number of posted questions")
original_number_of_questions = self.number_extraction_from_string(
self.sumo_pages.my_profile_page._get_my_profile_questions_text()
)
with allure.step("Navigating to each product AAQ form"):
for product in super().general_test_data["freemium_products"]:
self.navigate_to_link(super().aaq_question_test_data["products_aaq_url"][product])
self.logger.info("Navigating to each product aaq form")
for product in super().general_test_data["freemium_products"]:
self.navigate_to_link(super().aaq_question_test_data["products_aaq_url"][product])
with allure.step("Adding data inside the AAQ form fields and clicking on the "
"cancel button"):
self.sumo_pages.aaq_flow.add__valid_data_to_all_aaq_fields_without_submitting(
subject=super().aaq_question_test_data["valid_firefox_question"]
["subject"],
topic_value=self.sumo_pages.aaq_form_page._get_aaq_form_topic_options()[0],
body_text=super().aaq_question_test_data["valid_firefox_question"]
["question_body"]
)
self.sumo_pages.aaq_form_page._click_aaq_form_cancel_button()
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(
with allure.step("Verifying that we are redirected back to the correct product "
"solutions page"):
expect(
self.page
).to_have_url(super().general_test_data["product_solutions"][product])
with check, allure.step("Navigating back to the My Profile page and verifying "
"that the correct number of posted questions is "
"displayed"):
self.sumo_pages.top_navbar._click_on_view_profile_option()
new_number = self.number_extraction_from_string(
self.sumo_pages.my_profile_page._get_my_profile_questions_text()
)
assert new_number == original_number_of_questions
# C890614, C890613, C890538
@pytest.mark.aaqPage
def test_post_aaq_questions_for_all_freemium_products_topics(self):
with allure.step("Signing in with an admin account"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Navigating to each product AAQ form"):
for product in super().general_test_data["freemium_products"]:
self.navigate_to_link(super().aaq_question_test_data["products_aaq_url"][product])
for topic in self.sumo_pages.aaq_form_page._get_aaq_form_topic_options():
with allure.step(f"Submitting question for {product} product"):
question_info = self.sumo_pages.aaq_flow.submit_an_aaq_question(
subject=super().aaq_question_test_data["valid_firefox_question"]
["subject"],
topic_name=topic,
body=super().aaq_question_test_data["valid_firefox_question"]
["question_body"],
attach_image=False
)
with allure.step("Verifying that the correct implicit tags are added to the "
"question"):
slugs = [super().aaq_question_test_data['aaq_topic_tags'][product][topic]]
if (super().aaq_question_test_data['aaq_topic_tags'][product]
['default_slug']
!= "none"):
slugs.append(
super().aaq_question_test_data['aaq_topic_tags'][product]
['default_slug']
)
assert (
all(map(
lambda x: x in self.sumo_pages.question_page.
_get_question_tag_options(),
slugs))
)
with allure.step("Clicking on the 'My Questions' banner option and Verifying "
"that the posted question is displayed inside the 'My "
"Questions page"):
self.sumo_pages.question_page._click_on_my_questions_banner_option()
expect(
self.sumo_pages.my_questions_page._get_listed_question(
question_info['aaq_subject']
)
).to_be_visible()
with allure.step("Clicking on the question and deleting it"):
self.sumo_pages.my_questions_page._click_on_a_question_by_name(
question_info['aaq_subject']
)
self.sumo_pages.aaq_flow.deleting_question_flow()
with allure.step("Verifying that the question is no longer displayed inside "
"My Questions page"):
self.sumo_pages.top_navbar._click_on_my_questions_profile_option()
expect(
self.sumo_pages.my_questions_page._get_listed_question(
question_info['aaq_subject']
)
).to_be_hidden()
with allure.step(f"Navigating back to the {product} product aa form"):
self.navigate_to_link(super().aaq_question_test_data["products_aaq_url"]
[product])
@pytest.mark.aaqPage
def test_share_firefox_data_functionality(self):
with allure.step("Signing in with an admin user account"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Navigating to the Firefox AAQ form page and clicking on the 'Share "
"Data' option"):
self.navigate_to_link(super().aaq_question_test_data["products_aaq_url"]["Firefox"])
self.sumo_pages.aaq_form_page._click_on_share_data_button()
with check, allure.step("Verifying that the 'try these manual steps' contains the "
"correct link"):
assert self.sumo_pages.aaq_form_page._get_try_these_manual_steps_link(
) == QuestionPageMessages.TRY_THESE_MANUAL_STEPS_LINK
with allure.step("Adding data inside AAQ form fields without submitting the form"):
self.sumo_pages.aaq_flow.add__valid_data_to_all_aaq_fields_without_submitting(
subject=super().aaq_question_test_data["valid_firefox_question"]["subject"],
topic_value=self.sumo_pages.aaq_form_page._get_aaq_form_topic_options()[0],
body_text=super().aaq_question_test_data["valid_firefox_question"]["question_body"]
)
self.logger.info("Clicking on the Cancel button")
self.sumo_pages.aaq_form_page._click_aaq_form_cancel_button()
self.logger.info("Verifying that we are redirected back to the correct product "
"solutions page")
expect(
self.page
).to_have_url(super().general_test_data["product_solutions"][product])
self.logger.info("Navigating back to the My Profile page")
self.sumo_pages.top_navbar._click_on_view_profile_option()
new_number = self.number_extraction_from_string(
self.sumo_pages.my_profile_page._get_my_profile_questions_text()
)
self.logger.info("Verifying that the correct number of posted questions is displayed "
"at profile level")
check.equal(
new_number,
original_number_of_questions,
f"Incorrect number of questions displayed. "
f"Expected: {original_number_of_questions} "
f"Received: {new_number}"
)
# C890614, C890613, C890538
@pytest.mark.aaqPage
def test_post_aaq_questions_for_all_freemium_products_topics(self):
self.logger.info("Signing in with a admin user account")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
self.logger.info("Navigating to each product aaq form")
for product in super().general_test_data["freemium_products"]:
self.navigate_to_link(super().aaq_question_test_data["products_aaq_url"][product])
for topic in self.sumo_pages.aaq_form_page._get_aaq_form_topic_options():
self.logger.info(f"Submitting question for {product} product")
question_info = self.sumo_pages.aaq_flow.submit_an_aaq_question_for_a_product(
subject=super().aaq_question_test_data["valid_firefox_question"]["subject"],
topic_name=topic,
body=super().aaq_question_test_data["valid_firefox_question"]["question_body"],
attach_image=False
)
self.logger.info("Verifying that the correct implicit tags are added to the "
"question")
slugs = [super().aaq_question_test_data['aaq_topic_tags'][product][topic]]
if (super().aaq_question_test_data['aaq_topic_tags'][product]['default_slug']
!= "none"):
slugs.append(
super().aaq_question_test_data['aaq_topic_tags'][product]['default_slug']
)
assert (
all(map(
lambda x: x in self.sumo_pages.question_page._get_question_tag_options(),
slugs))
)
self.logger.info("Clicking on the 'My Questions' banner option")
self.sumo_pages.question_page._click_on_my_questions_banner_option()
self.logger.info(
"Verifying that the posted question is displayed inside the 'My Questions "
"page'")
expect(
self.sumo_pages.my_questions_page._get_listed_question(
question_info['aaq_subject']
)
).to_be_visible()
self.logger.info("Clicking on the question and deleting it")
self.sumo_pages.my_questions_page._click_on_a_question_by_name(
question_info['aaq_subject']
)
self.sumo_pages.aaq_flow.deleting_question_flow()
self.logger.info(
"Verifying that the question is no longer displayed inside My Questions page")
self.sumo_pages.top_navbar._click_on_my_questions_profile_option()
expect(
self.sumo_pages.my_questions_page._get_listed_question(
question_info['aaq_subject']
)
).to_be_hidden()
self.logger.info(f"Navigating back to the {product} product aa form")
self.navigate_to_link(super().aaq_question_test_data["products_aaq_url"][product])
@pytest.mark.aaqPage
def test_share_firefox_data_functionality(self):
self.logger.info("Signing in with a admin user account")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
self.logger.info("Navigating to the Firefox AAQ form page")
self.navigate_to_link(super().aaq_question_test_data["products_aaq_url"]["Firefox"])
self.logger.info("Clicking on the 'Share Data' option")
self.sumo_pages.aaq_form_page._click_on_share_data_button()
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("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"],
topic_value=self.sumo_pages.aaq_form_page._get_aaq_form_topic_options()[0],
body_text=super().aaq_question_test_data["valid_firefox_question"]["question_body"]
)
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"]
)
self.logger.info("Submitting the aaq question")
self.sumo_pages.aaq_form_page._click_aaq_form_submit_button()
self.logger.info("Verifying that the troubleshooting information is displayed")
self.sumo_pages.question_page._click_on_question_details_button()
self.sumo_pages.question_page._click_on_more_system_details_option()
expect(
self.sumo_pages.question_page._get_more_information_with_text_locator(
with allure.step("Adding text inside the troubleshooting information field and "
"submitting the AAQ question"):
self.sumo_pages.aaq_form_page._add_text_to_troubleshooting_information_textarea(
super().aaq_question_test_data["troubleshooting_information"]
)
).to_be_visible()
self.sumo_pages.aaq_form_page._click_aaq_form_submit_button()
self.logger.info("Closing additional details panel")
self.sumo_pages.question_page._click_on_the_additional_system_panel_close_button()
with allure.step("Verifying that the troubleshooting information is displayed"):
self.sumo_pages.question_page._click_on_question_details_button()
self.sumo_pages.question_page._click_on_more_system_details_option()
expect(
self.sumo_pages.question_page._get_more_information_with_text_locator(
super().aaq_question_test_data["troubleshooting_information"]
)
).to_be_visible()
self.logger.info("Deleting the posted question")
self.sumo_pages.aaq_flow.deleting_question_flow()
with allure.step("Closing the additional details panel and deleting the posted question"):
self.sumo_pages.question_page._click_on_the_additional_system_panel_close()
self.sumo_pages.aaq_flow.deleting_question_flow()
@pytest.mark.aaqPage
def test_additional_system_details_user_agent_information(self):
self.logger.info("Signing in with a admin user account")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Signing in with an admin user account"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
self.logger.info("Navigating to each product aaq form")
for product in super().general_test_data["freemium_products"]:
self.navigate_to_link(super().aaq_question_test_data["products_aaq_url"][product])
with allure.step("Navigating to each product aaq form"):
for product in super().general_test_data["freemium_products"]:
self.navigate_to_link(super().aaq_question_test_data["products_aaq_url"][product])
self.logger.info(f"Submitting question for {product} product")
self.sumo_pages.aaq_flow.submit_an_aaq_question_for_a_product(
subject=super().aaq_question_test_data["valid_firefox_question"]["subject"],
topic_name=self.sumo_pages.aaq_form_page._get_aaq_form_topic_options()[0],
body=super().aaq_question_test_data["valid_firefox_question"]["question_body"],
attach_image=True
)
with allure.step(f"Submitting a question for the {product} product"):
self.sumo_pages.aaq_flow.submit_an_aaq_question(
subject=super().aaq_question_test_data["valid_firefox_question"]
["subject"],
topic_name=self.sumo_pages.aaq_form_page._get_aaq_form_topic_options()[0],
body=super().aaq_question_test_data["valid_firefox_question"]
["question_body"],
attach_image=True
)
self.logger.info("Verifying that the correct user-agent information is displayed")
self.sumo_pages.question_page._click_on_question_details_button()
self.sumo_pages.question_page._click_on_more_system_details_option()
with check, allure.step("Verifying that the correct user-agent information is "
"displayed"):
self.sumo_pages.question_page._click_on_question_details_button()
self.sumo_pages.question_page._click_on_more_system_details_option()
assert "User Agent: " + self.get_user_agent(
) == self.sumo_pages.question_page._get_user_agent_information()
check.equal(
"User Agent: " + self.get_user_agent(),
self.sumo_pages.question_page._get_user_agent_information(),
f"Incorrect user agent displayed. "
f"Expected: {'User Agent: ' + self.get_user_agent()} "
f"Received: {self.sumo_pages.question_page._get_user_agent_information()}"
)
self.logger.info("Closing additional details panel")
self.sumo_pages.question_page._click_on_the_additional_system_panel_close_button()
self.logger.info("Deleting the posted question")
self.sumo_pages.aaq_flow.deleting_question_flow()
with allure.step("Closing the additional details panel and deleting the posted "
"questions"):
self.sumo_pages.question_page._click_on_the_additional_system_panel_close()
self.sumo_pages.aaq_flow.deleting_question_flow()
@pytest.mark.aaqPage
def test_system_details_information(self):
@ -429,52 +396,47 @@ class TestAAQPage(TestUtilities):
"Firefox " + super().aaq_question_test_data["troubleshoot_product_and_os_versions"][1]
]
self.logger.info("Signing in with a admin user account")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Signing in with an admin user account"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
self.logger.info("Navigating to each product aaq form")
for product in super().general_test_data["freemium_products"]:
self.logger.info(product)
if product == 'Firefox Reality' or product == "Thunderbird":
continue
else:
self.navigate_to_link(super().aaq_question_test_data["products_aaq_url"][product])
with allure.step("Navigating to each product aaq form and and adding data without "
"submitting the form"):
for product in super().general_test_data["freemium_products"]:
self.logger.info(product)
if product == 'Firefox Reality' or product == "Thunderbird":
continue
else:
self.navigate_to_link(super().aaq_question_test_data["products_aaq_url"]
[product])
self.sumo_pages.aaq_flow.add__valid_data_to_all_aaq_fields_without_submitting(
subject=super().aaq_question_test_data["valid_firefox_question"]
["subject"],
topic_value=self.sumo_pages.aaq_form_page._get_aaq_form_topic_options()[0],
body_text=super().aaq_question_test_data["valid_firefox_question"][
"question_body"]
)
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"],
topic_value=self.sumo_pages.aaq_form_page._get_aaq_form_topic_options()[0],
body_text=super().aaq_question_test_data["valid_firefox_question"][
"question_body"]
)
with allure.step("Clicking on the 'Show details' option and adding data to "
"product version and OS fields"):
self.sumo_pages.aaq_form_page._click_on_show_details_option()
self.sumo_pages.aaq_form_page._add_text_to_product_version_field(
super().aaq_question_test_data[
"troubleshoot_product_and_os_versions"][1]
)
self.sumo_pages.aaq_form_page._add_text_to_os_field(
super().aaq_question_test_data[
"troubleshoot_product_and_os_versions"][0]
)
self.logger.info("Clicking on the 'Show details' option")
self.sumo_pages.aaq_form_page._click_on_show_details_option()
with check, allure.step("Submitting the AAQ question and verifying that the "
"correct provided troubleshooting information is "
"displayed"):
self.sumo_pages.aaq_form_page._click_aaq_form_submit_button()
self.sumo_pages.question_page._click_on_question_details_button()
assert self.sumo_pages.question_page._get_system_details_information(
) == troubleshooting_info
self.logger.info("Adding data to product version and OS fields")
self.sumo_pages.aaq_form_page._add_text_to_product_version_field(
super().aaq_question_test_data[
"troubleshoot_product_and_os_versions"][1]
)
self.sumo_pages.aaq_form_page._add_text_to_os_field(
super().aaq_question_test_data[
"troubleshoot_product_and_os_versions"][0]
)
self.logger.info("Submitting the aaq question")
self.sumo_pages.aaq_form_page._click_aaq_form_submit_button()
self.logger.info(
"Verifying that the correct provided troubleshooting information is displayed")
self.sumo_pages.question_page._click_on_question_details_button()
check.equal(
self.sumo_pages.question_page._get_system_details_information(),
troubleshooting_info,
f"Expected: {troubleshooting_info} "
f"Received:{self.sumo_pages.question_page._get_system_details_information()}"
)
self.logger.info("Deleting the posted question")
self.sumo_pages.aaq_flow.deleting_question_flow()
with allure.step("Deleting the posted question"):
self.sumo_pages.aaq_flow.deleting_question_flow()

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -1,5 +1,6 @@
import allure
import pytest
import pytest_check as check
from pytest_check import check
from playwright.sync_api import expect
from playwright_tests.core.testutilities import TestUtilities
@ -15,90 +16,60 @@ class TestContactSupportPage(TestUtilities):
# C890363
@pytest.mark.contactSupportPage
def test_contact_support_page_content(self):
self.logger.info("Accessing the contact support page via the top navbar Get Help > Ask a "
"Question")
self.sumo_pages.top_navbar._click_on_ask_a_question_option()
with allure.step("Accessing the contact support page via the top navbar Get Help > Ask a "
"Question"):
self.sumo_pages.top_navbar._click_on_ask_a_question_option()
self.logger.info("Verifying that the current milestone is the correct one")
check.equal(
self.sumo_pages.contact_support_page._get_text_of_current_milestone(),
ContactSupportMessages.CURRENT_MILESTONE,
f"Incorrect current milestone displayed. "
f"Expected: {ContactSupportMessages.CURRENT_MILESTONE}"
f"Received: {self.sumo_pages.contact_support_page._get_text_of_current_milestone()}"
)
with check, allure.step("Verifying that the current milestone is the correct one"):
assert self.sumo_pages.contact_support_page._get_text_of_current_milestone(
) == ContactSupportMessages.CURRENT_MILESTONE
self.logger.info("Verifying that the correct page header is displayed")
check.equal(
self.sumo_pages.contact_support_page._get_contact_support_main_heading(),
ContactSupportMessages.MAIN_HEADER,
f"Incorrect page header displayed. "
f"Expected: {ContactSupportMessages.MAIN_HEADER} "
f"Received: {self.sumo_pages.contact_support_page._get_contact_support_main_heading()}"
)
with check, allure.step("Verifying that the correct page header is displayed"):
assert self.sumo_pages.contact_support_page._get_contact_support_main_heading(
) == ContactSupportMessages.MAIN_HEADER
self.logger.info("Verifying that the correct page subheading is displayed")
check.equal(
self.sumo_pages.contact_support_page._get_contact_support_subheading_text(),
ContactSupportMessages.SUBHEADING,
f"Incorrect page subheading displayed. "
f"Expected: {ContactSupportMessages.SUBHEADING} "
f"Actual:{self.sumo_pages.contact_support_page._get_contact_support_subheading_text()}"
)
with check, allure.step("Verifying that the correct page subheading is displayed"):
assert self.sumo_pages.contact_support_page._get_contact_support_subheading_text(
) == ContactSupportMessages.SUBHEADING
self.logger.info("Verifying that each product card has the correct subheading")
for card in self.sumo_pages.contact_support_page._get_all_product_card_titles():
check.equal(
ContactSupportMessages.PRODUCT_CARDS_SUBHEADING[card],
self.sumo_pages.contact_support_page._get_product_card_subtitle(card),
f"Incorrect card subheading displayed "
f"Expected: {ContactSupportMessages.PRODUCT_CARDS_SUBHEADING[card]} "
f"Actual: {self.sumo_pages.contact_support_page._get_product_card_subtitle(card)}"
)
with allure.step("Verifying that each product card has the correct subheading"):
for card in self.sumo_pages.contact_support_page._get_all_product_card_titles():
with check, allure.step(f"Verifying {card} card has the correct subheading"):
assert (ContactSupportMessages.
PRODUCT_CARDS_SUBHEADING[card] == self.sumo_pages.
contact_support_page._get_product_card_subtitle(card))
# C890368, C890387, C890388
@pytest.mark.contactSupportPage
def test_contact_support_page_cards_redirect(self):
self.logger.info("Accessing the contact support page via the top navbar Get Help > "
"Browse All products")
self.sumo_pages.top_navbar._click_on_browse_all_products_option()
self.logger.info("Clicking on all product cards")
with allure.step("Accessing the contact support page via the top navbar Get Help > "
"Browse All products"):
self.sumo_pages.top_navbar._click_on_browse_all_products_option()
for card in self.sumo_pages.contact_support_page._get_all_product_card_titles():
self.sumo_pages.contact_support_page._click_on_a_particular_card(card)
with allure.step(f"Clicking on {card}"):
self.sumo_pages.contact_support_page._click_on_a_particular_card(card)
self.logger.info("Verifying that we are on the correct product solutions page")
check.equal(
self.sumo_pages.product_solutions_page._get_product_solutions_heading(),
card + ProductSolutionsMessages.PAGE_HEADER,
f"Incorrect product solutions page displayed: "
f"Expected: {card + ProductSolutionsMessages.PAGE_HEADER} "
f"Actual:{self.sumo_pages.product_solutions_page._get_product_solutions_heading()}"
)
with check, allure.step("Verifying that we are on the correct product solutions page"):
assert self.sumo_pages.product_solutions_page._get_product_solutions_heading(
) == card + ProductSolutionsMessages.PAGE_HEADER
self.logger.info("Verifying that we are on the correct milestone")
check.equal(
self.sumo_pages.product_solutions_page._get_current_milestone_text(),
ProductSolutionsMessages.CURRENT_MILESTONE_TEXT,
f"Incorrect current milestone displayed "
f"Expected: {ProductSolutionsMessages.CURRENT_MILESTONE_TEXT} "
f"Received: {self.sumo_pages.product_solutions_page._get_current_milestone_text()}"
)
with check, allure.step("Verifying that we are on the correct milestone"):
assert self.sumo_pages.product_solutions_page._get_current_milestone_text(
) == ProductSolutionsMessages.CURRENT_MILESTONE_TEXT
self.logger.info("Click on the 'Change Product' milestone")
self.sumo_pages.product_solutions_page._click_on_the_completed_milestone()
with allure.step("Click on the 'Change Product' milestone"):
self.sumo_pages.product_solutions_page._click_on_the_completed_milestone()
@pytest.mark.contactSupportPage
def test_browse_all_product_forums_button_redirect(self):
self.logger.info("Accessing the contact support page via the top navbar Get Help > Ask a "
"Question")
self.sumo_pages.top_navbar._click_on_ask_a_question_option()
with allure.step("Accessing the contact support page via the top navbar Get Help > Ask a "
"Question"):
self.sumo_pages.top_navbar._click_on_ask_a_question_option()
self.sumo_pages.contact_support_page._click_on_browse_all_product_forums_button()
self.logger.info("Verifying that we are redirected to the correct page url")
expect(
self.page
).to_have_url(SupportForumsPageMessages.PAGE_URL)
with allure.step("Clicking on browse all product forums button and verifying that we are "
"redirected to the correct page"):
self.sumo_pages.contact_support_page._click_on_browse_all_product_forums_button()
expect(
self.page
).to_have_url(SupportForumsPageMessages.PAGE_URL)

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

@ -1,5 +1,6 @@
import allure
import pytest
import pytest_check as check
from pytest_check import check
from playwright.sync_api import TimeoutError, expect, Error
from playwright_tests.core.testutilities import TestUtilities
@ -17,109 +18,90 @@ class TestPopularTopicsPage(TestUtilities):
# C890379
@pytest.mark.productTopicsPage
def test_popular_topics_navbar(self):
self.logger.info("Navigating to product topics pages")
for product_topic in super().general_test_data["product_topics"]:
topic_url = super().general_test_data["product_topics"][product_topic]
self.page.wait_for_timeout(400)
self.navigate_to_link(topic_url)
self.wait_for_url_to_be(topic_url)
with allure.step("Navigating to product topics pages"):
for product_topic in super().general_test_data["product_topics"]:
topic_url = super().general_test_data["product_topics"][product_topic]
self.page.wait_for_timeout(400)
self.navigate_to_link(topic_url)
self.wait_for_url_to_be(topic_url)
for option in self.sumo_pages.product_topics_page._get_navbar_links_text():
self.logger.info(f"Clicking on {option} navbar option")
option_url = (HomepageMessages.STAGE_HOMEPAGE_URL + self.sumo_pages.
product_topics_page._get_navbar_option_link(option))
self.sumo_pages.product_topics_page._click_on_a_navbar_option(option)
try:
self.wait_for_url_to_be(option_url)
except (TimeoutError, Error):
self.logger.info("Failed click, retrying")
self.sumo_pages.product_topics_page._click_on_a_navbar_option(option)
self.wait_for_url_to_be(option_url)
for option in self.sumo_pages.product_topics_page._get_navbar_links_text():
with allure.step(f"Clicking on {option} navbar option"):
option_url = (HomepageMessages.STAGE_HOMEPAGE_URL + self.sumo_pages.
product_topics_page._get_navbar_option_link(option))
self.sumo_pages.product_topics_page._click_on_a_navbar_option(option)
try:
self.wait_for_url_to_be(option_url)
except (TimeoutError, Error):
self.logger.info("Failed click, retrying")
self.sumo_pages.product_topics_page._click_on_a_navbar_option(option)
self.wait_for_url_to_be(option_url)
self.logger.info("Verifying that the correct option is displayed")
check.equal(
self.sumo_pages.product_topics_page._get_page_title(),
option,
f"Incorrect topic: "
f"Expected: {option} "
f"Received: {self.sumo_pages.product_topics_page._get_page_title()}"
)
with check, allure.step("Verifying that the correct option is displayed"):
assert self.sumo_pages.product_topics_page._get_page_title() == option
self.logger.info("Verifying that the correct navbar option is selected")
check.equal(
self.sumo_pages.product_topics_page._get_selected_navbar_option(),
option,
f"Incorrect selected navbar option "
f"Expected: {option} "
f"Actual: {self.sumo_pages.product_topics_page._get_selected_navbar_option()}"
)
with check, allure.step("Verifying that the correct nav option is selected"):
assert self.sumo_pages.product_topics_page._get_selected_navbar_option(
) == option
# C2428991
@pytest.mark.productTopicsPage
def test_learn_more_redirect(self):
self.logger.info("Navigating to product topics pages")
for product_topic in super().general_test_data["product_topics"]:
topic_url = super().general_test_data["product_topics"][product_topic]
self.navigate_to_link(topic_url)
self.wait_for_url_to_be(topic_url)
with allure.step("Navigating to product topics pages"):
for product_topic in super().general_test_data["product_topics"]:
topic_url = super().general_test_data["product_topics"][product_topic]
self.navigate_to_link(topic_url)
self.wait_for_url_to_be(topic_url)
self.logger.info("Clicking on the 'Learn More' button")
self.sumo_pages.product_topics_page._click_on_learn_more_button()
with allure.step("Clicking on the 'Learn More' button"):
self.sumo_pages.product_topics_page._click_on_learn_more_button()
self.logger.info("Verifying that we are redirected to the contribute_messages page")
expect(
self.page
).to_have_url(ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL)
with allure.step("Verifying that the user is redirected to the contribute "
"messages page"):
expect(
self.page
).to_have_url(ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL)
# C2188690
@pytest.mark.productTopicsPage
def test_aaq_redirect(self):
self.logger.info("Navigating to product topics pages")
for product_topic in super().general_test_data["product_topics"]:
topic_url = super().general_test_data["product_topics"][product_topic]
self.navigate_to_link(topic_url)
self.wait_for_url_to_be(topic_url)
with allure.step("Navigating to product topics pages"):
for product_topic in super().general_test_data["product_topics"]:
topic_url = super().general_test_data["product_topics"][product_topic]
self.navigate_to_link(topic_url)
self.wait_for_url_to_be(topic_url)
self.logger.info("Verifying the subheading text")
if product_topic in super().general_test_data["premium_products"]:
check.equal(
self.sumo_pages.product_topics_page._get_aaq_subheading_text(),
AAQWidgetMessages.PREMIUM_AAQ_SUBHEADING_TEXT,
f"Incorrect aaq subheading "
f"Expected: {AAQWidgetMessages.PREMIUM_AAQ_SUBHEADING_TEXT} "
f"Received: {self.sumo_pages.product_topics_page._get_aaq_subheading_text()}"
)
self.logger.info("Clicking on the AAQ button")
self.sumo_pages.product_topics_page._click_on_aaq_button()
self.logger.info("Verifying the subheading text")
if product_topic in super().general_test_data["premium_products"]:
with check, allure.step(f"Verifying that the correct subheading page for "
f"{product_topic} is displayed"):
assert self.sumo_pages.product_topics_page._get_aaq_subheading_text(
) == AAQWidgetMessages.PREMIUM_AAQ_SUBHEADING_TEXT
self.logger.info("Signing in to SUMO")
self.sumo_pages.auth_flow_page.sign_in_flow(
username=super().user_special_chars,
account_password=super().user_secrets_pass
)
with allure.step("Clicking on the AAQ button"):
self.sumo_pages.product_topics_page._click_on_aaq_button()
self.logger.info("Verifying that we are on the correct AAQ form page")
with allure.step("Signing in to SUMO and verifying that we are on the "
"correct AAQ form page"):
self.sumo_pages.auth_flow_page.sign_in_flow(
username=super().user_special_chars,
account_password=super().user_secrets_pass
)
expect(
self.page
).to_have_url(super(
).aaq_question_test_data["products_aaq_url"][product_topic], timeout=30000)
expect(
self.page
).to_have_url(super().aaq_question_test_data["products_aaq_url"][product_topic],
timeout=30000)
with allure.step("Signing out from SUMO"):
self.sumo_pages.top_navbar._click_on_sign_out_button()
self.logger.info("Signing out")
self.sumo_pages.top_navbar._click_on_sign_out_button()
else:
assert self.sumo_pages.product_topics_page._get_aaq_subheading_text(
) == AAQWidgetMessages.FREEMIUM_AAQ_SUBHEADING_TEXT_SIGNED_OUT
else:
check.equal(
self.sumo_pages.product_topics_page._get_aaq_subheading_text(),
AAQWidgetMessages.FREEMIUM_AAQ_SUBHEADING_TEXT_SIGNED_OUT,
f"Incorrect aaq subheading "
f"Expected: {AAQWidgetMessages.FREEMIUM_AAQ_SUBHEADING_TEXT_SIGNED_OUT} "
f"Received: {self.sumo_pages.product_topics_page._get_aaq_subheading_text()}"
)
self.logger.info("Clicking on the AAQ button")
self.sumo_pages.product_topics_page._click_on_aaq_button()
self.logger.info("Verifying that we are on the 'Get community support article'")
expect(
self.page
).to_have_url(KBArticlePageMessages.GET_COMMUNITY_SUPPORT_ARTICLE_LINK)
with allure.step("Clicking on the AAQ button and verifying that we are on "
"the 'Get community support article'"):
self.sumo_pages.product_topics_page._click_on_aaq_button()
expect(
self.page
).to_have_url(KBArticlePageMessages.GET_COMMUNITY_SUPPORT_ARTICLE_LINK)

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

@ -1,5 +1,6 @@
import allure
import pytest
import pytest_check as check
from pytest_check import check
from playwright.sync_api import expect, TimeoutError
from playwright_tests.core.testutilities import TestUtilities
@ -15,93 +16,73 @@ class TestProductSolutionsPage(TestUtilities):
# C890370
@pytest.mark.skip
def test_featured_articles_redirect(self):
self.logger.info("Accessing the contact support page via the top navbar Get Help > "
"Browse All products")
self.sumo_pages.top_navbar._click_on_browse_all_products_option()
with allure.step("Accessing the contact support page via the top navbar Get Help > "
"Browse All products"):
self.sumo_pages.top_navbar._click_on_browse_all_products_option()
self.logger.info("Clicking on all product cards")
with allure.step("Clicking on all product cards"):
for card in self.sumo_pages.contact_support_page._get_all_product_card_titles():
with check, allure.step(f"Clicking on the {card} and verifying that the correct "
f"product solutions page header is displayed"):
self.sumo_pages.contact_support_page._click_on_a_particular_card(card)
assert self.sumo_pages.product_solutions_page._get_product_solutions_heading(
) == card + ProductSolutionsMessages.PAGE_HEADER
for card in self.sumo_pages.contact_support_page._get_all_product_card_titles():
self.sumo_pages.contact_support_page._click_on_a_particular_card(card)
check.equal(
self.sumo_pages.product_solutions_page._get_product_solutions_heading(),
card + ProductSolutionsMessages.PAGE_HEADER,
f"Incorrect product solutions page displayed: "
f"Expected: {card + ProductSolutionsMessages.PAGE_HEADER} "
f"Actual:{self.sumo_pages.product_solutions_page._get_product_solutions_heading()}"
)
if self.sumo_pages.product_solutions_page._is_featured_article_section_displayed():
for featured_article_card in (self.sumo_pages.product_solutions_page
._get_all_featured_articles_titles()):
self.sumo_pages.product_solutions_page._click_on_a_featured_article_card(
featured_article_card)
with self.page.context.expect_page() as tab:
feature_article_page = tab.value
print("Tab open")
article_text = (feature_article_page.
locator("//h1[@class='sumo-page-heading']").inner_text())
check.equal(
article_text,
featured_article_card,
f"Incorrect article page title. "
f"Expected: {featured_article_card} "
f"Received: {article_text}"
)
feature_article_page.close()
else:
self.logger.info(f"{card} has no featured articles displayed!!!")
self.navigate_back()
if self.sumo_pages.product_solutions_page._is_featured_article_section_displayed():
for featured_article_card in (self.sumo_pages.product_solutions_page
._get_all_featured_articles_titles()):
self.sumo_pages.product_solutions_page._click_on_a_featured_article_card(
featured_article_card)
with check, allure.step(f"Clicking on the {featured_article_card} and "
f"verifying that the correct article page title "
f"is displayed"):
with self.page.context.expect_page() as tab:
feature_article_page = tab.value
article_text = (feature_article_page.
locator("//h1[@class='sumo-page-heading']").inner_text(
))
assert article_text == featured_article_card
feature_article_page.close()
else:
self.logger.info(f"{card} has no featured articles displayed!!!")
self.navigate_back()
# C890375, C890379
@pytest.mark.productSolutionsPage
def test_popular_topics_redirect(self):
self.logger.info("Accessing the contact support page via the top navbar Get Help > "
"Browse All products")
self.sumo_pages.top_navbar._click_on_browse_all_products_option()
self.logger.info("Clicking on all product cards")
with allure.step("Accessing the contact support page via the top navbar Get Help > "
"Browse All products"):
self.sumo_pages.top_navbar._click_on_browse_all_products_option()
for card in self.sumo_pages.contact_support_page._get_all_product_card_titles():
self.sumo_pages.contact_support_page._click_on_a_particular_card(card)
check.equal(
self.sumo_pages.product_solutions_page._get_product_solutions_heading(),
card + ProductSolutionsMessages.PAGE_HEADER,
f"Incorrect product solutions page displayed: "
f"Expected: {card + ProductSolutionsMessages.PAGE_HEADER} "
f"Actual:{self.sumo_pages.product_solutions_page._get_product_solutions_heading()}"
)
with check, allure.step(f"Clicking on the {card} card and verifying that the correct "
f"product solutions page is displayed"):
assert self.sumo_pages.product_solutions_page._get_product_solutions_heading(
) == card + ProductSolutionsMessages.PAGE_HEADER
if self.sumo_pages.product_solutions_page._is_popular_topics_section_displayed:
for topic in self.sumo_pages.product_solutions_page._get_popular_topics():
self.sumo_pages.product_solutions_page._click_on_a_popular_topic_card(topic)
try:
with self.page.context.expect_page() as tab:
feature_article_page = tab.value
print(f"Tab open for topic: {topic}")
except TimeoutError:
print("Trying to click on the popular topic again")
self.sumo_pages.product_solutions_page._click_on_a_popular_topic_card(
topic)
with self.page.context.expect_page() as tab:
feature_article_page = tab.value
print(f"Tab open for topic: {topic}")
with check, allure.step(f"Clicking on the {topic} topic and verifying if "
f"correct topic page title is displayed"):
try:
with self.page.context.expect_page() as tab:
feature_article_page = tab.value
print(f"Tab open for topic: {topic}")
except TimeoutError:
print("Trying to click on the popular topic again")
self.sumo_pages.product_solutions_page._click_on_a_popular_topic_card(
topic)
with self.page.context.expect_page() as tab:
feature_article_page = tab.value
print(f"Tab open for topic: {topic}")
popular_topic = (feature_article_page
.locator("//h1[@class='topic-title sumo-page-heading']")
.inner_text())
check.equal(
popular_topic,
topic,
f"Incorrect topic page title. "
f"Expected: {topic} "
f"Received: {popular_topic}"
)
feature_article_page.close()
popular_topic = (feature_article_page
.locator("//h1[@class='topic-title sumo-page-heading']")
.inner_text())
assert popular_topic == topic
feature_article_page.close()
else:
self.logger.info(f"{card} has no featured articles displayed!!!")
@ -110,107 +91,79 @@ class TestProductSolutionsPage(TestUtilities):
# C890382
@pytest.mark.productSolutionsPage
def test_ask_now_widget_redirect(self):
self.logger.info("Accessing the contact support page via the top navbar Get Help > "
"Browse All products")
self.sumo_pages.top_navbar._click_on_browse_all_products_option()
self.logger.info("Clicking on all product cards")
with allure.step("Accessing the contact support page via the top navbar Get Help > "
"Browse All products"):
self.sumo_pages.top_navbar._click_on_browse_all_products_option()
for freemium_product in super().general_test_data["freemium_products"]:
self.sumo_pages.contact_support_page._click_on_a_particular_card(freemium_product)
with allure.step(f"Clicking on the {freemium_product} card "):
self.sumo_pages.contact_support_page._click_on_a_particular_card(freemium_product)
with check, allure.step("verifying that the correct 'Still need help' subtext is "
"displayed"):
assert self.sumo_pages.product_solutions_page._get_aaq_subheading_text(
) == AAQWidgetMessages.FREEMIUM_AAQ_SUBHEADING_TEXT_SIGNED_OUT
self.logger.info("Verifying that the correct 'Still need help' subtext is displayed")
check.equal(
self.sumo_pages.product_solutions_page._get_aaq_subheading_text(),
AAQWidgetMessages.FREEMIUM_AAQ_SUBHEADING_TEXT_SIGNED_OUT,
f"Incorrect AAQ widget displayed: "
f"Expected: {AAQWidgetMessages.FREEMIUM_AAQ_SUBHEADING_TEXT_SIGNED_OUT} "
f"Received: {self.sumo_pages.product_solutions_page._get_aaq_subheading_text()}"
)
with check, allure.step("Verifying that the correct AAQ button text is displayed"):
assert self.sumo_pages.product_solutions_page._get_aaq_widget_button_name(
) == AAQWidgetMessages.FREEMIUM_PRODUCTS_AAQ_WIDGET_BUTTON_TEXT
self.logger.info("Verifying that the correct AAQ button text is displayed")
check.equal(
self.sumo_pages.product_solutions_page._get_aaq_widget_button_name(),
AAQWidgetMessages.FREEMIUM_PRODUCTS_AAQ_WIDGET_BUTTON_TEXT,
f"Incorrect AAQ button name. "
f"Expected: {self.sumo_pages.product_solutions_page._get_aaq_widget_button_name()}"
f" Actual: {AAQWidgetMessages.FREEMIUM_PRODUCTS_AAQ_WIDGET_BUTTON_TEXT}"
)
with allure.step("Clicking on the AAQ button and verifying that the auth page is "
"displayed"):
self.sumo_pages.product_solutions_page._click_ask_now_button()
self.logger.info("Signing in to SUMO")
self.sumo_pages.auth_flow_page.sign_in_flow(
username=super().user_special_chars,
account_password=super().user_secrets_pass,
)
self.logger.info("Clicking on the AAQ button and verifying that the auth page is "
"displayed")
self.sumo_pages.product_solutions_page._click_ask_now_button()
with allure.step("Verifying that we are on the correct AAQ form page"):
expect(
self.page
).to_have_url(super().aaq_question_test_data["products_aaq_url"][freemium_product],
timeout=30000)
self.logger.info("Signing in to SUMO")
self.sumo_pages.auth_flow_page.sign_in_flow(
username=super().user_special_chars,
account_password=super().user_secrets_pass,
)
self.logger.info("Verifying that we are on the correct AAQ form page")
expect(
self.page
).to_have_url(super().aaq_question_test_data["products_aaq_url"][freemium_product],
timeout=30000)
self.logger.info("Signing out")
self.sumo_pages.top_navbar._click_on_sign_out_button()
self.logger.info("Accessing the contact support page via the top navbar Get Help > "
"Browse All products")
self.sumo_pages.top_navbar._click_on_browse_all_products_option()
with allure.step("Signing out and accessing the contact support page via the top "
"navbar Get Help > Browse All products"):
self.sumo_pages.top_navbar._click_on_sign_out_button()
self.sumo_pages.top_navbar._click_on_browse_all_products_option()
# C890382
@pytest.mark.productSolutionsPage
def test_contact_support_widget_redirect(self):
self.logger.info("Accessing the contact support page via the top navbar Get Help > "
"Browse All products")
self.sumo_pages.top_navbar._click_on_browse_all_products_option()
self.logger.info("Clicking on all product cards")
with allure.step("Accessing the contact support page via the top navbar Get Help > "
"Browse All products"):
self.sumo_pages.top_navbar._click_on_browse_all_products_option()
for premium_product in super().general_test_data["premium_products"]:
self.sumo_pages.contact_support_page._click_on_a_particular_card(premium_product)
with allure.step(f"Clicking on the {premium_product} card"):
self.sumo_pages.contact_support_page._click_on_a_particular_card(premium_product)
self.logger.info("Verifying that the correct 'Still need help' subtext is displayed")
check.equal(
self.sumo_pages.product_solutions_page._get_aaq_subheading_text(),
AAQWidgetMessages.PREMIUM_AAQ_SUBHEADING_TEXT,
f"Incorrect AAQ widget displayed: "
f"Expected: {AAQWidgetMessages.PREMIUM_AAQ_SUBHEADING_TEXT} "
f"Received: {self.sumo_pages.product_solutions_page._get_aaq_subheading_text()}"
)
with check, allure.step("Verifying that the correct 'Still need help' subtext is "
"displayed"):
assert self.sumo_pages.product_solutions_page._get_aaq_subheading_text(
) == AAQWidgetMessages.PREMIUM_AAQ_SUBHEADING_TEXT
self.logger.info("Verifying that the correct AAQ button text is displayed")
check.equal(
self.sumo_pages.product_solutions_page._get_aaq_widget_button_name(),
AAQWidgetMessages.PREMIUM_PRODUCTS_AAQ_WIDGET_BUTTON_TEXT,
f"Incorrect AAQ button name. "
f"Expected: {self.sumo_pages.product_solutions_page._get_aaq_widget_button_name()}"
f" Actual: {AAQWidgetMessages.FREEMIUM_PRODUCTS_AAQ_WIDGET_BUTTON_TEXT}"
)
with check, allure.step("Verifying that the correct AAQ button text is displayed"):
assert self.sumo_pages.product_solutions_page._get_aaq_widget_button_name(
) == AAQWidgetMessages.PREMIUM_PRODUCTS_AAQ_WIDGET_BUTTON_TEXT
self.logger.info("Clicking on the AAQ button and verifying that the auth page is "
"displayed")
self.sumo_pages.product_solutions_page._click_ask_now_button()
with allure.step("Clicking on the AAQ button, verifying that the auth page is "
"displayed and signing in to SUMO"):
self.sumo_pages.product_solutions_page._click_ask_now_button()
self.logger.info("Signing in to SUMO")
self.sumo_pages.auth_flow_page.sign_in_flow(
username=super().user_special_chars,
account_password=super().user_secrets_pass,
)
self.logger.info("Signing in to SUMO")
self.sumo_pages.auth_flow_page.sign_in_flow(
username=super().user_special_chars,
account_password=super().user_secrets_pass,
)
self.logger.info("Verifying that we are on the correct AAQ form page")
with allure.step("Verifying that we are on the correct AAQ form page"):
expect(
self.page
).to_have_url(super().aaq_question_test_data["products_aaq_url"][premium_product],
timeout=30000)
expect(
self.page
).to_have_url(super().aaq_question_test_data["products_aaq_url"][premium_product],
timeout=30000)
self.logger.info("Signing out")
self.sumo_pages.top_navbar._click_on_sign_out_button()
self.logger.info("Accessing the contact support page via the top navbar Get Help > "
"Browse All products")
self.sumo_pages.top_navbar._click_on_browse_all_products_option()
with allure.step("Signing out and access the contact support page via the top navbar "
"Get Help > Browse All products"):
self.sumo_pages.top_navbar._click_on_sign_out_button()
self.sumo_pages.top_navbar._click_on_browse_all_products_option()

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

@ -1,8 +1,6 @@
import os
import allure
import pytest
from playwright.sync_api import sync_playwright
from playwright_tests.core.testutilities import TestUtilities
from playwright_tests.messages.homepage_messages import HomepageMessages
from playwright_tests.pages.sumo_pages import SumoPages
@ -17,11 +15,11 @@ def setup(request, browser, logger_setup):
with sync_playwright() as playwright:
if requested_browser == "chrome":
browser = playwright.chromium.launch()
context = browser.new_context()
context = browser.new_context(record_video_dir="reports/videos")
page = context.new_page()
else:
browser = playwright.firefox.launch()
context = browser.new_context()
context = browser.new_context(record_video_dir="reports/videos")
page = context.new_page()
sumo_pages = SumoPages(page)
@ -33,7 +31,8 @@ def setup(request, browser, logger_setup):
request.cls.requested_browser = requested_browser
request.cls.logger = logger
yield
context.close()
page.context.close()
page.video.delete()
def pytest_addoption(parser):
@ -62,27 +61,17 @@ def logger_setup():
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item):
def pytest_runtest_makereport():
try:
pytest_html = item.config.pluginmanager.getplugin("html")
outcome = yield
report = outcome.get_result()
extra = getattr(report, "extra", [])
if report.when == "call":
xfail = hasattr(report, "wasxfail")
if (report.skipped and xfail) or (report.failed and not xfail):
report_directory = "reports/"
file_name_edit = report.nodeid.split("::")
file_name = file_name_edit[2] + ".png"
destination_file = os.path.join(report_directory, file_name)
page.screenshot(path=destination_file, full_page=True)
if file_name:
html = (
'<div><img src="%s" alt="screenshot" style="width:300px; height=200px"'
'onclick="window.open(this.src)" align="right"/></div>' % file_name
)
extra.append(pytest_html.extras.html(html))
report.extra = extra
allure.attach.file(
page.video.path(),
name="Video",
attachment_type=allure.attachment_type.WEBM
)
except Exception as e:
print(e)

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

@ -1,6 +1,7 @@
import allure
import pytest
import requests
import pytest_check as check
from pytest_check import check
from playwright_tests.core.testutilities import TestUtilities
from playwright_tests.messages.contribute_messages.con_pages.con_forum_messages import (
@ -22,55 +23,30 @@ class TestContributeArticlePage(TestUtilities):
# C2165414
@pytest.mark.contributePagesTests
def test_contribute_article_page_text(self):
self.logger.info("Accessing the Contribute with help Article page")
self.navigate_to_link(
ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL
)
with allure.step("Accessing the Contribute with help Article page"):
self.navigate_to_link(
ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL
)
self.logger.info(
"Verifying that the page header is successfully displayed "
"and contains the correct strings "
)
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_hero_main_header_text(),
ContributeHelpArticlesMessages.HERO_PAGE_TITLE,
f"Actual: {self.sumo_pages.ways_to_contribute_pages._get_hero_main_header_text()}"
f"Expected: {ContributeHelpArticlesMessages.HERO_PAGE_TITLE}",
)
with check, allure.step("Verifying that the page header is successfully displayed and "
"contains the correct strings"):
assert self.sumo_pages.ways_to_contribute_pages._get_hero_main_header_text(
) == ContributeHelpArticlesMessages.HERO_PAGE_TITLE
self.logger.info(
"Verifying that the h2 is successfully displayed and contains the correct strings"
)
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_hero_second_header(),
ContributeHelpArticlesMessages.HERO_SECOND_TITLE,
f"Text is: "
f"{self.sumo_pages.ways_to_contribute_pages._get_hero_second_header()}"
f"Expected: {ContributeHelpArticlesMessages.HERO_SECOND_TITLE}",
)
with check, allure.step("Verifying that the h2 is successfully displayed and contains "
"the correct strings"):
assert self.sumo_pages.ways_to_contribute_pages._get_hero_second_header(
) == ContributeHelpArticlesMessages.HERO_SECOND_TITLE
self.logger.info(
"Verifying tha the paragraph under h2 is successfully "
"displayed and contains the correct strings"
)
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_hero_text(),
ContributeHelpArticlesMessages.HERO_TEXT,
f"Text is: {self.sumo_pages.ways_to_contribute_pages._get_hero_text()}"
f"Expected: {ContributeHelpArticlesMessages.HERO_TEXT}",
)
with check, allure.step("Verifying tha the paragraph under h2 is successfully displayed "
"and contains the correct strings"):
assert self.sumo_pages.ways_to_contribute_pages._get_hero_text(
) == ContributeHelpArticlesMessages.HERO_TEXT
self.logger.info(
"Verifying that the 'How you can contribute_messages' header is successfully "
"displayed and contains the correct strings"
)
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_header_text(),
ContributeHelpArticlesMessages.HOW_TO_CONTRIBUTE_HEADER,
f"Text is: "
f"{self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_header_text()}"
f"Expected is: {ContributeHelpArticlesMessages.HOW_TO_CONTRIBUTE_HEADER}",
)
with check, allure.step("Verifying that the 'How you can contribute_messages' header is "
"successfully displayed and contains the correct strings"):
assert self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_header_text(
) == ContributeHelpArticlesMessages.HOW_TO_CONTRIBUTE_HEADER
# Need to add a check for the logged in state as well.
# Excluding option four from the list since we are using a different locator
@ -82,71 +58,33 @@ class TestContributeArticlePage(TestUtilities):
ContributeHelpArticlesMessages.HOW_TO_CONTRIBUTE_OPTION_FIVE,
]
self.logger.info(
"Verifying that the 'How you can contribute_messages' cards are successfully expected"
)
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_link_options_text(),
card_titles,
"How you can contribute_messages steps are incorrect!",
)
with check, allure.step("Verifying that the 'How you can contribute_messages' cards are "
"successfully expected"):
assert self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_link_options(
) == card_titles
self.logger.info("Signing up with a FxA contributor account")
with check, allure.step("Signing up with a FxA contributor account and Verifying that "
"the step 4 option is successfully displayed and the text "
"contains the expected string"):
# We need to add here the check for when the user is signed in with a contributor
# account
assert self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_option_four(
) == ContributeHelpArticlesMessages.HOW_TO_CONTRIBUTE_OPTION_FOUR
# We need to add here the check for when the user is signed in with a contributor account
with check, allure.step("Verifying that the first line from the fact text is "
"successfully displayed and contains the expected string"):
assert self.sumo_pages.ways_to_contribute_pages._get_first_fact_text(
) == ContributeHelpArticlesMessages.FACT_FIRST_LINE
self.logger.info(
"Verifying that the step 4 option is successfully displayed and the text contains "
"the expected string"
)
with check, allure.step("Verifying that the second line from the fact section text is "
"successfully displayed and contains the expected string"):
assert self.sumo_pages.ways_to_contribute_pages._get_second_fact_text(
) == ContributeHelpArticlesMessages.FACT_SECOND_LINE
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_option_four_text(),
ContributeHelpArticlesMessages.HOW_TO_CONTRIBUTE_OPTION_FOUR,
f"Text is: "
f"{self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_option_four_text()}"
f"Expected is: "
f"{ContributeHelpArticlesMessages.HOW_TO_CONTRIBUTE_OPTION_FOUR}",
)
self.logger.info(
"Verifying that the first line from the fact text is successfully displayed and "
"contains the expected string"
)
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_first_fact_text(),
ContributeHelpArticlesMessages.FACT_FIRST_LINE,
f"Text is: "
f"{self.sumo_pages.ways_to_contribute_pages._get_first_fact_text()}"
f"Expected is: "
f"{ContributeHelpArticlesMessages.FACT_FIRST_LINE}",
)
self.logger.info(
"Verifying that the second line from the fact section text is successfully displayed "
"and contains the expected string "
)
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_second_fact_text(),
ContributeHelpArticlesMessages.FACT_SECOND_LINE,
f"Text is: "
f"{self.sumo_pages.ways_to_contribute_pages._get_second_fact_text()}"
f"Expected is: "
f"{ContributeHelpArticlesMessages.FACT_SECOND_LINE}",
)
self.logger.info(
"Verifying that the 'Other ways to contribute_messages' header is successfully "
"displayed and contains the expected string"
)
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_header(),
ContributeHelpArticlesMessages.OTHER_WAYS_TO_CONTRIBUTE_HEADER,
f"Text is: "
f"{self.sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_header()}"
f"Expected is: "
f"{ContributeHelpArticlesMessages.OTHER_WAYS_TO_CONTRIBUTE_HEADER}",
)
with check, allure.step("Verifying that the 'Other ways to contribute_messages' header "
"is successfully displayed and contains the expected string"):
assert self.sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_header(
) == ContributeHelpArticlesMessages.OTHER_WAYS_TO_CONTRIBUTE_HEADER
other_ways_to_contribute_card_titles = [
ContributeHelpArticlesMessages.ANSWER_QUESTIONS_IN_SUPPORT_FORUM_TITLE,
@ -155,53 +93,42 @@ class TestContributeArticlePage(TestUtilities):
ContributeHelpArticlesMessages.RESPOND_TO_MOBILE_STORE_REVIEWS_CARD_TITLE,
]
self.logger.info(
"Verifying that the 'Other ways to contribute_messages' are successfully displayed "
"and in the correct order"
)
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_card_title(),
other_ways_to_contribute_card_titles,
"Other ways to contribute_messages card titles are not the correct ones!",
)
with check, allure.step("Verifying that the 'Other ways to contribute_messages' are "
"successfully displayed and in the correct order"):
assert self.sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_cards(
) == other_ways_to_contribute_card_titles
# C2165414
@pytest.mark.contributePagesTests
def test_contribute_article_page_images_are_not_broken(self):
self.logger.info("Accessing the Contribute with help Article page")
self.navigate_to_link(
ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL
)
self.logger.info("Verifying that the Contribute forum page images are not broken")
with allure.step("Accessing the Contribute with help Article page"):
self.navigate_to_link(
ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL
)
for link in self.sumo_pages.ways_to_contribute_pages._get_all_page_image_links():
image_link = link.get_attribute("src")
response = requests.get(image_link, stream=True)
check.is_true(response.status_code < 400, f"The {image_link} image is broken")
with check, allure.step(f"Verifying that {image_link} is not broken"):
assert response.status_code < 400
# C2165415
@pytest.mark.contributePagesTests
def test_contribute_article_page_breadcrumbs(self):
self.logger.info("Accessing the Contribute Forum page")
self.navigate_to_link(
ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL
)
with allure.step("Accessing the Contribute Forum page"):
self.navigate_to_link(
ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL
)
self.logger.info("Verifying that the correct breadcrumbs are displayed")
breadcrumbs = [
ContributeHelpArticlesMessages.FIRST_BREADCRUMB,
ContributeHelpArticlesMessages.SECOND_BREADCRUMB,
ContributeHelpArticlesMessages.THIRD_BREADCRUMB,
]
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_text_of_all_breadcrumbs(),
breadcrumbs,
f"Breadcrumbs are: "
f"{self.sumo_pages.ways_to_contribute_pages._get_text_of_all_breadcrumbs()}"
f"Expected: {breadcrumbs}",
)
with check, allure.step("Verifying that the correct breadcrumbs are displayed"):
assert self.sumo_pages.ways_to_contribute_pages._get_text_of_all_breadcrumbs(
) == breadcrumbs
counter = 1
for breadcrumb in self.sumo_pages.ways_to_contribute_pages._get_interactable_breadcrumbs():
@ -211,41 +138,24 @@ class TestContributeArticlePage(TestUtilities):
self.sumo_pages.ways_to_contribute_pages._click_on_breadcrumb(breadcrumb_to_click)
if counter == 1:
self.logger.info(
"Verifying that the Contribute breadcrumb redirects to the Contribute page"
)
check.equal(
self.get_page_url(),
ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL,
f"Expected to be on {ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL}"
f"We are actual on {self.get_page_url()}",
)
with check, allure.step("Verifying that the Contribute breadcrumb redirects to "
"the Contribute page"):
assert self.get_page_url() == ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL
self.navigate_forward()
counter -= 1
elif counter == 0:
self.logger.info("Verifying that the Home breadcrumb redirects to the Homepage")
check.equal(
self.get_page_url(),
HomepageMessages.STAGE_HOMEPAGE_URL_EN_US,
f"Expected to be on: "
f"{HomepageMessages.STAGE_HOMEPAGE_URL_EN_US}"
f"We are actual on: "
f"{self.get_page_url()}",
)
with check, allure.step("Verifying that the Home breadcrumb redirects to the "
"Homepage"):
assert self.get_page_url() == HomepageMessages.STAGE_HOMEPAGE_URL_EN_US
# Need to add tests for "How you can contribute_messages" section
# C2165418
@pytest.mark.contributePagesTests
def test_contribute_article_other_ways_to_contribute_redirect_to_the_correct_page(self):
self.logger.info("Accessing the Contribute Forum page")
self.navigate_to_link(
ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL
)
self.logger.info(
"Verifying that the 'other ways to contribute_messages' cards are "
"redirecting to the correct SUMO page"
)
with allure.step("Accessing the Contribute Forum page"):
self.navigate_to_link(
ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL
)
ways_to_contribute_links = [
ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL,
@ -264,11 +174,8 @@ class TestContributeArticlePage(TestUtilities):
]
)
self.sumo_pages.ways_to_contribute_pages._click_on_other_way_to_contribute_card(card)
check.equal(
ways_to_contribute_links[counter],
self.get_page_url(),
f"Expected the following URL: {ways_to_contribute_links[counter]}"
f"Received: {self.get_page_url()}",
)
with check, allure.step(f"Verifying that the {ways_to_contribute_links[counter]} "
f"redirects to the correct page"):
assert ways_to_contribute_links[counter] == self.get_page_url()
self.navigate_back()
counter += 1

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

@ -1,5 +1,6 @@
import allure
import pytest
import pytest_check as check
from pytest_check import check
import requests
from playwright_tests.core.testutilities import TestUtilities
@ -22,140 +23,85 @@ class TestContributeForumPage(TestUtilities):
# C2165414
@pytest.mark.contributePagesTests
def test_contribute_forum_page_text(self):
self.logger.info("Accessing the Contribute Forum page")
self.navigate_to_link(
ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL
)
with allure.step("Accessing the Contribute Forum page"):
self.navigate_to_link(
ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL
)
with check, allure.step("Verifying that the Contribute Forum page contains the correct "
"strings"):
assert self.sumo_pages.ways_to_contribute_pages._get_hero_main_header_text(
) == ContributeForumMessages.HERO_PAGE_TITLE
assert self.sumo_pages.ways_to_contribute_pages._get_hero_second_header(
) == ContributeForumMessages.HERO_SECOND_TITLE
assert self.sumo_pages.ways_to_contribute_pages._get_hero_text(
) == ContributeForumMessages.HERO_TEXT
assert self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_header_text(
) == ContributeForumMessages.HOW_TO_CONTRIBUTE_HEADER
self.logger.info("Verifying that the Contribute Forum page contains the correct strings")
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_hero_main_header_text(),
ContributeForumMessages.HERO_PAGE_TITLE,
f"Actual: {self.sumo_pages.ways_to_contribute_pages._get_hero_main_header_text()}"
f"Expected: {ContributeForumMessages.HERO_PAGE_TITLE}",
)
# Need to add a check for the logged in state as well.
# Excluding option four from the list since we are using a different locator
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_hero_second_header(),
ContributeForumMessages.HERO_SECOND_TITLE,
f"Actual: {self.sumo_pages.ways_to_contribute_pages._get_hero_second_header()}"
f"Expected: {ContributeForumMessages.HERO_PAGE_TITLE}",
)
card_titles = [
ContributeForumMessages.HOW_TO_CONTRIBUTE_OPTION_ONE_SIGNED_OUT,
ContributeForumMessages.HOW_TO_CONTRIBUTE_OPTION_TWO,
ContributeForumMessages.HOW_TO_CONTRIBUTE_OPTION_THREE,
ContributeForumMessages.HOW_TO_CONTRIBUTE_OPTION_FIVE,
]
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_hero_text(),
ContributeForumMessages.HERO_TEXT,
f"Text is: {self.sumo_pages.ways_to_contribute_pages._get_hero_text()}"
f"Expected: {ContributeForumMessages.HERO_TEXT}",
)
assert self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_link_options(
) == card_titles
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_header_text(),
ContributeForumMessages.HOW_TO_CONTRIBUTE_HEADER,
f"Text is: "
f"{self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_header_text()}"
f"Expected is: {ContributeForumMessages.HOW_TO_CONTRIBUTE_HEADER}",
)
# We need to add here the check for when the user is signed in with a contributor
# account
assert self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_option_four(
) == ContributeForumMessages.HOW_TO_CONTRIBUTE_OPTION_FOUR
assert self.sumo_pages.ways_to_contribute_pages._get_first_fact_text(
) == ContributeForumMessages.FACT_FIRST_LINE
assert self.sumo_pages.ways_to_contribute_pages._get_second_fact_text(
) == ContributeForumMessages.FACT_SECOND_LINE
assert self.sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_header(
) == ContributeForumMessages.OTHER_WAYS_TO_CONTRIBUTE_HEADER
# Need to add a check for the logged in state as well.
# Excluding option four from the list since we are using a different locator
card_titles = [
ContributeForumMessages.HOW_TO_CONTRIBUTE_OPTION_ONE_SIGNED_OUT,
ContributeForumMessages.HOW_TO_CONTRIBUTE_OPTION_TWO,
ContributeForumMessages.HOW_TO_CONTRIBUTE_OPTION_THREE,
ContributeForumMessages.HOW_TO_CONTRIBUTE_OPTION_FIVE,
]
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_link_options_text(),
card_titles,
"How you can contribute_messages steps are incorrect!",
)
# We need to add here the check for when the user is signed in with a contributor account
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_option_four_text(),
ContributeForumMessages.HOW_TO_CONTRIBUTE_OPTION_FOUR,
f"Text is: "
f"{self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_option_four_text()}"
f"Expected is: "
f"{ContributeForumMessages.HOW_TO_CONTRIBUTE_OPTION_FOUR}",
)
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_first_fact_text(),
ContributeForumMessages.FACT_FIRST_LINE,
f"Text is: {self.sumo_pages.ways_to_contribute_pages._get_first_fact_text()}"
f"Expected is: {ContributeForumMessages.FACT_FIRST_LINE}",
)
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_second_fact_text(),
ContributeForumMessages.FACT_SECOND_LINE,
f"Text is: {self.sumo_pages.ways_to_contribute_pages._get_second_fact_text()}"
f"Expected is: {ContributeForumMessages.FACT_SECOND_LINE}",
)
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_header(),
ContributeForumMessages.OTHER_WAYS_TO_CONTRIBUTE_HEADER,
f"Text is: "
f"{self.sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_header()}"
f"Expected is: "
f"{ContributeForumMessages.OTHER_WAYS_TO_CONTRIBUTE_HEADER}",
)
other_ways_to_contribute_card_titles = [
ContributeForumMessages.WRITE_ARTICLES_CARD_TITLE,
ContributeForumMessages.LOCALIZE_CONTENT_CARD_TITLE,
ContributeForumMessages.PROVIDE_SUPPORT_ON_SOCIAL_CHANNELS_CARD_TITLE,
ContributeForumMessages.RESPOND_TO_MOBILE_STORE_REVIEWS_CARD_TITLE,
]
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_card_title(),
other_ways_to_contribute_card_titles,
"Other ways to contribute_messages card titles are not the correct ones!",
)
other_ways_to_contribute_card_titles = [
ContributeForumMessages.WRITE_ARTICLES_CARD_TITLE,
ContributeForumMessages.LOCALIZE_CONTENT_CARD_TITLE,
ContributeForumMessages.PROVIDE_SUPPORT_ON_SOCIAL_CHANNELS_CARD_TITLE,
ContributeForumMessages.RESPOND_TO_MOBILE_STORE_REVIEWS_CARD_TITLE,
]
assert self.sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_cards(
) == other_ways_to_contribute_card_titles
# C2165414
@pytest.mark.contributePagesTests
def test_contribute_forum_page_images_are_not_broken(self):
self.logger.info("Accessing the Contribute Forum page")
self.navigate_to_link(
ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL
)
with allure.step("Accessing the Contribute Forum page"):
self.navigate_to_link(
ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL
)
self.logger.info("Verifying that the Contribute forum page images are not broken")
for link in self.sumo_pages.ways_to_contribute_pages._get_all_page_image_links():
image_link = link.get_attribute("src")
response = requests.get(image_link, stream=True)
check.is_true(response.status_code < 400, f"The {image_link} image is broken")
with check, allure.step(f"Verifying that the {image_link} link is not broken"):
assert response.status_code < 400
# C2165415
@pytest.mark.contributePagesTests
def test_contribute_forum_page_breadcrumbs(self):
self.logger.info("Accessing the Contribute Forum page")
self.navigate_to_link(
ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL
)
with allure.step("Accessing the Contribute Forum page"):
self.navigate_to_link(
ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL
)
self.logger.info("Verifying that the correct breadcrumbs are displayed")
breadcrumbs = [
ContributeForumMessages.FIRST_BREADCRUMB,
ContributeForumMessages.SECOND_BREADCRUMB,
ContributeForumMessages.THIRD_BREADCRUMB,
]
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_text_of_all_breadcrumbs(),
breadcrumbs,
f"Breadcrumbs are: "
f"{self.sumo_pages.ways_to_contribute_pages._get_text_of_all_breadcrumbs()}"
f"Expected: {breadcrumbs}",
)
with check, allure.step("Verifying that the correct breadcrumbs are displayed"):
assert self.sumo_pages.ways_to_contribute_pages._get_text_of_all_breadcrumbs(
) == breadcrumbs
counter = 1
for breadcrumb in self.sumo_pages.ways_to_contribute_pages._get_interactable_breadcrumbs():
@ -165,40 +111,27 @@ class TestContributeForumPage(TestUtilities):
self.sumo_pages.ways_to_contribute_pages._click_on_breadcrumb(breadcrumb_to_click)
if counter == 1:
self.logger.info(
"Verifying that the Contribute breadcrumb redirects to the Contribute page"
)
check.equal(
self.get_page_url(),
ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL,
f"Expected to be on {ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL}"
f"We are actual on {self.get_page_url()}",
)
with check, allure.step("Verifying that the Contribute breadcrumb redirects to "
"the Contribute page"):
assert self.get_page_url() == ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL
self.navigate_forward()
counter -= 1
elif counter == 0:
self.logger.info("Verifying that the Home breadcrumb redirects to the Homepage")
check.equal(
self.get_page_url(),
HomepageMessages.STAGE_HOMEPAGE_URL_EN_US,
f"Expected to be on {HomepageMessages.STAGE_HOMEPAGE_URL_EN_US}"
f"We are actual on {self.get_page_url()}",
)
with check, allure.step("Verifying that the Home breadcrumb redirects to the "
"Homepage"):
assert self.get_page_url() == HomepageMessages.STAGE_HOMEPAGE_URL_EN_US
# Need to add tests for "How you can contribute_messages" section
# C2165418
@pytest.mark.contributePagesTests
def test_contribute_forum_other_ways_to_contribute_redirect_to_the_correct_page(self):
self.logger.info("Accessing the Contribute Forum page")
self.navigate_to_link(
ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL
)
with allure.step("Accessing the Contribute Forum page"):
self.navigate_to_link(
ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL
)
self.logger.info(
"Verifying that the 'other ways to contribute_messages'"
" cards are redirecting to the correct SUMO page"
)
ways_to_contribute_links = [
ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL,
ContributeLocalizationMessages.STAGE_CONTRIBUTE_LOCALIZATION_PAGE_URL,
@ -216,11 +149,8 @@ class TestContributeForumPage(TestUtilities):
]
)
self.sumo_pages.ways_to_contribute_pages._click_on_other_way_to_contribute_card(card)
check.equal(
ways_to_contribute_links[counter],
self.get_page_url(),
f"Expected the following URL: {ways_to_contribute_links[counter]}"
f"Received: {self.get_page_url()}",
)
with check, allure.step("Verifying that the 'other ways to contribute_messages' "
"cards are redirecting to the correct SUMO page"):
assert ways_to_contribute_links[counter] == self.get_page_url()
self.navigate_back()
counter += 1

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

@ -1,5 +1,6 @@
import allure
import pytest
import pytest_check as check
from pytest_check import check
import requests
from playwright_tests.core.testutilities import TestUtilities
@ -22,141 +23,81 @@ class TestContributeLocalizationPage(TestUtilities):
# C2176356
@pytest.mark.contributePagesTests
def test_contribute_localization_page_text(self):
self.logger.info("Accessing the Contribute localization page")
self.navigate_to_link(
ContributeLocalizationMessages.STAGE_CONTRIBUTE_LOCALIZATION_PAGE_URL
)
with allure.step("Accessing the Contribute localization page"):
self.navigate_to_link(
ContributeLocalizationMessages.STAGE_CONTRIBUTE_LOCALIZATION_PAGE_URL
)
self.logger.info(
"Verifying that the Contribute localization page contains the correct strings"
)
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_hero_main_header_text(),
ContributeLocalizationMessages.HERO_PAGE_TITLE,
f"Actual {self.sumo_pages.ways_to_contribute_pages._get_hero_main_header_text()}"
f"Expected: {ContributeLocalizationMessages.HERO_PAGE_TITLE}",
)
with check, allure.step("Verifying that the Contribute localization page contains the "
"correct strings"):
assert self.sumo_pages.ways_to_contribute_pages._get_hero_main_header_text(
) == ContributeLocalizationMessages.HERO_PAGE_TITLE
assert self.sumo_pages.ways_to_contribute_pages._get_hero_second_header(
) == ContributeLocalizationMessages.HERO_SECOND_TITLE
assert self.sumo_pages.ways_to_contribute_pages._get_hero_text(
) == ContributeLocalizationMessages.HERO_TEXT
assert self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_header_text(
) == ContributeLocalizationMessages.HOW_TO_CONTRIBUTE_HEADER
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_hero_second_header(),
ContributeLocalizationMessages.HERO_SECOND_TITLE,
f"Text is: "
f"{self.sumo_pages.ways_to_contribute_pages._get_hero_second_header()}"
f"Expected: {ContributeLocalizationMessages.HERO_SECOND_TITLE}",
)
# Need to add a check for the logged in state as well.
# Excluding option four from the list since we are using a different locator
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_hero_text(),
ContributeLocalizationMessages.HERO_TEXT,
f"Text is: {self.sumo_pages.ways_to_contribute_pages._get_hero_text()}"
f"Expected: {ContributeLocalizationMessages.HERO_TEXT}",
)
card_titles = [
ContributeLocalizationMessages.HOW_TO_CONTRIBUTE_OPTION_ONE_SIGNED_OUT,
ContributeLocalizationMessages.HOW_TO_CONTRIBUTE_OPTION_TWO,
ContributeLocalizationMessages.HOW_TO_CONTRIBUTE_OPTION_THREE,
ContributeLocalizationMessages.HOW_TO_CONTRIBUTE_OPTION_FIVE,
]
assert self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_link_options(
) == card_titles
assert self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_option_four(
) == ContributeLocalizationMessages.HOW_TO_CONTRIBUTE_OPTION_FOUR
assert self.sumo_pages.ways_to_contribute_pages._get_first_fact_text(
) == ContributeLocalizationMessages.FACT_FIRST_LINE
assert self.sumo_pages.ways_to_contribute_pages._get_second_fact_text(
) == ContributeLocalizationMessages.FACT_SECOND_LINE
assert self.sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_header(
) == ContributeLocalizationMessages.OTHER_WAYS_TO_CONTRIBUTE_HEADER
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_header_text(),
ContributeLocalizationMessages.HOW_TO_CONTRIBUTE_HEADER,
f"Text is: "
f"{self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_header_text()}"
f"Expected is: {ContributeLocalizationMessages.HOW_TO_CONTRIBUTE_HEADER}",
)
# Need to add a check for the logged in state as well.
# Excluding option four from the list since we are using a different locator
card_titles = [
ContributeLocalizationMessages.HOW_TO_CONTRIBUTE_OPTION_ONE_SIGNED_OUT,
ContributeLocalizationMessages.HOW_TO_CONTRIBUTE_OPTION_TWO,
ContributeLocalizationMessages.HOW_TO_CONTRIBUTE_OPTION_THREE,
ContributeLocalizationMessages.HOW_TO_CONTRIBUTE_OPTION_FIVE,
]
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_link_options_text(),
card_titles,
"How you can contribute_messages steps are incorrect!",
)
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_option_four_text(),
ContributeLocalizationMessages.HOW_TO_CONTRIBUTE_OPTION_FOUR,
f"Text is: "
f"{self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_option_four_text()}"
f"Expected is: "
f"{ContributeLocalizationMessages.HOW_TO_CONTRIBUTE_OPTION_FOUR}",
)
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_first_fact_text(),
ContributeLocalizationMessages.FACT_FIRST_LINE,
f"Text is: {self.sumo_pages.ways_to_contribute_pages._get_first_fact_text()}"
f"Expected is: {ContributeLocalizationMessages.FACT_FIRST_LINE}",
)
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_second_fact_text(),
ContributeLocalizationMessages.FACT_SECOND_LINE,
f"Text is: {self.sumo_pages.ways_to_contribute_pages._get_second_fact_text()}"
f"Expected is: {ContributeLocalizationMessages.FACT_SECOND_LINE}",
)
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_header(),
ContributeLocalizationMessages.OTHER_WAYS_TO_CONTRIBUTE_HEADER,
f"Text is: "
f"{self.sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_header()}"
f"Expected is: "
f"{ContributeLocalizationMessages.OTHER_WAYS_TO_CONTRIBUTE_HEADER}",
)
other_ways_to_contribute_card_titles = [
ContributeLocalizationMessages.ANSWER_QUESTIONS_IN_SUPPORT_FORUM_TITLE,
ContributeLocalizationMessages.WRITE_ARTICLES_CARD_TITLE,
ContributeLocalizationMessages.PROVIDE_SUPPORT_ON_SOCIAL_CHANNELS_CARD_TITLE,
ContributeLocalizationMessages.RESPOND_TO_MOBILE_STORE_REVIEWS_CARD_TITLE,
]
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_card_title(),
other_ways_to_contribute_card_titles,
"Other ways to contribute_messages card titles are not the correct ones!",
)
other_ways_to_contribute_card_titles = [
ContributeLocalizationMessages.ANSWER_QUESTIONS_IN_SUPPORT_FORUM_TITLE,
ContributeLocalizationMessages.WRITE_ARTICLES_CARD_TITLE,
ContributeLocalizationMessages.PROVIDE_SUPPORT_ON_SOCIAL_CHANNELS_CARD_TITLE,
ContributeLocalizationMessages.RESPOND_TO_MOBILE_STORE_REVIEWS_CARD_TITLE,
]
assert self.sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_cards(
) == other_ways_to_contribute_card_titles
# C2176356
@pytest.mark.contributePagesTests
def test_contribute_localization_page_images_are_not_broken(self):
self.logger.info("Accessing the Contribute localization page")
self.navigate_to_link(
ContributeLocalizationMessages.STAGE_CONTRIBUTE_LOCALIZATION_PAGE_URL
)
with allure.step("Accessing the Contribute localization page"):
self.navigate_to_link(
ContributeLocalizationMessages.STAGE_CONTRIBUTE_LOCALIZATION_PAGE_URL
)
self.logger.info("Verifying that the Contribute localization page images are not broken")
for link in self.sumo_pages.ways_to_contribute_pages._get_all_page_image_links():
image_link = link.get_attribute("src")
response = requests.get(image_link, stream=True)
check.is_true(response.status_code < 400, f"The {image_link} image is broken")
with check, allure.step(f"Verifying that the {image_link} is not broken"):
assert response.status_code < 400
# C2176357
@pytest.mark.contributePagesTests
def test_contribute_localization_page_breadcrumbs(self):
self.logger.info("Accessing the Contribute localization page")
self.navigate_to_link(
ContributeLocalizationMessages.STAGE_CONTRIBUTE_LOCALIZATION_PAGE_URL
)
with allure.step("Accessing the Contribute localization page"):
self.navigate_to_link(
ContributeLocalizationMessages.STAGE_CONTRIBUTE_LOCALIZATION_PAGE_URL
)
self.logger.info("Verifying that the correct breadcrumbs are displayed")
breadcrumbs = [
ContributeLocalizationMessages.FIRST_BREADCRUMB,
ContributeLocalizationMessages.SECOND_BREADCRUMB,
ContributeLocalizationMessages.THIRD_BREADCRUMB,
]
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_text_of_all_breadcrumbs(),
breadcrumbs,
f"Breadcrumbs are: "
f"{self.sumo_pages.ways_to_contribute_pages._get_text_of_all_breadcrumbs()}"
f"Expected: {breadcrumbs}",
)
with check, allure.step("Verifying that the correct breadcrumbs are displayed"):
breadcrumbs = [
ContributeLocalizationMessages.FIRST_BREADCRUMB,
ContributeLocalizationMessages.SECOND_BREADCRUMB,
ContributeLocalizationMessages.THIRD_BREADCRUMB,
]
assert self.sumo_pages.ways_to_contribute_pages._get_text_of_all_breadcrumbs(
) == breadcrumbs
counter = 1
for breadcrumb in self.sumo_pages.ways_to_contribute_pages._get_interactable_breadcrumbs():
@ -166,40 +107,27 @@ class TestContributeLocalizationPage(TestUtilities):
self.sumo_pages.ways_to_contribute_pages._click_on_breadcrumb(breadcrumb_to_click)
if counter == 1:
self.logger.info(
"Verifying that the Contribute breadcrumb redirects to the Contribute page"
)
check.equal(
self.get_page_url(),
ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL,
f"Expected to be on {ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL}"
f"We are actual on {self.get_page_url()}",
)
with check, allure.step("Verifying that the Contribute breadcrumb redirects to "
"the Contribute page"):
assert self.get_page_url() == ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL
self.navigate_forward()
counter -= 1
elif counter == 0:
self.logger.info("Verifying that the Home breadcrumb redirects to the Homepage")
check.equal(
self.get_page_url(),
HomepageMessages.STAGE_HOMEPAGE_URL_EN_US,
f"Expected to be on {HomepageMessages.STAGE_HOMEPAGE_URL_EN_US}"
f"We are actual on {self.get_page_url()}",
)
with check, allure.step("Verifying that the Home breadcrumb redirects to the "
"Homepage"):
assert self.get_page_url() == HomepageMessages.STAGE_HOMEPAGE_URL_EN_US
# Need to add tests for "How you can contribute_messages" section
# C2176360
@pytest.mark.contributePagesTests
def test_contribute_localization_other_ways_to_contribute_redirect_to_the_correct_page(self):
self.logger.info("Accessing the Contribute Forum page")
self.navigate_to_link(
ContributeLocalizationMessages.STAGE_CONTRIBUTE_LOCALIZATION_PAGE_URL
)
with allure.step("Accessing the Contribute Forum page"):
self.navigate_to_link(
ContributeLocalizationMessages.STAGE_CONTRIBUTE_LOCALIZATION_PAGE_URL
)
self.logger.info(
"Verifying that the 'other ways to contribute_messages' "
"cards are redirecting to the correct SUMO page"
)
ways_to_contribute_links = [
ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL,
ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL,
@ -217,11 +145,8 @@ class TestContributeLocalizationPage(TestUtilities):
]
)
self.sumo_pages.ways_to_contribute_pages._click_on_other_way_to_contribute_card(card)
check.equal(
ways_to_contribute_links[counter],
self.get_page_url(),
f"Expected the following URL: {ways_to_contribute_links[counter]}"
f"Received: {self.get_page_url()}",
)
with check, allure.step("Verifying that the 'other ways to contribute_messages' "
"cards are redirecting to the correct SUMO page"):
assert ways_to_contribute_links[counter] == self.get_page_url()
self.navigate_back()
counter += 1

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

@ -1,5 +1,6 @@
import allure
import pytest
import pytest_check as check
from pytest_check import check
import requests
from playwright_tests.core.testutilities import TestUtilities
@ -22,141 +23,82 @@ class TestContributeMobilePage(TestUtilities):
# C2176366
@pytest.mark.contributePagesTests
def test_contribute_mobile_page_text(self):
self.logger.info("Accessing the Contribute Mobile Store page")
self.navigate_to_link(
ContributeMobileSupportMessages.STAGE_CONTRIBUTE_MOBILE_SUPPORT_PAGE_URL
)
with allure.step("Accessing the Contribute Mobile Store page"):
self.navigate_to_link(
ContributeMobileSupportMessages.STAGE_CONTRIBUTE_MOBILE_SUPPORT_PAGE_URL
)
self.logger.info(
"Verifying that the Contribute Mobile Store page contains the correct strings"
)
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_hero_main_header_text(),
ContributeMobileSupportMessages.HERO_PAGE_TITLE,
f"Actual {self.sumo_pages.ways_to_contribute_pages._get_hero_main_header_text()}"
f"Expected: {ContributeMobileSupportMessages.HERO_PAGE_TITLE}",
)
with check, allure.step("Verifying that the Contribute Mobile Store page contains the "
"correct strings"):
assert self.sumo_pages.ways_to_contribute_pages._get_hero_main_header_text(
) == ContributeMobileSupportMessages.HERO_PAGE_TITLE
assert self.sumo_pages.ways_to_contribute_pages._get_hero_second_header(
) == ContributeMobileSupportMessages.HERO_SECOND_TITLE
assert self.sumo_pages.ways_to_contribute_pages._get_hero_text(
) == ContributeMobileSupportMessages.HERO_TEXT
assert self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_header_text(
) == ContributeMobileSupportMessages.HOW_TO_CONTRIBUTE_HEADER
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_hero_second_header(),
ContributeMobileSupportMessages.HERO_SECOND_TITLE,
f"Text is: "
f"{self.sumo_pages.ways_to_contribute_pages._get_hero_second_header()}"
f"Expected: {ContributeMobileSupportMessages.HERO_SECOND_TITLE}",
)
# Need to add a check for the logged in state as well.
# Excluding option four from the list since we are using a different locator
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_hero_text(),
ContributeMobileSupportMessages.HERO_TEXT,
f"Text is: {self.sumo_pages.ways_to_contribute_pages._get_hero_text()}"
f"Expected: {ContributeMobileSupportMessages.HERO_TEXT}",
)
card_titles = [
ContributeMobileSupportMessages.HOW_TO_CONTRIBUTE_OPTION_ONE_SIGNED_OUT,
ContributeMobileSupportMessages.HOW_TO_CONTRIBUTE_OPTION_TWO,
ContributeMobileSupportMessages.HOW_TO_CONTRIBUTE_OPTION_THREE,
ContributeMobileSupportMessages.HOW_TO_CONTRIBUTE_OPTION_FIVE,
]
assert self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_link_options(
) == card_titles
assert self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_option_four(
) == ContributeMobileSupportMessages.HOW_TO_CONTRIBUTE_OPTION_FOUR
assert self.sumo_pages.ways_to_contribute_pages._get_first_fact_text(
) == ContributeMobileSupportMessages.FACT_FIRST_LINE
assert self.sumo_pages.ways_to_contribute_pages._get_second_fact_text(
) == ContributeMobileSupportMessages.FACT_SECOND_LINE
assert self.sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_header(
) == ContributeMobileSupportMessages.OTHER_WAYS_TO_CONTRIBUTE_HEADER
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_header_text(),
ContributeMobileSupportMessages.HOW_TO_CONTRIBUTE_HEADER,
f"Text is: "
f"{self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_header_text()}"
f"Expected is: {ContributeMobileSupportMessages.HOW_TO_CONTRIBUTE_HEADER}",
)
# Need to add a check for the logged in state as well.
# Excluding option four from the list since we are using a different locator
card_titles = [
ContributeMobileSupportMessages.HOW_TO_CONTRIBUTE_OPTION_ONE_SIGNED_OUT,
ContributeMobileSupportMessages.HOW_TO_CONTRIBUTE_OPTION_TWO,
ContributeMobileSupportMessages.HOW_TO_CONTRIBUTE_OPTION_THREE,
ContributeMobileSupportMessages.HOW_TO_CONTRIBUTE_OPTION_FIVE,
]
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_link_options_text(),
card_titles,
"How you can contribute_messages steps are incorrect!",
)
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_option_four_text(),
ContributeMobileSupportMessages.HOW_TO_CONTRIBUTE_OPTION_FOUR,
f"Text is: "
f"{self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_option_four_text()}"
f"Expected is: "
f"{ContributeMobileSupportMessages.HOW_TO_CONTRIBUTE_OPTION_FOUR}",
)
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_first_fact_text(),
ContributeMobileSupportMessages.FACT_FIRST_LINE,
f"Text is: {self.sumo_pages.ways_to_contribute_pages._get_first_fact_text()}"
f"Expected is: {ContributeMobileSupportMessages.FACT_FIRST_LINE}",
)
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_second_fact_text(),
ContributeMobileSupportMessages.FACT_SECOND_LINE,
f"Text is: {self.sumo_pages.ways_to_contribute_pages._get_second_fact_text()}"
f"Expected is: {ContributeMobileSupportMessages.FACT_SECOND_LINE}",
)
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_header(),
ContributeMobileSupportMessages.OTHER_WAYS_TO_CONTRIBUTE_HEADER,
f"Text is: "
f"{self.sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_header()}"
f"Expected is: "
f"{ContributeMobileSupportMessages.OTHER_WAYS_TO_CONTRIBUTE_HEADER}",
)
other_ways_to_contribute_card_titles = [
ContributeMobileSupportMessages.ANSWER_QUESTIONS_IN_SUPPORT_FORUM_TITLE_CARD_TITLE,
ContributeMobileSupportMessages.WRITE_HELP_ARTICLES_CARD_TITLE,
ContributeMobileSupportMessages.LOCALIZE_CONTENT_CARD_TITLE,
ContributeMobileSupportMessages.PROVIDE_SUPPORT_ON_SOCIAL_CHANNELS_CARD_TITLE,
]
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_card_title(),
other_ways_to_contribute_card_titles,
"Other ways to contribute_messages card titles are not the correct ones!",
)
other_ways_to_contribute_card_titles = [
ContributeMobileSupportMessages.ANSWER_QUESTIONS_IN_SUPPORT_FORUM_TITLE_CARD_TITLE,
ContributeMobileSupportMessages.WRITE_HELP_ARTICLES_CARD_TITLE,
ContributeMobileSupportMessages.LOCALIZE_CONTENT_CARD_TITLE,
ContributeMobileSupportMessages.PROVIDE_SUPPORT_ON_SOCIAL_CHANNELS_CARD_TITLE,
]
assert self.sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_cards(
) == other_ways_to_contribute_card_titles
# C2176366
@pytest.mark.contributePagesTests
def test_contribute_mobile_page_images_are_not_broken(self):
self.logger.info("Accessing the Contribute Mobile store page")
self.navigate_to_link(
ContributeMobileSupportMessages.STAGE_CONTRIBUTE_MOBILE_SUPPORT_PAGE_URL
)
with allure.step("Accessing the Contribute Mobile store page"):
self.navigate_to_link(
ContributeMobileSupportMessages.STAGE_CONTRIBUTE_MOBILE_SUPPORT_PAGE_URL
)
self.logger.info("Verifying that the Contribute Mobile store page images are not broken")
for link in self.sumo_pages.ways_to_contribute_pages._get_all_page_image_links():
image_link = link.get_attribute("src")
response = requests.get(image_link, stream=True)
check.is_true(response.status_code < 400, f"The {image_link} image is broken")
with check, allure.step(f"Verifying that the {image_link} image is not broken"):
assert response.status_code < 400
# C2176367
@pytest.mark.contributePagesTests
def test_contribute_mobile_page_breadcrumbs(self):
self.logger.info("Accessing the Contribute Mobile Store page")
self.navigate_to_link(
ContributeMobileSupportMessages.STAGE_CONTRIBUTE_MOBILE_SUPPORT_PAGE_URL
)
with allure.step("Accessing the Contribute Mobile Store page"):
self.navigate_to_link(
ContributeMobileSupportMessages.STAGE_CONTRIBUTE_MOBILE_SUPPORT_PAGE_URL
)
self.logger.info("Verifying that the correct breadcrumbs are displayed")
breadcrumbs = [
ContributeMobileSupportMessages.FIRST_BREADCRUMB,
ContributeMobileSupportMessages.SECOND_BREADCRUMB,
ContributeMobileSupportMessages.THIRD_BREADCRUMB,
]
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_text_of_all_breadcrumbs(),
breadcrumbs,
f"Breadcrumbs are: "
f"{self.sumo_pages.ways_to_contribute_pages._get_text_of_all_breadcrumbs()}"
f"Expected: {breadcrumbs}",
)
with check, allure.step("Verifying that the correct breadcrumbs are displayed"):
assert self.sumo_pages.ways_to_contribute_pages._get_text_of_all_breadcrumbs(
) == breadcrumbs
counter = 1
for breadcrumb in self.sumo_pages.ways_to_contribute_pages._get_interactable_breadcrumbs():
@ -166,40 +108,26 @@ class TestContributeMobilePage(TestUtilities):
self.sumo_pages.ways_to_contribute_pages._click_on_breadcrumb(breadcrumb_to_click)
if counter == 1:
self.logger.info(
"Verifying that the Contribute breadcrumb redirects to the Contribute page"
)
check.equal(
self.get_page_url(),
ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL,
f"Expected to be on {ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL}"
f"We are actual on {self.get_page_url()}",
)
with check, allure.step("Verifying that the Contribute breadcrumb redirects to "
"the Contribute page"):
assert self.get_page_url() == ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL
self.navigate_forward()
counter -= 1
elif counter == 0:
self.logger.info("Verifying that the Home breadcrumb redirects to the Homepage")
check.equal(
self.get_page_url(),
HomepageMessages.STAGE_HOMEPAGE_URL_EN_US,
f"Expected to be on {HomepageMessages.STAGE_HOMEPAGE_URL_EN_US}"
f"We are actual on {self.get_page_url()}",
)
with check, allure.step("Verifying that the Home breadcrumb redirects to the "
"Homepage"):
assert self.get_page_url() == HomepageMessages.STAGE_HOMEPAGE_URL_EN_US
# Need to add tests for "How you can contribute_messages" section
# C2176370
@pytest.mark.contributePagesTests
def test_contribute_mobile_other_ways_to_contribute_redirect_to_the_correct_page(self):
self.logger.info("Accessing the Contribute Mobile Store page")
self.navigate_to_link(
ContributeMobileSupportMessages.STAGE_CONTRIBUTE_MOBILE_SUPPORT_PAGE_URL
)
with allure.step("Accessing the Contribute Mobile Store page"):
self.navigate_to_link(
ContributeMobileSupportMessages.STAGE_CONTRIBUTE_MOBILE_SUPPORT_PAGE_URL
)
self.logger.info(
"Verifying that the 'other ways to contribute_messages' "
"cards are redirecting to the correct SUMO page"
)
ways_to_contribute_links = [
ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL,
ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL,
@ -209,7 +137,7 @@ class TestContributeMobilePage(TestUtilities):
counter = 0
for (
element
element
) in self.sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_card_list():
card = (
self.sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_card_list()[
@ -217,11 +145,8 @@ class TestContributeMobilePage(TestUtilities):
]
)
self.sumo_pages.ways_to_contribute_pages._click_on_other_way_to_contribute_card(card)
check.equal(
ways_to_contribute_links[counter],
self.get_page_url(),
f"Expected the following URL: {ways_to_contribute_links[counter]}"
f"Received: {self.get_page_url()}",
)
with check, allure.step("Verifying that the 'other ways to contribute_messages' "
"cards are redirecting to the correct SUMO page"):
assert ways_to_contribute_links[counter] == self.get_page_url()
self.navigate_back()
counter += 1

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

@ -1,5 +1,6 @@
import allure
import pytest
import pytest_check as check
from pytest_check import check
import requests
from playwright_tests.core.testutilities import TestUtilities
@ -23,50 +24,30 @@ class TestContributePage(TestUtilities):
# C2165413
@pytest.mark.contributePagesTests
def test_contribute_page_text(self):
self.logger.info("Clicking on the Contribute top-navbar option")
self.sumo_pages.top_navbar._click_on_contribute_top_navbar_option()
with allure.step("Clicking on the Contribute top-navbar option"):
self.sumo_pages.top_navbar._click_on_contribute_top_navbar_option()
self.logger.info("Verifying that the correct page hero header text is displayed")
check.equal(
self.sumo_pages.contribute_page._get_page_hero_main_header_text(),
ContributePageMessages.HERO_MAIN_PAGE_TITLE,
f"Text is: {self.sumo_pages.contribute_page._get_page_hero_main_header_text()} "
f"Expected: {ContributePageMessages.HERO_MAIN_PAGE_TITLE}"
)
with check, allure.step("Verifying that the correct page hero header text is displayed"):
assert self.sumo_pages.contribute_page._get_page_hero_main_header_text(
) == ContributePageMessages.HERO_MAIN_PAGE_TITLE
self.logger.info("Verifying that the correct page hero need help subtext is displayed")
check.equal(
self.sumo_pages.contribute_page._get_page_hero_main_subtext(),
ContributePageMessages.HERO_HELP_MILLION_OF_USERS_TEXT,
f"Text is: {self.sumo_pages.contribute_page._get_page_hero_main_subtext()} "
f"Expected: {ContributePageMessages.HERO_HELP_MILLION_OF_USERS_TEXT}",
)
with check, allure.step("Verifying that the correct page hero need help subtext is "
"displayed"):
assert self.sumo_pages.contribute_page._get_page_hero_main_subtext(
) == ContributePageMessages.HERO_HELP_MILLION_OF_USERS_TEXT
self.logger.info("Verifying that the correct need help header text is displayed")
check.equal(
self.sumo_pages.contribute_page._get_page_hero_need_help_header_text(),
ContributePageMessages.HERO_NEED_YOUR_HELP_TITLE,
f"Text is: "
f"{self.sumo_pages.contribute_page._get_page_hero_need_help_header_text()}"
f" Expected: {ContributePageMessages.HERO_NEED_YOUR_HELP_TITLE}",
)
with check, allure.step("Verifying that the correct need help header text is displayed"):
assert self.sumo_pages.contribute_page._get_page_hero_need_help_header_text(
) == ContributePageMessages.HERO_NEED_YOUR_HELP_TITLE
self.logger.info("Verifying that the correct need help subtext is displayed")
check.equal(
self.sumo_pages.contribute_page._get_page_hero_need_help_subtext(),
ContributePageMessages.HERO_NEED_YOUR_HELP_PARAGRAPH,
f"Text is: {self.sumo_pages.contribute_page._get_page_hero_need_help_subtext()}."
f"Expected: {ContributePageMessages.HERO_NEED_YOUR_HELP_PARAGRAPH}",
)
with check, allure.step("Verifying that the correct need help subtext is displayed"):
assert self.sumo_pages.contribute_page._get_page_hero_need_help_subtext(
) == ContributePageMessages.HERO_NEED_YOUR_HELP_PARAGRAPH
self.logger.info("Verifying that the correct get way to contribute_messages header is "
"displayed")
check.equal(
self.sumo_pages.contribute_page._get_way_to_contribute_header_text(),
ContributePageMessages.PICK_A_WAY_TO_CONTRIBUTE_HEADER,
f"Text is: {self.sumo_pages.contribute_page._get_way_to_contribute_header_text()}"
f"Expected: {ContributePageMessages.PICK_A_WAY_TO_CONTRIBUTE_HEADER}",
)
with check, allure.step("Verifying that the correct get way to contribute_messages "
"header is displayed"):
assert self.sumo_pages.contribute_page._get_way_to_contribute_header_text(
) == ContributePageMessages.PICK_A_WAY_TO_CONTRIBUTE_HEADER
card_titles = [
ContributePageMessages.ANSWER_QUESTIONS_CARD_TITLE,
@ -76,75 +57,53 @@ class TestContributePage(TestUtilities):
ContributePageMessages.RESPOND_TO_MOBILE_STORE_REVIEWS_CARD_TITLE,
]
self.logger.info("Verifying that the correct list of ways to contribute_messages card "
"titles is displayed")
check.equal(
card_titles,
self.sumo_pages.contribute_page._get_way_to_contribute_card_titles_text(),
"Pick a way to contribute_messages card titles are not the correct ones",
)
with check, allure.step("Verifying that the correct list of ways to contribute_messages "
"card titles is displayed"):
assert card_titles == self.sumo_pages.contribute_page._get_way_to_contribute_cards()
self.logger.info("Verifying that the correct about us header text is displayed")
check.equal(
self.sumo_pages.contribute_page._get_about_us_header_text(),
ContributePageMessages.ABOUT_US_HEADER,
f"Text is: {self.sumo_pages.contribute_page._get_about_us_header_text()}"
f"Expected: {ContributePageMessages.ABOUT_US_HEADER}",
)
with check, allure.step("Verifying that the correct about us header text is displayed"):
assert self.sumo_pages.contribute_page._get_about_us_header_text(
) == ContributePageMessages.ABOUT_US_HEADER
self.logger.info("Verifying that the correct about us subtext is displayed")
check.equal(
self.sumo_pages.contribute_page._get_about_us_subtext(),
ContributePageMessages.ABOUT_US_CONTENT,
f"Text is: {self.sumo_pages.contribute_page._get_about_us_subtext()}"
f"Expected: {ContributePageMessages.ABOUT_US_CONTENT}",
)
with check, allure.step("Verifying that the correct about us subtext is displayed"):
assert self.sumo_pages.contribute_page._get_about_us_subtext(
) == ContributePageMessages.ABOUT_US_CONTENT
# C2165413
@pytest.mark.contributePagesTests
def test_contribute_page_images_are_not_broken(self):
self.logger.info("Clicking on the 'Contribute' top-navbar option")
self.sumo_pages.top_navbar._click_on_contribute_top_navbar_option()
self.logger.info("Verifying that the contribute_messages page images are not broken")
with allure.step("Clicking on the 'Contribute' top-navbar option"):
self.sumo_pages.top_navbar._click_on_contribute_top_navbar_option()
for link in self.sumo_pages.contribute_page._get_all_page_links():
image_link = link.get_attribute("src")
response = requests.get(image_link, stream=True)
check.is_true(response.status_code < 400, f'The {image_link} image is broken!')
with check, allure.step(f"Verifying that the {image_link} image is not broken"):
assert response.status_code < 400
# C1949333
@pytest.mark.contributePagesTests
def test_contribute_page_breadcrumbs(self):
self.logger.info("Clicking on the Contribute top-navbar option")
self.sumo_pages.top_navbar._click_on_contribute_top_navbar_option()
with allure.step("Clicking on the Contribute top-navbar option"):
self.sumo_pages.top_navbar._click_on_contribute_top_navbar_option()
breadcrumbs = [
ContributePageMessages.FIRST_BREADCRUMB,
ContributePageMessages.SECOND_BREADCRUMB,
]
self.logger.info("Verifying that the correct breadcrumbs are displayed")
check.equal(
self.sumo_pages.contribute_page._get_breadcrumbs_text(),
breadcrumbs,
f"Breadcrumbs are: {self.sumo_pages.contribute_page._get_breadcrumbs_text()}"
f"Expected to be: {breadcrumbs}",
)
with check, allure.step("Verifying that the correct breadcrumbs are displayed"):
assert self.sumo_pages.contribute_page._get_breadcrumbs_text() == breadcrumbs
self.logger.info("Verifying that the home breadcrumb redirects to the homepage")
self.sumo_pages.contribute_page._click_on_home_breadcrumb()
assert self.get_page_url() == HomepageMessages.STAGE_HOMEPAGE_URL_EN_US, (
f"{HomepageMessages.STAGE_HOMEPAGE_URL_EN_US} page was expected to be displayed"
f"{self.get_page_url()} is displayed instead"
)
with allure.step("Verifying that the home breadcrumb redirects to the homepage"):
self.sumo_pages.contribute_page._click_on_home_breadcrumb()
assert self.get_page_url() == HomepageMessages.STAGE_HOMEPAGE_URL_EN_US
# C1949335,C1949336,C1949337,C1949338,C1949339,C1949355
@pytest.mark.contributePagesTests
def test_way_to_contribute_redirects_to_correct_page(self):
self.logger.info("Clicking on the Contribute top-navbar option")
self.sumo_pages.top_navbar._click_on_contribute_top_navbar_option()
with allure.step("Clicking on the Contribute top-navbar option"):
self.sumo_pages.top_navbar._click_on_contribute_top_navbar_option()
ways_to_contribute_links = [
ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL,
@ -154,20 +113,12 @@ class TestContributePage(TestUtilities):
ContributeMobileSupportMessages.STAGE_CONTRIBUTE_MOBILE_SUPPORT_PAGE_URL,
]
self.logger.info(
"Verifying that the 'way to contribute_messages' cards are redirecting to the "
"correct SUMO page"
)
counter = 0
for element in self.sumo_pages.contribute_page._get_list_of_contribute_cards():
card = self.sumo_pages.contribute_page._get_list_of_contribute_cards()[counter]
self.sumo_pages.contribute_page._click_on_way_to_contribute_card(card)
check.equal(
ways_to_contribute_links[counter],
self.get_page_url(),
f"Expected the following URL: {ways_to_contribute_links[counter]}"
f"Received: {self.get_page_url()}",
)
with check, allure.step("Verifying that the 'way to contribute_messages' cards are "
"redirecting to the correct SUMO page"):
assert ways_to_contribute_links[counter] == self.get_page_url()
self.navigate_back()
counter += 1

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

@ -1,5 +1,6 @@
import allure
import pytest
import pytest_check as check
from pytest_check import check
import requests
from playwright_tests.core.testutilities import TestUtilities
@ -22,47 +23,27 @@ class TestContributeSocialMediaPage(TestUtilities):
# C2176361
@pytest.mark.contributePagesTests
def test_contribute_social_page_text(self):
self.logger.info("Accessing the Contribute Social Channels page")
self.navigate_to_link(
ContributeSocialSupportMessages.STAGE_CONTRIBUTE_SOCIAL_SUPPORT_PAGE_URL
)
with allure.step("Accessing the Contribute Social Channels page"):
self.navigate_to_link(
ContributeSocialSupportMessages.STAGE_CONTRIBUTE_SOCIAL_SUPPORT_PAGE_URL
)
self.logger.info(
"Verifying that the correct hero main header is displayed"
)
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_hero_main_header_text(),
ContributeSocialSupportMessages.HERO_PAGE_TITLE,
f"Actual: {self.sumo_pages.ways_to_contribute_pages._get_hero_main_header_text()}"
f"Expected: {ContributeSocialSupportMessages.HERO_PAGE_TITLE}",
)
with check, allure.step("Verifying that the correct hero main header is displayed"):
assert self.sumo_pages.ways_to_contribute_pages._get_hero_main_header_text(
) == ContributeSocialSupportMessages.HERO_PAGE_TITLE
self.logger.info("Verifying that the correct hero second header is displayed")
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_hero_second_header(),
ContributeSocialSupportMessages.HERO_SECOND_TITLE,
f"Text is: "
f"{self.sumo_pages.ways_to_contribute_pages._get_hero_second_header()}"
f"Expected: {ContributeSocialSupportMessages.HERO_SECOND_TITLE}",
)
with check, allure.step("Verifying that the correct hero second header is displayed"):
assert self.sumo_pages.ways_to_contribute_pages._get_hero_second_header(
) == ContributeSocialSupportMessages.HERO_SECOND_TITLE
self.logger.info("Verifying that the correct get hero text is displayed")
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_hero_text(),
ContributeSocialSupportMessages.HERO_TEXT,
f"Text is: {self.sumo_pages.ways_to_contribute_pages._get_hero_text()}"
f"Expected: {ContributeSocialSupportMessages.HERO_TEXT}",
)
with check, allure.step("Verifying that the correct get hero text is displayed"):
assert self.sumo_pages.ways_to_contribute_pages._get_hero_text(
) == ContributeSocialSupportMessages.HERO_TEXT
self.logger.info("Verifying that the correct how to contribute_messages header text is "
"displayed")
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_header_text(),
ContributeSocialSupportMessages.HOW_TO_CONTRIBUTE_HEADER,
f"Text is: "
f"{self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_header_text()}"
f"Expected is: {ContributeSocialSupportMessages.HOW_TO_CONTRIBUTE_HEADER}",
)
with check, allure.step("Verifying that the correct how to contribute_messages header "
"text is displayed"):
assert self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_header_text(
) == ContributeSocialSupportMessages.HOW_TO_CONTRIBUTE_HEADER
# Need to add a check for the logged in state as well.
# Excluding option four from the list since we are using a different locator
@ -74,50 +55,27 @@ class TestContributeSocialMediaPage(TestUtilities):
ContributeSocialSupportMessages.HOW_TO_CONTRIBUTE_OPTION_FIVE,
]
self.logger.info("Verifying that the correct how to contribute_messages link option are "
"displayed")
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_link_options_text(),
card_titles,
"How you can contribute_messages steps are incorrect!",
)
with check, allure.step("Verifying that the correct how to contribute_messages link "
"option are displayed"):
assert self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_link_options(
) == card_titles
self.logger.info("Verifying that the correct option four text is displayed")
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_option_four_text(),
ContributeSocialSupportMessages.HOW_TO_CONTRIBUTE_OPTION_FOUR,
f"Text is: "
f"{self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_option_four_text()}"
f"Expected is: "
f"{ContributeSocialSupportMessages.HOW_TO_CONTRIBUTE_OPTION_FOUR}",
)
with check, allure.step("Verifying that the correct option four text is displayed"):
assert self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_option_four(
) == ContributeSocialSupportMessages.HOW_TO_CONTRIBUTE_OPTION_FOUR
self.logger.info("Verifying that the correct page first fact text is displayed")
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_first_fact_text(),
ContributeSocialSupportMessages.FACT_FIRST_LINE,
f"Text is: {self.sumo_pages.ways_to_contribute_pages._get_first_fact_text()}"
f"Expected is: {ContributeSocialSupportMessages.FACT_FIRST_LINE}",
)
with check, allure.step("Verifying that the correct page first fact text is displayed"):
assert self.sumo_pages.ways_to_contribute_pages._get_first_fact_text(
) == ContributeSocialSupportMessages.FACT_FIRST_LINE
self.logger.info("Verifying that the correct second fact text is displayed")
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_second_fact_text(),
ContributeSocialSupportMessages.FACT_SECOND_LINE,
f"Text is: {self.sumo_pages.ways_to_contribute_pages._get_second_fact_text()}"
f"Expected is: {ContributeSocialSupportMessages.FACT_SECOND_LINE}",
)
with check, allure.step("Verifying that the correct second fact text is displayed"):
assert self.sumo_pages.ways_to_contribute_pages._get_second_fact_text(
) == ContributeSocialSupportMessages.FACT_SECOND_LINE
self.logger.info("Verifying that the correct get other ways to contribute_messages "
"header is displayed")
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_header(),
ContributeSocialSupportMessages.OTHER_WAYS_TO_CONTRIBUTE_HEADER,
f"Text is: "
f"{self.sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_header()}"
f"Expected is: "
f"{ContributeSocialSupportMessages.OTHER_WAYS_TO_CONTRIBUTE_HEADER}",
)
with check, allure.step("Verifying that the correct get other ways to "
"contribute_messages header is displayed"):
assert self.sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_header(
) == ContributeSocialSupportMessages.OTHER_WAYS_TO_CONTRIBUTE_HEADER
other_ways_to_contribute_card_titles = [
ContributeSocialSupportMessages.ANSWER_QUESTIONS_IN_SUPPORT_FORUM_TITLE,
@ -126,51 +84,42 @@ class TestContributeSocialMediaPage(TestUtilities):
ContributeSocialSupportMessages.RESPOND_TO_MOBILE_STORE_REVIEWS_CARD_TITLE,
]
self.logger.info("Verifying that the other ways to contribute_messages card titles are "
"the correct ones")
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_card_title(),
other_ways_to_contribute_card_titles,
"Other ways to contribute_messages card titles are not the correct ones!",
)
with check, allure.step("Verifying that the other ways to contribute_messages card "
"titles are the correct ones"):
assert self.sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_cards(
) == other_ways_to_contribute_card_titles
# C2176361
@pytest.mark.contributePagesTests
def test_contribute_social_page_images_are_not_broken(self):
self.logger.info("Accessing the Contribute Forum page")
self.navigate_to_link(
ContributeSocialSupportMessages.STAGE_CONTRIBUTE_SOCIAL_SUPPORT_PAGE_URL
)
self.logger.info("Verifying that the Contribute forum page images are not broken")
with allure.step("Accessing the Contribute Forum page"):
self.navigate_to_link(
ContributeSocialSupportMessages.STAGE_CONTRIBUTE_SOCIAL_SUPPORT_PAGE_URL
)
for link in self.sumo_pages.ways_to_contribute_pages._get_all_page_image_links():
image_link = link.get_attribute("src")
response = requests.get(image_link, stream=True)
check.is_true(response.status_code < 400, f"The {image_link} image is broken")
with check, allure.step(f"Verifying that the {image_link} image is not broken"):
assert response.status_code < 400
# C2176362
@pytest.mark.contributePagesTests
def test_contribute_social_page_breadcrumbs(self):
self.logger.info("Accessing the Contribute Forum page")
self.navigate_to_link(
ContributeSocialSupportMessages.STAGE_CONTRIBUTE_SOCIAL_SUPPORT_PAGE_URL
)
with allure.step("Accessing the Contribute Forum page"):
self.navigate_to_link(
ContributeSocialSupportMessages.STAGE_CONTRIBUTE_SOCIAL_SUPPORT_PAGE_URL
)
self.logger.info("Verifying that the correct breadcrumbs are displayed")
breadcrumbs = [
ContributeSocialSupportMessages.FIRST_BREADCRUMB,
ContributeSocialSupportMessages.SECOND_BREADCRUMB,
ContributeSocialSupportMessages.THIRD_BREADCRUMB,
]
check.equal(
self.sumo_pages.ways_to_contribute_pages._get_text_of_all_breadcrumbs(),
breadcrumbs,
f"Breadcrumbs are: "
f"{self.sumo_pages.ways_to_contribute_pages._get_text_of_all_breadcrumbs()}"
f"Expected: {breadcrumbs}",
)
with check, allure.step("Verifying that the correct breadcrumbs are displayed"):
assert self.sumo_pages.ways_to_contribute_pages._get_text_of_all_breadcrumbs(
) == breadcrumbs
counter = 1
for breadcrumb in self.sumo_pages.ways_to_contribute_pages._get_interactable_breadcrumbs():
@ -180,40 +129,25 @@ class TestContributeSocialMediaPage(TestUtilities):
self.sumo_pages.ways_to_contribute_pages._click_on_breadcrumb(breadcrumb_to_click)
if counter == 1:
self.logger.info(
"Verifying that the Contribute breadcrumb redirects to the Contribute page"
)
check.equal(
self.get_page_url(),
ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL,
f"Expected to be on {ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL}"
f"We are actual on {self.get_page_url()}",
)
with check, allure.step("Verifying that the Contribute breadcrumb redirects to "
"the Contribute page"):
assert self.get_page_url() == ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL
self.navigate_forward()
counter -= 1
elif counter == 0:
self.logger.info("Verifying that the Home breadcrumb redirects to the Homepage")
check.equal(
self.get_page_url(),
HomepageMessages.STAGE_HOMEPAGE_URL_EN_US,
f"Expected to be on {HomepageMessages.STAGE_HOMEPAGE_URL_EN_US}"
f"We are actual on {self.get_page_url()}",
)
with check, allure.step("Verifying that the Home breadcrumb redirects to the "
"Homepage"):
assert self.get_page_url() == HomepageMessages.STAGE_HOMEPAGE_URL_EN_US
# Need to add tests for "How you can contribute_messages" section
# C2176364
@pytest.mark.contributePagesTests
def test_contribute_social_other_ways_to_contribute_redirect_to_the_correct_page(self):
self.logger.info("Accessing the Contribute Forum page")
self.navigate_to_link(
ContributeSocialSupportMessages.STAGE_CONTRIBUTE_SOCIAL_SUPPORT_PAGE_URL
)
self.logger.info(
"Verifying that the 'other ways to contribute_messages' "
"cards are redirecting to the correct SUMO page"
)
with allure.step("Accessing the Contribute Forum page"):
self.navigate_to_link(
ContributeSocialSupportMessages.STAGE_CONTRIBUTE_SOCIAL_SUPPORT_PAGE_URL
)
ways_to_contribute_links = [
ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL,
@ -224,7 +158,7 @@ class TestContributeSocialMediaPage(TestUtilities):
counter = 0
for (
element
element
) in self.sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_card_list():
card = (
self.sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_card_list()[
@ -232,11 +166,8 @@ class TestContributeSocialMediaPage(TestUtilities):
]
)
self.sumo_pages.ways_to_contribute_pages._click_on_other_way_to_contribute_card(card)
check.equal(
ways_to_contribute_links[counter],
self.get_page_url(),
f"Expected the following URL: {ways_to_contribute_links[counter]}"
f"Received: {self.get_page_url()}",
)
with check, allure.step("Verifying that the 'other ways to contribute_messages'n "
"cards are redirecting to the correct SUMO page"):
assert ways_to_contribute_links[counter] == self.get_page_url()
self.navigate_back()
counter += 1

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -1,5 +1,6 @@
import allure
import pytest
import pytest_check as check
from pytest_check import check
from playwright.sync_api import expect
from playwright_tests.core.testutilities import TestUtilities
from playwright_tests.messages.explore_help_articles.kb_article_revision_page_messages import (
@ -13,576 +14,450 @@ class TestRecentRevisionsDashboard(TestUtilities):
# C2499112
@pytest.mark.recentRevisionsDashboard
def test_recent_revisions_revision_availability(self):
self.logger.info("Signing in with a non-Admin account")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts['TEST_ACCOUNT_12']
))
with allure.step("Signing in with a non-admin account"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts['TEST_ACCOUNT_12']
))
username = self.sumo_pages.top_navbar._get_text_of_logged_in_username()
self.logger.info("Create a new simple article")
article_details = self.sumo_pages.submit_kb_article_flow.submit_simple_kb_article()
with allure.step("Creating a new kb article"):
article_details = self.sumo_pages.submit_kb_article_flow.submit_simple_kb_article()
article_url = self.get_page_url()
self.logger.info("Navigating to the recent revisions dashboard")
self.sumo_pages.top_navbar._click_on_recent_revisions_option()
with allure.step("Navigating to the recent revisions dashboard and verifying that the "
"posted article is displayed for admin accounts"):
self.sumo_pages.top_navbar._click_on_recent_revisions_option()
expect(
self.sumo_pages.recent_revisions_page._get_recent_revision_based_on_article(
article_details['article_title']
)
).to_be_visible()
self.logger.info("Verifying that the posted article is displayed for admin accounts")
expect(
self.sumo_pages.recent_revisions_page._get_recent_revision_based_on_article_locator(
article_details['article_title']
with allure.step("Deleting the user session and verifying that the revision is not "
"displayed for signed out users"):
self.delete_cookies()
expect(
self.sumo_pages.recent_revisions_page._get_recent_revision_based_on_article(
article_details['article_title']
)
).to_be_hidden()
with allure.step("Typing the article creator username inside the 'Users' field and "
"verifying that the article is not displayed"):
self.sumo_pages.recent_revisions_page._fill_in_users_field(username)
self.wait_for_given_timeout(2000)
expect(
self.sumo_pages.recent_revisions_page._get_recent_revision_based_on_article(
article_details['article_title']
)
).to_be_hidden()
with allure.step("Clearing the user search field and signing in with a different "
"non-admin account"):
self.sumo_pages.recent_revisions_page._clearing_the_user_field()
self.username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MESSAGE_6"]
)
).to_be_visible()
self.logger.info("Deleting user session and verifying that the revision is not displayed")
self.delete_cookies()
with allure.step("Verifying that the revision is not displayed for non-admin accounts"):
expect(
self.sumo_pages.recent_revisions_page._get_recent_revision_based_on_article(
article_details['article_title']
)
).to_be_hidden()
expect(
self.sumo_pages.recent_revisions_page._get_recent_revision_based_on_article_locator(
article_details['article_title']
)
).to_be_hidden()
with allure.step("Typing the article creator username inside the 'Users' field and "
"verifying that the article is not displayed"):
self.sumo_pages.recent_revisions_page._fill_in_users_field(username)
self.wait_for_given_timeout(2000)
expect(
self.sumo_pages.recent_revisions_page._get_recent_revision_based_on_article(
article_details['article_title']
)
).to_be_hidden()
self.logger.info("Typing the article creator username inside the 'Users' field and "
"verifying that the article is not displayed")
self.sumo_pages.recent_revisions_page._fill_in_users_field(username)
with allure.step("Clearing the user search field and signing in back with the admin "
"account"):
self.sumo_pages.recent_revisions_page._clearing_the_user_field()
self.logger.info("Signing back in with the admin account")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
self.wait_for_given_timeout(2000)
with allure.step("Navigating to the article page and deleting it"):
self.navigate_to_link(article_url)
self.sumo_pages.kb_article_deletion_flow.delete_kb_article()
expect(
self.sumo_pages.recent_revisions_page._get_recent_revision_based_on_article_locator(
article_details['article_title']
)
).to_be_hidden()
self.logger.info("Clearing the user search field")
self.sumo_pages.recent_revisions_page._clearing_the_user_field()
self.logger.info("Signing in with a different user account")
self.username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MESSAGE_6"]
)
self.logger.info("Verifying that the revision is not displayed")
expect(
self.sumo_pages.recent_revisions_page._get_recent_revision_based_on_article_locator(
article_details['article_title']
)
).to_be_hidden()
self.logger.info("Typing the article creator username inside the 'Users' field and "
"verifying that the article is not displayed")
self.sumo_pages.recent_revisions_page._fill_in_users_field(username)
self.wait_for_given_timeout(2000)
expect(
self.sumo_pages.recent_revisions_page._get_recent_revision_based_on_article_locator(
article_details['article_title']
)
).to_be_hidden()
self.logger.info("Clearing the user search field")
self.sumo_pages.recent_revisions_page._clearing_the_user_field()
self.logger.info("Signing back in with the admin account")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
self.logger.info("Navigating to the article page and deleting it")
self.navigate_to_link(article_url)
self.sumo_pages.kb_article_show_history_page._click_on_delete_this_document_button()
self.sumo_pages.kb_article_show_history_page._click_on_confirmation_delete_button()
self.logger.info("Navigating back to the recent revisions page and verifying that the "
"article is no longer displayed")
self.logger.info("Navigating to the recent revisions dashboard")
self.sumo_pages.top_navbar._click_on_recent_revisions_option()
self.logger.info("Verifying that the posted article is no longer displayed for admin "
"accounts")
expect(
self.sumo_pages.recent_revisions_page._get_recent_revision_based_on_article_locator(
article_details['article_title']
)
).to_be_hidden()
with allure.step("Navigating back to the recent revisions page and verifying that the "
"article is no longer displayed"):
self.sumo_pages.top_navbar._click_on_recent_revisions_option()
expect(
self.sumo_pages.recent_revisions_page._get_recent_revision_based_on_article(
article_details['article_title']
)
).to_be_hidden()
# C2266240
@pytest.mark.recentRevisionsDashboard
def test_second_revisions_availability(self):
self.logger.info("Signing back in with the admin account")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Signing back in with the admin account"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
self.logger.info("Create a new simple article")
article_details = self.sumo_pages.submit_kb_article_flow.submit_simple_kb_article()
with allure.step("Creating a new kb article"):
article_details = self.sumo_pages.submit_kb_article_flow.submit_simple_kb_article()
article_url = self.get_page_url()
revision_id = self.sumo_pages.kb_article_show_history_page._get_last_revision_id()
self.logger.info("Clicking on the 'Review' option")
self.sumo_pages.kb_article_show_history_page._click_on_review_revision(
revision_id
)
with allure.step("Approving the article revision"):
self.sumo_pages.kb_article_revision_flow.approve_kb_revision(revision_id)
self.logger.info("Click on 'Approve Revision' button")
self.sumo_pages.kb_article_review_revision_page._click_on_approve_revision_button()
self.logger.info("Clicking on the 'Accept' button")
self.sumo_pages.kb_article_review_revision_page._click_accept_revision_accept_button()
self.logger.info("Signing in with a non admin account")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_13"]
))
with allure.step("Signing in with a non-admin account"):
self.logger.info("Signing in with a non admin account")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_13"]
))
username = self.sumo_pages.top_navbar._get_text_of_logged_in_username()
self.logger.info("Creating a new revision for the article")
second_revision_details = self.sumo_pages.kb_article_revision_flow.submit_new_kb_revision()
with allure.step("Creating a new revision for the article"):
second_revision = self.sumo_pages.kb_article_revision_flow.submit_new_kb_revision()
self.logger.info("Navigating to the Recent Revisions dashboard and verifying that own "
"revision is visible")
self.sumo_pages.top_navbar._click_on_recent_revisions_option()
expect(
self.sumo_pages.recent_revisions_page.
_get_recent_revision_based_on_article_title_and_user(
article_details['article_title'], username
with allure.step("Navigating to the Recent Revisions dashboard and verifying that own "
"revision is visible"):
self.sumo_pages.top_navbar._click_on_recent_revisions_option()
expect(
self.sumo_pages.recent_revisions_page.
_get_recent_revision_based_on_article_title_and_user(
article_details['article_title'], username
)
).to_be_visible()
with allure.step("Deleting user session and verifying that the recent revision is "
"displayed"):
self.delete_cookies()
expect(
self.sumo_pages.recent_revisions_page.
_get_recent_revision_based_on_article_title_and_user(
article_details['article_title'], username
)
).to_be_visible()
with allure.step("Signing in with a different non-admin user and verifying that the "
"revision is displayed"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MESSAGE_6"]
))
expect(
self.sumo_pages.recent_revisions_page.
_get_recent_revision_based_on_article_title_and_user(
article_details['article_title'], username
)
).to_be_visible()
with allure.step("Signing in with an admin account and verifying that the revision is "
"displayed"):
self.delete_cookies()
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
expect(
self.sumo_pages.recent_revisions_page.
_get_recent_revision_based_on_article_title_and_user(
article_details['article_title'], username
)
).to_be_visible()
with allure.step("Navigating to the article and approving the revision"):
self.navigate_to_link(article_url)
self.sumo_pages.kb_article_revision_flow.approve_kb_revision(
second_revision['revision_id']
)
).to_be_visible()
self.wait_for_given_timeout(1000)
self.logger.info("Deleting user session and verifying that the recent revision is "
"displayed")
self.delete_cookies()
expect(
self.sumo_pages.recent_revisions_page.
_get_recent_revision_based_on_article_title_and_user(
article_details['article_title'], username
)
).to_be_visible()
with allure.step("Signing out and verifying that the revision is displayed inside the "
"Recent Revisions dashboard"):
self.delete_cookies()
self.navigate_to_link(self.general_test_data['dashboard_links']['recent_revisions'])
expect(
self.sumo_pages.recent_revisions_page.
_get_recent_revision_based_on_article_title_and_user(
article_details['article_title'], username
)
).to_be_visible()
self.logger.info("Signing in with a different non-admin user and verifying that the "
"revision is displayed")
self.username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MESSAGE_6"]
)
expect(
self.sumo_pages.recent_revisions_page.
_get_recent_revision_based_on_article_title_and_user(
article_details['article_title'], username
)
).to_be_visible()
with allure.step("Signing in with a different non-admin user account and verifying that "
"the revision is visible"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MESSAGE_6"]
))
expect(
self.sumo_pages.recent_revisions_page.
_get_recent_revision_based_on_article_title_and_user(
article_details['article_title'], username
)
).to_be_visible()
self.logger.info("Signing in with an admin account and verifying that the revision is "
"displayed")
with allure.step("Signing back in with an admin account an deleting the article"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
self.navigate_to_link(article_url)
self.sumo_pages.kb_article_deletion_flow.delete_kb_article()
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
expect(
self.sumo_pages.recent_revisions_page.
_get_recent_revision_based_on_article_title_and_user(
article_details['article_title'], username
)
).to_be_visible()
with allure.step("Navigating back to the recent revision dashboard, signing out and "
"verifying that the revision is no longer displayed for the deleted kb "
"article"):
self.sumo_pages.top_navbar._click_on_recent_revisions_option()
self.wait_for_given_timeout(1000)
self.delete_cookies()
expect(
self.sumo_pages.recent_revisions_page.
_get_recent_revision_based_on_article_title_and_user(
article_details['article_title'], username
)
).to_be_hidden()
self.logger.info("Navigating to the article and approving the revision")
self.navigate_to_link(article_url)
self.logger.info("Clicking on the 'Review' option")
self.sumo_pages.kb_article_show_history_page._click_on_review_revision(
second_revision_details['revision_id']
)
self.logger.info("Click on 'Approve Revision' button")
self.sumo_pages.kb_article_review_revision_page._click_on_approve_revision_button()
self.logger.info("Clicking on the 'Accept' button")
self.sumo_pages.kb_article_review_revision_page._click_accept_revision_accept_button()
self.sumo_pages.top_navbar._click_on_recent_revisions_option()
expect(
self.page
).to_have_url(self.general_test_data['dashboard_links']['recent_revisions'])
self.logger.info("Signing out and verifying that the revision is displayed inside the "
"Recent Revisions dashboard")
self.delete_cookies()
expect(
self.sumo_pages.recent_revisions_page.
_get_recent_revision_based_on_article_title_and_user(
article_details['article_title'], username
)
).to_be_visible()
self.logger.info("Signing in with a different non-admin user account and verifying that "
"the revision is visible")
self.username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MESSAGE_6"]
)
expect(
self.sumo_pages.recent_revisions_page.
_get_recent_revision_based_on_article_title_and_user(
article_details['article_title'], username
)
).to_be_visible()
self.logger.info("Signing back 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"]
))
self.logger.info("Navigating to the article page and deleting it")
self.navigate_to_link(article_url)
self.sumo_pages.kb_article_show_history_page._click_on_delete_this_document_button()
self.sumo_pages.kb_article_show_history_page._click_on_confirmation_delete_button()
self.sumo_pages.top_navbar._click_on_recent_revisions_option()
expect(
self.page
).to_have_url(self.general_test_data['dashboard_links']['recent_revisions'])
self.logger.info("Signing out and and verifying that the revision is no longer displayed "
"inside the Recent Revisions dashboard")
self.delete_cookies()
expect(
self.sumo_pages.recent_revisions_page.
_get_recent_revision_based_on_article_title_and_user(
article_details['article_title'], username
)
).to_be_hidden()
self.logger.info("Signing in with a different non-admin user account and verifying that "
"the revision is not visible")
self.username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MESSAGE_6"]
)
expect(
self.sumo_pages.recent_revisions_page.
_get_recent_revision_based_on_article_title_and_user(
article_details['article_title'], username
)
).to_be_hidden()
with allure.step("Signing in with a different non-admin account and verifying that the "
"revision is no longer displayed for the deleted kb article"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MESSAGE_6"]
))
expect(
self.sumo_pages.recent_revisions_page.
_get_recent_revision_based_on_article_title_and_user(
article_details['article_title'], username
)
).to_be_hidden()
# C2266240
@pytest.mark.recentRevisionsDashboard
def test_recent_revisions_dashboard_links(self):
self.logger.info("Signing back in with the admin account")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Signing in with an admin account"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
first_username = self.sumo_pages.top_navbar._get_text_of_logged_in_username()
self.logger.info("Create a new simple article")
article_details = self.sumo_pages.submit_kb_article_flow.submit_simple_kb_article()
with allure.step("Creating a new kb article"):
article_details = self.sumo_pages.submit_kb_article_flow.submit_simple_kb_article()
self.sumo_pages.kb_article_page._click_on_article_option()
article_url = self.get_page_url()
self.logger.info("Clicking on the 'Show History' option")
self.sumo_pages.kb_article_page._click_on_show_history_option()
with allure.step("Approving the first revision"):
self.sumo_pages.kb_article_page._click_on_show_history_option()
revision_id = self.sumo_pages.kb_article_show_history_page._get_last_revision_id()
self.sumo_pages.kb_article_revision_flow.approve_kb_revision(revision_id)
revision_id = self.sumo_pages.kb_article_show_history_page._get_last_revision_id()
with allure.step("Navigating to the recent revisions dahsboard and verifying that the "
"'Show Diff' option is not available for first revisions"):
self.sumo_pages.top_navbar._click_on_recent_revisions_option()
self.wait_for_given_timeout(3000)
expect(
self.sumo_pages.recent_revisions_page._get_show_diff_article_locator(
article_title=article_details['article_title'], creator=first_username
)
).to_be_hidden()
self.logger.info("Clicking on the 'Review' option")
self.sumo_pages.kb_article_show_history_page._click_on_review_revision(
revision_id
)
self.logger.info("Click on 'Approve Revision' button")
self.sumo_pages.kb_article_review_revision_page._click_on_approve_revision_button()
self.logger.info("Clicking on the 'Accept' button")
self.sumo_pages.kb_article_review_revision_page._click_accept_revision_accept_button()
self.logger.info("Navigating to the recent revisions dashboard")
self.sumo_pages.top_navbar._click_on_recent_revisions_option()
expect(
self.page
).to_have_url(self.general_test_data['dashboard_links']['recent_revisions'])
self.logger.info("Verifying that the Show Diff option is not available for first revision")
expect(
self.sumo_pages.recent_revisions_page._get_show_diff_article_locator(
article_title=article_details['article_title'], creator=first_username
)
).to_be_hidden()
self.navigate_to_link(article_url)
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_12"]
))
username = self.sumo_pages.top_navbar._get_text_of_logged_in_username()
self.logger.info("Creating a new revision for the article")
second_revision_details = self.sumo_pages.kb_article_revision_flow.submit_new_kb_revision()
self.logger.info("Navigating to the Recent Revisions dashboard")
self.sumo_pages.top_navbar._click_on_recent_revisions_option()
expect(
self.page
).to_have_url(self.general_test_data['dashboard_links']['recent_revisions'])
self.logger.info("Signing out from SUMO")
self.delete_cookies()
self.logger.info("Clicking on the revision date link")
self.sumo_pages.recent_revisions_page._click_on_revision_date_for_article(
article_title=article_details['article_title'], username=username
)
self.logger.info("Verifying that the user is redirected to the correct page")
expect(
self.page
).to_have_url(
article_url + KBArticleRevision.
KB_REVISION_PREVIEW + str(self.number_extraction_from_string(
second_revision_details['revision_id']
with allure.step("Navigating to the article page, signing in with a non-admin user and "
"creating a new revision for the article"):
self.navigate_to_link(article_url)
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_12"]
))
)
username = self.sumo_pages.top_navbar._get_text_of_logged_in_username()
second_revision = self.sumo_pages.kb_article_revision_flow.submit_new_kb_revision()
self.logger.info("Verifying that the revision id is the correct one")
check.equal(
self.sumo_pages.kb_article_preview_revision_page._get_preview_revision_id_text(),
str(self.number_extraction_from_string(second_revision_details['revision_id']))
)
self.logger.info("Navigating back")
self.navigate_back()
self.logger.info("Clicking on the revision title")
self.sumo_pages.recent_revisions_page._click_on_article_title(
article_title=article_details['article_title'], creator=username
)
self.logger.info("Verifying that the user is redirected to the article title")
expect(
self.page
).to_have_url(article_url)
self.logger.info("Navigating back")
self.navigate_back()
self.logger.info("Verifying that the correct comment is displayed")
check.equal(
self.sumo_pages.recent_revisions_page._get_revision_comment(
with allure.step("Navigating to the recent revisions dashboard, signing out and clicking "
"on the revision date link and verifying that the user is redirected to"
"the correct page"):
self.sumo_pages.top_navbar._click_on_recent_revisions_option()
self.wait_for_given_timeout(3000)
self.delete_cookies()
self.sumo_pages.recent_revisions_page._click_on_revision_date_for_article(
article_title=article_details['article_title'], username=username
),
self.kb_article_test_data['changes_description']
)
)
expect(
self.page
).to_have_url(
article_url + KBArticleRevision.
KB_REVISION_PREVIEW + str(self.number_extraction_from_string(
second_revision['revision_id']
))
)
self.logger.info("Clicking on the editor")
self.sumo_pages.recent_revisions_page._click_article_creator_link(
article_title=article_details['article_title'], creator=username
)
with check, allure.step("Verifying that the revision id is the correct one"):
assert self.sumo_pages.kb_article_preview_revision_page._get_preview_revision_id_text(
) == str(self.number_extraction_from_string(second_revision['revision_id']))
self.logger.info("Verifying that the user was redirected to the correct user page")
expect(
self.page
).to_have_url(MyProfileMessages.get_my_profile_stage_url(username))
with allure.step("Navigating back, clicking on the revision title and verifying that the "
"user is redirected to the article page"):
self.navigate_back()
self.sumo_pages.recent_revisions_page._click_on_article_title(
article_title=article_details['article_title'], creator=username
)
expect(
self.page
).to_have_url(article_url)
self.logger.info("Navigating back")
self.navigate_back()
with check, allure.step("Navigating back and verifying that the correct comment is "
"displayed"):
self.navigate_back()
assert self.sumo_pages.recent_revisions_page._get_revision_comment(
article_title=article_details['article_title'], username=username
) == self.kb_article_test_data['changes_description']
self.logger.info("Clicking on show diff option")
self.sumo_pages.recent_revisions_page._click_on_show_diff_for_article(
article_title=article_details['article_title'], creator=username
)
with allure.step("Clicking on the editor and verifying that the user was redirected to "
"the correct page"):
self.sumo_pages.recent_revisions_page._click_article_creator_link(
article_title=article_details['article_title'], creator=username
)
expect(
self.page
).to_have_url(MyProfileMessages.get_my_profile_stage_url(username))
self.logger.info("Verifying that the diff section is displayed")
expect(
self.sumo_pages.recent_revisions_page._get_diff_section_locator()
).to_be_visible()
with allure.step("Navigating back, clicking on the show diff option and verifying that"
"diff section is displayed"):
self.navigate_back()
self.sumo_pages.recent_revisions_page._click_on_show_diff_for_article(
article_title=article_details['article_title'], creator=username
)
expect(
self.sumo_pages.recent_revisions_page._get_diff_section_locator()
).to_be_visible()
self.logger.info("Hiding the diff")
self.sumo_pages.recent_revisions_page._click_on_hide_diff_for_article(
article_title=article_details['article_title'], creator=username
)
with allure.step("Hiding the diff and verifying that the diff section is not displayed"):
self.sumo_pages.recent_revisions_page._click_on_hide_diff_for_article(
article_title=article_details['article_title'], creator=username
)
expect(
self.sumo_pages.recent_revisions_page._get_diff_section_locator()
).to_be_hidden()
self.logger.info("Verifying that the diff section is not displayed")
expect(
self.sumo_pages.recent_revisions_page._get_diff_section_locator()
).to_be_hidden()
self.logger.info("Signing in with an admin account")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
self.logger.info("Navigating back to the article page")
self.navigate_to_link(article_url)
self.logger.info("Clicking on the 'Show History' option")
self.sumo_pages.kb_article_page._click_on_show_history_option()
self.logger.info("Clicking on the 'Delete article' button")
self.sumo_pages.kb_article_show_history_page._click_on_delete_this_document_button()
self.logger.info("Clicking on the 'Delete' button")
self.sumo_pages.kb_article_show_history_page._click_on_confirmation_delete_button()
with allure.step("Signing in with an admin account and deleting the article"):
self.logger.info("Signing in with an admin account")
self.delete_cookies()
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
self.logger.info("Navigating back to the article page")
self.navigate_to_link(article_url)
self.sumo_pages.kb_article_deletion_flow.delete_kb_article()
# C2266240
@pytest.mark.recentRevisionsDashboard
def test_recent_revisions_dashboard_title_and_username_update(self):
self.logger.info("Signing back in with the admin account")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Signing back in with the admin account"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
first_username = self.sumo_pages.top_navbar._get_text_of_logged_in_username()
self.logger.info("Create a new simple article")
article_details = self.sumo_pages.submit_kb_article_flow.submit_simple_kb_article()
with allure.step("Creating a new kb article"):
article_details = self.sumo_pages.submit_kb_article_flow.submit_simple_kb_article()
self.sumo_pages.kb_article_page._click_on_article_option()
article_url = self.get_page_url()
self.logger.info("Clicking on the 'Show History' option")
self.sumo_pages.kb_article_page._click_on_show_history_option()
with allure.step("Approving the first article revision"):
self.sumo_pages.kb_article_page._click_on_show_history_option()
revision_id = self.sumo_pages.kb_article_show_history_page._get_last_revision_id()
self.sumo_pages.kb_article_revision_flow.approve_kb_revision(revision_id)
revision_id = self.sumo_pages.kb_article_show_history_page._get_last_revision_id()
with allure.step("Changing the article title via the 'Edit Article Metadata' page"):
self.sumo_pages.kb_article_page._click_on_edit_article_metadata()
self.sumo_pages.edit_article_metadata_flow.edit_article_metadata(
title=self.kb_article_test_data['updated_kb_article_title'] + article_details
['article_title']
)
self.logger.info("Clicking on the 'Review' option")
self.sumo_pages.kb_article_show_history_page._click_on_review_revision(
revision_id
)
self.logger.info("Click on 'Approve Revision' button")
self.sumo_pages.kb_article_review_revision_page._click_on_approve_revision_button()
self.logger.info("Clicking on the 'Accept' button")
self.sumo_pages.kb_article_review_revision_page._click_accept_revision_accept_button()
self.logger.info("Clicking on the 'Edit Article Metadata' option")
self.sumo_pages.kb_article_page._click_on_edit_article_metadata()
self.sumo_pages.kb_article_edit_article_metadata_page._add_text_to_title_field(
self.kb_article_test_data['updated_kb_article_title'] + article_details
['article_title']
)
self.logger.info("Clicking on the 'Save' button")
self.sumo_pages.kb_article_edit_article_metadata_page._click_on_save_changes_button()
self.logger.info("Editing the username")
self.sumo_pages.top_navbar._click_on_edit_profile_option()
new_username = self.profile_edit_test_data['valid_user_edit']['username']
self.sumo_pages.edit_my_profile_page._send_text_to_username_field(
new_username
)
self.logger.info("Clicking on the 'Update My Profile' button")
self.sumo_pages.edit_my_profile_page._click_update_my_profile_button()
self.logger.info("Navigating to the recent revisions dashboard")
self.sumo_pages.top_navbar._click_on_recent_revisions_option()
expect(
self.page
).to_have_url(self.general_test_data['dashboard_links']['recent_revisions'])
expect(
self.sumo_pages.recent_revisions_page._get_revision_and_username_locator(
self.kb_article_test_data['updated_kb_article_title'] + article_details
['article_title'],
with allure.step("Editing the username"):
self.sumo_pages.top_navbar._click_on_edit_profile_option()
new_username = self.profile_edit_test_data['valid_user_edit']['username']
self.sumo_pages.edit_my_profile_page._send_text_to_username_field(
new_username
)
).to_be_visible()
self.logger.info("Clicking on the 'Update My Profile' button")
self.sumo_pages.edit_my_profile_page._click_update_my_profile_button()
self.logger.info("Editing the username back")
self.sumo_pages.top_navbar._click_on_edit_profile_option()
with allure.step("Navigating to the recent revisions dashboard and verifying that the "
"correct new username and article title arte displayed"):
self.sumo_pages.top_navbar._click_on_recent_revisions_option()
self.wait_for_given_timeout(3000)
expect(
self.sumo_pages.recent_revisions_page._get_revision_and_username_locator(
article_title=self.kb_article_test_data
['updated_kb_article_title'] + article_details['article_title'],
username=new_username
)
).to_be_visible()
self.sumo_pages.edit_my_profile_page._send_text_to_username_field(
first_username
)
with allure.step("Changing the username back"):
self.sumo_pages.top_navbar._click_on_edit_profile_option()
self.sumo_pages.edit_my_profile_page._send_text_to_username_field(
first_username
)
self.logger.info("Clicking on the 'Update My Profile' button")
self.sumo_pages.edit_my_profile_page._click_update_my_profile_button()
self.logger.info("Clicking on the 'Update My Profile' button")
self.sumo_pages.edit_my_profile_page._click_update_my_profile_button()
self.logger.info("Deleting the article")
self.navigate_to_link(article_url)
self.logger.info("Clicking on the 'Show History' option")
self.sumo_pages.kb_article_page._click_on_show_history_option()
self.logger.info("Clicking on the 'Delete article' button")
self.sumo_pages.kb_article_show_history_page._click_on_delete_this_document_button()
self.logger.info("Clicking on the 'Delete' button")
self.sumo_pages.kb_article_show_history_page._click_on_confirmation_delete_button()
with allure.step("Deleting the article"):
self.navigate_to_link(article_url)
self.sumo_pages.kb_article_deletion_flow.delete_kb_article()
# C2266241
@pytest.mark.recentRevisionsDashboard
def test_recent_revisions_dashboard_filters(self):
start_date = "04052023"
end_date = "05012023"
self.logger.info("Navigating to the 'Recent Revisions' dashboard")
self.navigate_to_link(
self.general_test_data['dashboard_links']['recent_revisions']
)
self.logger.info("Selecting the ro locale from the locale filter")
self.sumo_pages.recent_revisions_page._select_locale_option("ro")
self.wait_for_given_timeout(3000)
self.logger.info("Verifying that all the displayed revisions are for the 'ro' locale")
for tag in self.sumo_pages.recent_revisions_page._get_list_of_all_locale_tage():
check.equal(
tag,
"ro"
with allure.step("Navigating to the 'Recent Revisions' dashboard"):
self.navigate_to_link(
self.general_test_data['dashboard_links']['recent_revisions']
)
self.logger.info("Select the US filter")
self.sumo_pages.recent_revisions_page._select_locale_option("en-US")
with check, allure.step("Selecting the ro locale from the locale filter and verifying "
"that all the displayed revisions are for the 'ro' locale"):
self.sumo_pages.recent_revisions_page._select_locale_option("ro")
self.wait_for_given_timeout(3000)
for tag in self.sumo_pages.recent_revisions_page._get_list_of_all_locale_tage():
assert tag == "ro"
self.wait_for_given_timeout(3000)
self.logger.info("Typing a username inside the 'Users' filter")
username = self.username_extraction_from_email(
self.user_secrets_accounts['TEST_ACCOUNT_12']
)
self.sumo_pages.recent_revisions_page._fill_in_users_field(username)
self.wait_for_given_timeout(2000)
self.logger.info("Verifying that all the displayed revisions are for the posted user")
for user in self.sumo_pages.recent_revisions_page._get_list_of_all_editors():
check.equal(
user,
username
with check, allure.step("Selecting the US filter, typing a username inside the 'Users' "
"filter and verifying that all the displayed revisions are for "
"the posted user"):
self.sumo_pages.recent_revisions_page._select_locale_option("en-US")
self.wait_for_given_timeout(3000)
username = self.username_extraction_from_email(
self.user_secrets_accounts['TEST_ACCOUNT_12']
)
self.sumo_pages.recent_revisions_page._fill_in_users_field(username)
self.wait_for_given_timeout(2000)
for user in self.sumo_pages.recent_revisions_page._get_list_of_all_editors():
assert user == username
self.sumo_pages.recent_revisions_page._clearing_the_user_field()
self.wait_for_given_timeout(2000)
with allure.step("Clearing the user filter, adding data inside the start and end fields"):
self.sumo_pages.recent_revisions_page._clearing_the_user_field()
self.wait_for_given_timeout(2000)
self.logger.info("Adding date inside the start field")
self.sumo_pages.recent_revisions_page._add_start_date("04052023")
self.logger.info("Adding date inside the start field")
self.sumo_pages.recent_revisions_page._add_start_date("04052023")
self.logger.info("Adding date inside the end field")
self.sumo_pages.recent_revisions_page._add_end_date("05012023")
self.logger.info("Adding date inside the end field")
self.sumo_pages.recent_revisions_page._add_end_date("05012023")
self.wait_for_given_timeout(2000)
self.wait_for_given_timeout(2000)
with check, allure.step("Verifying that the displayed revision dates are between ("
"inclusive) the set start and end date filters"):
extracted_date = []
date_filters = [int(start_date), int(end_date)]
for date in self.sumo_pages.recent_revisions_page._get_all_revision_dates():
extracted_date.append(self.extract_date_to_digit_format(
self.extract_month_day_year_from_string(date)
))
self.logger.info("Verifying that the displayed revision dates are between (inclusive) "
"the set start and end date filters")
extracted_date = []
date_filters = [int(start_date), int(end_date)]
for date in self.sumo_pages.recent_revisions_page._get_all_revision_dates():
extracted_date.append(self.extract_date_to_digit_format(
self.extract_month_day_year_from_string(date)
))
for date in extracted_date:
check.between_equal(
date,
date_filters[0],
date_filters[1]
)
for date in extracted_date:
assert date_filters[0] <= date <= date_filters[1]

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -1,6 +1,8 @@
import allure
from playwright_tests.core.testutilities import TestUtilities
from playwright.sync_api import expect
import pytest_check as check
from pytest_check import check
import pytest
from playwright_tests.messages.homepage_messages import HomepageMessages
@ -13,46 +15,42 @@ class TestPostedQuestions(TestUtilities):
# C890834, C890833
@pytest.mark.kbProductsPage
def test_products_page_content(self):
self.logger.info("Navigating to products page via top-navbar")
self.sumo_pages.top_navbar._click_on_explore_our_help_articles_option()
with check, allure.step("Navigating to products page via top-navbar and verifying that "
"the correct page header is displayed"):
self.sumo_pages.top_navbar._click_on_explore_our_help_articles_option()
assert self.sumo_pages.products_page._get_page_header(
) == ProductsPageMessages.PRODUCTS_PAGE_HEADER
self.logger.info("Verifying that the correct page header is displayed")
check.equal(
self.sumo_pages.products_page._get_page_header(),
ProductsPageMessages.PRODUCTS_PAGE_HEADER
)
with allure.step("Clicking on the first 'Home' breadcrumb and verifying the redirect"):
self.sumo_pages.products_page._click_on_first_breadcrumb()
expect(
self.page
).to_have_url(HomepageMessages.STAGE_HOMEPAGE_URL_EN_US)
self.logger.info("Clicking on the first 'Home' breadcrumb and verifying the redirect")
self.sumo_pages.products_page._click_on_first_breadcrumb()
expect(
self.page
).to_have_url(HomepageMessages.STAGE_HOMEPAGE_URL_EN_US)
self.logger.info("Navigating back to the 'Products' page")
self.navigate_back()
with allure.step("Navigating back to the 'Products' page"):
self.navigate_back()
for card in self.sumo_pages.products_page._get_all_product_support_titles():
self.logger.info(f"Verifying that the {card} card contains the correct subheading")
if card in ProductsPageMessages.PRODUCT_CARDS_SUBHEADING:
check.equal(
self.sumo_pages.products_page._get_subheading_of_card(card),
ProductsPageMessages.PRODUCT_CARDS_SUBHEADING[card]
)
with check, allure.step(f"Verifying that the {card} card contains the correct "
f"subheading"):
if card in ProductsPageMessages.PRODUCT_CARDS_SUBHEADING:
assert self.sumo_pages.products_page._get_subheading_of_card(
card) == ProductsPageMessages.PRODUCT_CARDS_SUBHEADING[card]
# C890846
@pytest.mark.kbProductsPage
def test_products_page_card_redirect(self):
self.logger.info("Navigating to products page via top-navbar")
self.sumo_pages.top_navbar._click_on_explore_our_help_articles_option()
with allure.step("Navigating to products page via top-navbar"):
self.sumo_pages.top_navbar._click_on_explore_our_help_articles_option()
for card in self.sumo_pages.products_page._get_all_product_support_titles():
if card in self.general_test_data['product_support']:
self.logger.info(f"Clicking on {card} card and verifying that we are redirected "
f"to the correct product url")
self.sumo_pages.products_page._click_on_a_particular_product_support_card(card)
expect(
self.page
).to_have_url(self.general_test_data['product_support'][card])
with allure.step(f"Clicking on {card} card and verifying that we are redirected "
f"to the correct product url"):
self.sumo_pages.products_page._click_on_a_particular_product_support_card(card)
expect(
self.page
).to_have_url(self.general_test_data['product_support'][card])
self.logger.info("Navigating back to the products page")
self.navigate_back()
with allure.step("Navigating back to the products page"):
self.navigate_back()

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -1,4 +1,5 @@
import pytest_check as check
import allure
from pytest_check import check
import pytest
from playwright.sync_api import expect
from playwright_tests.core.testutilities import TestUtilities
@ -18,236 +19,215 @@ class TestPostedQuestions(TestUtilities):
# C890926, C890931, C2091563
@pytest.mark.skip
def test_product_support_page(self):
self.logger.info("Navigating to products page via top-navbar")
self.sumo_pages.top_navbar._click_on_explore_our_help_articles_option()
with allure.step("Navigating to products page via top-navbar"):
self.sumo_pages.top_navbar._click_on_explore_our_help_articles_option()
self.logger.info("Clicking on all product cards")
for card in self.sumo_pages.products_page._get_all_product_support_titles():
if card in self.general_test_data['product_support']:
self.sumo_pages.products_page._click_on_a_particular_product_support_card(card)
with allure.step("Clicking on all product cards"):
for card in self.sumo_pages.products_page._get_all_product_support_titles():
if card in self.general_test_data['product_support']:
self.sumo_pages.products_page._click_on_a_particular_product_support_card(card)
self.logger.info("Verifying that the correct page header is displayed")
check.equal(
self.sumo_pages.product_support_page._get_product_support_title_text(),
card + ProductSupportPageMessages.PRODUCT_SUPPORT_PAGE_TITLE
)
with check, allure.step("Verifying that the correct page header is displayed"):
assert (self.sumo_pages.product_support_page
._get_product_support_title_text()
) == card + ProductSupportPageMessages.PRODUCT_SUPPORT_PAGE_TITLE
self.logger.info("Verifying that the correct topics header is displayed")
check.equal(
self.sumo_pages.product_support_page._get_frequent_topics_title_text(),
ProductSupportPageMessages.PRODUCT_SUPPORT_PAGE_FREQUENT_TOPICS_TITLE
)
with check, allure.step("Verifying the correct topics header is displayed"):
assert (self.sumo_pages.product_support_page
._get_frequent_topics_title_text()
) == (ProductSupportPageMessages
.PRODUCT_SUPPORT_PAGE_FREQUENT_TOPICS_TITLE)
self.logger.info("Verifying that the correct topics subheader is displayed")
check.equal(
self.sumo_pages.product_support_page._get_frequent_topics_subtitle_text(),
ProductSupportPageMessages.PRODUCT_SUPPORT_PAGE_FREQUENT_TOPICS_SUBTITLE
)
with check, allure.step("Verifying that the correct topics subheader is "
"displayed"):
assert (self.sumo_pages.product_support_page
._get_frequent_topics_subtitle_text()
) == (ProductSupportPageMessages
.PRODUCT_SUPPORT_PAGE_FREQUENT_TOPICS_SUBTITLE)
self.logger.info("Verifying that the correct still need help title is displayed")
check.equal(
self.sumo_pages.product_support_page._get_still_need_help_widget_title(),
ProductSupportPageMessages.STILL_NEED_HELP_WIDGET_TITLE
)
with check, allure.step("Verifying that the correct still need help title is "
"displayed"):
assert (self.sumo_pages.product_support_page
._get_still_need_help_widget_title()
) == ProductSupportPageMessages.STILL_NEED_HELP_WIDGET_TITLE
if card in super().general_test_data['premium_products']:
self.logger.info(
"Verifying that the correct still need help content is displayed")
check.equal(
self.sumo_pages.product_support_page.
_get_still_need_help_widget_content(),
ProductSupportPageMessages.STILL_NEED_HELP_WIDGET_CONTENT_PREMIUM
)
if card in super().general_test_data['premium_products']:
with check, allure.step("Verifying that the correct still need help "
"content is displayed"):
assert (self.sumo_pages.product_support_page
._get_still_need_help_widget_content()
) == (ProductSupportPageMessages
.STILL_NEED_HELP_WIDGET_CONTENT_PREMIUM)
self.logger.info("Verifying that the correct still need help button text is "
"displayed")
check.equal(
self.sumo_pages.product_support_page
._get_still_need_help_widget_button_text(),
ProductSupportPageMessages.STILL_NEED_HELP_WIDGET_BUTTON_TEXT_PREMIUM
)
else:
self.logger.info("Verifying that the correct still need help content is "
"displayed")
check.equal(
self.sumo_pages.product_support_page.
_get_still_need_help_widget_content(),
ProductSupportPageMessages.STILL_NEED_HELP_WIDGET_CONTENT_FREEMIUM
)
with check, allure.step("Verifying that the correct still need help "
"button text is displayed"):
assert (self.sumo_pages.product_support_page
._get_still_need_help_widget_button_text()
) == (ProductSupportPageMessages
.STILL_NEED_HELP_WIDGET_BUTTON_TEXT_PREMIUM)
else:
with check, allure.step("Verifying that the correct still need help "
"content is displayed"):
assert (self.sumo_pages.product_support_page
._get_still_need_help_widget_content()
) == (ProductSupportPageMessages
.STILL_NEED_HELP_WIDGET_CONTENT_FREEMIUM)
self.logger.info("Verifying that the correct still need help button text is "
"displayed")
check.equal(
self.sumo_pages.product_support_page
._get_still_need_help_widget_button_text(),
ProductSupportPageMessages.STILL_NEED_HELP_WIDGET_BUTTON_TEXT_FREEMIUM
)
with check, allure.step("Verifying that the correct still need help "
"button text is displayed"):
assert (self.sumo_pages.product_support_page
._get_still_need_help_widget_button_text()
) == (ProductSupportPageMessages
.STILL_NEED_HELP_WIDGET_BUTTON_TEXT_FREEMIUM)
# Firefox Focus and Thunderbird don't have frequent articles section
if card != "Firefox Focus" and card != "Thunderbird":
self.logger.info("Verifying the correct featured articles header is displayed")
check.equal(
self.sumo_pages.product_support_page._get_featured_articles_header_text(),
ProductSupportPageMessages.PRODUCT_SUPPORT_PAGE_FREQUENT_ARTICLES_TITLE
)
# Firefox Focus and Thunderbird don't have frequent articles section
if card != "Firefox Focus" and card != "Thunderbird":
with check, allure.step("Verifying the correct featured articles header "
"is displayed"):
assert (self.sumo_pages.product_support_page
._get_featured_articles_header_text()
) == (ProductSupportPageMessages
.PRODUCT_SUPPORT_PAGE_FREQUENT_ARTICLES_TITLE)
self.logger.info("Verifying that the correct 'Join Our Community' section header "
"is displayed")
check.equal(
self.sumo_pages.product_support_page._get_join_our_community_header_text(),
ProductSupportPageMessages.JOIN_OUR_COMMUNITY_SECTION_HEADER
)
with check, allure.step("Verifying that the correct 'Join Our Community' "
"section header is displayed"):
assert (self.sumo_pages.product_support_page
._get_join_our_community_header_text()
) == ProductSupportPageMessages.JOIN_OUR_COMMUNITY_SECTION_HEADER
self.logger.info("Verifying that the correct 'Join Our Community section content "
"is displayed'")
check.equal(
self.sumo_pages.product_support_page._get_join_our_community_content_text(),
ProductSupportPageMessages.JOIN_OUR_COMMUNITY_SECTION_CONTENT
)
with check, allure.step("Verifying that the correct 'Join Our Community "
"section content is displayed'"):
assert (self.sumo_pages.product_support_page
._get_join_our_community_content_text()
) == ProductSupportPageMessages.JOIN_OUR_COMMUNITY_SECTION_CONTENT
self.logger.info("Clicking on the 'Learn more' option from the 'Join Our "
"Community' section")
self.sumo_pages.product_support_page._click_join_our_community_learn_more_link()
with allure.step("Clicking on the 'Learn more' option from the 'Join Our "
"Community' section"):
(self.sumo_pages.product_support_page
._click_join_our_community_learn_more_link())
self.logger.info("Verify that we are redirected to the contribute messages page")
expect(
self.page
).to_have_url(ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL)
with allure.step("Verify that we are redirected to the contribute messages "
"page"):
expect(
self.page
).to_have_url(ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL)
self.logger.info("Navigate back")
self.navigate_back()
with allure.step("Navigate back, clicking on the 'Home' breadcrumb and "
"verifying that we are redirected to the homepage"):
self.navigate_back()
(self.sumo_pages.product_support_page
._click_on_product_support_home_breadcrumb())
expect(
self.page
).to_have_url(HomepageMessages.STAGE_HOMEPAGE_URL_EN_US)
self.logger.info("Clicking on the 'Home' breadcrumb")
self.sumo_pages.product_support_page._click_on_product_support_home_breadcrumb()
self.logger.info("Verifying that we are redirected to the homepage")
expect(
self.page
).to_have_url(HomepageMessages.STAGE_HOMEPAGE_URL_EN_US)
self.logger.info("Navigating to products page via top-navbar")
self.sumo_pages.top_navbar._click_on_explore_our_help_articles_option()
with allure.step("Navigating to products page via top-navbar"):
self.sumo_pages.top_navbar._click_on_explore_our_help_articles_option()
# C890929
@pytest.mark.skip
def test_product_support_page_frequent_topics_redirect(self):
self.logger.info("Navigating to products page via top-navbar")
self.sumo_pages.top_navbar._click_on_explore_our_help_articles_option()
with allure.step("Navigating to products page via top-navbar"):
self.sumo_pages.top_navbar._click_on_explore_our_help_articles_option()
self.logger.info("Clicking on all product cards")
with allure.step("Clicking on all product cards"):
for card in self.sumo_pages.products_page._get_all_product_support_titles():
if card in self.general_test_data['product_support']:
self.sumo_pages.products_page._click_on_a_particular_product_support_card(card)
for card in self.sumo_pages.products_page._get_all_product_support_titles():
if card in self.general_test_data['product_support']:
self.sumo_pages.products_page._click_on_a_particular_product_support_card(card)
self.logger.info("Verifying that the correct page header is displayed")
check.equal(
self.sumo_pages.product_support_page._get_product_support_title_text(),
card + ProductSupportPageMessages.PRODUCT_SUPPORT_PAGE_TITLE
)
with check, allure.step("Verifying that the correct page header is displayed"):
assert (self.sumo_pages.product_support_page
._get_product_support_title_text()
) == card + ProductSupportPageMessages.PRODUCT_SUPPORT_PAGE_TITLE
if self.sumo_pages.product_support_page._is_frequent_topics_section_displayed:
for topic in (self.sumo_pages.product_support_page.
_get_all_frequent_topics_cards()):
(self.sumo_pages.product_support_page
._click_on_a_particular_frequent_topic_card(topic))
check.equal(
self.sumo_pages.product_topics_page._get_page_title(),
topic,
f"Incorrect topic page title. "
f"Expected: {topic} "
f"Received: {self.sumo_pages.product_topics_page._get_page_title()}"
)
if self.sumo_pages.product_support_page._is_frequent_topics_section_displayed:
for topic in (self.sumo_pages.product_support_page.
_get_all_frequent_topics_cards()):
(self.sumo_pages.product_support_page
._click_on_a_particular_frequent_topic_card(topic))
with check, allure.step("Clicking on a particular frequent topic "
"card and verifying that the correct topic "
"page title is displayed"):
assert self.sumo_pages.product_topics_page._get_page_title(
) == topic
self.navigate_back()
else:
self.logger.info(f"{card} has no frequent topics displayed!!!")
with allure.step("Navigating back"):
self.navigate_back()
else:
self.logger.info(f"{card} has no frequent topics displayed!!!")
self.navigate_back()
@pytest.mark.skip
def test_product_support_page_featured_articles_redirect(self):
self.logger.info("Navigating to products page via top-navbar")
self.sumo_pages.top_navbar._click_on_explore_our_help_articles_option()
with allure.step("Navigating to products page via top-navbar"):
self.sumo_pages.top_navbar._click_on_explore_our_help_articles_option()
self.logger.info("Clicking on all product cards")
with allure.step("Clicking on all product cards"):
for card in self.sumo_pages.products_page._get_all_product_support_titles():
if card in self.general_test_data['product_support']:
self.sumo_pages.products_page._click_on_a_particular_product_support_card(card)
for card in self.sumo_pages.products_page._get_all_product_support_titles():
if card in self.general_test_data['product_support']:
self.sumo_pages.products_page._click_on_a_particular_product_support_card(card)
with check, allure.step("Verifying that the correct page header is displayed"):
assert (self.sumo_pages.product_support_page
._get_product_support_title_text()
) == card + ProductSupportPageMessages.PRODUCT_SUPPORT_PAGE_TITLE
self.logger.info("Verifying that the correct page header is displayed")
check.equal(
self.sumo_pages.product_support_page._get_product_support_title_text(),
card + ProductSupportPageMessages.PRODUCT_SUPPORT_PAGE_TITLE
)
if (self.sumo_pages.product_support_page
._is_featured_articles_section_displayed):
featured_article_cards_count = (self.sumo_pages.product_support_page
._get_feature_articles_count())
count = 1
while count <= featured_article_cards_count:
featured_article_names = (self.sumo_pages.product_support_page.
_get_list_of_featured_articles_headers())
# Skipping check for now because the Firefox Monitor article redirects
# to a different one
if featured_article_names[count - 1] == "Firefox Monitor":
continue
(self.sumo_pages.product_support_page.
_click_on_a_particular_feature_article_card(
featured_article_names[count - 1]))
if self.sumo_pages.product_support_page._is_featured_articles_section_displayed:
featured_article_cards_count = (self.sumo_pages.product_support_page
._get_feature_articles_count())
count = 1
while count <= featured_article_cards_count:
featured_article_names = (self.sumo_pages.product_support_page.
_get_list_of_featured_articles_headers())
# Skipping check for now because the Firefox Monitor article redirects to
# a different one
if featured_article_names[count - 1] == "Firefox Monitor":
continue
(self.sumo_pages.product_support_page.
_click_on_a_particular_feature_article_card(
featured_article_names[count - 1]))
with check, allure.step("Verifying the accessed article title is the "
"correct one"):
assert featured_article_names[count - 1] == (
self.sumo_pages.kb_article_page._get_text_of_article_title())
count += 1
self.navigate_back()
else:
self.logger.info(f"{card} has no featured articles displayed!!!")
self.logger.info("Verifying the accessed article title is the correct one")
check.equal(
featured_article_names[count - 1],
self.sumo_pages.kb_article_page._get_text_of_article_title(),
f"Expected: {featured_article_names[count - 1]} "
f"Received:"
f" {self.sumo_pages.kb_article_page._get_text_of_article_title()}"
)
count += 1
with allure.step("Navigating back"):
self.navigate_back()
else:
self.logger.info(f"{card} has no featured articles displayed!!!")
self.navigate_back()
# C890932
@pytest.mark.skip
def test_still_need_help_button_redirect(self):
self.logger.info("Navigating to products page via top-navbar")
self.sumo_pages.top_navbar._click_on_explore_our_help_articles_option()
with allure.step("Navigating to products page via top-navbar"):
self.sumo_pages.top_navbar._click_on_explore_our_help_articles_option()
self.logger.info("Clicking on all product cards")
with allure.step("Clicking on all product cards"):
for card in self.sumo_pages.products_page._get_all_product_support_titles():
if card in self.general_test_data['product_support']:
self.sumo_pages.products_page._click_on_a_particular_product_support_card(card)
for card in self.sumo_pages.products_page._get_all_product_support_titles():
if card in self.general_test_data['product_support']:
self.sumo_pages.products_page._click_on_a_particular_product_support_card(card)
with check, allure.step("Verifying that the correct page header is displayed"):
assert (self.sumo_pages.product_support_page
._get_product_support_title_text()
) == card + ProductSupportPageMessages.PRODUCT_SUPPORT_PAGE_TITLE
self.sumo_pages.product_support_page._click_still_need_help_widget_button()
self.logger.info("Verifying that the correct page header is displayed")
check.equal(
self.sumo_pages.product_support_page._get_product_support_title_text(),
card + ProductSupportPageMessages.PRODUCT_SUPPORT_PAGE_TITLE
)
with allure.step("Verifying that we are redirected to the correct product "
"solutions page"):
expect(
self.page
).to_have_url(
super().general_test_data['product_solutions'][card]
)
self.sumo_pages.product_support_page._click_still_need_help_widget_button()
with check, allure.step("Verifying that we are on the correct milestone"):
assert self.sumo_pages.product_solutions_page._get_current_milestone_text(
) == ProductSolutionsMessages.CURRENT_MILESTONE_TEXT
self.logger.info("Verifying that we are redirected to the correct product "
"solutions page")
expect(
self.page
).to_have_url(
super().general_test_data['product_solutions'][card]
)
self.logger.info("Verifying that we are on the correct milestone")
check.equal(
self.sumo_pages.product_solutions_page._get_current_milestone_text(),
ProductSolutionsMessages.CURRENT_MILESTONE_TEXT,
f"Incorrect current milestone displayed "
f"Expected: {ProductSolutionsMessages.CURRENT_MILESTONE_TEXT} "
f"Received: "
f"{self.sumo_pages.product_solutions_page._get_current_milestone_text()}"
)
self.logger.info("Navigating to products page via top-navbar")
self.sumo_pages.top_navbar._click_on_explore_our_help_articles_option()
with allure.step("Navigating to products page via top-navbar"):
self.sumo_pages.top_navbar._click_on_explore_our_help_articles_option()

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

@ -1,6 +1,7 @@
import allure
import pytest
import requests
import pytest_check as check
from pytest_check import check
from playwright_tests.core.testutilities import TestUtilities
from urllib.parse import urljoin
@ -39,11 +40,5 @@ class TestFooter(TestUtilities):
# Some links are returning status code 429.
# We are currently treating them as pass cases.
check.is_true(
response.status_code < 400 or response.status_code == 429,
f"The following url is broken: "
f"{url}. "
f"Received status code: "
f"{response.status_code}"
)
with check, allure.step(f"Verifying that {url} is not broken are not broken"):
assert response.status_code < 400 or response.status_code == 429

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

@ -1,5 +1,6 @@
import allure
import pytest
import pytest_check as check
from pytest_check import check
from playwright_tests.core.testutilities import TestUtilities
@ -14,82 +15,84 @@ class TestHomepage(TestUtilities):
# C876542
@pytest.mark.homePageTests
def test_join_our_community_card_learn_more_redirects_to_contribute_page(self):
self.logger.info("Clicking on the 'Learn More' option")
self.sumo_pages.homepage._click_learn_more_option()
with allure.step("Clicking on the 'Learn More' option"):
self.sumo_pages.homepage._click_learn_more_option()
self.logger.info("Verifying that we are redirected to the 'Contribute' page successfully")
assert (
self.get_page_url()
== ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL
), "We are not on the Contribute page!"
with allure.step("Verifying that we are redirected to the 'Contribute' page successfully"):
assert (
self.get_page_url()
== ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL
), "We are not on the Contribute page!"
# C876542
@pytest.mark.homePageTests
def test_join_our_community_card_has_the_correct_content(self):
self.logger.info(
with allure.step(
"Verifying that the 'Join Our Community' card has the correct strings applied"
)
assert (
self.sumo_pages.homepage._get_community_card_title()
== HomepageMessages.JOIN_OUR_COMMUNITY_CARD_TITLE
and self.sumo_pages.homepage._get_community_card_description()
== HomepageMessages.JOIN_OUR_COMMUNITY_CARD_DESCRIPTION
), "Incorrect strings are displayed"
):
assert (
self.sumo_pages.homepage._get_community_card_title()
== HomepageMessages.JOIN_OUR_COMMUNITY_CARD_TITLE
and self.sumo_pages.homepage._get_community_card_description()
== HomepageMessages.JOIN_OUR_COMMUNITY_CARD_DESCRIPTION
), "Incorrect strings are displayed"
# C876541
@pytest.mark.homePageTests
def test_homepage_feature_articles_are_available_and_interactable(self):
self.logger.info(
"Verifying that the correct number of featured articles are present on the homepage"
)
check.equal(
self.sumo_pages.homepage._get_number_of_featured_articles(),
HomepageMessages.EXPECTED_FEATURED_ARTICLES_COUNT,
"Unexpected featured article count"
)
with check, allure.step(
"Verifying if the correct number of featured articles are present on the homepage"
):
assert self.sumo_pages.homepage._get_number_of_featured_articles(
self.logger.info("Clicking on each featured article card and verifying that the user is "
"redirected to the correct article page.")
counter = 0
for featured_article in self.sumo_pages.homepage._get_featured_articles_titles():
articles_names = self.sumo_pages.homepage._get_featured_articles_titles()
) is HomepageMessages.EXPECTED_FEATURED_ARTICLES_COUNT
self.logger.info(f"Clicking on: {articles_names[counter]} article card")
self.sumo_pages.homepage._click_on_a_featured_card(counter)
with allure.step("Clicking on each featured article card and verifying that the user is"
" redirected to the correct article page."):
counter = 0
for featured_article in self.sumo_pages.homepage._get_featured_articles_titles():
articles_names = self.sumo_pages.homepage._get_featured_articles_titles()
self.logger.info("Verifying that the correct article title is displayed.")
assert (
self.sumo_pages.kb_article_page._get_text_of_article_title()
== articles_names[counter]
), (f"Incorrect featured article displayed. Expected: {featured_article} "
f"Received: {self.sumo_pages.kb_article_page._get_text_of_article_title()}")
self.logger.info(
f"Clicking on: {articles_names[counter]} article card"
)
self.sumo_pages.homepage._click_on_a_featured_card(counter)
self.logger.info("Navigating back to the previous page")
self.navigate_back()
counter += 1
self.logger.info(
"Verifying that the correct article title is displayed."
)
assert (
self.sumo_pages.kb_article_page._get_text_of_article_title()
== articles_names[counter]
), (f"Incorrect featured article displayed. Expected: {featured_article} "
f"Received: {self.sumo_pages.kb_article_page._get_text_of_article_title()}")
with allure.step("Navigating back to the previous page"):
self.navigate_back()
counter += 1
# C873774
@pytest.mark.homePageTests
def test_product_cards_are_functional_and_redirect_to_the_proper_support_page(self):
self.logger.info("Verifying that the product cards are redirecting to the correct "
"support page")
card_titles = self.sumo_pages.homepage._get_text_of_product_card_titles()
counter = 0
for product_card in card_titles:
expected_product_title = card_titles[counter] + SupportPageMessages.TITLE_CONTAINS
with allure.step("Verifying that the product cards redirect to the correct support page"):
card_titles = self.sumo_pages.homepage._get_text_of_product_card_titles()
counter = 0
for product_card in card_titles:
expected_product_title = card_titles[counter] + SupportPageMessages.TITLE_CONTAINS
self.logger.info(expected_product_title)
self.logger.info(f"Clicking on the: {card_titles[counter]} card")
self.sumo_pages.homepage._click_on_product_card(counter)
self.logger.info("Verifying that the correct product support page is displayed")
assert (
expected_product_title
== self.sumo_pages.product_support_page._get_product_support_title_text()
), (f"Incorrect support page displayed. "
f"Expected: {expected_product_title} "
f"Received: "
f"{self.sumo_pages.product_support_page._get_product_support_title_text()}")
self.logger.info(expected_product_title)
self.logger.info(f"Clicking on the: {card_titles[counter]} card")
self.sumo_pages.homepage._click_on_product_card(counter)
self.logger.info("Verifying that the correct product support page is displayed")
assert (
expected_product_title
== self.sumo_pages.product_support_page._get_product_support_title_text()
), (f"Incorrect support page displayed. "
f"Expected: {expected_product_title} "
f"Received: "
f"{self.sumo_pages.product_support_page._get_product_support_title_text()}")
self.logger.info("Navigating back to the previous page")
self.navigate_back()
counter += 1
with allure.step("Navigating back to the previous page"):
self.navigate_back()
counter += 1

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -1,5 +1,6 @@
import allure
import pytest
import pytest_check as check
from pytest_check import check
import requests
from playwright_tests.core.testutilities import TestUtilities
@ -10,70 +11,67 @@ class TestTopNavbar(TestUtilities):
# C876534, C890961
@pytest.mark.topNavbarTests
def test_number_of_options_not_signed_in(self):
self.logger.info("Verifying that the SUMO logo is successfully displayed")
image = self.sumo_pages.top_navbar._get_sumo_nav_logo()
image_link = image.get_attribute("src")
response = requests.get(image_link, stream=True)
check.is_true(response.status_code < 400, f"The {image_link} image is broken")
with check, allure.step("Verifying that the SUMO logo is successfully displayed"):
image = self.sumo_pages.top_navbar._get_sumo_nav_logo()
image_link = image.get_attribute("src")
response = requests.get(image_link, stream=True)
assert response.status_code < 400
self.logger.info("Verifying that top-navbar contains only Get Help & Contribute options "
"for non signed-in state")
top_navbar_items = self.sumo_pages.top_navbar._get_available_menu_titles()
expected_top_navbar_items = [
TopNavbarMessages.GET_HELP_OPTION_TEXT,
TopNavbarMessages.CONTRIBUTE_OPTION_TEXT,
]
assert top_navbar_items == expected_top_navbar_items, (
"Incorrect elements displayed in top-navbar for signed out state"
)
with allure.step("Verifying that top-navbar contains only Get Help & Contribute options "
"for non signed-in state"):
top_navbar_items = self.sumo_pages.top_navbar._get_available_menu_titles()
expected_top_navbar_items = [
TopNavbarMessages.GET_HELP_OPTION_TEXT,
TopNavbarMessages.CONTRIBUTE_OPTION_TEXT,
]
assert top_navbar_items == expected_top_navbar_items, (
"Incorrect elements displayed in top-navbar for signed out state"
)
# C876539
@pytest.mark.topNavbarTests
def test_number_of_options_signed_in(self):
self.logger.info("Using saved user session")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts['TEST_ACCOUNT_12']
))
with allure.step("Signing in using a non-admin user"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts['TEST_ACCOUNT_12']
))
self.logger.info("Verifying that the SUMO logo is successfully displayed")
image = self.sumo_pages.top_navbar._get_sumo_nav_logo()
image_link = image.get_attribute("src")
response = requests.get(image_link, stream=True)
check.is_true(response.status_code < 400, f"The {image_link} image is broken")
with check, allure.step("Verifying that the SUMO logo is successfully displayed"):
image = self.sumo_pages.top_navbar._get_sumo_nav_logo()
image_link = image.get_attribute("src")
response = requests.get(image_link, stream=True)
assert response.status_code < 400
self.logger.info("Verifying that the top-navbar contains Get Help, Contributor Tools and "
"Contribute options")
top_navbar_items = self.sumo_pages.top_navbar._get_available_menu_titles()
expected_top_navbar_items = [
TopNavbarMessages.GET_HELP_OPTION_TEXT,
TopNavbarMessages.CONTRIBUTOR_TOOLS_TEXT,
TopNavbarMessages.CONTRIBUTE_OPTION_TEXT,
]
assert top_navbar_items == expected_top_navbar_items, (
"Incorrect elements displayed in top-navbar for " "signed-in state"
)
with allure.step("Verifying that the top-navbar contains Get Help, Contributor Tools and "
"Contribute options"):
top_navbar_items = self.sumo_pages.top_navbar._get_available_menu_titles()
expected_top_navbar_items = [
TopNavbarMessages.GET_HELP_OPTION_TEXT,
TopNavbarMessages.CONTRIBUTOR_TOOLS_TEXT,
TopNavbarMessages.CONTRIBUTE_OPTION_TEXT,
]
assert top_navbar_items == expected_top_navbar_items, (
"Incorrect elements displayed in top-navbar for " "signed-in state"
)
# C876534
@pytest.mark.topNavbarTests
def test_contributor_tools_is_removed_after_user_signs_out(self):
self.logger.info("Using saved user session")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts['TEST_ACCOUNT_12']
))
with allure.step("Signing in with a non-admin user"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts['TEST_ACCOUNT_12']
))
self.logger.info("Signing the user out from SUMO by clearing session cookies")
self.delete_cookies()
with allure.step("Signing the user out from SUMO"):
self.delete_cookies()
self.logger.info("Verifying that top-navbar contains only Get Help & Contribute options "
"for non signed-in state")
top_navbar_items = self.sumo_pages.top_navbar._get_available_menu_titles()
expected_top_navbar_items = [
TopNavbarMessages.GET_HELP_OPTION_TEXT,
TopNavbarMessages.CONTRIBUTE_OPTION_TEXT,
]
assert top_navbar_items == expected_top_navbar_items, (
"Incorrect elements displayed in top-navbar for " "signed out state"
)
with allure.step("Verifying that top-navbar contains only Get Help & Contribute options "
"for non signed-in state"):
top_navbar_items = self.sumo_pages.top_navbar._get_available_menu_titles()
expected_top_navbar_items = [
TopNavbarMessages.GET_HELP_OPTION_TEXT,
TopNavbarMessages.CONTRIBUTE_OPTION_TEXT,
]
assert top_navbar_items == expected_top_navbar_items, (
"Incorrect elements displayed in top-navbar for " "signed out state"
)

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

@ -1,5 +1,6 @@
import allure
import pytest
import pytest_check as check
from pytest_check import check
from playwright.sync_api import expect
from playwright_tests.core.testutilities import TestUtilities
@ -13,106 +14,82 @@ class TestEditContributionAreas(TestUtilities):
# C2206070
@pytest.mark.userContributionTests
def test_all_checkboxes_can_be_selected_and_saved(self):
self.logger.info("Signing in with a simple user account")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts['TEST_ACCOUNT_12']
))
with allure.step("Signing in with a non-admin account"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts['TEST_ACCOUNT_12']
))
original_user = self.sumo_pages.top_navbar._get_text_of_logged_in_username()
self.logger.info("Checking all contributor checkboxes")
self.sumo_pages.edit_profile_flow.check_all_profile_contribution_areas(checked=False)
with allure.step("Checking all contributor checkboxes"):
self.sumo_pages.edit_profile_flow.check_all_profile_contribution_areas(checked=False)
self.logger.info("Verifying that the correct notification banner text is displayed")
check.equal(
self.sumo_pages.edit_my_profile_con_areas_page._edit_con_areas_pref_banner_txt(),
EditContributionAreasPageMessages.PREFERENCES_SAVED_NOTIFICATION_BANNER_TEXT,
f"Incorrect notification banner message displayed. "
f"Expected: "
f"{EditContributionAreasPageMessages.PREFERENCES_SAVED_NOTIFICATION_BANNER_TEXT}"
f" received: "
f"{self.sumo_pages.edit_my_profile_con_areas_page._edit_con_areas_pref_banner_txt()}",
)
with check, allure.step("Verifying that the correct notification banner text is "
"displayed"):
assert self.sumo_pages.edit_my_profile_con_areas_page._edit_con_areas_pref_banner_txt(
) == EditContributionAreasPageMessages.PREFERENCES_SAVED_NOTIFICATION_BANNER_TEXT
self.logger.info("Verifying that all the checkboxes are checked")
assert (
self.sumo_pages.edit_my_profile_con_areas_page._are_all_cont_pref_checkboxes_checked()
), "Not all checkbox options are checked!"
with allure.step("Verifying that all the checkboxes are checked"):
assert (
self.sumo_pages.edit_my_profile_con_areas_page._are_all_cont_pref_checked()
), "Not all checkbox options are checked!"
contribution_options = (
self.sumo_pages.edit_my_profile_con_areas_page._get_contrib_areas_checkbox_labels()
)
self.logger.info("Accessing the my profile page and verifying that the displayed groups "
"are the correct ones")
self.sumo_pages.user_navbar._click_on_my_profile_option()
with allure.step("Accessing the my profile page and verifying that the displayed groups "
"are the correct ones"):
self.sumo_pages.user_navbar._click_on_my_profile_option()
assert (
self.sumo_pages.my_profile_page._get_my_profile_groups_items_text()
== contribution_options
)
assert (
self.sumo_pages.my_profile_page._get_my_profile_groups_items_text()
== contribution_options
), (
f"Not all groups are displayed. Expected:"
f" {contribution_options} "
f"received: {self.sumo_pages.my_profile_page._get_my_profile_groups_items_text()}"
)
with allure.step("Signing in with a different account and verifying that the original "
"user groups are displayed"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts['TEST_ACCOUNT_13']
))
self.logger.info("Signing in with a different account and verifying that the original "
"user groups are displayed")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts['TEST_ACCOUNT_13']
))
with allure.step("Navigating to the user page and verifying that the user groups is "
"successfully displayed"):
self.navigate_to_link(MyProfileMessages.get_my_profile_stage_url(original_user))
assert (
self.sumo_pages.my_profile_page._get_my_profile_groups_items_text()
== contribution_options
)
self.navigate_to_link(MyProfileMessages.get_my_profile_stage_url(original_user))
with allure.step("Signing in back with the original user"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts['TEST_ACCOUNT_12']
))
self.logger.info("Verifying that the user groups is successfully displayed for the "
"original user")
assert (
self.sumo_pages.my_profile_page._get_my_profile_groups_items_text()
== contribution_options
), (
f"Not all groups are displayed. Expected:"
f" {contribution_options} "
f"received: {self.sumo_pages.my_profile_page._get_my_profile_groups_items_text()}"
)
with allure.step("Accessing the edit contribution areas page and unchecking all "
"checkboxes"):
self.sumo_pages.edit_profile_flow.check_all_profile_contribution_areas(checked=True)
self.logger.info("Signing in back with the original user")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts['TEST_ACCOUNT_12']
))
with check, allure.step("Clicking on the update button and verifying that the correct "
"notification banner is displayed"):
assert self.sumo_pages.edit_my_profile_con_areas_page._edit_con_areas_pref_banner_txt(
) == EditContributionAreasPageMessages.PREFERENCES_SAVED_NOTIFICATION_BANNER_TEXT
self.logger.info("Unchecking all contributor checkboxes and verifying that the correct "
"notification banner is displayed")
self.sumo_pages.edit_profile_flow.check_all_profile_contribution_areas(checked=True)
with allure.step("Verifying that the profile groups section is no longer displayed "
"inside the profile section"):
self.sumo_pages.user_navbar._click_on_my_profile_option()
expect(
self.sumo_pages.my_profile_page._groups_section_element()
).to_be_hidden()
check.equal(
self.sumo_pages.edit_my_profile_con_areas_page._edit_con_areas_pref_banner_txt(),
EditContributionAreasPageMessages.PREFERENCES_SAVED_NOTIFICATION_BANNER_TEXT,
f"Incorrect notification banner text is displayed."
f" Expected:"
f"{EditContributionAreasPageMessages.PREFERENCES_SAVED_NOTIFICATION_BANNER_TEXT}"
f" received: "
f"{self.sumo_pages.edit_my_profile_con_areas_page._edit_con_areas_pref_banner_txt()}",
)
with allure.step("Logging in with a different user and accessing the original user "
"profile"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts['TEST_ACCOUNT_13']
))
self.logger.info("Verifying that the profile groups section is no longer displayed "
"inside the profile section")
self.sumo_pages.user_navbar._click_on_my_profile_option()
expect(
self.sumo_pages.my_profile_page._groups_section_element()
).to_be_hidden()
self.logger.info(
"Logging in with a different user and accessing the original user profile"
)
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts['TEST_ACCOUNT_13']
))
self.navigate_to_link(MyProfileMessages.get_my_profile_stage_url(original_user))
self.logger.info("Verifying that the groups section is not longer displayed for the "
"original user")
expect(
self.sumo_pages.my_profile_page._groups_section_element()
).to_be_hidden()
with allure.step("Navigating to the my profile page and verifying that the groups "
"section is no longer displayed for the original user"):
self.navigate_to_link(MyProfileMessages.get_my_profile_stage_url(original_user))
expect(
self.sumo_pages.my_profile_page._groups_section_element()
).to_be_hidden()

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -1,5 +1,6 @@
import allure
import pytest
import pytest_check as check
from pytest_check import check
from playwright_tests.core.testutilities import TestUtilities
from playwright_tests.messages.my_profile_pages_messages.edit_settings_page_messages import (
@ -10,49 +11,26 @@ class TestEditMySettings(TestUtilities):
# C891396, C2108836
@pytest.mark.userSettings
def test_all_checkboxes_can_be_selected_and_saved(self):
self.logger.info(
"Signing in to a normal user account "
)
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts['TEST_ACCOUNT_12']
))
with allure.step("Signing in with a non-admin account"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts['TEST_ACCOUNT_12']
))
self.sumo_pages.edit_profile_flow.check_all_user_settings()
with check, allure.step("Checking all user settings and verifying that the correct "
"notification banner is displayed and all checkboxes are checked"):
self.sumo_pages.edit_profile_flow.check_all_user_settings()
assert self.sumo_pages.edit_my_profile_settings_page._settings_saved_notif_banner_txt(
) == EditSettingsPageMessages.MODIFIED_SETTINGS_NOTIFICATION_BANNER_MESSAGE
assert (
self.sumo_pages.edit_my_profile_settings_page._are_all_checkbox_checked()
), "Not all checkboxes are checked!"
self.logger.info("Verifying that the correct notification banner is displayed")
check.equal(
self.sumo_pages.edit_my_profile_settings_page._settings_saved_notif_banner_txt(),
EditSettingsPageMessages.MODIFIED_SETTINGS_NOTIFICATION_BANNER_MESSAGE,
f"Incorrect message displayed inside the notification banner. Expected:"
f" {EditSettingsPageMessages.MODIFIED_SETTINGS_NOTIFICATION_BANNER_MESSAGE} "
f"but received: "
f"{self.sumo_pages.edit_my_profile_settings_page._settings_saved_notif_banner_txt()}",
)
self.logger.info("Verifying that all the checkboxes are checked")
assert (
self.sumo_pages.edit_my_profile_settings_page._are_all_checkbox_checked()
), "Not all checkboxes are checked!"
self.logger.info(
"Unchecking all the available checkboxes and clicking on the 'Update' button"
)
self.sumo_pages.edit_profile_flow.check_all_user_settings()
self.logger.info("Verifying that the correct notification banner is displayed")
check.equal(
self.sumo_pages.edit_my_profile_settings_page._settings_saved_notif_banner_txt(),
EditSettingsPageMessages.MODIFIED_SETTINGS_NOTIFICATION_BANNER_MESSAGE,
f"Incorrect message displayed inside the notification banner. Expected:"
f" {EditSettingsPageMessages.MODIFIED_SETTINGS_NOTIFICATION_BANNER_MESSAGE} "
f"but received: "
f"{self.sumo_pages.edit_my_profile_settings_page._settings_saved_notif_banner_txt()}",
)
self.logger.info("Verifying that all the checkboxes are unchecked")
assert not (
self.sumo_pages.edit_my_profile_settings_page._are_all_checkbox_checked()
), "Not all checkboxes are unchecked!"
with check, allure.step("Unchecking all the checkboxes and verifying that the correct "
"notification banner is displayed and all checkboxes are "
"unchecked"):
self.sumo_pages.edit_profile_flow.check_all_user_settings()
assert self.sumo_pages.edit_my_profile_settings_page._settings_saved_notif_banner_txt(
) == EditSettingsPageMessages.MODIFIED_SETTINGS_NOTIFICATION_BANNER_MESSAGE
assert not (
self.sumo_pages.edit_my_profile_settings_page._are_all_checkbox_checked()
), "Not all checkboxes are unchecked!"

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

@ -1,5 +1,6 @@
import allure
import pytest
import pytest_check as check
from pytest_check import check
from playwright.sync_api import expect
from playwright_tests.core.testutilities import TestUtilities
@ -14,359 +15,252 @@ class TestMyProfilePage(TestUtilities):
# C891409
@pytest.mark.userProfile
def test_my_profile_page_can_be_accessed_via_top_navbar(self):
self.logger.info("Signing in with a normal user account")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts['TEST_ACCOUNT_12']
))
with allure.step("Signing in with a non-admin user account"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts['TEST_ACCOUNT_12']
))
original_username = self.sumo_pages.top_navbar._get_text_of_logged_in_username()
self.logger.info("Accessing the 'My profile' page via the top-navbar menu")
self.sumo_pages.top_navbar._click_on_view_profile_option()
with allure.step("Accessing the 'My profile' page and verifying that we are redirected "
"to the correct profile"):
self.sumo_pages.top_navbar._click_on_view_profile_option()
expect(
self.page
).to_have_url(MyProfileMessages.get_my_profile_stage_url(username=original_username))
self.logger.info(
"Verifying that we are on the correct URL and viewing the correct profile"
)
expect(
self.page
).to_have_url(MyProfileMessages.get_my_profile_stage_url(username=original_username))
with check, allure.step("Verifying that the page header is the expected one"):
assert self.sumo_pages.my_profile_page._get_my_profile_page_header(
) == MyProfileMessages.STAGE_MY_PROFILE_PAGE_HEADER
self.logger.info("Verifying that the page header is the expected one")
check.equal(
self.sumo_pages.my_profile_page._get_my_profile_page_header(),
MyProfileMessages.STAGE_MY_PROFILE_PAGE_HEADER,
f"Page header is {self.sumo_pages.my_profile_page._get_my_profile_page_header()}"
f"Expected to be {MyProfileMessages.STAGE_MY_PROFILE_PAGE_HEADER}",
)
self.logger.info("Verifying that the 'My profile' navbar option is selected")
check.equal(
self.sumo_pages.my_profile_page._get_text_of_selected_navbar_option(),
UserProfileNavbarMessages.NAVBAR_OPTIONS[0],
f"Selected navbar option is: "
f"{self.sumo_pages.my_profile_page._get_text_of_selected_navbar_option}"
f"Expected to be: {UserProfileNavbarMessages.NAVBAR_OPTIONS[0]}",
)
with check, allure.step("Verifying that the 'My profile' navbar option is selected"):
assert self.sumo_pages.my_profile_page._get_text_of_selected_navbar_option(
) == UserProfileNavbarMessages.NAVBAR_OPTIONS[0]
# C891411
@pytest.mark.userProfile
def test_my_profile_sign_out_button_functionality(self):
self.logger.info("Signing in with a normal user account")
self.sumo_pages.top_navbar._click_on_signin_signup_button()
with allure.step("Signing in with a non-admin account"):
self.sumo_pages.top_navbar._click_on_signin_signup_button()
self.sumo_pages.auth_flow_page.sign_in_flow(
username=super().user_special_chars,
account_password=super().user_secrets_pass
)
self.sumo_pages.auth_flow_page.sign_in_flow(
username=super().user_special_chars,
account_password=super().user_secrets_pass
)
self.logger.info("Accessing the 'My profile' page via the top-navbar menu")
self.sumo_pages.top_navbar._click_on_view_profile_option()
with allure.step("Accessing the my profile page, clicking on the sign out button and "
"verifying that the user is redirected to the homepage"):
self.sumo_pages.top_navbar._click_on_view_profile_option()
self.sumo_pages.my_profile_page._click_my_profile_page_sign_out_button()
expect(
self.page
).to_have_url(HomepageMessages.STAGE_HOMEPAGE_URL_EN_US)
self.logger.info("Clicking on the 'Sign Out' button from the 'My Profile' page")
self.sumo_pages.my_profile_page._click_my_profile_page_sign_out_button()
self.logger.info("Verifying that the user is redirected to the homepage")
expect(
self.page
).to_have_url(HomepageMessages.STAGE_HOMEPAGE_URL_EN_US)
self.logger.info("Verify that the 'Sign in/Up' button from the page header is displayed")
expect(
self.sumo_pages.top_navbar._sign_in_up_button_displayed_element()
).to_be_visible()
with allure.step("Verify that the 'Sign in/Up' button from the page header is displayed"):
expect(
self.sumo_pages.top_navbar._sign_in_up_button_displayed_element()
).to_be_visible()
# C2108828
@pytest.mark.userProfile
def test_provided_solutions_number_is_successfully_displayed(self):
self.logger.info("Signing in with a normal user account")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Signing in with an admin user account"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
repliant_username = self.sumo_pages.top_navbar._get_text_of_logged_in_username()
self.logger.info("Navigating to the Firefox AAQ form")
self.navigate_to_link(
super().aaq_question_test_data["products_aaq_url"]["Firefox"]
)
self.logger.info("Posting a new AAQ question for Firefox product")
question_info = (
self.sumo_pages.aaq_flow.submit_an_aaq_question_for_a_product(
subject=super().aaq_question_test_data["valid_firefox_question"]["subject"],
topic_name=super().aaq_question_test_data["valid_firefox_question"]["topic_value"],
body=super().aaq_question_test_data["valid_firefox_question"]["question_body"]
with allure.step("Navigating to the Firefox AAQ form and posting a new AAQ question for "
"the Firefox product"):
self.navigate_to_link(
super().aaq_question_test_data["products_aaq_url"]["Firefox"]
)
question_info = (
self.sumo_pages.aaq_flow.submit_an_aaq_question(
subject=super().aaq_question_test_data["valid_firefox_question"]["subject"],
topic_name=super(
).aaq_question_test_data["valid_firefox_question"]["topic_value"],
body=super().aaq_question_test_data["valid_firefox_question"]["question_body"]
)
)
)
self.sumo_pages.top_navbar._click_on_view_profile_option()
with allure.step("Navigating to the user profile page and extracting the original number "
"of posted question solutions"):
self.sumo_pages.top_navbar._click_on_view_profile_option()
original_number_of_solutions = self.number_extraction_from_string(
self.sumo_pages.my_profile_page._get_my_profile_solutions_text()
)
self.logger.info("Extracting original number of posted solutions")
original_number_of_solutions = self.number_extraction_from_string(
self.sumo_pages.my_profile_page._get_my_profile_solutions_text()
)
with allure.step("Navigating to the previously posted question and posting a reply to it"):
self.navigate_to_link(question_info["question_page_url"])
question_test_data = super().question_test_data
self.sumo_pages.question_page._add_text_to_post_a_reply_textarea(
question_test_data["question_reply_solution"]
)
answer_id = self.sumo_pages.question_page._click_on_post_reply_button(
repliant_username=repliant_username
)
self.logger.info("Navigating to the previously posted question")
self.navigate_to_link(question_info["question_page_url"])
with allure.step("Marking the reply as the question solution"):
self.sumo_pages.question_page._click_on_solves_the_problem_button(
target_reply_id=answer_id)
self.logger.info("Posting a reply for the question")
question_test_data = super().question_test_data
self.sumo_pages.question_page._add_text_to_post_a_reply_textarea(
question_test_data["question_reply_solution"]
)
self.logger.info("Clicking on the 'Post Reply' button and extracting answer id from url")
answer_id = self.sumo_pages.question_page._click_on_post_reply_button(
repliant_username=repliant_username
)
self.logger.info("Marking the reply as the solution")
self.sumo_pages.question_page._click_on_solves_the_problem_button(
target_reply_id=answer_id)
self.logger.info(
"Accessing the 'My profile' page of the account which provided a solution"
)
self.sumo_pages.top_navbar._click_on_view_profile_option()
new_number = self.number_extraction_from_string(
self.sumo_pages.my_profile_page._get_my_profile_solutions_text()
)
assert (
with allure.step("Accessing the 'My profile' page of the account which provided the "
"solution and verifying that the original number of solutions has "
"incremented"):
self.sumo_pages.top_navbar._click_on_view_profile_option()
self.number_extraction_from_string(
self.sumo_pages.my_profile_page._get_my_profile_solutions_text()
)
== original_number_of_solutions + 1
), (
f"The number of questions should have incremented! "
f"The original number of question was: {original_number_of_solutions}"
f" The new number of questions is: "
f"{new_number}"
)
assert (self.number_extraction_from_string(
self.sumo_pages.my_profile_page._get_my_profile_solutions_text(
)) == original_number_of_solutions + 1
)
self.logger.info("Deleting the my posted question")
self.navigate_to_link(question_info["question_page_url"])
self.sumo_pages.question_page._click_delete_this_question_question_tools_option()
self.sumo_pages.question_page._click_delete_this_question_button()
self.logger.info("Verifying that we are on the product support forum page after deletion")
expect(
self.sumo_pages.product_support_page._product_product_title_element()
).to_be_visible()
with allure.step("Deleting the posted question and verifying that we are redirected to "
"the product support forum page after deletion"):
self.navigate_to_link(question_info["question_page_url"])
self.sumo_pages.question_page._click_delete_this_question_question_tools_option()
self.sumo_pages.question_page._click_delete_this_question_button()
expect(
self.sumo_pages.product_support_page._product_product_title_element()
).to_be_visible()
# C890832, C2094281
@pytest.mark.userProfile
def test_number_of_my_profile_answers_is_successfully_displayed(self):
reply_text = None
self.logger.info("Signing in with a user account")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Signing in with an admin user"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
repliant_user = self.sumo_pages.top_navbar._get_text_of_logged_in_username()
self.logger.info("Accessing the 'My profile' page via the top-navbar menu")
self.sumo_pages.top_navbar._click_on_view_profile_option()
self.logger.info("Extracting original number of posted answers")
original_number_of_answers = self.number_extraction_from_string(
self.sumo_pages.my_profile_page._get_my_profile_answers_text()
)
self.logger.info("Navigating to the Firefox AAQ form")
self.navigate_to_link(
super().aaq_question_test_data["products_aaq_url"]["Firefox"]
)
self.logger.info("Posting a new AAQ question")
question_info = (
self.sumo_pages.aaq_flow.submit_an_aaq_question_for_a_product(
subject=super().aaq_question_test_data["valid_firefox_question"]["subject"],
topic_name=super().aaq_question_test_data["valid_firefox_question"]["topic_value"],
body=super().aaq_question_test_data["valid_firefox_question"]["question_body"]
with allure.step("Accessing the 'My profile' page and extracting the number of posted "
"answers"):
self.sumo_pages.top_navbar._click_on_view_profile_option()
original_number_of_answers = self.number_extraction_from_string(
self.sumo_pages.my_profile_page._get_my_profile_answers_text()
)
)
self.logger.info("Posting a reply for the question")
question_test_data = super().question_test_data
with allure.step("Navigating to the Firefox AAQ form and posting a new AAQ question"):
self.navigate_to_link(
super().aaq_question_test_data["products_aaq_url"]["Firefox"]
)
question_info = (
self.sumo_pages.aaq_flow.submit_an_aaq_question(
subject=super().aaq_question_test_data["valid_firefox_question"]["subject"],
topic_name=super(
).aaq_question_test_data["valid_firefox_question"]["topic_value"],
body=super().aaq_question_test_data["valid_firefox_question"]["question_body"]
)
)
reply_text = question_test_data["non_solution_reply"]
with allure.step("Posting a reply for the question"):
question_test_data = super().question_test_data
reply_text = question_test_data["non_solution_reply"]
self.sumo_pages.question_page._add_text_to_post_a_reply_textarea(reply_text)
answer_id = self.sumo_pages.question_page._click_on_post_reply_button(
repliant_username=repliant_user
)
self.sumo_pages.question_page._add_text_to_post_a_reply_textarea(reply_text)
self.logger.info("Clicking on the 'Post Reply' button and extracting answer id from url")
answer_id = self.sumo_pages.question_page._click_on_post_reply_button(
repliant_username=repliant_user
)
self.logger.info("Accessing the 'My profile' page by clicking on the replient username")
self.sumo_pages.question_page._click_on_the_reply_author(answer_id)
self.logger.info("Verify that my number of profile answers has incremented successfully")
new_number = self.number_extraction_from_string(
self.sumo_pages.my_profile_page._get_my_profile_answers_text()
)
assert (
with allure.step("Accessing the 'My profile' page and verifying that the number of "
"answers has incremented successfully"):
self.sumo_pages.question_page._click_on_the_reply_author(answer_id)
self.number_extraction_from_string(
self.sumo_pages.my_profile_page._get_my_profile_answers_text()
)
== original_number_of_answers + 1
), (
f"The number of questions should have incremented! "
f"The original number of question was: {original_number_of_answers}"
f" The new number of questions is: "
f"{new_number}"
)
assert (
self.number_extraction_from_string(
self.sumo_pages.my_profile_page._get_my_profile_answers_text()
) == original_number_of_answers + 1
)
self.sumo_pages.my_profile_page._click_my_profile_answers_link()
self.logger.info(
"Verify that my answer is successfully displayed inside the profile answers list"
)
with allure.step("Clicking on the my profile answers and verifying that the posted "
"answer is successfully displayed inside the list"):
self.sumo_pages.my_profile_page._click_my_profile_answers_link()
assert reply_text == self.sumo_pages.my_answers_page._get_my_answer_text(
answer_id=answer_id
), "My question reply is not displayed inside the my profile answers list"
assert reply_text == self.sumo_pages.my_answers_page._get_my_answer_text(
answer_id=answer_id
), "My question reply is not displayed inside the my profile answers list"
self.logger.info("Deleting the my posted question")
self.navigate_to_link(question_info["question_page_url"])
self.sumo_pages.question_page._click_delete_this_question_question_tools_option()
self.sumo_pages.question_page._click_delete_this_question_button()
self.logger.info("Verifying that we are on the product support forum page after deletion")
expect(
self.sumo_pages.product_support_page._product_product_title_element()
).to_be_visible()
with allure.step("Deleting the posted question and verifying that the user is redirected "
"to the product support forum page"):
self.navigate_to_link(question_info["question_page_url"])
self.sumo_pages.question_page._click_delete_this_question_question_tools_option()
self.sumo_pages.question_page._click_delete_this_question_button()
expect(
self.sumo_pages.product_support_page._product_product_title_element()
).to_be_visible()
# C2094285, C2094284, C891309
@pytest.mark.userProfile
def test_number_of_posted_articles_is_successfully_displayed(self):
self.logger.info("Logging in with an moderator account")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Signing in with an admin account"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
self.logger.info("Accessing the View Profile page")
self.sumo_pages.top_navbar._click_on_view_profile_option()
self.logger.info("Extracting the number of posted documents")
original_number_of_documents = self.number_extraction_from_string(
self.sumo_pages.my_profile_page._get_my_profile_documents_text()
)
self.logger.info("Create a new simple article")
article_details = self.sumo_pages.submit_kb_article_flow.submit_simple_kb_article()
self.logger.info("Accessing the View Profile page")
self.sumo_pages.top_navbar._click_on_view_profile_option()
self.logger.info("Verifying that the number of posted documents has incremented")
new_number = self.number_extraction_from_string(
self.sumo_pages.my_profile_page._get_my_profile_documents_text()
)
assert (
self.number_extraction_from_string(
with allure.step("Accessing the profile page and extracting the number of documents"):
self.sumo_pages.top_navbar._click_on_view_profile_option()
original_number_of_documents = self.number_extraction_from_string(
self.sumo_pages.my_profile_page._get_my_profile_documents_text()
)
== original_number_of_documents + 1
), (
f"The number of documents should have incremented! "
f"The original number of documents was: {original_number_of_documents}"
f" The new number of documents is: "
f"{new_number}"
)
self.logger.info("Click on the my posted documents link")
self.sumo_pages.my_profile_page._click_on_my_profile_document_link()
with allure.step("Creating a kb article"):
article_details = self.sumo_pages.submit_kb_article_flow.submit_simple_kb_article()
self.logger.info(
"Verifying that the posted document is listed inside the my profile documents list"
)
assert (
article_details['article_title'] in self.sumo_pages.my_documents_page.
_get_text_of_document_links()
), (f"The {article_details['article_title']} is not listed inside the my posted documents "
f"list")
with allure.step("Accessing the profile page and verifying that the number of posted "
"documents has incremented"):
self.sumo_pages.top_navbar._click_on_view_profile_option()
assert (
self.number_extraction_from_string(
self.sumo_pages.my_profile_page._get_my_profile_documents_text()
) == original_number_of_documents + 1
)
self.logger.info(
"Verifying that clicking on the posted article title redirects the "
"user to that article"
)
self.sumo_pages.my_documents_page._click_on_a_particular_document(
article_details['article_title']
)
with allure.step("Clicking on my posted documents link and verifying that the posted "
"document is listed"):
self.sumo_pages.my_profile_page._click_on_my_profile_document_link()
assert (
article_details['article_title'] in self.sumo_pages.my_documents_page.
_get_text_of_document_links()
)
self.logger.info("Deleting the created article")
self.sumo_pages.kb_article_page._click_on_show_history_option()
self.sumo_pages.kb_article_show_history_page._click_on_delete_this_document_button()
self.sumo_pages.kb_article_show_history_page._click_on_confirmation_delete_button()
with allure.step("Deleting the article"):
self.sumo_pages.my_documents_page._click_on_a_particular_document(
article_details['article_title']
)
self.sumo_pages.kb_article_deletion_flow.delete_kb_article()
# C1491023
@pytest.mark.userProfile
def test_accounts_with_symbols_are_getting_a_corresponding_valid_username(self):
self.logger.info(
"Signing in with an account that contains SUMO-supported and unsupported characters"
)
with allure.step("Signing in with an account that contains SUMO-supported and "
"unsupported characters"):
self.sumo_pages.top_navbar._click_on_signin_signup_button()
self.sumo_pages.top_navbar._click_on_signin_signup_button()
username = self.username_extraction_from_email(
self.remove_character_from_string(
self.sumo_pages.auth_flow_page.sign_in_flow(
username=super().user_special_chars,
account_password=super().user_secrets_pass
),
"*",
))
username = self.username_extraction_from_email(
self.remove_character_from_string(
self.sumo_pages.auth_flow_page.sign_in_flow(
username=super().user_special_chars,
account_password=super().user_secrets_pass
),
"*",
))
with allure.step("Verifying that the username contains the supported characters and "
"doesn't contain the unsupported ones in top navbar"):
assert self.sumo_pages.top_navbar._get_text_of_logged_in_username() == username
self.logger.info(
"Verifying that the username contains the supported characters "
"and doesn't contain the unsupported ones in top navbar"
)
assert self.sumo_pages.top_navbar._get_text_of_logged_in_username() == username, (
f" The displayed username inside the top-navbar is incorrect. "
f"The displayed username should be: {username} "
f"but instead is : {self.sumo_pages.top_navbar._get_text_of_logged_in_username()}"
)
with allure.step("Verifying that the username contains the supported characters and "
"doesn't contain the unsupported ones in My Profile page"):
self.sumo_pages.top_navbar._click_on_view_profile_option()
assert (self.sumo_pages.my_profile_page._get_my_profile_display_name_header_text()
== username)
self.logger.info(
"Verifying that the username contains the supported characters "
"and doesn't contain the unsupported ones in My Profile page"
)
self.sumo_pages.top_navbar._click_on_view_profile_option()
assert (self.sumo_pages.my_profile_page._get_my_profile_display_name_header_text()
== username), (
f"The displayed username inside the my profile page is incorrect. "
f"The displayed username should be: {username}"
f"but instead is: "
f"{self.sumo_pages.my_profile_page._get_my_profile_display_name_header_text()}"
)
self.logger.info(
"Verifying that the username contains the supported characters and "
"doesn't contain the unsupported ones in Edit my Profile page"
)
self.sumo_pages.top_navbar._click_on_edit_profile_option()
assert (
self.sumo_pages.edit_my_profile_page._get_username_input_field_value() == username), (
f"The displayed username inside the Edit my Profile page is incorrect. "
f"The displayed field value should be: {username}"
f"but instead is: "
f"{self.sumo_pages.edit_my_profile_page._get_username_input_field_value()}"
)
with allure.step("Verifying that the username contains the supported characters and "
"doesn't contain the unsupported ones in Edit my Profile page"):
self.sumo_pages.top_navbar._click_on_edit_profile_option()
assert (self.sumo_pages.edit_my_profile_page._get_username_input_field_value(
) == username)

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

@ -1,3 +1,4 @@
import allure
import pytest
from playwright.sync_api import expect
@ -10,262 +11,196 @@ class TestMyQuestions(TestUtilities):
# C2094280, C890790
@pytest.mark.userQuestions
def test_number_of_questions_is_incremented_when_posting_a_question(self):
self.logger.info("Signing in wit a normal user account")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Signing in with an admin account"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
self.logger.info("Accessing the 'My profile' page via the top-navbar menu")
self.sumo_pages.top_navbar._click_on_view_profile_option()
self.logger.info("Extracting original number of posted questions")
original_number_of_questions = self.number_extraction_from_string(
self.sumo_pages.my_profile_page._get_my_profile_questions_text()
)
self.logger.info("Navigating to the Firefox AAQ form")
self.navigate_to_link(
super().aaq_question_test_data["products_aaq_url"]["Firefox"]
)
self.logger.info("Posting a new AAQ question for Firefox product")
question_info = (
self.sumo_pages.aaq_flow.submit_an_aaq_question_for_a_product(
subject=super().aaq_question_test_data["valid_firefox_question"]["subject"],
topic_name=super().aaq_question_test_data["valid_firefox_question"]["topic_value"],
body=super().aaq_question_test_data["valid_firefox_question"]["question_body"]
with allure.step("Accessing the 'My profile' page and extracting the original number of "
"posted questions"):
self.sumo_pages.top_navbar._click_on_view_profile_option()
original_number_of_questions = self.number_extraction_from_string(
self.sumo_pages.my_profile_page._get_my_profile_questions_text()
)
)
self.logger.info("Navigating back to the My Profile page")
self.sumo_pages.top_navbar._click_on_view_profile_option()
new_number = self.number_extraction_from_string(
self.sumo_pages.my_profile_page._get_my_profile_questions_text()
)
with allure.step("Navigating to the AAQ form and posting a new AAQ question"):
self.navigate_to_link(
super().aaq_question_test_data["products_aaq_url"]["Firefox"]
)
question_info = (
self.sumo_pages.aaq_flow.submit_an_aaq_question(
subject=super().aaq_question_test_data["valid_firefox_question"]["subject"],
topic_name=super(
).aaq_question_test_data["valid_firefox_question"]["topic_value"],
body=super().aaq_question_test_data["valid_firefox_question"]["question_body"]
)
)
assert (
new_number
== original_number_of_questions + 1
), (
f"The number of questions should have incremented! "
f"The original number of question was: "
f"{original_number_of_questions}"
f" The new number of questions is: "
f"{new_number}"
)
with allure.step("Navigating back to the profile page and verifying that the number of "
"questions has incremented"):
self.sumo_pages.top_navbar._click_on_view_profile_option()
new_number = self.number_extraction_from_string(
self.sumo_pages.my_profile_page._get_my_profile_questions_text()
)
assert new_number == original_number_of_questions + 1
self.logger.info("Deleting the my posted question")
self.navigate_to_link(question_info["question_page_url"])
self.sumo_pages.question_page._click_delete_this_question_question_tools_option()
self.sumo_pages.question_page._click_delete_this_question_button()
with allure.step("Deleting the posted question"):
self.navigate_to_link(question_info["question_page_url"])
self.sumo_pages.question_page._click_delete_this_question_question_tools_option()
self.sumo_pages.question_page._click_delete_this_question_button()
self.logger.info("Verifying that we are on the product support forum page after deletion")
expect(
self.sumo_pages.product_support_page._product_product_title_element()
).to_be_visible()
with allure.step("Verifying that we are on the product support forum page after deletion"):
expect(
self.sumo_pages.product_support_page._product_product_title_element()
).to_be_visible()
# write tests to check my questions section as well
# C1296000, # C890790
@pytest.mark.userQuestions
def test_my_contributions_questions_reflects_my_questions_page_numbers(self):
self.logger.info("Signing in with a normal user account")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_12"]
))
with allure.step("Signing in with a non-admin account"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_12"]
))
self.logger.info("Accessing the 'My profile' page via the top-navbar menu")
self.sumo_pages.top_navbar._click_on_view_profile_option()
with allure.step("Accessing the 'My profile' and extracting the number of questions "
"listed inside the my profile page"):
self.sumo_pages.top_navbar._click_on_view_profile_option()
number_of_questions = self.number_extraction_from_string(
self.sumo_pages.my_profile_page._get_my_profile_questions_text()
)
self.logger.info("Extracting the number of questions listed inside the my profile page")
number_of_questions = self.number_extraction_from_string(
self.sumo_pages.my_profile_page._get_my_profile_questions_text()
)
self.logger.info("Clicking on the my profile questions link")
self.sumo_pages.my_profile_page._click_on_my_profile_questions_link()
self.logger.info(
"Verifying that the number of questions from the"
" my profile pages matches the ones from my questions "
"page"
)
assert (number_of_questions
== self.sumo_pages.my_questions_page._get_number_of_questions()), (
f"The number of questions listed inside the my profile page is:"
f" {number_of_questions} "
f"The number of questions listed inside the my questions page is:"
f" {self.sumo_pages.my_questions_page._get_number_of_questions()}"
)
with allure.step("Clicking on the my profile questions link and verifying that the "
"number of questions from the my profile page matches the one from the "
"ones from my questions page"):
self.sumo_pages.my_profile_page._click_on_my_profile_questions_link()
assert (number_of_questions
== self.sumo_pages.my_questions_page._get_number_of_questions())
# C890821
@pytest.mark.userQuestions
def test_correct_messages_is_displayed_if_user_has_no_posted_questions(self):
self.logger.info("Signing in with a user which has no posted questions")
self.sumo_pages.top_navbar._click_on_signin_signup_button()
self.sumo_pages.auth_flow_page.sign_in_flow(
username=super().user_special_chars,
account_password=super().user_secrets_pass
)
with allure.step("Signing in with a user which has no posted questions"):
self.sumo_pages.top_navbar._click_on_signin_signup_button()
self.sumo_pages.auth_flow_page.sign_in_flow(
username=super().user_special_chars,
account_password=super().user_secrets_pass
)
original_user = self.sumo_pages.top_navbar._get_text_of_logged_in_username()
self.logger.info("Accessing the 'My questions' page")
self.sumo_pages.top_navbar._click_on_view_profile_option()
self.sumo_pages.user_navbar._click_on_my_questions_option()
self.logger.info("Verifying that the correct message is displayed")
assert (
self.sumo_pages.my_questions_page._get_text_of_no_question_message()
== MyQuestionsPageMessages.NO_POSTED_QUESTIONS_MESSAGE
), (
f"Incorrect message is displayed!. "
f"Expected: {MyQuestionsPageMessages.NO_POSTED_QUESTIONS_MESSAGE} "
f"received: {self.sumo_pages.my_questions_page._get_text_of_no_question_message()}"
)
self.logger.info("Verifying that a question list is not displayed")
expect(
self.sumo_pages.my_questions_page._is_question_list_displayed()
).to_be_hidden()
self.logger.info("Navigating to the Firefox AAQ form")
self.navigate_to_link(
super().aaq_question_test_data["products_aaq_url"]["Firefox"]
)
self.logger.info("Posting a new AAQ question for Firefox product")
question_info = (
self.sumo_pages.aaq_flow.submit_an_aaq_question_for_a_product(
subject=super().aaq_question_test_data["valid_firefox_question"]["subject"],
topic_name=super().aaq_question_test_data["valid_firefox_question"]["topic_value"],
body=super().aaq_question_test_data["valid_firefox_question"]["question_body"]
with allure.step("Accessing the 'My questions' page and verifying that the correct "
"message is displayed"):
self.sumo_pages.top_navbar._click_on_view_profile_option()
self.sumo_pages.user_navbar._click_on_my_questions_option()
assert (
self.sumo_pages.my_questions_page._get_text_of_no_question_message()
== MyQuestionsPageMessages.NO_POSTED_QUESTIONS_MESSAGE
)
)
self.logger.info(
"Accessing the my questions page and verifying that the "
"no questions message is no longer displayed"
)
with allure.step("Verifying that the question list is not displayed"):
expect(
self.sumo_pages.my_questions_page._is_question_list_displayed()
).to_be_hidden()
self.sumo_pages.top_navbar._click_on_view_profile_option()
self.sumo_pages.user_navbar._click_on_my_questions_option()
with allure.step("Navigating to the Firefox AAQ form and posting a new AAQ question for "
"the Firefox product"):
self.navigate_to_link(
super().aaq_question_test_data["products_aaq_url"]["Firefox"]
)
question_info = (
self.sumo_pages.aaq_flow.submit_an_aaq_question(
subject=super().aaq_question_test_data["valid_firefox_question"]["subject"],
topic_name=super(
).aaq_question_test_data["valid_firefox_question"]["topic_value"],
body=super().aaq_question_test_data["valid_firefox_question"]["question_body"]
)
)
expect(
self.sumo_pages.my_questions_page._is_no_question_message_displayed()
).to_be_hidden()
with allure.step("Accessing the my questions page and verifying that the no question "
"message is no longer displayed"):
self.sumo_pages.top_navbar._click_on_view_profile_option()
self.sumo_pages.user_navbar._click_on_my_questions_option()
expect(
self.sumo_pages.my_questions_page._is_no_question_message_displayed()
).to_be_hidden()
self.logger.info("Signing in with a moderator account")
self.sumo_pages.top_navbar._click_on_sign_out_button()
with allure.step("Signing in with an admin account and deleting the posted question"):
self.sumo_pages.top_navbar._click_on_sign_out_button()
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
self.navigate_to_link(question_info["question_page_url"])
self.sumo_pages.question_page._click_delete_this_question_question_tools_option()
self.sumo_pages.question_page._click_delete_this_question_button()
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Accessing the original user and verifying that the correct message is "
"displayed"):
self.navigate_to_link(
MyQuestionsPageMessages.get_stage_my_questions_url(original_user)
)
assert (
self.sumo_pages.my_questions_page._get_text_of_no_question_message()
== MyQuestionsPageMessages.get_no_posted_questions_other_user_message(
original_user)
)
self.logger.info("Deleting the my posted question")
self.navigate_to_link(question_info["question_page_url"])
self.sumo_pages.question_page._click_delete_this_question_question_tools_option()
self.sumo_pages.question_page._click_delete_this_question_button()
self.logger.info(
"Accessing the original user and verifying that the correct message is displayed"
)
self.navigate_to_link(
MyQuestionsPageMessages.get_stage_my_questions_url(original_user)
)
assert (
self.sumo_pages.my_questions_page._get_text_of_no_question_message()
== MyQuestionsPageMessages.get_no_posted_questions_other_user_message(original_user)
), (
f"Incorrect message displayed! "
f"Expected: "
f"{MyQuestionsPageMessages.get_no_posted_questions_other_user_message(original_user)} "
f"received: "
f"{self.sumo_pages.my_questions_page._get_text_of_no_question_message()}"
)
self.logger.info(
"Sign in with the original user an verify that the "
"correct message and the question list is no longer displayed"
)
self.delete_cookies()
self.sumo_pages.top_navbar._click_on_signin_signup_button()
self.sumo_pages.auth_flow_page.sign_in_flow(
username=super().user_special_chars,
account_password=super().user_secrets_pass
)
self.sumo_pages.top_navbar._click_on_view_profile_option()
self.sumo_pages.user_navbar._click_on_my_questions_option()
assert (
self.sumo_pages.my_questions_page._get_text_of_no_question_message()
== MyQuestionsPageMessages.NO_POSTED_QUESTIONS_MESSAGE
), (
f"Incorrect message displayed! "
f"Expected: {MyQuestionsPageMessages.NO_POSTED_QUESTIONS_MESSAGE} "
f"received: {self.sumo_pages.my_questions_page._get_text_of_no_question_message()}"
)
with allure.step("Signing in with the original user and verifying that the correct "
"message and the question list is no longer displayed"):
self.delete_cookies()
self.sumo_pages.top_navbar._click_on_signin_signup_button()
self.sumo_pages.auth_flow_page.sign_in_flow(
username=super().user_special_chars,
account_password=super().user_secrets_pass
)
self.sumo_pages.top_navbar._click_on_view_profile_option()
self.sumo_pages.user_navbar._click_on_my_questions_option()
assert (
self.sumo_pages.my_questions_page._get_text_of_no_question_message()
== MyQuestionsPageMessages.NO_POSTED_QUESTIONS_MESSAGE
)
# C890823, C890831
@pytest.mark.userQuestions
def test_my_question_page_reflects_posted_questions_and_redirects_to_the_correct_question(
self,
):
self.logger.info("Signing in with a moderator user account")
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Signing in with an admin account"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
self.logger.info("Navigating to the Firefox AAQ form")
self.navigate_to_link(
super().aaq_question_test_data["products_aaq_url"]["Firefox"]
)
self.logger.info("Posting a new AAQ question for Firefox product")
question_info = (
self.sumo_pages.aaq_flow.submit_an_aaq_question_for_a_product(
subject=super().aaq_question_test_data["valid_firefox_question"]["subject"],
topic_name=super().aaq_question_test_data["valid_firefox_question"]["topic_value"],
body=super().aaq_question_test_data["valid_firefox_question"]["question_body"]
with allure.step("Navigating to the Firefox AAQ form and posting a new AAQ question"):
self.navigate_to_link(
super().aaq_question_test_data["products_aaq_url"]["Firefox"]
)
question_info = (
self.sumo_pages.aaq_flow.submit_an_aaq_question(
subject=super().aaq_question_test_data["valid_firefox_question"]["subject"],
topic_name=super(
).aaq_question_test_data["valid_firefox_question"]["topic_value"],
body=super().aaq_question_test_data["valid_firefox_question"]["question_body"]
)
)
)
self.logger.info(
"Verifying that the first element from the "
"My Questions page is the recently posted question"
)
self.sumo_pages.top_navbar._click_on_my_questions_profile_option()
with allure.step("Navigating to my questions profile page and verifying that the first "
"element from the My Questions page is the recently posted question"):
self.sumo_pages.top_navbar._click_on_my_questions_profile_option()
assert self.sumo_pages.my_questions_page._get_text_of_first_listed_question().replace(
" ", ""
) == question_info["aaq_subject"].replace(" ", "")
assert self.sumo_pages.my_questions_page._get_text_of_first_listed_question().replace(
" ", ""
) == question_info["aaq_subject"].replace(" ", ""), (
f" Expected: {question_info['aaq_subject']} "
f"Received: {self.sumo_pages.my_questions_page._get_text_of_first_listed_question()}"
)
self.logger.info(
"Clicking on the first listed item and verifying that "
"the user is redirected to the correct question"
)
self.sumo_pages.my_questions_page._click_on_a_question_by_index(1)
expect(
self.page
).to_have_url(question_info["question_page_url"])
with allure.step("Clicking on the first list item and verifying that the user is "
"redirected to the correct question"):
self.sumo_pages.my_questions_page._click_on_a_question_by_index(1)
expect(
self.page
).to_have_url(question_info["question_page_url"])
# assert self.sumo_pages.question_page.current_url() == question_info[
# "question_page_url"], ( f"We are on the wrong page. Expected: {question_info} "
# f"received: {self.sumo_pages.question_page.current_url()}" )
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()
with allure.step("Deleting the posted question"):
self.sumo_pages.aaq_flow.deleting_question_flow()

32
poetry.lock сгенерированный
Просмотреть файл

@ -11,6 +11,36 @@ files = [
{file = "alabaster-0.7.16.tar.gz", hash = "sha256:75a8b99c28a5dad50dd7f8ccdd447a121ddb3892da9e53d1ca5cca3106d58d65"},
]
[[package]]
name = "allure-pytest"
version = "2.13.2"
description = "Allure pytest integration"
optional = false
python-versions = "*"
files = [
{file = "allure-pytest-2.13.2.tar.gz", hash = "sha256:22243159e8ec81ce2b5254b4013802198821b1b42f118f69d4a289396607c7b3"},
{file = "allure_pytest-2.13.2-py3-none-any.whl", hash = "sha256:17de9dbee7f61c8e66a5b5e818b00e419dbcea44cb55c24319401ba813220690"},
]
[package.dependencies]
allure-python-commons = "2.13.2"
pytest = ">=4.5.0"
[[package]]
name = "allure-python-commons"
version = "2.13.2"
description = "Common module for integrate allure with python-based frameworks"
optional = false
python-versions = ">=3.6"
files = [
{file = "allure-python-commons-2.13.2.tar.gz", hash = "sha256:8a03681330231b1deadd86b97ff68841c6591320114ae638570f1ed60d7a2033"},
{file = "allure_python_commons-2.13.2-py3-none-any.whl", hash = "sha256:2bb3646ec3fbf5b36d178a5e735002bc130ae9f9ba80f080af97d368ba375051"},
]
[package.dependencies]
attrs = ">=16.0.0"
pluggy = ">=0.4.0"
[[package]]
name = "amqp"
version = "5.2.0"
@ -4794,4 +4824,4 @@ testing = ["coverage (>=5.0.3)", "zope.event", "zope.testing"]
[metadata]
lock-version = "2.0"
python-versions = "^3.11"
content-hash = "33119e30eb969203679def29e16bb783f79ab7ea23879a6ddfdab8099214a880"
content-hash = "345af3f80110ff3963071c53929d503114ffc87436c505a4ba5e5f671d854a5a"

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

@ -119,6 +119,7 @@ pytest-rerunfailures = "^12.0"
flake8 = "^7.0.0"
pytest-check = "^2.3.1"
playwright = "^1.42.0"
allure-pytest = "^2.13.2"
[build-system]
requires = ["poetry-core>=1.0.0"]