forked from mozilla/kitsune
-
Notifications
You must be signed in to change notification settings - Fork 1
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 mozilla#5911 from emilghittasv/playwright-kb-dashb…
…oard Expanding playwright coverage over KB Dashboard
- Loading branch information
Showing
25 changed files
with
993 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
playwright_tests/flows/explore_articles_flows/article_flows/delete_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,21 @@ | ||
from playwright_tests.core.testutilities import TestUtilities | ||
from playwright.sync_api import Page | ||
|
||
from playwright_tests.pages.explore_help_articles.articles.kb_article_page import KBArticlePage | ||
from playwright_tests.pages.explore_help_articles.articles.kb_article_show_history_page import \ | ||
KBArticleShowHistoryPage | ||
from playwright_tests.pages.top_navbar import TopNavbar | ||
|
||
|
||
class DeleteKbArticleFlow(TestUtilities, KBArticleShowHistoryPage, KBArticlePage, TopNavbar): | ||
|
||
def __init__(self, page: Page): | ||
super().__init__(page) | ||
|
||
def delete_kb_article(self): | ||
# If the delete button is not displayed we presume that we are not on the show history page | ||
# Clicking on the 'Show History' page. | ||
if not super()._is_delete_button_displayed(): | ||
super()._click_on_show_history_option() | ||
super()._click_on_delete_this_document_button() | ||
super()._click_on_confirmation_delete_button() |
35 changes: 35 additions & 0 deletions
35
playwright_tests/flows/explore_articles_flows/article_flows/edit_article_meta_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,35 @@ | ||
from playwright_tests.core.testutilities import TestUtilities | ||
from playwright.sync_api import Page | ||
|
||
from playwright_tests.pages.explore_help_articles.articles.kb_edit_article_meta import ( | ||
KBArticleEditMetadata) | ||
|
||
|
||
class EditArticleMetaFlow(TestUtilities, KBArticleEditMetadata): | ||
|
||
def __init__(self, page: Page): | ||
super().__init__(page) | ||
|
||
def edit_article_metadata(self, title=None, needs_change=False, needs_change_comment=False): | ||
if title is not None: | ||
super()._add_text_to_title_field(title) | ||
|
||
# If it needs change we are going to ensure that the needs change checkbox is checked. | ||
if needs_change: | ||
if not super()._is_needs_change_checkbox(): | ||
super()._click_needs_change_checkbox() | ||
# If it needs change with comment we are also adding the comment. | ||
if needs_change_comment: | ||
super()._fill_needs_change_textarea( | ||
super().kb_revision_test_data['needs_change_message'] | ||
) | ||
# If it doesn't need comment we are ensuring that the textarea field is empty. | ||
else: | ||
super()._fill_needs_change_textarea('') | ||
|
||
# If it doesn't need change we are ensuring that the checkbox is not checked. | ||
else: | ||
if super()._is_needs_change_checkbox(): | ||
super()._click_needs_change_checkbox() | ||
|
||
super()._click_on_save_changes_button() |
File renamed without changes.
7 changes: 7 additions & 0 deletions
7
playwright_tests/messages/contribute_messages/con_tools/kb_dashboard_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,7 @@ | ||
class KBDashboardPageMessages: | ||
KB_LIVE_STATUS = "Live" | ||
GENERAL_NEGATIVE_STATUS = "No" | ||
GENERAL_POSITIVE_STATUS = "Yes" | ||
|
||
def get_kb_not_live_status(self, revision_note: str) -> str: | ||
return f"Review Needed: {revision_note}" |
71 changes: 71 additions & 0 deletions
71
playwright_tests/pages/contribute/contributor_tools_pages/kb_dashboard_page.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,71 @@ | ||
from playwright_tests.core.basepage import BasePage | ||
from playwright.sync_api import Page, Locator | ||
|
||
|
||
class KBDashboard(BasePage): | ||
# Top-level filter locators | ||
__products_filter_button = ("//article[@id='localize']/div[@class='mzp-c-menu-list " | ||
"featured-dropdown is-details']//button") | ||
__products_filter_complete_overview = "//div[@id='product-selector']/select" | ||
__filter_by_type = "//div[@class='table-filters']//select" | ||
__filter_by_type_complete_overview = "//select[@name='category']" | ||
__subscribe_button = "//div[@id='doc-watch']/button" | ||
__complete_overview_link = "//div[@class='table-footer']/a" | ||
|
||
def __init__(self, page: Page): | ||
super().__init__(page) | ||
|
||
# KB Dashboard actions | ||
def _get_a_particular_article_title_locator(self, article_name: str) -> Locator: | ||
xpath = f"//td/a[text()='{article_name}']" | ||
return super()._get_element_locator(xpath) | ||
|
||
def _click_on_article_title(self, article_name: str): | ||
xpath = f"//td/a[text()='{article_name}']" | ||
super()._click(xpath) | ||
|
||
def _get_a_particular_article_status(self, article_name: str) -> str: | ||
xpath = (f"//td/a[text()='{article_name}']/../following-sibling::td[contains(@class," | ||
f"'status ')]") | ||
return super()._get_text_of_element(xpath) | ||
|
||
def _get_needs_update_status(self, article_name: str) -> str: | ||
xpath = (f"//td/a[text()='{article_name}']/../following-sibling::td[contains(@class," | ||
f"'needs-update')]") | ||
return super()._get_text_of_element(xpath) | ||
|
||
def _is_needs_change_empty(self, article_name: str) -> bool: | ||
xpath = (f"//td/a[text()='{article_name}']/../following-sibling::td[contains(@class," | ||
f"'needs-update')]") | ||
return super()._is_element_empty(xpath) | ||
|
||
def _get_ready_for_l10n_status(self, article_name: str) -> str: | ||
xpath = (f"//td/a[text()='{article_name}']/../following-sibling::td[contains(@class," | ||
f"'ready-for-l10n')]") | ||
return super()._get_text_of_element(xpath) | ||
|
||
def _get_stale_status(self, article_name: str) -> str: | ||
xpath = (f"//td/a[text()='{article_name}']/../following-sibling::td[contains(@class," | ||
f"'stale ')]") | ||
return super()._get_text_of_element(xpath) | ||
|
||
def _is_stale_status_empty(self, article_name: str) -> bool: | ||
xpath = (f"//td/a[text()='{article_name}']/../following-sibling::td[contains(@class," | ||
f"'stale ')]") | ||
return super()._is_element_empty(xpath) | ||
|
||
def _get_existing_expiry_date(self, article_name: str) -> str: | ||
xpath = f"//td/a[text()='{article_name}']/../following-sibling::td/time" | ||
return super()._get_text_of_element(xpath) | ||
|
||
def _get_expiry_date_locator(self, article_name: str) -> Locator: | ||
xpath = f"//td/a[text()='{article_name}']/../following-sibling::td/time" | ||
return super()._get_element_locator(xpath) | ||
|
||
def _click_on_show_translations_option(self, article_name: str): | ||
xpath = (f"//td/a[text()='{article_name}']/../following-sibling::td/a[contains(text()," | ||
f"'Show translations')]") | ||
super()._click(xpath) | ||
|
||
def _click_on_the_complete_overview_link(self): | ||
super()._click(self.__complete_overview_link) |
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
Oops, something went wrong.