Merge pull request #6128 from emilghittasv/playwright-framework-refactor

Refactoring playwright framework
This commit is contained in:
Emil Ghitta 2024-07-19 01:03:01 +03:00 коммит произвёл GitHub
Родитель ae43b3b20a 4eef3588cb
Коммит c4eb68b1d5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
43 изменённых файлов: 11740 добавлений и 12229 удалений

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

@ -7,7 +7,7 @@ from playwright.sync_api import Page, ElementHandle, Locator, TimeoutError
class BasePage:
def __init__(self, page: Page):
self._page = page
self.page = page
def _get_element_locator(self, xpath: str, with_wait=True) -> Locator:
"""
@ -15,20 +15,20 @@ class BasePage:
"""
if with_wait:
self.__wait_for_dom_load_to_finnish()
return self._page.locator(xpath)
return self.page.locator(xpath)
def _get_elements_locators(self, xpath: str) -> list[Locator]:
"""
This helper function returns a list of element locators from a given xpath.
"""
self.__wait_for_dom_load_to_finnish()
return self._page.locator(xpath).all()
return self.page.locator(xpath).all()
def _get_current_page_url(self) -> str:
"""
This helper function returns the current page URL.
"""
return self._page.url
return self.page.url
def _get_element_handles(self, xpath: str) -> list[ElementHandle]:
"""
@ -86,7 +86,7 @@ class BasePage:
"""
This helper function pauses the execution for a given timeout.
"""
self._page.wait_for_timeout(timeout)
self.page.wait_for_timeout(timeout)
def _get_element_input_value(self, xpath: str) -> str:
"""
@ -98,13 +98,13 @@ class BasePage:
"""
This helper function returns the inner text of a given locator via the page instance.
"""
return self._page.inner_text(xpath)
return self.page.inner_text(xpath)
def _get_element_text_content(self, xpath: str) -> str:
"""
This helper function returns the text content of a given locator via the page instance.
"""
return self._page.text_content(xpath)
return self.page.text_content(xpath)
def _click(self, element: Union[str, Locator], with_wait=True):
"""
@ -182,7 +182,7 @@ class BasePage:
"""
This helper function accepts the displayed dialog.
"""
self._page.on("dialog", lambda dialog: dialog.accept())
self.page.on("dialog", lambda dialog: dialog.accept())
def _hover_over_element(self, xpath: str):
"""
@ -208,8 +208,8 @@ class BasePage:
1. Waits for the dom load to finish.
2. Waits for the load event to be fired when the whole page, including resources has loaded
"""
self._page.wait_for_load_state("domcontentloaded")
self._page.wait_for_load_state("load")
self.page.wait_for_load_state("domcontentloaded")
self.page.wait_for_load_state("load")
def _wait_for_selector(self, xpath: str, timeout=3500):
"""
@ -217,6 +217,6 @@ class BasePage:
timeout.
"""
try:
self._page.wait_for_selector(xpath, timeout=timeout)
self.page.wait_for_selector(xpath, timeout=timeout)
except TimeoutError:
print(f"{xpath} is not displayed")

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

@ -1,25 +1,20 @@
import logging
import inspect
import requests
import pytest
import time
import re
import json
import random
import os
from datetime import datetime
from playwright.sync_api import Page
from playwright_tests.messages.homepage_messages import HomepageMessages
from requests.exceptions import HTTPError
from playwright_tests.pages.top_navbar import TopNavbar
@pytest.mark.usefixtures("setup")
class TestUtilities:
logger = None
page = None
context = None
sumo_pages = None
requested_browser = None
def __init__(self, page: Page):
self.page = page
# Fetching test data from json files.
with open("test_data/profile_edit.json", "r") as edit_test_data_file:
@ -100,11 +95,10 @@ class TestUtilities:
self.clear_fxa_email(cleared_username)
return fxa_verification_code
except HTTPError as htt_err:
print(f"HTTP error occurred: {htt_err}. Polling again")
print(htt_err)
time.sleep(poll_interval)
except Exception as err:
print(f"Used: {cleared_username} Other error occurred: {err}. Polling again")
print(fxa_verification_code)
print(err)
time.sleep(poll_interval)
def username_extraction_from_email(self, string_to_analyze: str) -> str:
@ -131,26 +125,6 @@ class TestUtilities:
"""
return int(re.findall(fr'{endpoint}(\d+)', string_to_analyze)[0])
def get_logger(self):
"""
This helper function defines the logging mechanism in the following steps:
1. Retrieve the logger name from the call stack.
2. Create/ Get the logger.
3. Create a file handler.
4. Sets the log message format.
5. Attaching the formatter to the file handler and adding the file handler to the logger.
6. Sets the logging level to INFO.
"""
logger_name = inspect.stack()[1][3]
logger = logging.getLogger(logger_name)
file_handler = logging.FileHandler("reports/logs/logfile.log")
formatter = logging.Formatter("%(asctime)s : %(levelname)s : %(name)s : %(message)s")
file_handler.setFormatter(formatter)
logger.addHandler(file_handler)
logger.setLevel(logging.INFO)
return logger
def get_page_url(self) -> str:
"""
This helper function returns the current URL.
@ -228,19 +202,20 @@ class TestUtilities:
"""
This helper function stores the session state for further usage.
"""
self.context.storage_state(path=f"core/sessions/.auth/{session_file_name}.json")
self.page.context.storage_state(path=f"core/sessions/.auth/{session_file_name}.json")
def delete_cookies(self, tried_once=False):
"""
This helper function deletes all cookies and performs a page refresh so that the outcome
is visible immediately.
"""
self.context.clear_cookies()
top_navbar = TopNavbar(self.page)
self.page.context.clear_cookies()
self.refresh_page()
# In order to avoid test flakiness we are trying to delete the cookies again if the sign-in
# sign-up button is not visible after page refresh.
if not self.sumo_pages.top_navbar.is_sign_in_up_button_displayed and not tried_once:
if not top_navbar.is_sign_in_up_button_displayed and not tried_once:
self.delete_cookies(tried_once=True)
def start_existing_session(self, session_file_name: str, tried_once=False) -> str:
@ -248,18 +223,19 @@ class TestUtilities:
This helper function starts an existing session by applying the session cookies saved in
the /sessions/ folder.
"""
top_navbar = TopNavbar(self.page)
if not tried_once:
self.delete_cookies()
with open(f"core/sessions/.auth/{session_file_name}.json", 'r') as file:
cookies_data = json.load(file)
self.context.add_cookies(cookies=cookies_data['cookies'])
self.page.context.add_cookies(cookies=cookies_data['cookies'])
# A SUMO action needs to be done in order to have the page refreshed with the correct
# session
self.refresh_page()
# In order to avoid test flakiness we are trying to re-apply the session cookies again if
# the sign-in/up button is still displayed instead of the session username.
if self.sumo_pages.top_navbar.is_sign_in_up_button_displayed() and not tried_once:
if top_navbar.is_sign_in_up_button_displayed() and not tried_once:
self.start_existing_session(session_file_name, tried_once=True)
return session_file_name

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

