Skip to content

Commit

Permalink
Merge pull request #5916 from emilghittasv/playwright-allure-reporting
Browse files Browse the repository at this point in the history
Switching playwright reporting from HTML to Allure.
  • Loading branch information
emilghittasv authored Mar 13, 2024
2 parents b53aed0 + 0e8a968 commit f566582
Show file tree
Hide file tree
Showing 44 changed files with 7,672 additions and 10,072 deletions.
57 changes: 30 additions & 27 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,132 +51,135 @@ jobs:
id: create-sessions
working-directory: playwright_tests
run: |
poetry run pytest -m loginSessions --browser ${{ env.BROWSER }} --reruns 1 --html=reports/creating_user_sessions.html --capture=tee-sys
poetry run pytest -m loginSessions --browser ${{ env.BROWSER }} --reruns 1
- name: Run Homepage tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m homePageTests --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_homepage_tests_report.html --capture=tee-sys
poetry run pytest -m homePageTests --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run Top-Navbar tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m topNavbarTests --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_top_navbar_tests_report.html --capture=tee-sys
poetry run pytest -m topNavbarTests --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run Footer tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m footerSectionTests --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_footer_tests_report.html --capture=tee-sys
poetry run pytest -m footerSectionTests --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run Contribute Pages tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m contributePagesTests --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_contribute_page_tests_report.html --capture=tee-sys
poetry run pytest -m contributePagesTests --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run Messaging System Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m messagingSystem --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_messaging_system_tests_report.html --capture=tee-sys
poetry run pytest -m messagingSystem --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run User Contribution Page Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m userContributionTests --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_user_contribution_tests.html --capture=tee-sys
poetry run pytest -m userContributionTests --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run User Page Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m userProfile --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_user_page_tests.html --capture=tee-sys
poetry run pytest -m userProfile --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run User Settings Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m userSettings --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_user_settings_page_tests.html --capture=tee-sys
poetry run pytest -m userSettings --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run User Profile Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m editUserProfileTests --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_user_profile_page_tests.html --capture=tee-sys
poetry run pytest -m editUserProfileTests --browser ${{ env.BROWSER }} --reruns 1
- name: Run User Questions Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m userQuestions --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_user_questions_page_tests.html --capture=tee-sys
poetry run pytest -m userQuestions --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run Contact Support Page Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m contactSupportPage --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_contact_support_page_tests.html --capture=tee-sys
poetry run pytest -m contactSupportPage --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run Product Solutions Page Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m productSolutionsPage --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_product_solutions_page_tests.html --capture=tee-sys
poetry run pytest -m productSolutionsPage --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run Product Topics Page Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m productTopicsPage --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_product_topics_page_tests.html --capture=tee-sys
poetry run pytest -m productTopicsPage --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run AAQ Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m aaqPage --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_aaq_tests.html --capture=tee-sys
poetry run pytest -m aaqPage --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run AAQ Questions Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m postedQuestions --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_aaq_questions_tests.html --capture=tee-sys
poetry run pytest -m postedQuestions --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name : Run KB Products Page Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m kbProductsPage --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_kb_products_page.html --capture=tee-sys
poetry run pytest -m kbProductsPage --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run KB Article Creation And Access Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m kbArticleCreationAndAccess --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_kb_article_creation_and_access.html --capture=tee-sys
poetry run pytest -m kbArticleCreationAndAccess --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run before kb thread tests setup (${{ env.BROWSER }})
id: kb-threads-setup
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m beforeThreadTests --numprocesses 1 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_before_thread_tests_setup.html --capture=tee-sys
poetry run pytest -m beforeThreadTests --numprocesses 1 --browser ${{ env.BROWSER }} --reruns 1
- name: Run KB article threads Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success' && steps.kb-threads-setup.outcome == 'success'
run: |
poetry run pytest -m articleThreads --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_kb_article_threads.html --capture=tee-sys
poetry run pytest -m articleThreads --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run KB article threads tear down (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success' && steps.kb-threads-setup.outcome == 'success'
run: |
poetry run pytest -m afterThreadTests --numprocesses 1 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_kb_article_threads_tear_down.html --capture=tee-sys
poetry run pytest -m afterThreadTests --numprocesses 1 --browser ${{ env.BROWSER }} --reruns 1
- name: Run KB article show history Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m kbArticleShowHistory --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_kb_article_show_history.html --capture=tee-sys
poetry run pytest -m kbArticleShowHistory --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run KB article revisions dashboard Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m recentRevisionsDashboard --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_kb_article_recent_revisions.html --capture=tee-sys
poetry run pytest -m recentRevisionsDashboard --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Run KB Dashboard Tests (${{ env.BROWSER }})
working-directory: playwright_tests
if: success() || failure() && steps.create-sessions.outcome == 'success'
run: |
poetry run pytest -m kbDashboard --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1 --html=reports/${{ env.BROWSER }}_kb_dashboard.html --capture=tee-sys
- name: Combine Reports
poetry run pytest -m kbDashboard --numprocesses 2 --browser ${{ env.BROWSER }} --reruns 1
- name: Generating Allure Report
working-directory: playwright_tests
if: success() || failure()
run: |
cat reports/*.html > reports/combined_report_${{ env.BROWSER }}.html
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH"
brew install allure
allure generate --single-file reports/allure_reports
- name: Upload the combined test report as artifact
if: success() || failure()
uses: actions/upload-artifact@v2
with:
name: Playwright test report
path: |
playwright_tests/reports/
playwright_tests/allure-report
26 changes: 13 additions & 13 deletions playwright_tests/flows/ask_a_question_flows/aaq_flows/aaq_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ def __init__(self, page: Page):

# Submitting an aaq question for a product flow.
# Mozilla VPN has an extra optional dropdown menu for choosing an operating system.
def submit_an_aaq_question_for_a_product(self,
subject: str,
topic_name: str,
body: str,
os="",
attach_image=False):
question_subject = self.add__valid_data_to_all_input_fields_without_submitting(
def submit_an_aaq_question(self,
subject: str,
topic_name: str,
body: str,
os="",
attach_image=False):
question_subject = self.add__valid_data_to_all_aaq_fields_without_submitting(
subject,
topic_name,
body,
Expand All @@ -38,12 +38,12 @@ def submit_an_aaq_question_for_a_product(self,

# Populating the aaq form fields with given values without submitting the form.
# Mozilla VPN has an extra optional dropdown menu for choosing an operating system.
def add__valid_data_to_all_input_fields_without_submitting(self,
subject: str,
topic_value: str,
body_text: str,
os='',
attach_image=False):
def add__valid_data_to_all_aaq_fields_without_submitting(self,
subject: str,
topic_value: str,
body_text: str,
os='',
attach_image=False):
aaq_subject = subject + super().generate_random_number(min_value=0, max_value=5000)
# Adding text to subject field.
super()._add_text_to_aaq_form_subject_field(aaq_subject)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def _click_on_question_details_button(self):
def _click_on_more_system_details_option(self):
super()._click(self.__more_system_details_option)

def _click_on_the_additional_system_panel_close_button(self):
def _click_on_the_additional_system_panel_close(self):
super()._click(self.__close_additional_system_details_button)

def _get_reply_section_locator(self, answer_id: str) -> Locator:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def _get_all_page_links(self) -> list[ElementHandle]:
def _get_way_to_contribute_header_text(self) -> str:
return super()._get_text_of_element(self.__way_to_contribute_header)

def _get_way_to_contribute_card_titles_text(self) -> list[str]:
def _get_way_to_contribute_cards(self) -> list[str]:
return super()._get_text_of_elements(self.__way_to_contribute_card_titles)

# About us
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ def _get_all_page_image_links(self) -> list[ElementHandle]:
def _get_how_to_contribute_header_text(self) -> str:
return super()._get_text_of_element(self.__how_to_contribute_header)

def _get_how_to_contribute_link_options_text(self) -> list[str]:
def _get_how_to_contribute_link_options(self) -> list[str]:
return super()._get_text_of_elements(self.__all_how_to_contribute_option_links)

def _get_how_to_contribute_option_four_text(self) -> str:
def _get_how_to_contribute_option_four(self) -> str:
return super()._get_text_of_element(self.__start_answering_how_to_contribute_option_text)

def _get_first_fact_text(self) -> str:
Expand All @@ -72,7 +72,7 @@ def _get_second_fact_text(self) -> str:
def _get_other_ways_to_contribute_header(self) -> str:
return super()._get_text_of_element(self.__other_ways_to_contribute_header)

def _get_other_ways_to_contribute_card_title(self) -> list[str]:
def _get_other_ways_to_contribute_cards(self) -> list[str]:
return super()._get_text_of_elements(self.__other_ways_to_contribute_card_titles)

def _get_other_ways_to_contribute_card_list(self) -> list[ElementHandle]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def _add_start_date(self, start_date: str):
def _add_end_date(self, end_date: str):
super()._type(self.__end_date_input_field, end_date, 0)

def _get_recent_revision_based_on_article_locator(self, title: str) -> Locator:
def _get_recent_revision_based_on_article(self, title: str) -> Locator:
xpath = f"//div[@id='revisions-fragment']//div[@class='title']//a[text()='{title}']"
return super()._get_element_locator(xpath)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def _click_on_sticky_this_thread_option(self):
def _get_thread_post_a_reply_textarea_field(self) -> Locator:
return super()._get_element_locator(self.__thread_post_a_reply_textarea_field)

def _fill_the_thread_post_a_reply_textarea_field(self, text: str):
def _fill_the_thread_post_a_reply_textarea(self, text: str):
super()._fill(self.__thread_post_a_reply_textarea_field, text)

def _get_thread_page_counter_replies_text(self) -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class KBArticlePage(BasePage):
__kb_article_content = "//section[@id='doc-content']"
__kb_article_content_approved_content = "//section[@id='doc-content']/p"
__kb_article_contributors = "//div[@class='document--contributors-list text-body-xs']/a"
__learn_more_kb_article_option = "//a[text()='Learn More']"

# Editing Tools options
__editing_tools_article_option = "//a[text()='Article']"
Expand Down Expand Up @@ -53,3 +54,6 @@ def _editing_tools_discussion_locator(self) -> Locator:

def _click_on_editing_tools_discussion_option(self):
super()._click(self.__editing_tools_discussion_option)

def _click_on_volunteer_learn_more_option(self):
super()._click(self.__learn_more_kb_article_option)
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ def __init__(self, page: Page):
def _click_on_messaging_system_navbar_inbox(self):
super()._click(self.__messaging_system_user_navbar_inbox_option)

def _click_on_messaging_system_navbar_sent_messages(self):
def _click_on_messaging_system_nav_sent_messages(self):
super()._click(self.__messaging_system_user_navbar_sent_messages_option)

def _click_on_messaging_system_navbar_new_message(self):
def _click_on_messaging_system_nav_new_message(self):
super()._click(self.__messaging_system_user_navbar_new_message_option)

# Need to add logic for fetching the background color of selected navbar elements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def _is_mobile_support_contributors_checkbox_checked(self) -> bool:
return super()._is_checkbox_checked(
self.__edit_contribution_areas_mobile_support_contributors)

def _are_all_cont_pref_checkboxes_checked(self) -> bool:
def _are_all_cont_pref_checked(self) -> bool:
is_checked = [
self._is_kb_contributors_checkbox_checked(),
self._is_l10n_contributors_checkbox_checked(),
Expand Down
Loading

0 comments on commit f566582

Please sign in to comment.