-
Notifications
You must be signed in to change notification settings - Fork 740
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5859 from emilghittasv/expanding-playwright-kb-co…
…verage Expanding playwright coverage over KB
- Loading branch information
Showing
71 changed files
with
2,025 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 110 additions & 0 deletions
110
playwright_tests/flows/explore_help_articles_flows/article_flows/add_kb_article_flow.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
from playwright.sync_api import Page | ||
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.submit_kb_article_page import ( | ||
SubmitKBArticlePage) | ||
|
||
|
||
class AddKbArticleFlow(TestUtilities, SubmitKBArticlePage): | ||
|
||
def __init__(self, page: Page): | ||
super().__init__(page) | ||
|
||
def submit_simple_kb_article(self, | ||
article_title=None, | ||
article_slug=None, | ||
allow_discussion=True, | ||
selected_relevancy=True, | ||
selected_topics=True, | ||
search_summary=None, | ||
article_content=None, | ||
submit_article=True) -> dict[str, Any]: | ||
self._page.goto(KBArticlePageMessages.CREATE_NEW_KB_ARTICLE_STAGE_URL) | ||
|
||
kb_article_test_data = super().kb_article_test_data | ||
|
||
if article_title is None: | ||
kb_article_title = (kb_article_test_data["kb_article_title"] + self. | ||
generate_random_number(0, 1000)) | ||
|
||
else: | ||
kb_article_title = article_title | ||
|
||
if kb_article_title != "": | ||
super()._add_text_to_article_form_title_field( | ||
kb_article_title | ||
) | ||
|
||
if (article_slug is not None) and (article_slug != ""): | ||
kb_article_slug = article_slug | ||
super()._add_text_to_article_slug_field(kb_article_slug) | ||
|
||
super()._select_category_option_by_text(kb_article_test_data["category_options"]) | ||
|
||
if selected_relevancy is True: | ||
super()._click_on_a_relevant_to_option_checkbox( | ||
kb_article_test_data["relevant_to_option"] | ||
) | ||
|
||
# Adding Article topic | ||
if selected_topics is True: | ||
super()._click_on_a_particular_parent_topic( | ||
kb_article_test_data["selected_parent_topic"] | ||
) | ||
super()._click_on_a_particular_child_topic_checkbox( | ||
kb_article_test_data["selected_parent_topic"], | ||
kb_article_test_data["selected_child_topic"], | ||
) | ||
|
||
# Interacting with Allow Discussion checkbox | ||
if (allow_discussion is True) and (super( | ||
|
||
)._is_allow_discussion_on_article_checkbox_checked() is False): | ||
super()._check_allow_discussion_on_article_checkbox() | ||
elif (allow_discussion is False) and (super( | ||
|
||
)._is_allow_discussion_on_article_checkbox_checked() is True): | ||
super()._check_allow_discussion_on_article_checkbox() | ||
|
||
super()._add_text_to_related_documents_field(kb_article_test_data["related_documents"]) | ||
super()._add_text_to_keywords_field(kb_article_test_data["keywords"]) | ||
|
||
if search_summary is None: | ||
super()._add_text_to_search_result_summary_field( | ||
kb_article_test_data["search_result_summary"] | ||
) | ||
|
||
if not super()._is_content_textarea_displayed(): | ||
super()._click_on_toggle_syntax_highlight_option() | ||
|
||
if article_content is None: | ||
super()._add_text_to_content_textarea(kb_article_test_data["article_content"]) | ||
|
||
super()._add_text_to_expiry_date_field(kb_article_test_data["expiry_date"]) | ||
# We need to evaluate in order to fetch the slug field value | ||
slug = self._page.evaluate( | ||
'document.getElementById("id_slug").value' | ||
) | ||
|
||
if submit_article is True: | ||
# If title and slug are empty we are not reaching the description field. | ||
if ((article_title != '') and (article_slug != '') and ( | ||
search_summary is None) and (article_content is None)): | ||
super()._click_on_submit_for_review_button() | ||
super()._add_text_to_changes_description_field( | ||
kb_article_test_data["changes_description"] | ||
) | ||
super()._click_on_changes_submit_button() | ||
else: | ||
super()._click_on_submit_for_review_button() | ||
|
||
return {"article_title": kb_article_title, | ||
"article_content": kb_article_test_data["article_content"], | ||
"article_content_html": kb_article_test_data['article_content_html_rendered'], | ||
"article_slug": slug, | ||
"article_review_description": kb_article_test_data["changes_description"], | ||
"keyword": kb_article_test_data["keywords"], | ||
"search_results_summary": kb_article_test_data["search_result_summary"] | ||
} |
39 changes: 39 additions & 0 deletions
39
playwright_tests/flows/explore_help_articles_flows/article_flows/post_new_thread_flow.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
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) -> dict[str, Any]: | ||
thread_title = (super().kb_new_thread_test_data['new_thread_title'] + super() | ||
.generate_random_number(0, 1000)) | ||
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 | ||
} |
55 changes: 0 additions & 55 deletions
55
playwright_tests/flows/get_help_flows/article_flows/add_kb_article_flow.py
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions
15
playwright_tests/messages/explore_help_articles/kb_article_page_messages.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class KBArticlePageMessages: | ||
CREATE_NEW_KB_ARTICLE_STAGE_URL = "https://support.allizom.org/en-US/kb/new" | ||
KB_ARTICLE_PAGE_URL = "https://support.allizom.org/en-US/kb/" | ||
KB_ARTICLE_HISTORY_URL_ENDPOINT = "/history" | ||
KB_ARTICLE_DISCUSSIONS_ENDPOINT = "/discuss/" | ||
GET_COMMUNITY_SUPPORT_ARTICLE_LINK = ("https://support.allizom.org/en-US/kb/get-community" | ||
"-support?exit_aaq=1") | ||
UNREVIEWED_REVISION_STATUS = "Unreviewed" | ||
REVIEW_REVISION_STATUS = "Review" | ||
CURRENT_REVISION_STATUS = "Current" | ||
KB_ARTICLE_NOT_APPROVED_CONTENT = "This article doesn't have approved content yet." | ||
KB_ARTICLE_SUBMISSION_TITLE_ERRORS = ["Document with this Title and Locale already exists.", | ||
"Document with this Slug and Locale already exists."] | ||
KB_ARTICLE_RELEVANCY_ERROR = "Please select at least one product." | ||
KB_ARTICLE_TOPIC_ERROR = "Please select at least one topic." |
19 changes: 19 additions & 0 deletions
19
playwright_tests/messages/explore_help_articles/kb_article_revision_page_messages.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
class KBArticleRevision: | ||
KB_ARTICLE_REVISION_HEADER = "Review Revision of " | ||
UNREVIEWED_REVISION_HEADER = " Unreviewed Revision: " | ||
KB_ARTICLE_REVISION_NO_CURRENT_REV_TEXT = "This document does not have a current revision." | ||
KB_ARTICLE_REVISION_KEYWORD_HEADER = "Keywords:" | ||
|
||
def get_kb_article_revision_details(self, | ||
revision_id: str, | ||
username: str, | ||
revision_comment: str) -> str: | ||
return (f"Reviewing Revision {revision_id} by {username}. Back to HistoryRevision Comment:" | ||
f" {revision_comment}") | ||
|
||
def get_unreviewed_revision_details(self, | ||
revision_id: str, | ||
username: str, | ||
revision_comment: str) -> str: | ||
return (f"Revision {revision_id} by {username}. Revision Comment: {revision_comment}Review" | ||
f" Revision {revision_id}") |
18 changes: 18 additions & 0 deletions
18
playwright_tests/messages/explore_help_articles/products_page_messages.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
class ProductsPageMessages: | ||
PRODUCTS_PAGE_HEADER = "Products" | ||
PRODUCT_CARDS_SUBHEADING = { | ||
"Firefox": "Web browser for Windows, Mac and Linux", | ||
"Firefox for Android": "Web browser for Android smartphones and tablets", | ||
"Firefox for iOS": "Firefox for iPhone, iPad and iPod touch devices", | ||
"Mozilla VPN": "VPN for Windows 10, Mac, Linux, Android, and iOS devices", | ||
"Firefox Relay": "Service that lets you create email masks to hide your real email " | ||
"address", | ||
"Monitor": "Find out if your private information has been exposed in a known data breach.", | ||
"Pocket": "Discover and save stories for later.", | ||
"MDN Plus": "MDN Plus provides a custom user experience for MDN supporters.", | ||
"Hubs": "Collaborate and engage with each other through spatialized audio and with media " | ||
"from around the web.", | ||
"Firefox Focus": "Automatic privacy browser and content blocker", | ||
"Firefox for Enterprise": "Firefox Quantum for businesses", | ||
"Thunderbird": "Email software for Windows, Mac and Linux" | ||
} |
17 changes: 17 additions & 0 deletions
17
playwright_tests/messages/explore_help_articles/products_support_page_messages.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class ProductSupportPageMessages: | ||
PRODUCT_SUPPORT_PAGE_TITLE = " Support" | ||
PRODUCT_SUPPORT_PAGE_FREQUENT_TOPICS_TITLE = "Frequent Topics" | ||
PRODUCT_SUPPORT_PAGE_FREQUENT_TOPICS_SUBTITLE = "Explore the knowledge base." | ||
PRODUCT_SUPPORT_PAGE_FREQUENT_ARTICLES_TITLE = "Featured Articles" | ||
STILL_NEED_HELP_WIDGET_TITLE = "Still need help?" | ||
STILL_NEED_HELP_WIDGET_CONTENT_FREEMIUM = ("We’re here for you. Post a question to our " | ||
"support forums and get answers from our " | ||
"community of experts.") | ||
STILL_NEED_HELP_WIDGET_CONTENT_PREMIUM = ("We’re here for you! If you haven’t found a " | ||
"solution after exploring our help articles, " | ||
"you can get in touch with our support team.") | ||
STILL_NEED_HELP_WIDGET_BUTTON_TEXT_FREEMIUM = "Ask the Community" | ||
STILL_NEED_HELP_WIDGET_BUTTON_TEXT_PREMIUM = "Get Support" | ||
JOIN_OUR_COMMUNITY_SECTION_HEADER = "Join Our Community" | ||
JOIN_OUR_COMMUNITY_SECTION_CONTENT = ("Grow and share your expertise with others. Answer " | ||
"questions and improve our knowledge base.") |
File renamed without changes.
4 changes: 0 additions & 4 deletions
4
playwright_tests/messages/get_help_messages/kb_article/kb_article_page_messages.py
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.