@ -41,7 +41,7 @@ class AAQFlow(AAQFormPage, ProductSolutionsPage, TopNavbar, TestUtilities, Quest
if not is_premium:
# Waiting for submitted question reply button visibility.
super()._is_post_reply_button_visible()
current_page_url = self._page.url
current_page_url = self.page.url
return {"aaq_subject": question_subject, "question_page_url": current_page_url,
"question_body": body}

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

@ -42,7 +42,7 @@ class AddKbArticleFlow(TestUtilities, SubmitKBArticlePage, AddKbMediaFlow, KBArt
approve_first_revision=False,
ready_for_localization=False
) -> dict[str, Any]:
self._page.goto(KBArticlePageMessages.CREATE_NEW_KB_ARTICLE_STAGE_URL)
self.page.goto(KBArticlePageMessages.CREATE_NEW_KB_ARTICLE_STAGE_URL)
kb_article_test_data = super().kb_article_test_data
@ -154,7 +154,7 @@ class AddKbArticleFlow(TestUtilities, SubmitKBArticlePage, AddKbMediaFlow, KBArt
super()._add_text_to_expiry_date_field(expiry_date)
# We need to evaluate in order to fetch the slug field value
slug = self._page.evaluate(
slug = self.page.evaluate(
'document.getElementById("id_slug").value'
)

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

@ -0,0 +1,82 @@
from typing import Any
from playwright_tests.core.testutilities import TestUtilities
from playwright_tests.messages.explore_help_articles.kb_article_page_messages import \
KBArticlePageMessages
from playwright_tests.pages.explore_help_articles.articles.kb_article_discussion_page import \
KBArticleDiscussionPage
from playwright.sync_api import Page
from playwright_tests.pages.explore_help_articles.articles.kb_article_page import KBArticlePage
class KbThreads(TestUtilities, KBArticleDiscussionPage, KBArticlePage):
def __init__(self, page: Page):
super().__init__(page)
def delete_article_thread(self, thread_id: str, confirm_deletion=True):
super()._click_on_a_particular_thread(thread_id)
super()._click_on_delete_this_thread_option()
if confirm_deletion:
super()._click_on_delete_this_thread_reply_confirmation_button()
def add_new_kb_discussion_thread(self, title='') -> [dict[str, Any]]:
super()._click_on_editing_tools_discussion_option()
article_discussion_url = super()._get_url()
super()._click_on_post_a_new_thread_option()
if title == '':
thread_title = (super().kb_new_thread_test_data['new_thread_title'] + super()
.generate_random_number(0, 5000))
else:
thread_title = (title + super()
.generate_random_number(0, 5000))
thread_body = super().kb_new_thread_test_data['new_thread_body']
# Adding text to the title field.
super()._add_text_to_new_thread_title_field(thread_title)
# Adding text to the body field.
super()._add_text_to_new_thread_body_input_field(thread_body)
# Clicking on the post a new thread option.
super()._click_on_submit_new_thread_button()
# Fetching the article url & the thread id from the url.
thread_url = self.page.url
thread_id = str(super().number_extraction_from_string_endpoint(
KBArticlePageMessages.KB_ARTICLE_DISCUSSIONS_ENDPOINT, thread_url)
)
return {
"thread_title": thread_title,
"thread_body": thread_body,
"thread_url": thread_url,
"thread_id": thread_id,
"article_discussion_url": article_discussion_url
}
def _edit_article_thread(self, thread_title="", submit_edit=True):
super()._click_on_edit_this_thread_option()
super()._add_text_to_edit_article_thread_title_field(thread_title)
if submit_edit:
super()._click_on_edit_article_thread_update_button()
else:
super()._click_on_edit_article_thread_cancel_button()
def post_reply_to_thread(self, text: str, post_reply=True) -> dict[str, Any]:
super()._fill_the_thread_post_a_reply_textarea(text)
if post_reply:
super()._click_on_thread_post_reply_button()
return {
"reply_id": super()._get_thread_reply_id(super()._get_url())
}
def delete_reply_to_thread(self, reply_id: str, submit_deletion=True):
super()._click_on_dotted_menu_for_a_certain_reply(reply_id)
super()._click_on_delete_this_thread_reply(reply_id)
if submit_deletion:
super()._click_on_delete_this_thread_reply_confirmation_button()

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

@ -1,43 +0,0 @@
from typing import Any
from playwright_tests.core.testutilities import TestUtilities
from playwright_tests.messages.explore_help_articles.kb_article_page_messages import (
KBArticlePageMessages)
from playwright_tests.pages.explore_help_articles.articles.kb_article_discussion_page import (
KBArticleDiscussionPage)
from playwright.sync_api import Page
class PostNewDiscussionThreadFlow(TestUtilities, KBArticleDiscussionPage):
def __init__(self, page: Page):
super().__init__(page)
def add_new_kb_discussion_thread(self, title='') -> dict[str, Any]:
if title == '':
thread_title = (super().kb_new_thread_test_data['new_thread_title'] + super()
.generate_random_number(0, 5000))
else:
thread_title = (title + super()
.generate_random_number(0, 5000))
thread_body = super().kb_new_thread_test_data['new_thread_body']
# Adding text to the title field.
super()._add_text_to_new_thread_title_field(thread_title)
# Adding text to the body field.
super()._add_text_to_new_thread_body_input_field(thread_body)
# Clicking on the post a new thread option.
super()._click_on_submit_new_thread_button()
# Fetching the article url & the thread id from the url.
thread_url = self._page.url
thread_id = str(super().number_extraction_from_string_endpoint(
KBArticlePageMessages.KB_ARTICLE_DISCUSSIONS_ENDPOINT, thread_url)
)
return {
"thread_title": thread_title,
"thread_body": thread_body,
"thread_url": thread_url,
"thread_id": thread_id
}

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

@ -101,3 +101,6 @@ class KBArticlePage(BasePage):
def _click_on_volunteer_learn_more_option(self):
super()._click(self.__learn_more_kb_article_option)
def _get_url(self) -> str:
return super()._get_current_page_url()

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

@ -12,8 +12,8 @@ from playwright_tests.flows.explore_articles_flows.article_flows.delete_kb_artic
DeleteKbArticleFlow
from playwright_tests.flows.explore_articles_flows.article_flows.edit_article_meta_flow import \
EditArticleMetaFlow
from playwright_tests.flows.explore_articles_flows.article_flows.post_new_thread_flow import \
PostNewDiscussionThreadFlow
from playwright_tests.flows.explore_articles_flows.article_flows.kb_article_threads_flow import \
KbThreads
from playwright_tests.flows.messaging_system_flows.messaging_system_flow import (
MessagingSystemFlows)
from playwright_tests.flows.user_groups_flows.user_group_flow import UserGroupFlow
@ -204,9 +204,6 @@ class SumoPages:
# KB article deletion Flow
self.kb_article_deletion_flow = DeleteKbArticleFlow(page)
# KB article discussion Flow
self.post_kb_discussion_thread_flow = PostNewDiscussionThreadFlow(page)
# KB article edit metadata Flow
self.edit_article_metadata_flow = EditArticleMetaFlow(page)
@ -215,3 +212,6 @@ class SumoPages:
# User Group Flow
self.user_group_flow = UserGroupFlow(page)
# KB article threads Flow
self.kb_article_thread_flow = KbThreads(page)

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

@ -132,7 +132,7 @@ class MyProfileEdit(BasePage):
super()._fill(self.__people_directory_username_field, text)
def _send_text_to_matrix_nickname(self, text: str):
self._page.locator(self.__matrix_nickname_field).fill(text)
self.page.locator(self.__matrix_nickname_field).fill(text)
def _sent_text_to_city_field(self, text: str):
super()._fill(self.__city_field, text)

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

@ -2,7 +2,7 @@ import allure
import pytest
from pytest_check import check
from playwright.sync_api import expect
from playwright.sync_api import expect, Page
from playwright_tests.core.testutilities import TestUtilities
from playwright_tests.messages.ask_a_question_messages.AAQ_messages.aaq_form_page_messages import (
AAQFormMessages)
@ -12,496 +12,519 @@ from playwright_tests.messages.ask_a_question_messages.contact_support_messages
ContactSupportMessages)
from playwright_tests.messages.contribute_messages.con_pages.con_page_messages import (
ContributePageMessages)
from playwright_tests.pages.sumo_pages import SumoPages
class TestAAQPage(TestUtilities, AAQFormMessages):
# C2188694, C2188695
@pytest.mark.aaqPage
def test_community_card_and_helpful_tip_are_displayed_for_freemium_product(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Signing in with a non-admin user account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts['TEST_ACCOUNT_12']
))
# C2188694, C2188695
@pytest.mark.aaqPage
def test_community_card_and_helpful_tip_are_displayed_for_freemium_product(self):
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']
with allure.step("Navigating to each freemium aaq form"):
for freemium_product in test_utilities.general_test_data["freemium_products"]:
test_utilities.navigate_to_link(
test_utilities.aaq_question_test_data["products_aaq_url"][freemium_product]
)
with allure.step(f"Verifying that the helpful tip card is displayed for the "
f"{freemium_product} product"):
expect(sumo_pages.aaq_form_page._get_helpful_tip_locator()).to_be_visible()
with allure.step("Clicking on the 'Learn More' button from the community help "
"card and verifying that we are on the contribute messages page"):
sumo_pages.aaq_form_page._click_on_learn_more_button()
expect(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(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Signing in with a non-admin account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts['TEST_ACCOUNT_12']
))
with allure.step("Navigating to each premium aaq form"):
for premium_product in test_utilities.general_test_data["premium_products"]:
test_utilities.navigate_to_link(
test_utilities.aaq_question_test_data["products_aaq_url"][premium_product]
)
with allure.step(f"Verifying that the helpful tip options is displayed for the "
f"{premium_product}"):
expect(sumo_pages.aaq_form_page._get_helpful_tip_locator()).to_be_hidden()
with allure.step("Verifying that the 'Learn More' button from the community help "
"banner is not displayed"):
expect(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(page: Page, username):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
if username != '':
with allure.step(f"Singing in with {username} user"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts[username]
))
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]
)
with allure.step("Navigating to each premium product solutions page"):
for premium_product in test_utilities.general_test_data["premium_products"]:
test_utilities.navigate_to_link(
test_utilities.general_test_data["product_solutions"][premium_product]
)
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()
with allure.step(f"Verifying that the sam banner is not displayed for "
f"{premium_product} card"):
expect(sumo_pages.product_solutions_page._get_scam_banner_locator()).to_be_hidden()
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):
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']
))
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]
)
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()
with allure.step("Verifying that the 'Learn More' button from the community help "
if username != '':
with allure.step("Clicking on the Ask Now button and verifying that the scam "
"banner is not displayed"):
expect(
self.sumo_pages.aaq_form_page._get_learn_more_button_locator()
).to_be_hidden()
sumo_pages.product_solutions_page._click_ask_now_button()
test_utilities.wait_for_url_to_be(
test_utilities.aaq_question_test_data["products_aaq_url"][premium_product]
)
expect(sumo_pages.product_solutions_page._get_scam_banner_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 != '':
with allure.step(f"Singing in with {username} user"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts[username]
))
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]
)
# C2190040
@pytest.mark.aaqPage
@pytest.mark.parametrize("username", ['', 'TEST_ACCOUNT_12', 'TEST_ACCOUNT_MODERATOR'])
def test_scam_banner_for_freemium_products_is_displayed(page: Page, username):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
if username != '':
with allure.step(f"Signing in with {username} user"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts[username]
))
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()
with allure.step("Navigating to each freemium product solutions page"):
for freemium_product in test_utilities.general_test_data["freemium_products"]:
test_utilities.navigate_to_link(
test_utilities.general_test_data["product_solutions"][freemium_product]
)
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()
with check, allure.step("Verifying that the 'Learn More' button contains the "
"correct link"):
assert sumo_pages.product_solutions_page._get_scam_alert_banner_link(
) == QuestionPageMessages.AVOID_SCAM_SUPPORT_LEARN_MORE_LINK
# 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 != '':
with allure.step(f"Signing in with {username} user"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts[username]
))
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]
)
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(
if username != '':
with check, allure.step("Clicking on the Ask Now button and verifying that "
"the 'Learn More' button contains the correct link"):
sumo_pages.product_solutions_page._click_ask_now_button()
test_utilities.wait_for_url_to_be(
test_utilities.aaq_question_test_data["products_aaq_url"][freemium_product]
)
assert 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):
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']
))
# C890537
@pytest.mark.aaqPage
def test_corresponding_aaq_product_name_and_image_are_displayed(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Signing in with a non-admin account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts['TEST_ACCOUNT_12']
))
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])
with allure.step("Navigating to each product aaq form"):
for product in test_utilities.aaq_question_test_data["products_aaq_url"]:
test_utilities.navigate_to_link(
test_utilities.aaq_question_test_data["products_aaq_url"][product])
# 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()
# 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(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(sumo_pages.aaq_form_page._get_product_image_locator()).to_be_visible()
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
with check, allure.step("Verifying that the correct product header is displayed"):
assert sumo_pages.aaq_form_page._get_aaq_form_page_heading() == product
# C890535, C890536
@pytest.mark.aaqPage
def test_progress_milestone_redirect(self):
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']
))
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])
# C890535, C890536
@pytest.mark.aaqPage
def test_progress_milestone_redirect(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Signing in with a non-admin user account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts['TEST_ACCOUNT_12']
))
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(
) == super().IN_PROGRESS_MILESTONE
with allure.step("Navigating to each product AAQ form"):
for product in test_utilities.aaq_question_test_data["products_aaq_url"]:
test_utilities.navigate_to_link(
test_utilities.aaq_question_test_data["products_aaq_url"][product])
with allure.step(f"Clicking on the {super().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(
super().COMPLETED_MILESTONE_TWO)
expect(
self.page
).to_have_url(super().general_test_data["product_solutions"][product])
with check, allure.step("Verifying that the correct in progress milestone is "
"displayed"):
assert sumo_pages.aaq_form_page._get_in_progress_item_label(
) == AAQFormMessages.IN_PROGRESS_MILESTONE
with allure.step(f"Navigating back to the aaq form and clicking on the "
f"{super().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(
super().COMPLETED_MILESTONE_ONE)
expect(
self.page
).to_have_url(ContactSupportMessages.PAGE_URL_CHANGE_PRODUCT_REDIRECT)
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"):
sumo_pages.aaq_form_page._click_on_a_particular_completed_milestone(
AAQFormMessages.COMPLETED_MILESTONE_TWO)
expect(page).to_have_url(
test_utilities.general_test_data["product_solutions"][product])
# C890612
@pytest.mark.aaqPage
def test_aaq_form_cancel_button_freemium_products(self):
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"]
))
with allure.step(f"Navigating back to the aaq form and clicking on the "
f"{AAQFormMessages.COMPLETED_MILESTONE_ONE} milestone"):
test_utilities.navigate_to_link(
test_utilities.aaq_question_test_data["products_aaq_url"][product])
sumo_pages.aaq_form_page._click_on_a_particular_completed_milestone(
AAQFormMessages.COMPLETED_MILESTONE_ONE)
expect(page).to_have_url(ContactSupportMessages.PAGE_URL_CHANGE_PRODUCT_REDIRECT)
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()
)
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])
# C890612
@pytest.mark.aaqPage
def test_aaq_form_cancel_button_freemium_products(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Signing in with a non-admin user account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MESSAGE_1"]
))
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()
with allure.step("Accessing the 'My profile' page via the top-navbar menu and extracting "
"the original number of posted questions"):
sumo_pages.top_navbar._click_on_view_profile_option()
original_number_of_questions = test_utilities.number_extraction_from_string(
sumo_pages.my_profile_page._get_my_profile_questions_text()
)
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 allure.step("Navigating to each product AAQ form"):
for product in test_utilities.general_test_data["freemium_products"]:
test_utilities.navigate_to_link(
test_utilities.aaq_question_test_data["products_aaq_url"][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"):
topic_s = super().aaq_question_test_data['aaq_topic_tags'][product][topic]
if isinstance(topic_s, list):
slugs = topic_s
else:
slugs = [topic_s]
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"]
)
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"]
)
self.sumo_pages.aaq_form_page._click_aaq_form_submit_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"]
with allure.step("Adding data inside the AAQ form fields and clicking on the "
"cancel button"):
sumo_pages.aaq_flow.add__valid_data_to_all_aaq_fields_without_submitting(
subject=test_utilities.aaq_question_test_data["valid_firefox_question"]
["subject"],
topic_value=sumo_pages.aaq_form_page._get_aaq_form_topic_options()[0],
body_text=test_utilities.aaq_question_test_data["valid_firefox_question"]
["question_body"]
)
).to_be_visible()
sumo_pages.aaq_form_page._click_aaq_form_cancel_button()
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()
with allure.step("Verifying that we are redirected back to the correct product "
"solutions page"):
expect(page).to_have_url(
test_utilities.general_test_data["product_solutions"][product])
@pytest.mark.aaqPage
def test_additional_system_details_user_agent_information(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 check, allure.step("Navigating back to the My Profile page and verifying "
"that the correct number of posted questions is "
"displayed"):
sumo_pages.top_navbar._click_on_view_profile_option()
new_number = test_utilities.number_extraction_from_string(
sumo_pages.my_profile_page._get_my_profile_questions_text()
)
assert new_number == original_number_of_questions
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])
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"]
# C890614, C890613, C890538
@pytest.mark.aaqPage
def test_post_aaq_questions_for_all_freemium_products_topics(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Signing in with an admin account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Navigating to each product AAQ form"):
for product in test_utilities.general_test_data["freemium_products"]:
test_utilities.navigate_to_link(
test_utilities.aaq_question_test_data["products_aaq_url"][product])
for topic in sumo_pages.aaq_form_page._get_aaq_form_topic_options():
with allure.step(f"Submitting question for {product} product"):
question_info = sumo_pages.aaq_flow.submit_an_aaq_question(
subject=test_utilities.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"]
topic_name=topic,
body=test_utilities.aaq_question_test_data["valid_firefox_question"]
["question_body"],
attach_image=True
attach_image=False
)
with check, allure.step("Verifying that the correct user-agent information is "
with allure.step("Verifying that the correct implicit tags are added to the "
"question"):
topic_s = (test_utilities
.aaq_question_test_data['aaq_topic_tags'][product][topic])
if isinstance(topic_s, list):
slugs = topic_s
else:
slugs = [topic_s]
if (test_utilities.aaq_question_test_data['aaq_topic_tags'][product]
['default_slug'] != "none"):
slugs.append(
test_utilities.aaq_question_test_data['aaq_topic_tags'][product]
['default_slug']
)
assert (
all(map(
lambda x: x in 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"):
sumo_pages.question_page._click_on_my_questions_banner_option()
expect(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"):
sumo_pages.my_questions_page._click_on_a_question_by_name(
question_info['aaq_subject']
)
sumo_pages.aaq_flow.deleting_question_flow()
with allure.step("Verifying that the question is no longer displayed inside "
"My Questions page"):
sumo_pages.top_navbar._click_on_my_questions_profile_option()
expect(
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"):
test_utilities.navigate_to_link(
test_utilities.aaq_question_test_data["products_aaq_url"][product])
@pytest.mark.aaqPage
def test_share_firefox_data_functionality(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Signing in with an admin user account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Navigating to the Firefox AAQ form page and clicking on the 'Share "
"Data' option"):
test_utilities.navigate_to_link(
test_utilities.aaq_question_test_data["products_aaq_url"]["Firefox"])
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 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"):
sumo_pages.aaq_flow.add__valid_data_to_all_aaq_fields_without_submitting(
subject=test_utilities.aaq_question_test_data["valid_firefox_question"]["subject"],
topic_value=sumo_pages.aaq_form_page._get_aaq_form_topic_options()[0],
body_text=test_utilities.aaq_question_test_data["valid_firefox_question"]
["question_body"]
)
with allure.step("Adding text inside the troubleshooting information field and "
"submitting the AAQ question"):
sumo_pages.aaq_form_page._add_text_to_troubleshooting_information_textarea(
test_utilities.aaq_question_test_data["troubleshooting_information"]
)
sumo_pages.aaq_form_page._click_aaq_form_submit_button()
with allure.step("Verifying that the troubleshooting information is displayed"):
sumo_pages.question_page._click_on_question_details_button()
sumo_pages.question_page._click_on_more_system_details_option()
expect(
sumo_pages.question_page._get_more_information_with_text_locator(
test_utilities.aaq_question_test_data["troubleshooting_information"]
)
).to_be_visible()
with allure.step("Closing the additional details panel and deleting the posted question"):
sumo_pages.question_page._click_on_the_additional_system_panel_close()
sumo_pages.aaq_flow.deleting_question_flow()
@pytest.mark.aaqPage
def test_additional_system_details_user_agent_information(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Signing in with an admin user account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Navigating to each product aaq form"):
for product in test_utilities.general_test_data["freemium_products"]:
test_utilities.navigate_to_link(
test_utilities.aaq_question_test_data["products_aaq_url"][product])
with allure.step(f"Submitting a question for the {product} product"):
sumo_pages.aaq_flow.submit_an_aaq_question(
subject=test_utilities.aaq_question_test_data["valid_firefox_question"]
["subject"],
topic_name=sumo_pages.aaq_form_page._get_aaq_form_topic_options()[0],
body=test_utilities.aaq_question_test_data["valid_firefox_question"]
["question_body"],
attach_image=True
)
with check, allure.step("Verifying that the correct user-agent information is "
"displayed"):
sumo_pages.question_page._click_on_question_details_button()
sumo_pages.question_page._click_on_more_system_details_option()
assert "User Agent: " + test_utilities.get_user_agent(
) == sumo_pages.question_page._get_user_agent_information()
with allure.step("Closing the additional details panel and deleting the posted "
"questions"):
sumo_pages.question_page._click_on_the_additional_system_panel_close()
sumo_pages.aaq_flow.deleting_question_flow()
@pytest.mark.aaqPage
def test_system_details_information(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
troubleshooting_info = [
test_utilities.aaq_question_test_data["troubleshoot_product_and_os_versions"][
0],
"Firefox " + test_utilities.aaq_question_test_data["troubleshoot_product_and_os_versions"]
[1]
]
with allure.step("Signing in with an admin user account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Navigating to each product aaq form and and adding data without "
"submitting the form"):
for product in test_utilities.general_test_data["freemium_products"]:
if product == "Thunderbird":
continue
else:
test_utilities.navigate_to_link(
test_utilities.aaq_question_test_data["products_aaq_url"][product])
sumo_pages.aaq_flow.add__valid_data_to_all_aaq_fields_without_submitting(
subject=test_utilities.aaq_question_test_data["valid_firefox_question"]
["subject"],
topic_value=sumo_pages.aaq_form_page._get_aaq_form_topic_options()[0],
body_text=test_utilities.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"):
sumo_pages.aaq_form_page._click_on_show_details_option()
sumo_pages.aaq_form_page._add_text_to_product_version_field(
test_utilities.aaq_question_test_data[
"troubleshoot_product_and_os_versions"][1]
)
sumo_pages.aaq_form_page._add_text_to_os_field(
test_utilities.aaq_question_test_data[
"troubleshoot_product_and_os_versions"][0]
)
with check, allure.step("Submitting the AAQ question and verifying that the "
"correct provided 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()
assert "User Agent: " + self.get_user_agent(
) == self.sumo_pages.question_page._get_user_agent_information()
sumo_pages.aaq_form_page._click_aaq_form_submit_button()
sumo_pages.question_page._click_on_question_details_button()
assert sumo_pages.question_page._get_system_details_information(
) == troubleshooting_info
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()
with allure.step("Deleting the posted question"):
sumo_pages.aaq_flow.deleting_question_flow()
@pytest.mark.aaqPage
def test_system_details_information(self):
troubleshooting_info = [
super().aaq_question_test_data["troubleshoot_product_and_os_versions"][
0],
"Firefox " + super().aaq_question_test_data["troubleshoot_product_and_os_versions"][1]
]
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"]
))
# C1512592
@pytest.mark.aaqPage
def test_premium_products_aaq(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
aaq_form_messages = AAQFormMessages()
with allure.step("Signing in with an admin account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
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 == "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"]
)
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]
)
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
with allure.step("Deleting the posted question"):
self.sumo_pages.aaq_flow.deleting_question_flow()
# C1512592
@pytest.mark.aaqPage
def test_premium_products_aaq(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 premium product contact form and sending a ticket"):
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 product contact form and sending a ticket"):
for premium_product in test_utilities.general_test_data['premium_products']:
test_utilities.navigate_to_link(
test_utilities.aaq_question_test_data['products_aaq_url'][premium_product]
)
test_utilities.wait_for_dom_to_load()
if premium_product == 'Mozilla VPN':
sumo_pages.aaq_flow.submit_an_aaq_question(
subject=test_utilities.aaq_question_test_data['premium_aaq_question']
['subject'],
body=test_utilities.aaq_question_test_data['premium_aaq_question']['body'],
is_premium=True
)
self.wait_for_dom_to_load()
if premium_product == 'Mozilla VPN':
self.sumo_pages.aaq_flow.submit_an_aaq_question(
subject=super().aaq_question_test_data['premium_aaq_question']['subject'],
body=super().aaq_question_test_data['premium_aaq_question']['body'],
is_premium=True
)
else:
self.sumo_pages.aaq_flow.submit_an_aaq_question(
subject=super().aaq_question_test_data['premium_aaq_question']['subject'],
body=super().aaq_question_test_data['premium_aaq_question']['body'],
is_premium=True
)
with allure.step("Verifying that the correct success message is displayed"):
assert self.sumo_pages.aaq_form_page._get_premium_card_submission_message(
) == self.get_premium_ticket_submission_success_message(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
else:
sumo_pages.aaq_flow.submit_an_aaq_question(
subject=test_utilities.aaq_question_test_data['premium_aaq_question']
['subject'],
body=test_utilities.aaq_question_test_data['premium_aaq_question']['body'],
is_premium=True
)
# C2635907
@pytest.mark.aaqPage
def test_loginless_mozilla_account_aaq(self):
with allure.step("Sending 4 loginless tickets and verifying that the user is successfully "
"blocked after 3 submissions"):
i = 1
while i <= 4:
self.sumo_pages.top_navbar._click_on_signin_signup_button()
self.sumo_pages.auth_page._click_on_cant_sign_in_to_my_mozilla_account_link()
self.sumo_pages.aaq_flow.submit_an_aaq_question(
subject=super().aaq_question_test_data['premium_aaq_question']['subject'],
body=super().aaq_question_test_data['premium_aaq_question']['body'],
is_premium=True,
email=self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"],
is_loginless=True
)
if i <= 3:
with allure.step("Verifying that the correct success message is displayed"):
assert self.sumo_pages.aaq_form_page._get_premium_card_submission_message(
) == self.get_premium_ticket_submission_success_message(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
)
else:
with allure.step("Verifying that submission error message is displayed"):
assert self.sumo_pages.aaq_form_page._get_premium_card_submission_message(
) == self.LOGINLESS_RATELIMIT_REACHED_MESSAGE
i += 1
with allure.step("Verifying that the correct success message is displayed"):
assert sumo_pages.aaq_form_page._get_premium_card_submission_message(
) == aaq_form_messages.get_premium_ticket_submission_success_message(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
)
# C2635907
@pytest.mark.aaqPage
def test_loginless_mozilla_account_aaq(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
aaq_form_messages = AAQFormMessages()
with allure.step("Sending 4 loginless tickets and verifying that the user is successfully "
"blocked after 3 submissions"):
i = 1
while i <= 4:
sumo_pages.top_navbar._click_on_signin_signup_button()
sumo_pages.auth_page._click_on_cant_sign_in_to_my_mozilla_account_link()
sumo_pages.aaq_flow.submit_an_aaq_question(
subject=test_utilities.aaq_question_test_data['premium_aaq_question']['subject'],
body=test_utilities.aaq_question_test_data['premium_aaq_question']['body'],
is_premium=True,
email=test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"],
is_loginless=True
)
if i <= 3:
with allure.step("Verifying that the correct success message is displayed"):
assert sumo_pages.aaq_form_page._get_premium_card_submission_message(
) == aaq_form_messages.get_premium_ticket_submission_success_message(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
)
else:
with allure.step("Verifying that submission error message is displayed"):
assert sumo_pages.aaq_form_page._get_premium_card_submission_message(
) == aaq_form_messages.LOGINLESS_RATELIMIT_REACHED_MESSAGE
i += 1

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

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

@ -1,75 +1,76 @@
import allure
import pytest
from pytest_check import check
from playwright.sync_api import expect
from playwright.sync_api import expect, Page
from playwright_tests.core.testutilities import TestUtilities
from playwright_tests.messages.ask_a_question_messages.contact_support_messages import (
ContactSupportMessages)
from playwright_tests.messages.contribute_messages.con_discussions.support_forums_messages import (
SupportForumsPageMessages)
from playwright_tests.messages.ask_a_question_messages.product_solutions_messages import (
ProductSolutionsMessages)
from playwright_tests.pages.sumo_pages import SumoPages
class TestContactSupportPage(TestUtilities):
# C890363
@pytest.mark.contactSupportPage
def test_contact_support_page_content(self):
with allure.step("Accessing the contact support page via the top navbar via Ask a "
"Question > View All"):
self.sumo_pages.top_navbar._click_on_browse_all_products_option()
# C890363
@pytest.mark.contactSupportPage
def test_contact_support_page_content(page: Page):
sumo_pages = SumoPages(page)
with allure.step("Accessing the contact support page via the top navbar via Ask a "
"Question > View All"):
sumo_pages.top_navbar._click_on_browse_all_products_option()
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
with check, allure.step("Verifying that the current milestone is the correct one"):
assert sumo_pages.contact_support_page._get_text_of_current_milestone(
) == ContactSupportMessages.CURRENT_MILESTONE
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
with check, allure.step("Verifying that the correct page header is displayed"):
assert sumo_pages.contact_support_page._get_contact_support_main_heading(
) == ContactSupportMessages.MAIN_HEADER
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
with check, allure.step("Verifying that the correct page subheading is displayed"):
assert sumo_pages.contact_support_page._get_contact_support_subheading_text(
) == ContactSupportMessages.SUBHEADING
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))
with allure.step("Verifying that each product card has the correct subheading"):
for card in 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] == sumo_pages.
contact_support_page._get_product_card_subtitle(card))
# C890368, C890387, C890388
@pytest.mark.contactSupportPage
def test_contact_support_page_cards_redirect(self):
with allure.step("Accessing the contact support page via the top navbar Ask a Question > "
"View All"):
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():
with allure.step(f"Clicking on {card}"):
self.sumo_pages.contact_support_page._click_on_a_particular_card(card)
# C890368, C890387, C890388
@pytest.mark.contactSupportPage
def test_contact_support_page_cards_redirect(page: Page):
sumo_pages = SumoPages(page)
with allure.step("Accessing the contact support page via the top navbar Ask a Question > "
"View All"):
sumo_pages.top_navbar._click_on_browse_all_products_option()
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
for card in sumo_pages.contact_support_page._get_all_product_card_titles():
with allure.step(f"Clicking on {card}"):
sumo_pages.contact_support_page._click_on_a_particular_card(card)
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
with check, allure.step("Verifying that we are on the correct product solutions page"):
assert sumo_pages.product_solutions_page._get_product_solutions_heading(
) == card + ProductSolutionsMessages.PAGE_HEADER
with allure.step("Click on the 'Change Product' milestone"):
self.sumo_pages.product_solutions_page._click_on_the_completed_milestone()
with check, allure.step("Verifying that we are on the correct milestone"):
assert sumo_pages.product_solutions_page._get_current_milestone_text(
) == ProductSolutionsMessages.CURRENT_MILESTONE_TEXT
@pytest.mark.contactSupportPage
def test_browse_all_product_forums_button_redirect(self):
with allure.step("Accessing the contact support page via the top navbar Ask a Question > "
"View All option"):
self.sumo_pages.top_navbar._click_on_browse_all_products_option()
with allure.step("Click on the 'Change Product' milestone"):
sumo_pages.product_solutions_page._click_on_the_completed_milestone()
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)
@pytest.mark.contactSupportPage
def test_browse_all_product_forums_button_redirect(page: Page):
sumo_pages = SumoPages(page)
with allure.step("Accessing the contact support page via the top navbar Ask a Question > "
"View All option"):
sumo_pages.top_navbar._click_on_browse_all_products_option()
with allure.step("Clicking on browse all product forums button and verifying that we are "
"redirected to the correct page"):
sumo_pages.contact_support_page._click_on_browse_all_product_forums_button()
expect(page).to_have_url(SupportForumsPageMessages.PAGE_URL)

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

@ -2,101 +2,102 @@ import allure
import pytest
from pytest_check import check
from playwright.sync_api import TimeoutError, expect, Error
from playwright.sync_api import TimeoutError, expect, Error, Page
from playwright_tests.core.testutilities import TestUtilities
from playwright_tests.messages.ask_a_question_messages.AAQ_messages.aaq_widget import (
AAQWidgetMessages)
from playwright_tests.messages.contribute_messages.con_pages.con_page_messages import (
ContributePageMessages)
from playwright_tests.messages.homepage_messages import HomepageMessages
from playwright_tests.pages.sumo_pages import SumoPages
class TestPopularTopicsPage(TestUtilities):
# C890379
@pytest.mark.productTopicsPage
def test_popular_topics_navbar(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Navigating to product topics pages"):
for product_topic in test_utilities.general_test_data["product_topics"]:
topic_url = test_utilities.general_test_data["product_topics"][product_topic]
page.wait_for_timeout(400)
test_utilities.navigate_to_link(topic_url)
test_utilities.wait_for_url_to_be(topic_url)
# C890379
@pytest.mark.productTopicsPage
def test_popular_topics_navbar(self):
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 sumo_pages.product_topics_page._get_navbar_links_text():
with allure.step(f"Clicking on {option} navbar option"):
option_url = (HomepageMessages.STAGE_HOMEPAGE_URL + sumo_pages.
product_topics_page._get_navbar_option_link(option))
sumo_pages.product_topics_page._click_on_a_navbar_option(option)
try:
test_utilities.wait_for_url_to_be(option_url)
except (TimeoutError, Error):
sumo_pages.product_topics_page._click_on_a_navbar_option(option)
test_utilities.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)
with check, allure.step("Verifying that the correct option is displayed"):
assert sumo_pages.product_topics_page._get_page_title() == option
with check, allure.step("Verifying that the correct option is displayed"):
assert self.sumo_pages.product_topics_page._get_page_title() == option
with check, allure.step("Verifying that the correct nav option is selected"):
assert sumo_pages.product_topics_page._get_selected_navbar_option() == 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):
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)
# C2428991
@pytest.mark.productTopicsPage
def test_learn_more_redirect(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Navigating to product topics pages"):
for product_topic in test_utilities.general_test_data["product_topics"]:
topic_url = test_utilities.general_test_data["product_topics"][product_topic]
test_utilities.navigate_to_link(topic_url)
test_utilities.wait_for_url_to_be(topic_url)
with allure.step("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"):
sumo_pages.product_topics_page._click_on_learn_more_button()
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)
with allure.step("Verifying that the user is redirected to the contribute messages "
"page"):
expect(page).to_have_url(ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL)
# C2188690
@pytest.mark.productTopicsPage
def test_aaq_redirect(self):
with allure.step("Navigating to product topics pages"):
count = 0
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")
with check, allure.step(f"Verifying that the correct subheading page for "
f"{product_topic} is displayed"):
if product_topic in super().general_test_data["premium_products"]:
assert self.sumo_pages.product_topics_page._get_aaq_subheading_text(
) == AAQWidgetMessages.PREMIUM_AAQ_SUBHEADING_TEXT_SIGNED_OUT
else:
assert self.sumo_pages.product_topics_page._get_aaq_subheading_text(
) == AAQWidgetMessages.FREEMIUM_AAQ_SUBHEADING_TEXT_SIGNED_OUT
# C2188690
@pytest.mark.productTopicsPage
def test_aaq_redirect(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Navigating to product topics pages"):
count = 0
for product_topic in test_utilities.general_test_data["product_topics"]:
topic_url = test_utilities.general_test_data["product_topics"][product_topic]
test_utilities.navigate_to_link(topic_url)
test_utilities.wait_for_url_to_be(topic_url)
with allure.step("Clicking on the AAQ button"):
self.sumo_pages.product_topics_page._click_on_aaq_button()
with check, allure.step(f"Verifying that the correct subheading page for "
f"{product_topic} is displayed"):
if product_topic in test_utilities.general_test_data["premium_products"]:
assert sumo_pages.product_topics_page._get_aaq_subheading_text(
) == AAQWidgetMessages.PREMIUM_AAQ_SUBHEADING_TEXT_SIGNED_OUT
else:
assert sumo_pages.product_topics_page._get_aaq_subheading_text(
) == AAQWidgetMessages.FREEMIUM_AAQ_SUBHEADING_TEXT_SIGNED_OUT
with allure.step("Signing in to SUMO and verifying that we are on the correct AAQ "
"form page"):
if count == 0:
self.sumo_pages.auth_flow_page.sign_in_flow(
username=super().user_special_chars,
account_password=super().user_secrets_pass
)
count += 1
else:
self.sumo_pages.auth_flow_page.login_with_existing_session()
expect(
self.page
).to_have_url(super(
).aaq_question_test_data["products_aaq_url"][product_topic], timeout=30000)
with allure.step("Clicking on the AAQ button"):
sumo_pages.product_topics_page._click_on_aaq_button()
with allure.step("Signing out from SUMO"):
self.sumo_pages.top_navbar._click_on_sign_out_button()
with allure.step("Signing in to SUMO and verifying that we are on the correct AAQ "
"form page"):
if count == 0:
sumo_pages.auth_flow_page.sign_in_flow(
username=test_utilities.user_special_chars,
account_password=test_utilities.user_secrets_pass
)
count += 1
else:
sumo_pages.auth_flow_page.login_with_existing_session()
expect(page).to_have_url(
test_utilities.aaq_question_test_data["products_aaq_url"][product_topic],
timeout=30000)
with allure.step("Signing out from SUMO"):
sumo_pages.top_navbar._click_on_sign_out_button()

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

@ -2,176 +2,181 @@ import allure
import pytest
from pytest_check import check
from playwright.sync_api import expect, TimeoutError
from playwright.sync_api import expect, TimeoutError, Page
from playwright_tests.core.testutilities import TestUtilities
from playwright_tests.messages.ask_a_question_messages.AAQ_messages.aaq_widget import (
AAQWidgetMessages)
from playwright_tests.messages.ask_a_question_messages.product_solutions_messages import (
ProductSolutionsMessages)
from playwright_tests.pages.sumo_pages import SumoPages
class TestProductSolutionsPage(TestUtilities):
# Currently fails due to https://github.com/mozilla/sumo/issues/1608
# C890370
@pytest.mark.skip
def test_featured_articles_redirect(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Accessing the contact support page via the top navbar Get Help > "
"Browse All products"):
sumo_pages.top_navbar._click_on_browse_all_products_option()
# Currently fails due to https://github.com/mozilla/sumo/issues/1608
# C890370
@pytest.mark.skip
def test_featured_articles_redirect(self):
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()
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
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):
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 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(
with allure.step("Clicking on all product cards"):
for card in 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"):
sumo_pages.contact_support_page._click_on_a_particular_card(card)
assert 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)
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())
assert popular_topic == topic
if sumo_pages.product_solutions_page._is_featured_article_section_displayed():
for featured_article_card in (sumo_pages.product_solutions_page
._get_all_featured_articles_titles()):
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 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!!!")
print(f"{card} has no featured articles displayed!!!")
test_utilities.navigate_back()
self.navigate_back()
# C890382
@pytest.mark.productSolutionsPage
def test_ask_now_widget_redirect(self):
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()
count = 0
for freemium_product in super().general_test_data["freemium_products"]:
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
# C890375, C890379
@pytest.mark.productSolutionsPage
def test_popular_topics_redirect(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Accessing the contact support page via the top navbar Get Help > "
"Browse All products"):
sumo_pages.top_navbar._click_on_browse_all_products_option()
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_AND_PREMIUM_PRODUCTS_AAQ_WIDGET_BUTTON_TEXT
for card in sumo_pages.contact_support_page._get_all_product_card_titles():
sumo_pages.contact_support_page._click_on_a_particular_card(card)
with check, allure.step(f"Clicking on the {card} card and verifying that the correct "
f"product solutions page is displayed"):
assert sumo_pages.product_solutions_page._get_product_solutions_heading(
) == card + ProductSolutionsMessages.PAGE_HEADER
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")
if count == 0:
self.sumo_pages.auth_flow_page.sign_in_flow(
username=super().user_special_chars,
account_password=super().user_secrets_pass,
)
count += 1
else:
self.sumo_pages.auth_flow_page.login_with_existing_session()
if sumo_pages.product_solutions_page._is_popular_topics_section_displayed:
for topic in sumo_pages.product_solutions_page._get_popular_topics():
sumo_pages.product_solutions_page._click_on_a_popular_topic_card(topic)
with check, allure.step(f"Clicking on the {topic} topic and verifying if "
f"correct topic page title is displayed"):
try:
with 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")
sumo_pages.product_solutions_page._click_on_a_popular_topic_card(
topic)
with page.context.expect_page() as tab:
feature_article_page = tab.value
print(f"Tab open for topic: {topic}")
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)
popular_topic = (feature_article_page
.locator("//h1[@class='topic-title sumo-page-heading']")
.inner_text())
assert popular_topic == topic
feature_article_page.close()
else:
print(f"{card} has no featured articles displayed!!!")
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()
test_utilities.navigate_back()
# C890382
@pytest.mark.productSolutionsPage
def test_contact_support_widget_redirect(self):
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()
count = 0
for premium_product in super().general_test_data["premium_products"]:
with allure.step(f"Clicking on the {premium_product} card"):
self.sumo_pages.contact_support_page._click_on_a_particular_card(premium_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.PREMIUM_AAQ_SUBHEADING_TEXT_SIGNED_OUT
# C890382
@pytest.mark.productSolutionsPage
def test_ask_now_widget_redirect(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Accessing the contact support page via the top navbar Get Help > "
"Browse All products"):
sumo_pages.top_navbar._click_on_browse_all_products_option()
count = 0
for freemium_product in test_utilities.general_test_data["freemium_products"]:
with allure.step(f"Clicking on the {freemium_product} card "):
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 sumo_pages.product_solutions_page._get_aaq_subheading_text(
) == AAQWidgetMessages.FREEMIUM_AAQ_SUBHEADING_TEXT_SIGNED_OUT
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_AND_PREMIUM_PRODUCTS_AAQ_WIDGET_BUTTON_TEXT
with check, allure.step("Verifying that the correct AAQ button text is displayed"):
assert sumo_pages.product_solutions_page._get_aaq_widget_button_name(
) == AAQWidgetMessages.FREEMIUM_AND_PREMIUM_PRODUCTS_AAQ_WIDGET_BUTTON_TEXT
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()
with allure.step("Clicking on the AAQ button and verifying that the auth page is "
"displayed"):
sumo_pages.product_solutions_page._click_ask_now_button()
if count == 0:
sumo_pages.auth_flow_page.sign_in_flow(
username=test_utilities.user_special_chars,
account_password=test_utilities.user_secrets_pass,
)
count += 1
else:
sumo_pages.auth_flow_page.login_with_existing_session()
self.logger.info("Signing in to SUMO")
if count == 0:
self.sumo_pages.auth_flow_page.sign_in_flow(
username=super().user_special_chars,
account_password=super().user_secrets_pass,
)
count += 1
else:
self.sumo_pages.auth_flow_page.login_with_existing_session()
with allure.step("Verifying that we are on the correct AAQ form page"):
expect(page).to_have_url(
test_utilities.aaq_question_test_data["products_aaq_url"][freemium_product],
timeout=30000)
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)
with allure.step("Signing out and accessing the contact support page via the top "
"navbar Get Help > Browse All products"):
sumo_pages.top_navbar._click_on_sign_out_button()
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()
# C890382
@pytest.mark.productSolutionsPage
def test_contact_support_widget_redirect(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Accessing the contact support page via the top navbar Get Help > "
"Browse All products"):
sumo_pages.top_navbar._click_on_browse_all_products_option()
count = 0
for premium_product in test_utilities.general_test_data["premium_products"]:
with allure.step(f"Clicking on the {premium_product} card"):
sumo_pages.contact_support_page._click_on_a_particular_card(premium_product)
with check, allure.step("Verifying that the correct 'Still need help' subtext is "
"displayed"):
assert sumo_pages.product_solutions_page._get_aaq_subheading_text(
) == AAQWidgetMessages.PREMIUM_AAQ_SUBHEADING_TEXT_SIGNED_OUT
with check, allure.step("Verifying that the correct AAQ button text is displayed"):
assert sumo_pages.product_solutions_page._get_aaq_widget_button_name(
) == AAQWidgetMessages.FREEMIUM_AND_PREMIUM_PRODUCTS_AAQ_WIDGET_BUTTON_TEXT
with allure.step("Clicking on the AAQ button, verifying that the auth page is "
"displayed and signing in to SUMO"):
sumo_pages.product_solutions_page._click_ask_now_button()
if count == 0:
sumo_pages.auth_flow_page.sign_in_flow(
username=test_utilities.user_special_chars,
account_password=test_utilities.user_secrets_pass,
)
count += 1
else:
sumo_pages.auth_flow_page.login_with_existing_session()
with allure.step("Verifying that we are on the correct AAQ form page"):
expect(page).to_have_url(
test_utilities.aaq_question_test_data["products_aaq_url"][premium_product],
timeout=30000)
with allure.step("Signing out and access the contact support page via the top navbar "
"Get Help > Browse All products"):
sumo_pages.top_navbar._click_on_sign_out_button()
sumo_pages.top_navbar._click_on_browse_all_products_option()

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

@ -1,77 +1,45 @@
import allure
import pytest
from playwright.sync_api import sync_playwright
from playwright_tests.core.testutilities import TestUtilities
from playwright.sync_api import Page
from slugify import slugify
from playwright_tests.messages.homepage_messages import HomepageMessages
from playwright_tests.pages.sumo_pages import SumoPages
@pytest.fixture(autouse=True)
def navigate_to_homepage(page: Page):
"""
This fixture is used in all functions. It navigates to the SuMo homepage and returns the page
object.
"""
page.goto(HomepageMessages.STAGE_HOMEPAGE_URL)
return page
def pytest_runtest_makereport(item, call) -> None:
"""
If there is a test failure we are saving & attaching the test execution's screencast to
allure reporting.
"""
if call.when == "call":
if call.excinfo is not None and "page" in item.funcargs:
page: Page = item.funcargs["page"]
video_path = page.video.path()
page.context.close() # ensure video saved
allure.attach(
open(video_path, 'rb').read(),
name=f"{slugify(item.nodeid)}.webm",
attachment_type=allure.attachment_type.WEBM
)
@pytest.fixture()
def setup(request, browser, logger_setup):
requested_browser = browser
logger = logger_setup
global page
with sync_playwright() as playwright:
if requested_browser == "chrome":
browser = playwright.chromium.launch()
context = browser.new_context(record_video_dir="reports/videos")
page = context.new_page()
else:
browser = playwright.firefox.launch()
context = browser.new_context(record_video_dir="reports/videos")
page = context.new_page()
sumo_pages = SumoPages(page)
logger.info(f"Running tests on: {requested_browser}")
page.goto(HomepageMessages.STAGE_HOMEPAGE_URL)
request.cls.page = page
request.cls.context = context
request.cls.sumo_pages = sumo_pages
request.cls.requested_browser = requested_browser
request.cls.logger = logger
yield
page.context.close()
page.video.delete()
def pytest_addoption(parser):
parser.addoption("--browser")
@pytest.fixture(scope="class", autouse=True)
def browser(request):
return request.config.getoption("--browser")
# Clearing the logs from the previous run
@pytest.fixture(scope="session")
def logger_setup():
logger = TestUtilities().get_logger()
try:
log_file = open("../reports/logs/logfile.log", "w")
log_file.truncate()
log_file.close()
logger.info("Cleared previous logs")
except FileNotFoundError:
print("No log file found to remove")
return logger
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport():
try:
outcome = yield
report = outcome.get_result()
if report.when == "call":
xfail = hasattr(report, "wasxfail")
if (report.skipped and xfail) or (report.failed and not xfail):
allure.attach.file(
page.video.path(),
name="Video",
attachment_type=allure.attachment_type.WEBM
)
except Exception as e:
print(e)
def browser_context_args(browser_context_args, tmpdir_factory: pytest.TempdirFactory):
"""
Modifying the default browser context to include the location of the browser session screencast
"""
return {
**browser_context_args,
"record_video_dir": tmpdir_factory.mktemp('videos')
}

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

@ -1,6 +1,7 @@
import allure
import pytest
import requests
from playwright.sync_api import Page
from pytest_check import check
from playwright_tests.core.testutilities import TestUtilities
@ -17,165 +18,172 @@ from playwright_tests.messages.contribute_messages.con_pages.con_page_messages i
from playwright_tests.messages.contribute_messages.con_pages.con_social_support_messages import (
ContributeSocialSupportMessages)
from playwright_tests.messages.homepage_messages import HomepageMessages
from playwright_tests.pages.sumo_pages import SumoPages
class TestContributeArticlePage(TestUtilities):
# C2165414
@pytest.mark.contributePagesTests
def test_contribute_article_page_text(self):
with allure.step("Accessing the Contribute with help Article page"):
self.navigate_to_link(
ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL
)
# C2165414
@pytest.mark.contributePagesTests
def test_contribute_article_page_text(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Accessing the Contribute with help Article page"):
test_utilities.navigate_to_link(
ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL
)
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
with check, allure.step("Verifying that the page header is successfully displayed and "
"contains the correct strings"):
assert sumo_pages.ways_to_contribute_pages._get_hero_main_header_text(
) == ContributeHelpArticlesMessages.HERO_PAGE_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
with check, allure.step("Verifying that the h2 is successfully displayed and contains "
"the correct strings"):
assert sumo_pages.ways_to_contribute_pages._get_hero_second_header(
) == ContributeHelpArticlesMessages.HERO_SECOND_TITLE
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
with check, allure.step("Verifying tha the paragraph under h2 is successfully displayed "
"and contains the correct strings"):
assert sumo_pages.ways_to_contribute_pages._get_hero_text(
) == ContributeHelpArticlesMessages.HERO_TEXT
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
with check, allure.step("Verifying that the 'How you can contribute_messages' header is "
"successfully displayed and contains the correct strings"):
assert 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
# 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 = [
ContributeHelpArticlesMessages.HOW_TO_CONTRIBUTE_OPTION_ONE_SIGNED_OUT,
ContributeHelpArticlesMessages.HOW_TO_CONTRIBUTE_OPTION_TWO,
ContributeHelpArticlesMessages.HOW_TO_CONTRIBUTE_OPTION_THREE,
ContributeHelpArticlesMessages.HOW_TO_CONTRIBUTE_OPTION_FIVE,
]
card_titles = [
ContributeHelpArticlesMessages.HOW_TO_CONTRIBUTE_OPTION_ONE_SIGNED_OUT,
ContributeHelpArticlesMessages.HOW_TO_CONTRIBUTE_OPTION_TWO,
ContributeHelpArticlesMessages.HOW_TO_CONTRIBUTE_OPTION_THREE,
ContributeHelpArticlesMessages.HOW_TO_CONTRIBUTE_OPTION_FIVE,
]
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
with check, allure.step("Verifying that the 'How you can contribute_messages' cards are "
"successfully expected"):
assert sumo_pages.ways_to_contribute_pages._get_how_to_contribute_link_options(
) == card_titles
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
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 sumo_pages.ways_to_contribute_pages._get_how_to_contribute_option_four(
) == ContributeHelpArticlesMessages.HOW_TO_CONTRIBUTE_OPTION_FOUR
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
with check, allure.step("Verifying that the first line from the fact text is "
"successfully displayed and contains the expected string"):
assert sumo_pages.ways_to_contribute_pages._get_first_fact_text(
) == ContributeHelpArticlesMessages.FACT_FIRST_LINE
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
with check, allure.step("Verifying that the second line from the fact section text is "
"successfully displayed and contains the expected string"):
assert sumo_pages.ways_to_contribute_pages._get_second_fact_text(
) == ContributeHelpArticlesMessages.FACT_SECOND_LINE
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
with check, allure.step("Verifying that the 'Other ways to contribute_messages' header "
"is successfully displayed and contains the expected string"):
assert 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,
ContributeHelpArticlesMessages.LOCALIZE_CONTENT_CARD_TITLE,
ContributeHelpArticlesMessages.PROVIDE_SUPPORT_ON_SOCIAL_CHANNELS_CARD_TITLE,
ContributeHelpArticlesMessages.RESPOND_TO_MOBILE_STORE_REVIEWS_CARD_TITLE,
]
other_ways_to_contribute_card_titles = [
ContributeHelpArticlesMessages.ANSWER_QUESTIONS_IN_SUPPORT_FORUM_TITLE,
ContributeHelpArticlesMessages.LOCALIZE_CONTENT_CARD_TITLE,
ContributeHelpArticlesMessages.PROVIDE_SUPPORT_ON_SOCIAL_CHANNELS_CARD_TITLE,
ContributeHelpArticlesMessages.RESPOND_TO_MOBILE_STORE_REVIEWS_CARD_TITLE,
]
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
with check, allure.step("Verifying that the 'Other ways to contribute_messages' are "
"successfully displayed and in the correct order"):
assert 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):
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)
with check, allure.step(f"Verifying that {image_link} is not broken"):
assert response.status_code < 400
# C2165414
@pytest.mark.contributePagesTests
def test_contribute_article_page_images_are_not_broken(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Accessing the Contribute with help Article page"):
test_utilities.navigate_to_link(
ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL
)
# C2165415
@pytest.mark.contributePagesTests
def test_contribute_article_page_breadcrumbs(self):
with allure.step("Accessing the Contribute Forum page"):
self.navigate_to_link(
ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL
)
for link in sumo_pages.ways_to_contribute_pages._get_all_page_image_links():
image_link = link.get_attribute("src")
response = requests.get(image_link, stream=True)
with check, allure.step(f"Verifying that {image_link} is not broken"):
assert response.status_code < 400
breadcrumbs = [
ContributeHelpArticlesMessages.FIRST_BREADCRUMB,
ContributeHelpArticlesMessages.SECOND_BREADCRUMB,
ContributeHelpArticlesMessages.THIRD_BREADCRUMB,
]
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
# C2165415
@pytest.mark.contributePagesTests
def test_contribute_article_page_breadcrumbs(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Accessing the Contribute Forum page"):
test_utilities.navigate_to_link(
ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL
)
counter = 1
for breadcrumb in self.sumo_pages.ways_to_contribute_pages._get_interactable_breadcrumbs():
breadcrumb_to_click = (
self.sumo_pages.ways_to_contribute_pages._get_interactable_breadcrumbs()[counter]
)
self.sumo_pages.ways_to_contribute_pages._click_on_breadcrumb(breadcrumb_to_click)
breadcrumbs = [
ContributeHelpArticlesMessages.FIRST_BREADCRUMB,
ContributeHelpArticlesMessages.SECOND_BREADCRUMB,
ContributeHelpArticlesMessages.THIRD_BREADCRUMB,
]
if counter == 1:
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:
with check, allure.step("Verifying that the Home breadcrumb redirects to the "
"Homepage"):
assert self.get_page_url() == HomepageMessages.STAGE_HOMEPAGE_URL_EN_US
with check, allure.step("Verifying that the correct breadcrumbs are displayed"):
assert sumo_pages.ways_to_contribute_pages._get_text_of_all_breadcrumbs() == breadcrumbs
# 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):
with allure.step("Accessing the Contribute Forum page"):
self.navigate_to_link(
ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL
)
counter = 1
for breadcrumb in sumo_pages.ways_to_contribute_pages._get_interactable_breadcrumbs():
breadcrumb_to_click = (
sumo_pages.ways_to_contribute_pages._get_interactable_breadcrumbs()[counter]
)
sumo_pages.ways_to_contribute_pages._click_on_breadcrumb(breadcrumb_to_click)
ways_to_contribute_links = [
ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL,
ContributeLocalizationMessages.STAGE_CONTRIBUTE_LOCALIZATION_PAGE_URL,
ContributeSocialSupportMessages.STAGE_CONTRIBUTE_SOCIAL_SUPPORT_PAGE_URL,
ContributeMobileSupportMessages.STAGE_CONTRIBUTE_MOBILE_SUPPORT_PAGE_URL,
]
if counter == 1:
with check, allure.step("Verifying that the Contribute breadcrumb redirects to "
"the Contribute page"):
assert test_utilities.get_page_url(
) == ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL
test_utilities.navigate_forward()
counter -= 1
elif counter == 0:
with check, allure.step("Verifying that the Home breadcrumb redirects to the "
"Homepage"):
assert test_utilities.get_page_url() == HomepageMessages.STAGE_HOMEPAGE_URL_EN_US
counter = 0
for (
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()[
counter
]
)
self.sumo_pages.ways_to_contribute_pages._click_on_other_way_to_contribute_card(card)
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
# 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(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Accessing the Contribute Forum page"):
test_utilities.navigate_to_link(
ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL
)
ways_to_contribute_links = [
ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL,
ContributeLocalizationMessages.STAGE_CONTRIBUTE_LOCALIZATION_PAGE_URL,
ContributeSocialSupportMessages.STAGE_CONTRIBUTE_SOCIAL_SUPPORT_PAGE_URL,
ContributeMobileSupportMessages.STAGE_CONTRIBUTE_MOBILE_SUPPORT_PAGE_URL,
]
counter = 0
for element in sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_card_list():
card = (
sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_card_list()[counter]
)
sumo_pages.ways_to_contribute_pages._click_on_other_way_to_contribute_card(card)
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] == test_utilities.get_page_url()
test_utilities.navigate_back()
counter += 1

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

@ -1,5 +1,6 @@
import allure
import pytest
from playwright.sync_api import Page
from pytest_check import check
import requests
@ -17,140 +18,140 @@ from playwright_tests.messages.contribute_messages.con_pages.con_page_messages i
from playwright_tests.messages.contribute_messages.con_pages.con_social_support_messages import (
ContributeSocialSupportMessages)
from playwright_tests.messages.homepage_messages import HomepageMessages
from playwright_tests.pages.sumo_pages import SumoPages
class TestContributeForumPage(TestUtilities):
# C2165414
@pytest.mark.contributePagesTests
def test_contribute_forum_page_text(self):
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
# C2165414
@pytest.mark.contributePagesTests
def test_contribute_forum_page_text(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Accessing the Contribute Forum page"):
test_utilities.navigate_to_link(
ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL
)
with check, allure.step("Verifying that the Contribute Forum page contains the correct "
"strings"):
assert sumo_pages.ways_to_contribute_pages._get_hero_main_header_text(
) == ContributeForumMessages.HERO_PAGE_TITLE
assert sumo_pages.ways_to_contribute_pages._get_hero_second_header(
) == ContributeForumMessages.HERO_SECOND_TITLE
assert sumo_pages.ways_to_contribute_pages._get_hero_text(
) == ContributeForumMessages.HERO_TEXT
assert sumo_pages.ways_to_contribute_pages._get_how_to_contribute_header_text(
) == ContributeForumMessages.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
# 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,
]
assert self.sumo_pages.ways_to_contribute_pages._get_how_to_contribute_link_options(
) == card_titles
# 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
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):
with allure.step("Accessing the Contribute Forum page"):
self.navigate_to_link(
ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_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)
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):
with allure.step("Accessing the Contribute Forum page"):
self.navigate_to_link(
ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL
)
breadcrumbs = [
ContributeForumMessages.FIRST_BREADCRUMB,
ContributeForumMessages.SECOND_BREADCRUMB,
ContributeForumMessages.THIRD_BREADCRUMB,
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,
]
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
assert sumo_pages.ways_to_contribute_pages._get_how_to_contribute_link_options(
) == card_titles
counter = 1
for breadcrumb in self.sumo_pages.ways_to_contribute_pages._get_interactable_breadcrumbs():
breadcrumb_to_click = (
self.sumo_pages.ways_to_contribute_pages._get_interactable_breadcrumbs()[counter]
)
self.sumo_pages.ways_to_contribute_pages._click_on_breadcrumb(breadcrumb_to_click)
# We need to add here the check for when the user is signed in with a contributor
# account
assert sumo_pages.ways_to_contribute_pages._get_how_to_contribute_option_four(
) == ContributeForumMessages.HOW_TO_CONTRIBUTE_OPTION_FOUR
assert sumo_pages.ways_to_contribute_pages._get_first_fact_text(
) == ContributeForumMessages.FACT_FIRST_LINE
assert sumo_pages.ways_to_contribute_pages._get_second_fact_text(
) == ContributeForumMessages.FACT_SECOND_LINE
assert sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_header(
) == ContributeForumMessages.OTHER_WAYS_TO_CONTRIBUTE_HEADER
if counter == 1:
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:
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):
with allure.step("Accessing the Contribute Forum page"):
self.navigate_to_link(
ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL
)
ways_to_contribute_links = [
ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL,
ContributeLocalizationMessages.STAGE_CONTRIBUTE_LOCALIZATION_PAGE_URL,
ContributeSocialSupportMessages.STAGE_CONTRIBUTE_SOCIAL_SUPPORT_PAGE_URL,
ContributeMobileSupportMessages.STAGE_CONTRIBUTE_MOBILE_SUPPORT_PAGE_URL,
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 sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_cards(
) == other_ways_to_contribute_card_titles
counter = 0
for (
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()[
counter
]
)
self.sumo_pages.ways_to_contribute_pages._click_on_other_way_to_contribute_card(card)
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
# C2165414
@pytest.mark.contributePagesTests
def test_contribute_forum_page_images_are_not_broken(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Accessing the Contribute Forum page"):
test_utilities.navigate_to_link(ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL)
for link in sumo_pages.ways_to_contribute_pages._get_all_page_image_links():
image_link = link.get_attribute("src")
response = requests.get(image_link, stream=True)
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(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Accessing the Contribute Forum page"):
test_utilities.navigate_to_link(ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL)
breadcrumbs = [
ContributeForumMessages.FIRST_BREADCRUMB,
ContributeForumMessages.SECOND_BREADCRUMB,
ContributeForumMessages.THIRD_BREADCRUMB,
]
with check, allure.step("Verifying that the correct breadcrumbs are displayed"):
assert sumo_pages.ways_to_contribute_pages._get_text_of_all_breadcrumbs() == breadcrumbs
counter = 1
for breadcrumb in sumo_pages.ways_to_contribute_pages._get_interactable_breadcrumbs():
breadcrumb_to_click = (
sumo_pages.ways_to_contribute_pages._get_interactable_breadcrumbs()[counter]
)
sumo_pages.ways_to_contribute_pages._click_on_breadcrumb(breadcrumb_to_click)
if counter == 1:
with check, allure.step("Verifying that the Contribute breadcrumb redirects to "
"the Contribute page"):
assert test_utilities.get_page_url(
) == ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL
test_utilities.navigate_forward()
counter -= 1
elif counter == 0:
with check, allure.step("Verifying that the Home breadcrumb redirects to the "
"Homepage"):
assert test_utilities.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(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Accessing the Contribute Forum page"):
test_utilities.navigate_to_link(ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL)
ways_to_contribute_links = [
ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL,
ContributeLocalizationMessages.STAGE_CONTRIBUTE_LOCALIZATION_PAGE_URL,
ContributeSocialSupportMessages.STAGE_CONTRIBUTE_SOCIAL_SUPPORT_PAGE_URL,
ContributeMobileSupportMessages.STAGE_CONTRIBUTE_MOBILE_SUPPORT_PAGE_URL,
]
counter = 0
for element in sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_card_list():
card = (
sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_card_list()[counter]
)
sumo_pages.ways_to_contribute_pages._click_on_other_way_to_contribute_card(card)
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] == test_utilities.get_page_url()
test_utilities.navigate_back()
counter += 1

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

@ -1,5 +1,6 @@
import allure
import pytest
from playwright.sync_api import Page
from pytest_check import check
import requests
@ -17,136 +18,143 @@ from playwright_tests.messages.contribute_messages.con_pages.con_page_messages i
from playwright_tests.messages.contribute_messages.con_pages.con_social_support_messages import (
ContributeSocialSupportMessages)
from playwright_tests.messages.homepage_messages import HomepageMessages
from playwright_tests.pages.sumo_pages import SumoPages
class TestContributeLocalizationPage(TestUtilities):
# C2176356
@pytest.mark.contributePagesTests
def test_contribute_localization_page_text(self):
with allure.step("Accessing the Contribute localization page"):
self.navigate_to_link(
ContributeLocalizationMessages.STAGE_CONTRIBUTE_LOCALIZATION_PAGE_URL
)
# C2176356
@pytest.mark.contributePagesTests
def test_contribute_localization_page_text(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Accessing the Contribute localization page"):
test_utilities.navigate_to_link(
ContributeLocalizationMessages.STAGE_CONTRIBUTE_LOCALIZATION_PAGE_URL
)
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
with check, allure.step("Verifying that the Contribute localization page contains the "
"correct strings"):
assert sumo_pages.ways_to_contribute_pages._get_hero_main_header_text(
) == ContributeLocalizationMessages.HERO_PAGE_TITLE
assert sumo_pages.ways_to_contribute_pages._get_hero_second_header(
) == ContributeLocalizationMessages.HERO_SECOND_TITLE
assert sumo_pages.ways_to_contribute_pages._get_hero_text(
) == ContributeLocalizationMessages.HERO_TEXT
assert sumo_pages.ways_to_contribute_pages._get_how_to_contribute_header_text(
) == 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
# 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,
]
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
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):
with allure.step("Accessing the Contribute localization page"):
self.navigate_to_link(
ContributeLocalizationMessages.STAGE_CONTRIBUTE_LOCALIZATION_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)
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):
with allure.step("Accessing the Contribute localization page"):
self.navigate_to_link(
ContributeLocalizationMessages.STAGE_CONTRIBUTE_LOCALIZATION_PAGE_URL
)
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():
breadcrumb_to_click = (
self.sumo_pages.ways_to_contribute_pages._get_interactable_breadcrumbs()[counter]
)
self.sumo_pages.ways_to_contribute_pages._click_on_breadcrumb(breadcrumb_to_click)
if counter == 1:
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:
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):
with allure.step("Accessing the Contribute Forum page"):
self.navigate_to_link(
ContributeLocalizationMessages.STAGE_CONTRIBUTE_LOCALIZATION_PAGE_URL
)
ways_to_contribute_links = [
ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL,
ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL,
ContributeSocialSupportMessages.STAGE_CONTRIBUTE_SOCIAL_SUPPORT_PAGE_URL,
ContributeMobileSupportMessages.STAGE_CONTRIBUTE_MOBILE_SUPPORT_PAGE_URL,
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 sumo_pages.ways_to_contribute_pages._get_how_to_contribute_link_options(
) == card_titles
assert sumo_pages.ways_to_contribute_pages._get_how_to_contribute_option_four(
) == ContributeLocalizationMessages.HOW_TO_CONTRIBUTE_OPTION_FOUR
assert sumo_pages.ways_to_contribute_pages._get_first_fact_text(
) == ContributeLocalizationMessages.FACT_FIRST_LINE
assert sumo_pages.ways_to_contribute_pages._get_second_fact_text(
) == ContributeLocalizationMessages.FACT_SECOND_LINE
assert sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_header(
) == ContributeLocalizationMessages.OTHER_WAYS_TO_CONTRIBUTE_HEADER
counter = 0
for (
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()[
counter
]
)
self.sumo_pages.ways_to_contribute_pages._click_on_other_way_to_contribute_card(card)
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
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 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(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Accessing the Contribute localization page"):
test_utilities.navigate_to_link(
ContributeLocalizationMessages.STAGE_CONTRIBUTE_LOCALIZATION_PAGE_URL
)
for link in sumo_pages.ways_to_contribute_pages._get_all_page_image_links():
image_link = link.get_attribute("src")
response = requests.get(image_link, stream=True)
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(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Accessing the Contribute localization page"):
test_utilities.navigate_to_link(
ContributeLocalizationMessages.STAGE_CONTRIBUTE_LOCALIZATION_PAGE_URL
)
with check, allure.step("Verifying that the correct breadcrumbs are displayed"):
breadcrumbs = [
ContributeLocalizationMessages.FIRST_BREADCRUMB,
ContributeLocalizationMessages.SECOND_BREADCRUMB,
ContributeLocalizationMessages.THIRD_BREADCRUMB,
]
assert sumo_pages.ways_to_contribute_pages._get_text_of_all_breadcrumbs() == breadcrumbs
counter = 1
for breadcrumb in sumo_pages.ways_to_contribute_pages._get_interactable_breadcrumbs():
breadcrumb_to_click = (
sumo_pages.ways_to_contribute_pages._get_interactable_breadcrumbs()[counter]
)
sumo_pages.ways_to_contribute_pages._click_on_breadcrumb(breadcrumb_to_click)
if counter == 1:
with check, allure.step("Verifying that the Contribute breadcrumb redirects to "
"the Contribute page"):
assert test_utilities.get_page_url(
) == ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL
test_utilities.navigate_forward()
counter -= 1
elif counter == 0:
with check, allure.step("Verifying that the Home breadcrumb redirects to the "
"Homepage"):
assert test_utilities.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(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Accessing the Contribute Forum page"):
test_utilities.navigate_to_link(
ContributeLocalizationMessages.STAGE_CONTRIBUTE_LOCALIZATION_PAGE_URL
)
ways_to_contribute_links = [
ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL,
ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL,
ContributeSocialSupportMessages.STAGE_CONTRIBUTE_SOCIAL_SUPPORT_PAGE_URL,
ContributeMobileSupportMessages.STAGE_CONTRIBUTE_MOBILE_SUPPORT_PAGE_URL,
]
counter = 0
for element in sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_card_list():
card = (
sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_card_list()[counter]
)
sumo_pages.ways_to_contribute_pages._click_on_other_way_to_contribute_card(card)
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] == test_utilities.get_page_url()
test_utilities.navigate_back()
counter += 1

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

@ -1,5 +1,6 @@
import allure
import pytest
from playwright.sync_api import Page
from pytest_check import check
import requests
@ -17,136 +18,144 @@ from playwright_tests.messages.contribute_messages.con_pages.con_page_messages i
from playwright_tests.messages.contribute_messages.con_pages.con_social_support_messages import (
ContributeSocialSupportMessages)
from playwright_tests.messages.homepage_messages import HomepageMessages
from playwright_tests.pages.sumo_pages import SumoPages
class TestContributeMobilePage(TestUtilities):
# C2176366
@pytest.mark.contributePagesTests
def test_contribute_mobile_page_text(self):
with allure.step("Accessing the Contribute Mobile Store page"):
self.navigate_to_link(
ContributeMobileSupportMessages.STAGE_CONTRIBUTE_MOBILE_SUPPORT_PAGE_URL
)
# C2176366
@pytest.mark.contributePagesTests
def test_contribute_mobile_page_text(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Accessing the Contribute Mobile Store page"):
test_utilities.navigate_to_link(
ContributeMobileSupportMessages.STAGE_CONTRIBUTE_MOBILE_SUPPORT_PAGE_URL
)
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
with check, allure.step("Verifying that the Contribute Mobile Store page contains the "
"correct strings"):
assert sumo_pages.ways_to_contribute_pages._get_hero_main_header_text(
) == ContributeMobileSupportMessages.HERO_PAGE_TITLE
assert sumo_pages.ways_to_contribute_pages._get_hero_second_header(
) == ContributeMobileSupportMessages.HERO_SECOND_TITLE
assert sumo_pages.ways_to_contribute_pages._get_hero_text(
) == ContributeMobileSupportMessages.HERO_TEXT
assert sumo_pages.ways_to_contribute_pages._get_how_to_contribute_header_text(
) == 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
# 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,
]
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
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):
with allure.step("Accessing the Contribute Mobile store page"):
self.navigate_to_link(
ContributeMobileSupportMessages.STAGE_CONTRIBUTE_MOBILE_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)
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):
with allure.step("Accessing the Contribute Mobile Store page"):
self.navigate_to_link(
ContributeMobileSupportMessages.STAGE_CONTRIBUTE_MOBILE_SUPPORT_PAGE_URL
)
breadcrumbs = [
ContributeMobileSupportMessages.FIRST_BREADCRUMB,
ContributeMobileSupportMessages.SECOND_BREADCRUMB,
ContributeMobileSupportMessages.THIRD_BREADCRUMB,
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 sumo_pages.ways_to_contribute_pages._get_how_to_contribute_link_options(
) == card_titles
assert sumo_pages.ways_to_contribute_pages._get_how_to_contribute_option_four(
) == ContributeMobileSupportMessages.HOW_TO_CONTRIBUTE_OPTION_FOUR
assert sumo_pages.ways_to_contribute_pages._get_first_fact_text(
) == ContributeMobileSupportMessages.FACT_FIRST_LINE
assert sumo_pages.ways_to_contribute_pages._get_second_fact_text(
) == ContributeMobileSupportMessages.FACT_SECOND_LINE
assert sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_header(
) == ContributeMobileSupportMessages.OTHER_WAYS_TO_CONTRIBUTE_HEADER
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():
breadcrumb_to_click = (
self.sumo_pages.ways_to_contribute_pages._get_interactable_breadcrumbs()[counter]
)
self.sumo_pages.ways_to_contribute_pages._click_on_breadcrumb(breadcrumb_to_click)
if counter == 1:
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:
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):
with allure.step("Accessing the Contribute Mobile Store page"):
self.navigate_to_link(
ContributeMobileSupportMessages.STAGE_CONTRIBUTE_MOBILE_SUPPORT_PAGE_URL
)
ways_to_contribute_links = [
ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL,
ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL,
ContributeLocalizationMessages.STAGE_CONTRIBUTE_LOCALIZATION_PAGE_URL,
ContributeSocialSupportMessages.STAGE_CONTRIBUTE_SOCIAL_SUPPORT_PAGE_URL,
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 sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_cards(
) == other_ways_to_contribute_card_titles
counter = 0
for (
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()[
counter
]
)
self.sumo_pages.ways_to_contribute_pages._click_on_other_way_to_contribute_card(card)
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
# C2176366
@pytest.mark.contributePagesTests
def test_contribute_mobile_page_images_are_not_broken(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Accessing the Contribute Mobile store page"):
test_utilities.navigate_to_link(
ContributeMobileSupportMessages.STAGE_CONTRIBUTE_MOBILE_SUPPORT_PAGE_URL
)
for link in sumo_pages.ways_to_contribute_pages._get_all_page_image_links():
image_link = link.get_attribute("src")
response = requests.get(image_link, stream=True)
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(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Accessing the Contribute Mobile Store page"):
test_utilities.navigate_to_link(
ContributeMobileSupportMessages.STAGE_CONTRIBUTE_MOBILE_SUPPORT_PAGE_URL
)
breadcrumbs = [
ContributeMobileSupportMessages.FIRST_BREADCRUMB,
ContributeMobileSupportMessages.SECOND_BREADCRUMB,
ContributeMobileSupportMessages.THIRD_BREADCRUMB,
]
with check, allure.step("Verifying that the correct breadcrumbs are displayed"):
assert sumo_pages.ways_to_contribute_pages._get_text_of_all_breadcrumbs(
) == breadcrumbs
counter = 1
for breadcrumb in sumo_pages.ways_to_contribute_pages._get_interactable_breadcrumbs():
breadcrumb_to_click = (
sumo_pages.ways_to_contribute_pages._get_interactable_breadcrumbs()[counter]
)
sumo_pages.ways_to_contribute_pages._click_on_breadcrumb(breadcrumb_to_click)
if counter == 1:
with check, allure.step("Verifying that the Contribute breadcrumb redirects to "
"the Contribute page"):
assert test_utilities.get_page_url(
) == ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL
test_utilities.navigate_forward()
counter -= 1
elif counter == 0:
with check, allure.step("Verifying that the Home breadcrumb redirects to the "
"Homepage"):
assert test_utilities.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(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Accessing the Contribute Mobile Store page"):
test_utilities.navigate_to_link(
ContributeMobileSupportMessages.STAGE_CONTRIBUTE_MOBILE_SUPPORT_PAGE_URL
)
ways_to_contribute_links = [
ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL,
ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL,
ContributeLocalizationMessages.STAGE_CONTRIBUTE_LOCALIZATION_PAGE_URL,
ContributeSocialSupportMessages.STAGE_CONTRIBUTE_SOCIAL_SUPPORT_PAGE_URL,
]
counter = 0
for element in sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_card_list():
card = (
sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_card_list()[counter]
)
sumo_pages.ways_to_contribute_pages._click_on_other_way_to_contribute_card(card)
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] == test_utilities.get_page_url()
test_utilities.navigate_back()
counter += 1

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

@ -1,5 +1,6 @@
import allure
import pytest
from playwright.sync_api import Page
from pytest_check import check
import requests
@ -17,108 +18,116 @@ from playwright_tests.messages.contribute_messages.con_pages.con_page_messages i
from playwright_tests.messages.contribute_messages.con_pages.con_social_support_messages import (
ContributeSocialSupportMessages)
from playwright_tests.messages.homepage_messages import HomepageMessages
from playwright_tests.pages.sumo_pages import SumoPages
class TestContributePage(TestUtilities):
# C2165413
@pytest.mark.contributePagesTests
def test_contribute_page_text(page: Page):
sumo_pages = SumoPages(page)
with allure.step("Clicking on the Contribute top-navbar option"):
sumo_pages.top_navbar._click_on_contribute_top_navbar_option()
# C2165413
@pytest.mark.contributePagesTests
def test_contribute_page_text(self):
with allure.step("Clicking on the Contribute top-navbar option"):
self.sumo_pages.top_navbar._click_on_contribute_top_navbar_option()
with check, allure.step("Verifying that the correct page hero header text is displayed"):
assert sumo_pages.contribute_page._get_page_hero_main_header_text(
) == 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
with check, allure.step("Verifying that the correct page hero need help subtext is "
"displayed"):
assert sumo_pages.contribute_page._get_page_hero_main_subtext(
) == 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
with check, allure.step("Verifying that the correct need help header text is displayed"):
assert sumo_pages.contribute_page._get_page_hero_need_help_header_text(
) == 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
with check, allure.step("Verifying that the correct need help subtext is displayed"):
assert sumo_pages.contribute_page._get_page_hero_need_help_subtext(
) == 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
with check, allure.step("Verifying that the correct get way to contribute_messages "
"header is displayed"):
assert sumo_pages.contribute_page._get_way_to_contribute_header_text(
) == 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,
ContributePageMessages.WRITE_ARTICLES_CARD_TITLE,
ContributePageMessages.LOCALIZE_CONTENT_CARD_TITLE,
ContributePageMessages.PROVIDE_SUPPORT_ON_SOCIAL_CHANNELS_CARD_TITLE,
ContributePageMessages.RESPOND_TO_MOBILE_STORE_REVIEWS_CARD_TITLE,
]
card_titles = [
ContributePageMessages.ANSWER_QUESTIONS_CARD_TITLE,
ContributePageMessages.WRITE_ARTICLES_CARD_TITLE,
ContributePageMessages.LOCALIZE_CONTENT_CARD_TITLE,
ContributePageMessages.PROVIDE_SUPPORT_ON_SOCIAL_CHANNELS_CARD_TITLE,
ContributePageMessages.RESPOND_TO_MOBILE_STORE_REVIEWS_CARD_TITLE,
]
with check, allure.step("Verifying that the correct list of ways to contribute_messages "
"card titles is displayed"):
assert card_titles == sumo_pages.contribute_page._get_way_to_contribute_cards()
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()
with check, allure.step("Verifying that the correct about us header text is displayed"):
assert sumo_pages.contribute_page._get_about_us_header_text(
) == 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
with check, allure.step("Verifying that the correct about us subtext is displayed"):
assert sumo_pages.contribute_page._get_about_us_subtext(
) == 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):
with allure.step("Clicking on the 'Contribute' top-navbar option"):
self.sumo_pages.top_navbar._click_on_contribute_top_navbar_option()
# C2165413
@pytest.mark.contributePagesTests
def test_contribute_page_images_are_not_broken(page: Page):
sumo_pages = SumoPages(page)
with allure.step("Clicking on the 'Contribute' top-navbar option"):
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)
with check, allure.step(f"Verifying that the {image_link} image is not broken"):
assert response.status_code < 400
for link in sumo_pages.contribute_page._get_all_page_links():
image_link = link.get_attribute("src")
response = requests.get(image_link, stream=True)
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):
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,
]
# C1949333
@pytest.mark.contributePagesTests
def test_contribute_page_breadcrumbs(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Clicking on the Contribute top-navbar option"):
sumo_pages.top_navbar._click_on_contribute_top_navbar_option()
with check, allure.step("Verifying that the correct breadcrumbs are displayed"):
assert self.sumo_pages.contribute_page._get_breadcrumbs_text() == breadcrumbs
breadcrumbs = [
ContributePageMessages.FIRST_BREADCRUMB,
ContributePageMessages.SECOND_BREADCRUMB,
]
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
with check, allure.step("Verifying that the correct breadcrumbs are displayed"):
assert sumo_pages.contribute_page._get_breadcrumbs_text() == breadcrumbs
# C1949335,C1949336,C1949337,C1949338,C1949339,C1949355
@pytest.mark.contributePagesTests
def test_way_to_contribute_redirects_to_correct_page(self):
with allure.step("Clicking on the Contribute top-navbar option"):
self.sumo_pages.top_navbar._click_on_contribute_top_navbar_option()
with allure.step("Verifying that the home breadcrumb redirects to the homepage"):
sumo_pages.contribute_page._click_on_home_breadcrumb()
assert test_utilities.get_page_url() == HomepageMessages.STAGE_HOMEPAGE_URL_EN_US
ways_to_contribute_links = [
ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL,
ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL,
ContributeLocalizationMessages.STAGE_CONTRIBUTE_LOCALIZATION_PAGE_URL,
ContributeSocialSupportMessages.STAGE_CONTRIBUTE_SOCIAL_SUPPORT_PAGE_URL,
ContributeMobileSupportMessages.STAGE_CONTRIBUTE_MOBILE_SUPPORT_PAGE_URL,
]
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)
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
# C1949335,C1949336,C1949337,C1949338,C1949339,C1949355
@pytest.mark.contributePagesTests
def test_way_to_contribute_redirects_to_correct_page(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Clicking on the Contribute top-navbar option"):
sumo_pages.top_navbar._click_on_contribute_top_navbar_option()
ways_to_contribute_links = [
ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL,
ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL,
ContributeLocalizationMessages.STAGE_CONTRIBUTE_LOCALIZATION_PAGE_URL,
ContributeSocialSupportMessages.STAGE_CONTRIBUTE_SOCIAL_SUPPORT_PAGE_URL,
ContributeMobileSupportMessages.STAGE_CONTRIBUTE_MOBILE_SUPPORT_PAGE_URL,
]
counter = 0
for element in sumo_pages.contribute_page._get_list_of_contribute_cards():
card = sumo_pages.contribute_page._get_list_of_contribute_cards()[counter]
sumo_pages.contribute_page._click_on_way_to_contribute_card(card)
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] == test_utilities.get_page_url()
test_utilities.navigate_back()
counter += 1

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

@ -1,5 +1,6 @@
import allure
import pytest
from playwright.sync_api import Page
from pytest_check import check
import requests
@ -17,157 +18,163 @@ from playwright_tests.messages.contribute_messages.con_pages.con_page_messages i
from playwright_tests.messages.contribute_messages.con_pages.con_social_support_messages import (
ContributeSocialSupportMessages)
from playwright_tests.messages.homepage_messages import HomepageMessages
from playwright_tests.pages.sumo_pages import SumoPages
class TestContributeSocialMediaPage(TestUtilities):
# C2176361
@pytest.mark.contributePagesTests
def test_contribute_social_page_text(self):
with allure.step("Accessing the Contribute Social Channels page"):
self.navigate_to_link(
ContributeSocialSupportMessages.STAGE_CONTRIBUTE_SOCIAL_SUPPORT_PAGE_URL
)
# C2176361
@pytest.mark.contributePagesTests
def test_contribute_social_page_text(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Accessing the Contribute Social Channels page"):
test_utilities.navigate_to_link(
ContributeSocialSupportMessages.STAGE_CONTRIBUTE_SOCIAL_SUPPORT_PAGE_URL
)
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
with check, allure.step("Verifying that the correct hero main header is displayed"):
assert sumo_pages.ways_to_contribute_pages._get_hero_main_header_text(
) == ContributeSocialSupportMessages.HERO_PAGE_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
with check, allure.step("Verifying that the correct hero second header is displayed"):
assert sumo_pages.ways_to_contribute_pages._get_hero_second_header(
) == ContributeSocialSupportMessages.HERO_SECOND_TITLE
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
with check, allure.step("Verifying that the correct get hero text is displayed"):
assert sumo_pages.ways_to_contribute_pages._get_hero_text(
) == ContributeSocialSupportMessages.HERO_TEXT
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
with check, allure.step("Verifying that the correct how to contribute_messages header "
"text is displayed"):
assert 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
# 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 = [
ContributeSocialSupportMessages.HOW_TO_CONTRIBUTE_OPTION_ONE_SIGNED_OUT,
ContributeSocialSupportMessages.HOW_TO_CONTRIBUTE_OPTION_TWO,
ContributeSocialSupportMessages.HOW_TO_CONTRIBUTE_OPTION_THREE,
ContributeSocialSupportMessages.HOW_TO_CONTRIBUTE_OPTION_FIVE,
]
card_titles = [
ContributeSocialSupportMessages.HOW_TO_CONTRIBUTE_OPTION_ONE_SIGNED_OUT,
ContributeSocialSupportMessages.HOW_TO_CONTRIBUTE_OPTION_TWO,
ContributeSocialSupportMessages.HOW_TO_CONTRIBUTE_OPTION_THREE,
ContributeSocialSupportMessages.HOW_TO_CONTRIBUTE_OPTION_FIVE,
]
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
with check, allure.step("Verifying that the correct how to contribute_messages link "
"option are displayed"):
assert sumo_pages.ways_to_contribute_pages._get_how_to_contribute_link_options(
) == card_titles
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
with check, allure.step("Verifying that the correct option four text is displayed"):
assert sumo_pages.ways_to_contribute_pages._get_how_to_contribute_option_four(
) == ContributeSocialSupportMessages.HOW_TO_CONTRIBUTE_OPTION_FOUR
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
with check, allure.step("Verifying that the correct page first fact text is displayed"):
assert sumo_pages.ways_to_contribute_pages._get_first_fact_text(
) == ContributeSocialSupportMessages.FACT_FIRST_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
with check, allure.step("Verifying that the correct second fact text is displayed"):
assert sumo_pages.ways_to_contribute_pages._get_second_fact_text(
) == ContributeSocialSupportMessages.FACT_SECOND_LINE
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
with check, allure.step("Verifying that the correct get other ways to "
"contribute_messages header is displayed"):
assert 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,
ContributeSocialSupportMessages.WRITE_ARTICLES_CARD_TITLE,
ContributeSocialSupportMessages.LOCALIZE_SUPPORT_CONTENT_TITLE,
ContributeSocialSupportMessages.RESPOND_TO_MOBILE_STORE_REVIEWS_CARD_TITLE,
]
other_ways_to_contribute_card_titles = [
ContributeSocialSupportMessages.ANSWER_QUESTIONS_IN_SUPPORT_FORUM_TITLE,
ContributeSocialSupportMessages.WRITE_ARTICLES_CARD_TITLE,
ContributeSocialSupportMessages.LOCALIZE_SUPPORT_CONTENT_TITLE,
ContributeSocialSupportMessages.RESPOND_TO_MOBILE_STORE_REVIEWS_CARD_TITLE,
]
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
with check, allure.step("Verifying that the other ways to contribute_messages card "
"titles are the correct ones"):
assert 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):
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)
with check, allure.step(f"Verifying that the {image_link} image is not broken"):
assert response.status_code < 400
# C2176361
@pytest.mark.contributePagesTests
def test_contribute_social_page_images_are_not_broken(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Accessing the Contribute Forum page"):
test_utilities.navigate_to_link(
ContributeSocialSupportMessages.STAGE_CONTRIBUTE_SOCIAL_SUPPORT_PAGE_URL
)
# C2176362
@pytest.mark.contributePagesTests
def test_contribute_social_page_breadcrumbs(self):
with allure.step("Accessing the Contribute Forum page"):
self.navigate_to_link(
ContributeSocialSupportMessages.STAGE_CONTRIBUTE_SOCIAL_SUPPORT_PAGE_URL
)
for link in sumo_pages.ways_to_contribute_pages._get_all_page_image_links():
image_link = link.get_attribute("src")
response = requests.get(image_link, stream=True)
with check, allure.step(f"Verifying that the {image_link} image is not broken"):
assert response.status_code < 400
breadcrumbs = [
ContributeSocialSupportMessages.FIRST_BREADCRUMB,
ContributeSocialSupportMessages.SECOND_BREADCRUMB,
ContributeSocialSupportMessages.THIRD_BREADCRUMB,
]
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
# C2176362
@pytest.mark.contributePagesTests
def test_contribute_social_page_breadcrumbs(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Accessing the Contribute Forum page"):
test_utilities.navigate_to_link(
ContributeSocialSupportMessages.STAGE_CONTRIBUTE_SOCIAL_SUPPORT_PAGE_URL
)
counter = 1
for breadcrumb in self.sumo_pages.ways_to_contribute_pages._get_interactable_breadcrumbs():
breadcrumb_to_click = (
self.sumo_pages.ways_to_contribute_pages._get_interactable_breadcrumbs()[counter]
)
self.sumo_pages.ways_to_contribute_pages._click_on_breadcrumb(breadcrumb_to_click)
breadcrumbs = [
ContributeSocialSupportMessages.FIRST_BREADCRUMB,
ContributeSocialSupportMessages.SECOND_BREADCRUMB,
ContributeSocialSupportMessages.THIRD_BREADCRUMB,
]
if counter == 1:
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:
with check, allure.step("Verifying that the Home breadcrumb redirects to the "
"Homepage"):
assert self.get_page_url() == HomepageMessages.STAGE_HOMEPAGE_URL_EN_US
with check, allure.step("Verifying that the correct breadcrumbs are displayed"):
assert sumo_pages.ways_to_contribute_pages._get_text_of_all_breadcrumbs() == breadcrumbs
# Need to add tests for "How you can contribute_messages" section
counter = 1
for breadcrumb in sumo_pages.ways_to_contribute_pages._get_interactable_breadcrumbs():
breadcrumb_to_click = (
sumo_pages.ways_to_contribute_pages._get_interactable_breadcrumbs()[counter]
)
sumo_pages.ways_to_contribute_pages._click_on_breadcrumb(breadcrumb_to_click)
# C2176364
@pytest.mark.contributePagesTests
def test_contribute_social_other_ways_to_contribute_redirect_to_the_correct_page(self):
with allure.step("Accessing the Contribute Forum page"):
self.navigate_to_link(
ContributeSocialSupportMessages.STAGE_CONTRIBUTE_SOCIAL_SUPPORT_PAGE_URL
)
if counter == 1:
with check, allure.step("Verifying that the Contribute breadcrumb redirects to "
"the Contribute page"):
assert test_utilities.get_page_url(
) == ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL
test_utilities.navigate_forward()
counter -= 1
elif counter == 0:
with check, allure.step("Verifying that the Home breadcrumb redirects to the "
"Homepage"):
assert test_utilities.get_page_url() == HomepageMessages.STAGE_HOMEPAGE_URL_EN_US
ways_to_contribute_links = [
ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL,
ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL,
ContributeLocalizationMessages.STAGE_CONTRIBUTE_LOCALIZATION_PAGE_URL,
ContributeMobileSupportMessages.STAGE_CONTRIBUTE_MOBILE_SUPPORT_PAGE_URL,
]
counter = 0
for (
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()[
counter
]
)
self.sumo_pages.ways_to_contribute_pages._click_on_other_way_to_contribute_card(card)
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
# 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(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Accessing the Contribute Forum page"):
test_utilities.navigate_to_link(
ContributeSocialSupportMessages.STAGE_CONTRIBUTE_SOCIAL_SUPPORT_PAGE_URL
)
ways_to_contribute_links = [
ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL,
ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL,
ContributeLocalizationMessages.STAGE_CONTRIBUTE_LOCALIZATION_PAGE_URL,
ContributeMobileSupportMessages.STAGE_CONTRIBUTE_MOBILE_SUPPORT_PAGE_URL,
]
counter = 0
for element in sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_card_list():
card = (
sumo_pages.ways_to_contribute_pages._get_other_ways_to_contribute_card_list()[counter]
)
sumo_pages.ways_to_contribute_pages._click_on_other_way_to_contribute_card(card)
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] == test_utilities.get_page_url()
test_utilities.navigate_back()
counter += 1

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

@ -1,501 +1,544 @@
import allure
import pytest
from pytest_check import check
from playwright.sync_api import expect
from playwright.sync_api import expect, Page
from playwright_tests.core.testutilities import TestUtilities
from playwright_tests.messages.contribute_messages.con_tools.kb_dashboard_messages import (
KBDashboardPageMessages)
from playwright_tests.pages.sumo_pages import SumoPages
class TestKBDashboard(TestUtilities, KBDashboardPageMessages):
# C891357
@pytest.mark.kbDashboard
def test_unreviewed_articles_visibility_in_kb_dashboard(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
kb_dashboard_page_messages = KBDashboardPageMessages()
with allure.step("Signing in with an admin account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
# C891357
@pytest.mark.kbDashboard
def test_unreviewed_articles_visibility_in_kb_dashboard(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("Create a new simple article"):
article_details = sumo_pages.submit_kb_article_flow.submit_simple_kb_article()
sumo_pages.kb_article_page._click_on_article_option()
article_url = test_utilities.get_page_url()
with allure.step("Create a new simple 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()
with allure.step("Navigating to the kb dashboards and clicking on the 'Complete "
"overview' option"):
sumo_pages.top_navbar._click_on_dashboards_option()
sumo_pages.kb_dashboard_page._click_on_the_complete_overview_link()
with allure.step("Navigating to the kb dashboards and clicking on the 'Complete "
"overview' option"):
self.sumo_pages.top_navbar._click_on_dashboards_option()
self.sumo_pages.kb_dashboard_page._click_on_the_complete_overview_link()
with allure.step("Verifying that we are redirected to the correct page"):
expect(page).to_have_url(
test_utilities.general_test_data['dashboard_links']['kb_overview'])
with allure.step("Verifying that we are redirected to the correct page"):
expect(
self.page
).to_have_url(super().general_test_data['dashboard_links']['kb_overview'])
with check, allure.step("Verifying that the correct live status is displayed"):
assert sumo_pages.kb_dashboard_page._get_a_particular_article_status(
article_details['article_title']
).strip() == kb_dashboard_page_messages.get_kb_not_live_status(
revision_note=article_details['article_review_description']
)
with check, allure.step("Verifying that the correct live status is displayed"):
assert self.sumo_pages.kb_dashboard_page._get_a_particular_article_status(
article_details['article_title']
).strip() == self.get_kb_not_live_status(
revision_note=article_details['article_review_description']
)
with allure.step("Signing out and verifying that the article is not displayed since it "
"is not live yet"):
self.delete_cookies()
expect(
self.sumo_pages.kb_dashboard_page._get_a_particular_article_title_locator(
article_details['article_title']
)
).to_be_hidden()
with allure.step("Navigating to the homepage and performing the sign in step since the "
"kb overview takes quite a bit to refresh/load"):
self.sumo_pages.top_navbar._click_on_sumo_nav_logo()
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_13"]
))
with allure.step("Navigating to the kb overview verifying that the article is not "
"displayed since it is not live yet"):
self.navigate_to_link(super().general_test_data['dashboard_links']['kb_overview'])
expect(
self.sumo_pages.kb_dashboard_page._get_a_particular_article_title_locator(
article_details['article_title']
)
).to_be_hidden()
with allure.step("Signing in with an admin account"):
self.sumo_pages.top_navbar._click_on_sumo_nav_logo()
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Navigating to the kb overview page and clicking on the article title"):
self.navigate_to_link(super().general_test_data['dashboard_links']['kb_overview'])
self.sumo_pages.kb_dashboard_page._click_on_article_title(
with allure.step("Signing out and verifying that the article is not displayed since it "
"is not live yet"):
test_utilities.delete_cookies()
expect(
sumo_pages.kb_dashboard_page._get_a_particular_article_title_locator(
article_details['article_title']
)
).to_be_hidden()
with allure.step("Verifying that the user is redirected to the correct kb page"):
expect(
self.page
).to_have_url(article_url)
with allure.step("Navigating to the homepage and performing the sign in step since the "
"kb overview takes quite a bit to refresh/load"):
sumo_pages.top_navbar._click_on_sumo_nav_logo()
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_13"]
))
with allure.step("Approving the article revision"):
self.sumo_pages.submit_kb_article_flow.approve_kb_revision(
article_details['first_revision_id']
)
with check, allure.step("Navigating back to the kb overview page and verifying that the "
"correct live status is displayed"):
self.navigate_to_link(super().general_test_data['dashboard_links']['kb_overview'])
assert self.sumo_pages.kb_dashboard_page._get_a_particular_article_status(
article_details['article_title']
).strip() == self.KB_LIVE_STATUS
with allure.step("Signing out and verifying that the article is visible"):
self.delete_cookies()
expect(
self.sumo_pages.kb_dashboard_page._get_a_particular_article_title_locator(
article_details['article_title']
)
).to_be_visible()
with allure.step("Signing in with a non-admin user"):
self.sumo_pages.top_navbar._click_on_sumo_nav_logo()
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_13"]
))
with allure.step("Navigating to the kb overview and verifying that the article is "
"visible"):
self.navigate_to_link(super().general_test_data['dashboard_links']['kb_overview'])
expect(
self.sumo_pages.kb_dashboard_page._get_a_particular_article_title_locator(
article_details['article_title']
)
).to_be_visible()
with allure.step("Signing back with an admin account and deleting the article"):
self.sumo_pages.top_navbar._click_on_sumo_nav_logo()
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
self.navigate_to_link(super().general_test_data['dashboard_links']['kb_overview'])
self.sumo_pages.kb_dashboard_page._click_on_article_title(
with allure.step("Navigating to the kb overview verifying that the article is not "
"displayed since it is not live yet"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['kb_overview'])
expect(
sumo_pages.kb_dashboard_page._get_a_particular_article_title_locator(
article_details['article_title']
)
self.sumo_pages.kb_article_deletion_flow.delete_kb_article()
).to_be_hidden()
# C2266376
@pytest.mark.kbDashboard
def test_kb_dashboard_articles_status(self):
with allure.step("Signing 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"):
sumo_pages.top_navbar._click_on_sumo_nav_logo()
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Creating a new simple article"):
article_details = self.sumo_pages.submit_kb_article_flow.submit_simple_kb_article(
approve_first_revision=True
)
with allure.step("Navigating to the kb overview page and clicking on the article title"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['kb_overview'])
sumo_pages.kb_dashboard_page._click_on_article_title(article_details['article_title'])
article_url = self.get_page_url()
with allure.step("Verifying that the user is redirected to the correct kb page"):
expect(page).to_have_url(article_url)
with allure.step("Creating a anew revision for the document"):
second_revision = self.sumo_pages.submit_kb_article_flow.submit_new_kb_revision()
with allure.step("Approving the article revision"):
sumo_pages.submit_kb_article_flow.approve_kb_revision(article_details['first_revision_id'])
with check, allure.step("Navigating to the kb overview dashboard and verifying that the "
"correct status is displayed"):
self.navigate_to_link(super().general_test_data['dashboard_links']['kb_overview'])
assert self.sumo_pages.kb_dashboard_page._get_a_particular_article_status(
article_details['article_title']
).strip() == self.get_kb_not_live_status(
revision_note=second_revision['changes_description']
)
with check, allure.step("Navigating back to the kb overview page and verifying that the "
"correct live status is displayed"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['kb_overview'])
assert sumo_pages.kb_dashboard_page._get_a_particular_article_status(
article_details['article_title']
).strip() == kb_dashboard_page_messages.KB_LIVE_STATUS
with allure.step("Navigating back to the article history and deleting the revision"):
self.navigate_to_link(article_url)
self.sumo_pages.kb_article_show_history_page._click_on_delete_revision_button(
second_revision['revision_id']
)
self.sumo_pages.kb_article_show_history_page._click_on_confirmation_delete_button()
with check, allure.step("Navigating back to the kb dashboard and verifying that the live "
"status is displayed"):
self.navigate_to_link(super().general_test_data['dashboard_links']['kb_overview'])
assert self.sumo_pages.kb_dashboard_page._get_a_particular_article_status(
article_details['article_title']
).strip() == self.KB_LIVE_STATUS
with allure.step("Clicking on the article title and deleting it"):
self.sumo_pages.kb_dashboard_page._click_on_article_title(
with allure.step("Signing out and verifying that the article is visible"):
test_utilities.delete_cookies()
expect(
sumo_pages.kb_dashboard_page._get_a_particular_article_title_locator(
article_details['article_title']
)
self.sumo_pages.kb_article_deletion_flow.delete_kb_article()
).to_be_visible()
# C2496647
@pytest.mark.kbDashboard
def test_kb_dashboard_revision_deferred_status(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("Signing in with a non-admin user"):
sumo_pages.top_navbar._click_on_sumo_nav_logo()
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_13"]
))
with allure.step("Creating a new simple article"):
article_details = self.sumo_pages.submit_kb_article_flow.submit_simple_kb_article(
approve_first_revision=True
)
article_url = self.get_page_url()
with allure.step("Creating a new revision for the document"):
second_revision = self.sumo_pages.submit_kb_article_flow.submit_new_kb_revision()
with check, allure.step("Navigating to the kb overview page and verifying that the "
"correct kb status is displayed"):
self.navigate_to_link(super().general_test_data['dashboard_links']['kb_overview'])
assert self.sumo_pages.kb_dashboard_page._get_a_particular_article_status(
article_details['article_title']
) == self.get_kb_not_live_status(second_revision['changes_description'])
with allure.step("Navigating back to the article history page and deferring the revision"):
self.navigate_to_link(article_url)
self.sumo_pages.kb_article_show_history_page._click_on_review_revision(
second_revision['revision_id']
)
self.sumo_pages.kb_article_review_revision_page._click_on_defer_revision_button()
self.sumo_pages.kb_article_review_revision_page._click_on_defer_confirm_button()
with check, allure.step("Navigating back to the kb overview page and verifying that the "
"correct status is displayed"):
self.navigate_to_link(super().general_test_data['dashboard_links']['kb_overview'])
assert self.sumo_pages.kb_dashboard_page._get_a_particular_article_status(
article_details['article_title']
) == self.KB_LIVE_STATUS
with allure.step("Deleting the article"):
self.navigate_to_link(article_url)
self.sumo_pages.kb_article_deletion_flow.delete_kb_article()
# C2496646
@pytest.mark.kbDashboard
def test_kb_dashboard_needs_update_when_reviewing_a_revision(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("Creating a new simple article"):
article_details = self.sumo_pages.submit_kb_article_flow.submit_simple_kb_article(
approve_first_revision=True
)
article_url = self.get_page_url()
with allure.step("Creating an new article revision for the document"):
second_revision = self.sumo_pages.submit_kb_article_flow.submit_new_kb_revision()
self.sumo_pages.submit_kb_article_flow.approve_kb_revision(
second_revision['revision_id'], revision_needs_change=True
)
with check, allure.step("Navigating to the kb dashboard overview page and verifying that "
"the correct article status is displayed"):
self.navigate_to_link(super().general_test_data['dashboard_links']['kb_overview'])
assert self.sumo_pages.kb_dashboard_page._get_needs_update_status(
article_details['article_title']
).strip() == super().kb_revision_test_data['needs_change_message']
with allure.step("Deleting the article"):
self.navigate_to_link(article_url)
self.sumo_pages.kb_article_deletion_flow.delete_kb_article()
# C2266377, C2243456, C2496646
@pytest.mark.kbDashboard
def test_kb_dashboard_needs_update_edit_metadata(self):
with allure.step("Signing in with the admin account"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Create a new simple article"):
article_details = self.sumo_pages.submit_kb_article_flow.submit_simple_kb_article(
approve_first_revision=True
)
article_url = self.get_page_url()
with allure.step("Clicking on the 'Edit Article Metadata' option and enabling the 'Needs "
"change with comment' option"):
self.sumo_pages.edit_article_metadata_flow.edit_article_metadata(
needs_change=True, needs_change_comment=True
)
with check, allure.step("Navigating to the kb dashboard and verifying that the correct "
"needs change status is displayed"):
self.navigate_to_link(super().general_test_data['dashboard_links']['kb_overview'])
assert self.sumo_pages.kb_dashboard_page._get_needs_update_status(
article_details['article_title']
).strip() == super().kb_revision_test_data['needs_change_message']
with allure.step("Navigating back to the article's 'Edit Article Metadata' page and "
"removing the comment from the needs change textarea"):
self.navigate_to_link(article_url)
self.sumo_pages.edit_article_metadata_flow.edit_article_metadata(needs_change=True)
with allure.step("Navigating to the complete dashboard list and verifying that the "
"correct needs change status is displayed"):
self.navigate_to_link(super().general_test_data['dashboard_links']['kb_overview'])
assert self.sumo_pages.kb_dashboard_page._get_needs_update_status(
article_details['article_title']
).strip() == KBDashboardPageMessages.GENERAL_POSITIVE_STATUS
with allure.step("Navigating back to the article's 'Edit Article Metadata' page and "
"removing the needs change updates"):
self.navigate_to_link(article_url)
self.sumo_pages.edit_article_metadata_flow.edit_article_metadata()
with check, allure.step("Navigating to the kb overview page and verifying that the "
"correct needs change status is displayed"):
self.navigate_to_link(super().general_test_data['dashboard_links']['kb_overview'])
assert self.sumo_pages.kb_dashboard_page._is_needs_change_empty(
with allure.step("Navigating to the kb overview and verifying that the article is "
"visible"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['kb_overview'])
expect(
sumo_pages.kb_dashboard_page._get_a_particular_article_title_locator(
article_details['article_title']
)
).to_be_visible()
with allure.step("Deleting the article"):
self.navigate_to_link(article_url)
self.sumo_pages.kb_article_deletion_flow.delete_kb_article()
with allure.step("Signing back with an admin account and deleting the article"):
sumo_pages.top_navbar._click_on_sumo_nav_logo()
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['kb_overview'])
sumo_pages.kb_dashboard_page._click_on_article_title(article_details['article_title'])
sumo_pages.kb_article_deletion_flow.delete_kb_article()
# C2266378, C2489548
@pytest.mark.kbDashboard
def test_ready_for_l10n_kb_dashboard_revision_approval(self):
with allure.step("Signing in with the admin account"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Create a new simple article"):
article_details = self.sumo_pages.submit_kb_article_flow.submit_simple_kb_article()
# C2266376
@pytest.mark.kbDashboard
def test_kb_dashboard_articles_status(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
kb_dashboard_page_messages = KBDashboardPageMessages()
with allure.step("Signing in with the admin account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
article_url = self.get_page_url()
with allure.step("Creating a new simple article"):
article_details = sumo_pages.submit_kb_article_flow.submit_simple_kb_article(
approve_first_revision=True
)
revision_id = self.sumo_pages.kb_article_show_history_page._get_last_revision_id()
article_url = test_utilities.get_page_url()
with allure.step("Approving the first revision and marking it as ready for l10n"):
self.sumo_pages.submit_kb_article_flow.approve_kb_revision(
revision_id=revision_id, ready_for_l10n=True)
with allure.step("Creating a anew revision for the document"):
second_revision = sumo_pages.submit_kb_article_flow.submit_new_kb_revision()
with check, allure.step("Navigating to the kb dashboard overview page and verifying that "
"the correct l10n status is displayed"):
self.navigate_to_link(super().general_test_data['dashboard_links']['kb_overview'])
assert self.sumo_pages.kb_dashboard_page._get_ready_for_l10n_status(
article_details['article_title']
) == KBDashboardPageMessages.GENERAL_POSITIVE_STATUS
with check, allure.step("Navigating to the kb overview dashboard and verifying that the "
"correct status is displayed"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['kb_overview'])
assert sumo_pages.kb_dashboard_page._get_a_particular_article_status(
article_details['article_title']
).strip() == kb_dashboard_page_messages.get_kb_not_live_status(
revision_note=second_revision['changes_description']
)
with allure.step("Deleting the article"):
self.navigate_to_link(article_url)
self.sumo_pages.kb_article_deletion_flow.delete_kb_article()
with allure.step("Navigating back to the article history and deleting the revision"):
test_utilities.navigate_to_link(article_url)
sumo_pages.kb_article_show_history_page._click_on_delete_revision_button(
second_revision['revision_id']
)
sumo_pages.kb_article_show_history_page._click_on_confirmation_delete_button()
# C2266378
@pytest.mark.kbDashboard
def test_ready_for_l10n_kb_dashboard_revision_l10n_status(self):
with allure.step("Signing in with the admin account"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with check, allure.step("Navigating back to the kb dashboard and verifying that the live "
"status is displayed"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['kb_overview'])
assert sumo_pages.kb_dashboard_page._get_a_particular_article_status(
article_details['article_title']
).strip() == kb_dashboard_page_messages.KB_LIVE_STATUS
with allure.step("Creating a new kb article"):
article_details = self.sumo_pages.submit_kb_article_flow.submit_simple_kb_article(
approve_first_revision=True
)
with allure.step("Clicking on the article title and deleting it"):
sumo_pages.kb_dashboard_page._click_on_article_title(article_details['article_title'])
sumo_pages.kb_article_deletion_flow.delete_kb_article()
article_url = self.get_page_url()
with check, allure.step("Navigating to the kb dashboard overview page and verifying that "
"the correct l10n status is displayed"):
self.navigate_to_link(super().general_test_data['dashboard_links']['kb_overview'])
assert self.sumo_pages.kb_dashboard_page._get_ready_for_l10n_status(
article_details['article_title']
) == KBDashboardPageMessages.GENERAL_NEGATIVE_STATUS
# C2496647
@pytest.mark.kbDashboard
def test_kb_dashboard_revision_deferred_status(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
kb_dashboard_page_messages = KBDashboardPageMessages()
with allure.step("Signing in with an admin account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Navigating back to the article page and marking the revision as ready "
"for l10n"):
self.navigate_to_link(article_url)
self.sumo_pages.kb_article_show_history_page._click_on_ready_for_l10n_option(
article_details['first_revision_id']
)
self.sumo_pages.kb_article_show_history_page._click_on_submit_l10n_readiness_button()
with allure.step("Creating a new simple article"):
article_details = sumo_pages.submit_kb_article_flow.submit_simple_kb_article(
approve_first_revision=True
)
with allure.step("Navigating to the kb dashboard overview page and verifying that the "
"correct l10n status is displayed"):
self.navigate_to_link(super().general_test_data['dashboard_links']['kb_overview'])
assert self.sumo_pages.kb_dashboard_page._get_ready_for_l10n_status(
article_details['article_title']
) == KBDashboardPageMessages.GENERAL_POSITIVE_STATUS
article_url = test_utilities.get_page_url()
with allure.step("Navigating to the article and deleting it"):
self.navigate_to_link(article_url)
self.sumo_pages.kb_article_deletion_flow.delete_kb_article()
with allure.step("Creating a new revision for the document"):
second_revision = sumo_pages.submit_kb_article_flow.submit_new_kb_revision()
# C2266378
@pytest.mark.kbDashboard
def test_article_translation_not_allowed_kb_dashboard(self):
with allure.step("Signing in with the admin account"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with check, allure.step("Navigating to the kb overview page and verifying that the "
"correct kb status is displayed"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['kb_overview'])
assert sumo_pages.kb_dashboard_page._get_a_particular_article_status(
article_details['article_title']
) == kb_dashboard_page_messages.get_kb_not_live_status(
second_revision['changes_description'])
with allure.step("Creating a new simple article & unchecking the allow translations"):
article_details = self.sumo_pages.submit_kb_article_flow.submit_simple_kb_article(
allow_translations=False,
approve_first_revision=True
)
with allure.step("Navigating back to the article history page and deferring the revision"):
test_utilities.navigate_to_link(article_url)
sumo_pages.kb_article_show_history_page._click_on_review_revision(
second_revision['revision_id']
)
sumo_pages.kb_article_review_revision_page._click_on_defer_revision_button()
sumo_pages.kb_article_review_revision_page._click_on_defer_confirm_button()
article_url = self.get_page_url()
with check, allure.step("Navigating back to the kb overview page and verifying that the "
"correct status is displayed"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['kb_overview'])
assert sumo_pages.kb_dashboard_page._get_a_particular_article_status(
article_details['article_title']
) == kb_dashboard_page_messages.KB_LIVE_STATUS
with allure.step("Navigating to the kb dashboard overview page and verifying that the "
"correct l10n status is displayed"):
self.navigate_to_link(super().general_test_data['dashboard_links']['kb_overview'])
assert self.sumo_pages.kb_dashboard_page._get_ready_for_l10n_status(
article_details['article_title']
) == KBDashboardPageMessages.GENERAL_NEGATIVE_STATUS
with allure.step("Deleting the article"):
test_utilities.navigate_to_link(article_url)
sumo_pages.kb_article_deletion_flow.delete_kb_article()
with allure.step("Deleting the article"):
self.navigate_to_link(article_url)
self.sumo_pages.kb_article_deletion_flow.delete_kb_article()
# C2266379, C2266380
@pytest.mark.kbDashboard
def test_article_stale_kb_dashboard(self):
with allure.step("Signing in with the admin account"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
# C2496646
@pytest.mark.kbDashboard
def test_kb_dashboard_needs_update_when_reviewing_a_revision(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Signing in with an admin account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Create a new simple article & adding an old expiry date"):
article_details = self.sumo_pages.submit_kb_article_flow.submit_simple_kb_article(
expiry_date=self.kb_article_test_data['old_expiry_date'],
approve_first_revision=True
)
with allure.step("Creating a new simple article"):
article_details = sumo_pages.submit_kb_article_flow.submit_simple_kb_article(
approve_first_revision=True
)
article_url = self.get_page_url()
article_url = test_utilities.get_page_url()
with check, allure.step("Navigating to the kb dashboard overview page and verifying that "
"the correct stale status and date is displayed"):
self.navigate_to_link(super().general_test_data['dashboard_links']['kb_overview'])
assert self.sumo_pages.kb_dashboard_page._get_stale_status(
article_details['article_title']
) == KBDashboardPageMessages.GENERAL_POSITIVE_STATUS
assert self.sumo_pages.kb_dashboard_page._get_existing_expiry_date(
article_details['article_title']
) == self.convert_string_to_datetime(
self.kb_article_test_data['old_expiry_date']
)
with allure.step("Creating an new article revision for the document"):
second_revision = sumo_pages.submit_kb_article_flow.submit_new_kb_revision()
sumo_pages.submit_kb_article_flow.approve_kb_revision(
second_revision['revision_id'], revision_needs_change=True
)
with allure.step("Navigating back to the article and creating a new revision with a "
"non-stale expiry date"):
self.navigate_to_link(article_url)
self.sumo_pages.submit_kb_article_flow.submit_new_kb_revision(
expiry_date=self.kb_article_test_data['expiry_date'],
approve_revision=True
)
with check, allure.step("Navigating to the kb dashboard overview page and verifying that "
"the correct article status is displayed"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['kb_overview'])
assert sumo_pages.kb_dashboard_page._get_needs_update_status(
article_details['article_title']
).strip() == test_utilities.kb_revision_test_data['needs_change_message']
with check, allure.step("Navigating to the kb dashboard and verifying that the correct "
"stale status and date is displayed"):
self.navigate_to_link(super().general_test_data['dashboard_links']['kb_overview'])
assert self.sumo_pages.kb_dashboard_page._is_stale_status_empty(
with allure.step("Deleting the article"):
test_utilities.navigate_to_link(article_url)
sumo_pages.kb_article_deletion_flow.delete_kb_article()
# C2266377, C2243456, C2496646
@pytest.mark.kbDashboard
def test_kb_dashboard_needs_update_edit_metadata(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
kb_dashboard_page_messages = KBDashboardPageMessages()
with allure.step("Signing in with the admin account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Create a new simple article"):
article_details = sumo_pages.submit_kb_article_flow.submit_simple_kb_article(
approve_first_revision=True
)
article_url = test_utilities.get_page_url()
with allure.step("Clicking on the 'Edit Article Metadata' option and enabling the 'Needs "
"change with comment' option"):
sumo_pages.edit_article_metadata_flow.edit_article_metadata(
needs_change=True, needs_change_comment=True
)
with check, allure.step("Navigating to the kb dashboard and verifying that the correct "
"needs change status is displayed"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['kb_overview'])
assert sumo_pages.kb_dashboard_page._get_needs_update_status(
article_details['article_title']
).strip() == test_utilities.kb_revision_test_data['needs_change_message']
with allure.step("Navigating back to the article's 'Edit Article Metadata' page and "
"removing the comment from the needs change textarea"):
test_utilities.navigate_to_link(article_url)
sumo_pages.edit_article_metadata_flow.edit_article_metadata(needs_change=True)
with allure.step("Navigating to the complete dashboard list and verifying that the "
"correct needs change status is displayed"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['kb_overview'])
assert sumo_pages.kb_dashboard_page._get_needs_update_status(
article_details['article_title']
).strip() == kb_dashboard_page_messages.GENERAL_POSITIVE_STATUS
with allure.step("Navigating back to the article's 'Edit Article Metadata' page and "
"removing the needs change updates"):
test_utilities.navigate_to_link(article_url)
sumo_pages.edit_article_metadata_flow.edit_article_metadata()
with check, allure.step("Navigating to the kb overview page and verifying that the "
"correct needs change status is displayed"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['kb_overview'])
assert sumo_pages.kb_dashboard_page._is_needs_change_empty(
article_details['article_title']
)
with allure.step("Deleting the article"):
test_utilities.navigate_to_link(article_url)
sumo_pages.kb_article_deletion_flow.delete_kb_article()
# C2266378, C2489548
@pytest.mark.kbDashboard
def test_ready_for_l10n_kb_dashboard_revision_approval(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
kb_dashboard_page_messages = KBDashboardPageMessages()
with allure.step("Signing in with the admin account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Create a new simple article"):
article_details = sumo_pages.submit_kb_article_flow.submit_simple_kb_article()
article_url = test_utilities.get_page_url()
revision_id = sumo_pages.kb_article_show_history_page._get_last_revision_id()
with allure.step("Approving the first revision and marking it as ready for l10n"):
sumo_pages.submit_kb_article_flow.approve_kb_revision(
revision_id=revision_id, ready_for_l10n=True)
with check, allure.step("Navigating to the kb dashboard overview page and verifying that "
"the correct l10n status is displayed"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['kb_overview'])
assert sumo_pages.kb_dashboard_page._get_ready_for_l10n_status(
article_details['article_title']
) == kb_dashboard_page_messages.GENERAL_POSITIVE_STATUS
with allure.step("Deleting the article"):
test_utilities.navigate_to_link(article_url)
sumo_pages.kb_article_deletion_flow.delete_kb_article()
# C2266378
@pytest.mark.kbDashboard
def test_ready_for_l10n_kb_dashboard_revision_l10n_status(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
kb_dashboard_page_messages = KBDashboardPageMessages()
with allure.step("Signing in with the admin account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Creating a new kb article"):
article_details = sumo_pages.submit_kb_article_flow.submit_simple_kb_article(
approve_first_revision=True
)
article_url = test_utilities.get_page_url()
with check, allure.step("Navigating to the kb dashboard overview page and verifying that "
"the correct l10n status is displayed"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['kb_overview'])
assert sumo_pages.kb_dashboard_page._get_ready_for_l10n_status(
article_details['article_title']
) == kb_dashboard_page_messages.GENERAL_NEGATIVE_STATUS
with allure.step("Navigating back to the article page and marking the revision as ready "
"for l10n"):
test_utilities.navigate_to_link(article_url)
sumo_pages.kb_article_show_history_page._click_on_ready_for_l10n_option(
article_details['first_revision_id']
)
sumo_pages.kb_article_show_history_page._click_on_submit_l10n_readiness_button()
with allure.step("Navigating to the kb dashboard overview page and verifying that the "
"correct l10n status is displayed"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['kb_overview'])
assert sumo_pages.kb_dashboard_page._get_ready_for_l10n_status(
article_details['article_title']
) == kb_dashboard_page_messages.GENERAL_POSITIVE_STATUS
with allure.step("Navigating to the article and deleting it"):
test_utilities.navigate_to_link(article_url)
sumo_pages.kb_article_deletion_flow.delete_kb_article()
# C2266378
@pytest.mark.kbDashboard
def test_article_translation_not_allowed_kb_dashboard(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
kb_dashboard_page_messages = KBDashboardPageMessages()
with allure.step("Signing in with the admin account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Creating a new simple article & unchecking the allow translations"):
article_details = sumo_pages.submit_kb_article_flow.submit_simple_kb_article(
allow_translations=False,
approve_first_revision=True
)
article_url = test_utilities.get_page_url()
with allure.step("Navigating to the kb dashboard overview page and verifying that the "
"correct l10n status is displayed"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['kb_overview'])
assert sumo_pages.kb_dashboard_page._get_ready_for_l10n_status(
article_details['article_title']
) == kb_dashboard_page_messages.GENERAL_NEGATIVE_STATUS
with allure.step("Deleting the article"):
test_utilities.navigate_to_link(article_url)
sumo_pages.kb_article_deletion_flow.delete_kb_article()
# C2266379, C2266380
@pytest.mark.kbDashboard
def test_article_stale_kb_dashboard(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
kb_dashboard_page_messages = KBDashboardPageMessages()
with allure.step("Signing in with the admin account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Create a new simple article & adding an old expiry date"):
article_details = sumo_pages.submit_kb_article_flow.submit_simple_kb_article(
expiry_date=test_utilities.kb_article_test_data['old_expiry_date'],
approve_first_revision=True
)
article_url = test_utilities.get_page_url()
with check, allure.step("Navigating to the kb dashboard overview page and verifying that "
"the correct stale status and date is displayed"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['kb_overview'])
assert sumo_pages.kb_dashboard_page._get_stale_status(
article_details['article_title']
) == kb_dashboard_page_messages.GENERAL_POSITIVE_STATUS
assert sumo_pages.kb_dashboard_page._get_existing_expiry_date(
article_details['article_title']
) == test_utilities.convert_string_to_datetime(
test_utilities.kb_article_test_data['old_expiry_date']
)
with allure.step("Navigating back to the article and creating a new revision with a "
"non-stale expiry date"):
test_utilities.navigate_to_link(article_url)
sumo_pages.submit_kb_article_flow.submit_new_kb_revision(
expiry_date=test_utilities.kb_article_test_data['expiry_date'],
approve_revision=True
)
with check, allure.step("Navigating to the kb dashboard and verifying that the correct "
"stale status and date is displayed"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['kb_overview'])
assert sumo_pages.kb_dashboard_page._is_stale_status_empty(
article_details['article_title']
)
assert sumo_pages.kb_dashboard_page._get_existing_expiry_date(
article_details['article_title']
) == test_utilities.convert_string_to_datetime(
test_utilities.kb_article_test_data['expiry_date']
)
with allure.step("Deleting the article"):
test_utilities.navigate_to_link(article_url)
sumo_pages.kb_article_deletion_flow.delete_kb_article()
@pytest.mark.kbDashboard
def test_article_title_update(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Signing in with the admin account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Creating a new kb article"):
article_details = sumo_pages.submit_kb_article_flow.submit_simple_kb_article(
approve_first_revision=True
)
article_url = test_utilities.get_page_url()
with allure.step("Navigating to the kb dashboard overview page and verifying that the "
"correct title is displayed"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['kb_overview'])
expect(
sumo_pages.kb_dashboard_page._get_a_particular_article_title_locator(
article_details['article_title']
)
assert self.sumo_pages.kb_dashboard_page._get_existing_expiry_date(
article_details['article_title']
) == self.convert_string_to_datetime(
self.kb_article_test_data['expiry_date']
)
).to_be_visible()
with allure.step("Deleting the article"):
self.navigate_to_link(article_url)
self.sumo_pages.kb_article_deletion_flow.delete_kb_article()
with allure.step("Navigating to the article's 'Edit Metadata page' page and changing the "
"title"):
test_utilities.navigate_to_link(article_url)
new_article_title = "Updated " + article_details['article_title']
sumo_pages.edit_article_metadata_flow.edit_article_metadata(title=new_article_title)
@pytest.mark.kbDashboard
def test_article_title_update(self):
with allure.step("Signing in with the admin account"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Navigating back to the kb dashboard page and verifying that the "
"correct title is displayed"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['kb_overview'])
expect(sumo_pages.kb_dashboard_page._get_a_particular_article_title_locator(
new_article_title)
).to_be_visible()
with allure.step("Creating a new kb article"):
article_details = self.sumo_pages.submit_kb_article_flow.submit_simple_kb_article(
approve_first_revision=True
)
article_url = self.get_page_url()
with allure.step("Navigating to the kb dashboard overview page and verifying that the "
"correct title is displayed"):
self.navigate_to_link(super().general_test_data['dashboard_links']['kb_overview'])
expect(
self.sumo_pages.kb_dashboard_page._get_a_particular_article_title_locator(
article_details['article_title']
)
).to_be_visible()
with allure.step("Navigating to the article's 'Edit Metadata page' page and changing the "
"title"):
self.navigate_to_link(article_url)
new_article_title = "Updated " + article_details['article_title']
self.sumo_pages.edit_article_metadata_flow.edit_article_metadata(
title=new_article_title
)
with allure.step("Navigating back to the kb dashboard page and verifying that the "
"correct title is displayed"):
self.navigate_to_link(super().general_test_data['dashboard_links']['kb_overview'])
expect(
self.sumo_pages.kb_dashboard_page._get_a_particular_article_title_locator(
new_article_title
)
).to_be_visible()
with allure.step("Deleting the kb article"):
self.navigate_to_link(article_url)
self.sumo_pages.kb_article_deletion_flow.delete_kb_article()
with allure.step("Deleting the kb article"):
test_utilities.navigate_to_link(article_url)
sumo_pages.kb_article_deletion_flow.delete_kb_article()

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

@ -1,462 +1,443 @@
import allure
import pytest
from pytest_check import check
from playwright.sync_api import expect
from playwright.sync_api import expect, Page
from playwright_tests.core.testutilities import TestUtilities
from playwright_tests.messages.explore_help_articles.kb_article_revision_page_messages import (
KBArticleRevision)
from playwright_tests.messages.my_profile_pages_messages.my_profile_page_messages import (
MyProfileMessages)
from playwright_tests.pages.sumo_pages import SumoPages
class TestRecentRevisionsDashboard(TestUtilities):
# C2499112
@pytest.mark.recentRevisionsDashboard
def test_recent_revisions_revision_availability(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Signing in with a non-admin account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts['TEST_ACCOUNT_12']
))
# C2499112
@pytest.mark.recentRevisionsDashboard
def test_recent_revisions_revision_availability(self):
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 = sumo_pages.top_navbar._get_text_of_logged_in_username()
username = self.sumo_pages.top_navbar._get_text_of_logged_in_username()
with allure.step("Creating a new kb article"):
article_details = 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 = test_utilities.get_page_url()
article_url = self.get_page_url()
with allure.step("Navigating to the recent revisions dashboard and verifying that the "
"posted article is displayed for admin accounts"):
self.navigate_to_link(
self.general_test_data['dashboard_links']['recent_revisions']
with allure.step("Navigating to the recent revisions dashboard and verifying that the "
"posted article is displayed for admin accounts"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['recent_revisions']
)
expect(
sumo_pages.recent_revisions_page._get_recent_revision_based_on_article(
article_details['article_title']
)
expect(
self.sumo_pages.recent_revisions_page._get_recent_revision_based_on_article(
article_details['article_title']
)
).to_be_visible()
).to_be_visible()
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"]
with allure.step("Deleting the user session and verifying that the revision is not "
"displayed for signed out users"):
test_utilities.delete_cookies()
expect(
sumo_pages.recent_revisions_page._get_recent_revision_based_on_article(
article_details['article_title']
)
).to_be_hidden()
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()
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 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"]
))
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()
with allure.step("Navigating back to the recent revisions page and verifying that the "
"article is no longer displayed"):
self.navigate_to_link(
self.general_test_data['dashboard_links']['recent_revisions']
with allure.step("Typing the article creator username inside the 'Users' field and "
"verifying that the article is not displayed"):
sumo_pages.recent_revisions_page._fill_in_users_field(username)
test_utilities.wait_for_given_timeout(2000)
expect(
sumo_pages.recent_revisions_page._get_recent_revision_based_on_article(
article_details['article_title']
)
expect(
self.sumo_pages.recent_revisions_page._get_recent_revision_based_on_article(
article_details['article_title']
)
).to_be_hidden()
).to_be_hidden()
# C2266240
@pytest.mark.recentRevisionsDashboard
def test_second_revisions_availability(self):
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"]
))
with allure.step("Clearing the user search field and signing in with a different "
"non-admin account"):
sumo_pages.recent_revisions_page._clearing_the_user_field()
test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MESSAGE_6"]
)
with allure.step("Creating a new kb article"):
article_details = self.sumo_pages.submit_kb_article_flow.submit_simple_kb_article(
approve_first_revision=True
with allure.step("Verifying that the revision is not displayed for non-admin accounts"):
expect(
sumo_pages.recent_revisions_page._get_recent_revision_based_on_article(
article_details['article_title']
)
).to_be_hidden()
article_url = self.get_page_url()
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()
with allure.step("Creating a new revision for the article"):
second_revision = self.sumo_pages.submit_kb_article_flow.submit_new_kb_revision()
with allure.step("Navigating to the Recent Revisions dashboard and verifying that own "
"revision is visible"):
self.navigate_to_link(
self.general_test_data['dashboard_links']['recent_revisions']
with allure.step("Typing the article creator username inside the 'Users' field and "
"verifying that the article is not displayed"):
sumo_pages.recent_revisions_page._fill_in_users_field(username)
test_utilities.wait_for_given_timeout(2000)
expect(
sumo_pages.recent_revisions_page._get_recent_revision_based_on_article(
article_details['article_title']
)
expect(
self.sumo_pages.recent_revisions_page.
_get_recent_revision_based_on_article_title_and_user(
article_details['article_title'], username
)
).to_be_visible()
).to_be_hidden()
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("Clearing the user search field and signing in back with the admin "
"account"):
sumo_pages.recent_revisions_page._clearing_the_user_field()
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
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("Navigating to the article page and deleting it"):
test_utilities.navigate_to_link(article_url)
sumo_pages.kb_article_deletion_flow.delete_kb_article()
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 back to the recent revisions page and verifying that the "
"article is no longer displayed"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['recent_revisions']
)
expect(
sumo_pages.recent_revisions_page._get_recent_revision_based_on_article(
article_details['article_title']
)
).to_be_hidden()
with allure.step("Navigating to the article and approving the revision"):
self.navigate_to_link(article_url)
self.sumo_pages.submit_kb_article_flow.approve_kb_revision(
# C2266240
@pytest.mark.recentRevisionsDashboard
def test_second_revisions_availability(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Signing back in with the admin account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Creating a new kb article"):
article_details = sumo_pages.submit_kb_article_flow.submit_simple_kb_article(
approve_first_revision=True
)
article_url = test_utilities.get_page_url()
with allure.step("Signing in with a non-admin account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_13"]
))
username = sumo_pages.top_navbar._get_text_of_logged_in_username()
with allure.step("Creating a new revision for the article"):
second_revision = sumo_pages.submit_kb_article_flow.submit_new_kb_revision()
with allure.step("Navigating to the Recent Revisions dashboard and verifying that own "
"revision is visible"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['recent_revisions']
)
expect(
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"):
test_utilities.delete_cookies()
expect(
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"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MESSAGE_6"]
))
expect(
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"):
test_utilities.delete_cookies()
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
expect(
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"):
test_utilities.navigate_to_link(article_url)
sumo_pages.submit_kb_article_flow.approve_kb_revision(second_revision['revision_id'])
test_utilities.wait_for_given_timeout(1000)
with allure.step("Signing out and verifying that the revision is displayed inside the "
"Recent Revisions dashboard"):
test_utilities.delete_cookies()
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['recent_revisions'])
expect(
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"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MESSAGE_6"]
))
expect(
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 back in with an admin account an deleting the article"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
test_utilities.navigate_to_link(article_url)
sumo_pages.kb_article_deletion_flow.delete_kb_article()
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"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['recent_revisions']
)
test_utilities.wait_for_given_timeout(1000)
test_utilities.delete_cookies()
expect(
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"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MESSAGE_6"]
))
expect(
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(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Signing in with an admin account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
first_username = sumo_pages.top_navbar._get_text_of_logged_in_username()
with allure.step("Creating a new kb article"):
article_details = sumo_pages.submit_kb_article_flow.submit_simple_kb_article(
approve_first_revision=True
)
sumo_pages.kb_article_page._click_on_article_option()
article_url = test_utilities.get_page_url()
with allure.step("Navigating to the recent revisions dashboard and verifying that the "
"'Show Diff' option is not available for first revisions"):
sumo_pages.top_navbar._click_on_recent_revisions_option()
test_utilities.wait_for_given_timeout(3000)
expect(
sumo_pages.recent_revisions_page._get_show_diff_article_locator(
article_title=article_details['article_title'], creator=first_username
)
).to_be_hidden()
with allure.step("Navigating to the article page, signing in with a non-admin user and "
"creating a new revision for the article"):
test_utilities.navigate_to_link(article_url)
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_13"]
))
username = sumo_pages.top_navbar._get_text_of_logged_in_username()
second_revision = sumo_pages.submit_kb_article_flow.submit_new_kb_revision()
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"):
sumo_pages.top_navbar._click_on_recent_revisions_option()
test_utilities.wait_for_given_timeout(3000)
test_utilities.delete_cookies()
sumo_pages.recent_revisions_page._click_on_revision_date_for_article(
article_title=article_details['article_title'], username=username
)
expect(page).to_have_url(
article_url + KBArticleRevision.
KB_REVISION_PREVIEW + str(test_utilities.number_extraction_from_string(
second_revision['revision_id']
)
self.wait_for_given_timeout(1000)
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()
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()
)
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"]
with check, allure.step("Verifying that the revision id is the correct one"):
assert sumo_pages.kb_article_preview_revision_page._get_preview_revision_id_text(
) == str(test_utilities.number_extraction_from_string(second_revision['revision_id']))
with allure.step("Navigating back, clicking on the revision title and verifying that the "
"user is redirected to the article page"):
test_utilities.navigate_back()
sumo_pages.recent_revisions_page._click_on_article_title(
article_title=article_details['article_title'], creator=username
)
expect(page).to_have_url(article_url)
with check, allure.step("Navigating back and verifying that the correct comment is "
"displayed"):
test_utilities.navigate_back()
assert sumo_pages.recent_revisions_page._get_revision_comment(
article_title=article_details['article_title'], username=username
) == test_utilities.kb_article_test_data['changes_description']
with allure.step("Clicking on the editor and verifying that the user was redirected to "
"the correct page"):
sumo_pages.recent_revisions_page._click_article_creator_link(
article_title=article_details['article_title'], creator=username
)
expect(page).to_have_url(MyProfileMessages.get_my_profile_stage_url(username))
with allure.step("Navigating back, clicking on the show diff option and verifying that"
"diff section is displayed"):
test_utilities.navigate_back()
sumo_pages.recent_revisions_page._click_on_show_diff_for_article(
article_title=article_details['article_title'], creator=username
)
expect(sumo_pages.recent_revisions_page._get_diff_section_locator()).to_be_visible()
with allure.step("Hiding the diff and verifying that the diff section is not displayed"):
sumo_pages.recent_revisions_page._click_on_hide_diff_for_article(
article_title=article_details['article_title'], creator=username
)
expect(sumo_pages.recent_revisions_page._get_diff_section_locator()).to_be_hidden()
with allure.step("Signing in with an admin account and deleting the article"):
test_utilities.delete_cookies()
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
test_utilities.navigate_to_link(article_url)
sumo_pages.kb_article_deletion_flow.delete_kb_article()
# C2266240, C2243449
@pytest.mark.recentRevisionsDashboard
def test_recent_revisions_dashboard_title_and_username_update(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Signing back in with the admin account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
first_username = sumo_pages.top_navbar._get_text_of_logged_in_username()
with allure.step("Creating a new kb article"):
article_details = sumo_pages.submit_kb_article_flow.submit_simple_kb_article(
approve_first_revision=True
)
sumo_pages.kb_article_page._click_on_article_option()
article_url = test_utilities.get_page_url()
with allure.step("Changing the article title via the 'Edit Article Metadata' page"):
sumo_pages.edit_article_metadata_flow.edit_article_metadata(
title=test_utilities.kb_article_test_data['updated_kb_article_title'] + article_details
['article_title']
)
with allure.step("Editing the username"):
sumo_pages.top_navbar._click_on_edit_profile_option()
new_username = test_utilities.profile_edit_test_data['valid_user_edit']['username']
sumo_pages.edit_my_profile_page._send_text_to_username_field(new_username)
sumo_pages.edit_my_profile_page._click_update_my_profile_button()
with allure.step("Navigating to the recent revisions dashboard and verifying that the "
"correct new username and article title arte displayed"):
sumo_pages.top_navbar._click_on_recent_revisions_option()
test_utilities.wait_for_given_timeout(3000)
expect(
sumo_pages.recent_revisions_page._get_revision_and_username_locator(
article_title=(test_utilities.kb_article_test_data
['updated_kb_article_title'] + article_details['article_title']),
username=new_username
)
).to_be_visible()
with allure.step("Changing the username back"):
sumo_pages.top_navbar._click_on_edit_profile_option()
sumo_pages.edit_my_profile_page._send_text_to_username_field(first_username)
sumo_pages.edit_my_profile_page._click_update_my_profile_button()
with allure.step("Deleting the article"):
test_utilities.navigate_to_link(article_url)
sumo_pages.kb_article_deletion_flow.delete_kb_article()
# C2266241
@pytest.mark.recentRevisionsDashboard
def test_recent_revisions_dashboard_filters(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
start_date = "04052023"
end_date = "05012023"
with allure.step("Navigating to the 'Recent Revisions' dashboard"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['recent_revisions']
)
with check, allure.step("Selecting the ro locale from the locale filter and verifying "
"that all the displayed revisions are for the 'ro' locale"):
sumo_pages.recent_revisions_page._select_locale_option("ro")
test_utilities.wait_for_given_timeout(3000)
for tag in sumo_pages.recent_revisions_page._get_list_of_all_locale_tage():
assert tag == "ro"
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"):
sumo_pages.recent_revisions_page._select_locale_option("en-US")
test_utilities.wait_for_given_timeout(3000)
username = test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts['TEST_ACCOUNT_12']
)
sumo_pages.recent_revisions_page._fill_in_users_field(username)
test_utilities.wait_for_given_timeout(2000)
for user in sumo_pages.recent_revisions_page._get_list_of_all_editors():
assert user == username
with allure.step("Clearing the user filter, adding data inside the start and end fields"):
sumo_pages.recent_revisions_page._clearing_the_user_field()
test_utilities.wait_for_given_timeout(2000)
sumo_pages.recent_revisions_page._add_start_date("04052023")
sumo_pages.recent_revisions_page._add_end_date("05012023")
test_utilities.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 sumo_pages.recent_revisions_page._get_all_revision_dates():
extracted_date.append(test_utilities.extract_date_to_digit_format(
test_utilities.extract_month_day_year_from_string(date)
))
self.navigate_to_link(article_url)
self.sumo_pages.kb_article_deletion_flow.delete_kb_article()
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.navigate_to_link(
self.general_test_data['dashboard_links']['recent_revisions']
)
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()
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):
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()
with allure.step("Creating a new kb article"):
article_details = self.sumo_pages.submit_kb_article_flow.submit_simple_kb_article(
approve_first_revision=True
)
self.sumo_pages.kb_article_page._click_on_article_option()
article_url = self.get_page_url()
with allure.step("Navigating to the recent revisions dashboard 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()
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_13"]
))
username = self.sumo_pages.top_navbar._get_text_of_logged_in_username()
second_revision = self.sumo_pages.submit_kb_article_flow.submit_new_kb_revision()
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
)
expect(
self.page
).to_have_url(
article_url + KBArticleRevision.
KB_REVISION_PREVIEW + str(self.number_extraction_from_string(
second_revision['revision_id']
))
)
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']))
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)
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']
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))
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()
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()
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, C2243449
@pytest.mark.recentRevisionsDashboard
def test_recent_revisions_dashboard_title_and_username_update(self):
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()
with allure.step("Creating a new kb article"):
article_details = self.sumo_pages.submit_kb_article_flow.submit_simple_kb_article(
approve_first_revision=True
)
self.sumo_pages.kb_article_page._click_on_article_option()
article_url = self.get_page_url()
with allure.step("Changing the article title via the 'Edit Article Metadata' page"):
self.sumo_pages.edit_article_metadata_flow.edit_article_metadata(
title=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
)
self.logger.info("Clicking on the 'Update My Profile' button")
self.sumo_pages.edit_my_profile_page._click_update_my_profile_button()
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()
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()
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"
with allure.step("Navigating to the 'Recent Revisions' dashboard"):
self.navigate_to_link(
self.general_test_data['dashboard_links']['recent_revisions']
)
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"
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
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 end field")
self.sumo_pages.recent_revisions_page._add_end_date("05012023")
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)
))
for date in extracted_date:
assert date_filters[0] <= date <= date_filters[1]
for date in extracted_date:
assert date_filters[0] <= date <= date_filters[1]

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

@ -0,0 +1,67 @@
from typing import Any
import pytest
from playwright.sync_api import Page
from playwright_tests.core.testutilities import TestUtilities
from playwright_tests.flows.explore_articles_flows.article_flows.add_kb_article_flow import \
AddKbArticleFlow
from playwright_tests.flows.explore_articles_flows.article_flows.delete_kb_article_flow import \
DeleteKbArticleFlow
from playwright_tests.pages.auth_page import AuthPage
@pytest.fixture
def create_delete_article(request, page: Page):
test_utilities = TestUtilities(page)
submit_kb_article_flow = AddKbArticleFlow(page)
auth_page = AuthPage(page)
kb_article_deletion_flow = DeleteKbArticleFlow(page)
auto_close = True
marker = request.node.get_closest_marker("create_delete_article")
if marker is not None:
auto_close = marker.args[0]
created_articles_url = []
def _create_delete_article(username: str, data: dict[str, Any] = {}) -> (
tuple)[dict[str, Any], str]:
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts[username]
))
defaults = {
'article_title': None,
'article_slug': None,
'article_category': None,
'article_keyword': None,
'allow_discussion': True,
'allow_translations': True,
'selected_relevancy': True,
'selected_topics': True,
'search_summary': None,
'article_content': None,
'article_content_image': '',
'submit_article': True,
'is_template': False,
'expiry_date': None,
'restricted_to_groups': None,
'single_group': '',
'approve_first_revision': False,
'ready_for_localization': False
}
article_data = {**defaults, **data}
article_info = submit_kb_article_flow.submit_simple_kb_article(**article_data)
created_articles_url.append(article_info['article_url'])
return article_info, test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts['TEST_ACCOUNT_MODERATOR']
)
yield _create_delete_article
if auto_close:
for article_link in created_articles_url:
test_utilities.navigate_to_link(article_link)
if auth_page._is_logged_in_sign_in_button_displayed():
test_utilities.start_existing_session(
test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts['TEST_ACCOUNT_MODERATOR']
))
kb_article_deletion_flow.delete_kb_article()

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

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

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

@ -2,331 +2,303 @@ from playwright_tests.core.testutilities import TestUtilities
import pytest
import allure
from pytest_check import check
from playwright.sync_api import expect
from playwright.sync_api import expect, Page
from playwright_tests.messages.explore_help_articles.kb_article_page_messages import (
KBArticlePageMessages)
from playwright_tests.messages.explore_help_articles.kb_translation_messages import (
KbTranslationMessages)
from playwright_tests.messages.explore_help_articles.kb_translation_messages import \
KbTranslationMessages
from playwright_tests.messages.homepage_messages import HomepageMessages
from kitsune.settings import SUMO_LANGUAGES, FALLBACK_LANGUAGES, NON_SUPPORTED_LOCALES
from playwright_tests.pages.sumo_pages import SumoPages
class TestArticleTranslation(TestUtilities, KbTranslationMessages):
# C2489548, C2490043, C946153
@pytest.mark.kbArticleTranslation
def test_not_ready_for_localization_articles_dashboard_status(self):
with allure.step("Signing in with an Admin account"):
username = self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
# C2489548, C2490043, C946153
@pytest.mark.kbArticleTranslation
def test_not_ready_for_localization_articles_dashboard_status(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
kb_translation_messages = KbTranslationMessages()
with allure.step("Signing in with an Admin account"):
username = test_utilities.start_existing_session(
test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Create a new simple article and approving it without marking it as "
"ready for localization"):
article_details = self.sumo_pages.submit_kb_article_flow.submit_simple_kb_article(
approve_first_revision=True
)
parent_article_url = self.get_page_url()
with allure.step("Create a new simple article and approving it without marking it as "
"ready for localization"):
article_details = sumo_pages.submit_kb_article_flow.submit_simple_kb_article(
approve_first_revision=True
)
parent_article_url = test_utilities.get_page_url()
with allure.step("Clicking on the Translate Article Editing Tools option and selecting "
"the ro locale"):
self.sumo_pages.kb_article_page._click_on_translate_article_option()
self.sumo_pages.translate_article_page._click_on_romanian_locale_from_list()
translation_url = self.get_page_url()
with allure.step("Clicking on the Translate Article Editing Tools option and selecting "
"the ro locale"):
sumo_pages.kb_article_page._click_on_translate_article_option()
sumo_pages.translate_article_page._click_on_romanian_locale_from_list()
translation_url = test_utilities.get_page_url()
with check, allure.step("Verifying that the correct banner is displayed"):
check.equal(
(self.sumo_pages.translate_article_page
._get_text_of_article_unready_for_translation_banner()),
KBArticlePageMessages.KB_ARTICLE_NOT_READY_FOR_TRANSLATION_BANNER
)
with check, allure.step("Verifying that the correct banner is displayed"):
check.equal(
sumo_pages.translate_article_page._get_text_of_article_unready_for_translation_banner(
), KBArticlePageMessages.KB_ARTICLE_NOT_READY_FOR_TRANSLATION_BANNER
)
with allure.step("Navigating to the localization dashboard and verifying that the "
"article is not listed"):
self.navigate_to_link(
super().general_test_data['dashboard_links']['l10n_most_visited_translations']
)
expect(
(self.sumo_pages.most_visited_translations_page
._get_a_particular_article_title_locator(article_details['article_title']))
).to_be_hidden()
with allure.step("Navigating to the localization dashboard and verifying that the "
"article is not listed"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['l10n_most_visited_translations']
)
expect(sumo_pages.most_visited_translations_page._get_a_particular_article_title_locator(
article_details['article_title'])).to_be_hidden()
with allure.step("Navigating to the localization unreviewed page and verifying that the "
"article is not listed"):
self.navigate_to_link(
super().general_test_data['dashboard_links']['localization_unreviewed']
)
expect(
self.sumo_pages.localization_unreviewed_page._get_listed_article(
article_details['article_title']
)
).to_be_hidden()
with allure.step("Navigating to the localization unreviewed page and verifying that the "
"article is not listed"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['localization_unreviewed']
)
expect(sumo_pages.localization_unreviewed_page._get_listed_article(
article_details['article_title'])).to_be_hidden()
with allure.step("Navigating back to the translation page and performing a translation"):
self.navigate_to_link(translation_url)
translation = self.sumo_pages.submit_kb_translation_flow._add_article_translation(
approve_translation_revision=False
)
with allure.step("Navigating back to the translation page and performing a translation"):
test_utilities.navigate_to_link(translation_url)
translation = sumo_pages.submit_kb_translation_flow._add_article_translation(
approve_translation_revision=False
)
with allure.step("Navigating to the localization dashboard and verifying that the "
"article is not listed"):
self.navigate_to_link(
super().general_test_data['dashboard_links']['l10n_most_visited_translations']
)
expect(
(self.sumo_pages.most_visited_translations_page
._get_a_particular_article_title_locator(translation['translation_title']))
).to_be_hidden()
with allure.step("Navigating to the localization dashboard and verifying that the "
"article is not listed"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['l10n_most_visited_translations']
)
expect(sumo_pages.most_visited_translations_page._get_a_particular_article_title_locator(
translation['translation_title'])).to_be_hidden()
with allure.step("Navigating to the localization unreviewed page and verifying that the "
"article is displayed"):
self.navigate_to_link(
super().general_test_data['dashboard_links']['localization_unreviewed']
)
expect(
self.sumo_pages.localization_unreviewed_page._get_listed_article(
translation['translation_title']
)
).to_be_visible()
with allure.step("Navigating to the localization unreviewed page and verifying that the "
"article is displayed"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['localization_unreviewed']
)
expect(sumo_pages.localization_unreviewed_page._get_listed_article(
translation['translation_title'])).to_be_visible()
with check, allure.step("Verifying that the correct modified by text is displayed"):
check.equal(
self.sumo_pages.localization_unreviewed_page._get_modified_by_text(
translation['translation_title']
),
super().get_unreviewed_localization_modified_by_text(username)
with check, allure.step("Verifying that the correct modified by text is displayed"):
check.equal(sumo_pages.localization_unreviewed_page._get_modified_by_text(
translation['translation_title']),
kb_translation_messages.get_unreviewed_localization_modified_by_text(username)
)
with allure.step("Clicking on the article approving the revision"):
sumo_pages.localization_unreviewed_page._click_on_a_listed_article(
translation['translation_title']
)
sumo_pages.submit_kb_translation_flow.approve_kb_translation(translation['revision_id'])
with allure.step("Navigating to the localization unreviewed page and verifying that the "
"article is not displayed"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['l10n_most_visited_translations']
)
expect(sumo_pages.localization_unreviewed_page._get_listed_article(
translation['translation_title'])).to_be_hidden()
with check, allure.step("Navigating to the localization dashboard and verifying that the "
"article is not displayed"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['l10n_most_visited_translations']
)
expect(sumo_pages.localization_unreviewed_page._get_listed_article(
translation['translation_title'])).to_be_hidden()
with allure.step("Navigating to the parent article and marking it as ready for l10n"):
test_utilities.navigate_to_link(parent_article_url)
sumo_pages.kb_article_show_history_page._click_on_ready_for_l10n_option(
article_details['first_revision_id']
)
sumo_pages.kb_article_show_history_page._click_on_submit_l10n_readiness_button()
with check, allure.step("Navigating to the localization dashboard and verifying that the "
"article is displayed with the correct status"):
test_utilities.wait_for_given_timeout(2000)
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['l10n_most_visited_translations']
)
check.equal(sumo_pages.most_visited_translations_page._get_updated_localization_status(
translation['translation_title']),
kb_translation_messages.LOCALIZATION_DASHBOARD_TRANSLATED_STATUS
)
with allure.step("Deleting the parent article"):
test_utilities.navigate_to_link(parent_article_url)
sumo_pages.kb_article_deletion_flow.delete_kb_article()
with check, allure.step("Manually navigating to the 'Discuss' endpoint and verifying "
"that the 404 page is returned"):
with page.expect_navigation() as navigation_info:
test_utilities.navigate_to_link(
translation_url
)
with allure.step("Clicking on the article approving the revision"):
self.sumo_pages.localization_unreviewed_page._click_on_a_listed_article(
response = navigation_info.value
assert response.status == 404
# C2489548
@pytest.mark.kbArticleTranslation
def test_ready_for_localization_articles_dashboard_status(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
kb_translation_messages = KbTranslationMessages()
with allure.step("Signing in with an Admin account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Create a new simple article and marking it as ready for localization"):
article_details = sumo_pages.submit_kb_article_flow.submit_simple_kb_article(
approve_first_revision=True, ready_for_localization=True
)
parent_article_url = test_utilities.get_page_url()
with check, allure.step("Navigating to the localization dashboard and verifying that the "
"correct status is displayed"):
test_utilities.wait_for_given_timeout(2000)
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['l10n_most_visited_translations']
)
check.equal(sumo_pages.most_visited_translations_page._get_a_particular_translation_status(
article_details['article_title']),
kb_translation_messages.LOCALIZATION_DASHBOARD_NEEDS_TRANSLATION_STATUS
)
with allure.step("Navigating to the article translation page and verifying that no "
"banner is displayed"):
sumo_pages.most_visited_translations_page._click_on_a_particular_article_status(
article_details['article_title'])
translation_url = test_utilities.get_page_url()
expect(sumo_pages.translate_article_page._get_unready_for_translation_banner()
).to_be_hidden()
with allure.step("Performing an article translation"):
translation = sumo_pages.submit_kb_translation_flow._add_article_translation(
approve_translation_revision=False
)
with check, allure.step("Navigating to the localization dashboard and verifying that the "
"correct status is displayed"):
test_utilities.wait_for_given_timeout(2000)
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['l10n_most_visited_translations']
)
check.equal(sumo_pages.most_visited_translations_page._get_a_particular_translation_status(
translation['translation_title']),
kb_translation_messages.LOCALIZATION_DASHBOARD_NEEDS_REVIEW_STATUS
)
with check, allure.step("Navigating to the article translation and approving the "
"translation revision"):
sumo_pages.most_visited_translations_page._click_on_a_particular_article_status(
translation['translation_title']
)
sumo_pages.submit_kb_translation_flow.approve_kb_translation(translation['revision_id'])
with check, allure.step("Navigating to the localization dashboard an verifying that the "
"correct status is displayed"):
test_utilities.wait_for_given_timeout(2000)
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['l10n_most_visited_translations']
)
check.equal(
sumo_pages.most_visited_translations_page._get_updated_localization_status(
translation['translation_title']
)
self.sumo_pages.submit_kb_translation_flow.approve_kb_translation(
translation['revision_id']
)
), kb_translation_messages.LOCALIZATION_DASHBOARD_TRANSLATED_STATUS
)
with allure.step("Navigating to the localization unreviewed page and verifying that the "
"article is not displayed"):
self.navigate_to_link(
super().general_test_data['dashboard_links']['l10n_most_visited_translations']
)
expect(
self.sumo_pages.localization_unreviewed_page._get_listed_article(
translation['translation_title']
)
).to_be_hidden()
with allure.step("Deleting the parent article"):
test_utilities.navigate_to_link(parent_article_url)
sumo_pages.kb_article_deletion_flow.delete_kb_article()
with check, allure.step("Navigating to the localization dashboard and verifying that the "
"article is not displayed"):
self.navigate_to_link(
super().general_test_data['dashboard_links']['l10n_most_visited_translations']
)
expect(
self.sumo_pages.localization_unreviewed_page._get_listed_article(
translation['translation_title']
)
).to_be_hidden()
with check, allure.step("Manually navigating to the 'Discuss' endpoint and verifying "
"that the 404 page is returned"):
with page.expect_navigation() as navigation_info:
test_utilities.navigate_to_link(translation_url)
response = navigation_info.value
assert response.status == 404
with allure.step("Navigating to the parent article and marking it as ready for l10n"):
self.navigate_to_link(parent_article_url)
self.sumo_pages.kb_article_show_history_page._click_on_ready_for_l10n_option(
# C2490043
@pytest.mark.kbArticleTranslation
def test_revisions_cannot_be_marked_as_ready_for_l10n_if_lacking_permissions(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Signing in with an Admin account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Create a new simple article and marking it as ready for localization"):
article_details = sumo_pages.submit_kb_article_flow.submit_simple_kb_article(
approve_first_revision=True
)
article_url = test_utilities.get_page_url()
with allure.step("Signing in with a different account that has no permissions to mark a "
"revision as ready for l10n"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MESSAGE_2"]
))
with allure.step("Clicking on the ready for l10n button and verifying that it has no "
"effect"):
sumo_pages.kb_article_show_history_page._click_on_ready_for_l10n_option(
article_details['first_revision_id']
)
test_utilities.wait_for_given_timeout(2000)
expect(sumo_pages.kb_article_show_history_page._get_l10n_modal_locator()).to_be_hidden()
expect(
sumo_pages.kb_article_show_history_page._get_ready_for_localization_status(
article_details['first_revision_id']
)
self.sumo_pages.kb_article_show_history_page._click_on_submit_l10n_readiness_button()
).to_be_hidden()
with check, allure.step("Navigating to the localization dashboard and verifying that the "
"article is displayed with the correct status"):
self.wait_for_given_timeout(2000)
self.navigate_to_link(
super().general_test_data['dashboard_links']['l10n_most_visited_translations']
)
check.equal(
self.sumo_pages.most_visited_translations_page._get_updated_localization_status(
translation['translation_title']
),
super().LOCALIZATION_DASHBOARD_TRANSLATED_STATUS
)
with allure.step("Navigating to the localization dashboard and verifying that the "
"article is not listed"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['l10n_most_visited_translations']
)
expect(sumo_pages.most_visited_translations_page._get_a_particular_article_title_locator(
article_details['article_title'])).to_be_hidden()
with allure.step("Deleting the parent article"):
self.navigate_to_link(parent_article_url)
self.sumo_pages.kb_article_deletion_flow.delete_kb_article()
with allure.step("Navigating to the localization unreviewed page and verifying that the "
"article is not listed"):
test_utilities.navigate_to_link(
test_utilities.general_test_data['dashboard_links']['localization_unreviewed']
)
expect(sumo_pages.localization_unreviewed_page._get_listed_article(
article_details['article_title'])).to_be_hidden()
with check, allure.step("Manually navigating to the 'Discuss' endpoint and verifying "
"that the 404 page is returned"):
with self.page.expect_navigation() as navigation_info:
self.navigate_to_link(
translation_url
)
response = navigation_info.value
assert response.status == 404
with allure.step("Navigating back to the article and deleting it"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
# C2489548
@pytest.mark.kbArticleTranslation
def test_ready_for_localization_articles_dashboard_status(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"]
))
test_utilities.navigate_to_link(article_url)
sumo_pages.kb_article_deletion_flow.delete_kb_article()
with allure.step("Create a new simple article and marking it as ready for localization"):
article_details = self.sumo_pages.submit_kb_article_flow.submit_simple_kb_article(
approve_first_revision=True, ready_for_localization=True
)
parent_article_url = self.get_page_url()
with check, allure.step("Navigating to the localization dashboard and verifying that the "
"correct status is displayed"):
self.wait_for_given_timeout(2000)
self.navigate_to_link(
super().general_test_data['dashboard_links']['l10n_most_visited_translations']
)
check.equal(
(self.sumo_pages.most_visited_translations_page
._get_a_particular_translation_status(article_details['article_title'])),
super().LOCALIZATION_DASHBOARD_NEEDS_TRANSLATION_STATUS
)
with allure.step("Navigating to the article translation page and verifying that no "
"banner is displayed"):
self.sumo_pages.most_visited_translations_page._click_on_a_particular_article_status(
article_details['article_title']
)
translation_url = self.get_page_url()
expect(
self.sumo_pages.translate_article_page._get_unready_for_translation_banner()
).to_be_hidden()
with allure.step("Performing an article translation"):
translation = self.sumo_pages.submit_kb_translation_flow._add_article_translation(
approve_translation_revision=False
)
with check, allure.step("Navigating to the localization dashboard and verifying that the "
"correct status is displayed"):
self.wait_for_given_timeout(2000)
self.navigate_to_link(
super().general_test_data['dashboard_links']['l10n_most_visited_translations']
)
check.equal(
(self.sumo_pages.most_visited_translations_page
._get_a_particular_translation_status(translation['translation_title'])),
super().LOCALIZATION_DASHBOARD_NEEDS_REVIEW_STATUS
)
with check, allure.step("Navigating to the article translation and approving the "
"translation revision"):
self.sumo_pages.most_visited_translations_page._click_on_a_particular_article_status(
translation['translation_title']
)
self.sumo_pages.submit_kb_translation_flow.approve_kb_translation(
translation['revision_id']
)
with check, allure.step("Navigating to the localization dashboard an verifying that the "
"correct status is displayed"):
self.wait_for_given_timeout(2000)
self.navigate_to_link(
super().general_test_data['dashboard_links']['l10n_most_visited_translations']
)
check.equal(
self.sumo_pages.most_visited_translations_page._get_updated_localization_status(
translation['translation_title']
),
super().LOCALIZATION_DASHBOARD_TRANSLATED_STATUS
)
with allure.step("Deleting the parent article"):
self.navigate_to_link(parent_article_url)
self.sumo_pages.kb_article_deletion_flow.delete_kb_article()
with check, allure.step("Manually navigating to the 'Discuss' endpoint and verifying "
"that the 404 page is returned"):
with self.page.expect_navigation() as navigation_info:
self.navigate_to_link(
translation_url
)
response = navigation_info.value
assert response.status == 404
# C2490043
@pytest.mark.kbArticleTranslation
def test_revisions_cannot_be_marked_as_ready_for_l10n_if_lacking_permissions(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("Create a new simple article and marking it as ready for localization"):
article_details = self.sumo_pages.submit_kb_article_flow.submit_simple_kb_article(
approve_first_revision=True
)
article_url = self.get_page_url()
with allure.step("Signing in with a different account that has no permissions to mark a "
"revision as ready for l10n"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MESSAGE_2"]
))
with allure.step("Clicking on the ready for l10n button and verifying that it has no "
"effect"):
self.sumo_pages.kb_article_show_history_page._click_on_ready_for_l10n_option(
article_details['first_revision_id']
)
self.wait_for_given_timeout(2000)
expect(
self.sumo_pages.kb_article_show_history_page._get_l10n_modal_locator()
).to_be_hidden()
expect(
self.sumo_pages.kb_article_show_history_page._get_ready_for_localization_status(
article_details['first_revision_id']
)
).to_be_hidden()
with allure.step("Navigating to the localization dashboard and verifying that the "
"article is not listed"):
self.navigate_to_link(
super().general_test_data['dashboard_links']['l10n_most_visited_translations']
)
expect(
(self.sumo_pages.most_visited_translations_page
._get_a_particular_article_title_locator(article_details['article_title']))
).to_be_hidden()
with allure.step("Navigating to the localization unreviewed page and verifying that the "
"article is not listed"):
self.navigate_to_link(
super().general_test_data['dashboard_links']['localization_unreviewed']
)
expect(
self.sumo_pages.localization_unreviewed_page._get_listed_article(
article_details['article_title']
)
).to_be_hidden()
with allure.step("Navigating back to the article and deleting it"):
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()
# C2316346, C2316347
@pytest.mark.kbArticleTranslation
def test_unsupported_locales_fallback(self):
with allure.step("Verifying the unsupported locales fallback"):
for key, value in NON_SUPPORTED_LOCALES.items():
self.navigate_to_link(HomepageMessages.STAGE_HOMEPAGE_URL + f"/{key}/")
if value is None:
expect(
self.page
).to_have_url(HomepageMessages.STAGE_HOMEPAGE_URL_EN_US)
else:
expect(
self.page
).to_have_url(HomepageMessages.STAGE_HOMEPAGE_URL + f"/{value}/")
# C2316346, C2316347
@pytest.mark.kbArticleTranslation
def test_unsupported_locales_fallback(page: Page):
test_utilities = TestUtilities(page)
with allure.step("Verifying the unsupported locales fallback"):
for key, value in NON_SUPPORTED_LOCALES.items():
test_utilities.navigate_to_link(HomepageMessages.STAGE_HOMEPAGE_URL + f"/{key}/")
if value is None:
expect(
page
).to_have_url(HomepageMessages.STAGE_HOMEPAGE_URL_EN_US)
else:
expect(
page
).to_have_url(HomepageMessages.STAGE_HOMEPAGE_URL + f"/{value}/")
# C2625000
@pytest.mark.kbArticleTranslation
@ -338,88 +310,83 @@ class TestArticleTranslation(TestUtilities, KbTranslationMessages):
self.page
).to_have_url(HomepageMessages.STAGE_HOMEPAGE_URL + f"/{key}/")
# C2316347
@pytest.mark.kbArticleTranslation
def test_supported_languages(self):
with allure.step("Verifying that the users are redirected to the supported locales "
"successfully"):
for locale in SUMO_LANGUAGES:
if locale == 'xx':
continue
else:
with self.page.expect_navigation() as navigation_info:
self.navigate_to_link(HomepageMessages.STAGE_HOMEPAGE_URL + f"/{locale}/")
response = navigation_info.value
assert response.status == 200
assert locale in self.get_page_url()
# C2316350, C2316349
@pytest.mark.kbArticleTranslation
def test_sumo_locale_priority(self):
with allure.step("Signing in with a non-admin account and changing the preferred profile "
"language"):
self.start_existing_session(super().username_extraction_from_email(
self.user_secrets_accounts["TEST_ACCOUNT_MESSAGE_5"]
))
# C2316347
@pytest.mark.kbArticleTranslation
def test_supported_languages(page: Page):
test_utilities = TestUtilities(page)
with allure.step("Verifying that the users are redirected to the supported locales "
"successfully"):
for locale in SUMO_LANGUAGES:
if locale == 'xx':
continue
else:
with page.expect_navigation() as navigation_info:
test_utilities.navigate_to_link(
HomepageMessages.STAGE_HOMEPAGE_URL + f"/{locale}/")
response = navigation_info.value
assert response.status == 200
assert locale in test_utilities.get_page_url()
with allure.step("Accessing the edit profile page and changing the language to ro"):
self.sumo_pages.top_navbar._click_on_edit_profile_option()
(self.sumo_pages.edit_my_profile_page
._select_preferred_language_dropdown_option_by_value("ro"))
self.sumo_pages.edit_my_profile_page._click_update_my_profile_button()
with allure.step("Navigating to the SUMO homepage without specifying the path in the "
"locale and verifying that the preferred locale is set"):
self.navigate_to_link(HomepageMessages.STAGE_HOMEPAGE_URL)
expect(
self.page
).to_have_url(HomepageMessages.STAGE_HOMEPAGE_URL + "/ro/")
# C2316350, C2316349
@pytest.mark.kbArticleTranslation
def test_sumo_locale_priority(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Signing in with a non-admin account and changing the preferred profile "
"language"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MESSAGE_5"]
))
with allure.step("Navigating to the SUMO homepage while using a lang query parameter and "
"verifying that the user is redirected to the specified locale inside "
"the param"):
self.navigate_to_link(HomepageMessages.STAGE_HOMEPAGE_URL + "/?lang=de")
expect(
self.page
).to_have_url(HomepageMessages.STAGE_HOMEPAGE_URL + "/de/")
with allure.step("Accessing the edit profile page and changing the language to ro"):
sumo_pages.top_navbar._click_on_edit_profile_option()
sumo_pages.edit_my_profile_page._select_preferred_language_dropdown_option_by_value("ro")
sumo_pages.edit_my_profile_page._click_update_my_profile_button()
with allure.step("Navigating back to the ro locale"):
self.navigate_to_link(HomepageMessages.STAGE_HOMEPAGE_URL)
with allure.step("Navigating to the SUMO homepage without specifying the path in the "
"locale and verifying that the preferred locale is set"):
test_utilities.navigate_to_link(HomepageMessages.STAGE_HOMEPAGE_URL)
expect(page).to_have_url(HomepageMessages.STAGE_HOMEPAGE_URL + "/ro/")
with allure.step("Sending a request by modifying the 'Accept-Language' header to a "
"different locale"):
headers = {
'Accept-Language': 'it'
}
self.set_extra_http_headers(headers)
self.navigate_to_link(HomepageMessages.STAGE_HOMEPAGE_URL)
expect(
self.page
).to_have_url(HomepageMessages.STAGE_HOMEPAGE_URL + "/ro/")
with allure.step("Navigating to the SUMO homepage while using a lang query parameter and "
"verifying that the user is redirected to the specified locale inside "
"the param"):
test_utilities.navigate_to_link(HomepageMessages.STAGE_HOMEPAGE_URL + "/?lang=de")
expect(page).to_have_url(HomepageMessages.STAGE_HOMEPAGE_URL + "/de/")
with allure.step("Changing the preferred language back to english and signing out"):
self.navigate_to_link(HomepageMessages.STAGE_HOMEPAGE_URL + '/en-US/')
self.sumo_pages.top_navbar._click_on_edit_profile_option()
(self.sumo_pages.edit_my_profile_page
._select_preferred_language_dropdown_option_by_value("en-US"))
self.sumo_pages.edit_my_profile_page._click_update_my_profile_button()
self.delete_cookies()
with allure.step("Navigating back to the ro locale"):
test_utilities.navigate_to_link(HomepageMessages.STAGE_HOMEPAGE_URL)
with allure.step("Sending the request with the modified 'Accept-Language' header set to "
"a different locale and verifying that the correct locale is displayed"):
self.navigate_to_link(HomepageMessages.STAGE_HOMEPAGE_URL)
expect(
self.page
).to_have_url(HomepageMessages.STAGE_HOMEPAGE_URL + "/it/")
with allure.step("Sending a request by modifying the 'Accept-Language' header to a "
"different locale"):
headers = {
'Accept-Language': 'it'
}
test_utilities.set_extra_http_headers(headers)
test_utilities.navigate_to_link(HomepageMessages.STAGE_HOMEPAGE_URL)
expect(page).to_have_url(HomepageMessages.STAGE_HOMEPAGE_URL + "/ro/")
with allure.step("Sending the request with the modified 'Accept-Language' to point out "
"to an invalid locale and a fallback and verifying that the user is "
"redirected to the correct first fallback locale"):
headers = {
'Accept-Language': 'test, de, it'
}
self.set_extra_http_headers(headers)
self.navigate_to_link(HomepageMessages.STAGE_HOMEPAGE_URL)
expect(
self.page
).to_have_url(HomepageMessages.STAGE_HOMEPAGE_URL + "/de/")
with allure.step("Changing the preferred language back to english and signing out"):
test_utilities.navigate_to_link(HomepageMessages.STAGE_HOMEPAGE_URL + '/en-US/')
sumo_pages.top_navbar._click_on_edit_profile_option()
sumo_pages.edit_my_profile_page._select_preferred_language_dropdown_option_by_value(
"en-US")
sumo_pages.edit_my_profile_page._click_update_my_profile_button()
test_utilities.delete_cookies()
with allure.step("Sending the request with the modified 'Accept-Language' header set to "
"a different locale and verifying that the correct locale is displayed"):
test_utilities.navigate_to_link(HomepageMessages.STAGE_HOMEPAGE_URL)
expect(page).to_have_url(HomepageMessages.STAGE_HOMEPAGE_URL + "/it/")
with allure.step("Sending the request with the modified 'Accept-Language' to point out "
"to an invalid locale and a fallback and verifying that the user is "
"redirected to the correct first fallback locale"):
headers = {
'Accept-Language': 'test, de, it'
}
test_utilities.set_extra_http_headers(headers)
test_utilities.navigate_to_link(HomepageMessages.STAGE_HOMEPAGE_URL)
expect(page).to_have_url(HomepageMessages.STAGE_HOMEPAGE_URL + "/de/")

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

@ -1,56 +1,56 @@
import allure
from playwright_tests.core.testutilities import TestUtilities
from playwright.sync_api import expect
from playwright.sync_api import expect, Page
from pytest_check import check
import pytest
from playwright_tests.core.testutilities import TestUtilities
from playwright_tests.messages.homepage_messages import HomepageMessages
from playwright_tests.messages.explore_help_articles.products_page_messages import (
ProductsPageMessages)
from playwright_tests.pages.sumo_pages import SumoPages
class TestPostedQuestions(TestUtilities):
# C890834, C890833
@pytest.mark.kbProductsPage
def test_products_page_content(page: Page):
with check, allure.step("Navigating to products page via top-navbar and verifying that "
"the correct page header is displayed"):
sumo_pages = SumoPages(page)
test_utilities = TestUtilities(page)
sumo_pages.top_navbar._click_on_explore_our_help_articles_view_all_option()
assert sumo_pages.products_page._get_page_header(
) == ProductsPageMessages.PRODUCTS_PAGE_HEADER
# C890834, C890833
@pytest.mark.kbProductsPage
def test_products_page_content(self):
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_view_all_option()
assert 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"):
sumo_pages.products_page._click_on_first_breadcrumb()
expect(page).to_have_url(HomepageMessages.STAGE_HOMEPAGE_URL_EN_US)
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)
with allure.step("Navigating back to the 'Products' page"):
test_utilities.navigate_back()
with allure.step("Navigating back to the 'Products' page"):
self.navigate_back()
for card in sumo_pages.products_page._get_all_product_support_titles():
with check, allure.step(f"Verifying that the {card} card contains the correct "
f"subheading"):
if card in ProductsPageMessages.PRODUCT_CARDS_SUBHEADING:
assert sumo_pages.products_page._get_subheading_of_card(
card) == ProductsPageMessages.PRODUCT_CARDS_SUBHEADING[card]
for card in self.sumo_pages.products_page._get_all_product_support_titles():
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):
with allure.step("Navigating to products page via top-navbar"):
self.sumo_pages.top_navbar._click_on_explore_our_help_articles_view_all_option()
# C890846
@pytest.mark.kbProductsPage
def test_products_page_card_redirect(page: Page):
sumo_pages = SumoPages(page)
test_utilities = TestUtilities(page)
with allure.step("Navigating to products page via top-navbar"):
sumo_pages.top_navbar._click_on_explore_our_help_articles_view_all_option()
for card in self.sumo_pages.products_page._get_all_product_support_titles():
if card in self.general_test_data['product_support']:
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])
for card in sumo_pages.products_page._get_all_product_support_titles():
if card in test_utilities.general_test_data['product_support']:
with allure.step(f"Clicking on {card} card and verifying that we are redirected "
f"to the correct product url"):
sumo_pages.products_page._click_on_a_particular_product_support_card(card)
expect(page).to_have_url(test_utilities.general_test_data['product_support'][card])
with allure.step("Navigating back to the products page"):
self.navigate_back()
with allure.step("Navigating back to the products page"):
test_utilities.navigate_back()

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

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

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

@ -1,7 +1,7 @@
import allure
from pytest_check import check
import pytest
from playwright.sync_api import expect
from playwright.sync_api import expect, Page
from playwright_tests.core.testutilities import TestUtilities
from playwright_tests.messages.contribute_messages.con_pages.con_page_messages import (
ContributePageMessages)
@ -10,226 +10,212 @@ from playwright_tests.messages.explore_help_articles.products_support_page_messa
ProductSupportPageMessages)
from playwright_tests.messages.ask_a_question_messages.product_solutions_messages import (
ProductSolutionsMessages)
from playwright_tests.pages.sumo_pages import SumoPages
class TestPostedQuestions(TestUtilities):
# Causing some weird failures in GH runners. Need to investigate before re-enabling.
# C890926, C890931, C2091563
@pytest.mark.skip
def test_product_support_page(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Navigating to products page via top-navbar"):
sumo_pages.top_navbar._click_on_explore_our_help_articles_view_all_option()
# Causing some weird failures in GH runners. Need to investigate before re-enabling.
with allure.step("Clicking on all product cards"):
for card in sumo_pages.products_page._get_all_product_support_titles():
if card in test_utilities.general_test_data['product_support']:
sumo_pages.products_page._click_on_a_particular_product_support_card(card)
# C890926, C890931, C2091563
@pytest.mark.skip
def test_product_support_page(self):
with allure.step("Navigating to products page via top-navbar"):
self.sumo_pages.top_navbar._click_on_explore_our_help_articles_view_all_option()
with check, allure.step("Verifying that the correct page header is displayed"):
assert (sumo_pages.product_support_page._get_product_support_title_text()
) == card + ProductSupportPageMessages.PRODUCT_SUPPORT_PAGE_TITLE
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)
with check, allure.step("Verifying the correct topics header is displayed"):
assert (sumo_pages.product_support_page._get_frequent_topics_title_text()
) == (ProductSupportPageMessages
.PRODUCT_SUPPORT_PAGE_FREQUENT_TOPICS_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
with check, allure.step("Verifying that the correct topics subheader is "
"displayed"):
assert (sumo_pages.product_support_page._get_frequent_topics_subtitle_text()
) == (ProductSupportPageMessages
.PRODUCT_SUPPORT_PAGE_FREQUENT_TOPICS_SUBTITLE)
with check, allure.step("Verifying the correct topics header is displayed"):
assert (self.sumo_pages.product_support_page
._get_frequent_topics_title_text()
with check, allure.step("Verifying that the correct still need help title is "
"displayed"):
assert (sumo_pages.product_support_page._get_still_need_help_widget_title()
) == ProductSupportPageMessages.STILL_NEED_HELP_WIDGET_TITLE
if card in test_utilities.general_test_data['premium_products']:
with check, allure.step("Verifying that the correct still need help "
"content is displayed"):
assert (sumo_pages.product_support_page
._get_still_need_help_widget_content()
) == (ProductSupportPageMessages
.PRODUCT_SUPPORT_PAGE_FREQUENT_TOPICS_TITLE)
.STILL_NEED_HELP_WIDGET_CONTENT_PREMIUM)
with check, allure.step("Verifying that the correct topics subheader is "
"displayed"):
assert (self.sumo_pages.product_support_page
._get_frequent_topics_subtitle_text()
with check, allure.step("Verifying that the correct still need help "
"button text is displayed"):
assert (sumo_pages.product_support_page
._get_still_need_help_widget_button_text()
) == (ProductSupportPageMessages
.PRODUCT_SUPPORT_PAGE_FREQUENT_TOPICS_SUBTITLE)
.STILL_NEED_HELP_WIDGET_BUTTON_TEXT_PREMIUM)
else:
with check, allure.step("Verifying that the correct still need help "
"content is displayed"):
assert (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 title is "
"displayed"):
assert (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 "
"button text is displayed"):
assert (sumo_pages.product_support_page
._get_still_need_help_widget_button_text()
) == (ProductSupportPageMessages
.STILL_NEED_HELP_WIDGET_BUTTON_TEXT_FREEMIUM)
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)
# 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 (sumo_pages.product_support_page
._get_featured_articles_header_text()
) == (ProductSupportPageMessages
.PRODUCT_SUPPORT_PAGE_FREQUENT_ARTICLES_TITLE)
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)
with check, allure.step("Verifying that the correct 'Join Our Community' "
"section header is displayed"):
assert (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 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)
with check, allure.step("Verifying that the correct 'Join Our Community "
"section content is displayed'"):
assert (sumo_pages.product_support_page._get_join_our_community_content_text()
) == ProductSupportPageMessages.JOIN_OUR_COMMUNITY_SECTION_CONTENT
# 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)
with allure.step("Clicking on the 'Learn more' option from the 'Join Our "
"Community' section"):
sumo_pages.product_support_page._click_join_our_community_learn_more_link()
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
with allure.step("Verify that we are redirected to the contribute messages page"):
expect(page).to_have_url(ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL)
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
with allure.step("Navigate back, clicking on the 'Home' breadcrumb and "
"verifying that we are redirected to the homepage"):
test_utilities.navigate_back()
sumo_pages.product_support_page._click_on_product_support_home_breadcrumb()
expect(page).to_have_url(HomepageMessages.STAGE_HOMEPAGE_URL_EN_US)
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())
with allure.step("Navigating to products page via top-navbar"):
sumo_pages.top_navbar._click_on_explore_our_help_articles_view_all_option()
with allure.step("Verify that we are redirected to the contribute messages "
"page"):
expect(
self.page
).to_have_url(ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL)
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)
# C890929
@pytest.mark.skip
def test_product_support_page_frequent_topics_redirect(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Navigating to products page via top-navbar"):
sumo_pages.top_navbar._click_on_explore_our_help_articles_view_all_option()
with allure.step("Navigating to products page via top-navbar"):
(self.sumo_pages.top_navbar
._click_on_explore_our_help_articles_view_all_option())
with allure.step("Clicking on all product cards"):
# C890929
@pytest.mark.skip
def test_product_support_page_frequent_topics_redirect(self):
with allure.step("Navigating to products page via top-navbar"):
self.sumo_pages.top_navbar._click_on_explore_our_help_articles_view_all_option()
for card in sumo_pages.products_page._get_all_product_support_titles():
if card in test_utilities.general_test_data['product_support']:
sumo_pages.products_page._click_on_a_particular_product_support_card(card)
with allure.step("Clicking on all product cards"):
with check, allure.step("Verifying that the correct page header is displayed"):
assert (sumo_pages.product_support_page._get_product_support_title_text()
) == card + ProductSupportPageMessages.PRODUCT_SUPPORT_PAGE_TITLE
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)
if sumo_pages.product_support_page._is_frequent_topics_section_displayed:
for topic in sumo_pages.product_support_page._get_all_frequent_topics_cards():
(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 sumo_pages.product_topics_page._get_page_title() == topic
test_utilities.navigate_back()
else:
print(f"{card} has no frequent topics displayed!!!")
with allure.step("Navigating back"):
test_utilities.navigate_back()
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))
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()
@pytest.mark.skip
def test_product_support_page_featured_articles_redirect(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Navigating to products page via top-navbar"):
sumo_pages.top_navbar._click_on_explore_our_help_articles_view_all_option()
@pytest.mark.skip
def test_product_support_page_featured_articles_redirect(self):
with allure.step("Navigating to products page via top-navbar"):
self.sumo_pages.top_navbar._click_on_explore_our_help_articles_view_all_option()
with allure.step("Clicking on all product cards"):
for card in sumo_pages.products_page._get_all_product_support_titles():
if card in test_utilities.general_test_data['product_support']:
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)
with check, allure.step("Verifying that the correct page header is displayed"):
assert (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 sumo_pages.product_support_page._is_featured_articles_section_displayed:
featured_article_cards_count = (sumo_pages.product_support_page
._get_feature_articles_count())
count = 1
while count <= featured_article_cards_count:
featured_article_names = (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
(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] == (
sumo_pages.kb_article_page._get_text_of_article_title())
count += 1
test_utilities.navigate_back()
else:
print(f"{card} has no featured articles displayed!!!")
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!!!")
with allure.step("Navigating back"):
test_utilities.navigate_back()
with allure.step("Navigating back"):
self.navigate_back()
# C890932
@pytest.mark.skip
def test_still_need_help_button_redirect(self):
with allure.step("Navigating to products page via top-navbar"):
self.sumo_pages.top_navbar._click_on_explore_our_help_articles_view_all_option()
# C890932
@pytest.mark.skip
def test_still_need_help_button_redirect(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Navigating to products page via top-navbar"):
sumo_pages.top_navbar._click_on_explore_our_help_articles_view_all_option()
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)
with allure.step("Clicking on all product cards"):
for card in sumo_pages.products_page._get_all_product_support_titles():
if card in test_utilities.general_test_data['product_support']:
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()
with check, allure.step("Verifying that the correct page header is displayed"):
assert (sumo_pages.product_support_page._get_product_support_title_text()
) == card + ProductSupportPageMessages.PRODUCT_SUPPORT_PAGE_TITLE
sumo_pages.product_support_page._click_still_need_help_widget_button()
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]
)
with allure.step("Verifying that we are redirected to the correct product "
"solutions page"):
expect(page).to_have_url(
test_utilities.general_test_data['product_solutions'][card]
)
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
with check, allure.step("Verifying that we are on the correct milestone"):
assert sumo_pages.product_solutions_page._get_current_milestone_text(
) == ProductSolutionsMessages.CURRENT_MILESTONE_TEXT
with allure.step("Navigating to products page via top-navbar"):
(self.sumo_pages.top_navbar
._click_on_explore_our_help_articles_view_all_option())
with allure.step("Navigating to products page via top-navbar"):
sumo_pages.top_navbar._click_on_explore_our_help_articles_view_all_option()

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

@ -3,54 +3,53 @@ import allure
import pytest
import requests
from pytest_check import check
from playwright.sync_api import expect
from playwright_tests.core.testutilities import TestUtilities
from playwright.sync_api import expect, Page
from urllib.parse import urljoin
from playwright_tests.pages.sumo_pages import SumoPages
class TestFooter(TestUtilities):
# C945147
@pytest.mark.footerSectionTests
def test_all_footer_links_are_working(page: Page):
sumo_pages = SumoPages(page)
for link in sumo_pages.footer_section._get_all_footer_links():
relative_url = link.get_attribute("href")
# C945147
@pytest.mark.footerSectionTests
def test_all_footer_links_are_working(self):
self.logger.info("Verifying that footer links are not broken")
for link in self.sumo_pages.footer_section._get_all_footer_links():
relative_url = link.get_attribute("href")
# Verify if URL is absolute, and construct the full URL if it's not
if not relative_url.startswith(('http://', 'https://')):
base_url = page.url
url = urljoin(base_url, relative_url)
else:
url = relative_url
# Verify if URL is absolute, and construct the full URL if it's not
if not relative_url.startswith(('http://', 'https://')):
base_url = self.page.url
url = urljoin(base_url, relative_url)
else:
url = relative_url
# I have noticed that one of our footer link: https://foundation.mozilla.org/
# seems to reject requests coming from Headless Chrome user-agent.
# We are fetching the User-Agent via the JS executor,
# constructing and passing the header to our request.
# I have noticed that one of our footer link: https://foundation.mozilla.org/
# seems to reject requests coming from Headless Chrome user-agent.
# We are fetching the User-Agent via the JS executor,
# constructing and passing the header to our request.
user_agent = page.evaluate("navigator.userAgent")
user_agent = self.page.evaluate("navigator.userAgent")
if "HeadlessChrome" in user_agent:
user_agent = user_agent.replace("HeadlessChrome", "Chrome")
if "HeadlessChrome" in user_agent:
user_agent = user_agent.replace("HeadlessChrome", "Chrome")
header = {"User-Agent": f"{user_agent}"}
# Remove this
response = requests.get(url, headers=header)
header = {"User-Agent": f"{user_agent}"}
# Remove this
self.logger.info(f"Request header: {header}")
response = requests.get(url, headers=header)
# Some links are returning status code 429.
# We are currently treating them as pass cases.
with check, allure.step(f"Verifying that {url} is not broken are not broken"):
assert response.status_code in set(range(400)) | {403, 429}
# Some links are returning status code 429.
# We are currently treating them as pass cases.
with check, allure.step(f"Verifying that {url} is not broken are not broken"):
assert response.status_code in set(range(400)) | {403, 429}
# C2316348
@pytest.mark.footerSectionTests
def test_locale_selector(self):
with allure.step("Verifying that all footer select options are redirecting the user to "
"the correct page locale"):
for locale in self.sumo_pages.footer_section._get_all_footer_locales():
self.sumo_pages.footer_section._switch_to_a_locale(locale)
expect(
self.page
).to_have_url(re.compile(f".*{locale}"))
# C2316348
@pytest.mark.footerSectionTests
def test_locale_selector(page: Page):
sumo_pages = SumoPages(page)
with allure.step("Verifying that all footer select options are redirecting the user to the "
"correct page locale"):
for locale in sumo_pages.footer_section._get_all_footer_locales():
sumo_pages.footer_section._switch_to_a_locale(locale)
expect(
page
).to_have_url(re.compile(f".*{locale}"))

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

@ -1,98 +1,93 @@
import allure
import pytest
from playwright.sync_api import Page
from pytest_check import check
from playwright_tests.core.testutilities import TestUtilities
from playwright_tests.messages.contribute_messages.con_pages.con_page_messages import (
ContributePageMessages)
from playwright_tests.messages.homepage_messages import HomepageMessages
from playwright_tests.messages.explore_help_articles.support_page_messages import (
SupportPageMessages)
from playwright_tests.pages.sumo_pages import SumoPages
class TestHomepage(TestUtilities):
# C876542
@pytest.mark.homePageTests
def test_join_our_community_card_learn_more_redirects_to_contribute_page(self):
with allure.step("Clicking on the 'Learn More' option"):
self.sumo_pages.homepage._click_learn_more_option()
# C876542
@pytest.mark.homePageTests
def test_join_our_community_card_learn_more_redirects_to_contribute_page(page: Page):
sumo_pages = SumoPages(page)
test_utilities = TestUtilities(page)
with allure.step("Clicking on the 'Learn More' option"):
sumo_pages.homepage._click_learn_more_option()
with allure.step("Verifying that we are redirected to the 'Contribute' page successfully"):
with allure.step("Verifying that we are redirected to the 'Contribute' page successfully"):
assert (
test_utilities.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(page: Page):
sumo_pages = SumoPages(page)
with allure.step(
"Verifying that the 'Join Our Community' card has the correct strings applied"
):
assert (
sumo_pages.homepage._get_community_card_title()
== HomepageMessages.JOIN_OUR_COMMUNITY_CARD_TITLE
and 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(page: Page):
sumo_pages = SumoPages(page)
test_utilities = TestUtilities(page)
with check, allure.step(
"Verifying if the correct number of featured articles are present on the homepage"
):
assert sumo_pages.homepage._get_number_of_featured_articles(
) is HomepageMessages.EXPECTED_FEATURED_ARTICLES_COUNT
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 sumo_pages.homepage._get_featured_articles_titles():
articles_names = sumo_pages.homepage._get_featured_articles_titles()
sumo_pages.homepage._click_on_a_featured_card(counter)
assert (
self.get_page_url()
== ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL
), "We are not on the Contribute page!"
sumo_pages.kb_article_page._get_text_of_article_title().strip()
== articles_names[counter].strip()
), (f"Incorrect featured article displayed. Expected: {featured_article} "
f"Received: {sumo_pages.kb_article_page._get_text_of_article_title()}")
# C876542
@pytest.mark.homePageTests
def test_join_our_community_card_has_the_correct_content(self):
with allure.step(
"Verifying that the 'Join Our Community' card has the correct strings applied"
):
with allure.step("Navigating back to the previous page"):
test_utilities.navigate_back()
counter += 1
# C873774
@pytest.mark.homePageTests
def test_product_cards_are_functional_and_redirect_to_the_proper_support_page(page: Page):
sumo_pages = SumoPages(page)
test_utilities = TestUtilities(page)
with allure.step("Verifying that the product cards redirect to the correct support page"):
card_titles = 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
sumo_pages.homepage._click_on_product_card(counter)
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"
expected_product_title
== sumo_pages.product_support_page._get_product_support_title_text()
), (f"Incorrect support page displayed. "
f"Expected: {expected_product_title} "
f"Received: "
f"{sumo_pages.product_support_page._get_product_support_title_text()}")
# C876541
@pytest.mark.homePageTests
def test_homepage_feature_articles_are_available_and_interactable(self):
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(
) is HomepageMessages.EXPECTED_FEATURED_ARTICLES_COUNT
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(
f"Clicking on: {articles_names[counter]} article card"
)
self.sumo_pages.homepage._click_on_a_featured_card(counter)
self.logger.info(
"Verifying that the correct article title is displayed."
)
assert (
self.sumo_pages.kb_article_page._get_text_of_article_title().strip()
== articles_names[counter].strip()
), (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):
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()}")
with allure.step("Navigating back to the previous page"):
self.navigate_back()
counter += 1
with allure.step("Navigating back to the previous page"):
test_utilities.navigate_back()
counter += 1

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

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

@ -1,49 +1,47 @@
import pytest
from playwright_tests.core.testutilities import TestUtilities
from playwright.sync_api import expect
from playwright.sync_api import expect, Page
from playwright_tests.flows.auth_flows.auth_flow import AuthFlowPage
from playwright_tests.pages.sumo_pages import SumoPages
class TestLoginSessions(TestUtilities):
# Need to update these tests to fetch the usernames and credentials from GH secrets
@pytest.mark.loginSessions
def test_create_user_sessions_for_test_accounts(self):
@pytest.mark.loginSessions
def test_create_user_sessions_for_test_accounts(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
auth_flow = AuthFlowPage(page)
i = 0
keys = list(super().user_secrets_accounts.keys())
tried_once = False
while i < len(keys):
self.sumo_pages.top_navbar._click_on_signin_signup_button()
i = 0
keys = list(test_utilities.user_secrets_accounts.keys())
tried_once = False
while i < len(keys):
sumo_pages.top_navbar._click_on_signin_signup_button()
# Also acts as a wait. Introduced in order to avoid flakiness which occurred on some
# GH runs.
expect(
self.sumo_pages.auth_page._get_continue_with_firefox_button_locator()
).to_be_visible()
# Also acts as a wait. Introduced in order to avoid flakiness which occurred on some
# GH runs.
expect(sumo_pages.auth_page._get_continue_with_firefox_button_locator()).to_be_visible()
self.sumo_pages.auth_flow_page.sign_in_flow(
username=super().user_secrets_accounts[keys[i]],
account_password=super().user_secrets_pass
)
auth_flow.sign_in_flow(
username=test_utilities.user_secrets_accounts[keys[i]],
account_password=test_utilities.user_secrets_pass
)
self.wait_for_given_timeout(3500)
username = self.username_extraction_from_email(
super().user_secrets_accounts[keys[i]]
)
self.store_session_cookies(username)
test_utilities.wait_for_given_timeout(3500)
username = test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts[keys[i]]
)
test_utilities.store_session_cookies(username)
# Trying to log in. If the login fails, we retry creating the failed session. If we
# retried once, fail the test.
self.start_existing_session(
username
)
# Trying to log in. If the login fails, we retry creating the failed session. If we
# retried once, fail the test.
test_utilities.start_existing_session(
username
)
if self.sumo_pages.top_navbar._get_text_of_logged_in_username(
) != username and not tried_once:
tried_once = True
elif self.sumo_pages.top_navbar._get_text_of_logged_in_username(
) != username and tried_once:
pytest.fail(f"Unable to sign in with {username}")
else:
i += 1
self.delete_cookies()
if sumo_pages.top_navbar._get_text_of_logged_in_username() != username and not tried_once:
tried_once = True
elif sumo_pages.top_navbar._get_text_of_logged_in_username() != username and tried_once:
pytest.fail(f"Unable to sign in with {username}")
else:
i += 1
test_utilities.delete_cookies()

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

@ -1,46 +1,51 @@
import allure
import pytest
from playwright.sync_api import Page
from pytest_check import check
import requests
from playwright_tests.core.testutilities import TestUtilities
from playwright_tests.messages.top_navbar_messages import TopNavbarMessages
from playwright_tests.pages.sumo_pages import SumoPages
class TestTopNavbar(TestUtilities):
# C876534, C890961
@pytest.mark.topNavbarTests
def test_number_of_options_not_signed_in(self):
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
# C876534, C890961
@pytest.mark.topNavbarTests
def test_number_of_options_not_signed_in(page: Page):
sumo_pages = SumoPages(page)
with check, allure.step("Verifying that the SUMO logo is successfully displayed"):
image = 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
with allure.step("Verifying that the top-navbar for signed in users contains: Explore "
"Help Articles, Community Forums, Ask a Question and Contribute"):
top_navbar_items = self.sumo_pages.top_navbar._get_available_menu_titles()
assert top_navbar_items == TopNavbarMessages.TOP_NAVBAR_OPTIONS, (
"Incorrect elements displayed in top-navbar for signed out state"
)
with allure.step("Verifying that the top-navbar for signed in users contains: Explore "
"Help Articles, Community Forums, Ask a Question and Contribute"):
top_navbar_items = sumo_pages.top_navbar._get_available_menu_titles()
assert top_navbar_items == TopNavbarMessages.TOP_NAVBAR_OPTIONS, (
"Incorrect elements displayed in top-navbar for signed out state"
)
# C876539
@pytest.mark.topNavbarTests
def test_number_of_options_signed_in(self):
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']
))
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
# C876539
@pytest.mark.topNavbarTests
def test_number_of_options_signed_in(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Signing in using a non-admin user"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts['TEST_ACCOUNT_12']
))
with allure.step("Verifying that the top-navbar contains: Explore Help Articles, "
"Community Forums, Ask a Question, Contribute"):
top_navbar_items = self.sumo_pages.top_navbar._get_available_menu_titles()
assert top_navbar_items == TopNavbarMessages.TOP_NAVBAR_OPTIONS, (
"Incorrect elements displayed in top-navbar for " "signed-in state"
)
with check, allure.step("Verifying that the SUMO logo is successfully displayed"):
image = 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
with allure.step("Verifying that the top-navbar contains: Explore Help Articles, "
"Community Forums, Ask a Question, Contribute"):
top_navbar_items = sumo_pages.top_navbar._get_available_menu_titles()
assert top_navbar_items == TopNavbarMessages.TOP_NAVBAR_OPTIONS, (
"Incorrect elements displayed in top-navbar for " "signed-in state"
)

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

@ -1,95 +1,86 @@
import allure
import pytest
from pytest_check import check
from playwright.sync_api import expect
from playwright.sync_api import expect, Page
from playwright_tests.core.testutilities import TestUtilities
from playwright_tests.messages.mess_system_pages_messages.edit_cont_areas_page_messages import (
EditContributionAreasPageMessages)
from playwright_tests.messages.my_profile_pages_messages.my_profile_page_messages import (
MyProfileMessages)
from playwright_tests.pages.sumo_pages import SumoPages
class TestEditContributionAreas(TestUtilities):
# C2206070
@pytest.mark.userContributionTests
def test_all_checkboxes_can_be_selected_and_saved(self):
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']
))
# C2206070
@pytest.mark.userContributionTests
def test_all_checkboxes_can_be_selected_and_saved(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Signing in with a non-admin account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts['TEST_ACCOUNT_12']
))
original_user = sumo_pages.top_navbar._get_text_of_logged_in_username()
original_user = self.sumo_pages.top_navbar._get_text_of_logged_in_username()
with allure.step("Checking all contributor checkboxes"):
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)
with check, allure.step("Verifying that the correct notification banner text is displayed"):
assert sumo_pages.edit_my_profile_con_areas_page._edit_con_areas_pref_banner_txt(
) == EditContributionAreasPageMessages.PREFERENCES_SAVED_NOTIFICATION_BANNER_TEXT
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
with allure.step("Verifying that all the checkboxes are checked"):
assert (
sumo_pages.edit_my_profile_con_areas_page._are_all_cont_pref_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 = (sumo_pages.edit_my_profile_con_areas_page
._get_contrib_areas_checkbox_labels())
contribution_options = (
self.sumo_pages.edit_my_profile_con_areas_page._get_contrib_areas_checkbox_labels()
)
with allure.step("Accessing the my profile page and verifying that the displayed groups are "
"the correct ones"):
sumo_pages.user_navbar._click_on_my_profile_option()
assert sumo_pages.my_profile_page._get_my_profile_groups_items_text(
) == contribution_options
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
)
with allure.step("Signing in with a different account and verifying that the original user "
"groups are displayed"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts['TEST_ACCOUNT_13']
))
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']
))
with allure.step("Navigating to the user page and verifying that the user groups is "
"successfully displayed"):
test_utilities.navigate_to_link(MyProfileMessages.get_my_profile_stage_url(original_user))
assert sumo_pages.my_profile_page._get_my_profile_groups_items_text(
) == contribution_options
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
)
with allure.step("Signing in back with the original user"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts['TEST_ACCOUNT_12']
))
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']
))
with allure.step("Accessing the edit contribution areas page and unchecking all checkboxes"):
sumo_pages.edit_profile_flow.check_all_profile_contribution_areas(checked=True)
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)
with check, allure.step("Clicking on the update button and verifying that the correct "
"notification banner is displayed"):
assert sumo_pages.edit_my_profile_con_areas_page._edit_con_areas_pref_banner_txt(
) == EditContributionAreasPageMessages.PREFERENCES_SAVED_NOTIFICATION_BANNER_TEXT
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
with allure.step("Verifying that the profile groups section is no longer displayed inside the "
"profile section"):
sumo_pages.user_navbar._click_on_my_profile_option()
expect(sumo_pages.my_profile_page._groups_section_element()).to_be_hidden()
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()
with allure.step("Logging in with a different user and accessing the original user profile"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts['TEST_ACCOUNT_13']
))
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']
))
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()
with allure.step("Navigating to the my profile page and verifying that the groups section is "
"no longer displayed for the original user"):
test_utilities.navigate_to_link(MyProfileMessages.get_my_profile_stage_url(original_user))
expect(
sumo_pages.my_profile_page._groups_section_element()
).to_be_hidden()

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

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

@ -1,36 +1,39 @@
import allure
import pytest
from playwright.sync_api import Page
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 (
EditSettingsPageMessages)
from playwright_tests.pages.sumo_pages import SumoPages
class TestEditMySettings(TestUtilities):
# C891396, C2108836
@pytest.mark.userSettings
def test_all_checkboxes_can_be_selected_and_saved(self):
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']
))
# C891396, C2108836
@pytest.mark.userSettings
def test_all_checkboxes_can_be_selected_and_saved(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Signing in with a non-admin account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts['TEST_ACCOUNT_12']
))
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!"
with check, allure.step("Checking all user settings and verifying that the correct "
"notification banner is displayed and all checkboxes are checked"):
sumo_pages.edit_profile_flow.check_all_user_settings()
assert sumo_pages.edit_my_profile_settings_page._settings_saved_notif_banner_txt(
) == EditSettingsPageMessages.MODIFIED_SETTINGS_NOTIFICATION_BANNER_MESSAGE
assert (
sumo_pages.edit_my_profile_settings_page._are_all_checkbox_checked()
), "Not all checkboxes are checked!"
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!"
with check, allure.step("Unchecking all the checkboxes and verifying that the correct "
"notification banner is displayed and all checkboxes are "
"unchecked"):
sumo_pages.edit_profile_flow.check_all_user_settings()
assert sumo_pages.edit_my_profile_settings_page._settings_saved_notif_banner_txt(
) == EditSettingsPageMessages.MODIFIED_SETTINGS_NOTIFICATION_BANNER_MESSAGE
assert not (
sumo_pages.edit_my_profile_settings_page._are_all_checkbox_checked()
), "Not all checkboxes are unchecked!"

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

@ -1,7 +1,7 @@
import allure
import pytest
from pytest_check import check
from playwright.sync_api import expect
from playwright.sync_api import expect, Page
from playwright_tests.core.testutilities import TestUtilities
from playwright_tests.messages.homepage_messages import HomepageMessages
@ -9,258 +9,263 @@ from playwright_tests.messages.my_profile_pages_messages.my_profile_page_message
MyProfileMessages)
from playwright_tests.messages.my_profile_pages_messages.user_profile_navbar_messages import (
UserProfileNavbarMessages)
from playwright_tests.pages.sumo_pages import SumoPages
class TestMyProfilePage(TestUtilities):
# C891409
@pytest.mark.userProfile
def test_my_profile_page_can_be_accessed_via_top_navbar(self):
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']
# C891409
@pytest.mark.userProfile
def test_my_profile_page_can_be_accessed_via_top_navbar(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Signing in with a non-admin user account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts['TEST_ACCOUNT_12']
))
original_username = sumo_pages.top_navbar._get_text_of_logged_in_username()
with allure.step("Accessing the 'My profile' page and verifying that we are redirected "
"to the correct profile"):
sumo_pages.top_navbar._click_on_view_profile_option()
expect(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 sumo_pages.my_profile_page._get_my_profile_page_header(
) == MyProfileMessages.STAGE_MY_PROFILE_PAGE_HEADER
with check, allure.step("Verifying that the 'My profile' navbar option is selected"):
assert 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(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Signing in with a non-admin account"):
sumo_pages.top_navbar._click_on_signin_signup_button()
sumo_pages.auth_flow_page.sign_in_flow(
username=test_utilities.user_special_chars,
account_password=test_utilities.user_secrets_pass
)
with allure.step("Accessing the my profile page, clicking on the sign out button and "
"verifying that the user is redirected to the homepage"):
sumo_pages.top_navbar._click_on_view_profile_option()
sumo_pages.my_profile_page._click_my_profile_page_sign_out_button()
expect(page).to_have_url(HomepageMessages.STAGE_HOMEPAGE_URL_EN_US)
with allure.step("Verify that the 'Sign in/Up' button from the page header is displayed"):
expect(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(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Signing in with an admin user account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
repliant_username = sumo_pages.top_navbar._get_text_of_logged_in_username()
with allure.step("Navigating to the Firefox AAQ form and posting a new AAQ question for "
"the Firefox product"):
test_utilities.navigate_to_link(
test_utilities.aaq_question_test_data["products_aaq_url"]["Firefox"]
)
question_info = (
sumo_pages.aaq_flow.submit_an_aaq_question(
subject=test_utilities.aaq_question_test_data["valid_firefox_question"]["subject"],
topic_name=test_utilities.
aaq_question_test_data["valid_firefox_question"]["topic_value"],
body=test_utilities.
aaq_question_test_data["valid_firefox_question"]["question_body"]
)
)
with allure.step("Navigating to the user profile page and extracting the original number "
"of posted question solutions"):
sumo_pages.top_navbar._click_on_view_profile_option()
original_number_of_solutions = test_utilities.number_extraction_from_string(
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"):
test_utilities.navigate_to_link(question_info["question_page_url"])
question_test_data = test_utilities.question_test_data
sumo_pages.question_page._add_text_to_post_a_reply_textarea(
question_test_data["question_reply_solution"]
)
answer_id = sumo_pages.question_page._click_on_post_reply_button(
repliant_username=repliant_username
)
with allure.step("Marking the reply as the question solution"):
sumo_pages.question_page._click_on_solves_the_problem_button(target_reply_id=answer_id)
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"):
sumo_pages.top_navbar._click_on_view_profile_option()
test_utilities.number_extraction_from_string(
sumo_pages.my_profile_page._get_my_profile_solutions_text()
)
assert (test_utilities.number_extraction_from_string(
sumo_pages.my_profile_page._get_my_profile_solutions_text(
)) == original_number_of_solutions + 1)
with allure.step("Deleting the posted question and verifying that we are redirected to "
"the product support forum page after deletion"):
test_utilities.navigate_to_link(question_info["question_page_url"])
sumo_pages.question_page._click_delete_this_question_question_tools_option()
sumo_pages.question_page._click_delete_this_question_button()
expect(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(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Signing in with an admin user"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
repliant_user = sumo_pages.top_navbar._get_text_of_logged_in_username()
with allure.step("Accessing the 'My profile' page and extracting the number of posted "
"answers"):
sumo_pages.top_navbar._click_on_view_profile_option()
original_number_of_answers = test_utilities.number_extraction_from_string(
sumo_pages.my_profile_page._get_my_profile_answers_text()
)
with allure.step("Navigating to the Firefox AAQ form and posting a new AAQ question"):
test_utilities.navigate_to_link(
test_utilities.aaq_question_test_data["products_aaq_url"]["Firefox"]
)
question_info = (
sumo_pages.aaq_flow.submit_an_aaq_question(
subject=test_utilities.aaq_question_test_data["valid_firefox_question"]["subject"],
topic_name=test_utilities.
aaq_question_test_data["valid_firefox_question"]["topic_value"],
body=test_utilities.
aaq_question_test_data["valid_firefox_question"]["question_body"]
)
)
with allure.step("Posting a reply for the question"):
question_test_data = test_utilities.question_test_data
reply_text = question_test_data["non_solution_reply"]
sumo_pages.question_page._add_text_to_post_a_reply_textarea(reply_text)
answer_id = sumo_pages.question_page._click_on_post_reply_button(
repliant_username=repliant_user
)
with allure.step("Accessing the 'My profile' page and verifying that the number of "
"answers has incremented successfully"):
sumo_pages.question_page._click_on_the_reply_author(answer_id)
test_utilities.number_extraction_from_string(
sumo_pages.my_profile_page._get_my_profile_answers_text()
)
assert (
test_utilities.number_extraction_from_string(
sumo_pages.my_profile_page._get_my_profile_answers_text()
) == original_number_of_answers + 1
)
with allure.step("Clicking on the my profile answers and verifying that the posted "
"answer is successfully displayed inside the list"):
sumo_pages.my_profile_page._click_my_profile_answers_link()
assert reply_text == 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"
with allure.step("Deleting the posted question and verifying that the user is redirected "
"to the product support forum page"):
test_utilities.navigate_to_link(question_info["question_page_url"])
sumo_pages.question_page._click_delete_this_question_question_tools_option()
sumo_pages.question_page._click_delete_this_question_button()
expect(
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(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Signing in with an admin account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Accessing the profile page and extracting the number of documents"):
sumo_pages.top_navbar._click_on_view_profile_option()
original_number_of_documents = test_utilities.number_extraction_from_string(
sumo_pages.my_profile_page._get_my_profile_documents_text()
)
with allure.step("Creating a kb article"):
article_details = sumo_pages.submit_kb_article_flow.submit_simple_kb_article()
with allure.step("Accessing the profile page and verifying that the number of posted "
"documents has incremented"):
sumo_pages.top_navbar._click_on_view_profile_option()
assert (
test_utilities.number_extraction_from_string(
sumo_pages.my_profile_page._get_my_profile_documents_text()
) == original_number_of_documents + 1
)
with allure.step("Clicking on my posted documents link and verifying that the posted "
"document is listed"):
sumo_pages.my_profile_page._click_on_my_profile_document_link()
assert (
article_details['article_title'] in sumo_pages.
my_documents_page._get_text_of_document_links()
)
with allure.step("Deleting the article"):
sumo_pages.my_documents_page._click_on_a_particular_document(
article_details['article_title']
)
sumo_pages.kb_article_deletion_flow.delete_kb_article()
# C1491023
@pytest.mark.userProfile
def test_accounts_with_symbols_are_getting_a_corresponding_valid_username(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Signing in with an account that contains SUMO-supported and "
"unsupported characters"):
sumo_pages.top_navbar._click_on_signin_signup_button()
username = test_utilities.username_extraction_from_email(
test_utilities.remove_character_from_string(
sumo_pages.auth_flow_page.sign_in_flow(
username=test_utilities.user_special_chars,
account_password=test_utilities.user_secrets_pass
),
"*",
))
original_username = 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 top navbar"):
assert sumo_pages.top_navbar._get_text_of_logged_in_username() == username
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))
with allure.step("Verifying that the username contains the supported characters and "
"doesn't contain the unsupported ones in My Profile page"):
sumo_pages.top_navbar._click_on_view_profile_option()
assert sumo_pages.my_profile_page._get_my_profile_display_name_header_text() == 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
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):
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
)
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)
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):
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()
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"]
)
)
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()
)
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
)
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)
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()
)
assert (self.number_extraction_from_string(
self.sumo_pages.my_profile_page._get_my_profile_solutions_text(
)) == original_number_of_solutions + 1
)
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):
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()
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()
)
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"]
)
)
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
)
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()
)
assert (
self.number_extraction_from_string(
self.sumo_pages.my_profile_page._get_my_profile_answers_text()
) == original_number_of_answers + 1
)
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"
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):
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("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()
)
with allure.step("Creating a kb article"):
article_details = self.sumo_pages.submit_kb_article_flow.submit_simple_kb_article()
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
)
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()
)
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):
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()
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
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)
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)
with allure.step("Verifying that the username contains the supported characters and "
"doesn't contain the unsupported ones in Edit my Profile page"):
sumo_pages.top_navbar._click_on_edit_profile_option()
assert sumo_pages.edit_my_profile_page._get_username_input_field_value() == username

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

@ -1,203 +1,207 @@
import allure
import pytest
from playwright.sync_api import expect
from playwright.sync_api import expect, Page
from playwright_tests.core.testutilities import TestUtilities
from playwright_tests.messages.my_profile_pages_messages.my_questions_page_messages import (
MyQuestionsPageMessages)
from playwright_tests.pages.sumo_pages import SumoPages
class TestMyQuestions(TestUtilities):
# C2094280, C890790
@pytest.mark.userQuestions
def test_number_of_questions_is_incremented_when_posting_a_question(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"]
))
# C2094280, C890790
@pytest.mark.userQuestions
def test_number_of_questions_is_incremented_when_posting_a_question(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Signing in with an admin account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
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()
with allure.step("Accessing the 'My profile' page and extracting the original number of "
"posted questions"):
sumo_pages.top_navbar._click_on_view_profile_option()
original_number_of_questions = test_utilities.number_extraction_from_string(
sumo_pages.my_profile_page._get_my_profile_questions_text()
)
with allure.step("Navigating to the AAQ form and posting a new AAQ question"):
test_utilities.navigate_to_link(
test_utilities.aaq_question_test_data["products_aaq_url"]["Firefox"]
)
question_info = (
sumo_pages.aaq_flow.submit_an_aaq_question(
subject=test_utilities.aaq_question_test_data["valid_firefox_question"]["subject"],
topic_name=test_utilities
.aaq_question_test_data["valid_firefox_question"]["topic_value"],
body=test_utilities.
aaq_question_test_data["valid_firefox_question"]["question_body"]
)
)
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"]
with allure.step("Navigating back to the profile page and verifying that the number of "
"questions has incremented"):
sumo_pages.top_navbar._click_on_view_profile_option()
new_number = test_utilities.number_extraction_from_string(
sumo_pages.my_profile_page._get_my_profile_questions_text()
)
assert new_number == original_number_of_questions + 1
with allure.step("Deleting the posted question"):
test_utilities.navigate_to_link(question_info["question_page_url"])
sumo_pages.question_page._click_delete_this_question_question_tools_option()
sumo_pages.question_page._click_delete_this_question_button()
with allure.step("Verifying that we are on the product support forum page after deletion"):
expect(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(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Signing in with a non-admin account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_12"]
))
with allure.step("Accessing the 'My profile' and extracting the number of questions "
"listed inside the my profile page"):
sumo_pages.top_navbar._click_on_view_profile_option()
number_of_questions = test_utilities.number_extraction_from_string(
sumo_pages.my_profile_page._get_my_profile_questions_text()
)
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"):
sumo_pages.my_profile_page._click_on_my_profile_questions_link()
assert number_of_questions == 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(page: Page):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Signing in with a user which has no posted questions"):
sumo_pages.top_navbar._click_on_signin_signup_button()
sumo_pages.auth_flow_page.sign_in_flow(
username=test_utilities.user_special_chars,
account_password=test_utilities.user_secrets_pass
)
original_user = sumo_pages.top_navbar._get_text_of_logged_in_username()
with allure.step("Accessing the 'My questions' page and verifying that the correct "
"message is displayed"):
sumo_pages.top_navbar._click_on_view_profile_option()
sumo_pages.user_navbar._click_on_my_questions_option()
assert (
sumo_pages.my_questions_page._get_text_of_no_question_message()
== MyQuestionsPageMessages.NO_POSTED_QUESTIONS_MESSAGE
)
with allure.step("Verifying that the question list is not displayed"):
expect(sumo_pages.my_questions_page._is_question_list_displayed()).to_be_hidden()
with allure.step("Navigating to the Firefox AAQ form and posting a new AAQ question for "
"the Firefox product"):
test_utilities.navigate_to_link(
test_utilities.aaq_question_test_data["products_aaq_url"]["Firefox"]
)
question_info = (
sumo_pages.aaq_flow.submit_an_aaq_question(
subject=test_utilities.aaq_question_test_data["valid_firefox_question"]["subject"],
topic_name=test_utilities
.aaq_question_test_data["valid_firefox_question"]["topic_value"],
body=test_utilities.
aaq_question_test_data["valid_firefox_question"]["question_body"]
)
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"]
)
)
with allure.step("Accessing the my questions page and verifying that the no question "
"message is no longer displayed"):
sumo_pages.top_navbar._click_on_view_profile_option()
sumo_pages.user_navbar._click_on_my_questions_option()
expect(sumo_pages.my_questions_page._is_no_question_message_displayed()).to_be_hidden()
with allure.step("Signing in with an admin account and deleting the posted question"):
sumo_pages.top_navbar._click_on_sign_out_button()
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
test_utilities.navigate_to_link(question_info["question_page_url"])
sumo_pages.question_page._click_delete_this_question_question_tools_option()
sumo_pages.question_page._click_delete_this_question_button()
with allure.step("Accessing the original user and verifying that the correct message is "
"displayed"):
test_utilities.navigate_to_link(
MyQuestionsPageMessages.get_stage_my_questions_url(original_user)
)
assert (
sumo_pages.my_questions_page._get_text_of_no_question_message()
== MyQuestionsPageMessages.get_no_posted_questions_other_user_message(original_user)
)
with allure.step("Signing in with the original user and verifying that the correct "
"message and the question list is no longer displayed"):
test_utilities.delete_cookies()
sumo_pages.top_navbar._click_on_signin_signup_button()
sumo_pages.auth_flow_page.login_with_existing_session()
sumo_pages.top_navbar._click_on_view_profile_option()
sumo_pages.user_navbar._click_on_my_questions_option()
assert (
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(
page: Page
):
test_utilities = TestUtilities(page)
sumo_pages = SumoPages(page)
with allure.step("Signing in with an admin account"):
test_utilities.start_existing_session(test_utilities.username_extraction_from_email(
test_utilities.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"]
))
with allure.step("Navigating to the Firefox AAQ form and posting a new AAQ question"):
test_utilities.navigate_to_link(
test_utilities.aaq_question_test_data["products_aaq_url"]["Firefox"]
)
question_info = (
sumo_pages.aaq_flow.submit_an_aaq_question(
subject=test_utilities.aaq_question_test_data["valid_firefox_question"]["subject"],
topic_name=test_utilities.
aaq_question_test_data["valid_firefox_question"]["topic_value"],
body=test_utilities.
aaq_question_test_data["valid_firefox_question"]["question_body"]
)
)
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
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"):
sumo_pages.top_navbar._click_on_my_questions_profile_option()
assert sumo_pages.my_questions_page._get_text_of_first_listed_question().replace(
" ", ""
) == question_info["aaq_subject"].replace(" ", "")
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()
with allure.step("Clicking on the first list item and verifying that the user is "
"redirected to the correct question"):
sumo_pages.my_questions_page._click_on_a_question_by_index(1)
expect(page).to_have_url(question_info["question_page_url"])
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()
# 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()}" )
# 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):
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"]
))
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()
)
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):
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()
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
)
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()
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"]
)
)
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()
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()
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)
)
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.login_with_existing_session()
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,
):
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 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"]
)
)
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(" ", "")
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()}" )
with allure.step("Deleting the posted question"):
self.sumo_pages.aaq_flow.deleting_question_flow()
with allure.step("Deleting the posted question"):
sumo_pages.aaq_flow.deleting_question_flow()

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

@ -1,4 +1,4 @@
# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand.
# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand.
[[package]]
name = "alabaster"
@ -3564,6 +3564,24 @@ pluggy = ">=0.12,<2.0"
[package.extras]
testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"]
[[package]]
name = "pytest-base-url"
version = "2.1.0"
description = "pytest plugin for URL based testing"
optional = false
python-versions = ">=3.8"
files = [
{file = "pytest_base_url-2.1.0-py3-none-any.whl", hash = "sha256:3ad15611778764d451927b2a53240c1a7a591b521ea44cebfe45849d2d2812e6"},
{file = "pytest_base_url-2.1.0.tar.gz", hash = "sha256:02748589a54f9e63fcbe62301d6b0496da0d10231b753e950c63e03aee745d45"},
]
[package.dependencies]
pytest = ">=7.0.0"
requests = ">=2.9"
[package.extras]
test = ["black (>=22.1.0)", "flake8 (>=4.0.1)", "pre-commit (>=2.17.0)", "pytest-localserver (>=0.7.1)", "tox (>=3.24.5)"]
[[package]]
name = "pytest-check"
version = "2.3.1"
@ -3611,6 +3629,23 @@ pytest = ">=7.0.0"
[package.extras]
test = ["black (>=22.1.0)", "flake8 (>=4.0.1)", "pre-commit (>=2.17.0)", "tox (>=3.24.5)"]
[[package]]
name = "pytest-playwright"
version = "0.5.1"
description = "A pytest wrapper with fixtures for Playwright to automate web browsers"
optional = false
python-versions = ">=3.8"
files = [
{file = "pytest-playwright-0.5.1.tar.gz", hash = "sha256:6b0683cbacd060f338b37d0c2cdac25d841e14f1440e986efcceaacd3d61a268"},
{file = "pytest_playwright-0.5.1-py3-none-any.whl", hash = "sha256:54eb12742de16bf50d9630fe06ac398727e52d5c1e55269acb37e1ede91d9e00"},
]
[package.dependencies]
playwright = ">=1.18"
pytest = ">=6.2.4,<9.0.0"
pytest-base-url = ">=1.0.0,<3.0.0"
python-slugify = ">=6.0.0,<9.0.0"
[[package]]
name = "pytest-rerunfailures"
version = "12.0"
@ -3682,6 +3717,23 @@ files = [
{file = "python_memcached-1.61-py2.py3-none-any.whl", hash = "sha256:6f95c056486e8398c55f47d0b701f499a41f0d7fb800cd29a40b2dfdc2f18d4d"},
]
[[package]]
name = "python-slugify"
version = "8.0.4"
description = "A Python slugify application that also handles Unicode"
optional = false
python-versions = ">=3.7"
files = [
{file = "python-slugify-8.0.4.tar.gz", hash = "sha256:59202371d1d05b54a9e7720c5e038f928f45daaffe41dd10822f3907b937c856"},
{file = "python_slugify-8.0.4-py2.py3-none-any.whl", hash = "sha256:276540b79961052b66b7d116620b36518847f52d5fd9e3a70164fc8c50faa6b8"},
]
[package.dependencies]
text-unidecode = ">=1.3"
[package.extras]
unidecode = ["Unidecode (>=1.1.1)"]
[[package]]
name = "pytoolconfig"
version = "1.3.1"
@ -3762,7 +3814,6 @@ files = [
{file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"},
{file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"},
{file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"},
{file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a08c6f0fe150303c1c6b71ebcd7213c2858041a7e01975da3a99aed1e7a378ef"},
{file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"},
{file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"},
{file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"},
@ -5228,4 +5279,4 @@ testing = ["coverage (>=5.0.3)", "zope.event", "zope.testing"]
[metadata]
lock-version = "2.0"
python-versions = "^3.11"
content-hash = "9d2afd2959397ceda4e3550c12d080fc84d2ba1384e3d18549911d009e007fd9"
content-hash = "713cdd154c0d7f0da0c33c93d1dafe8b566b261192bf2b934ce519aa04d99dc5"

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

@ -123,6 +123,7 @@ flake8 = "^7.0.0"
pytest-check = "^2.3.1"
allure-pytest = "^2.13.2"
playwright = "^1.45.0"
pytest-playwright = "^0.5.1"
[build-system]
requires = ["poetry-core>=1.0.0"]