diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml new file mode 100644 index 00000000000..566aeb6efa8 --- /dev/null +++ b/.github/workflows/playwright.yml @@ -0,0 +1,155 @@ +name: Playwright Tests +on: + schedule: + - cron: '0 5 * * 1,3,5' + +jobs: + playwright: + name: 'Playwright Tests' + runs-on: ubuntu-latest + env: + TEST_ACCOUNT_12: ${{secrets.AUTOMATION_TEST_ACCOUNT_12}} + TEST_ACCOUNT_13: ${{secrets.AUTOMATION_TEST_ACCOUNT_13}} + TEST_ACCOUNT_MESSAGE_1: ${{secrets.AUTOMATION_TEST_ACCOUNT_MESSAGE_1}} + TEST_ACCOUNT_MESSAGE_2: ${{secrets.AUTOMATION_TEST_ACCOUNT_MESSAGE_2}} + TEST_ACCOUNT_MESSAGE_3: ${{secrets.AUTOMATION_TEST_ACCOUNT_MESSAGE_3}} + TEST_ACCOUNT_MESSAGE_4: ${{secrets.AUTOMATION_TEST_ACCOUNT_MESSAGE_4}} + TEST_ACCOUNT_MESSAGE_5: ${{secrets.AUTOMATION_TEST_ACCOUNT_MESSAGE_5}} + TEST_ACCOUNT_MESSAGE_6: ${{secrets.AUTOMATION_TEST_ACCOUNT_MESSAGE_6}} + TEST_ACCOUNT_SPECIAL_CHARS: ${{secrets.AUTOMATION_TEST_ACCOUNT_SPECIAL_CHARS}} + TEST_ACCOUNTS_PS: ${{secrets.AUTOMATION_ACCOUNTS_PASSWORD}} + TEST_ACCOUNT_MODERATOR: ${{secrets.AUTOMATION_MODERATOR_ACCOUNT}} + + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + - name: Install dependencies + if: success() || failure() + run: | + sudo apt-get update + pip3 install --user poetry + poetry install + - name: Ensure Playwright browsers are installed + run: | + pip3 install playwright + python -m playwright install + - name: Creating User Sessions + id: create-sessions + working-directory: playwright_tests + run: | + poetry run pytest -m loginSessions --browser firefox --html=reports/creating_user_sessions.html --capture=tee-sys + - name: Run Homepage tests (Firefox) + working-directory: playwright_tests + if: success() || failure() && steps.create-sessions.outcome == 'success' + run: | + poetry run pytest -m homePageTests --numprocesses 2 --browser firefox --html=reports/firefox_homepage_tests_report.html --capture=tee-sys + - name: Run Homepage tests (Chrome) + working-directory: playwright_tests + if: success() || failure() && steps.create-sessions.outcome == 'success' + run: | + poetry run pytest -m homePageTests --numprocesses 2 --browser chrome --html=reports/chrome_homepage_tests_report.html --capture=tee-sys + - name: Run Top-Navbar tests (Firefox) + working-directory: playwright_tests + if: success() || failure() && steps.create-sessions.outcome == 'success' + run: | + poetry run pytest -m topNavbarTests --numprocesses 2 --browser firefox --html=reports/firefox_top_navbar_tests_report.html --capture=tee-sys + - name: Run Top-Navbar tests (Chrome) + working-directory: playwright_tests + if: success() || failure() && steps.create-sessions.outcome == 'success' + run: | + poetry run pytest -m topNavbarTests --numprocesses 2 --browser chrome --html=reports/chrome_top_navbar_tests_report.html --capture=tee-sys + - name: Run Footer tests (Firefox) + working-directory: playwright_tests + if: success() || failure() && steps.create-sessions.outcome == 'success' + run: | + poetry run pytest -m footerSectionTests --numprocesses 2 --browser firefox --html=reports/firefox_footer_tests_report.html --capture=tee-sys + - name: Run Footer tests (Chrome) + working-directory: playwright_tests + if: success() || failure() && steps.create-sessions.outcome == 'success' + run: | + poetry run pytest -m footerSectionTests --numprocesses 2 --browser chrome --html=reports/chrome_footer_tests_report.html --capture=tee-sys + - name: Run Contribute Pages tests (Firefox) + working-directory: playwright_tests + if: success() || failure() && steps.create-sessions.outcome == 'success' + run: | + poetry run pytest -m contributePagesTests --numprocesses 2 --browser firefox --html=reports/firefox_contribute_page_tests_report.html --capture=tee-sys + - name: Run Contribute Page tests (Chrome) + working-directory: playwright_tests + if: success() || failure() && steps.create-sessions.outcome == 'success' + run: | + poetry run pytest -m contributePagesTests --numprocesses 2 --browser chrome --html=reports/chrome_contribute_page_tests_report.html --capture=tee-sys + - name: Run Messaging System Tests (Firefox) + working-directory: playwright_tests + if: success() || failure() && steps.create-sessions.outcome == 'success' + run: | + poetry run pytest -m messagingSystem --numprocesses 2 --browser firefox --html=reports/firefox_messaging_system_tests_report.html --capture=tee-sys + - name: Run Messaging System Tests (Chrome) + working-directory: playwright_tests + if: success() || failure() && steps.create-sessions.outcome == 'success' + run: | + poetry run pytest -m messagingSystem --numprocesses 2 --browser chrome --html=reports/chrome_messaging_system_tests_report.html --capture=tee-sys + - name: Run User Contribution Page Tests (Firefox) + working-directory: playwright_tests + if: success() || failure() && steps.create-sessions.outcome == 'success' + run: | + poetry run pytest -m userContributionTests --numprocesses 2 --browser firefox --html=reports/firefox_user_contribution_tests.html --capture=tee-sys + - name: Run User Contribution Page Tests (Chrome) + working-directory: playwright_tests + if: success() || failure() && steps.create-sessions.outcome == 'success' + run: | + poetry run pytest -m userContributionTests --numprocesses 2 --browser chrome --html=reports/chrome_user_contribution_tests.html --capture=tee-sys + - name: Run User Page Tests (Firefox) + working-directory: playwright_tests + if: success() || failure() && steps.create-sessions.outcome == 'success' + run: | + poetry run pytest -m userProfile --numprocesses 2 --browser firefox --html=reports/firefox_user_page_tests.html --capture=tee-sys + - name: Run User Page Tests (Chrome) + working-directory: playwright_tests + if: success() || failure() && steps.create-sessions.outcome == 'success' + run: | + poetry run pytest -m userProfile --numprocesses 2 --browser chrome --html=reports/chrome_user_page_tests.html --capture=tee-sys + - name: Run User Settings Tests (Firefox) + working-directory: playwright_tests + if: success() || failure() && steps.create-sessions.outcome == 'success' + run: | + poetry run pytest -m userSettings --numprocesses 2 --browser firefox --html=reports/firefox_user_settings_page_tests.html --capture=tee-sys + - name: Run User Settings Tests (Chrome) + working-directory: playwright_tests + if: success() || failure() && steps.create-sessions.outcome == 'success' + run: | + poetry run pytest -m userSettings --numprocesses 2 --browser chrome --html=reports/chrome_user_settings_page_tests.html --capture=tee-sys + - name: Run User Profile Tests (Firefox) + working-directory: playwright_tests + if: success() || failure() && steps.create-sessions.outcome == 'success' + run: | + poetry run pytest -m editUserProfileTests --browser firefox --html=reports/firefox_user_profile_page_tests.html --capture=tee-sys + - name: Run Edit User Profile Tests (Chrome) + working-directory: playwright_tests + if: success() || failure() && steps.create-sessions.outcome == 'success' + run: | + poetry run pytest -m editUserProfileTests --browser chrome --html=reports/chrome_user_profile_page_tests.html --capture=tee-sys + - name: Run User Questions Tests (Firefox) + working-directory: playwright_tests + if: success() || failure() && steps.create-sessions.outcome == 'success' + run: | + poetry run pytest -m userQuestions --numprocesses 2 --browser firefox --html=reports/firefox_user_questions_page_tests.html --capture=tee-sys + - name: Run User Questions Tests (Chrome) + working-directory: playwright_tests + if: success() || failure() && steps.create-sessions.outcome == 'success' + run: | + poetry run pytest -m userQuestions --numprocesses 2 --browser chrome --html=reports/chrome_user_questions_page_tests.html --capture=tee-sys + - name: Combine Reports + working-directory: playwright_tests + if: success() || failure() + run: | + cat reports/*.html > reports/combined_report.html + - 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/ diff --git a/.github/workflows/selenium.yml b/.github/workflows/selenium.yml deleted file mode 100644 index 0c1af9f979d..00000000000 --- a/.github/workflows/selenium.yml +++ /dev/null @@ -1,202 +0,0 @@ -name: Selenium Tests - -on: - schedule: - - cron: '0 5 * * 1,3,5' - - -jobs: - test: - runs-on: ubuntu-latest - env: - TEST_ACCOUNT_12: ${{secrets.AUTOMATION_TEST_ACCOUNT_12}} - TEST_ACCOUNT_13: ${{secrets.AUTOMATION_TEST_ACCOUNT_13}} - TEST_ACCOUNT_MESSAGE_1: ${{secrets.AUTOMATION_TEST_ACCOUNT_MESSAGE_1}} - TEST_ACCOUNT_MESSAGE_2: ${{secrets.AUTOMATION_TEST_ACCOUNT_MESSAGE_2}} - TEST_ACCOUNT_MESSAGE_3: ${{secrets.AUTOMATION_TEST_ACCOUNT_MESSAGE_3}} - TEST_ACCOUNT_MESSAGE_4: ${{secrets.AUTOMATION_TEST_ACCOUNT_MESSAGE_4}} - TEST_ACCOUNT_MESSAGE_5: ${{secrets.AUTOMATION_TEST_ACCOUNT_MESSAGE_5}} - TEST_ACCOUNT_MESSAGE_6: ${{secrets.AUTOMATION_TEST_ACCOUNT_MESSAGE_6}} - TEST_ACCOUNT_SPECIAL_CHARS: ${{secrets.AUTOMATION_TEST_ACCOUNT_SPECIAL_CHARS}} - TEST_ACCOUNTS_PS: ${{secrets.AUTOMATION_ACCOUNTS_PASSWORD}} - TEST_ACCOUNT_MODERATOR: ${{secrets.AUTOMATION_MODERATOR_ACCOUNT}} - steps: - - uses: actions/checkout@v3 - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: 3.11 - - name: Install dependencies - run: | - sudo apt-get update - pip3 install --user poetry - poetry install - - name: Start Selenoid container - working-directory: selenium_tests/docker/ - run: | - docker pull selenoid/firefox:latest - docker pull selenoid/chrome:latest - docker-compose build - docker-compose up -d - - name: Run Homepage tests (Firefox) - working-directory: selenium_tests/ - if: success() || failure() - run: | - poetry run pytest -m homePageTests -n 2 --reruns 2 --browser firefox --html=reports/firefox_homepage_tests_report.html --capture=tee-sys - - name: Run Homepage tests (Chrome) - working-directory: selenium_tests/ - if: success() || failure() - run: | - poetry run pytest -m homePageTests -n 2 --reruns 2 --browser chrome --html=reports/chrome_homepage_tests_report.html --capture=tee-sys - - name: Restart Selenoid container - working-directory: selenium_tests/docker/ - if: success() || failure() - run: | - docker compose restart - - name: Run Top-Navbar tests (Firefox) - working-directory: selenium_tests/ - if: success() || failure() - run: | - poetry run pytest -m topNavbarTests -n 2 --reruns 2 --browser firefox --html=reports/firefox_top_navbar_tests_report.html --capture=tee-sys - - name: Run Top-Navbar tests (Chrome) - working-directory: selenium_tests/ - if: success() || failure() - run: | - poetry run pytest -m topNavbarTests -n 2 --reruns 2 --browser chrome --html=reports/chrome_top_navbar_tests_report.html --capture=tee-sys - - name: Restart Selenoid container - working-directory: selenium_tests/docker/ - if: success() || failure() - run: | - docker compose restart - - name: Run Footer tests (Firefox) - working-directory: selenium_tests/ - if: success() || failure() - run: | - poetry run pytest -m footerSectionTests -n 2 --reruns 2 --browser firefox --html=reports/firefox_footer_tests_report.html --capture=tee-sys - - name: Run Footer tests (Chrome) - working-directory: selenium_tests/ - if: success() || failure() - run: | - poetry run pytest -m footerSectionTests -n 2 --reruns 2 --browser chrome --html=reports/chrome_footer_tests_report.html --capture=tee-sys - - name: Restart Selenoid container - working-directory: selenium_tests/docker/ - if: success() || failure() - run: | - docker compose restart - - name: Run Contribute Pages tests (Firefox) - working-directory: selenium_tests/ - if: success() || failure() - run: | - poetry run pytest -m contributePagesTests -n 2 --reruns 2 --browser firefox --html=reports/firefox_contribute_page_tests_report.html --capture=tee-sys - - name: Run Contribute Page tests (Chrome) - working-directory: selenium_tests/ - if: success() || failure() - run: | - poetry run pytest -m contributePagesTests -n 2 --reruns 2 --browser chrome --html=reports/chrome_contribute_page_tests_report.html --capture=tee-sys - - name: Restart Selenoid container - working-directory: selenium_tests/docker/ - if: success() || failure() - run: | - docker compose restart - - name: Run Messaging System Tests (Firefox) - working-directory: selenium_tests/ - if: success() || failure() - run: | - poetry run pytest -m messagingSystem -n 2 --reruns 2 --browser firefox --html=reports/firefox_messaging_system_tests_report.html --capture=tee-sys - - name: Run Messaging System Tests (Chrome) - working-directory: selenium_tests/ - if: success() || failure() - run: | - poetry run pytest -m messagingSystem -n 2 --reruns 2 --browser chrome --html=reports/chrome_messaging_system_tests_report.html --capture=tee-sys - - name: Restart Selenoid container - working-directory: selenium_tests/docker/ - if: success() || failure() - run: | - docker compose restart - - name: Run User Contribution Page Tests (Firefox) - working-directory: selenium_tests/ - if: success() || failure() - run: | - poetry run pytest -m userContributionTests -n 2 --reruns 2 --browser firefox --html=reports/firefox_user_contribution_tests.html --capture=tee-sys - - name: Run User Contribution Page Tests (Chrome) - working-directory: selenium_tests/ - if: success() || failure() - run: | - poetry run pytest -m userContributionTests -n 2 --reruns 2 --browser chrome --html=reports/chrome_user_contribution_tests.html --capture=tee-sys - - name: Restart Selenoid container - working-directory: selenium_tests/docker/ - if: success() || failure() - run: | - docker compose restart - - name: Run User Page Tests (Firefox) - working-directory: selenium_tests/ - if: success() || failure() - run: | - poetry run pytest -m userPageTests -n 2 --reruns 2 --browser firefox --html=reports/firefox_user_page_tests.html --capture=tee-sys - - name: Run User Page Tests (Chrome) - working-directory: selenium_tests/ - if: success() || failure() - run: | - poetry run pytest -m userPageTests -n 2 --reruns 2 --browser chrome --html=reports/chrome_user_page_tests.html --capture=tee-sys - - name: Restart Selenoid container - working-directory: selenium_tests/docker/ - if: success() || failure() - run: | - docker compose restart - - name: Run User Settings Tests (Firefox) - working-directory: selenium_tests/ - if: success() || failure() - run: | - poetry run pytest -m userSettings -n 2 --reruns 2 --browser firefox --html=reports/firefox_user_settings_page_tests.html --capture=tee-sys - - name: Run User Settings Tests (Chrome) - working-directory: selenium_tests/ - if: success() || failure() - run: | - poetry run pytest -m userSettings -n 2 --reruns 2 --browser chrome --html=reports/chrome_user_settings_page_tests.html --capture=tee-sys - - name: Restart Selenoid container - working-directory: selenium_tests/docker/ - if: success() || failure() - run: | - docker compose restart - - name: Run User Profile Tests (Firefox) - working-directory: selenium_tests/ - if: success() || failure() - run: | - poetry run pytest -m userProfile -n 2 --reruns 2 --browser firefox --html=reports/firefox_user_profile_page_tests.html --capture=tee-sys - - name: Run User Profile Tests (Chrome) - working-directory: selenium_tests/ - if: success() || failure() - run: | - poetry run pytest -m userProfile -n 2 --reruns 2 --browser chrome --html=reports/chrome_user_profile_page_tests.html --capture=tee-sys - - name: Restart Selenoid container - working-directory: selenium_tests/docker/ - if: success() || failure() - run: | - docker compose restart - - name: Run User Questions Tests (Firefox) - working-directory: selenium_tests/ - if: success() || failure() - run: | - poetry run pytest -m userQuestions -n 2 --reruns 2 --browser firefox --html=reports/firefox_user_questions_page_tests.html --capture=tee-sys - - name: Run User Questions Tests (Chrome) - working-directory: selenium_tests/ - if: success() || failure() - run: | - poetry run pytest -m userQuestions -n 2 --reruns 2 --browser chrome --html=reports/chrome_user_questions_page_tests.html --capture=tee-sys - - name: Stop Selenoid containers - if: success() || failure() - working-directory: selenium_tests/docker/ - run: | - docker-compose down - - name: Combine Reports - working-directory: selenium_tests/ - if: success() || failure() - run: | - cat reports/*.html > reports/combined_report.html - - name: Upload the combined test report as artifact - if: success() || failure() - uses: actions/upload-artifact@v2 - with: - name: Selenium test report - path: | - selenium_tests/reports/ diff --git a/playwright_tests/core/basepage.py b/playwright_tests/core/basepage.py new file mode 100644 index 00000000000..cf84996e87e --- /dev/null +++ b/playwright_tests/core/basepage.py @@ -0,0 +1,90 @@ +from playwright.sync_api import Page, ElementHandle, Locator, TimeoutError + + +class BasePage: + + def __init__(self, page: Page): + self._page = page + + def _get_element_locator(self, xpath: str) -> Locator: + self.__wait_for_dom_load_to_finnish() + return self._page.locator(xpath) + + def _get_element_locator_no_wait(self, xpath: str) -> Locator: + return self._page.locator(xpath) + + def _get_element_handles(self, xpath: str) -> list[ElementHandle]: + return self._get_element_locator(xpath).element_handles() + + def _get_element_handle(self, xpath: str) -> ElementHandle: + return self._get_element_locator(xpath).element_handle() + + def _get_text_of_elements(self, xpath: str) -> list[str]: + return self._get_element_locator(xpath).all_inner_texts() + + def _get_text_of_element(self, xpath: str) -> str: + return self._get_element_locator(xpath).inner_text() + + def _get_elements_count(self, xpath: str) -> int: + return self._get_element_locator(xpath).count() + + def _get_element_attribute_value(self, xpath: str, attribute: str) -> str: + return self._get_element_locator(xpath).get_attribute(attribute) + + def _get_element_inner_text_from_page(self, xpath: str) -> str: + return self._page.inner_text(xpath) + + def _get_element_input_value(self, xpath: str) -> str: + return self._get_element_locator(xpath).input_value() + + def _click(self, xpath: str): + self._get_element_locator(xpath).click() + + def _click_without_wait(self, xpath: str): + self._get_element_locator_no_wait(xpath).click() + + def _fill(self, xpath: str, text: str): + self._get_element_locator(xpath).fill(text) + + def _type(self, xpath: str, text: str, delay: int): + self._get_element_locator(xpath).type(text=text, delay=delay) + + def _press_a_key(self, xpath: str, key: str): + self._get_element_locator(xpath).press(key) + + def _clear_field(self, xpath: str): + self._get_element_locator(xpath).clear() + + def _click_on_an_element_by_index(self, xpath: str, index: int): + self._get_element_locator(xpath).nth(index).click() + + def _click_on_first_item(self, xpath: str): + self._get_element_locator(xpath).first.click() + + def _select_option_by_label(self, xpath: str, label_name: str): + self._get_element_locator(xpath).select_option(label=label_name) + + def _select_option_by_value(self, xpath: str, value: str): + self._get_element_locator(xpath).select_option(value=value) + + def _accept_dialog(self): + self._page.on("dialog", lambda dialog: dialog.accept()) + + def _hover_over_element(self, xpath: str): + self._get_element_locator(xpath).hover() + + def _is_element_visible(self, xpath: str) -> bool: + return self._get_element_locator(xpath).is_visible() + + def _is_checkbox_checked(self, xpath: str) -> bool: + return self._get_element_locator(xpath).is_checked() + + def __wait_for_dom_load_to_finnish(self): + self._page.wait_for_load_state("domcontentloaded") + self._page.wait_for_load_state("load") + + def _wait_for_selector(self, xpath: str): + try: + self._page.wait_for_selector(xpath, timeout=3500) + except TimeoutError: + print("Use a different account button is not displayed") diff --git a/selenium_tests/reports/logs/.gitkeep b/playwright_tests/core/sessions/.auth/.gitkeep similarity index 100% rename from selenium_tests/reports/logs/.gitkeep rename to playwright_tests/core/sessions/.auth/.gitkeep diff --git a/selenium_tests/core/test_utilities.py b/playwright_tests/core/testutilities.py similarity index 58% rename from selenium_tests/core/test_utilities.py rename to playwright_tests/core/testutilities.py index d2a54ff9461..aff3c52dbcf 100644 --- a/selenium_tests/core/test_utilities.py +++ b/playwright_tests/core/testutilities.py @@ -1,13 +1,14 @@ -import random import logging -import pytest import inspect -import re import requests +import pytest import time +import re import json +import random import os +from playwright_tests.messages.homepage_messages import HomepageMessages from requests.exceptions import HTTPError @@ -33,7 +34,7 @@ class TestUtilities: user_message_test_data = json.load(user_message_test_data_file) user_message_test_data_file.close() - user_secrets_data = { + user_secrets_accounts = { "TEST_ACCOUNT_12": os.environ.get("TEST_ACCOUNT_12"), "TEST_ACCOUNT_13": os.environ.get("TEST_ACCOUNT_13"), "TEST_ACCOUNT_MESSAGE_1": os.environ.get("TEST_ACCOUNT_MESSAGE_1"), @@ -42,69 +43,109 @@ class TestUtilities: "TEST_ACCOUNT_MESSAGE_4": os.environ.get("TEST_ACCOUNT_MESSAGE_4"), "TEST_ACCOUNT_MESSAGE_5": os.environ.get("TEST_ACCOUNT_MESSAGE_5"), "TEST_ACCOUNT_MESSAGE_6": os.environ.get("TEST_ACCOUNT_MESSAGE_6"), - "TEST_ACCOUNT_SPECIAL_CHARS": os.environ.get("TEST_ACCOUNT_SPECIAL_CHARS"), - "TEST_ACCOUNTS_PS": os.environ.get("TEST_ACCOUNTS_PS"), - "TEST_ACCOUNT_MODERATOR": os.environ.get("TEST_ACCOUNT_MODERATOR"), + "TEST_ACCOUNT_MODERATOR": os.environ.get("TEST_ACCOUNT_MODERATOR") } + user_special_chars = os.environ.get("TEST_ACCOUNT_SPECIAL_CHARS") + user_secrets_pass = os.environ.get("TEST_ACCOUNTS_PS") - # Defining the logging mechanism - def get_logger(self): - 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 generate_random_number(self, min_value, max_value) -> int: - return random.randint(min_value, max_value) + # Clearing restmail. + def clear_fxa_email(self, fxa_username: str): + requests.delete(f"https://restmail.net/mail/{fxa_username}") - # We are polling restmail 5 times in order to fetch the FxA verification code + # Mechanism of fetching the fxa verification code from restamil def get_fxa_verification_code(self, fxa_username: str, max_attempts=5, poll_interval=5) -> str: for attempt in range(max_attempts): try: - # fetching the FxA email verification code - response = requests.get(f"https://restmail.net/mail/{fxa_username}") + cleared_username = self.username_extraction_from_email(fxa_username) + # Fetching the FxA email verification code + response = requests.get(f"https://restmail.net/mail/{cleared_username}") response.raise_for_status() json_response = response.json() - email_text = json_response[0]["text"] - print(email_text) - confirmation_code = re.search( - r"If yes, here is your authorization code:\s*\n\n(\d+)", email_text - ).group(1) + fxa_verification_code = json_response[0]['headers']['x-signin-verify-code'] + print(fxa_verification_code) # clearing the email after the code is fetched - self.clear_fxa_email(fxa_username) + self.clear_fxa_email(cleared_username) - return confirmation_code + return fxa_verification_code except HTTPError as htt_err: print(f"HTTP error occurred: {htt_err}. Polling again") time.sleep(poll_interval) except Exception as err: - print(f"Other error occurred: {err}. Polling again") + print(f"Used: {cleared_username} Other error occurred: {err}. Polling again") + print(fxa_verification_code) time.sleep(poll_interval) - def clear_fxa_email(self, fxa_username: str): - requests.delete(f"https://restmail.net/mail/{fxa_username}") + # Extracting username from e-mail mechanism + def username_extraction_from_email(self, string_to_analyze: str) -> str: + return re.match(r"(.+)@", string_to_analyze).group(1) + + def generate_random_number(self, min_value, max_value) -> int: + return random.randint(min_value, max_value) def number_extraction_from_string(self, string_to_analyze: str) -> int: return int(re.findall(r"\d+", string_to_analyze)[0]) - def answer_id_extraction(self, string_to_analyze: str) -> str: - match = re.search(r"#answer-\d+", string_to_analyze) - if match: - return match.group(0) + # Defining the logging mechanism + def get_logger(self): + logger_name = inspect.stack()[1][3] + logger = logging.getLogger(logger_name) - def username_extraction_from_email(self, string_to_analyze: str) -> str: - return re.match(r"(.+)@", string_to_analyze).group(1) + 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 + + # Returning current page URL + def get_page_url(self) -> str: + return self.page.url + + # Navigating back in history (browser back button) + def navigate_back(self): + self.page.go_back() + + # Navigating forward in history (browser forward button) + def navigate_forward(self): + self.page.go_forward() + + # Navigating to SUMO homepage + def navigate_to_homepage(self): + self.page.goto(HomepageMessages.STAGE_HOMEPAGE_URL) + + # Navigating to a specific given link + def navigate_to_link(self, link: str): + self.page.goto(link) + + # Wait for a given timeout + def wait_for_given_timeout(self, milliseconds: int): + self.page.wait_for_timeout(milliseconds) + + # Store authentication states + def store_session_cookies(self, session_file_name: str): + self.context.storage_state(path=f"core/sessions/.auth/{session_file_name}.json") + + def delete_cookies(self): + self.context.clear_cookies() + # Reloading the page for the deletion to take immediate action. + self.page.reload() + + def start_existing_session(self, session_file_name: str): + 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']) + # A SUMO action needs to be done in order to have the page refreshed with the correct + # session + self.page.reload() + + def replace_special_chars_account(self, account: str) -> str: + return account.replace(account, "testMozillaSpecialChars") def remove_character_from_string(self, string: str, character_to_remove: str) -> str: return string.replace(character_to_remove, "") diff --git a/selenium_tests/flows/aaq_flows/aaq_flow.py b/playwright_tests/flows/aaq_flows/aaq_flow.py similarity index 60% rename from selenium_tests/flows/aaq_flows/aaq_flow.py rename to playwright_tests/flows/aaq_flows/aaq_flow.py index c8cee79a1bb..26449af6335 100644 --- a/selenium_tests/flows/aaq_flows/aaq_flow.py +++ b/playwright_tests/flows/aaq_flows/aaq_flow.py @@ -1,18 +1,17 @@ -from selenium_tests.core.test_utilities import TestUtilities -from selenium_tests.pages.product_solutions_pages.product_solutions_page import ( - ProductSolutionsPage, -) -from selenium_tests.pages.top_navbar import TopNavbar -from selenium_tests.pages.user_questions_pages.aaq_form_page import AAQFormPage -from selenium.webdriver.remote.webdriver import WebDriver -from selenium_tests.pages.user_questions_pages.questions_page import QuestionPage +from playwright.sync_api import Page +from playwright_tests.core.testutilities import TestUtilities +from playwright_tests.pages.product_solutions_pages.product_solutions_page import ( + ProductSolutionsPage) +from playwright_tests.pages.top_navbar import TopNavbar +from playwright_tests.pages.user_questions_pages.aaq_form_page import AAQFormPage +from playwright_tests.pages.user_questions_pages.questions_page import QuestionPage class AAQFlow(AAQFormPage, ProductSolutionsPage, TopNavbar, TestUtilities, QuestionPage): - def __init__(self, driver: WebDriver): - super().__init__(driver) + def __init__(self, page: Page): + super().__init__(page) - def submit_valid_firefox_product_question_via_ask_now_fx_solutions(self) -> dict: + def submit_valid_firefox_prod_question_via_ask_now_fx_solutions(self) -> dict: random_number = str(super().generate_random_number(min_value=0, max_value=1000)) super().click_on_ask_a_question_firefox_browser_option() super().click_ask_now_button() @@ -30,6 +29,6 @@ def submit_valid_firefox_product_question_via_ask_now_fx_solutions(self) -> dict super().click_aaq_form_submit_button() super().is_post_reply_button_visible() - current_page_url = super().current_url() + current_page_url = self._page.url return {"aaq_subject": aaq_subject, "question_page_url": current_page_url} diff --git a/selenium_tests/flows/article_flows/add_kb_article_flow.py b/playwright_tests/flows/article_flows/add_kb_article_flow.py similarity index 73% rename from selenium_tests/flows/article_flows/add_kb_article_flow.py rename to playwright_tests/flows/article_flows/add_kb_article_flow.py index 60e7afa1405..a1e9c59691a 100644 --- a/selenium_tests/flows/article_flows/add_kb_article_flow.py +++ b/playwright_tests/flows/article_flows/add_kb_article_flow.py @@ -1,16 +1,17 @@ -from selenium_tests.core.base_page import BasePage -from selenium_tests.core.test_utilities import TestUtilities -from selenium.webdriver.remote.webdriver import WebDriver -from selenium_tests.messages.kb_articles.kb_article_page_messages import KBArticlePageMessages -from selenium_tests.pages.articles.submit_kb_article_page import SubmitKBArticlePage +from playwright.sync_api import Page +from playwright_tests.core.testutilities import TestUtilities +from playwright_tests.messages.kb_article.kb_article_page_messages import KBArticlePageMessages +from playwright_tests.pages.articles.submit_kb_article_page import SubmitKBArticlePage -class AddKbArticleFlow(TestUtilities, SubmitKBArticlePage, BasePage): - def __init__(self, driver: WebDriver): - super().__init__(driver) + +class AddKbArticleFlow(TestUtilities, SubmitKBArticlePage): + + def __init__(self, page: Page): + super().__init__(page) def submit_simple_kb_article(self) -> str: - super().navigate_to(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 @@ -32,11 +33,11 @@ def submit_simple_kb_article(self) -> str: super().click_on_toggle_syntax_highlight_option() super().add_text_to_content_textarea(kb_article_test_data["article_content"]) - super()._press_enter_keyboard_button() + self._page.keyboard.press("Enter") super().add_text_to_content_textarea(kb_article_test_data["article_heading_one"]) - super()._press_enter_keyboard_button() + self._page.keyboard.press("Enter") super().add_text_to_content_textarea(kb_article_test_data["article_heading_two"]) - super()._press_enter_keyboard_button() + self._page.keyboard.press("Enter") super().add_text_to_content_textarea(kb_article_test_data["article_heading_three"]) super().click_on_insert_media_button() super()._click_on_first_image_from_media_panel() diff --git a/selenium_tests/flows/auth_flows/auth_flow.py b/playwright_tests/flows/auth_flows/auth_flow.py similarity index 88% rename from selenium_tests/flows/auth_flows/auth_flow.py rename to playwright_tests/flows/auth_flows/auth_flow.py index 015665c50f0..c3eff3a13a4 100644 --- a/selenium_tests/flows/auth_flows/auth_flow.py +++ b/playwright_tests/flows/auth_flows/auth_flow.py @@ -1,6 +1,6 @@ -from selenium_tests.core.test_utilities import TestUtilities -from selenium_tests.pages.auth_page import AuthPage -from selenium_tests.pages.homepage import Homepage +from playwright_tests.core.testutilities import TestUtilities +from playwright_tests.pages.auth_page import AuthPage +from playwright_tests.pages.homepage import Homepage class AuthFlowPage(TestUtilities, AuthPage, Homepage): @@ -21,6 +21,7 @@ def __provide_login_credentials_and_submit(self, username: str, password: str): def sign_in_flow( self, username: str, account_password: str, sign_in_with_same_account: bool ) -> str: + # Forcing an email clearance super().clear_fxa_email(username) @@ -39,4 +40,4 @@ def sign_in_flow( if super().is_enter_otp_code_input_field_displayed(): self.__provide_otp_code(super().get_fxa_verification_code(fxa_username=username)) - return self.username_extraction_from_email(username) + return username diff --git a/playwright_tests/flows/messaging_system_flows/messaging_system_flow.py b/playwright_tests/flows/messaging_system_flows/messaging_system_flow.py new file mode 100644 index 00000000000..eb0ef0f5ff6 --- /dev/null +++ b/playwright_tests/flows/messaging_system_flows/messaging_system_flow.py @@ -0,0 +1,13 @@ +from playwright.sync_api import Page +from playwright_tests.core.testutilities import TestUtilities +from playwright_tests.pages.messaging_system_pages.new_message import NewMessagePage + + +class MessagingSystemFlows(TestUtilities, NewMessagePage): + def __init__(self, page: Page): + super().__init__(page) + + def complete_send_message_form_with_data(self, recipient_username: str, message_body: str): + super().type_into_new_message_to_input_field(recipient_username) + super().click_on_a_searched_user(recipient_username) + super().fill_into_new_message_body_textarea(message_body) diff --git a/selenium_tests/flows/user_profile_flows/edit_profile_data_flow.py b/playwright_tests/flows/user_profile_flows/edit_profile_data_flow.py similarity index 79% rename from selenium_tests/flows/user_profile_flows/edit_profile_data_flow.py rename to playwright_tests/flows/user_profile_flows/edit_profile_data_flow.py index 96183d52e8f..05a347bda59 100644 --- a/selenium_tests/flows/user_profile_flows/edit_profile_data_flow.py +++ b/playwright_tests/flows/user_profile_flows/edit_profile_data_flow.py @@ -1,11 +1,11 @@ -from selenium.webdriver.remote.webdriver import WebDriver -from selenium_tests.core.test_utilities import TestUtilities -from selenium_tests.pages.user_pages.my_profile_edit import MyProfileEdit +from playwright.sync_api import Page +from playwright_tests.core.testutilities import TestUtilities +from playwright_tests.pages.user_pages.my_profile_edit import MyProfileEdit class EditProfileDataFlow(MyProfileEdit, TestUtilities): - def __init__(self, driver: WebDriver): - super().__init__(driver) + def __init__(self, page: Page): + super().__init__(page) def edit_profile_with_test_data(self): edit_test_data = super().profile_edit_test_data @@ -24,7 +24,7 @@ def edit_profile_with_test_data(self): super().send_text_to_people_directory_username( edit_test_data["valid_user_edit"]["people_directory_username"] ) - super().send_text_to_matrix_nickname_field( + super().send_text_to_matrix_nickname( edit_test_data["valid_user_edit"]["matrix_nickname"] ) super().select_country_dropdown_option_by_value( @@ -37,10 +37,10 @@ def edit_profile_with_test_data(self): super().select_preferred_language_dropdown_option_by_value( edit_test_data["valid_user_edit"]["preferred_language"] ) - super().select_involved_with_mozilla_from_month_option_by_value( + super().select_involved_from_month_option_by_value( edit_test_data["valid_user_edit"]["involved_from_month_number"] ) - super().select_involved_with_mozilla_from_year_option_by_value( + super().select_involved_from_year_option_by_value( edit_test_data["valid_user_edit"]["involved_from_year"] ) diff --git a/selenium_tests/messages/auth_pages_messages/fxa_page_messages.py b/playwright_tests/messages/auth_pages_messages/fxa_page_messages.py similarity index 100% rename from selenium_tests/messages/auth_pages_messages/fxa_page_messages.py rename to playwright_tests/messages/auth_pages_messages/fxa_page_messages.py diff --git a/selenium_tests/messages/contribute_pages_messages/con_forum_page_messages.py b/playwright_tests/messages/contribute_pages_messages/con_forum_page_messages.py similarity index 100% rename from selenium_tests/messages/contribute_pages_messages/con_forum_page_messages.py rename to playwright_tests/messages/contribute_pages_messages/con_forum_page_messages.py diff --git a/selenium_tests/messages/contribute_pages_messages/con_help_articles_page_messages.py b/playwright_tests/messages/contribute_pages_messages/con_help_articles_page_messages.py similarity index 100% rename from selenium_tests/messages/contribute_pages_messages/con_help_articles_page_messages.py rename to playwright_tests/messages/contribute_pages_messages/con_help_articles_page_messages.py diff --git a/selenium_tests/messages/contribute_pages_messages/con_localization_page_messages.py b/playwright_tests/messages/contribute_pages_messages/con_localization_page_messages.py similarity index 100% rename from selenium_tests/messages/contribute_pages_messages/con_localization_page_messages.py rename to playwright_tests/messages/contribute_pages_messages/con_localization_page_messages.py diff --git a/selenium_tests/messages/contribute_pages_messages/con_mobile_support_page_messages.py b/playwright_tests/messages/contribute_pages_messages/con_mobile_support_page_messages.py similarity index 100% rename from selenium_tests/messages/contribute_pages_messages/con_mobile_support_page_messages.py rename to playwright_tests/messages/contribute_pages_messages/con_mobile_support_page_messages.py diff --git a/selenium_tests/messages/contribute_pages_messages/con_page_messages.py b/playwright_tests/messages/contribute_pages_messages/con_page_messages.py similarity index 100% rename from selenium_tests/messages/contribute_pages_messages/con_page_messages.py rename to playwright_tests/messages/contribute_pages_messages/con_page_messages.py diff --git a/selenium_tests/messages/contribute_pages_messages/con_social_support_messages.py b/playwright_tests/messages/contribute_pages_messages/con_social_support_messages.py similarity index 100% rename from selenium_tests/messages/contribute_pages_messages/con_social_support_messages.py rename to playwright_tests/messages/contribute_pages_messages/con_social_support_messages.py diff --git a/selenium_tests/messages/homepage_messages.py b/playwright_tests/messages/homepage_messages.py similarity index 100% rename from selenium_tests/messages/homepage_messages.py rename to playwright_tests/messages/homepage_messages.py diff --git a/selenium_tests/messages/kb_articles/kb_article_page_messages.py b/playwright_tests/messages/kb_article/kb_article_page_messages.py similarity index 100% rename from selenium_tests/messages/kb_articles/kb_article_page_messages.py rename to playwright_tests/messages/kb_article/kb_article_page_messages.py diff --git a/selenium_tests/messages/my_profile_pages_messages/edit_cont_areas_page_messages.py b/playwright_tests/messages/mess_system_pages_messages/edit_cont_areas_page_messages.py similarity index 100% rename from selenium_tests/messages/my_profile_pages_messages/edit_cont_areas_page_messages.py rename to playwright_tests/messages/mess_system_pages_messages/edit_cont_areas_page_messages.py diff --git a/selenium_tests/messages/messaging_system_pages_messages/inbox_page_messages.py b/playwright_tests/messages/mess_system_pages_messages/inbox_page_messages.py similarity index 77% rename from selenium_tests/messages/messaging_system_pages_messages/inbox_page_messages.py rename to playwright_tests/messages/mess_system_pages_messages/inbox_page_messages.py index d326b1db509..5672ab90b7d 100644 --- a/selenium_tests/messages/messaging_system_pages_messages/inbox_page_messages.py +++ b/playwright_tests/messages/mess_system_pages_messages/inbox_page_messages.py @@ -6,6 +6,6 @@ class InboxPageMessages: NO_MESSAGES_IN_INBOX_TEXT = "There are no messages here." MESSAGE_SENT_BANNER_TEXT = "Your message was sent!" MESSAGE_DELETED_BANNER_TEXT = "The message was deleted!" + MULTIPLE_MESSAGES_DELETION_BANNER_TEXT = "The messages were deleted!" NO_MESSAGES_SELECTED_BANNER_TEXT = "No messages selected. Please try again." - NAVBAR_INBOX_SELECTED_BG_COLOR_CHROME = "rgba(237, 237, 240, 1)" - NAVBAR_INBOX_SELECTED_BG_COLOR_FIREFOX = "rgb(237, 237, 240)" + NAVBAR_INBOX_SELECTED_BG_COLOR = "rgb(237, 237, 240)" diff --git a/selenium_tests/messages/messaging_system_pages_messages/new_message_page_messages.py b/playwright_tests/messages/mess_system_pages_messages/new_message_page_messages.py similarity index 73% rename from selenium_tests/messages/messaging_system_pages_messages/new_message_page_messages.py rename to playwright_tests/messages/mess_system_pages_messages/new_message_page_messages.py index 660e6bda60a..1c7a57cfd8a 100644 --- a/selenium_tests/messages/messaging_system_pages_messages/new_message_page_messages.py +++ b/playwright_tests/messages/mess_system_pages_messages/new_message_page_messages.py @@ -4,16 +4,13 @@ class NewMessagePageMessages: NEW_MESSAGE_BREADCRUMB_TWO = "Messages" NEW_MESSAGE_BREADCRUMB_THREE = "New Message" NEW_MESSAGE_PAGE_HEADING = "New Message" - NAVBAR_NEW_MESSAGE_SELECTED_BG_COLOR_CHROME = "rgba(237, 237, 240, 1)" - NAVBAR_NEW_MESSAGE_SELECTED_BG_COLOR_FIREFOX = "rgb(237, 237, 240)" + NAVBAR_NEW_MESSAGE_SELECTED_BG_COLOR = "rgb(237, 237, 240)" NEW_MESSAGE_DEFAULT_REMAINING_CHARACTERS = "10000 characters remaining" TEN_CHARACTERS_REMAINING_MESSAGE = "10 characters remaining" NINE_CHARACTERS_REMAINING_MESSAGE = "9 characters remaining" NO_CHARACTERS_REMAINING_MESSAGE = "0 characters remaining" - ENOUGH_CHARACTERS_REMAINING_COLOR_CHROME = "rgba(0, 0, 0, 1)" - NO_CHARACTERS_REMAINING_COLOR_CHROME = "rgba(255, 0, 0, 1)" - ENOUGH_CHARACTERS_REMAINING_COLOR_FIREFOX = "rgb(0, 0, 0)" - NO_CHARACTERS_REMAINING_COLOR_FIREFOX = "rgb(255, 0, 0)" + ENOUGH_CHARACTERS_REMAINING_COLOR = "rgb(0, 0, 0)" + NO_CHARACTERS_REMAINING_COLOR = "rgb(255, 0, 0)" PREVIEW_MESSAGE_CONTENT_FIRST_PARAGRAPH_TEXT = "Test Automation message. Test italic text" PREVIEW_MESSAGE_CONTENT_FIRST_PARAGRAPH_STRONG_TEXT = "message" PREVIEW_MESSAGE_CONTENT_FIRST_PARAGRAPH_ITALIC_TEXT = "italic text" @@ -25,4 +22,4 @@ class NewMessagePageMessages: PREVIEW_MESSAGE_UL_LI_NUMBER_THREE = "Bulleted list item three" PREVIEW_MESSAGE_EXTERNAL_LINK = "Test external link" PREVIEW_MESSAGE_INTERNAL_LINK = "Test internal Link" - PREVIEW_MESSAGE_INTERNAL_LINK_TITLE = "Test Sync [Device Migration]" + PREVIEW_MESSAGE_INTERNAL_LINK_TITLE = "Back up your Firefox data" diff --git a/selenium_tests/messages/messaging_system_pages_messages/sent_messages_page_messages.py b/playwright_tests/messages/mess_system_pages_messages/sent_messages_page_messages.py similarity index 77% rename from selenium_tests/messages/messaging_system_pages_messages/sent_messages_page_messages.py rename to playwright_tests/messages/mess_system_pages_messages/sent_messages_page_messages.py index 1f4e19e37bf..aea477dc926 100644 --- a/selenium_tests/messages/messaging_system_pages_messages/sent_messages_page_messages.py +++ b/playwright_tests/messages/mess_system_pages_messages/sent_messages_page_messages.py @@ -6,6 +6,6 @@ class SentMessagesPageMessages: SENT_MESSAGES_PAGE_HEADER = "Sent Messages" NO_MESSAGES_IN_SENT_MESSAGES_TEXT = "There are no messages here." DELETE_MESSAGE_BANNER_TEXT = "The message was deleted!" + MULTIPLE_MESSAGES_DELETION_BANNER_TEXT = "The messages were deleted!" NO_MESSAGES_SELECTED_BANNER_TEXT = "No messages selected. Please try again." - NAVBAR_SENT_MESSAGES_SELECTED_BG_COLOR_CHROME = "rgba(237, 237, 240, 1)" - NAVBAR_SENT_MESSAGES_SELECTED_BG_COLOR_FIREFOX = "rgb(237, 237, 240)" + NAVBAR_SENT_MESSAGES_SELECTED_BG_COLOR = "rgb(237, 237, 240)" diff --git a/selenium_tests/messages/my_profile_pages_messages/edit_my_profile_page_messages.py b/playwright_tests/messages/my_profile_pages_messages/edit_my_profile_page_messages.py similarity index 100% rename from selenium_tests/messages/my_profile_pages_messages/edit_my_profile_page_messages.py rename to playwright_tests/messages/my_profile_pages_messages/edit_my_profile_page_messages.py diff --git a/selenium_tests/messages/my_profile_pages_messages/edit_settings_page_messages.py b/playwright_tests/messages/my_profile_pages_messages/edit_settings_page_messages.py similarity index 100% rename from selenium_tests/messages/my_profile_pages_messages/edit_settings_page_messages.py rename to playwright_tests/messages/my_profile_pages_messages/edit_settings_page_messages.py diff --git a/selenium_tests/messages/my_profile_pages_messages/my_profile_page_messages.py b/playwright_tests/messages/my_profile_pages_messages/my_profile_page_messages.py similarity index 100% rename from selenium_tests/messages/my_profile_pages_messages/my_profile_page_messages.py rename to playwright_tests/messages/my_profile_pages_messages/my_profile_page_messages.py diff --git a/selenium_tests/messages/my_profile_pages_messages/my_questions_page_messages.py b/playwright_tests/messages/my_profile_pages_messages/my_questions_page_messages.py similarity index 100% rename from selenium_tests/messages/my_profile_pages_messages/my_questions_page_messages.py rename to playwright_tests/messages/my_profile_pages_messages/my_questions_page_messages.py diff --git a/selenium_tests/messages/my_profile_pages_messages/user_profile_navbar_messages.py b/playwright_tests/messages/my_profile_pages_messages/user_profile_navbar_messages.py similarity index 100% rename from selenium_tests/messages/my_profile_pages_messages/user_profile_navbar_messages.py rename to playwright_tests/messages/my_profile_pages_messages/user_profile_navbar_messages.py diff --git a/playwright_tests/messages/support_page_messages.py b/playwright_tests/messages/support_page_messages.py new file mode 100644 index 00000000000..17bf1b0d785 --- /dev/null +++ b/playwright_tests/messages/support_page_messages.py @@ -0,0 +1,2 @@ +class SupportPageMessages: + TITLE_CONTAINS = " Support" diff --git a/selenium_tests/messages/top_navbar_messages.py b/playwright_tests/messages/top_navbar_messages.py similarity index 100% rename from selenium_tests/messages/top_navbar_messages.py rename to playwright_tests/messages/top_navbar_messages.py diff --git a/playwright_tests/pages/articles/kb_article_page.py b/playwright_tests/pages/articles/kb_article_page.py new file mode 100644 index 00000000000..519746f9856 --- /dev/null +++ b/playwright_tests/pages/articles/kb_article_page.py @@ -0,0 +1,18 @@ +from playwright.sync_api import Page +from playwright_tests.core.basepage import BasePage + + +class KBArticlePage(BasePage): + __kb_article_heading = "//h1[@class='sumo-page-heading']" + + # Editing Tools options + __editing_tools_show_history_option = "//a[contains(text(), 'Show History')]" + + def __init__(self, page: Page): + super().__init__(page) + + def get_text_of_article_title(self) -> str: + return super()._get_text_of_element(self.__kb_article_heading) + + def click_on_show_history_option(self): + super()._click(self.__editing_tools_show_history_option) diff --git a/playwright_tests/pages/articles/kb_article_show_history_page.py b/playwright_tests/pages/articles/kb_article_show_history_page.py new file mode 100644 index 00000000000..d1fd94a411b --- /dev/null +++ b/playwright_tests/pages/articles/kb_article_show_history_page.py @@ -0,0 +1,22 @@ +from playwright.sync_api import Page, Locator +from playwright_tests.core.basepage import BasePage + + +class KBArticleShowHistoryPage(BasePage): + __delete_this_document_button = "//div[@id='delete-doc']/a" + __delete_this_document_confirmation_delete_button = "//div[@class='submit']/input" + __delete_this_document_confirmation_cancel_button = "//div[@class='submit']/a" + __article_deleted_confirmation_message = "//article[@id='delete-document']/h1" + + def __init__(self, page: Page): + super().__init__(page) + + def click_on_delete_this_document_button(self): + super()._click(self.__delete_this_document_button) + + def click_on_confirmation_delete_button(self): + super()._click(self.__delete_this_document_confirmation_delete_button) + + def is_article_deleted_confirmation_messages_displayed(self) -> Locator: + super()._wait_for_selector(self.__article_deleted_confirmation_message) + return super()._get_element_locator(self.__article_deleted_confirmation_message) diff --git a/playwright_tests/pages/articles/submit_kb_article_page.py b/playwright_tests/pages/articles/submit_kb_article_page.py new file mode 100644 index 00000000000..b55aedb0502 --- /dev/null +++ b/playwright_tests/pages/articles/submit_kb_article_page.py @@ -0,0 +1,114 @@ +from playwright.sync_api import Page, Locator +from playwright_tests.core.basepage import BasePage + + +class SubmitKBArticlePage(BasePage): + __kb_article_for_contributors_sidebar = "//nav[@id='for-contributors-sidebar']" + __kb_article_form_title = "//input[@id='id_title']" + __kb_article_form_slug = "//input[@id='id_slug']" + __kb_article_category_select = "//select[@id='id_category']" + __kb_article_is_localizable_checkbox = "//input[@id='id_is_localizable']" + __kb_article_allow_discussions_on_article = "//input[@id='id_allow_discussion']" + __kb_article_search_for_related_documents = "//input[@id='search-related']" + __kb_article_keywords_input = "//input[@id='id_keywords']" + __kb_article_search_result_summary_textarea = "//textarea[@id='id_summary']" + # try + __kb_article_content_textarea = "//textarea[@id='id_content'][1]" + __kb_article_insert_media = "//button[contains(@class, 'btn-media')]" + __kb_article_insert_media_modal_images = "//div[@id='media-modal']//img" + __kb_article_insert_media_modal_insert_button = "//button[contains(text(), 'Insert Media')]" + __kb_article_toggle_syntax_highlighting = "//a[contains(text(), 'Toggle syntax highlight')]" + __kb_article_expiry_date = "//input[@id='id_expires']" + __kb_article_preview_content_button = ("//div[contains(@class, 'submit')]/button[contains(" + "@class, 'btn-preview')]") + __kb_article_preview_image = "//div[@id='doc-content']//img" + __kb_article_submit_for_preview_button = ("//div[contains(@class, 'submit')]/button[contains(" + "@class, 'submit')]") + __kb_article_preview_content = "//div[@id='doc-content']" + __kb_article_showfor_panel = "//section[@id='showfor-panel']" + __kb_submit_changes_input_field = "//input[@id='id_comment']" + __kb_submit_changes_button = "//button[@id='submit-document-form']" + + def __init__(self, page: Page): + super().__init__(page) + + def for_contributors_section(self) -> Locator: + return super()._get_element_locator(self.__kb_article_for_contributors_sidebar) + + def add_text_to_article_form_title_field(self, text: str): + super()._fill(self.__kb_article_form_title, text) + + def add_text_to_related_documents_field(self, text: str): + super()._fill(self.__kb_article_search_for_related_documents, text) + + def add_text_to_keywords_field(self, text: str): + super()._fill(self.__kb_article_keywords_input, text) + + def add_text_to_search_result_summary_field(self, text: str): + super()._fill(self.__kb_article_search_result_summary_textarea, text) + + def add_text_to_expiry_date_field(self, text: str): + super()._type(self.__kb_article_expiry_date, text, 0) + + def add_text_to_changes_description_field(self, text: str): + super()._fill(self.__kb_submit_changes_input_field, text) + + def add_text_to_content_textarea(self, text: str): + super()._fill(self.__kb_article_content_textarea, text) + + def is_content_textarea_displayed(self) -> bool: + super()._wait_for_selector(self.__kb_article_content_textarea) + return super()._is_element_visible(self.__kb_article_content_textarea) + + def click_on_insert_media_button(self): + super()._click(self.__kb_article_insert_media) + + def click_on_toggle_syntax_highlight_option(self): + super()._click(self.__kb_article_toggle_syntax_highlighting) + + def click_on_preview_content_button(self): + super()._click(self.__kb_article_preview_content_button) + + def click_on_submit_for_review_button(self): + super()._click(self.__kb_article_submit_for_preview_button) + + def click_on_changes_submit_button(self): + super()._click(self.__kb_submit_changes_button) + + def is_showfor_panel_displayed(self) -> Locator: + return super()._get_element_locator(self.__kb_article_showfor_panel) + + def is_preview_content_section_displayed(self) -> Locator: + return super()._get_element_locator(self.__kb_article_preview_content) + + def _click_on_a_relevant_to_option_checkbox(self, option_to_click: str): + xpath = f"//div[@id='id_products']//label[contains(text(), '{option_to_click}')]/input" + super()._click(xpath) + + def _get_text_of_label_for_relevant_to_checkbox(self, option_to_click) -> str: + xpath = f"//div[@id='id_products']//input[@id='id_products_{option_to_click}']/.." + return super()._get_text_of_element(xpath) + + def _click_on_a_particular_parent_topic(self, parent_topic: str): + xpath_parent_topic = f"//section[@id='accordion']//button[text()='{parent_topic}']" + super()._click(xpath_parent_topic) + + def _click_on_a_particular_child_topic_checkbox( + self, parent_topic: str, child_topic_checkbox: str + ): + xpath_child_topic_checkbox_option = ( + f"//section[@id='accordion']//button[text()='{parent_topic}']/parent::h3" + f"/following-sibling::ul[1]//label[text()='{child_topic_checkbox}']") + super()._click(xpath_child_topic_checkbox_option) + + def _click_on_insert_media_textarea_option(self): + super()._click(self.__kb_article_insert_media) + + def _click_on_first_image_from_media_panel(self): + super()._click_on_first_item(self.__kb_article_insert_media_modal_images) + + def _click_on_insert_media_modal_button(self): + super()._click(self.__kb_article_insert_media_modal_insert_button) + + def select_category_option_by_text(self, option: str): + super()._select_option_by_label(self.__kb_article_category_select, option) diff --git a/playwright_tests/pages/auth_page.py b/playwright_tests/pages/auth_page.py new file mode 100644 index 00000000000..56691e7c5f1 --- /dev/null +++ b/playwright_tests/pages/auth_page.py @@ -0,0 +1,80 @@ +from playwright.sync_api import Page +from playwright_tests.core.basepage import BasePage + + +class AuthPage(BasePage): + + # Auth page content + __auth_page_section = "//section[@class='sumo-auth--wrap']" + __fxa_sign_in_page_header = "//h1[@id='fxa-signin-password-header']" + __auth_page_main_header = "//h1[@class='sumo-page-heading']" + __auth_page_subheading_text = "//div[@class='sumo-page-section']/p" + + # Continue with firefox accounts button + __continue_with_firefox_accounts_button = "//p[@class='login-button-wrap']/a" + + # Use a different account option + __use_a_different_account_button = "//a[@id='use-different']" + + # Already logged in 'Sign in' button + __user_logged_in_sign_in_button = "//button[@id='use-logged-in']" + + # Email submission + __enter_your_email_input_field = "//input[@name='email']" + __enter_your_email_submit_button = "//button[@id='submit-btn']" + + # Password submission + __enter_your_password_input_field = "//input[@id='password']" + __enter_your_password_submit_button = "//button[@id='submit-btn']" + + # OTP Code + __enter_otp_code_input_field = "//input[@id='otp-code']" + __enter_otp_code_confirm_button = "//button[@id='submit-btn']" + + def __init__(self, page: Page): + super().__init__(page) + + def click_on_continue_with_firefox_accounts_button(self): + super()._click(self.__continue_with_firefox_accounts_button) + + def click_on_use_a_different_account_button(self): + super()._click(self.__use_a_different_account_button) + + def click_on_user_logged_in_sign_in_button(self): + super()._click(self.__user_logged_in_sign_in_button) + + def click_on_enter_your_email_submit_button(self): + super()._click(self.__enter_your_email_submit_button) + + def click_on_enter_your_password_submit_button(self): + super()._click(self.__enter_your_password_submit_button) + + def click_on_otp_code_confirm_button(self): + super()._click(self.__enter_otp_code_confirm_button) + + def add_data_to_email_input_field(self, text: str): + super()._fill(self.__enter_your_email_input_field, text) + + def add_data_to_password_input_field(self, text: str): + super()._fill(self.__enter_your_password_input_field, text) + + def add_data_to_otp_code_input_field(self, text: str): + super()._fill(self.__enter_otp_code_input_field, text) + + def clear_email_input_field(self): + super()._clear_field(self.__enter_your_email_input_field) + + def is_use_a_different_account_button_displayed(self) -> bool: + super()._wait_for_selector(self.__use_a_different_account_button) + return super()._is_element_visible(self.__use_a_different_account_button) + + def is_logged_in_sign_in_button_displayed(self) -> bool: + return super()._is_element_visible(self.__user_logged_in_sign_in_button) + + def is_enter_otp_code_input_field_displayed(self) -> bool: + super()._wait_for_selector(self.__continue_with_firefox_accounts_button) + return super()._is_element_visible(self.__enter_otp_code_input_field) + + def is_continue_with_firefox_button_displayed(self) -> bool: + super()._wait_for_selector(self.__continue_with_firefox_accounts_button) + return super()._is_element_visible(self.__continue_with_firefox_accounts_button) diff --git a/playwright_tests/pages/contribute_pages/contribute_page.py b/playwright_tests/pages/contribute_pages/contribute_page.py new file mode 100644 index 00000000000..d96242e0252 --- /dev/null +++ b/playwright_tests/pages/contribute_pages/contribute_page.py @@ -0,0 +1,76 @@ +from playwright.sync_api import Page, ElementHandle +from playwright_tests.core.basepage import BasePage + + +class ContributePage(BasePage): + # Breadcrumbs + __breadcrumbs = "//ol[@id='breadcrumbs']/li" + __breadcrumb_homepage = "//ol[@id='breadcrumbs']/li[1]" + + # Page Hero + __page_hero_main_header = "//div[contains(@class,'hero')]/div/h1" + __page_hero_main_header_subtext = ("//div[contains(@class," + "'hero')]/div/h1/following-sibling::p[1]") + __page_hero_need_help_header = "//div[contains(@class,'hero')]/div/h2" + __page_hero_need_help_subtext = "//div[contains(@class,'hero')]/div/h1/following-sibling::p[2]" + + # Ways to contribute + __way_to_contribute_header = "//nav/preceding-sibling::h2" + __way_to_contribute_cards = ("//h2[contains(text(),'Pick a way to " + "contribute')]/following-sibling::nav/ul/a") + __way_to_contribute_card_titles = "//nav/ul/a/li/span" + + # About us + __about_us_header = "//h2[contains(text(),'About us')]" + __about_us_subtext = "//h2[contains(text(),'About us')]/following-sibling::p" + + # All page images + __all_page_images = "//div[@id='svelte']//img" + + def __init__(self, page: Page): + super().__init__(page) + + # Breadcrumbs + def get_breadcrumbs_text(self) -> list[str]: + return super()._get_text_of_elements(self.__breadcrumbs) + + def click_on_home_breadcrumb(self): + super()._click(self.__breadcrumb_homepage) + + # Page Hero + def get_page_hero_main_header_text(self) -> str: + return super()._get_text_of_element(self.__page_hero_main_header) + + def get_page_hero_main_subtext(self) -> str: + return super()._get_text_of_element(self.__page_hero_main_header_subtext) + + def get_page_hero_need_help_header_text(self) -> str: + return super()._get_text_of_element(self.__page_hero_need_help_header) + + def get_page_hero_need_help_subtext(self) -> str: + return super()._get_text_of_element(self.__page_hero_need_help_subtext) + + # Page images + def get_all_page_links(self) -> list[ElementHandle]: + return super()._get_element_handles(self.__all_page_images) + + # Way to contribute + 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]: + return super()._get_text_of_elements(self.__way_to_contribute_card_titles) + + # About us + def get_about_us_header_text(self) -> str: + return super()._get_text_of_element(self.__about_us_header) + + def get_about_us_subtext(self) -> str: + return super()._get_text_of_element(self.__about_us_subtext) + + # Contribute cards + def get_list_of_contribute_cards(self) -> list[ElementHandle]: + return super()._get_element_handles(self.__way_to_contribute_cards) + + def click_on_way_to_contribute_card(self, way_to_contribute_card: ElementHandle): + way_to_contribute_card.click() diff --git a/playwright_tests/pages/contribute_pages/ways_to_contribute_pages.py b/playwright_tests/pages/contribute_pages/ways_to_contribute_pages.py new file mode 100644 index 00000000000..9bf7b9e9d3a --- /dev/null +++ b/playwright_tests/pages/contribute_pages/ways_to_contribute_pages.py @@ -0,0 +1,82 @@ +from playwright.sync_api import Page, ElementHandle +from playwright_tests.core.basepage import BasePage + + +class WaysToContributePages(BasePage): + # Breadcrumbs + __interactable_breadcrumbs = "//ol[@id='breadcrumbs']/li/a" + __all_breadcrumbs = "//ol[@id='breadcrumbs']/li" + + # Page Content + __hero_main_header = "//div[contains(@class,'hero')]/div/h1" + __hero_second_header = "//div[contains(@class,'hero')]/div/h2" + __hero_text = "//div[contains(@class,'hero')]/div/p" + __all_page_images = "//div[@id='svelte']//img" + + # How to contribute section + __how_to_contribute_header = "//section[@class='mzp-l-content']/h2" + __all_how_to_contribute_option_links = "//section[@class='mzp-l-content']/div/ol/li/a" + __start_answering_how_to_contribute_option_text = ("//section[@class='mzp-l-content']/div/ol" + "/li[4]") + __first_fact_text = "//div[contains(@class,'fact')]/span[1]" + __second_fact_text = "//div[contains(@class,'fact')]/span[2]" + + # Other ways to contribute section + __other_ways_to_contribute_header = "//div[@id='svelte']/section[2]/h2" + __other_ways_to_contribute_card_titles = "//div[@id='svelte']/section[2]//nav//span" + __other_ways_to_contribute_card_list = "//div[@id='svelte']/section[2]//ul/a" + + def __init__(self, page: Page): + super().__init__(page) + + # Breadcrumbs + def get_text_of_all_breadcrumbs(self) -> list[str]: + return super()._get_text_of_elements(self.__all_breadcrumbs) + + def get_interactable_breadcrumbs(self) -> list[ElementHandle]: + return super()._get_element_handles(self.__interactable_breadcrumbs) + + def click_on_breadcrumb(self, element: ElementHandle): + element.click() + + # Page content + def get_hero_main_header_text(self) -> str: + return super()._get_text_of_element(self.__hero_main_header) + + def get_hero_second_header_text(self) -> str: + return super()._get_text_of_element(self.__hero_second_header) + + def get_hero_text(self) -> str: + return super()._get_text_of_element(self.__hero_text) + + def get_all_page_image_links(self) -> list[ElementHandle]: + return super()._get_element_handles(self.__all_page_images) + + # How to contribute section + 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]: + return super()._get_text_of_elements(self.__all_how_to_contribute_option_links) + + def get_how_to_contribute_option_four_text(self) -> str: + return super()._get_text_of_element(self.__start_answering_how_to_contribute_option_text) + + def get_first_fact_text(self) -> str: + return super()._get_text_of_element(self.__first_fact_text) + + def get_second_fact_text(self) -> str: + return super()._get_text_of_element(self.__second_fact_text) + + # Other ways to contribute section + def get_other_ways_to_contribute_header_txt(self) -> str: + return super()._get_text_of_element(self.__other_ways_to_contribute_header) + + def get_other_ways_to_contribute_card_title_txt(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]: + return super()._get_element_handles(self.__other_ways_to_contribute_card_list) + + def click_on_other_way_to_contribute_card(self, card_item: ElementHandle): + card_item.click() diff --git a/playwright_tests/pages/footer.py b/playwright_tests/pages/footer.py new file mode 100644 index 00000000000..095f1f33a5e --- /dev/null +++ b/playwright_tests/pages/footer.py @@ -0,0 +1,13 @@ +from playwright.sync_api import Page, ElementHandle +from playwright_tests.core.basepage import BasePage + + +class FooterSection(BasePage): + __all_footer_links = "//footer//a" + __language_selector = "mzp-c-language-switcher-select" + + def __init__(self, page: Page): + super().__init__(page) + + def get_all_footer_links(self) -> list[ElementHandle]: + return super()._get_element_handles(self.__all_footer_links) diff --git a/playwright_tests/pages/homepage.py b/playwright_tests/pages/homepage.py new file mode 100644 index 00000000000..b1c47f7365c --- /dev/null +++ b/playwright_tests/pages/homepage.py @@ -0,0 +1,61 @@ +from playwright.sync_api import Page +from playwright_tests.core.basepage import BasePage + + +class Homepage(BasePage): + # Searchbar section + __search_bar = "//form[@id='support-search-masthead']/input[@id='search-q']" + __search_bar_button = "//form[@id='support-search-masthead']/button[@class='search-button']" + __popular_searches = "p.popular-searches > a" + + # Product list section + __product_list = "div.card--product" + __product_card_titles = "//div[contains(@class, 'card--product')]//h3[@class='card--title']/a" + + # Featured articles section + __featured_articles_list = "div.card--article" + __featured_articles_card_items = "div.card--article" + __featured_articles_card_titles = "div.card--article a" + + # Join our Community section + __join_our_community_card_title = "div.card--callout-wrap-narrow h3" + + __join_our_community_card_description = "//div[@class='card--callout-wrap-narrow']//p[1]" + __learn_more_option = "//a[contains(text(), 'Learn More')]" + + def __init__(self, page: Page): + super().__init__(page) + + # Search + def click_on_first_popular_search(self): + super()._click_on_first_item(self.__popular_searches) + + def click_on_search_button(self): + super()._click(self.__search_bar_button) + + # Product Cards + def get_text_of_product_card_titles(self) -> list[str]: + return super()._get_text_of_elements(self.__product_card_titles) + + def click_on_product_card(self, element_number): + super()._click_on_an_element_by_index(self.__product_list, element_number) + + # Featured articles + def get_number_of_featured_articles(self) -> int: + return super()._get_elements_count(self.__featured_articles_list) + + def get_featured_articles_titles(self) -> list[str]: + return super()._get_text_of_elements(self.__featured_articles_card_titles) + + def click_on_a_featured_card(self, element_number: int): + super()._click_on_an_element_by_index(self.__featured_articles_card_items, element_number) + + # Learn More + def click_learn_more_option(self): + super()._click(self.__learn_more_option) + + def get_community_card_title(self) -> str: + return super()._get_text_of_element(self.__join_our_community_card_title) + + def get_community_card_description(self) -> str: + return super()._get_text_of_element(self.__join_our_community_card_description) diff --git a/playwright_tests/pages/messaging_system_pages/inbox_page.py b/playwright_tests/pages/messaging_system_pages/inbox_page.py new file mode 100644 index 00000000000..61a0a26e693 --- /dev/null +++ b/playwright_tests/pages/messaging_system_pages/inbox_page.py @@ -0,0 +1,133 @@ +from playwright.sync_api import Page, Locator, ElementHandle +from playwright_tests.core.basepage import BasePage + + +class InboxPage(BasePage): + __inbox_page_breadcrumbs = "//ol[@id='breadcrumbs']/li" + __inbox_page_main_heading = "//h1[@class='sumo-page-heading']" + __inbox_new_message_button = "//article[@id='inbox']//a[contains(text(),'New Message')]" + __inbox_no_messages_text = "//article[@id='inbox']//p" + __inbox_mark_selected_as_read_button = "//input[@name='mark_read']" + __inbox_delete_selected_button = "//input[@name='delete']" + __inbox_delete_page_delete_button = "//button[@name='delete']" + __inbox_delete_page_cancel_button = "//a[contains(text(), 'Cancel')]" + __inbox_page_scam_alert_banner_text = "//div[@id='id_scam_alert']//p[@class='heading']" + __inbox_page_scam_alert_close_button = "//button[@data-close-id='id_scam_alert']" + __inbox_page_message_action_banner = "//ul[@class='user-messages']/li/p" + __inbox_page_message_action_banner_close_button = ("//button[@class='mzp-c-notification-bar" + "-button']") + __inbox_messages = "//ol[@class='message-list']/li" + __inbox_messages_section = "//ol[@class='message-list']" + __inbox_messages_delete_button = "//ol[@class='message-list']/li/a[@class='delete']" + __inbox_delete_checkbox = ("//ol[@class='message-list']//a/ancestor::li/div[contains(@class, " + "'field checkbox no-label')]/label") + + def __init__(self, page: Page): + super().__init__(page) + + def get_text_inbox_page_message_banner_text(self) -> str: + return super()._get_text_of_element(self.__inbox_page_message_action_banner) + + def get_text_inbox_scam_alert_banner_text(self) -> str: + return super()._get_text_of_element(self.__inbox_page_scam_alert_banner_text) + + def get_text_of_inbox_page_main_header(self) -> str: + return super()._get_text_of_element(self.__inbox_page_main_heading) + + def get_text_of_inbox_no_message_header(self) -> str: + return super()._get_text_of_element(self.__inbox_no_messages_text) + + def get_inbox_message_subject(self, username: str) -> str: + xpath = ( + f"//ol[@class='message-list']//a[contains(text()," + f"'{username}')]/ancestor::li/a[@class='read']" + ) + return super()._get_text_of_element(xpath) + + # This requires a change def click_on_inbox_message_banner_close_button(self): + # self._page.locator(self.__inbox_page_message_action_banner_close_button).dispatch_event( + # type='click') + + def click_on_inbox_scam_alert_close_button(self): + super()._click(self.__inbox_page_scam_alert_close_button) + + def click_on_inbox_message_delete_button(self, username: str): + xpath_to_hover = ( + f"//ol[@class='message-list']//a[contains(text(),'{username}')]" + ) + super()._hover_over_element(xpath_to_hover) + + xpath_delete_button = ( + f"//ol[@class='message-list']//a[contains(text(),'{username}')]/ancestor::li" + f"/a[@class='delete']" + ) + super()._click(xpath_delete_button) + + def click_on_inbox_new_message_button(self): + super()._click(self.__inbox_new_message_button) + + def click_on_inbox_mark_selected_as_read_button(self): + super()._click(self.__inbox_mark_selected_as_read_button) + + def click_on_inbox_delete_selected_button(self): + super()._click(self.__inbox_delete_selected_button) + + def click_on_inbox_message_sender_username(self, username: str): + xpath = f"//ol[@class='message-list']//a[contains(text(),'{username}')]" + super()._click(xpath) + + def inbox_message_select_checkbox_element(self) -> list[ElementHandle]: + return super()._get_element_handles(self.__inbox_delete_checkbox) + + def click_on_inbox_message_subject(self, username: str): + xpath = (f"//ol[@class='message-list']//a[contains(text(),'{username}')]/ancestor::li/a[" + f"@class='read']") + super()._click(xpath) + + def click_on_delete_page_delete_button(self): + super()._click(self.__inbox_delete_page_delete_button) + + def click_on_delete_page_cancel_button(self): + # Hitting the "Enter" button instead of click due to an issue (the banner does not close + # on click) + super()._press_a_key(self.__inbox_delete_page_cancel_button, 'Enter') + + def is_no_message_header_displayed(self) -> bool: + return super()._is_element_visible(self.__inbox_no_messages_text) + + def inbox_message_banner(self) -> Locator: + return super()._get_element_locator(self.__inbox_page_scam_alert_banner_text) + + def inbox_message(self, username: str) -> Locator: + return super()._get_element_locator( + f"//ol[@class='message-list']//a[contains(text(),'{username}')]") + + def are_inbox_messages_displayed(self) -> bool: + return super()._is_element_visible(self.__inbox_messages_section) + + def delete_all_displayed_inbox_messages(self): + inbox_messages_count = super()._get_element_handles(self.__inbox_messages) + counter = 0 + for i in range(len(inbox_messages_count)): + inbox_messages = super()._get_element_handles(self.__inbox_messages) + element = inbox_messages[counter] + element.hover() + + inbox_elements_delete_button = super()._get_element_handles( + self.__inbox_messages_delete_button) + delete_button = inbox_elements_delete_button[counter] + + delete_button.click() + self.click_on_delete_page_delete_button() + + def delete_all_displayed_inbox_messages_via_delete_selected_button(self): + inbox_messages_count = super()._get_element_handles(self.__inbox_messages) + counter = 0 + for i in range(len(inbox_messages_count)): + inbox_checkbox = self.inbox_message_select_checkbox_element() + element = inbox_checkbox[counter] + element.click() + counter += 1 + + self.click_on_inbox_delete_selected_button() + self.click_on_delete_page_delete_button() diff --git a/playwright_tests/pages/messaging_system_pages/mess_system_user_navbar.py b/playwright_tests/pages/messaging_system_pages/mess_system_user_navbar.py new file mode 100644 index 00000000000..7974fd29343 --- /dev/null +++ b/playwright_tests/pages/messaging_system_pages/mess_system_user_navbar.py @@ -0,0 +1,33 @@ +from playwright.sync_api import Page, Locator +from playwright_tests.core.basepage import BasePage + + +class MessagingSystemUserNavbar(BasePage): + __messaging_system_user_navbar_inbox_option = "//ul[@id='pm-nav']//a[contains(text(),'Inbox')]" + __messaging_system_user_navbar_sent_messages_option = ("//ul[@id='pm-nav']//a[contains(text(" + "),'Sent Messages')]") + __messaging_system_user_navbar_new_message_option = ("//ul[@id='pm-nav']//a[contains(text()," + "'New Message')]") + + def __init__(self, page: Page): + super().__init__(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): + super()._click(self.__messaging_system_user_navbar_sent_messages_option) + + def click_on_messaging_system_navbar_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 + def get_inbox_navbar_element(self) -> Locator: + return super()._get_element_locator(self.__messaging_system_user_navbar_inbox_option) + + def get_sent_messages_navbar_element(self) -> Locator: + return super()._get_element_locator( + self.__messaging_system_user_navbar_sent_messages_option) + + def get_new_message_navbar_element(self) -> Locator: + return super()._get_element_locator(self.__messaging_system_user_navbar_new_message_option) diff --git a/playwright_tests/pages/messaging_system_pages/new_message.py b/playwright_tests/pages/messaging_system_pages/new_message.py new file mode 100644 index 00000000000..4c703b420fe --- /dev/null +++ b/playwright_tests/pages/messaging_system_pages/new_message.py @@ -0,0 +1,120 @@ +from playwright.sync_api import Page, Locator +from playwright_tests.core.basepage import BasePage + + +class NewMessagePage(BasePage): + __new_message_page_header = "//h1[@class='sumo-page-heading']" + __new_message_to_input_field = "//input[@id='token-input-id_to']" + __new_message_textarea_input_field = "//textarea[@id='id_message']" + __new_message_textarea_remaining_characters = "//div[@id='remaining-characters']" + __new_message_cancel_button = "//a[contains(text(),'Cancel')]" + __new_message_send_button = "//button[@name='send']" + __new_message_preview_section = "//section[@id='preview']" + __new_message_preview_section_content = "//div[@class='message']" + __new_message_search_for_a_user_option = "//div[@class='token-input-dropdown-facebook']" + __new_message_search_results_bolded_characters = "//div[@class='name_search']/b" + __new_message_search_results_text = "//div[@class='name_search']" + __sent_message_page_to_user_text = "//li[@class='token-input-token-facebook']/p" + __sent_message_page_to_user_delete_button = ("//span[@class='token-input-delete-token" + "-facebook']") + + # Preview Section + __new_message_preview_username = "//div[contains(@class, 'user from')]/a" + __new_message_preview_time = "//div[contains(@class, 'user from')]/time" + __new_message_preview_data_first_paragraph_content = "//div[@class='message']/p[1]" + __new_message_preview_data_first_paragraph_strong_content = ("//div[@class='message']/p[" + "1]/strong") + __new_message_preview_data_first_paragraph_italic_content = "//div[@class='message']/p[1]/em" + __new_message_numbered_list_items = "//div[@class='message']/ol/li" + __new_message_bulleted_list_items = "//div[@class='message']/ul/li" + __new_message_preview_external_link = "//a[contains(text(),'Test external link')]" + __new_message_preview_internal_link = "//a[contains(text(),'Test internal Link')]" + __new_message_preview_button = "//input[@id='preview-btn']" + + def __init__(self, page: Page): + super().__init__(page) + + def get_text_of_test_data_first_paragraph_text(self) -> str: + return super()._get_text_of_element( + self.__new_message_preview_data_first_paragraph_content) + + def get_text_of_test_data_first_p_strong_text(self) -> str: + return super()._get_text_of_element( + self.__new_message_preview_data_first_paragraph_strong_content) + + def get_text_of_test_data_first_p_italic_text(self) -> str: + return super()._get_text_of_element( + self.__new_message_preview_data_first_paragraph_italic_content) + + def get_text_of_numbered_list_items(self) -> list[str]: + return super()._get_text_of_elements(self.__new_message_numbered_list_items) + + def get_text_of_bulleted_list_items(self) -> list[str]: + return super()._get_text_of_elements(self.__new_message_bulleted_list_items) + + def get_text_of_message_preview_username(self) -> str: + return super()._get_text_of_element(self.__new_message_preview_username) + + def get_user_to_text(self) -> str: + return super()._get_text_of_element(self.__sent_message_page_to_user_text) + + def get_new_message_page_header_text(self) -> str: + return super()._get_text_of_element(self.__new_message_page_header) + + # def _get_search_for_a_user_dropdown_text(self) -> str: + # return super()._get_text_of_element(self.__search_for_a_user_option) + + def get_characters_remaining_text(self) -> str: + return super()._get_text_of_element(self.__new_message_textarea_remaining_characters) + + def get_characters_remaining_text_element(self) -> Locator: + return super()._get_element_locator(self.__new_message_textarea_remaining_characters) + + def get_text_of_new_message_preview_section(self) -> str: + return super()._get_text_of_element(self.__new_message_preview_section_content) + + def get_text_of_search_result_bolded_character(self) -> str: + return super()._get_text_of_element(self.__new_message_search_results_bolded_characters) + + def get_tet_of_search_results_text(self) -> list[str]: + return super()._get_text_of_elements(self.__new_message_search_results_text) + + def click_on_username_to_delete_button(self): + super()._click(self.__sent_message_page_to_user_delete_button) + + def click_on_new_message_cancel_button(self): + super()._click(self.__new_message_cancel_button) + + def click_on_new_message_preview_button(self): + super()._click(self.__new_message_preview_button) + + def click_on_new_message_send_button(self): + super()._click(self.__new_message_send_button) + + def click_on_a_searched_user(self, username: str): + xpath = f"//div[@class='name_search']/b[contains(text(), '{username}')]" + super()._click(xpath) + + def click_on_preview_internal_link(self): + super()._click(self.__new_message_preview_internal_link) + + def type_into_new_message_to_input_field(self, text: str): + super()._type(self.__new_message_to_input_field, text, 0) + + def fill_into_new_message_body_textarea(self, text: str): + super()._fill(self.__new_message_textarea_input_field, text) + + def type_into_new_message_body_textarea(self, text: str): + super()._type(self.__new_message_textarea_input_field, text, 0) + + def message_preview_section_element(self) -> Locator: + return super()._get_element_locator(self.__new_message_preview_section) + + def is_message_preview_time_displayed(self) -> bool: + return super()._is_element_visible(self.__new_message_preview_time) + + def new_message_preview_internal_link_test_data_element(self) -> Locator: + return super()._get_element_locator(self.__new_message_preview_internal_link) + + def new_message_preview_external_link_test_data_element(self) -> Locator: + return super()._get_element_locator(self.__new_message_preview_external_link) diff --git a/playwright_tests/pages/messaging_system_pages/sent_messages.py b/playwright_tests/pages/messaging_system_pages/sent_messages.py new file mode 100644 index 00000000000..937569deabd --- /dev/null +++ b/playwright_tests/pages/messaging_system_pages/sent_messages.py @@ -0,0 +1,106 @@ +from playwright.sync_api import Page, Locator, ElementHandle +from playwright_tests.core.basepage import BasePage + + +class SentMessagePage(BasePage): + __sent_messages_breadcrumbs = "//ol[@id='breadcrumbs']/li" + __sent_messages_page_header = "//h1[@class='sumo-page-subheading']" + __sent_messages_no_messages_message = "//article[@id='outbox']/p" + __sent_messages_delete_selected_button = "//button[contains(text(), 'Delete Selected')]" + __sent_messages_delete_page_delete_button = "//button[@name='delete']" + __sent_messages_delete_page_cancel_button = "//a[contains(text(), 'Cancel')]" + __sent_messages_page_message_banner_text = "//ul[@class='user-messages']/li/p" + __sent_message_page_message_banner_close_button = ("//button[@class='mzp-c-notification-bar" + "-button']") + __sent_messages = "//ol[@class='message-list']/li" + __sent_messages_section = "//ol[@class='message-list']" + __sent_messages_delete_button = "//ol[@class='message-list']/li/a[@class='delete']" + __sent_messages_delete_checkbox = ("//ol[@class='message-list']//a/ancestor::li/div[" + "contains(@class, 'field checkbox no-label')]/label") + + def __init__(self, page: Page): + super().__init__(page) + + def get_sent_messages_page_deleted_banner_text(self) -> str: + return super()._get_text_of_element(self.__sent_messages_page_message_banner_text) + + def get_sent_messages_page_header(self) -> str: + return super()._get_text_of_element(self.__sent_messages_page_header) + + def get_sent_messages_no_message_text(self) -> str: + return super()._get_text_of_element(self.__sent_messages_no_messages_message) + + def get_sent_message_subject(self, username: str) -> str: + xpath = (f"//ol[@class='message-list']//a[contains(text(),'{username}')]/ancestor::li/a[" + f"@class='read']") + return super()._get_text_of_element(xpath) + + # Need to update this def click_on_sent_messages_page_banner_close_button(self): Hitting the + # click twice because of an issue with closing the banner self._page.locator( + # self.__sent_message_page_message_banner_close_button).dispatch_event(type='click') + + def click_on_delete_selected_button(self): + super()._click(self.__sent_messages_delete_selected_button) + + def click_on_sent_message_delete_button(self, username: str): + xpath_to_hover = f"//ol[@class='message-list']//a[contains(text(),'{username}')]" + super()._hover_over_element(xpath_to_hover) + xpath_delete_button = (f"//ol[@class='message-list']//a[contains(text()," + f"'{username}')]/ancestor::li/a[" + f"@class='delete']") + super()._click(xpath_delete_button) + + def click_on_sent_message_sender_username(self, username: str): + xpath = f"//ol[@class='message-list']//a[contains(text(),'{username}')]" + super()._click(xpath) + + def sent_message_select_checkbox(self) -> list[ElementHandle]: + return super()._get_element_handles(self.__sent_messages_delete_checkbox) + + def click_on_sent_message_subject(self, username: str): + xpath = (f"//ol[@class='message-list']//a[contains(text(),'{username}')]/ancestor::li/a[" + f"@class='read']") + super()._click(xpath) + + def click_on_delete_page_delete_button(self): + super()._click(self.__sent_messages_delete_page_delete_button) + + def click_on_delete_page_cancel_button(self): + super()._click(self.__sent_messages_delete_page_cancel_button) + + def sent_messages(self, username: str) -> Locator: + return super()._get_element_locator(f"//ol[@class='message-list']//a[contains(text()," + f"'{username}')]") + + def sent_message_banner(self) -> Locator: + return super()._get_element_locator(self.__sent_messages_page_message_banner_text) + + def are_sent_messages_displayed(self) -> bool: + return super()._is_element_visible(self.__sent_messages_section) + + def delete_all_displayed_sent_messages(self): + sent_messages = super()._get_element_handles(self.__sent_messages) + counter = 0 + for i in range(len(sent_messages), 0, -1): + sent_messages = super()._get_element_handles(self.__sent_messages) + element = sent_messages[counter] + element.hover() + + sent_elements_delete_button = super()._get_element_handles( + self.__sent_messages_delete_button) + delete_button = sent_elements_delete_button[counter] + + delete_button.click() + self.click_on_delete_page_delete_button() + + def delete_all_sent_messages_via_delete_selected_button(self): + sent_messages_count = super()._get_element_handles(self.__sent_messages) + counter = 0 + for i in range(len(sent_messages_count)): + checkbox = self.sent_message_select_checkbox() + element = checkbox[counter] + element.click() + counter += 1 + + self.click_on_delete_selected_button() + self.click_on_delete_page_delete_button() diff --git a/playwright_tests/pages/product_solutions_pages/product_solutions_page.py b/playwright_tests/pages/product_solutions_pages/product_solutions_page.py new file mode 100644 index 00000000000..8ecf9c73dc8 --- /dev/null +++ b/playwright_tests/pages/product_solutions_pages/product_solutions_page.py @@ -0,0 +1,27 @@ +from playwright.sync_api import Page, ElementHandle +from playwright_tests.core.basepage import BasePage + + +class ProductSolutionsPage(BasePage): + __complete_progress_item = "//li[@class='progress--item is-complete']/a" + __complete_progress_item_label = ("//li[@class='progress--item is-complete']//span[" + "@class='progress--label']") + __current_progress_item = "//li[@class='progress--item is-current']/a" + __current_progress_item_label = ("//li[@class='progress--item is-current']//span[" + "@class='progress--label']") + __product_title_heading = "//span[@class='product-title-text']" + __product_solutions_find_help_searchbar = "//form[@id='question-search-masthead']/input" + __product_solutions_find_help_search_button = "//form[@id='question-search-masthead']/button" + __page_heading_intro_text = "//p[@class='page-heading--intro-text']" + __still_need_help_ask_now_button = "//a[@data-event-action='aaq']" + __featured_articles_cards = "//h2[contains(text(),'Featured Articles')]/../..//a" + __popular_topics_cards = "//h2[contains(text(),'Popular Topics')]/../..//a" + + def __init__(self, page: Page): + super().__init__(page) + + def click_ask_now_button(self): + super()._click(self.__still_need_help_ask_now_button) + + def is_product_solutions_page_header_displayed(self) -> ElementHandle: + return super()._get_element_handle(self.__product_title_heading) diff --git a/playwright_tests/pages/product_support_page.py b/playwright_tests/pages/product_support_page.py new file mode 100644 index 00000000000..f05eecaea7e --- /dev/null +++ b/playwright_tests/pages/product_support_page.py @@ -0,0 +1,15 @@ +from playwright.sync_api import Page, Locator +from playwright_tests.core.basepage import BasePage + + +class ProductSupportPage(BasePage): + __product_title = "//span[@class='product-title-text']" + + def __init__(self, page: Page): + super().__init__(page) + + def get_product_title_text(self) -> str: + return super()._get_text_of_element(self.__product_title) + + def product_product_title_element(self) -> Locator: + return super()._get_element_locator(self.__product_title) diff --git a/playwright_tests/pages/sumo_pages.py b/playwright_tests/pages/sumo_pages.py new file mode 100644 index 00000000000..3be65e49464 --- /dev/null +++ b/playwright_tests/pages/sumo_pages.py @@ -0,0 +1,93 @@ +from playwright.sync_api import Page + +from playwright_tests.flows.aaq_flows.aaq_flow import AAQFlow +from playwright_tests.flows.article_flows.add_kb_article_flow import AddKbArticleFlow +from playwright_tests.flows.auth_flows.auth_flow import AuthFlowPage +from playwright_tests.flows.messaging_system_flows.messaging_system_flow import ( + MessagingSystemFlows) +from playwright_tests.flows.user_profile_flows.edit_profile_data_flow import EditProfileDataFlow +from playwright_tests.pages.articles.kb_article_page import KBArticlePage +from playwright_tests.pages.articles.kb_article_show_history_page import KBArticleShowHistoryPage +from playwright_tests.pages.auth_page import AuthPage +from playwright_tests.pages.contribute_pages.contribute_page import ContributePage +from playwright_tests.pages.contribute_pages.ways_to_contribute_pages import WaysToContributePages +from playwright_tests.pages.footer import FooterSection +from playwright_tests.pages.homepage import Homepage +from playwright_tests.pages.messaging_system_pages.inbox_page import InboxPage +from playwright_tests.pages.messaging_system_pages.mess_system_user_navbar import ( + MessagingSystemUserNavbar) +from playwright_tests.pages.messaging_system_pages.new_message import NewMessagePage +from playwright_tests.pages.messaging_system_pages.sent_messages import SentMessagePage +from playwright_tests.pages.product_support_page import ProductSupportPage +from playwright_tests.pages.top_navbar import TopNavbar +from playwright_tests.pages.user_pages.my_profile_answers_page import MyProfileAnswersPage +from playwright_tests.pages.user_pages.my_profile_documents_page import MyProfileDocumentsPage +from playwright_tests.pages.user_pages.my_profile_edit import MyProfileEdit +from playwright_tests.pages.user_pages.my_profile_edit_contribution_areas_page import ( + MyProfileEditContributionAreasPage) +from playwright_tests.pages.user_pages.my_profile_edit_settings_page import ( + MyProfileEditSettingsPage) +from playwright_tests.pages.user_pages.my_profile_my_questions_page import MyProfileMyQuestionsPage +from playwright_tests.pages.user_pages.my_profile_page import MyProfilePage +from playwright_tests.pages.user_pages.my_profile_user_navbar import UserNavbar +from playwright_tests.pages.user_questions_pages.questions_page import QuestionPage + + +class SumoPages: + def __init__(self, page: Page): + # Auth Page. + self.auth_page = AuthPage(page) + + # Homepage. + self.homepage = Homepage(page) + + # Ways to contribute pages. + self.ways_to_contribute_pages = WaysToContributePages(page) + + # Footer. + self.footer_section = FooterSection(page) + + # top-navbar. + self.top_navbar = TopNavbar(page) + + # Profile pages. + self.my_profile_page = MyProfilePage(page) + self.my_answers_page = MyProfileAnswersPage(page) + self.my_questions_page = MyProfileMyQuestionsPage(page) + self.question_page = QuestionPage(page) + self.my_documents_page = MyProfileDocumentsPage(page) + self.edit_my_profile_page = MyProfileEdit(page) + self.edit_my_profile_settings_page = MyProfileEditSettingsPage(page) + self.edit_my_profile_con_areas_page = MyProfileEditContributionAreasPage(page) + self.user_navbar = UserNavbar(page) + + # Messaging System. + self.sent_message_page = SentMessagePage(page) + self.new_message_page = NewMessagePage(page) + self.inbox_page = InboxPage(page) + self.mess_system_user_navbar = MessagingSystemUserNavbar(page) + + # Contribute page. + self.contribute_page = ContributePage(page) + + # KB Articles. + self.kb_article_page = KBArticlePage(page) + self.kb_article_show_history_page = KBArticleShowHistoryPage(page) + + # Product Support page. + self.product_support_page = ProductSupportPage(page) + + # Auth flow Page. + self.auth_flow_page = AuthFlowPage(page) + + # AAQ Flow. + self.aaq_flow = AAQFlow(page) + + # Messaging System Flows. + self.messaging_system_flow = MessagingSystemFlows(page) + + # Edit profile flow + self.edit_profile_flow = EditProfileDataFlow(page) + + # KB article Flow + self.submit_kb_article_flow = AddKbArticleFlow(page) diff --git a/playwright_tests/pages/top_navbar.py b/playwright_tests/pages/top_navbar.py new file mode 100644 index 00000000000..f7e290978d8 --- /dev/null +++ b/playwright_tests/pages/top_navbar.py @@ -0,0 +1,87 @@ +from playwright.sync_api import Page, ElementHandle, Locator +from playwright_tests.core.basepage import BasePage + + +class TopNavbar(BasePage): + __menu_titles = "//div[@id='main-navigation']//a[contains(@class,'mzp-c-menu-title')]" + __sumo_nav_logo = "//div[@class='sumo-nav--logo']/a/img" + + # Get Help option + __get_help_option = ("//li[@class='mzp-c-menu-category mzp-has-drop-down " + "mzp-js-expandable']/a[contains(text(), 'Get Help')]") + + # Sub menu items ask a Question section + __ask_a_question_option = "//h4[contains(text(),'Ask a Question')]/parent::a" + __aaq_firefox_browser_option = ("//div[@id='main-navigation']//h4[contains(text(), 'Ask a " + "Question')]/../..//a[contains(text(),'Firefox Browser')]") + # Contribute Tools + __contribute_option = "//a[contains(text(),'Contribute')]" + + # Sign in button + __signin_signup_button = "//div[@id='profile-navigation']//a[@data-event-label='Sign In']" + + # Signed in options + __signed_in_username = "//span[@class='sumo-nav--username']" + __signed_in_view_profile_option = "//h4[contains(text(), 'View Profile')]/parent::a" + __signed_in_edit_profile_option = "//a[contains(text(),'Edit Profile')]" + __signed_in_my_questions_option = ("//div[@class='sumo-nav--dropdown-thirds']//a[contains(" + "text(), 'My Questions')]") + __signed_in_settings_option = "//h4[contains(text(), 'Settings')]/parent::a" + __signed_in_inbox_option = "//h4[contains(text(), 'Inbox')]/parent::a" + __sign_out_button = "//a[@data-event-label='Sign Out']" + + def __init__(self, page: Page): + super().__init__(page) + + # Support logo + def get_sumo_nav_logo(self) -> ElementHandle: + return super()._get_element_handle(self.__sumo_nav_logo) + + def click_on_sumo_nav_logo(self): + super()._click(self.__sumo_nav_logo) + + def get_available_menu_titles(self) -> list[str]: + return super()._get_text_of_elements(self.__menu_titles) + + # Contribute Tools + def click_on_contribute_top_navbar_option(self): + super()._click(self.__contribute_option) + + # Sign in option + def click_on_signin_signup_button(self): + super()._click(self.__signin_signup_button) + + # Profile options + def click_on_view_profile_option(self): + super()._hover_over_element(self.__signed_in_username) + super()._click(self.__signed_in_view_profile_option) + + def click_on_edit_profile_option(self): + super()._hover_over_element(self.__signed_in_username) + super()._click(self.__signed_in_edit_profile_option) + + def click_on_settings_profile_option(self): + super()._hover_over_element(self.__signed_in_username) + super()._click(self.__signed_in_settings_option) + + def click_on_inbox_option(self): + super()._hover_over_element(self.__signed_in_username) + super()._click(self.__signed_in_inbox_option) + + def click_on_sign_out_button(self): + super()._hover_over_element(self.__signed_in_username) + super()._click(self.__sign_out_button) + + def click_on_my_questions_profile_option(self): + super()._hover_over_element(self.__signed_in_username) + super()._click(self.__signed_in_my_questions_option) + + def click_on_ask_a_question_firefox_browser_option(self): + super()._hover_over_element(self.__get_help_option) + super()._click(self.__aaq_firefox_browser_option) + + def get_text_of_logged_in_username(self) -> str: + return super()._get_text_of_element(self.__signed_in_username) + + def sign_in_up_button_displayed_element(self) -> Locator: + return super()._get_element_locator(self.__signin_signup_button) diff --git a/playwright_tests/pages/user_pages/my_profile_answers_page.py b/playwright_tests/pages/user_pages/my_profile_answers_page.py new file mode 100644 index 00000000000..7bc45100e69 --- /dev/null +++ b/playwright_tests/pages/user_pages/my_profile_answers_page.py @@ -0,0 +1,25 @@ +from playwright.sync_api import Page +from playwright_tests.core.basepage import BasePage + + +class MyProfileAnswersPage(BasePage): + __my_answers_page_header = "//h2[@class='sumo-page-subheading']" + __my_answers_question_subject_links = "//article[@id='profile']//li/a" + + def __init__(self, page: Page): + super().__init__(page) + + def get_page_header(self) -> str: + return super()._get_text_of_element(self.__my_answers_page_header) + + def get_text_of_question_subjects(self) -> list[str]: + return super()._get_text_of_elements(self.__my_answers_question_subject_links) + + def click_on_specific_answer(self, answer_id: str): + xpath = f"//article[@id='profile']//a[contains(@href, '{answer_id}')]" + super()._click(xpath) + + def get_my_answer_text(self, answer_id: str) -> str: + xpath = (f"//article[@id='profile']//a[contains(@href, '{answer_id}')]/following-sibling" + f"::blockquote") + return super()._get_text_of_element(xpath) diff --git a/playwright_tests/pages/user_pages/my_profile_documents_page.py b/playwright_tests/pages/user_pages/my_profile_documents_page.py new file mode 100644 index 00000000000..8e0a3cff6eb --- /dev/null +++ b/playwright_tests/pages/user_pages/my_profile_documents_page.py @@ -0,0 +1,16 @@ +from playwright.sync_api import Page +from playwright_tests.core.basepage import BasePage + + +class MyProfileDocumentsPage(BasePage): + __documents_link_list = "//main//a" + + def __init__(self, page: Page): + super().__init__(page) + + def click_on_a_particular_document(self, document_name: str): + xpath = f"//main//a[contains(text(),'{document_name}')]" + super()._click(xpath) + + def get_text_of_document_links(self) -> list[str]: + return super()._get_text_of_elements(self.__documents_link_list) diff --git a/playwright_tests/pages/user_pages/my_profile_edit.py b/playwright_tests/pages/user_pages/my_profile_edit.py new file mode 100644 index 00000000000..61f4c3b1304 --- /dev/null +++ b/playwright_tests/pages/user_pages/my_profile_edit.py @@ -0,0 +1,214 @@ +from playwright.sync_api import Page, Locator +from playwright_tests.core.basepage import BasePage + + +class MyProfileEdit(BasePage): + # Access denied section + __access_denied_main_header = "//article[@id='error-page']/h1" + __access_denied_subheading_message = "//div[@class='center-on-mobile']/p" + + # Navbar section + __my_profile_user_navbar_options = "//ul[@id='user-nav']/li/a" + __my_profile_user_navbar_selected_element = "//a[@class='selected']" + + # Edit profile page + __edit_my_profile_edit_input_form = "//article[@id='edit-profile']/form" + __edit_my_profile_main_header = "//h1[@class='sumo-page-heading']" + __manage_firefox_account_button = "//a[contains(text(),'Manage account')]" + __username_input_field = "//input[@id='id_username']" + __username_error_message = ("//input[@id='id_username']/following-sibling::span[contains(" + "@class, 'form-error is-visible')]") + __display_name_input_field = "//input[@id='id_name']" + __biography_textarea_field = "//textarea[@id='id_bio']" + __make_email_visible_to_logged_in_users_checkbox = "//label[@for='id_public_email']" + __website_input_field = "//input[@id='id_website']" + __twitter_username_field = "//input[@id='id_twitter']" + __community_portal_username_field = "//input[@id='id_community_mozilla_org']" + __people_directory_username_field = "//input[@id='id_people_mozilla_org']" + __matrix_nickname_field = "//input[@id='id_matrix_handle']" + __country_dropdown = "//select[@id='id_country']" + __city_field = "//input[@id='id_city']" + __timezone_dropdown = "#id_timezone" + __preferred_locale_dropdown = "//select[@id='id_locale']" + __involved_with_mozilla_from_month = "//select[@id='id_involved_from_month']" + __involved_with_mozilla_from_year = "//select[@id='id_involved_from_year']" + __cancel_button = "//button[contains(text(),'Cancel')]" + __update_my_profile_button = "//button[contains(text(),'Update My Profile')]" + __close_account_and_delete_all_profile_information_link = "//p[@class='delete-account-link']/a" + __all_input_edit_profile_input_fields = ("//form[not(contains(@action, " + "'/en-US/users/close_account'))]/div[" + "@class='field']/input[not(contains(@id, " + "'id_username'))]") + + def __init__(self, page: Page): + super().__init__(page) + + def get_access_denied_header_text(self) -> str: + return super()._get_text_of_element(self.__access_denied_main_header) + + def get_access_denied_subheading_text(self) -> str: + return super()._get_text_of_element(self.__access_denied_subheading_message) + + def get_value_of_all_input_fields(self) -> list[str]: + elements = super()._get_element_handles(self.__all_input_edit_profile_input_fields) + values = [] + for el in elements: + values.append(el.input_value()) + + return values + + def get_timezone_select_value(self) -> str: + return super()._get_element_inner_text_from_page("#id_timezone [selected]") + + def get_preferred_locale_select_value(self) -> str: + return super()._get_element_inner_text_from_page('#id_locale [selected]') + + # Above not working trying to find a different solution + + def get_involved_with_mozilla_month_select_value(self) -> str: + return super()._get_text_of_element(self.__involved_with_mozilla_from_month) + # return super()._get_select_chosen_option(self.__involved_with_mozilla_from_month) + + def get_involved_with_mozilla_year_select_value(self) -> str: + return super()._get_text_of_element(self.__involved_with_mozilla_from_year) + # return super()._get_select_chosen_option(self.__involved_with_mozilla_from_year) + + def get_value_of_all_fields(self) -> list[str]: + values = [ + self.get_value_of_all_input_fields(), + self.get_timezone_select_value(), + self.get_preferred_locale_select_value(), + self.get_involved_with_mozilla_month_select_value(), + self.get_involved_with_mozilla_year_select_value(), + ] + return values + + def get_username_input_field_value(self) -> str: + return super()._get_element_input_value(self.__username_input_field) + + def get_username_error_message_text(self) -> str: + return super()._get_text_of_element(self.__username_error_message) + + def get_display_name_input_field_value(self) -> str: + return super()._get_element_input_value(self.__display_name_input_field) + + def get_website_input_field_value(self) -> str: + return super()._get_element_input_value(self.__website_input_field) + + def get_twitter_input_field_value(self) -> str: + return super()._get_element_input_value(self.__twitter_username_field) + + def get_community_portal_field_value(self) -> str: + return super()._get_element_input_value(self.__community_portal_username_field) + + def get_people_directory_field_value(self) -> str: + return super()._get_element_input_value(self.__people_directory_username_field) + + def get_matrix_username_field_value(self) -> str: + return super()._get_element_input_value(self.__matrix_nickname_field) + + def get_city_field_value(self) -> str: + return super()._get_element_input_value(self.__city_field) + + def send_text_to_username_field(self, text: str): + super()._fill(self.__username_input_field, text) + + def send_text_to_display_name_field(self, text: str): + super()._fill(self.__display_name_input_field, text) + + def send_text_to_biography_field(self, text: str): + super()._fill(self.__biography_textarea_field, text) + + def send_text_to_website_field(self, text: str): + super()._fill(self.__website_input_field, text) + + def send_text_to_twitter_username_field(self, text: str): + super()._fill(self.__twitter_username_field, text) + + def send_text_to_community_portal_field(self, text: str): + super()._fill(self.__community_portal_username_field, text) + + def send_text_to_people_directory_username(self, text: str): + 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) + + def sent_text_to_city_field(self, text: str): + super()._fill(self.__city_field, text) + + def select_country_dropdown_option_by_value(self, option_value: str): + super()._select_option_by_value(self.__country_dropdown, option_value) + + def select_timezone_dropdown_option_by_value(self, option_value: str): + super()._select_option_by_value(self.__timezone_dropdown, option_value) + + def select_preferred_language_dropdown_option_by_value(self, option_value: str): + super()._select_option_by_value(self.__preferred_locale_dropdown, option_value) + + def select_involved_from_month_option_by_value(self, option_value: str): + super()._select_option_by_value(self.__involved_with_mozilla_from_month, option_value) + + def select_involved_from_year_option_by_value(self, option_value: str): + super()._select_option_by_value(self.__involved_with_mozilla_from_year, option_value) + + def clear_all_input_fields(self): + for element in super()._get_element_handles(self.__all_input_edit_profile_input_fields): + element.fill("") + + def clear_biography_textarea_field(self): + super()._clear_field(self.__biography_textarea_field) + + def clear_username_field(self): + super()._clear_field(self.__username_input_field) + + def clear_display_name_field(self): + super()._clear_field(self.__display_name_input_field) + + def clear_website_field(self): + super()._clear_field(self.__website_input_field) + + def clear_twitter_field(self): + super()._clear_field(self.__twitter_username_field) + + def clear_community_portal_field(self): + super()._clear_field(self.__community_portal_username_field) + + def clear_people_directory_field(self): + super()._clear_field(self.__people_directory_username_field) + + def clear_matrix_field(self): + super()._clear_field(self.__matrix_nickname_field) + + def clear_country_dropdown_field(self): + super()._select_option_by_value(self.__country_dropdown, "") + + def clear_city_field(self): + super()._clear_field(self.__city_field) + + def clear_involved_from_month_select_field(self): + super()._select_option_by_value(self.__involved_with_mozilla_from_month, "0") + + def clear_involved_from_year_select_field(self): + super()._select_option_by_value(self.__involved_with_mozilla_from_year, "0") + + def click_cancel_button(self): + super()._click(self.__cancel_button) + + def click_update_my_profile_button(self): + super()._click(self.__update_my_profile_button) + + def click_close_account_option(self): + super()._click(self.__close_account_and_delete_all_profile_information_link) + + def click_manage_firefox_account_button(self): + super()._click_without_wait(self.__manage_firefox_account_button) + + def click_make_email_visible_checkbox(self): + super()._click(self.__make_email_visible_to_logged_in_users_checkbox) + + def is_make_email_visible_checkbox_selected(self) -> bool: + return super()._is_checkbox_checked(self.__make_email_visible_to_logged_in_users_checkbox) + + def is_my_profile_edit_form_displayed(self) -> Locator: + return super()._get_element_locator(self.__edit_my_profile_edit_input_form) diff --git a/playwright_tests/pages/user_pages/my_profile_edit_contribution_areas_page.py b/playwright_tests/pages/user_pages/my_profile_edit_contribution_areas_page.py new file mode 100644 index 00000000000..8b5ec7d95e1 --- /dev/null +++ b/playwright_tests/pages/user_pages/my_profile_edit_contribution_areas_page.py @@ -0,0 +1,97 @@ +from playwright.sync_api import Page, Locator +from playwright_tests.core.basepage import BasePage + + +class MyProfileEditContributionAreasPage(BasePage): + __edit_contribution_areas_page_header = "//h3[@class='sumo-page-heading']" + __edit_contribution_areas_checkboxes = "//input[@type='checkbox']" + __edit_contribution_areas_kb_contributors = "//input[@value='kb-contributors']" + __edit_contribution_areas_l10n_contributors = "//input[@value='l10n-contributors']" + __edit_contribution_areas_forum_contributors = "//input[@value='forum-contributors']" + __edit_contribution_areas_social_media_contributors = "//input[@value='social-contributors']" + __edit_contribution_areas_mobile_support_contributors = "//input[@value='mobile-contributors']" + __edit_contribution_areas_checkbox_labels = "//input[@type='checkbox']/parent::label" + __edit_contribution_areas_update_button = ("//article[@id='edit-contributions']/form//button[" + "@type='submit']") + __edit_contribution_areas_preferences_saved_banner = "//ul[@class='user-messages']/li" + __edit_contribution_areas_preferences_saved_banner_text = "//ul[@class='user-messages']/li/p" + __edit_contribution_areas_preferences_saved_banner_close_button = ("//ul[@class='user" + "-messages']/li/button") + + def __init__(self, page: Page): + super().__init__(page) + + def _edit_con_areas_pref_banner_txt(self) -> str: + return super()._get_text_of_element( + self.__edit_contribution_areas_preferences_saved_banner_text) + + def _get_edit_contribution_areas_page_header(self) -> str: + return super()._get_text_of_element(self.__edit_contribution_areas_page_header) + + def _get_contrib_areas_checkbox_labels(self) -> set[str]: + initial_list = set( + super()._get_text_of_elements(self.__edit_contribution_areas_checkbox_labels) + ) + normalized_list = set( + [ + item.lower() + .replace(" ", "-") + .replace("media", "") + .replace("support", "") + .replace("--", "-") + [1:] + for item in initial_list + ] + ) + return normalized_list + + def _click_on_update_contribution_areas_button(self): + super()._click(self.__edit_contribution_areas_update_button) + + def _click_on_unchecked_cont_areas_checkboxes(self): + for checkbox in super()._get_element_handles(self.__edit_contribution_areas_checkboxes): + if not checkbox.is_checked(): + checkbox.click() + + def _click_on_all_checked_cont_areas_checkboxes(self): + for checkbox in super()._get_element_handles(self.__edit_contribution_areas_checkboxes): + if checkbox.is_checked(): + checkbox.click() + + def _click_on_edit_cont_pref_banner_close_button(self): + super()._click(self.__edit_contribution_areas_preferences_saved_banner_close_button) + + def _is_edit_cont_pref_banner_displayed(self) -> Locator: + return super()._get_element_locator( + self.__edit_contribution_areas_preferences_saved_banner) + + def _is_kb_contributors_checkbox_checked(self) -> bool: + return super()._is_checkbox_checked(self.__edit_contribution_areas_kb_contributors) + + def _is_l10n_contributors_checkbox_checked(self) -> bool: + return super()._is_checkbox_checked(self.__edit_contribution_areas_l10n_contributors) + + def _is_forum_contributors_checkbox_checked(self) -> bool: + return super()._is_checkbox_checked(self.__edit_contribution_areas_forum_contributors) + + def _is_social_media_contributors_checkbox_checked(self) -> bool: + return super()._is_checkbox_checked( + self.__edit_contribution_areas_social_media_contributors) + + 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: + is_checked = [ + self._is_kb_contributors_checkbox_checked(), + self._is_l10n_contributors_checkbox_checked(), + self._is_forum_contributors_checkbox_checked(), + self._is_social_media_contributors_checkbox_checked(), + self._is_mobile_support_contributors_checkbox_checked(), + ] + + if False in is_checked: + return False + else: + return True diff --git a/playwright_tests/pages/user_pages/my_profile_edit_settings_page.py b/playwright_tests/pages/user_pages/my_profile_edit_settings_page.py new file mode 100644 index 00000000000..c1b2ead7204 --- /dev/null +++ b/playwright_tests/pages/user_pages/my_profile_edit_settings_page.py @@ -0,0 +1,151 @@ +from playwright.sync_api import Page, Locator +from playwright_tests.core.basepage import BasePage + + +class MyProfileEditSettingsPage(BasePage): + __edit_settings_page_header = "//h3[@class='sumo-page-heading']" + __edit_settings_checkbox_options_label = "//div[@class='field checkbox']/label" + __watch_forum_threads_I_start_checkbox = ("//input[@id='id_forums_watch_new_thread" + "']/following-sibling::label") + __watch_forum_threads_I_comment_in_checkbox = ("//input[@id='id_forums_watch_after_reply" + "']/following-sibling::label") + __watch_kb_discussions_threads_I_start_checkbox = ( + "//input[@id='id_kbforums_watch_new_thread']/following-sibling::label") + __watch_kb_discussion_threads_I_comment_in_checkbox = ( + "//input[@id='id_kbforums_watch_after_reply']/following-sibling::label") + __watch_question_threads_I_comment_in_checkbox = ( + "//input[@id='id_questions_watch_after_reply']/following-sibling::label") + __send_emails_for_private_messages_checkbox = ("//input[@id='id_email_private_messages" + "']/following-sibling::label") + __edit_settings_update_button = "//article[@id='edit-settings']/form//button[@type='submit']" + __your_settings_have_been_saved_notification_banner = "//ul[@class='user-messages']//li" + __your_settings_have_been_saved_notification_banner_text = "//ul[@class='user-messages']//li/p" + __your_settings_have_been_saved_notification_banner_close_button = ("//ul[@class='user" + "-messages']//button") + __my_profile_user_navbar = "//ul[@id='user-nav']/li" + __my_profile_user_navbar_selected_element = "//a[@class='selected']" + + def __init__(self, page: Page): + super().__init__(page) + + def get_edit_settings_page_header(self) -> str: + return super()._get_text_of_element(self.__edit_settings_page_header) + + def get_text_of_checkbox_options(self) -> list[str]: + return super()._get_text_of_elements(self.__edit_settings_checkbox_options_label) + + def settings_saved_notif_banner_txt(self) -> str: + return super()._get_text_of_element( + self.__your_settings_have_been_saved_notification_banner_text) + + def click_settings_saved_notification_banner(self): + super()._click(self.__your_settings_have_been_saved_notification_banner_close_button) + + def click_on_all_settings_checkboxes(self): + for checkbox in super()._get_element_handles(self.__edit_settings_checkbox_options_label): + checkbox.click() + + def click_on_watch_forum_threads_i_start_checkbox(self): + super()._click(self.__watch_forum_threads_I_start_checkbox) + + def click_on_watch_forum_threads_i_comment_in_checkbox(self): + super()._click(self.__watch_forum_threads_I_comment_in_checkbox) + + def click_on_watch_kb_discussions_threads_i_start_checkbox(self): + super()._click(self.__watch_kb_discussions_threads_I_start_checkbox) + + def click_on_watch_kb_discussions_threads_i_comment_checkbox(self): + super()._click(self.__watch_kb_discussion_threads_I_comment_in_checkbox) + + def click_on_watch_question_threads_i_comment(self): + super()._click(self.__watch_question_threads_I_comment_in_checkbox) + + def click_on_send_emails_for_private_messages(self): + super()._click(self.__send_emails_for_private_messages_checkbox) + + def click_on_update_button(self): + super()._click(self.__edit_settings_update_button) + + def is_watch_forum_threads_i_start_checkbox_checked(self) -> bool: + return super()._is_checkbox_checked(self.__watch_forum_threads_I_start_checkbox) + + # checkbox_background_color = super()._get_css_value_of_pseudo_html_element( + # "label[" 'for="id_forums_watch_new_thread"]', ":before", "background-color" + # ) + # if checkbox_background_color == EditSettingsPageMessages.CHECKBOX_CHECKED_COLOR: + # return True + # else: + # return False + + def is_watch_forum_threads_i_comment_checkbox_checked(self) -> bool: + return super()._is_checkbox_checked(self.__watch_forum_threads_I_comment_in_checkbox) + + # checkbox_background_color = super()._get_css_value_of_pseudo_html_element( + # "label[" 'for="id_forums_watch_after_reply"]', ":before", "background-color" + # ) + # if checkbox_background_color == EditSettingsPageMessages.CHECKBOX_CHECKED_COLOR: + # return True + # else: + # return False + + def is_watch_kb_discussion_threads_i_start_checkbox_checked(self) -> bool: + return super()._is_checkbox_checked(self.__watch_kb_discussions_threads_I_start_checkbox) + # checkbox_background_color = super()._get_css_value_of_pseudo_html_element( + # "label[" 'for="id_kbforums_watch_new_thread"]', ":before", "background-color" + # ) + # if checkbox_background_color == EditSettingsPageMessages.CHECKBOX_CHECKED_COLOR: + # return True + # else: + # return False + + def is_watch_kb_discussion_threads_i_comment_checkbox_checked(self) -> bool: + return super()._is_checkbox_checked( + self.__watch_kb_discussion_threads_I_comment_in_checkbox) + # checkbox_background_color = super()._get_css_value_of_pseudo_html_element( + # "label[" 'for="id_kbforums_watch_after_reply"]', ":before", "background-color" + # ) + # if checkbox_background_color == EditSettingsPageMessages.CHECKBOX_CHECKED_COLOR: + # return True + # else: + # return False + + def is_watch_question_threads_i_comment_checkbox_checked(self) -> bool: + return super()._is_checkbox_checked(self.__watch_question_threads_I_comment_in_checkbox) + # checkbox_background_color = super()._get_css_value_of_pseudo_html_element( + # "label[" 'for="id_questions_watch_after_reply"]', ":before", "background-color" + # ) + # if checkbox_background_color == EditSettingsPageMessages.CHECKBOX_CHECKED_COLOR: + # return True + # else: + # return False + + def is_send_emails_for_private_messages_checkbox_checked(self) -> bool: + return super()._is_checkbox_checked(self.__send_emails_for_private_messages_checkbox) + # checkbox_background_color = super()._get_css_value_of_pseudo_html_element( + # "label[" 'for="id_email_private_messages"]', ":before", "background-color" + # ) + # if checkbox_background_color == EditSettingsPageMessages.CHECKBOX_CHECKED_COLOR: + # return True + # else: + # return False + + def notification_banner_element(self) -> Locator: + return super()._get_element_locator( + self.__your_settings_have_been_saved_notification_banner) + + def are_all_checkbox_checked(self) -> bool: + is_checked = [ + self.is_watch_forum_threads_i_start_checkbox_checked(), + self.is_watch_forum_threads_i_comment_checkbox_checked(), + self.is_watch_kb_discussion_threads_i_start_checkbox_checked(), + self.is_watch_kb_discussion_threads_i_comment_checkbox_checked(), + self.is_watch_question_threads_i_comment_checkbox_checked(), + self.is_watch_question_threads_i_comment_checkbox_checked(), + self.is_watch_question_threads_i_comment_checkbox_checked(), + self.is_send_emails_for_private_messages_checkbox_checked(), + ] + + if False in is_checked: + return False + else: + return True diff --git a/playwright_tests/pages/user_pages/my_profile_my_questions_page.py b/playwright_tests/pages/user_pages/my_profile_my_questions_page.py new file mode 100644 index 00000000000..b2625b978ca --- /dev/null +++ b/playwright_tests/pages/user_pages/my_profile_my_questions_page.py @@ -0,0 +1,32 @@ +from playwright.sync_api import Page, Locator +from playwright_tests.core.basepage import BasePage + + +class MyProfileMyQuestionsPage(BasePage): + __my_profile_my_questions_page_heading = "//h2[@class='sumo-page-subheading']" + __my_profile_my_questions_no_question_message = "//article[@id='profile']/p" + __my_profile_my_questions_list = "//article[@id='profile']/ul/a" + __my_profile_my_questions_titles = "//article[@id='profile']/ul/a/li" + + def __init__(self, page: Page): + super().__init__(page) + + def is_question_list_displayed(self) -> Locator: + return super()._get_element_locator(self.__my_profile_my_questions_list) + + def is_no_question_message_displayed(self) -> Locator: + return super()._get_element_locator(self.__my_profile_my_questions_no_question_message) + + def get_text_of_no_question_message(self) -> str: + return super()._get_text_of_element(self.__my_profile_my_questions_no_question_message) + + def get_number_of_questions(self) -> int: + return len(super()._get_element_handles(self.__my_profile_my_questions_list)) + + def click_on_a_question_by_index(self, index_of_question: int): + xpath = f"//article[@id='profile']/ul/a[{index_of_question}]/li" + super()._click(xpath) + + def get_text_of_first_listed_question(self) -> str: + xpath = "//article[@id='profile']/ul/a[1]" + return super()._get_element_inner_text_from_page(xpath) diff --git a/playwright_tests/pages/user_pages/my_profile_page.py b/playwright_tests/pages/user_pages/my_profile_page.py new file mode 100644 index 00000000000..973e43229f2 --- /dev/null +++ b/playwright_tests/pages/user_pages/my_profile_page.py @@ -0,0 +1,200 @@ +from playwright.sync_api import Page, ElementHandle, Locator +from playwright_tests.core.basepage import BasePage + + +class MyProfilePage(BasePage): + # Sidebar + __my_profile_user_navbar_options = "//ul[@id='user-nav']/li/a" + __my_profile_user_navbar_selected_element = "//a[@class='selected']" + + # Admin/other user actions + __edit_user_profile_option = ("//div[@id='admin-actions']/a[contains(text(), 'Edit user " + "profile')]") + __report_abuse_profile_option = "//article[@id='profile']/a[contains(text(), 'Report Abuse')]" + __deactivate_this_user_button = "//input[@value='Deactivate this user']" + __deactivate_this_user_and_mark_all_content_as_spam = ("//input[@value='Deactivate this user " + "and mark all content as spam']") + __private_message_button = "//p[@class='pm']/a" + + # Report Abuse + __report_abuse_panel = "//section[@id='report-abuse']" + __spam_or_other_unrelated_content_option = ("//label[contains(text(),'Spam or other unrelated " + "content')]") + __inappropriate_language_or_dialog_option = ("//label[contains(text(),'Inappropriate " + "language/dialog')]") + __other_please_specify_option = "//label[contains(text(),'Other (please specify)')]" + __have_more_to_say_textarea = "//textarea[@name='other']" + __report_abuse_close_panel_button = "//div[@class='mzp-c-modal-close']/button" + __report_abuse_submit_button = "//section[@id='report-abuse']//button[@type='submit']" + __reported_user_confirmation_message = "//span[@class='message']" + + # Contributions section + __my_profile_contributions_questions_link = ("//section[@class='contributions']//a[contains(" + "text(), 'question')]") + __my_profile_contributions_answers_link = ("//section[@class='contributions']//a[contains(" + "text(), 'answer')]") + __my_profile_provided_solutions_text = ("//section[@class='contributions']//li[contains(text(" + "),'solution')]") + __my_profile_provided_documents_link = ("//section[@class='contributions']//a[contains(text(" + "),'document')]") + + # My Profile page details + __my_profile_page_header = "//h1[@class='sumo-page-heading']" + __my_profile_page_subheading = ("//article[@id='profile']/h2[contains(@class, " + "'sumo-page-subheading')]") + __my_profile_email_address = "//p/strong" + __my_profile_displayed_email_address = ("//li[@class='avatar-group--details-item']/span[" + "@class='email']/a") + __my_profile_sign_out_button = "//article[@id='profile']//a[@data-event-label='Sign Out']" + __my_profile_display_name_header = "//h2[@class='sumo-callout-heading user']" + __my_profile_username_info = "//span[@class='username']" + __my_profile_location_info = "//h2[contains(@class,'location')]" + __my_profile_website_info = "//label[contains(text(), 'Website')]/following-sibling::a" + __my_profile_twitter_info = "//label[contains(text(), 'Twitter')]/following-sibling::a" + __my_profile_community_portal_info = ("//label[contains(text(), 'Community " + "Portal')]/following-sibling::a") + __my_profile_people_directory_info = ("//label[contains(text(), 'People " + "Directory')]/following-sibling::a") + __my_profile_matrix_info = "//label[contains(text(),'Matrix')]/parent::li" + __my_profile_contributed_from_info = "//section[@class='contributions']//li[1]" + __my_profile_bio_info = "//section[@class='bio']/p" + __my_profile_groups_section = "//section[@class='groups']" + __my_profile_groups_heading = "//section[@class='groups']/h2" + __my_profile_groups_list_items = "//section[@class='groups']/ul/li" + + def __init__(self, page: Page): + super().__init__(page) + + def get_my_profile_display_name_header_text(self) -> str: + return super()._get_text_of_element(self.__my_profile_display_name_header) + + def get_my_profile_display_name_username_text(self) -> str: + return super()._get_text_of_element(self.__my_profile_username_info) + + def get_my_profile_location_text(self) -> str: + return super()._get_text_of_element(self.__my_profile_location_info) + + def get_my_profile_website_text(self) -> str: + return super()._get_text_of_element(self.__my_profile_website_info) + + def get_my_profile_twitter_text(self) -> str: + return super()._get_text_of_element(self.__my_profile_twitter_info) + + def get_my_profile_community_portal_text(self) -> str: + return super()._get_text_of_element(self.__my_profile_community_portal_info) + + def get_my_profile_people_directory_text(self) -> str: + return super()._get_text_of_element(self.__my_profile_people_directory_info) + + def get_my_profile_matrix_text(self) -> str: + return super()._get_text_of_element(self.__my_profile_matrix_info) + + def get_my_contributed_from_text(self) -> str: + return super()._get_text_of_element(self.__my_profile_contributed_from_info) + + def get_my_profile_bio_text(self) -> str: + return super()._get_text_of_element(self.__my_profile_bio_info) + + def get_my_profile_page_header(self) -> str: + return super()._get_text_of_element(self.__my_profile_page_header) + + def get_my_profile_email_information(self) -> str: + return super()._get_text_of_element(self.__my_profile_email_address) + + def get_text_of_selected_navbar_option(self) -> str: + return super()._get_text_of_element(self.__my_profile_user_navbar_selected_element) + + def get_navbar_menu_options(self) -> list[ElementHandle]: + return super()._get_element_handles(self.__my_profile_user_navbar_options) + + def get_text_of_all_navbar_menu_options(self) -> list[str]: + return super()._get_text_of_elements(self.__my_profile_user_navbar_options) + + def get_text_of_publicly_displayed_username(self) -> str: + return super()._get_text_of_element(self.__my_profile_displayed_email_address) + + def get_text_of_profile_subheading_location(self) -> str: + return super()._get_text_of_element(self.__my_profile_page_subheading) + + def get_my_profile_questions_text(self) -> str: + return super()._get_text_of_element(self.__my_profile_contributions_questions_link) + + def get_my_profile_solutions_text(self) -> str: + return super()._get_text_of_element(self.__my_profile_provided_solutions_text) + + def get_my_profile_documents_text(self) -> str: + return super()._get_text_of_element(self.__my_profile_provided_documents_link) + + def get_my_profile_answers_text(self) -> str: + return super()._get_text_of_element(self.__my_profile_contributions_answers_link) + + def get_my_profile_groups_heading_text(self) -> str: + return super()._get_text_of_element(self.__my_profile_groups_heading) + + def get_my_profile_groups_items_text(self) -> set[str]: + initial_list = set(super()._get_text_of_elements(self.__my_profile_groups_list_items)) + return initial_list + + def click_on_edit_user_profile_button(self): + super()._click(self.__edit_user_profile_option) + + def click_my_profile_answers_link(self): + super()._click(self.__my_profile_contributions_answers_link) + + def click_on_my_profile_questions_link(self): + super()._click(self.__my_profile_contributions_questions_link) + + def click_on_my_profile_document_link(self): + super()._click(self.__my_profile_provided_documents_link) + + def click_on_my_website_link(self): + super()._click(self.__my_profile_website_info) + + def click_on_twitter_link(self): + super()._click(self.__my_profile_twitter_info) + + def click_on_community_portal_link(self): + super()._click(self.__my_profile_community_portal_info) + + def click_on_people_directory_link(self): + super()._click(self.__my_profile_people_directory_info) + + def click_on_element(self, element: ElementHandle): + element.click() + + def click_my_profile_page_sign_out_button(self): + super()._click(self.__my_profile_sign_out_button) + + def click_on_report_abuse_option(self): + super()._click(self.__report_abuse_profile_option) + + def click_on_report_abuse_close_button(self): + super()._click(self.__report_abuse_close_panel_button) + + def click_on_private_message_button(self): + super()._click(self.__private_message_button) + + def publicly_displayed_email_element(self) -> Locator: + return super()._get_element_locator(self.__my_profile_displayed_email_address) + + def is_website_information_displayed(self) -> bool: + return super()._is_element_visible(self.__my_profile_website_info) + + def groups_section_element(self) -> Locator: + return super()._get_element_locator(self.__my_profile_groups_section) + + def edit_user_profile_option_element(self) -> Locator: + return super()._get_element_locator(self.__edit_user_profile_option) + + def is_report_user_option_displayed(self) -> Locator: + return super()._get_element_locator(self.__report_abuse_profile_option) + + def is_report_abuse_panel_displayed(self) -> Locator: + return super()._get_element_locator(self.__report_abuse_panel) + + def is_deactivate_this_user_button_displayed(self) -> Locator: + return super()._get_element_locator(self.__deactivate_this_user_button) + + def deactivate_this_user_and_mark_content_as_spam_element(self) -> Locator: + return super()._get_element_locator( + self.__deactivate_this_user_and_mark_all_content_as_spam) diff --git a/playwright_tests/pages/user_pages/my_profile_user_navbar.py b/playwright_tests/pages/user_pages/my_profile_user_navbar.py new file mode 100644 index 00000000000..ee32a9f3bec --- /dev/null +++ b/playwright_tests/pages/user_pages/my_profile_user_navbar.py @@ -0,0 +1,29 @@ +from playwright.sync_api import Page +from playwright_tests.core.basepage import BasePage + + +class UserNavbar(BasePage): + __my_profile_option = "//ul[@id='user-nav']//a[contains(text(), 'My profile')]" + __edit_my_profile_option = "//ul[@id='user-nav']//a[contains(text(),'Edit my profile')]" + __edit_my_profile_settings_option = "//ul[@id='user-nav']//a[contains(text(),'Edit settings')]" + __edit_my_profile_contribution_areas_option = ("//ul[@id='user-nav']//a[contains(text(),'Edit " + "contribution areas')]") + __edit_my_profile_manage_watch_list_option = ("//ul[@id='user-nav']//a[contains(text()," + "'Manage watch list')]") + __edit_my_profile_my_questions_option = ("//ul[@id='user-nav']//a[contains(text()," + "'My questions')]") + + def __init__(self, page: Page): + super().__init__(page) + + def click_on_my_profile_option(self): + super()._click(self.__my_profile_option) + + def click_on_edit_my_profile_option(self): + super()._click(self.__edit_my_profile_option) + + def click_on_edit_contribution_areas_option(self): + super()._click(self.__edit_my_profile_contribution_areas_option) + + def click_on_my_questions_option(self): + super()._click(self.__edit_my_profile_my_questions_option) diff --git a/playwright_tests/pages/user_questions_pages/aaq_form_page.py b/playwright_tests/pages/user_questions_pages/aaq_form_page.py new file mode 100644 index 00000000000..7dacf7f0251 --- /dev/null +++ b/playwright_tests/pages/user_questions_pages/aaq_form_page.py @@ -0,0 +1,102 @@ +from playwright.sync_api import Page, ElementHandle +from playwright_tests.core.basepage import BasePage + + +class AAQFormPage(BasePage): + __uploaded_image_title = "" + __complete_progress_items = "//li[@class='progress--item is-complete']/a" + __complete_progress_items_labels = ("//li[@class='progress--item is-complete']//span[" + "@class='progress--label']") + __in_progress_item_label = ("//li[@class='progress--item is-current']//span[" + "@class='progress--label']") + __aaq_page_heading = "//h2[@class='sumo-page-heading']" + __aaq_page_intro_text = "//form[@id='question-form']/p[@class='sumo-page-intro']" + __aaq_page_info_card = "//div[contains(@class, 'info card')]" + + # AAQ Subject + __aaq_subject_input_field = "//input[@id='id_title']" + __aaq_subject_input_field_error_message = ("//input[@id='id_title']/../ul[" + "@class='errorlist']/li") + + # Product topic dropdown + __product_topic_select_dropdown = "//select[@id='id_category']" + __product_topic_select_dropdown_error_message = ("//select[@id='id_category']/../ul[" + "@class='errorlist']/li") + + # How can we help textarea field + __how_can_we_help_textarea = "//textarea[@id='id_content']" + __how_can_we_help_textarea_error_field = ("//textarea[@id='id_content']/../following-sibling" + "::ul/li") + + # Add Image + __add_image_browse_button = "//input[@id='id_image']" + __uploaded_test_image_preview = f"//img[@title='{__uploaded_image_title}']" + __uploaded_test_image_delete_button = "//form[@class='upload-input']/input[@class='delete']" + __uploaded_image = "//a[@class='image']/img" + + # Email me when someone answers the thread checkbox + __email_me_checkbox = "//input[@id='id_notifications']" + + # form buttons + __form_submit_button = "//button[contains(text(), 'Submit')]" + __form_cancel_option = "//a[contains(text(),'Cancel')]" + + # Learn more button + + def __init__(self, page: Page): + super().__init__(page) + + def get_complete_progress_item_labels(self) -> list[str]: + return super()._get_text_of_elements(self.__complete_progress_items_labels) + + def get_in_progress_item_label(self) -> str: + return super()._get_text_of_element(self.__in_progress_item_label) + + def get_aaq_form_page_heading(self) -> str: + return super()._get_text_of_element(self.__aaq_page_heading) + + def get_aaq_form_page_intro_text(self) -> str: + return super()._get_text_of_element(self.__aaq_page_intro_text) + + def get_aaq_form_info_card_text(self) -> str: + return super()._get_text_of_element(self.__aaq_page_info_card) + + def get_aaq_form_subject_error(self) -> str: + return super()._get_text_of_element(self.__aaq_subject_input_field_error_message) + + def get_aaq_form_topic_select_error(self) -> str: + return super()._get_text_of_element(self.__product_topic_select_dropdown_error_message) + + def add_text_to_aaq_form_subject_field(self, text: str): + super()._fill(self.__aaq_subject_input_field, text) + + def select_aaq_form_topic_value(self, value: str): + super()._select_option_by_value(self.__product_topic_select_dropdown, value) + + def add_text_to_aaq_textarea_field(self, text: str): + super()._fill(self.__how_can_we_help_textarea, text) + + # def attach_image_to_question(self, image_path: str, image_title: str): + # Need to update this when needed in tests + # self.__uploaded_image_title = image_title + # super()._upload_jpg_image(locator=self.__add_image_browse_button, path_to_image=image_path) + + def image_preview_element(self) -> ElementHandle: + return super()._get_element_handle(self.__uploaded_test_image_preview) + + def uploaded_image_element(self) -> ElementHandle: + return super()._get_element_handle(self.__uploaded_image) + + def click_on_email_me_when_someone_answers_the_thread_checkbox(self): + super()._click(self.__email_me_checkbox) + + def click_aaq_form_cancel_button(self): + super()._click(self.__form_cancel_option) + + def click_aaq_form_submit_button(self): + super()._click(self.__form_submit_button) + + def delete_uploaded_image(self): + super()._hover_over_element(self.__uploaded_image) + super()._click(self.__uploaded_test_image_delete_button) + super()._accept_dialog() diff --git a/playwright_tests/pages/user_questions_pages/questions_page.py b/playwright_tests/pages/user_questions_pages/questions_page.py new file mode 100644 index 00000000000..1537e57bb11 --- /dev/null +++ b/playwright_tests/pages/user_questions_pages/questions_page.py @@ -0,0 +1,101 @@ +from playwright.sync_api import Page, ElementHandle +from playwright_tests.core.basepage import BasePage + + +class QuestionPage(BasePage): + # "Posted successfully" green banner + __posted_questions_success_banner_message = "//ul[@class='user-messages']/li/p" + __posted_questions_success_banner_my_questions_link = "//ul[@class='user-messages']/li/p/a" + __posted_questions_success_banner_close_button = "//ul[@class='user-messages']/li/button" + + # Question + __question_author = "//div[@class='question']//span[@class='display-name']" + + # Progress bar + __complete_progress_items_label = ("//li[@class='progress--item is-complete']//span[" + "@class='progress--label']") + + # Breadcrumbs + __aaq_page_breadcrumbs = "//ol[@id='breadcrumbs']/li" + + # Question details + __questions_header = "//article//h2" + + # Searchbar + __search_support_searchbar = "//form[@id='support-search-sidebar']/input" + __search_support_search_button = "//form[@id='support-search-sidebar']/button" + + # Still need help widget + __still_need_help_ask_now_button = "//a[@data-event-label='aaq widget']" + + # Question Tools + __edit_this_question_option = "//ul[@id='related-content']/li[@class='edit']/a" + __stop_email_updates_option = "//ul[@id='related-content']/li[@class='email']/a" + __subscribe_to_feed_option = "//ul[@id='related-content']/li[@class='rss']/a" + __delete_this_question_option = "//ul[@id='related-content']//a[@class='delete']" + + # Tags section + __question_tags_options = "//li[@class='tag']/a" + + # Post a reply section + __post_a_reply_section_heading = "//h3[@class='sumo-card-heading']" + __post_a_reply_textarea = "//textarea[@id='id_content']" + __post_a_reply_textarea_bold_button = "//button[@title='Bold']" + __post_a_reply_textarea_italic_button = "//button[@title='Italic']" + __post_a_reply_textarea_link_button = "//button[@title='Insert a link...']" + __post_a_reply_textarea_numbered_list_button = "//button[@title='Numbered List']" + __post_a_reply_textarea_bulleted_list_button = "//button[@title='Bulleted List']" + __common_responses_option = "//a[@title='Common responses']" + + # Needs more information from the user + __needs_more_information_from_the_user_checkbox = "//input[@id='id_needs_info']" + + # Add images button + + # Preview Reply button + __preview_reply_button = "//input[@id='preview']" + + # Post Reply button + __post_reply_button = "//button[contains(text(),'Post Reply')]" + + # Delete question + __delete_question_delete_button = "//input[@value='Delete']" + __delete_question_cancel_button = "//a[contains(text(),'Cancel')]" + + def __init__(self, page: Page): + super().__init__(page) + + def get_question_author_name(self) -> str: + return super()._get_text_of_element(self.__question_author) + + def add_text_to_post_a_reply_textarea(self, text: str): + super()._fill(self.__post_a_reply_textarea, text) + + def click_on_post_reply_button(self, repliant_username) -> str: + xpath_display_name = \ + f"//span[@class='display-name' and contains(text(), '{repliant_username}')]" + + xpath_reply_id = (f"//span[@class='display-name' and contains(text(), " + f"'{repliant_username}')]/ancestor::div[@class='answer ']") + super()._click(self.__post_reply_button) + super()._wait_for_selector(xpath_display_name) + return super()._get_element_attribute_value(xpath_reply_id, "id") + + def click_on_solves_the_problem_button(self, target_reply_id: str): + xpath = f"//div[@id='{target_reply_id}']/following-sibling::aside//input[@type='submit']" + + super()._click(xpath) + + def is_post_reply_button_visible(self) -> ElementHandle: + super()._wait_for_selector(self.__post_reply_button) + return super()._get_element_handle(self.__post_reply_button) + + def click_on_the_reply_author(self, reply_id: str): + xpath = f"//div[@id='{reply_id}']//a[@class='author-name']" + super()._click(xpath) + + def click_delete_this_question_question_tools_option(self): + super()._click(self.__delete_this_question_option) + + def click_delete_this_question_button(self): + super()._click(self.__delete_question_delete_button) diff --git a/selenium_tests/pytest.ini b/playwright_tests/pytest.ini similarity index 62% rename from selenium_tests/pytest.ini rename to playwright_tests/pytest.ini index b993ca992e5..8dcff264703 100644 --- a/selenium_tests/pytest.ini +++ b/playwright_tests/pytest.ini @@ -1,13 +1,13 @@ [pytest] markers = - smokeTest: Smoke Tests - homePageTests: Tests belonging to the homepage section. - contributePagesTests: Tests belonging to the contribute section. - topNavbarTests: Tests belonging to the top-navbar section. + homePageTests: Tests belonging to the homepage page. footerSectionTests: Tests belonging to the footer section. - userPageTests: Tests belonging to the user page/profile sections. - userContributionTests: Tests belonging to the user contribution section. + topNavbarTests: Tests belonging to the top-navbar section. + contributePagesTests: Tests belonging to the contribute section. + loginSessions: Acts as test prerequisites creating and storing user sessions + userProfile: Tests belonging to the user profile section. userSettings: Tests belonging to the user settings section. - userProfile: Tests belonging to the user profile section. + editUserProfileTests: Tests belonging to the edit user section. (not to be run in parallel) + userContributionTests: Tests belonging to the user contribution section. userQuestions: Tests belonging to the user questions section. messagingSystem: Tests belonging to the messaging system. diff --git a/playwright_tests/reports/logs/logfile.log b/playwright_tests/reports/logs/logfile.log new file mode 100644 index 00000000000..e69de29bb2d diff --git a/selenium_tests/test_data/aaq_question.json b/playwright_tests/test_data/aaq_question.json similarity index 100% rename from selenium_tests/test_data/aaq_question.json rename to playwright_tests/test_data/aaq_question.json diff --git a/selenium_tests/test_data/add_kb_article.json b/playwright_tests/test_data/add_kb_article.json similarity index 100% rename from selenium_tests/test_data/add_kb_article.json rename to playwright_tests/test_data/add_kb_article.json diff --git a/selenium_tests/test_data/profile_edit.json b/playwright_tests/test_data/profile_edit.json similarity index 98% rename from selenium_tests/test_data/profile_edit.json rename to playwright_tests/test_data/profile_edit.json index 8ffcb6f845e..56fe98ece28 100644 --- a/selenium_tests/test_data/profile_edit.json +++ b/playwright_tests/test_data/profile_edit.json @@ -5,7 +5,7 @@ "display_name_chrome": "Modified display name ch", "display_name_firefox": "Modified displayed name fx", "biography": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.", - "website": "https://www.mediafax.ro/", + "website": "https://edition.cnn.com/", "twitter_username": "twitterTestUser", "community_portal_username": "communityTestUsername123", "people_directory_username": "peopleDirectoryUsername123", diff --git a/selenium_tests/test_data/question_reply.json b/playwright_tests/test_data/question_reply.json similarity index 100% rename from selenium_tests/test_data/question_reply.json rename to playwright_tests/test_data/question_reply.json diff --git a/selenium_tests/test_data/user_message.json b/playwright_tests/test_data/user_message.json similarity index 99% rename from selenium_tests/test_data/user_message.json rename to playwright_tests/test_data/user_message.json index aa91a538061..2f76cdda736 100644 --- a/selenium_tests/test_data/user_message.json +++ b/playwright_tests/test_data/user_message.json @@ -1,7 +1,7 @@ { "valid_user_message": { "test_username": "test", - "message": "Test Automation '''message'''. Test ''italic text''\n\n# Numbered List one\n# Numbered List two\n# Numbered List Three\n\n* Bulleted list item one\n* Bulleted list item two\n* Bulleted list item three\n\n[https://www.mediafax.ro Test external link] \n\n[[Test Sync [Device Migration]|Test internal Link]] ", + "message": "Test Automation '''message'''. Test ''italic text''\n\n# Numbered List one\n# Numbered List two\n# Numbered List Three\n\n* Bulleted list item one\n* Bulleted list item two\n* Bulleted list item three\n\n[https://www.mediafax.ro Test external link] \n\n[[Back up your Firefox data|Test internal Link]] ", "9990_characters_long_message": "wPlwqgjBmYTL5ALrk01MVdittTTlFJFSS8OUnia5Nm5neqTp0plAN3ymCboSUNXfCxwOdG2Bfnx5kKYEp2BFbDrxgp5fZ9SKJ5HbyEPIv5mAj3d0qdGm4n8K3S5jyxBOj5wiAuQA4IDgbtvE4oiGVIzzWef6eD0GQE1QSEpQtH9P0eJdta4imEjdYx1G5LA6PUtdmD2gFA48W3VyY9mDBIEgerG2JFvgxJ8rp8sxesjm97ELOTrfF6nMWJXY5RcgQC80p84bfBxGlH6xxh2n8q2kKkBtz1TqhWupOvwB0tQB29tSvyCVujgwddBPmTzLDyMHIZ72uib329V5CXg0aHrXzJzs6jAvvC58O9YaQI3BwiIQ4kpv9610BiPc9pJPzVTLY8NpWN40jrxBP1d1mNSTdbyIjXrUmj7ifzwYbDtivcGLq1WGXtKWNTpsRoV2q2HV9a0YI9v9VkzAsW7UOm22Bm3EAzC72sxGKm4G2gnhfGEiW30RqreuJnGplYElyHTbOnnafmOZm9MktOT9Y0gJLKiqoiFKa7DxrkC36N3CxTYlAKJ9WDa39m0msOXuZcAlSwyiv3FVbrpA5VOBrQ3ekJL28zLKs4bviL5t4tgrYEZ5IoOASuTJBBIHUmAUzed2ZEXVWzH6So2PPfLeCxEV9K9Tc0twxwOCOB1w3QObfwOCkGSkwBaCM7DLetAy9DSJTHgAllRhpMeVeN4yL8Z0jEmJoTml3ldb90xXrbqkREHLvpM25QIeomd1roOPhbZPQH1gwjkXE60T10Oq4xNLbPZuHVcbI6iC2oLZgG3gpX5oAx3r4vwAJl7UcCek4lk5ZNha0BoVNtIe574gidH6ePYLvtCF5aKwZuLbdZSnrThgQjWCKHS62mIznRvw2EjYBKhQahqoJ7RFCte9Lq7DHz0Li8qUGGx5J5ydUh65uby5uW18g2PKINbZaaG9mU0TJvwuCDyI4kWTVNzNpaD951nZTyjCV9F1nUS3NBJCqKCDijXxVfqq4IaeUGv7V8altKPGR736C8XA9BYeJ5u1oDpR1WEGycMzTMDENUqMTTsHg2vkhnSTICkxbPACts4tQfgRtmNzX6VxAUS93UwC14sf1KiIxcg9xKuR756ioXIWmbielRSENYhsCNEZsI0KeHSCs7laG5RpR21QryY5BAlOMZ54VgxWy1OcHlS9xZGmBqpMZZpF9oT3GD4DS2BI7knSjcTCtv4YlSxWWBpZGLQB6m1dxA4BIqM3zd4VMU7sPm1TPscF2Yc4qAt4SlRtu5AQC4TdvN51lgfKPcQGdBPCKNyKVbmqXzgh2Q8zZSTw8yn477Z1TKd3dQSDAwEBynsAVShJYVcYZ5AFvHTjV8l354ku69AeHfKvIczci1njhgHtfub1amxs3xNaNMLGhgGZHaSX6uxEvqNeNFelRm2GxgwrwQ65ia6iLPr9jeIFFgvfMc05yh2izSOsRmPAmeui6AocayzsF7OJdM4U2aUewhVd7hD4Ota0wR0zaphWZGRk9dBUKFMOxO8O8kjXGyaIgtc0RlX3mTBQYgQ8mbHyHuGvotz8qdjiatVwW3bHYqGWjPdiDdWO4LouyKHMcFD7yYdrvWLS01Jme52wOQ2SxO7kXheVuoezaJl5euC0aQyzGHOLkNiDignIW3GfpbwXBPEkUZWMVOIopF9EZeeCTqjZ6Q9VzcS9dEuZjuP2lGf0BEOoB1U1URtAaNxqqZok6dolxj7SDj9248eh0sMAsHwDn8WHLfBiC5nVxpTYkegL7rwlxOZOn5zlOC1Fm46kdb1VNLgdr5jHE6AHq2nJMHo0SIGQRw8El5RZ5AdmRZG7GVzyRYbKEtTIXNByr96RjS9n3GMBUYAV11DugUNYtb7JGrKCiSFLT4n04LalWs2sdLsjA4DfBfZRoJdy6XGL9yArLRxhH7DQN8PFD4OC5nqGJP4A1xIe7qHaXIwLQVcKfP1WVn1e5Brkh9bwPVq4Ly92WTOPdhngLPgkfw8iY1hY1ty5JH099WfclGRPXzuFWMcqJu1zGvK9JI2eBUFCYaHU8rWuihKJtfAZXxHG94pL12nNJ35i7HCzY9QyfGlHOJUvG7ngwI6OfIUmHWO5y6UKyHGoGflsutKEzg7qFMHxhPCTPPm4ui49BJkrNGRO7s0fSUS8QAsf5SId43a0WDrJCRFOf498KOS25unQUloBkHZlipecZYmGSr2CfISxXRYVXJoWEy1yj0sIPczifTO1frVshdviramtk0t1q8ZPthawKqk8JnhM1oPAjBokWAXxrrtDSDEPwXvgrrbVksypmBhTjDxGpBcizzGqWj25CFezfK39LYlm8KLNGytxnyqgYETkTCDSdBTJ4RQq2QukcLQGAOYxN8LlAoc1s57c7m8gL9hEw0TlmlhnOMAO221ivk1yhgCl21uBCIQoBGzf8tPOnMreMSwtG6V1FR7DGnS2mMlCkMfss7xw2p7EcLTs7YVQVrgfS68uNQ0zdSlyWrhWXjlysmgyZbkUdxJlrqnZz0TzjXjDQUXdmnrcsi0m94g0yO6G4hGejlE58ZHlJvnzpuV7wQ0N8fduIagU0HYvHRNbrW6KCuBLWCSOlXCQQqtCrWfDjefACDtm8AJELWaIoV5R1CWaocwOXYgS1C6vqN2FCrbk7ioO3t8a7spxkawvqqQA6iqMMkj1a2lQWY1UqqKCnTICvFKn3szYoxdlVIsEVjAh0M4yh1xwxGjiqUblcy7IG0ePIJi6aKWTKkespNJ2vr2Cc1cJ4hAmNOyQz3q7OJpBDJV0FoYbiWD7yNfdUtWercle2ToVtg4SLShLB4lSRGB1bvfZa0JN4isqN6qOmUAngLluwDtAUDLI5FOv5UjD3KjOAMSXa1yjvTTJPXgai7flRhjnSFedwjp0XrTGoW1gNu9oLxWKfRrOCI7nU2gQCrRvhMQg2H3WuaSHMp3uCSmziQQCuhQWjRIEWl4WQpMJOeGocuRJFpwB55eW2NdstUcBqjTfYPB8FzQrhwZf9ZOQiKG8jokssxgORRmK6RtOAIJ15WAfFwCok1uYYbnSOhImnC5ajXT4AaIKiebjjzQA7iEg8z5t5jyJEGHWJx8tKdKKBS8lWilpweBjq0PpC2qb9FNU9PxU6gLXkA2LatGSvSPGZY4FI4NhFdEnGPZ8Qn5R5nT0P6W1hh7qegZgUL6xUbMwZb6moh9XlYgwsvzf4NR2J5boedCYMqKmvDOtnlCCD0hdZ0U3pe4JO1DidYKnmYke3M58KFNt97EZR6nDLyTDT5lejHbeZbN0r6du9DYXnqj3Nfmow5uvqWpdQ1usKNhG5fZTTIjOKckfgeyEPMUMTtkWCZqxCfBy0qN2bIByEKY4rORS8GNSGZyRGFBDlwaID747g4Gv3hM8a6eo6lRQVBwL0M11EwOD9omewpc1WQswiv2hBbNbyzi2rRLVjCri6u3a8AgBdYmNi1RPlK87uBM41ea6LLS6roeOvn1ludAlZ0dpETcg4nxuJD5Jdwlq6ILTrwxevXux8jJTs1nfG7F2X2UGaSCu7onWAodjfYB5qt2NPPxNDdtIueU1DQMTfXuYYbyKKS5biGIx0nBALPfExY3y4EsTFKebltW2NBe8SXcsXthmTjgGP9vGhfSCjkJuDEXTSSvR8oSrGwZym0BmJSRi3zeVdCsxm8lNC1CBUFYFNkM1A1wka3SoEMn21G88pBYOwgwue3ZYjzeccCvRiQUKqdFrGQ24BT1j83HToyWhK670UqOgFEKJvlag8JPARZIV3z2uZkFn4J2q0T4zbKcWwq6sbPv7mNxp3lCs0nlh4Xk0DMvRjFZAui2EQfUVy2aEKZRnoFAIv9IO1FTVvIltl9ODC2eRSYECltm26tO21HPwW6aNYWbCigsQ0ybmSkw6mTJY2c8WfRizUQeygjgmIRgPp5Ne07EIYI5oDAKJAgjWDr6DcSmccr47vBzSXpVcbMCBWZVPY3YBRHHPGG0r5cSf8HMtuE8bbHHnjJ8WEOibDosufaOWhUAjWRgM4HivJiiXhaKYPOS6IUTVcS0eilDPge5tfYBmB3G3JW65Ogy4PwHbhk3HjI9ob5gNjPqPO4jv6CfoxblT7PiUrWJ3AZH07rQAwJRpXLTT2aZqG4GMz7xNPJRWduZsvKw2cRytEmtZVJ9mByx898iKd9wxD7Z79NsZlQs7CMKqXFnpA8aQ3E5IP4GjmoP0J3kY2S2RQamvxDucpN8rqIGMkHCssNmR632H7Ftyq7SaSmbExNB2WO8qmI8CEoZcDBfFRPQRY23CewnwA9rYbFTx2sIPnYGi8XLBNbrHgjKj3HYkLakl1UMAoc6IOnY8J8HyMukTt89zprTUG1ZysGYf1vYrCnJ38NdwxqA5rjerb3lVYYw4sFMMWTlLpgVniPwIuxrpCMk5olMRJO9vp9rIyfKkhfMi2Psc7vqINZyqFk8gdiGFASHtGvKM3hn4HnEEkcEywlA6HF6GtxnmPyMy5L7Mhjon2K0TblapVZFXKZmj3woJucfN2xjv9amprxrs7dZH3eA2JNhtNPTmeBq8azRA7610rv44m1FnfPWWDAhLaPsOg38uceGbMQCwxbgxLhIhUGumJAIXUSkOPq0e7oNb3T4n5qPwN4YXIDk2SckYj9RVHtYaULlrZLTqPg7zH80qZ6WlrMePedUhniYDFmhOfUldd8LWiYftSABgFlNoNkBnELgPd2cmQjwRe8ObqFty16B6t90pmfyU2ST5HO3KVvvH5WpdTlw3AxfTVCICJ2krOR74BR1N6YDlPw6RKk2TitgJsyOaMNm4Z1qSjLyJdIYWQxFSyokYaxoJrDfXOTGN4dz8ryYxnPfsFeCjAOLw3Hd72TOPgTmiAQCzSE3wGtRdDkOiQGTChzUW0KA4vhwUHKrqHmMSOpaAmgGN3wr2jlKjpIuJIBojKEcLpPNdMLmJLk3owChBAnLRkLPgsP1ynIbbUPm7F3lcCNlrK0or3eZI8mUa9EIKKJIsuzF1kauz53gxQIvo28ukxlQTkItKfVxXlGTt38fOlrB0hUfagI096i8Omam2uXXwPl7wK65ZqQmu4qmGHyj635uL2uvd8uLIuEiBr1a6MwOV2ZmHASFqMT6POkE3xr5gdsaBiR22yznKmQ8f6ACLMoTdzYyLfrjzFiWWhCfuoBL5wzUU3vlfy71EPjUqwNZSYJLZvm9eVDZj5O6jVUEpxdOATgnGzIKyfS6OtLf0ygapQxjmQKtGTDB8piumGXu8Ewg96fzVsubjo8755h7GE9kBAg73mTxjoYyfdi0407z3mwMnfCyflEeztjsC4eo7IxEzZjRU6zCM0Qvefo335dddgPcCv7l9QytgSbxDXRrEv4BXAnMYI6XV8Qecv5UP5D7MxCUTHlRWSGj22O2aMm8jaFytjRP4UKlUucKzqn7NHKi7w5n1UDFAWk2UGApgeb5Mc1gzugfPzkMQUg1fHlsewNbvxTaFzBiRCwT4m5FolOgx8G5GCpJavhvyuu3E4UqO1yPRRxoJ5ErfEea6SBFzrhyus7TnSvxjV1cgwe2uFuSwLOLMpRpARwmW12IGYVK5ANOKQYeQnpFfgnGDLWswphAkGlI0YI4TLl6glW57RzqJb0XLmBlPYqhkyYMZyGrWut4TBMY4hsj980WSBqpXU36lFi9mBLPpaMWyLWDm7rLnBQr3Z8K8AtgVpbujb7XhMYxsk0DHrnzNha4585YBqi8c2yusHZRn9B11ybDKTkm2SQTdMPWuKsiE0cMNihU04aAGvsGSISBLG0L5D0Du113iXfr3ikSZYPe84FRYEiCWH3YJzHKIb1yPVDhX11k4pLIASnZDsBxyld2zingTpSxK3zPAJX9X4xcCcX6dRTVsKoATtbRgOvHIhPhMjohHidZQEEoRhgxjVTmMFsRearjT6oXwSYkhujSUZ3SOjGbGbKsVe8VTavZi5cCdYx8IP43Dhkmldnmxq3BKUdngnbVMR7CyE14lKYaTM2mtgOHn01Inh0MMga6bzW7ZPDIC2Ho7okKV4Eu8JhOxi9Pg3yShFOAwa7PhwxcQgOgNhfk75olTQTZmpsOjsyT1vD1yZuFKVApinESku5dPTwcqJK5CJ0Umiw3Gf6VzZiyQWrOMudaBvdwHvvB3pC8Yy52Dss7G9V6OWJQHqQx02ghU9WKoP6f2PNtDXKyfr56Lg7xl5rGCZaILuyZhdwlTXZqkHbo5cGZ78QUAMAerFXJqZelXZ2ZT0P1YIkNfBO92dE1VPNYmB3qS0HLPbXJf4acPXe2zqNh8vGikFvNob6145Cm3CVqHIoJBWM9M5HZLHzHJxfyIHMOeMO3sB2aOxFHb36KDjuKEZ4KQOMZeqoCoDzfQxV6cevKjKJ5NviZSA46l2wXocsdjt510wkxYHB4GUlVRblGEBRjSYmi2FGD6ixILtSivhrtPm7Di9rZwI9VQ7R2c4QgykdKOWUBJwUli9GSCOArPKXgHkso7SQZIduG8jQbIyrYeEdjMlQuyKRFLycxOnooadQhvAVOR8nMqXI6aT1fZIbLn6hJ0GArO3vKq5n48jGxrtXAIF6SoDr0TcpinoZLiicas0GQ6HXmwWB7Ey0xluWvo0dAO7mta7Gjq1aT5fSFSLTAIbUcOcRAgTlXVLXKyPwXGRHLkGnDqidNZMVGIaIf3gjJ3QSW9lwDZXHPg7wGawqmeM2iBlZjkbn0mPjBvWc5Y1Bfv9I9XhUxxXYAP6dbF0pGT299TyPVc6zWI8J0Uee91BPQnuanmKic6BBDKZQAnhT9Z36rE38jWWFcVUfuTkEexdvY4RPQO89cZbGFG4zZc7IFyCEZoYaaOHbK2u7QvfJaZ99I1BVuzPdnmPnKXUW7WpmJX59kEMbbunH7UT3OGwcCTBrZsgtAcGPU1fusi3a2lxgVRw6ZCLddQXpX0bRi1Px4gtaAhyHHbjbYQLJ2jzBAjw8qe96qNAitlSWa24lZMcWRtYBvxyXA8mMopvOlntCr4Nthgdqkp320aQoHkWaE3ArzZrYL3sXY1pkImCOF7M1Eut57a4I69IukWr7YYvZqS80Dt2v9Tc66VLokvLvKOamaARn5woAZRd4AKpoL38upGKBSaYPN4uHx7sHFQl1TInU5Zpw2aLC2ABzfeXjAQNR7P48dIoYw5h1LQSKevWCnJKGBgAdz2zXfl64loG10YQkg4GESzNGC7l6CWcJERlnElDVeJnSUBBKNYnpGC2GOVlFkYFGiG6UzUX96xilmROljffuznz3srOqtczgZPROCGI1lVAuNcs2J2xGjYd6LddtKsUN88uF9kOdNt0UTGaanI5Ka3FrKrqvAz35IP69OuPvwXrIgqXj8c9tDvrU9jItSfKiW4Quh5jc3DzQtFzGzYOP0nv6aIRSzu0I4uvvwB3hjxmCOYR3DQZfzqLmhXGoRJR1kz3jJBCWZQYKmd5CwPchxMo3K2FkM0fDRdNkFL3WCYWiLpj3FCv5iAzawvCyz3A96a5Z4JSnMJUxNfCBRBvk66FG5xC2SqELzAtIbpacMyluzAnPMgvdSlC06csPfPPOX4hL7hgqOrKvWk83XJlVALNF25DWR52dPRaYaksxNnw7rYodBf0MPmF5cQ1buKkbMGvssLFizTDgwRvkjzLGAf65oZpAbQO77FVkCywmulwAeZNOL2DEQgrAZMb2Sck8dugi7VR3hbkH7IGo2JHIweg1iM9EHWVwACgbYyuuRiBLGPuXiOb6Yw6i1EqwTRmAZM5Vt25vHwP84Hj0PlGzG4DDCfitdmBoEpFVQBWPNy1Y69UN7gU8LW8lbHP3veMs8fOzA2s5uStfc3tFuGl2u1ljmrtvBCNLRK0DIxi6zxGsGwMUyMeTyljpG0MHji9ERwQwrG2lA7PpeKI5pwIgErQka4zlCeZkQq1ctUeI08h6dPVaUIdWicKcTP2xnK2tUa7S5C6rEDZmPqYkH1z3pAj15W3F97RSvbzC3yN0A2Qz4cf9CKLjxB3pOcLPsSUAgycvk6svy4p6Bdr2nqhjfa5xT36TLIcYCu3uYUARnHyIInbABXizHyqBeTA8D7x31Tr8awPGmAmQxYgADIGiMvX1Xa8uZWFEVf4xq5FoNE84YwJKnpZfntIvsrMsK57dbb39J6i3lx1bAjg011Vfq1m2qFtfP2RlQ6zCfQVFFQIGXmUF97o0HrYjLXVVb7OmsnLWcnxgLOpBVnCaTVtfwodUizNlG39LcwHsXXY7nrc3keyWOLFheqzgNpvay7JlfaMJyZukdJkUSy2S2XT9TSBNF95eNCBoFrTHtY64Phd1hXtH7QsQrrWh1e7U5nmqi4oXxVvCITWzd829wTXWqjEutleoLl342lyOBmTcAqfW9casj7EhbDCjlukJPC6OXGHyUOfAEMiOcwf8Ju02fpW538BOREfZasbeIBUgY0rpg3HC7e61HqnFy2s1TF0luFZJvC5PTwsp61Y3W2v36OUBdpqEELSE6taYrS2vXVvIXMPbxQSib6397iGAKCN86t4M6oz3WT8fFxYLifsp6lxtMz0Xq3duRBfuzmrKIyssCU7YOHJfDyXKtViqGE91HvE4fyihz1ka14uYfjI7ArO2g7nDxRpEOoJ94RKrZwqKjXvuuhFLrWhAs9hi2BB9jdGPTwH6LyOOxOyutSQP33O6fzLbc0IVNa7uQ6kOhQorwsHxGVsmSe5fmQcWyoDfOGtUcWHnqHJoOoBdnHL2TiS9dtaSpVlhNGmHbZXGobZLQUDuEsHonFDZrjeQISoPJvnAtuLKmQlxSZCkOSyv2t4LQlRUWLzu8ALbmOeOI1jkZhBAosmKVVT9yGUpkA19vprAlzIPWnkuBc2MRfNF3dnUwRVTiobPf2mu6sRoVKTOivr2Kw7ftI7QWU9xlbUYufZMie95v1t1EkyO83z0XUGNqWUjHSIYe0BRe4dCaHiT2Pn5Gw5MHHjpQA7CyNmAndQ7AV7TTMWuNc5lVFxr40QCrkQQFSWOkq88LULGxKozxBuK9yiSttOCqjnOMrFpS7jJM4oBrMdPnEDkXNK7Yd8MCSNYI7ZoLBdfO0TDsCT14G2mPPsxHbPSGrVuyVfuV15CvX2HYFHbnhZbtv2iEEPMhFIkGCCUVPeioWuObW74SLfCozHgnd3CL0tiYaQ0sQ0w6ufSE7jhw2xrNskCyCJbbAYI8UuKfwvk7UJ9QqA0i1luXe122KvCNz2GcYXHSqbcWCmqW9J7dIy03syjv2nHRaayBxGIq560FzvDyJlXbY33cWypvxLe2rV9AKMAbjWQmyRoilqLdyVOoWGTZlQLoxFk6d9ezOYi3Pucayl4D3Tn7oIkjZZSH56TLZm3vUqWtkf5Mn7koEbYg3JnBMNWwOwBbxpooWErIfB3JZUS49VAzW9dgq8TxvdjMrRVMlVBeLHhlsWYVEepWx8kCrxjwEDfwQcVySGyAN5U2VYCBCgSrtrFCx9Gj0hN2ER7YMlB4TFompZVaRRIt3TNaof38SvfUvRwKjIoomX8GZDnJ4GwrKxAh2ee2ApyKWflUn0fyAW0LOS7K4oBYSAnFE8Bfim7awxSiGipBSrU61fRzvkIsVbINi64EwrvwJJaZjob3QPMGJiC87twcVw03yVDMjii7aeUTUrgFlNrMaCv0PGrmHbc81GRWC6OIYpHaFrkZB8qIn6izByLJxMiRC8M1WtJriPGNRVbjDCxHABKGn8vDmZ24tIIVo5tNHkqsvYTNiqghzIGf2zDjjiE7V7GTTqlEvQoxUgFxRriPjpcGykUiKaDv0qdgXx6fLcMu5kw5f5UxbOPKX592v2FYXGKKcbr4PSCaod44g1McdOjwNxvuXrZwK3qtRPkWTpvBKzlfPE5diNvPXYf13sZ57Sqz39NDBnLu2Km6GIiKmQp5cBWp1bivjKHR42kITkfpAl3lNCVGAoZprsdHrrxrpGTQ5tf", "one_character_message" : "a", "9_characters_message": "i3zOlXL9v" diff --git a/playwright_tests/tests/conftest.py b/playwright_tests/tests/conftest.py new file mode 100644 index 00000000000..2f6ac9b3610 --- /dev/null +++ b/playwright_tests/tests/conftest.py @@ -0,0 +1,88 @@ +import os + +import pytest +from playwright.sync_api import sync_playwright + +from playwright_tests.core.testutilities import TestUtilities +from playwright_tests.messages.homepage_messages import HomepageMessages +from playwright_tests.pages.sumo_pages import SumoPages + + +@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() + page = context.new_page() + else: + browser = playwright.firefox.launch() + context = browser.new_context() + 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.browser = requested_browser + request.cls.logger = logger + yield + context.close() + + +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(item): + try: + pytest_html = item.config.pluginmanager.getplugin("html") + outcome = yield + report = outcome.get_result() + extra = getattr(report, "extra", []) + if report.when == "call": + xfail = hasattr(report, "wasxfail") + if (report.skipped and xfail) or (report.failed and not xfail): + report_directory = "reports/" + file_name_edit = report.nodeid.split("::") + file_name = file_name_edit[2] + ".png" + destination_file = os.path.join(report_directory, file_name) + page.screenshot(path=destination_file) + if file_name: + html = ( + '
' % file_name + ) + + extra.append(pytest_html.extras.html(html)) + report.extra = extra + except Exception as e: + print(e) diff --git a/selenium_tests/tests/contribute_pages_tests/test_contribute_article_page.py b/playwright_tests/tests/contribute_pages_tests/test_contribute_article_page.py similarity index 67% rename from selenium_tests/tests/contribute_pages_tests/test_contribute_article_page.py rename to playwright_tests/tests/contribute_pages_tests/test_contribute_article_page.py index 5e6faaed23f..a322edafb71 100644 --- a/selenium_tests/tests/contribute_pages_tests/test_contribute_article_page.py +++ b/playwright_tests/tests/contribute_pages_tests/test_contribute_article_page.py @@ -1,26 +1,21 @@ import pytest import requests import pytest_check as check -from selenium_tests.core.test_utilities import TestUtilities -from selenium_tests.messages.contribute_pages_messages.con_forum_page_messages import ( - ContributeForumMessages, -) -from selenium_tests.messages.contribute_pages_messages.con_help_articles_page_messages import ( - ContributeHelpArticlesMessages, -) -from selenium_tests.messages.contribute_pages_messages.con_localization_page_messages import ( - ContributeLocalizationMessages, -) -from selenium_tests.messages.contribute_pages_messages.con_mobile_support_page_messages import ( - ContributeMobileSupportMessages, -) -from selenium_tests.messages.contribute_pages_messages.con_page_messages import ( - ContributePageMessages, -) -from selenium_tests.messages.contribute_pages_messages.con_social_support_messages import ( - ContributeSocialSupportMessages, -) -from selenium_tests.messages.homepage_messages import HomepageMessages + +from playwright_tests.core.testutilities import TestUtilities +from playwright_tests.messages.contribute_pages_messages.con_forum_page_messages import ( + ContributeForumMessages) +from playwright_tests.messages.contribute_pages_messages.con_help_articles_page_messages import ( + ContributeHelpArticlesMessages) +from playwright_tests.messages.contribute_pages_messages.con_localization_page_messages import ( + ContributeLocalizationMessages) +from playwright_tests.messages.contribute_pages_messages.con_mobile_support_page_messages import ( + ContributeMobileSupportMessages) +from playwright_tests.messages.contribute_pages_messages.con_page_messages import ( + ContributePageMessages) +from playwright_tests.messages.contribute_pages_messages.con_social_support_messages import ( + ContributeSocialSupportMessages) +from playwright_tests.messages.homepage_messages import HomepageMessages class TestContributeArticlePage(TestUtilities): @@ -28,7 +23,7 @@ class TestContributeArticlePage(TestUtilities): @pytest.mark.contributePagesTests def test_contribute_article_page_text(self): self.logger.info("Accessing the Contribute with help Article page") - self.pages.ways_to_contribute_pages.navigate_to( + self.navigate_to_link( ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL ) @@ -36,22 +31,21 @@ def test_contribute_article_page_text(self): "Verifying that the page header is successfully displayed " "and contains the correct strings " ) - check.equal( - self.pages.ways_to_contribute_pages.get_hero_main_header_text(), + self.sumo_pages.ways_to_contribute_pages.get_hero_main_header_text(), ContributeHelpArticlesMessages.HERO_PAGE_TITLE, - f"Text is: {self.pages.ways_to_contribute_pages.get_hero_main_header_text()}" + f"Text is: {self.sumo_pages.ways_to_contribute_pages.get_hero_main_header_text()}" f"Expected: {ContributeHelpArticlesMessages.HERO_PAGE_TITLE}", ) self.logger.info( "Verifying that the h2 is successfully displayed and contains the correct strings" ) - check.equal( - self.pages.ways_to_contribute_pages.get_hero_second_header_text(), + self.sumo_pages.ways_to_contribute_pages.get_hero_second_header_text(), ContributeHelpArticlesMessages.HERO_SECOND_TITLE, - f"Text is: {self.pages.ways_to_contribute_pages.get_hero_second_header_text()}" + f"Text is: " + f"{self.sumo_pages.ways_to_contribute_pages.get_hero_second_header_text()}" f"Expected: {ContributeHelpArticlesMessages.HERO_SECOND_TITLE}", ) @@ -59,11 +53,10 @@ def test_contribute_article_page_text(self): "Verifying tha the paragraph under h2 is successfully " "displayed and contains the correct strings" ) - check.equal( - self.pages.ways_to_contribute_pages.get_hero_text(), + self.sumo_pages.ways_to_contribute_pages.get_hero_text(), ContributeHelpArticlesMessages.HERO_TEXT, - f"Text is: {self.pages.ways_to_contribute_pages.get_hero_text()}" + f"Text is: {self.sumo_pages.ways_to_contribute_pages.get_hero_text()}" f"Expected: {ContributeHelpArticlesMessages.HERO_TEXT}", ) @@ -73,9 +66,10 @@ def test_contribute_article_page_text(self): "strings" ) check.equal( - self.pages.ways_to_contribute_pages.get_how_to_contribute_header_text(), + self.sumo_pages.ways_to_contribute_pages.get_how_to_contribute_header_text(), ContributeHelpArticlesMessages.HOW_TO_CONTRIBUTE_HEADER, - f"Text is: {self.pages.ways_to_contribute_pages.get_how_to_contribute_header_text()}" + f"Text is: " + f"{self.sumo_pages.ways_to_contribute_pages.get_how_to_contribute_header_text()}" f"Expected is: {ContributeHelpArticlesMessages.HOW_TO_CONTRIBUTE_HEADER}", ) @@ -92,9 +86,8 @@ def test_contribute_article_page_text(self): self.logger.info( "Verifying that the 'How you can contribute' cards are successfully expected" ) - check.equal( - self.pages.ways_to_contribute_pages.get_how_to_contribute_link_options_text(), + self.sumo_pages.ways_to_contribute_pages.get_how_to_contribute_link_options_text(), card_titles, "How you can contribute steps are incorrect!", ) @@ -109,10 +102,10 @@ def test_contribute_article_page_text(self): ) check.equal( - self.pages.ways_to_contribute_pages.get_how_to_contribute_option_four_text(), + self.sumo_pages.ways_to_contribute_pages.get_how_to_contribute_option_four_text(), ContributeHelpArticlesMessages.HOW_TO_CONTRIBUTE_OPTION_FOUR, f"Text is: " - f"{self.pages.ways_to_contribute_pages.get_how_to_contribute_option_four_text()}" + f"{self.sumo_pages.ways_to_contribute_pages.get_how_to_contribute_option_four_text()}" f"Expected is: " f"{ContributeHelpArticlesMessages.HOW_TO_CONTRIBUTE_OPTION_FOUR}", ) @@ -121,12 +114,11 @@ def test_contribute_article_page_text(self): "Verifying that the first line from the fact text is successfully displayed" " and contains the expected string" ) - check.equal( - self.pages.ways_to_contribute_pages.get_first_fact_text(), + self.sumo_pages.ways_to_contribute_pages.get_first_fact_text(), ContributeHelpArticlesMessages.FACT_FIRST_LINE, f"Text is: " - f"{self.pages.ways_to_contribute_pages.get_first_fact_text()}" + f"{self.sumo_pages.ways_to_contribute_pages.get_first_fact_text()}" f"Expected is: " f"{ContributeHelpArticlesMessages.FACT_FIRST_LINE}", ) @@ -135,12 +127,11 @@ def test_contribute_article_page_text(self): "Verifying that the second line from the fact section text is successfully displayed " "and contains the expected string " ) - check.equal( - self.pages.ways_to_contribute_pages.get_second_fact_text(), + self.sumo_pages.ways_to_contribute_pages.get_second_fact_text(), ContributeHelpArticlesMessages.FACT_SECOND_LINE, f"Text is: " - f"{self.pages.ways_to_contribute_pages.get_second_fact_text()}" + f"{self.sumo_pages.ways_to_contribute_pages.get_second_fact_text()}" f"Expected is: " f"{ContributeHelpArticlesMessages.FACT_SECOND_LINE}", ) @@ -150,12 +141,11 @@ def test_contribute_article_page_text(self): "header is successfully displayed and contains the expected " "string" ) - check.equal( - self.pages.ways_to_contribute_pages.get_other_ways_to_contribute_header_text(), + self.sumo_pages.ways_to_contribute_pages.get_other_ways_to_contribute_header_txt(), ContributeHelpArticlesMessages.OTHER_WAYS_TO_CONTRIBUTE_HEADER, f"Text is: " - f"{self.pages.ways_to_contribute_pages.get_other_ways_to_contribute_header_text()}" + f"{self.sumo_pages.ways_to_contribute_pages.get_other_ways_to_contribute_header_txt()}" f"Expected is: " f"{ContributeHelpArticlesMessages.OTHER_WAYS_TO_CONTRIBUTE_HEADER}", ) @@ -171,9 +161,8 @@ def test_contribute_article_page_text(self): "Verifying that the 'Other ways to contribute' are successfully displayed " "and in the correct order" ) - check.equal( - self.pages.ways_to_contribute_pages.get_other_ways_to_contribute_card_titles_text(), + self.sumo_pages.ways_to_contribute_pages.get_other_ways_to_contribute_card_title_txt(), other_ways_to_contribute_card_titles, "Other ways to contribute card titles are not the correct ones!", ) @@ -182,13 +171,13 @@ def test_contribute_article_page_text(self): @pytest.mark.contributePagesTests def test_contribute_article_page_images_are_not_broken(self): self.logger.info("Accessing the Contribute with help Article page") - self.pages.ways_to_contribute_pages.navigate_to( + self.navigate_to_link( ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL ) self.logger.info("Verifying that the Contribute forum page images are not broken") - for link in self.pages.ways_to_contribute_pages.get_all_page_image_links(): + for link in self.sumo_pages.ways_to_contribute_pages.get_all_page_image_links(): image_link = link.get_attribute("src") response = requests.get(image_link, stream=True) check.is_true(response.status_code < 400, f"The {image_link} image is broken") @@ -197,7 +186,7 @@ def test_contribute_article_page_images_are_not_broken(self): @pytest.mark.contributePagesTests def test_contribute_article_page_breadcrumbs(self): self.logger.info("Accessing the Contribute Forum page") - self.pages.ways_to_contribute_pages.navigate_to( + self.navigate_to_link( ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL ) @@ -209,40 +198,41 @@ def test_contribute_article_page_breadcrumbs(self): ] check.equal( - self.pages.ways_to_contribute_pages.get_text_of_all_breadcrumbs(), + self.sumo_pages.ways_to_contribute_pages.get_text_of_all_breadcrumbs(), breadcrumbs, - f"Breadcrumbs are: {self.pages.ways_to_contribute_pages.get_text_of_all_breadcrumbs()}" + f"Breadcrumbs are: " + f"{self.sumo_pages.ways_to_contribute_pages.get_text_of_all_breadcrumbs()}" f"Expected: {breadcrumbs}", ) counter = 1 - for breadcrumb in self.pages.ways_to_contribute_pages.get_all_interactable_breadcrumbs(): + for breadcrumb in self.sumo_pages.ways_to_contribute_pages.get_interactable_breadcrumbs(): breadcrumb_to_click = ( - self.pages.ways_to_contribute_pages.get_all_interactable_breadcrumbs()[counter] + self.sumo_pages.ways_to_contribute_pages.get_interactable_breadcrumbs()[counter] ) - self.pages.ways_to_contribute_pages.click_on_breadcrumb(breadcrumb_to_click) + self.sumo_pages.ways_to_contribute_pages.click_on_breadcrumb(breadcrumb_to_click) if counter == 1: self.logger.info( "Verifying that the Contribute breadcrumb redirects to the Contribute page" ) check.equal( - self.pages.contribute_page.current_url(), + self.get_page_url(), ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL, f"Expected to be on {ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL}" - f"We are actual on {self.pages.contribute_page.current_url()}", + f"We are actual on {self.get_page_url()}", ) - self.pages.contribute_page.navigate_forward() + self.navigate_forward() counter -= 1 elif counter == 0: self.logger.info("Verifying that the Home breadcrumb redirects to the Homepage") check.equal( - self.pages.homepage.current_url(), + self.get_page_url(), HomepageMessages.STAGE_HOMEPAGE_URL, f"Expected to be on: " f"{HomepageMessages.STAGE_HOMEPAGE_URL}" f"We are actual on: " - f"{self.pages.homepage.current_url()}", + f"{self.get_page_url()}", ) # Need to add tests for "How you can contribute" section @@ -251,7 +241,7 @@ def test_contribute_article_page_breadcrumbs(self): @pytest.mark.contributePagesTests def test_contribute_article_other_ways_to_contribute_redirect_to_the_correct_page(self): self.logger.info("Accessing the Contribute Forum page") - self.pages.ways_to_contribute_pages.navigate_to( + self.navigate_to_link( ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL ) @@ -270,18 +260,18 @@ def test_contribute_article_other_ways_to_contribute_redirect_to_the_correct_pag counter = 0 for ( element - ) in self.pages.ways_to_contribute_pages.get_all_other_ways_to_contribute_card_list(): + ) in self.sumo_pages.ways_to_contribute_pages.get_other_ways_to_contribute_card_list(): card = ( - self.pages.ways_to_contribute_pages.get_all_other_ways_to_contribute_card_list()[ + self.sumo_pages.ways_to_contribute_pages.get_other_ways_to_contribute_card_list()[ counter ] ) - self.pages.ways_to_contribute_pages.click_on_other_way_to_contribute_card(card) + self.sumo_pages.ways_to_contribute_pages.click_on_other_way_to_contribute_card(card) check.equal( ways_to_contribute_links[counter], - self.pages.ways_to_contribute_pages.current_url(), + self.get_page_url(), f"Expected the following URL: {ways_to_contribute_links[counter]}" - f"Received: {self.pages.ways_to_contribute_pages.current_url()}", + f"Received: {self.get_page_url()}", ) - self.pages.contribute_page.navigate_back() + self.navigate_back() counter += 1 diff --git a/selenium_tests/tests/contribute_pages_tests/test_contribute_forum_page.py b/playwright_tests/tests/contribute_pages_tests/test_contribute_forum_page.py similarity index 60% rename from selenium_tests/tests/contribute_pages_tests/test_contribute_forum_page.py rename to playwright_tests/tests/contribute_pages_tests/test_contribute_forum_page.py index dbe387b2dd0..8214636c452 100644 --- a/selenium_tests/tests/contribute_pages_tests/test_contribute_forum_page.py +++ b/playwright_tests/tests/contribute_pages_tests/test_contribute_forum_page.py @@ -2,26 +2,20 @@ import pytest_check as check import requests -from selenium_tests.core.test_utilities import TestUtilities -from selenium_tests.messages.contribute_pages_messages.con_forum_page_messages import ( - ContributeForumMessages, -) -from selenium_tests.messages.contribute_pages_messages.con_help_articles_page_messages import ( - ContributeHelpArticlesMessages, -) -from selenium_tests.messages.contribute_pages_messages.con_localization_page_messages import ( - ContributeLocalizationMessages, -) -from selenium_tests.messages.contribute_pages_messages.con_mobile_support_page_messages import ( - ContributeMobileSupportMessages, -) -from selenium_tests.messages.contribute_pages_messages.con_page_messages import ( - ContributePageMessages, -) -from selenium_tests.messages.contribute_pages_messages.con_social_support_messages import ( - ContributeSocialSupportMessages, -) -from selenium_tests.messages.homepage_messages import HomepageMessages +from playwright_tests.core.testutilities import TestUtilities +from playwright_tests.messages.contribute_pages_messages.con_forum_page_messages import ( + ContributeForumMessages) +from playwright_tests.messages.contribute_pages_messages.con_help_articles_page_messages import ( + ContributeHelpArticlesMessages) +from playwright_tests.messages.contribute_pages_messages.con_localization_page_messages import ( + ContributeLocalizationMessages) +from playwright_tests.messages.contribute_pages_messages.con_mobile_support_page_messages import ( + ContributeMobileSupportMessages) +from playwright_tests.messages.contribute_pages_messages.con_page_messages import ( + ContributePageMessages) +from playwright_tests.messages.contribute_pages_messages.con_social_support_messages import ( + ContributeSocialSupportMessages) +from playwright_tests.messages.homepage_messages import HomepageMessages class TestContributeForumPage(TestUtilities): @@ -29,37 +23,37 @@ class TestContributeForumPage(TestUtilities): @pytest.mark.contributePagesTests def test_contribute_forum_page_text(self): self.logger.info("Accessing the Contribute Forum page") - self.pages.ways_to_contribute_pages.navigate_to( + self.navigate_to_link( ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL ) self.logger.info("Verifying that the Contribute Forum page contains the correct strings") - check.equal( - self.pages.ways_to_contribute_pages.get_hero_main_header_text(), + self.sumo_pages.ways_to_contribute_pages.get_hero_main_header_text(), ContributeForumMessages.HERO_PAGE_TITLE, - f"Text is: {self.pages.ways_to_contribute_pages.get_hero_main_header_text()}" + f"Text is: {self.sumo_pages.ways_to_contribute_pages.get_hero_main_header_text()}" f"Expected: {ContributeForumMessages.HERO_PAGE_TITLE}", ) check.equal( - self.pages.ways_to_contribute_pages.get_hero_second_header_text(), + self.sumo_pages.ways_to_contribute_pages.get_hero_second_header_text(), ContributeForumMessages.HERO_SECOND_TITLE, - f"Text is: {self.pages.ways_to_contribute_pages.get_hero_second_header_text()}" + f"Text is: {self.sumo_pages.ways_to_contribute_pages.get_hero_second_header_text()}" f"Expected: {ContributeForumMessages.HERO_PAGE_TITLE}", ) check.equal( - self.pages.ways_to_contribute_pages.get_hero_text(), + self.sumo_pages.ways_to_contribute_pages.get_hero_text(), ContributeForumMessages.HERO_TEXT, - f"Text is: {self.pages.ways_to_contribute_pages.get_hero_text()}" + f"Text is: {self.sumo_pages.ways_to_contribute_pages.get_hero_text()}" f"Expected: {ContributeForumMessages.HERO_TEXT}", ) check.equal( - self.pages.ways_to_contribute_pages.get_how_to_contribute_header_text(), + self.sumo_pages.ways_to_contribute_pages.get_how_to_contribute_header_text(), ContributeForumMessages.HOW_TO_CONTRIBUTE_HEADER, - f"Text is: {self.pages.ways_to_contribute_pages.get_how_to_contribute_header_text()}" + f"Text is: " + f"{self.sumo_pages.ways_to_contribute_pages.get_how_to_contribute_header_text()}" f"Expected is: {ContributeForumMessages.HOW_TO_CONTRIBUTE_HEADER}", ) @@ -74,7 +68,7 @@ def test_contribute_forum_page_text(self): ] check.equal( - self.pages.ways_to_contribute_pages.get_how_to_contribute_link_options_text(), + self.sumo_pages.ways_to_contribute_pages.get_how_to_contribute_link_options_text(), card_titles, "How you can contribute steps are incorrect!", ) @@ -82,33 +76,33 @@ def test_contribute_forum_page_text(self): # We need to add here the check for when the user is signed in with a contributor account check.equal( - self.pages.ways_to_contribute_pages.get_how_to_contribute_option_four_text(), + self.sumo_pages.ways_to_contribute_pages.get_how_to_contribute_option_four_text(), ContributeForumMessages.HOW_TO_CONTRIBUTE_OPTION_FOUR, f"Text is: " - f"{self.pages.ways_to_contribute_pages.get_how_to_contribute_option_four_text()}" + f"{self.sumo_pages.ways_to_contribute_pages.get_how_to_contribute_option_four_text()}" f"Expected is: " f"{ContributeForumMessages.HOW_TO_CONTRIBUTE_OPTION_FOUR}", ) check.equal( - self.pages.ways_to_contribute_pages.get_first_fact_text(), + self.sumo_pages.ways_to_contribute_pages.get_first_fact_text(), ContributeForumMessages.FACT_FIRST_LINE, - f"Text is: {self.pages.ways_to_contribute_pages.get_first_fact_text()}" + f"Text is: {self.sumo_pages.ways_to_contribute_pages.get_first_fact_text()}" f"Expected is: {ContributeForumMessages.FACT_FIRST_LINE}", ) check.equal( - self.pages.ways_to_contribute_pages.get_second_fact_text(), + self.sumo_pages.ways_to_contribute_pages.get_second_fact_text(), ContributeForumMessages.FACT_SECOND_LINE, - f"Text is: {self.pages.ways_to_contribute_pages.get_second_fact_text()}" + f"Text is: {self.sumo_pages.ways_to_contribute_pages.get_second_fact_text()}" f"Expected is: {ContributeForumMessages.FACT_SECOND_LINE}", ) check.equal( - self.pages.ways_to_contribute_pages.get_other_ways_to_contribute_header_text(), + self.sumo_pages.ways_to_contribute_pages.get_other_ways_to_contribute_header_txt(), ContributeForumMessages.OTHER_WAYS_TO_CONTRIBUTE_HEADER, f"Text is: " - f"{self.pages.ways_to_contribute_pages.get_other_ways_to_contribute_header_text()}" + f"{self.sumo_pages.ways_to_contribute_pages.get_other_ways_to_contribute_header_txt()}" f"Expected is: " f"{ContributeForumMessages.OTHER_WAYS_TO_CONTRIBUTE_HEADER}", ) @@ -121,7 +115,7 @@ def test_contribute_forum_page_text(self): ] check.equal( - self.pages.ways_to_contribute_pages.get_other_ways_to_contribute_card_titles_text(), + self.sumo_pages.ways_to_contribute_pages.get_other_ways_to_contribute_card_title_txt(), other_ways_to_contribute_card_titles, "Other ways to contribute card titles are not the correct ones!", ) @@ -130,13 +124,12 @@ def test_contribute_forum_page_text(self): @pytest.mark.contributePagesTests def test_contribute_forum_page_images_are_not_broken(self): self.logger.info("Accessing the Contribute Forum page") - self.pages.ways_to_contribute_pages.navigate_to( + self.navigate_to_link( ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL ) self.logger.info("Verifying that the Contribute forum page images are not broken") - - for link in self.pages.ways_to_contribute_pages.get_all_page_image_links(): + for link in self.sumo_pages.ways_to_contribute_pages.get_all_page_image_links(): image_link = link.get_attribute("src") response = requests.get(image_link, stream=True) check.is_true(response.status_code < 400, f"The {image_link} image is broken") @@ -145,7 +138,7 @@ def test_contribute_forum_page_images_are_not_broken(self): @pytest.mark.contributePagesTests def test_contribute_forum_page_breadcrumbs(self): self.logger.info("Accessing the Contribute Forum page") - self.pages.ways_to_contribute_pages.navigate_to( + self.navigate_to_link( ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL ) @@ -157,38 +150,39 @@ def test_contribute_forum_page_breadcrumbs(self): ] check.equal( - self.pages.ways_to_contribute_pages.get_text_of_all_breadcrumbs(), + self.sumo_pages.ways_to_contribute_pages.get_text_of_all_breadcrumbs(), breadcrumbs, - f"Breadcrumbs are: {self.pages.ways_to_contribute_pages.get_text_of_all_breadcrumbs()}" + f"Breadcrumbs are: " + f"{self.sumo_pages.ways_to_contribute_pages.get_text_of_all_breadcrumbs()}" f"Expected: {breadcrumbs}", ) counter = 1 - for breadcrumb in self.pages.ways_to_contribute_pages.get_all_interactable_breadcrumbs(): + for breadcrumb in self.sumo_pages.ways_to_contribute_pages.get_interactable_breadcrumbs(): breadcrumb_to_click = ( - self.pages.ways_to_contribute_pages.get_all_interactable_breadcrumbs()[counter] + self.sumo_pages.ways_to_contribute_pages.get_interactable_breadcrumbs()[counter] ) - self.pages.ways_to_contribute_pages.click_on_breadcrumb(breadcrumb_to_click) + self.sumo_pages.ways_to_contribute_pages.click_on_breadcrumb(breadcrumb_to_click) if counter == 1: self.logger.info( "Verifying that the Contribute breadcrumb redirects to the Contribute page" ) check.equal( - self.pages.contribute_page.current_url(), + self.get_page_url(), ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL, f"Expected to be on {ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL}" - f"We are actual on {self.pages.contribute_page.current_url()}", + f"We are actual on {self.get_page_url()}", ) - self.pages.contribute_page.navigate_forward() + self.navigate_forward() counter -= 1 elif counter == 0: self.logger.info("Verifying that the Home breadcrumb redirects to the Homepage") check.equal( - self.pages.homepage.current_url(), + self.get_page_url(), HomepageMessages.STAGE_HOMEPAGE_URL, f"Expected to be on {HomepageMessages.STAGE_HOMEPAGE_URL}" - f"We are actual on {self.pages.homepage.current_url()}", + f"We are actual on {self.get_page_url()}", ) # Need to add tests for "How you can contribute" section @@ -197,7 +191,7 @@ def test_contribute_forum_page_breadcrumbs(self): @pytest.mark.contributePagesTests def test_contribute_forum_other_ways_to_contribute_redirect_to_the_correct_page(self): self.logger.info("Accessing the Contribute Forum page") - self.pages.ways_to_contribute_pages.navigate_to( + self.navigate_to_link( ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL ) @@ -205,7 +199,6 @@ def test_contribute_forum_other_ways_to_contribute_redirect_to_the_correct_page( "Verifying that the 'other ways to contribute'" " cards are redirecting to the correct SUMO page" ) - ways_to_contribute_links = [ ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL, ContributeLocalizationMessages.STAGE_CONTRIBUTE_LOCALIZATION_PAGE_URL, @@ -216,18 +209,18 @@ def test_contribute_forum_other_ways_to_contribute_redirect_to_the_correct_page( counter = 0 for ( element - ) in self.pages.ways_to_contribute_pages.get_all_other_ways_to_contribute_card_list(): + ) in self.sumo_pages.ways_to_contribute_pages.get_other_ways_to_contribute_card_list(): card = ( - self.pages.ways_to_contribute_pages.get_all_other_ways_to_contribute_card_list()[ + self.sumo_pages.ways_to_contribute_pages.get_other_ways_to_contribute_card_list()[ counter ] ) - self.pages.ways_to_contribute_pages.click_on_other_way_to_contribute_card(card) + self.sumo_pages.ways_to_contribute_pages.click_on_other_way_to_contribute_card(card) check.equal( ways_to_contribute_links[counter], - self.pages.ways_to_contribute_pages.current_url(), + self.get_page_url(), f"Expected the following URL: {ways_to_contribute_links[counter]}" - f"Received: {self.pages.ways_to_contribute_pages.current_url()}", + f"Received: {self.get_page_url()}", ) - self.pages.contribute_page.navigate_back() + self.navigate_back() counter += 1 diff --git a/selenium_tests/tests/contribute_pages_tests/test_contribute_localization_page.py b/playwright_tests/tests/contribute_pages_tests/test_contribute_localization_page.py similarity index 61% rename from selenium_tests/tests/contribute_pages_tests/test_contribute_localization_page.py rename to playwright_tests/tests/contribute_pages_tests/test_contribute_localization_page.py index ad5e5b999be..1667d8ec92b 100644 --- a/selenium_tests/tests/contribute_pages_tests/test_contribute_localization_page.py +++ b/playwright_tests/tests/contribute_pages_tests/test_contribute_localization_page.py @@ -2,26 +2,20 @@ import pytest_check as check import requests -from selenium_tests.core.test_utilities import TestUtilities -from selenium_tests.messages.contribute_pages_messages.con_forum_page_messages import ( - ContributeForumMessages, -) -from selenium_tests.messages.contribute_pages_messages.con_help_articles_page_messages import ( - ContributeHelpArticlesMessages, -) -from selenium_tests.messages.contribute_pages_messages.con_localization_page_messages import ( - ContributeLocalizationMessages, -) -from selenium_tests.messages.contribute_pages_messages.con_mobile_support_page_messages import ( - ContributeMobileSupportMessages, -) -from selenium_tests.messages.contribute_pages_messages.con_page_messages import ( - ContributePageMessages, -) -from selenium_tests.messages.contribute_pages_messages.con_social_support_messages import ( - ContributeSocialSupportMessages, -) -from selenium_tests.messages.homepage_messages import HomepageMessages +from playwright_tests.core.testutilities import TestUtilities +from playwright_tests.messages.contribute_pages_messages.con_forum_page_messages import ( + ContributeForumMessages) +from playwright_tests.messages.contribute_pages_messages.con_help_articles_page_messages import ( + ContributeHelpArticlesMessages) +from playwright_tests.messages.contribute_pages_messages.con_localization_page_messages import ( + ContributeLocalizationMessages) +from playwright_tests.messages.contribute_pages_messages.con_mobile_support_page_messages import ( + ContributeMobileSupportMessages) +from playwright_tests.messages.contribute_pages_messages.con_page_messages import ( + ContributePageMessages) +from playwright_tests.messages.contribute_pages_messages.con_social_support_messages import ( + ContributeSocialSupportMessages) +from playwright_tests.messages.homepage_messages import HomepageMessages class TestContributeLocalizationPage(TestUtilities): @@ -29,39 +23,40 @@ class TestContributeLocalizationPage(TestUtilities): @pytest.mark.contributePagesTests def test_contribute_localization_page_text(self): self.logger.info("Accessing the Contribute localization page") - self.pages.ways_to_contribute_pages.navigate_to( + self.navigate_to_link( ContributeLocalizationMessages.STAGE_CONTRIBUTE_LOCALIZATION_PAGE_URL ) self.logger.info( "Verifying that the Contribute localization page contains the correct strings" ) - check.equal( - self.pages.ways_to_contribute_pages.get_hero_main_header_text(), + self.sumo_pages.ways_to_contribute_pages.get_hero_main_header_text(), ContributeLocalizationMessages.HERO_PAGE_TITLE, - f"Text is: {self.pages.ways_to_contribute_pages.get_hero_main_header_text()}" + f"Text is: {self.sumo_pages.ways_to_contribute_pages.get_hero_main_header_text()}" f"Expected: {ContributeLocalizationMessages.HERO_PAGE_TITLE}", ) check.equal( - self.pages.ways_to_contribute_pages.get_hero_second_header_text(), + self.sumo_pages.ways_to_contribute_pages.get_hero_second_header_text(), ContributeLocalizationMessages.HERO_SECOND_TITLE, - f"Text is: {self.pages.ways_to_contribute_pages.get_hero_second_header_text()}" + f"Text is: " + f"{self.sumo_pages.ways_to_contribute_pages.get_hero_second_header_text()}" f"Expected: {ContributeLocalizationMessages.HERO_SECOND_TITLE}", ) check.equal( - self.pages.ways_to_contribute_pages.get_hero_text(), + self.sumo_pages.ways_to_contribute_pages.get_hero_text(), ContributeLocalizationMessages.HERO_TEXT, - f"Text is: {self.pages.ways_to_contribute_pages.get_hero_text()}" + f"Text is: {self.sumo_pages.ways_to_contribute_pages.get_hero_text()}" f"Expected: {ContributeLocalizationMessages.HERO_TEXT}", ) check.equal( - self.pages.ways_to_contribute_pages.get_how_to_contribute_header_text(), + self.sumo_pages.ways_to_contribute_pages.get_how_to_contribute_header_text(), ContributeLocalizationMessages.HOW_TO_CONTRIBUTE_HEADER, - f"Text is: {self.pages.ways_to_contribute_pages.get_how_to_contribute_header_text()}" + f"Text is: " + f"{self.sumo_pages.ways_to_contribute_pages.get_how_to_contribute_header_text()}" f"Expected is: {ContributeLocalizationMessages.HOW_TO_CONTRIBUTE_HEADER}", ) @@ -76,39 +71,39 @@ def test_contribute_localization_page_text(self): ] check.equal( - self.pages.ways_to_contribute_pages.get_how_to_contribute_link_options_text(), + self.sumo_pages.ways_to_contribute_pages.get_how_to_contribute_link_options_text(), card_titles, "How you can contribute steps are incorrect!", ) check.equal( - self.pages.ways_to_contribute_pages.get_how_to_contribute_option_four_text(), + self.sumo_pages.ways_to_contribute_pages.get_how_to_contribute_option_four_text(), ContributeLocalizationMessages.HOW_TO_CONTRIBUTE_OPTION_FOUR, f"Text is: " - f"{self.pages.ways_to_contribute_pages.get_how_to_contribute_option_four_text()}" + f"{self.sumo_pages.ways_to_contribute_pages.get_how_to_contribute_option_four_text()}" f"Expected is: " f"{ContributeLocalizationMessages.HOW_TO_CONTRIBUTE_OPTION_FOUR}", ) check.equal( - self.pages.ways_to_contribute_pages.get_first_fact_text(), + self.sumo_pages.ways_to_contribute_pages.get_first_fact_text(), ContributeLocalizationMessages.FACT_FIRST_LINE, - f"Text is: {self.pages.ways_to_contribute_pages.get_first_fact_text()}" + f"Text is: {self.sumo_pages.ways_to_contribute_pages.get_first_fact_text()}" f"Expected is: {ContributeLocalizationMessages.FACT_FIRST_LINE}", ) check.equal( - self.pages.ways_to_contribute_pages.get_second_fact_text(), + self.sumo_pages.ways_to_contribute_pages.get_second_fact_text(), ContributeLocalizationMessages.FACT_SECOND_LINE, - f"Text is: {self.pages.ways_to_contribute_pages.get_second_fact_text()}" + f"Text is: {self.sumo_pages.ways_to_contribute_pages.get_second_fact_text()}" f"Expected is: {ContributeLocalizationMessages.FACT_SECOND_LINE}", ) check.equal( - self.pages.ways_to_contribute_pages.get_other_ways_to_contribute_header_text(), + self.sumo_pages.ways_to_contribute_pages.get_other_ways_to_contribute_header_txt(), ContributeLocalizationMessages.OTHER_WAYS_TO_CONTRIBUTE_HEADER, f"Text is: " - f"{self.pages.ways_to_contribute_pages.get_other_ways_to_contribute_header_text()}" + f"{self.sumo_pages.ways_to_contribute_pages.get_other_ways_to_contribute_header_txt()}" f"Expected is: " f"{ContributeLocalizationMessages.OTHER_WAYS_TO_CONTRIBUTE_HEADER}", ) @@ -121,7 +116,7 @@ def test_contribute_localization_page_text(self): ] check.equal( - self.pages.ways_to_contribute_pages.get_other_ways_to_contribute_card_titles_text(), + self.sumo_pages.ways_to_contribute_pages.get_other_ways_to_contribute_card_title_txt(), other_ways_to_contribute_card_titles, "Other ways to contribute card titles are not the correct ones!", ) @@ -130,13 +125,12 @@ def test_contribute_localization_page_text(self): @pytest.mark.contributePagesTests def test_contribute_localization_page_images_are_not_broken(self): self.logger.info("Accessing the Contribute localization page") - self.pages.ways_to_contribute_pages.navigate_to( + self.navigate_to_link( ContributeLocalizationMessages.STAGE_CONTRIBUTE_LOCALIZATION_PAGE_URL ) self.logger.info("Verifying that the Contribute localization page images are not broken") - - for link in self.pages.ways_to_contribute_pages.get_all_page_image_links(): + for link in self.sumo_pages.ways_to_contribute_pages.get_all_page_image_links(): image_link = link.get_attribute("src") response = requests.get(image_link, stream=True) check.is_true(response.status_code < 400, f"The {image_link} image is broken") @@ -145,7 +139,7 @@ def test_contribute_localization_page_images_are_not_broken(self): @pytest.mark.contributePagesTests def test_contribute_localization_page_breadcrumbs(self): self.logger.info("Accessing the Contribute localization page") - self.pages.ways_to_contribute_pages.navigate_to( + self.navigate_to_link( ContributeLocalizationMessages.STAGE_CONTRIBUTE_LOCALIZATION_PAGE_URL ) @@ -157,38 +151,39 @@ def test_contribute_localization_page_breadcrumbs(self): ] check.equal( - self.pages.ways_to_contribute_pages.get_text_of_all_breadcrumbs(), + self.sumo_pages.ways_to_contribute_pages.get_text_of_all_breadcrumbs(), breadcrumbs, - f"Breadcrumbs are: {self.pages.ways_to_contribute_pages.get_text_of_all_breadcrumbs()}" + f"Breadcrumbs are: " + f"{self.sumo_pages.ways_to_contribute_pages.get_text_of_all_breadcrumbs()}" f"Expected: {breadcrumbs}", ) counter = 1 - for breadcrumb in self.pages.ways_to_contribute_pages.get_all_interactable_breadcrumbs(): + for breadcrumb in self.sumo_pages.ways_to_contribute_pages.get_interactable_breadcrumbs(): breadcrumb_to_click = ( - self.pages.ways_to_contribute_pages.get_all_interactable_breadcrumbs()[counter] + self.sumo_pages.ways_to_contribute_pages.get_interactable_breadcrumbs()[counter] ) - self.pages.ways_to_contribute_pages.click_on_breadcrumb(breadcrumb_to_click) + self.sumo_pages.ways_to_contribute_pages.click_on_breadcrumb(breadcrumb_to_click) if counter == 1: self.logger.info( "Verifying that the Contribute breadcrumb redirects to the Contribute page" ) check.equal( - self.pages.contribute_page.current_url(), + self.get_page_url(), ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL, f"Expected to be on {ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL}" - f"We are actual on {self.pages.contribute_page.current_url()}", + f"We are actual on {self.get_page_url()}", ) - self.pages.contribute_page.navigate_forward() + self.navigate_forward() counter -= 1 elif counter == 0: self.logger.info("Verifying that the Home breadcrumb redirects to the Homepage") check.equal( - self.pages.homepage.current_url(), + self.get_page_url(), HomepageMessages.STAGE_HOMEPAGE_URL, f"Expected to be on {HomepageMessages.STAGE_HOMEPAGE_URL}" - f"We are actual on {self.pages.homepage.current_url()}", + f"We are actual on {self.get_page_url()}", ) # Need to add tests for "How you can contribute" section @@ -197,7 +192,7 @@ def test_contribute_localization_page_breadcrumbs(self): @pytest.mark.contributePagesTests def test_contribute_localization_other_ways_to_contribute_redirect_to_the_correct_page(self): self.logger.info("Accessing the Contribute Forum page") - self.pages.ways_to_contribute_pages.navigate_to( + self.navigate_to_link( ContributeLocalizationMessages.STAGE_CONTRIBUTE_LOCALIZATION_PAGE_URL ) @@ -205,7 +200,6 @@ def test_contribute_localization_other_ways_to_contribute_redirect_to_the_correc "Verifying that the 'other ways to contribute' " "cards are redirecting to the correct SUMO page" ) - ways_to_contribute_links = [ ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL, ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL, @@ -216,18 +210,18 @@ def test_contribute_localization_other_ways_to_contribute_redirect_to_the_correc counter = 0 for ( element - ) in self.pages.ways_to_contribute_pages.get_all_other_ways_to_contribute_card_list(): + ) in self.sumo_pages.ways_to_contribute_pages.get_other_ways_to_contribute_card_list(): card = ( - self.pages.ways_to_contribute_pages.get_all_other_ways_to_contribute_card_list()[ + self.sumo_pages.ways_to_contribute_pages.get_other_ways_to_contribute_card_list()[ counter ] ) - self.pages.ways_to_contribute_pages.click_on_other_way_to_contribute_card(card) + self.sumo_pages.ways_to_contribute_pages.click_on_other_way_to_contribute_card(card) check.equal( ways_to_contribute_links[counter], - self.pages.ways_to_contribute_pages.current_url(), + self.get_page_url(), f"Expected the following URL: {ways_to_contribute_links[counter]}" - f"Received: {self.pages.ways_to_contribute_pages.current_url()}", + f"Received: {self.get_page_url()}", ) - self.pages.contribute_page.navigate_back() + self.navigate_back() counter += 1 diff --git a/selenium_tests/tests/contribute_pages_tests/test_contribute_mobile_page.py b/playwright_tests/tests/contribute_pages_tests/test_contribute_mobile_page.py similarity index 61% rename from selenium_tests/tests/contribute_pages_tests/test_contribute_mobile_page.py rename to playwright_tests/tests/contribute_pages_tests/test_contribute_mobile_page.py index 1d8a78c24ab..57a3cdd9d67 100644 --- a/selenium_tests/tests/contribute_pages_tests/test_contribute_mobile_page.py +++ b/playwright_tests/tests/contribute_pages_tests/test_contribute_mobile_page.py @@ -2,26 +2,20 @@ import pytest_check as check import requests -from selenium_tests.core.test_utilities import TestUtilities -from selenium_tests.messages.contribute_pages_messages.con_forum_page_messages import ( - ContributeForumMessages, -) -from selenium_tests.messages.contribute_pages_messages.con_help_articles_page_messages import ( - ContributeHelpArticlesMessages, -) -from selenium_tests.messages.contribute_pages_messages.con_localization_page_messages import ( - ContributeLocalizationMessages, -) -from selenium_tests.messages.contribute_pages_messages.con_mobile_support_page_messages import ( - ContributeMobileSupportMessages, -) -from selenium_tests.messages.contribute_pages_messages.con_page_messages import ( - ContributePageMessages, -) -from selenium_tests.messages.contribute_pages_messages.con_social_support_messages import ( - ContributeSocialSupportMessages, -) -from selenium_tests.messages.homepage_messages import HomepageMessages +from playwright_tests.core.testutilities import TestUtilities +from playwright_tests.messages.contribute_pages_messages.con_forum_page_messages import ( + ContributeForumMessages) +from playwright_tests.messages.contribute_pages_messages.con_help_articles_page_messages import ( + ContributeHelpArticlesMessages) +from playwright_tests.messages.contribute_pages_messages.con_localization_page_messages import ( + ContributeLocalizationMessages) +from playwright_tests.messages.contribute_pages_messages.con_mobile_support_page_messages import ( + ContributeMobileSupportMessages) +from playwright_tests.messages.contribute_pages_messages.con_page_messages import ( + ContributePageMessages) +from playwright_tests.messages.contribute_pages_messages.con_social_support_messages import ( + ContributeSocialSupportMessages) +from playwright_tests.messages.homepage_messages import HomepageMessages class TestContributeMobilePage(TestUtilities): @@ -29,39 +23,40 @@ class TestContributeMobilePage(TestUtilities): @pytest.mark.contributePagesTests def test_contribute_mobile_page_text(self): self.logger.info("Accessing the Contribute Mobile Store page") - self.pages.ways_to_contribute_pages.navigate_to( + self.navigate_to_link( ContributeMobileSupportMessages.STAGE_CONTRIBUTE_MOBILE_SUPPORT_PAGE_URL ) self.logger.info( "Verifying that the Contribute Mobile Store page contains the correct strings" ) - check.equal( - self.pages.ways_to_contribute_pages.get_hero_main_header_text(), + self.sumo_pages.ways_to_contribute_pages.get_hero_main_header_text(), ContributeMobileSupportMessages.HERO_PAGE_TITLE, - f"Text is: {self.pages.ways_to_contribute_pages.get_hero_main_header_text()}" + f"Text is: {self.sumo_pages.ways_to_contribute_pages.get_hero_main_header_text()}" f"Expected: {ContributeMobileSupportMessages.HERO_PAGE_TITLE}", ) check.equal( - self.pages.ways_to_contribute_pages.get_hero_second_header_text(), + self.sumo_pages.ways_to_contribute_pages.get_hero_second_header_text(), ContributeMobileSupportMessages.HERO_SECOND_TITLE, - f"Text is: {self.pages.ways_to_contribute_pages.get_hero_second_header_text()}" + f"Text is: " + f"{self.sumo_pages.ways_to_contribute_pages.get_hero_second_header_text()}" f"Expected: {ContributeMobileSupportMessages.HERO_SECOND_TITLE}", ) check.equal( - self.pages.ways_to_contribute_pages.get_hero_text(), + self.sumo_pages.ways_to_contribute_pages.get_hero_text(), ContributeMobileSupportMessages.HERO_TEXT, - f"Text is: {self.pages.ways_to_contribute_pages.get_hero_text()}" + f"Text is: {self.sumo_pages.ways_to_contribute_pages.get_hero_text()}" f"Expected: {ContributeMobileSupportMessages.HERO_TEXT}", ) check.equal( - self.pages.ways_to_contribute_pages.get_how_to_contribute_header_text(), + self.sumo_pages.ways_to_contribute_pages.get_how_to_contribute_header_text(), ContributeMobileSupportMessages.HOW_TO_CONTRIBUTE_HEADER, - f"Text is: {self.pages.ways_to_contribute_pages.get_how_to_contribute_header_text()}" + f"Text is: " + f"{self.sumo_pages.ways_to_contribute_pages.get_how_to_contribute_header_text()}" f"Expected is: {ContributeMobileSupportMessages.HOW_TO_CONTRIBUTE_HEADER}", ) @@ -76,39 +71,39 @@ def test_contribute_mobile_page_text(self): ] check.equal( - self.pages.ways_to_contribute_pages.get_how_to_contribute_link_options_text(), + self.sumo_pages.ways_to_contribute_pages.get_how_to_contribute_link_options_text(), card_titles, "How you can contribute steps are incorrect!", ) check.equal( - self.pages.ways_to_contribute_pages.get_how_to_contribute_option_four_text(), + self.sumo_pages.ways_to_contribute_pages.get_how_to_contribute_option_four_text(), ContributeMobileSupportMessages.HOW_TO_CONTRIBUTE_OPTION_FOUR, f"Text is: " - f"{self.pages.ways_to_contribute_pages.get_how_to_contribute_option_four_text()}" + f"{self.sumo_pages.ways_to_contribute_pages.get_how_to_contribute_option_four_text()}" f"Expected is: " f"{ContributeMobileSupportMessages.HOW_TO_CONTRIBUTE_OPTION_FOUR}", ) check.equal( - self.pages.ways_to_contribute_pages.get_first_fact_text(), + self.sumo_pages.ways_to_contribute_pages.get_first_fact_text(), ContributeMobileSupportMessages.FACT_FIRST_LINE, - f"Text is: {self.pages.ways_to_contribute_pages.get_first_fact_text()}" + f"Text is: {self.sumo_pages.ways_to_contribute_pages.get_first_fact_text()}" f"Expected is: {ContributeMobileSupportMessages.FACT_FIRST_LINE}", ) check.equal( - self.pages.ways_to_contribute_pages.get_second_fact_text(), + self.sumo_pages.ways_to_contribute_pages.get_second_fact_text(), ContributeMobileSupportMessages.FACT_SECOND_LINE, - f"Text is: {self.pages.ways_to_contribute_pages.get_second_fact_text()}" + f"Text is: {self.sumo_pages.ways_to_contribute_pages.get_second_fact_text()}" f"Expected is: {ContributeMobileSupportMessages.FACT_SECOND_LINE}", ) check.equal( - self.pages.ways_to_contribute_pages.get_other_ways_to_contribute_header_text(), + self.sumo_pages.ways_to_contribute_pages.get_other_ways_to_contribute_header_txt(), ContributeMobileSupportMessages.OTHER_WAYS_TO_CONTRIBUTE_HEADER, f"Text is: " - f"{self.pages.ways_to_contribute_pages.get_other_ways_to_contribute_header_text()}" + f"{self.sumo_pages.ways_to_contribute_pages.get_other_ways_to_contribute_header_txt()}" f"Expected is: " f"{ContributeMobileSupportMessages.OTHER_WAYS_TO_CONTRIBUTE_HEADER}", ) @@ -121,7 +116,7 @@ def test_contribute_mobile_page_text(self): ] check.equal( - self.pages.ways_to_contribute_pages.get_other_ways_to_contribute_card_titles_text(), + self.sumo_pages.ways_to_contribute_pages.get_other_ways_to_contribute_card_title_txt(), other_ways_to_contribute_card_titles, "Other ways to contribute card titles are not the correct ones!", ) @@ -130,13 +125,12 @@ def test_contribute_mobile_page_text(self): @pytest.mark.contributePagesTests def test_contribute_mobile_page_images_are_not_broken(self): self.logger.info("Accessing the Contribute Mobile store page") - self.pages.ways_to_contribute_pages.navigate_to( + self.navigate_to_link( ContributeMobileSupportMessages.STAGE_CONTRIBUTE_MOBILE_SUPPORT_PAGE_URL ) self.logger.info("Verifying that the Contribute Mobile store page images are not broken") - - for link in self.pages.ways_to_contribute_pages.get_all_page_image_links(): + for link in self.sumo_pages.ways_to_contribute_pages.get_all_page_image_links(): image_link = link.get_attribute("src") response = requests.get(image_link, stream=True) check.is_true(response.status_code < 400, f"The {image_link} image is broken") @@ -145,7 +139,7 @@ def test_contribute_mobile_page_images_are_not_broken(self): @pytest.mark.contributePagesTests def test_contribute_mobile_page_breadcrumbs(self): self.logger.info("Accessing the Contribute Mobile Store page") - self.pages.ways_to_contribute_pages.navigate_to( + self.navigate_to_link( ContributeMobileSupportMessages.STAGE_CONTRIBUTE_MOBILE_SUPPORT_PAGE_URL ) @@ -157,38 +151,39 @@ def test_contribute_mobile_page_breadcrumbs(self): ] check.equal( - self.pages.ways_to_contribute_pages.get_text_of_all_breadcrumbs(), + self.sumo_pages.ways_to_contribute_pages.get_text_of_all_breadcrumbs(), breadcrumbs, - f"Breadcrumbs are: {self.pages.ways_to_contribute_pages.get_text_of_all_breadcrumbs()}" + f"Breadcrumbs are: " + f"{self.sumo_pages.ways_to_contribute_pages.get_text_of_all_breadcrumbs()}" f"Expected: {breadcrumbs}", ) counter = 1 - for breadcrumb in self.pages.ways_to_contribute_pages.get_all_interactable_breadcrumbs(): + for breadcrumb in self.sumo_pages.ways_to_contribute_pages.get_interactable_breadcrumbs(): breadcrumb_to_click = ( - self.pages.ways_to_contribute_pages.get_all_interactable_breadcrumbs()[counter] + self.sumo_pages.ways_to_contribute_pages.get_interactable_breadcrumbs()[counter] ) - self.pages.ways_to_contribute_pages.click_on_breadcrumb(breadcrumb_to_click) + self.sumo_pages.ways_to_contribute_pages.click_on_breadcrumb(breadcrumb_to_click) if counter == 1: self.logger.info( "Verifying that the Contribute breadcrumb redirects to the Contribute page" ) check.equal( - self.pages.contribute_page.current_url(), + self.get_page_url(), ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL, f"Expected to be on {ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL}" - f"We are actual on {self.pages.contribute_page.current_url()}", + f"We are actual on {self.get_page_url()}", ) - self.pages.contribute_page.navigate_forward() + self.navigate_forward() counter -= 1 elif counter == 0: self.logger.info("Verifying that the Home breadcrumb redirects to the Homepage") check.equal( - self.pages.homepage.current_url(), + self.get_page_url(), HomepageMessages.STAGE_HOMEPAGE_URL, f"Expected to be on {HomepageMessages.STAGE_HOMEPAGE_URL}" - f"We are actual on {self.pages.homepage.current_url()}", + f"We are actual on {self.get_page_url()}", ) # Need to add tests for "How you can contribute" section @@ -197,7 +192,7 @@ def test_contribute_mobile_page_breadcrumbs(self): @pytest.mark.contributePagesTests def test_contribute_mobile_other_ways_to_contribute_redirect_to_the_correct_page(self): self.logger.info("Accessing the Contribute Mobile Store page") - self.pages.ways_to_contribute_pages.navigate_to( + self.navigate_to_link( ContributeMobileSupportMessages.STAGE_CONTRIBUTE_MOBILE_SUPPORT_PAGE_URL ) @@ -205,7 +200,6 @@ def test_contribute_mobile_other_ways_to_contribute_redirect_to_the_correct_page "Verifying that the 'other ways to contribute' " "cards are redirecting to the correct SUMO page" ) - ways_to_contribute_links = [ ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL, ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL, @@ -215,19 +209,19 @@ def test_contribute_mobile_other_ways_to_contribute_redirect_to_the_correct_page counter = 0 for ( - element - ) in self.pages.ways_to_contribute_pages.get_all_other_ways_to_contribute_card_list(): + element + ) in self.sumo_pages.ways_to_contribute_pages.get_other_ways_to_contribute_card_list(): card = ( - self.pages.ways_to_contribute_pages.get_all_other_ways_to_contribute_card_list()[ + self.sumo_pages.ways_to_contribute_pages.get_other_ways_to_contribute_card_list()[ counter ] ) - self.pages.ways_to_contribute_pages.click_on_other_way_to_contribute_card(card) + self.sumo_pages.ways_to_contribute_pages.click_on_other_way_to_contribute_card(card) check.equal( ways_to_contribute_links[counter], - self.pages.ways_to_contribute_pages.current_url(), + self.get_page_url(), f"Expected the following URL: {ways_to_contribute_links[counter]}" - f"Received: {self.pages.ways_to_contribute_pages.current_url()}", + f"Received: {self.get_page_url()}", ) - self.pages.contribute_page.navigate_back() + self.navigate_back() counter += 1 diff --git a/playwright_tests/tests/contribute_pages_tests/test_contribute_page.py b/playwright_tests/tests/contribute_pages_tests/test_contribute_page.py new file mode 100644 index 00000000000..7586b2ef01e --- /dev/null +++ b/playwright_tests/tests/contribute_pages_tests/test_contribute_page.py @@ -0,0 +1,171 @@ +import pytest +import pytest_check as check +import requests + +from playwright_tests.core.testutilities import TestUtilities +from playwright_tests.messages.contribute_pages_messages.con_forum_page_messages import ( + ContributeForumMessages) +from playwright_tests.messages.contribute_pages_messages.con_help_articles_page_messages import ( + ContributeHelpArticlesMessages) +from playwright_tests.messages.contribute_pages_messages.con_localization_page_messages import ( + ContributeLocalizationMessages) +from playwright_tests.messages.contribute_pages_messages.con_mobile_support_page_messages import ( + ContributeMobileSupportMessages) +from playwright_tests.messages.contribute_pages_messages.con_page_messages import ( + ContributePageMessages) +from playwright_tests.messages.contribute_pages_messages.con_social_support_messages import ( + ContributeSocialSupportMessages) +from playwright_tests.messages.homepage_messages import HomepageMessages + + +class TestContributePage(TestUtilities): + + # C2165413 + @pytest.mark.contributePagesTests + def test_contribute_page_text(self): + self.logger.info("Clicking on the Contribute top-navbar option") + self.sumo_pages.top_navbar.click_on_contribute_top_navbar_option() + + self.logger.info("Verifying that the correct page hero header text is displayed") + check.equal( + self.sumo_pages.contribute_page.get_page_hero_main_header_text(), + ContributePageMessages.HERO_MAIN_PAGE_TITLE, + f"Text is: {self.sumo_pages.contribute_page.get_page_hero_main_header_text()} " + f"Expected: {ContributePageMessages.HERO_MAIN_PAGE_TITLE}" + ) + + self.logger.info("Verifying that the correct page hero need help subtext is displayed") + check.equal( + self.sumo_pages.contribute_page.get_page_hero_main_subtext(), + ContributePageMessages.HERO_HELP_MILLION_OF_USERS_TEXT, + f"Text is: {self.sumo_pages.contribute_page.get_page_hero_main_subtext()} " + f"Expected: {ContributePageMessages.HERO_HELP_MILLION_OF_USERS_TEXT}", + ) + + self.logger.info("Verifying that the correct need help header text is displayed") + check.equal( + self.sumo_pages.contribute_page.get_page_hero_need_help_header_text(), + ContributePageMessages.HERO_NEED_YOUR_HELP_TITLE, + f"Text is: " + f"{self.sumo_pages.contribute_page.get_page_hero_need_help_header_text()}" + f" Expected: {ContributePageMessages.HERO_NEED_YOUR_HELP_TITLE}", + ) + + self.logger.info("Verifying that the correct need help subtext is displayed") + check.equal( + self.sumo_pages.contribute_page.get_page_hero_need_help_subtext(), + ContributePageMessages.HERO_NEED_YOUR_HELP_PARAGRAPH, + f"Text is: {self.sumo_pages.contribute_page.get_page_hero_need_help_subtext()}." + f"Expected: {ContributePageMessages.HERO_NEED_YOUR_HELP_PARAGRAPH}", + ) + + self.logger.info("Verifying that the correct get way to contribute header is displayed") + check.equal( + self.sumo_pages.contribute_page.get_way_to_contribute_header_text(), + ContributePageMessages.PICK_A_WAY_TO_CONTRIBUTE_HEADER, + f"Text is: {self.sumo_pages.contribute_page.get_way_to_contribute_header_text()}" + f"Expected: {ContributePageMessages.PICK_A_WAY_TO_CONTRIBUTE_HEADER}", + ) + + 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, + ] + + self.logger.info("Verifying that the correct list of ways to contribute card titles is " + "displayed") + check.equal( + card_titles, + self.sumo_pages.contribute_page.get_way_to_contribute_card_titles_text(), + "Pick a way to contribute card titles are not the correct ones", + ) + + self.logger.info("Verifying that the correct about us header text is displayed") + check.equal( + self.sumo_pages.contribute_page.get_about_us_header_text(), + ContributePageMessages.ABOUT_US_HEADER, + f"Text is: {self.sumo_pages.contribute_page.get_about_us_header_text()}" + f"Expected: {ContributePageMessages.ABOUT_US_HEADER}", + ) + + self.logger.info("Verifying that the correct about us subtext is displayed") + check.equal( + self.sumo_pages.contribute_page.get_about_us_subtext(), + ContributePageMessages.ABOUT_US_CONTENT, + f"Text is: {self.sumo_pages.contribute_page.get_about_us_subtext()}" + f"Expected: {ContributePageMessages.ABOUT_US_CONTENT}", + ) + + # C2165413 + @pytest.mark.contributePagesTests + def test_contribute_page_images_are_not_broken(self): + self.logger.info("Clicking on the 'Contribute' top-navbar option") + self.sumo_pages.top_navbar.click_on_contribute_top_navbar_option() + + self.logger.info("Verifying that the contribute page images are not broken") + + for link in self.sumo_pages.contribute_page.get_all_page_links(): + image_link = link.get_attribute("src") + response = requests.get(image_link, stream=True) + check.is_true(response.status_code < 400, f'The {image_link} image is broken!') + + # C1949333 + @pytest.mark.contributePagesTests + def test_contribute_page_breadcrumbs(self): + self.logger.info("Clicking on the Contribute top-navbar option") + self.sumo_pages.top_navbar.click_on_contribute_top_navbar_option() + + breadcrumbs = [ + ContributePageMessages.FIRST_BREADCRUMB, + ContributePageMessages.SECOND_BREADCRUMB, + ] + + self.logger.info("Verifying that the correct breadcrumbs are displayed") + check.equal( + self.sumo_pages.contribute_page.get_breadcrumbs_text(), + breadcrumbs, + f"Breadcrumbs are: {self.sumo_pages.contribute_page.get_breadcrumbs_text()}" + f"Expected to be: {breadcrumbs}", + ) + + self.logger.info("Verifying that the home breadcrumb redirects to the homepage") + self.sumo_pages.contribute_page.click_on_home_breadcrumb() + + assert self.get_page_url() == HomepageMessages.STAGE_HOMEPAGE_URL, ( + f"{HomepageMessages.STAGE_HOMEPAGE_URL} page was expected to be displayed" + f"{self.get_page_url()} is displayed instead" + ) + + # C1949335,C1949336,C1949337,C1949338,C1949339,C1949355 + @pytest.mark.contributePagesTests + def test_way_to_contribute_redirects_to_correct_page(self): + self.logger.info("Clicking on the Contribute top-navbar option") + self.sumo_pages.top_navbar.click_on_contribute_top_navbar_option() + + 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, + ] + + self.logger.info( + "Verifying that the 'way to contribute' cards are redirecting to the correct SUMO page" + ) + + counter = 0 + for element in self.sumo_pages.contribute_page.get_list_of_contribute_cards(): + card = self.sumo_pages.contribute_page.get_list_of_contribute_cards()[counter] + self.sumo_pages.contribute_page.click_on_way_to_contribute_card(card) + check.equal( + ways_to_contribute_links[counter], + self.get_page_url(), + f"Expected the following URL: {ways_to_contribute_links[counter]}" + f"Received: {self.get_page_url()}", + ) + self.navigate_back() + counter += 1 diff --git a/selenium_tests/tests/contribute_pages_tests/test_contribute_social_media_page.py b/playwright_tests/tests/contribute_pages_tests/test_contribute_social_media_page.py similarity index 56% rename from selenium_tests/tests/contribute_pages_tests/test_contribute_social_media_page.py rename to playwright_tests/tests/contribute_pages_tests/test_contribute_social_media_page.py index 57369524f89..1df58c37943 100644 --- a/selenium_tests/tests/contribute_pages_tests/test_contribute_social_media_page.py +++ b/playwright_tests/tests/contribute_pages_tests/test_contribute_social_media_page.py @@ -1,26 +1,21 @@ import pytest -import requests import pytest_check as check -from selenium_tests.core.test_utilities import TestUtilities -from selenium_tests.messages.contribute_pages_messages.con_forum_page_messages import ( - ContributeForumMessages, -) -from selenium_tests.messages.contribute_pages_messages.con_help_articles_page_messages import ( - ContributeHelpArticlesMessages, -) -from selenium_tests.messages.contribute_pages_messages.con_localization_page_messages import ( - ContributeLocalizationMessages, -) -from selenium_tests.messages.contribute_pages_messages.con_mobile_support_page_messages import ( - ContributeMobileSupportMessages, -) -from selenium_tests.messages.contribute_pages_messages.con_page_messages import ( - ContributePageMessages, -) -from selenium_tests.messages.contribute_pages_messages.con_social_support_messages import ( - ContributeSocialSupportMessages, -) -from selenium_tests.messages.homepage_messages import HomepageMessages +import requests + +from playwright_tests.core.testutilities import TestUtilities +from playwright_tests.messages.contribute_pages_messages.con_forum_page_messages import ( + ContributeForumMessages) +from playwright_tests.messages.contribute_pages_messages.con_help_articles_page_messages import ( + ContributeHelpArticlesMessages) +from playwright_tests.messages.contribute_pages_messages.con_localization_page_messages import ( + ContributeLocalizationMessages) +from playwright_tests.messages.contribute_pages_messages.con_mobile_support_page_messages import ( + ContributeMobileSupportMessages) +from playwright_tests.messages.contribute_pages_messages.con_page_messages import ( + ContributePageMessages) +from playwright_tests.messages.contribute_pages_messages.con_social_support_messages import ( + ContributeSocialSupportMessages) +from playwright_tests.messages.homepage_messages import HomepageMessages class TestContributeSocialMediaPage(TestUtilities): @@ -28,39 +23,43 @@ class TestContributeSocialMediaPage(TestUtilities): @pytest.mark.contributePagesTests def test_contribute_social_page_text(self): self.logger.info("Accessing the Contribute Social Channels page") - self.pages.ways_to_contribute_pages.navigate_to( + self.navigate_to_link( ContributeSocialSupportMessages.STAGE_CONTRIBUTE_SOCIAL_SUPPORT_PAGE_URL ) self.logger.info( - "Verifying that the Contribute Social Channels page contains the correct strings" + "Verifying that the correct hero main header is displayed" ) - check.equal( - self.pages.ways_to_contribute_pages.get_hero_main_header_text(), + self.sumo_pages.ways_to_contribute_pages.get_hero_main_header_text(), ContributeSocialSupportMessages.HERO_PAGE_TITLE, - f"Text is: {self.pages.ways_to_contribute_pages.get_hero_main_header_text()}" + f"Text is: {self.sumo_pages.ways_to_contribute_pages.get_hero_main_header_text()}" f"Expected: {ContributeSocialSupportMessages.HERO_PAGE_TITLE}", ) + self.logger.info("Verifying that the correct hero second header is displayed") check.equal( - self.pages.ways_to_contribute_pages.get_hero_second_header_text(), + self.sumo_pages.ways_to_contribute_pages.get_hero_second_header_text(), ContributeSocialSupportMessages.HERO_SECOND_TITLE, - f"Text is: {self.pages.ways_to_contribute_pages.get_hero_second_header_text()}" + f"Text is: " + f"{self.sumo_pages.ways_to_contribute_pages.get_hero_second_header_text()}" f"Expected: {ContributeSocialSupportMessages.HERO_SECOND_TITLE}", ) + self.logger.info("Verifying that the correct get hero text is displayed") check.equal( - self.pages.ways_to_contribute_pages.get_hero_text(), + self.sumo_pages.ways_to_contribute_pages.get_hero_text(), ContributeSocialSupportMessages.HERO_TEXT, - f"Text is: {self.pages.ways_to_contribute_pages.get_hero_text()}" + f"Text is: {self.sumo_pages.ways_to_contribute_pages.get_hero_text()}" f"Expected: {ContributeSocialSupportMessages.HERO_TEXT}", ) + self.logger.info("Verifying that the correct how to contribute header text is displayed") check.equal( - self.pages.ways_to_contribute_pages.get_how_to_contribute_header_text(), + self.sumo_pages.ways_to_contribute_pages.get_how_to_contribute_header_text(), ContributeSocialSupportMessages.HOW_TO_CONTRIBUTE_HEADER, - f"Text is: {self.pages.ways_to_contribute_pages.get_how_to_contribute_header_text()}" + f"Text is: " + f"{self.sumo_pages.ways_to_contribute_pages.get_how_to_contribute_header_text()}" f"Expected is: {ContributeSocialSupportMessages.HOW_TO_CONTRIBUTE_HEADER}", ) @@ -74,40 +73,46 @@ def test_contribute_social_page_text(self): ContributeSocialSupportMessages.HOW_TO_CONTRIBUTE_OPTION_FIVE, ] + self.logger.info("Verifying that the correct how to contribute link option are displayed") check.equal( - self.pages.ways_to_contribute_pages.get_how_to_contribute_link_options_text(), + self.sumo_pages.ways_to_contribute_pages.get_how_to_contribute_link_options_text(), card_titles, "How you can contribute steps are incorrect!", ) + self.logger.info("Verifying that the correct option four text is displayed") check.equal( - self.pages.ways_to_contribute_pages.get_how_to_contribute_option_four_text(), + self.sumo_pages.ways_to_contribute_pages.get_how_to_contribute_option_four_text(), ContributeSocialSupportMessages.HOW_TO_CONTRIBUTE_OPTION_FOUR, f"Text is: " - f"{self.pages.ways_to_contribute_pages.get_how_to_contribute_option_four_text()}" + f"{self.sumo_pages.ways_to_contribute_pages.get_how_to_contribute_option_four_text()}" f"Expected is: " f"{ContributeSocialSupportMessages.HOW_TO_CONTRIBUTE_OPTION_FOUR}", ) + self.logger.info("Verifying that the correct page first fact text is displayed") check.equal( - self.pages.ways_to_contribute_pages.get_first_fact_text(), + self.sumo_pages.ways_to_contribute_pages.get_first_fact_text(), ContributeSocialSupportMessages.FACT_FIRST_LINE, - f"Text is: {self.pages.ways_to_contribute_pages.get_first_fact_text()}" + f"Text is: {self.sumo_pages.ways_to_contribute_pages.get_first_fact_text()}" f"Expected is: {ContributeSocialSupportMessages.FACT_FIRST_LINE}", ) + self.logger.info("Verifying that the correct second fact text is displayed") check.equal( - self.pages.ways_to_contribute_pages.get_second_fact_text(), + self.sumo_pages.ways_to_contribute_pages.get_second_fact_text(), ContributeSocialSupportMessages.FACT_SECOND_LINE, - f"Text is: {self.pages.ways_to_contribute_pages.get_second_fact_text()}" + f"Text is: {self.sumo_pages.ways_to_contribute_pages.get_second_fact_text()}" f"Expected is: {ContributeSocialSupportMessages.FACT_SECOND_LINE}", ) + self.logger.info("Verifying that the correct get other ways to contribute header is " + "displayed") check.equal( - self.pages.ways_to_contribute_pages.get_other_ways_to_contribute_header_text(), + self.sumo_pages.ways_to_contribute_pages.get_other_ways_to_contribute_header_txt(), ContributeSocialSupportMessages.OTHER_WAYS_TO_CONTRIBUTE_HEADER, f"Text is: " - f"{self.pages.ways_to_contribute_pages.get_other_ways_to_contribute_header_text()}" + f"{self.sumo_pages.ways_to_contribute_pages.get_other_ways_to_contribute_header_txt()}" f"Expected is: " f"{ContributeSocialSupportMessages.OTHER_WAYS_TO_CONTRIBUTE_HEADER}", ) @@ -119,8 +124,10 @@ def test_contribute_social_page_text(self): ContributeSocialSupportMessages.RESPOND_TO_MOBILE_STORE_REVIEWS_CARD_TITLE, ] + self.logger.info("Verifying that the other ways to contribute card titles are the " + "correct ones") check.equal( - self.pages.ways_to_contribute_pages.get_other_ways_to_contribute_card_titles_text(), + self.sumo_pages.ways_to_contribute_pages.get_other_ways_to_contribute_card_title_txt(), other_ways_to_contribute_card_titles, "Other ways to contribute card titles are not the correct ones!", ) @@ -129,13 +136,13 @@ def test_contribute_social_page_text(self): @pytest.mark.contributePagesTests def test_contribute_social_page_images_are_not_broken(self): self.logger.info("Accessing the Contribute Forum page") - self.pages.ways_to_contribute_pages.navigate_to( + self.navigate_to_link( ContributeSocialSupportMessages.STAGE_CONTRIBUTE_SOCIAL_SUPPORT_PAGE_URL ) self.logger.info("Verifying that the Contribute forum page images are not broken") - for link in self.pages.ways_to_contribute_pages.get_all_page_image_links(): + for link in self.sumo_pages.ways_to_contribute_pages.get_all_page_image_links(): image_link = link.get_attribute("src") response = requests.get(image_link, stream=True) check.is_true(response.status_code < 400, f"The {image_link} image is broken") @@ -144,7 +151,7 @@ def test_contribute_social_page_images_are_not_broken(self): @pytest.mark.contributePagesTests def test_contribute_social_page_breadcrumbs(self): self.logger.info("Accessing the Contribute Forum page") - self.pages.ways_to_contribute_pages.navigate_to( + self.navigate_to_link( ContributeSocialSupportMessages.STAGE_CONTRIBUTE_SOCIAL_SUPPORT_PAGE_URL ) @@ -156,38 +163,39 @@ def test_contribute_social_page_breadcrumbs(self): ] check.equal( - self.pages.ways_to_contribute_pages.get_text_of_all_breadcrumbs(), + self.sumo_pages.ways_to_contribute_pages.get_text_of_all_breadcrumbs(), breadcrumbs, - f"Breadcrumbs are: {self.pages.ways_to_contribute_pages.get_text_of_all_breadcrumbs()}" + f"Breadcrumbs are: " + f"{self.sumo_pages.ways_to_contribute_pages.get_text_of_all_breadcrumbs()}" f"Expected: {breadcrumbs}", ) counter = 1 - for breadcrumb in self.pages.ways_to_contribute_pages.get_all_interactable_breadcrumbs(): + for breadcrumb in self.sumo_pages.ways_to_contribute_pages.get_interactable_breadcrumbs(): breadcrumb_to_click = ( - self.pages.ways_to_contribute_pages.get_all_interactable_breadcrumbs()[counter] + self.sumo_pages.ways_to_contribute_pages.get_interactable_breadcrumbs()[counter] ) - self.pages.ways_to_contribute_pages.click_on_breadcrumb(breadcrumb_to_click) + self.sumo_pages.ways_to_contribute_pages.click_on_breadcrumb(breadcrumb_to_click) if counter == 1: self.logger.info( "Verifying that the Contribute breadcrumb redirects to the Contribute page" ) check.equal( - self.pages.contribute_page.current_url(), + self.get_page_url(), ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL, f"Expected to be on {ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL}" - f"We are actual on {self.pages.contribute_page.current_url()}", + f"We are actual on {self.get_page_url()}", ) - self.pages.contribute_page.navigate_forward() + self.navigate_forward() counter -= 1 elif counter == 0: self.logger.info("Verifying that the Home breadcrumb redirects to the Homepage") check.equal( - self.pages.homepage.current_url(), + self.get_page_url(), HomepageMessages.STAGE_HOMEPAGE_URL, f"Expected to be on {HomepageMessages.STAGE_HOMEPAGE_URL}" - f"We are actual on {self.pages.homepage.current_url()}", + f"We are actual on {self.get_page_url()}", ) # Need to add tests for "How you can contribute" section @@ -196,7 +204,7 @@ def test_contribute_social_page_breadcrumbs(self): @pytest.mark.contributePagesTests def test_contribute_social_other_ways_to_contribute_redirect_to_the_correct_page(self): self.logger.info("Accessing the Contribute Forum page") - self.pages.ways_to_contribute_pages.navigate_to( + self.navigate_to_link( ContributeSocialSupportMessages.STAGE_CONTRIBUTE_SOCIAL_SUPPORT_PAGE_URL ) @@ -214,19 +222,19 @@ def test_contribute_social_other_ways_to_contribute_redirect_to_the_correct_page counter = 0 for ( - element - ) in self.pages.ways_to_contribute_pages.get_all_other_ways_to_contribute_card_list(): + element + ) in self.sumo_pages.ways_to_contribute_pages.get_other_ways_to_contribute_card_list(): card = ( - self.pages.ways_to_contribute_pages.get_all_other_ways_to_contribute_card_list()[ + self.sumo_pages.ways_to_contribute_pages.get_other_ways_to_contribute_card_list()[ counter ] ) - self.pages.ways_to_contribute_pages.click_on_other_way_to_contribute_card(card) + self.sumo_pages.ways_to_contribute_pages.click_on_other_way_to_contribute_card(card) check.equal( ways_to_contribute_links[counter], - self.pages.ways_to_contribute_pages.current_url(), + self.get_page_url(), f"Expected the following URL: {ways_to_contribute_links[counter]}" - f"Received: {self.pages.ways_to_contribute_pages.current_url()}", + f"Received: {self.get_page_url()}", ) - self.pages.contribute_page.navigate_back() + self.navigate_back() counter += 1 diff --git a/selenium_tests/tests/footer_section_tests/test_footer.py b/playwright_tests/tests/footer_tests/test_footer.py similarity index 58% rename from selenium_tests/tests/footer_section_tests/test_footer.py rename to playwright_tests/tests/footer_tests/test_footer.py index 7b64e8fab4f..edf3afdba55 100644 --- a/selenium_tests/tests/footer_section_tests/test_footer.py +++ b/playwright_tests/tests/footer_tests/test_footer.py @@ -1,30 +1,41 @@ import pytest import requests import pytest_check as check -from selenium_tests.core.test_utilities import TestUtilities + +from playwright_tests.core.testutilities import TestUtilities +from urllib.parse import urljoin class TestFooter(TestUtilities): - # C945147 + + # 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.pages.footer_section.get_all_footer_links(): - url = link.get_attribute("href") + 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 = 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 that do not identify a User-Agent. # We are fetching the User-Agent via the JS executor, # constructing and passing the header to our request. - user_agent = self.driver.execute_script("return navigator.userAgent") + user_agent = self.page.evaluate("navigator.userAgent") if "HeadlessChrome" in user_agent: user_agent = user_agent.replace("HeadlessChrome", "Chrome") header = {"User-Agent": f"{user_agent}"} - print(header) + # Remove this + self.logger.info(f"Request header: {header}") response = requests.get(url, headers=header) # Some links are returning status code 429. @@ -32,8 +43,8 @@ def test_all_footer_links_are_working(self): check.is_true( response.status_code < 400 or response.status_code == 429, - f"The following url if broken: " + f"The following url is broken: " f"{url}. " f"Received status code: " - f"{response.status_code}", + f"{response.status_code}" ) diff --git a/playwright_tests/tests/homepage_tests/test_homepage.py b/playwright_tests/tests/homepage_tests/test_homepage.py new file mode 100644 index 00000000000..b265951e0df --- /dev/null +++ b/playwright_tests/tests/homepage_tests/test_homepage.py @@ -0,0 +1,104 @@ +import pytest +import pytest_check as check + +from playwright_tests.core.testutilities import TestUtilities + +from playwright_tests.messages.contribute_pages_messages.con_page_messages import ( + ContributePageMessages) +from playwright_tests.messages.homepage_messages import HomepageMessages +from playwright_tests.messages.support_page_messages import SupportPageMessages + + +class TestHomepage(TestUtilities): + # C876542 + @pytest.mark.homePageTests + def test_join_our_community_card_learn_more_redirects_to_contribute_page(self): + self.logger.info("Clicking on the 'Learn More' option") + self.sumo_pages.homepage.click_learn_more_option() + self.logger.info("Verifying that we are redirected to the 'Contribute' page successfully") + + assert ( + self.get_page_url() + == ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL + ), "We are not on the Contribute page!" + + # C876542 + @pytest.mark.homePageTests + def test_join_our_community_card_has_the_correct_content(self): + self.logger.info( + "Verifying that the 'Join Our Community' card has the correct strings applied" + ) + + assert ( + self.sumo_pages.homepage.get_community_card_title() + == HomepageMessages.JOIN_OUR_COMMUNITY_CARD_TITLE + and self.sumo_pages.homepage.get_community_card_description() + == HomepageMessages.JOIN_OUR_COMMUNITY_CARD_DESCRIPTION + ), "Incorrect strings are displayed" + + # C876541 + @pytest.mark.homePageTests + def test_homepage_feature_articles_are_available_and_interactable(self): + self.logger.info( + "Verifying that the correct number of featured articles are present on the homepage" + ) + + check.equal( + self.sumo_pages.homepage.get_number_of_featured_articles(), + HomepageMessages.EXPECTED_FEATURED_ARTICLES_COUNT, + "Unexpected featured article count" + ) + + self.logger.info( + "Clicking on each featured article card and verifying that the user is redirected to " + "the correct article page." + ) + counter = 0 + for featured_article in self.sumo_pages.homepage.get_featured_articles_titles(): + articles_names = self.sumo_pages.homepage.get_featured_articles_titles() + + 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() + == articles_names[counter] + ), (f"Incorrect featured article displayed. Expected: {featured_article} " + f"Received: {self.sumo_pages.kb_article_page.get_text_of_article_title()}") + + self.logger.info("Navigating back to the previous page") + self.navigate_back() + counter += 1 + + # C873774 + @pytest.mark.homePageTests + def test_product_cards_are_functional_and_redirect_to_the_proper_support_page(self): + self.logger.info( + "Verifying that the product cards are redirecting to the correct support page" + ) + + card_titles = self.sumo_pages.homepage.get_text_of_product_card_titles() + counter = 0 + for product_card in card_titles: + expected_product_title = card_titles[counter] + SupportPageMessages.TITLE_CONTAINS + + 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_title_text() + ), (f"Incorrect support page displayed. " + f"Expected: {expected_product_title} " + f"Received: {self.sumo_pages.product_support_page.get_product_title_text()}") + + self.logger.info("Navigating back to the previous page") + self.navigate_back() + counter += 1 diff --git a/playwright_tests/tests/messaging_system_tests/test_messaging_system.py b/playwright_tests/tests/messaging_system_tests/test_messaging_system.py new file mode 100644 index 00000000000..f45a2bd5c04 --- /dev/null +++ b/playwright_tests/tests/messaging_system_tests/test_messaging_system.py @@ -0,0 +1,837 @@ +import pytest +import pytest_check as check +from playwright.sync_api import expect + +from playwright_tests.core.testutilities import TestUtilities +from playwright_tests.messages.mess_system_pages_messages.inbox_page_messages import ( + InboxPageMessages) +from playwright_tests.messages.mess_system_pages_messages.new_message_page_messages import ( + NewMessagePageMessages) +from playwright_tests.messages.mess_system_pages_messages.sent_messages_page_messages import ( + SentMessagesPageMessages) +from playwright_tests.messages.my_profile_pages_messages.my_profile_page_messages import ( + MyProfileMessages) + + +class TestMessagingSystem(TestUtilities): + # C891415 + @pytest.mark.messagingSystem + def test_there_are_no_messages_here_text_is_displayed_when_no_messages_are_available(self): + self.logger.info("Signing in with a normal user account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts['TEST_ACCOUNT_12'] + )) + + self.logger.info("Navigating to the inbox page") + + self.sumo_pages.top_navbar.click_on_inbox_option() + + self.logger.info( + "Clearing the inbox if there are messages" + ) + + if self.sumo_pages.inbox_page.are_inbox_messages_displayed(): + self.sumo_pages.inbox_page.delete_all_displayed_inbox_messages() + self.logger.info("Messages found. Clearing the list") + + self.logger.info("Verifying that the correct page message is displayed") + + check.equal( + self.sumo_pages.inbox_page.get_text_of_inbox_no_message_header(), + InboxPageMessages.NO_MESSAGES_IN_INBOX_TEXT, + f"Incorrect message displayed. " + f"Expected: " + f"{InboxPageMessages.NO_MESSAGES_IN_INBOX_TEXT} " + f"Received: " + f"{self.sumo_pages.inbox_page.get_text_of_inbox_no_message_header()}", + ) + + self.logger.info("Navigating to the 'Sent Messages' page") + + self.sumo_pages.mess_system_user_navbar.click_on_messaging_system_navbar_sent_messages() + + self.logger.info( + "Verifying if there are messages displayed inside the inbox section. " + "If there are, we are clearing them all" + ) + + if self.sumo_pages.sent_message_page.are_sent_messages_displayed(): + self.sumo_pages.sent_message_page.delete_all_displayed_sent_messages() + self.logger.info("Messages found. Clearing the list") + + self.logger.info("Verifying that the correct page message is displayed") + + check.equal( + self.sumo_pages.sent_message_page.get_sent_messages_no_message_text(), + SentMessagesPageMessages.NO_MESSAGES_IN_SENT_MESSAGES_TEXT, + f"Incorrect message displayed. " + f"Expected: " + f"{SentMessagesPageMessages.NO_MESSAGES_IN_SENT_MESSAGES_TEXT} " + f"Received: " + f"{self.sumo_pages.sent_message_page.get_sent_messages_no_message_text()}", + ) + + # C2094292 + # This test needs to be updated to fetch the username from a different place + @pytest.mark.messagingSystem + def test_private_messages_can_be_sent_via_user_profiles(self): + user_two = super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_MESSAGE_2"] + ) + + self.logger.info("Signing in with user one") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_MESSAGE_1"] + )) + + user_one = self.sumo_pages.top_navbar.get_text_of_logged_in_username() + + self.navigate_to_link( + MyProfileMessages.get_my_profile_stage_url(username=user_two) + ) + + self.logger.info("Clicking on the 'Private Message button'") + self.sumo_pages.my_profile_page.click_on_private_message_button() + + self.logger.info( + "Verifying that the receiver is automatically added inside the 'To' field" + ) + assert self.sumo_pages.new_message_page.get_user_to_text() == user_two, ( + f"Incorrect 'To' receiver. Expected: {user_two}. " + f"Received: {self.sumo_pages.new_message_page.get_user_to_text()}" + ) + + self.logger.info("Adding text into the new message textarea field") + self.sumo_pages.new_message_page.fill_into_new_message_body_textarea( + self.user_message_test_data["valid_user_message"]["message"] + ) + + self.logger.info("Clicking on the 'Send' button") + self.sumo_pages.new_message_page.click_on_new_message_send_button() + + self.logger.info("Verifying that the correct message sent banner is displayed") + check.equal( + self.sumo_pages.inbox_page.get_text_inbox_page_message_banner_text(), + InboxPageMessages.MESSAGE_SENT_BANNER_TEXT, + f"Incorrect banner text displayed. " + f"Expected: " + f"{InboxPageMessages.MESSAGE_SENT_BANNER_TEXT}. " + f"Received: " + f"{self.sumo_pages.inbox_page.get_text_inbox_page_message_banner_text()}", + ) + + self.logger.info( + "Clicking on the 'Sent Messages option' " + "and verifying that the message was successfully sent" + ) + self.sumo_pages.mess_system_user_navbar.click_on_messaging_system_navbar_sent_messages() + + self.logger.info("Verifying that the sent message is displayed") + expect(self.sumo_pages.sent_message_page.sent_messages( + username=user_two + )).to_be_visible() + + self.logger.info( + "Deleting the message from the sent messages link " + "and verifying that the message is no longer displayed" + ) + + self.sumo_pages.sent_message_page.click_on_sent_message_delete_button(username=user_two) + self.sumo_pages.sent_message_page.click_on_delete_page_delete_button() + + self.logger.info("Verifying that the correct banner is displayed") + check.equal( + self.sumo_pages.sent_message_page.get_sent_messages_page_deleted_banner_text(), + SentMessagesPageMessages.DELETE_MESSAGE_BANNER_TEXT, + f"Wrong message displayed inside the banner. " + f"Expected: " + f"{SentMessagesPageMessages.DELETE_MESSAGE_BANNER_TEXT} " + f"Received: " + f"{self.sumo_pages.sent_message_page.get_sent_messages_page_deleted_banner_text()}", + ) + + expect( + self.sumo_pages.sent_message_page.sent_messages(username=user_two) + ).to_be_hidden() + + self.logger.info("Signing in with the user which received the message") + self.delete_cookies() + + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_MESSAGE_2"] + )) + + self.logger.info( + "Accessing the Inbox section " "and verifying that the message was received" + ) + self.sumo_pages.top_navbar.click_on_inbox_option() + + expect(self.sumo_pages.inbox_page.inbox_message( + username=user_one + )).to_be_visible() + + self.logger.info( + "Deleting the message and verifying that it " + "is no longer displayed inside the inbox section" + ) + self.sumo_pages.inbox_page.click_on_inbox_message_delete_button(username=user_one) + + self.sumo_pages.inbox_page.click_on_delete_page_delete_button() + + expect( + self.sumo_pages.inbox_page.inbox_message(username=user_one) + ).to_be_hidden() + + self.logger.info("Verifying that the correct banner is displayed") + + check.equal( + self.sumo_pages.sent_message_page.get_sent_messages_page_deleted_banner_text(), + SentMessagesPageMessages.DELETE_MESSAGE_BANNER_TEXT, + f"Wrong message displayed inside the banner. " + f"Expected: " + f"{SentMessagesPageMessages.DELETE_MESSAGE_BANNER_TEXT} " + f"Received: " + f"{self.sumo_pages.sent_message_page.get_sent_messages_page_deleted_banner_text()}", + ) + + # C891419 + @pytest.mark.messagingSystem + def test_private_message_can_be_sent_via_new_message_page(self): + test_user = super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_MESSAGE_4"] + ) + + self.logger.info("Signing in with a normal user account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_MESSAGE_3"] + )) + + user_one = self.sumo_pages.top_navbar.get_text_of_logged_in_username() + + self.logger.info( + "Accessing the 'New Message page " "and sending a message to another user'" + ) + self.sumo_pages.top_navbar.click_on_inbox_option() + self.sumo_pages.mess_system_user_navbar.click_on_messaging_system_navbar_new_message() + self.sumo_pages.messaging_system_flow.complete_send_message_form_with_data( + recipient_username=test_user, + message_body=super().user_message_test_data["valid_user_message"]["message"], + ) + self.sumo_pages.new_message_page.click_on_new_message_send_button() + + self.logger.info("Verifying that the correct banner is displayed") + check.equal( + self.sumo_pages.inbox_page.get_text_inbox_page_message_banner_text(), + InboxPageMessages.MESSAGE_SENT_BANNER_TEXT, + f"Incorrect banner text displayed. " + f"Expected: " + f"{InboxPageMessages.MESSAGE_SENT_BANNER_TEXT} " + f"Received: " + f"{self.sumo_pages.inbox_page.get_text_inbox_page_message_banner_text()}", + ) + + self.logger.info( + "Verifying that the sent message is displayed inside the 'sent messages' page" + ) + self.sumo_pages.mess_system_user_navbar.click_on_messaging_system_navbar_sent_messages() + + expect(self.sumo_pages.sent_message_page.sent_messages(test_user)).to_be_visible() + + self.logger.info("Clearing the sent messages list") + self.sumo_pages.sent_message_page.delete_all_displayed_sent_messages() + + self.logger.info( + "Signing in with the receiver account and verifying that the message " + "is displayed inside the inbox section" + ) + self.delete_cookies() + + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_MESSAGE_4"] + )) + + self.sumo_pages.top_navbar.click_on_inbox_option() + + expect(self.sumo_pages.inbox_page.inbox_message( + username=user_one + )).to_be_visible() + + self.logger.info("Clearing the inbox") + + self.sumo_pages.inbox_page.delete_all_displayed_inbox_messages() + + # C891412, C891413 + @pytest.mark.messagingSystem + def test_navbar_options_redirect_to_the_correct_page_and_options_are_correctly_highlighted( + self, + ): + + self.logger.info("Signing in with a normal user account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_12"] + )) + + self.logger.info("Accessing the inbox section via the top-navbar") + self.sumo_pages.top_navbar.click_on_inbox_option() + + self.logger.info( + "Verifying that we are on the correct page " + "and the 'Inbox' navbar option is highlighted" + ) + expect(self.page).to_have_url(InboxPageMessages.INBOX_PAGE_STAGE_URL) + + expect( + self.sumo_pages.mess_system_user_navbar.get_inbox_navbar_element() + ).to_have_css("background-color", InboxPageMessages.NAVBAR_INBOX_SELECTED_BG_COLOR) + + self.sumo_pages.mess_system_user_navbar.click_on_messaging_system_navbar_sent_messages() + + self.logger.info( + "Verifying that we are on the correct page " + "and the 'Sent Messages' page is successfully displayed" + ) + expect( + self.page + ).to_have_url(SentMessagesPageMessages.SENT_MESSAGES_PAGE_URL) + + self.logger.info("Verifying that the 'Sent Messages' option is highlighted") + expect( + self.sumo_pages.mess_system_user_navbar.get_sent_messages_navbar_element() + ).to_have_css("background-color", + SentMessagesPageMessages.NAVBAR_SENT_MESSAGES_SELECTED_BG_COLOR) + + self.logger.info("Clicking on the 'New message' navbar option") + self.sumo_pages.mess_system_user_navbar.click_on_messaging_system_navbar_new_message() + + self.logger.info("Verifying that the 'New Message' page is displayed") + expect( + self.page + ).to_have_url(NewMessagePageMessages.NEW_MESSAGE_PAGE_STAGE_URL) + + self.logger.info("Verifying that the 'New Message' navbar option is highlighted") + expect( + self.sumo_pages.mess_system_user_navbar.get_new_message_navbar_element() + ).to_have_css("background-color", + NewMessagePageMessages.NAVBAR_NEW_MESSAGE_SELECTED_BG_COLOR) + + self.logger.info("Clicking on the navbar inbox messaging system navbar option") + self.sumo_pages.mess_system_user_navbar.click_on_messaging_system_navbar_inbox() + + self.logger.info( + "Verifying that we are on the correct page " + "and the 'Inbox' navbar option is highlighted" + ) + expect(self.page).to_have_url(InboxPageMessages.INBOX_PAGE_STAGE_URL) + + expect( + self.sumo_pages.mess_system_user_navbar.get_inbox_navbar_element() + ).to_have_css("background-color", InboxPageMessages.NAVBAR_INBOX_SELECTED_BG_COLOR) + + # C891416 + @pytest.mark.messagingSystem + def test_new_message_field_validation(self): + user_two = self.username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_MESSAGE_1"] + ) + self.logger.info("Signing in with normal user account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_12"] + )) + + self.logger.info("Accessing the New Message page") + self.sumo_pages.top_navbar.click_on_inbox_option() + self.sumo_pages.mess_system_user_navbar.click_on_messaging_system_navbar_new_message() + self.sumo_pages.new_message_page.click_on_new_message_send_button() + + self.logger.info("Verifying that we are still on the 'New Message page'") + expect(self.page).to_have_url(NewMessagePageMessages.NEW_MESSAGE_PAGE_STAGE_URL) + + self.logger.info("Adding a valid user inside the 'To' field") + self.sumo_pages.new_message_page.type_into_new_message_to_input_field(text=user_two) + self.sumo_pages.new_message_page.click_on_a_searched_user(username=user_two) + + self.logger.info( + "Clicking the 'Send' button and verifying that we are still on the same page" + ) + self.sumo_pages.new_message_page.click_on_new_message_send_button() + + expect(self.page).to_have_url(NewMessagePageMessages.NEW_MESSAGE_PAGE_STAGE_URL) + + self.logger.info("Verifying that the default remaining characters is the correct one") + check.equal( + self.sumo_pages.new_message_page.get_characters_remaining_text(), + NewMessagePageMessages.NEW_MESSAGE_DEFAULT_REMAINING_CHARACTERS, + f" The default character remaining string is not the correct one! " + f"Expected: {NewMessagePageMessages.NEW_MESSAGE_DEFAULT_REMAINING_CHARACTERS}" + f"Received: {self.sumo_pages.new_message_page.get_characters_remaining_text()}", + ) + + self.logger.info("Verifying that the characters remaining color is the expected one") + expect( + self.sumo_pages.new_message_page.get_characters_remaining_text_element() + ).to_have_css("color", NewMessagePageMessages.ENOUGH_CHARACTERS_REMAINING_COLOR) + + # To check if firefox container crashes. If not remove this part and uncomment the if + # clause + + # if self.browser == "chrome": + # self.logger.info("Adding 9990 characters inside the input field") + # + # self.pages.new_message_page.type_into_new_message_body_textarea( + # text=super().user_message_test_data["valid_user_message"][ + # "9990_characters_long_message" + # ] + # ) + self.logger.info("Adding 9990 characters inside the input field") + + self.sumo_pages.new_message_page.fill_into_new_message_body_textarea( + text=super().user_message_test_data["valid_user_message"][ + "9990_characters_long_message" + ]) + check.equal( + self.sumo_pages.new_message_page.get_characters_remaining_text(), + NewMessagePageMessages.TEN_CHARACTERS_REMAINING_MESSAGE, + f"Incorrect remaining characters string displayed. " + f"Expected: {NewMessagePageMessages.TEN_CHARACTERS_REMAINING_MESSAGE}" + f"Displayed: {self.sumo_pages.new_message_page.get_characters_remaining_text()}", + ) + self.logger.info("Verifying that the characters remaining color is the expected one") + expect(self.sumo_pages.new_message_page.get_characters_remaining_text_element() + ).to_have_css("color", NewMessagePageMessages.ENOUGH_CHARACTERS_REMAINING_COLOR) + + # elif self.browser == "firefox": + # check.equal( + # self.pages.new_message_page.get_characters_remaining_text_color(), + # NewMessagePageMessages.ENOUGH_CHARACTERS_REMAINING_COLOR_FIREFOX, + # f"Incorrect color displayed. " + # f"Expected: {NewMessagePageMessages.ENOUGH_CHARACTERS_REMAINING_COLOR_FIREFOX} " + # f"Received: {self.pages.new_message_page.get_characters_remaining_text_color()}", + # ) + + self.logger.info("Adding one character inside the textarea field") + + self.sumo_pages.new_message_page.type_into_new_message_body_textarea( + text=super().user_message_test_data["valid_user_message"]["one_character_message"] + ) + + self.logger.info("Verifying that the char remaining string is updated accordingly") + check.equal( + self.sumo_pages.new_message_page.get_characters_remaining_text(), + NewMessagePageMessages.NINE_CHARACTERS_REMAINING_MESSAGE, + f"Incorrect remaining characters string displayed. " + f"Expected:{NewMessagePageMessages.NINE_CHARACTERS_REMAINING_MESSAGE} " + f"Displayed: {self.sumo_pages.new_message_page.get_characters_remaining_text()}", + ) + + self.logger.info("Verifying that the characters remaining color is the expected one") + expect(self.sumo_pages.new_message_page.get_characters_remaining_text_element() + ).to_have_css("color", NewMessagePageMessages.NO_CHARACTERS_REMAINING_COLOR) + + # elif self.browser == "firefox": + # check.equal( + # self.pages.new_message_page.get_characters_remaining_text_color(), + # NewMessagePageMessages.NO_CHARACTERS_REMAINING_COLOR_FIREFOX, + # f"Incorrect color displayed. " + # f"Expected: {NewMessagePageMessages.NO_CHARACTERS_REMAINING_COLOR_FIREFOX} " + # f"Received: {self.pages.new_message_page.get_characters_remaining_text_color()}", + # ) + + self.logger.info("Adding 9 characters inside the textarea field") + + self.sumo_pages.new_message_page.type_into_new_message_body_textarea( + text=super().user_message_test_data["valid_user_message"]["9_characters_message"] + ) + + self.logger.info("Verifying that the char remaining string is updated accordingly") + expect( + self.sumo_pages.new_message_page.get_characters_remaining_text_element() + ).to_have_css("color", NewMessagePageMessages.NO_CHARACTERS_REMAINING_COLOR) + # elif self.browser == "firefox": + # check.equal( + # self.pages.new_message_page.get_characters_remaining_text_color(), + # NewMessagePageMessages.NO_CHARACTERS_REMAINING_COLOR_FIREFOX, + # f"Incorrect color displayed. " + # f"Expected: {NewMessagePageMessages.NO_CHARACTERS_REMAINING_COLOR_FIREFOX} " + # f"Received: {self.pages.new_message_page.get_characters_remaining_text_color()}", + # ) + + self.logger.info("Verifying that the characters remaining color is the expected one") + expect( + self.sumo_pages.new_message_page.get_characters_remaining_text_element() + ).to_have_css("color", NewMessagePageMessages.NO_CHARACTERS_REMAINING_COLOR) + + # elif self.browser == "firefox": + # check.equal( + # self.pages.new_message_page.get_characters_remaining_text_color(), + # NewMessagePageMessages.NO_CHARACTERS_REMAINING_COLOR_FIREFOX, + # f"Incorrect color displayed. " + # f"Expected: {NewMessagePageMessages.NO_CHARACTERS_REMAINING_COLOR_FIREFOX} " + # f"Received: {self.pages.new_message_page.get_characters_remaining_text_color()}", + # ) + + # C891417 + @pytest.mark.messagingSystem + def test_new_message_cancel_button(self): + user_two = super().username_extraction_from_email( + super().user_secrets_accounts["TEST_ACCOUNT_13"] + ) + self.logger.info("Signing in with a normal user account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_12"] + )) + user_one = self.sumo_pages.top_navbar.get_text_of_logged_in_username() + + self.logger.info("Accessing the 'New Message' section") + self.sumo_pages.top_navbar.click_on_inbox_option() + self.sumo_pages.mess_system_user_navbar.click_on_messaging_system_navbar_new_message() + + self.logger.info("Filling the new message form with data") + self.sumo_pages.messaging_system_flow.complete_send_message_form_with_data( + recipient_username=user_two, + message_body=super().user_message_test_data["valid_user_message"]["message"], + ) + + self.logger.info("Clicking on the 'Cancel' button") + self.sumo_pages.new_message_page.click_on_new_message_cancel_button() + + self.logger.info("Verifying that the user is redirected to the inbox page") + expect( + self.sumo_pages.mess_system_user_navbar.get_inbox_navbar_element() + ).to_have_css("background-color", InboxPageMessages.NAVBAR_INBOX_SELECTED_BG_COLOR) + + expect(self.page).to_have_url(InboxPageMessages.INBOX_PAGE_STAGE_URL) + + self.logger.info( + "Navigating to the 'Sent Messages' page nad verifying that the message was not sent" + ) + self.sumo_pages.mess_system_user_navbar.click_on_messaging_system_navbar_sent_messages() + + expect(self.sumo_pages.sent_message_page.sent_messages(username=user_two) + ).to_be_hidden() + + self.logger.info("Signing out and signing in with the receiver account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_13"] + )) + + self.logger.info( + "Navigating to the receiver inbox and verifying that no message was received" + ) + self.sumo_pages.top_navbar.click_on_inbox_option() + + expect( + self.sumo_pages.inbox_page.inbox_message(username=user_one) + ).to_be_hidden() + + # C891418 + @pytest.mark.messagingSystem + def test_new_message_preview(self): + test_user = self.username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_13"] + ) + + self.logger.info("Signing in with a normal user account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_12"] + )) + + username = self.sumo_pages.top_navbar.get_text_of_logged_in_username() + + self.logger.info("Accessing the inbox section") + self.sumo_pages.top_navbar.click_on_inbox_option() + + self.logger.info("Navigating to the new message page") + self.sumo_pages.mess_system_user_navbar.click_on_messaging_system_navbar_new_message() + + self.logger.info("Adding text inside the message content section") + self.sumo_pages.messaging_system_flow.complete_send_message_form_with_data( + recipient_username=test_user, + message_body=super().user_message_test_data["valid_user_message"]["message"], + ) + + self.logger.info("Clicking on the 'Preview' button") + self.sumo_pages.new_message_page.click_on_new_message_preview_button() + + self.logger.info("Verifying that the preview section is successfully displayed") + expect( + self.sumo_pages.new_message_page.message_preview_section_element() + ).to_be_visible() + + self.logger.info("Verifying that all the preview items are displayed") + + check.equal( + self.sumo_pages.new_message_page.get_text_of_test_data_first_paragraph_text(), + NewMessagePageMessages.PREVIEW_MESSAGE_CONTENT_FIRST_PARAGRAPH_TEXT, + f"Wrong text displayed. " + f"Expected: " + f"{NewMessagePageMessages.PREVIEW_MESSAGE_CONTENT_FIRST_PARAGRAPH_TEXT} " + f"Received: " + f"{self.sumo_pages.new_message_page.get_text_of_test_data_first_paragraph_text()}", + ) + + check.equal( + self.sumo_pages.new_message_page.get_text_of_test_data_first_p_strong_text(), + NewMessagePageMessages.PREVIEW_MESSAGE_CONTENT_FIRST_PARAGRAPH_STRONG_TEXT, + f"Wrong text displayed. " + f"Expected:" + f"{NewMessagePageMessages.PREVIEW_MESSAGE_CONTENT_FIRST_PARAGRAPH_STRONG_TEXT} " + f"Received: " + f"{self.sumo_pages.new_message_page.get_text_of_test_data_first_p_strong_text()}", + ) + + check.equal( + self.sumo_pages.new_message_page.get_text_of_test_data_first_p_italic_text(), + NewMessagePageMessages.PREVIEW_MESSAGE_CONTENT_FIRST_PARAGRAPH_ITALIC_TEXT, + f"Wrong text displayed. " + f"Expected:" + f"{NewMessagePageMessages.PREVIEW_MESSAGE_CONTENT_FIRST_PARAGRAPH_ITALIC_TEXT} " + f"Received: " + f"{self.sumo_pages.new_message_page.get_text_of_test_data_first_p_italic_text()}", + ) + + numbered_list_items = [ + NewMessagePageMessages.PREVIEW_MESSAGE_OL_LI_NUMBER_ONE, + NewMessagePageMessages.PREVIEW_MESSAGE_OL_LI_NUMBER_TWO, + NewMessagePageMessages.PREVIEW_MESSAGE_OL_LI_NUMBER_THREE, + ] + + bulleted_list_items = [ + NewMessagePageMessages.PREVIEW_MESSAGE_UL_LI_NUMBER_ONE, + NewMessagePageMessages.PREVIEW_MESSAGE_UL_LI_NUMBER_TWO, + NewMessagePageMessages.PREVIEW_MESSAGE_UL_LI_NUMBER_THREE, + ] + + check.equal( + self.sumo_pages.new_message_page.get_text_of_numbered_list_items(), + numbered_list_items, + f"Wrong data displayed in the numbered list. Expected {numbered_list_items} " + f"Received: {self.sumo_pages.new_message_page.get_text_of_numbered_list_items()}", + ) + + check.equal( + self.sumo_pages.new_message_page.get_text_of_bulleted_list_items(), + bulleted_list_items, + f"Wrong data displayed in the numbered list. Expected {bulleted_list_items} " + f"Received: {self.sumo_pages.new_message_page.get_text_of_numbered_list_items()}", + ) + expect( + self.sumo_pages.new_message_page.new_message_preview_external_link_test_data_element() + ).to_be_visible() + + expect( + self.sumo_pages.new_message_page.new_message_preview_internal_link_test_data_element() + ).to_be_visible() + + self.logger.info( + "Clicking on the internal link and " + "verifying that the user is redirected to the correct article" + ) + self.sumo_pages.new_message_page.click_on_preview_internal_link() + + assert ( + self.sumo_pages.kb_article_page.get_text_of_article_title() + == NewMessagePageMessages.PREVIEW_MESSAGE_INTERNAL_LINK_TITLE + ), ( + f"Incorrect article title displayed! " + f"Expected: {NewMessagePageMessages.PREVIEW_MESSAGE_INTERNAL_LINK_TITLE} " + f"Received: {self.sumo_pages.kb_article_page.get_text_of_article_title()}" + ) + + self.logger.info( + "Verifying that the message was no sent by checking the 'Sent Messages page'" + ) + self.sumo_pages.top_navbar.click_on_inbox_option() + + self.sumo_pages.mess_system_user_navbar.click_on_messaging_system_navbar_sent_messages() + + expect( + self.sumo_pages.sent_message_page.sent_messages(username=test_user) + ).to_be_hidden() + + self.logger.info( + "Signing in with the potential message receiver " + "and verifying that no message was received" + ) + + self.logger.info("Signing in with a normal user account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_13"] + )) + + self.sumo_pages.top_navbar.click_on_inbox_option() + + expect( + self.sumo_pages.inbox_page.inbox_message(username=username) + ).to_be_hidden() + + # C891421, C891424 + @pytest.mark.messagingSystem + def test_messages_can_be_selected_and_deleted(self): + test_user = self.username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_MESSAGE_6"] + ) + + self.logger.info("Signing in with a normal user account") + + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_MESSAGE_5"] + )) + + user_one = self.sumo_pages.top_navbar.get_text_of_logged_in_username() + + self.logger.info( + "Accessing the 'New Message' page and sending a message to a different user" + ) + self.sumo_pages.top_navbar.click_on_inbox_option() + self.sumo_pages.mess_system_user_navbar.click_on_messaging_system_navbar_new_message() + self.sumo_pages.messaging_system_flow.complete_send_message_form_with_data( + recipient_username=test_user, + message_body=super().user_message_test_data["valid_user_message"]["message"], + ) + self.sumo_pages.new_message_page.click_on_new_message_send_button() + + self.logger.info("Navigating to the sent messages page") + + self.sumo_pages.mess_system_user_navbar.click_on_messaging_system_navbar_sent_messages() + + self.logger.info("Clicking on the 'Delete Selected' button") + + self.sumo_pages.sent_message_page.click_on_delete_selected_button() + + self.logger.info( + "Verifying that the correct message is displayed " + "and is no longer displayed when dismissed" + ) + + check.equal( + self.sumo_pages.sent_message_page.get_sent_messages_page_deleted_banner_text(), + SentMessagesPageMessages.NO_MESSAGES_SELECTED_BANNER_TEXT, + f"Incorrect banner text displayed. " + f"Expected: " + f"{SentMessagesPageMessages.NO_MESSAGES_SELECTED_BANNER_TEXT} " + f"Received: " + f"{self.sumo_pages.sent_message_page.get_sent_messages_page_deleted_banner_text()}", + ) + + self.logger.info( + "Verifying that the message is still listed inside the sent messages section" + ) + + expect( + self.sumo_pages.sent_message_page.sent_messages(username=test_user) + ).to_be_visible() + + self.logger.info("Sending another message to self twice") + + for i in range(2): + self.sumo_pages.mess_system_user_navbar.click_on_messaging_system_navbar_new_message() + self.sumo_pages.messaging_system_flow.complete_send_message_form_with_data( + recipient_username=user_one, + message_body=super().user_message_test_data["valid_user_message"]["message"], + ) + self.sumo_pages.new_message_page.click_on_new_message_send_button() + + self.logger.info( + "Clicking on the 'delete selected' button while no messages is selected " + "and verifying that the correct " + "banner is displayed" + ) + + self.sumo_pages.inbox_page.click_on_inbox_delete_selected_button() + + check.equal( + self.sumo_pages.inbox_page.get_text_inbox_page_message_banner_text(), + InboxPageMessages.NO_MESSAGES_SELECTED_BANNER_TEXT, + f"Incorrect messages displayed. " + f"Expected: {InboxPageMessages.NO_MESSAGES_SELECTED_BANNER_TEXT} " + f"Received: {self.sumo_pages.inbox_page.get_text_inbox_page_message_banner_text()}", + ) + + expect( + self.sumo_pages.inbox_page.inbox_message(username=user_one).first + ).to_be_visible() + + self.logger.info("Selecting the messages and deleting it via the 'delete selected button'") + self.sumo_pages.inbox_page.delete_all_displayed_inbox_messages_via_delete_selected_button() + + self.logger.info("Verifying that the messages are no longer displayed") + + expect( + self.sumo_pages.inbox_page.inbox_message(username=user_one) + ).to_be_hidden() + + check.equal( + self.sumo_pages.inbox_page.get_text_inbox_page_message_banner_text(), + InboxPageMessages.MULTIPLE_MESSAGES_DELETION_BANNER_TEXT, + f"Incorrect message banner displayed. " + f"Expected: {InboxPageMessages.MULTIPLE_MESSAGES_DELETION_BANNER_TEXT} " + f"Received: {self.sumo_pages.inbox_page.get_text_inbox_page_message_banner_text()}", + ) + + self.logger.info( + "Navigating to the sent messages section and " + "clearing all messages via the 'delete selected button'" + ) + self.sumo_pages.mess_system_user_navbar.click_on_messaging_system_navbar_sent_messages() + + self.sumo_pages.sent_message_page.delete_all_sent_messages_via_delete_selected_button() + + self.logger.info("Verifying that the messages are no longer displayed") + expect( + self.sumo_pages.sent_message_page.sent_messages(username=user_one) + ).to_be_hidden() + + expect( + self.sumo_pages.sent_message_page.sent_messages(username=test_user) + ).to_be_hidden() + + self.logger.info("Verifying that the correct banner is displayed") + + check.equal( + self.sumo_pages.sent_message_page.get_sent_messages_page_deleted_banner_text(), + SentMessagesPageMessages.MULTIPLE_MESSAGES_DELETION_BANNER_TEXT, + f"Incorrect message banner displayed. " + f"Expected: " + f"{SentMessagesPageMessages.MULTIPLE_MESSAGES_DELETION_BANNER_TEXT} " + f"Received: " + f"{self.sumo_pages.sent_message_page.get_sent_messages_page_deleted_banner_text()}", + ) + + self.logger.info( + "Signing in with the receiver account and navigating to the inbox section" + ) + + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_MESSAGE_6"] + )) + + self.sumo_pages.top_navbar.click_on_inbox_option() + + self.logger.info("Verifying that the messages are displayed inside the inbox section") + + expect( + self.sumo_pages.inbox_page.inbox_message(username=user_one) + ).to_be_visible() + + self.logger.info( + "Deleting all messages from the inbox page via the 'delete selected button'" + ) + self.sumo_pages.inbox_page.delete_all_displayed_inbox_messages_via_delete_selected_button() + + self.logger.info( + "Verifying that the messages are no longer displayed inside the inbox section" + ) + + expect( + self.sumo_pages.inbox_page.inbox_message(username=user_one) + ).to_be_hidden() + + self.logger.info("Verifying that the correct banner is displayed") + + check.equal( + self.sumo_pages.inbox_page.get_text_inbox_page_message_banner_text(), + InboxPageMessages.MESSAGE_DELETED_BANNER_TEXT, + f"Incorrect message banner displayed. " + f"Expected: {InboxPageMessages.MESSAGE_DELETED_BANNER_TEXT} " + f"Received: {self.sumo_pages.inbox_page.get_text_inbox_page_message_banner_text()}", + ) diff --git a/playwright_tests/tests/test_prerequisites_login.py b/playwright_tests/tests/test_prerequisites_login.py new file mode 100644 index 00000000000..c9cf3d4f518 --- /dev/null +++ b/playwright_tests/tests/test_prerequisites_login.py @@ -0,0 +1,29 @@ +import pytest +from playwright_tests.core.testutilities import TestUtilities + + +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): + + for i in super().user_secrets_accounts: + self.sumo_pages.top_navbar.click_on_signin_signup_button() + + self.sumo_pages.auth_flow_page.sign_in_flow( + username=super().user_secrets_accounts[i], + account_password=super().user_secrets_pass, + sign_in_with_same_account=False + ) + + print(super().user_secrets_accounts[i]) + self.wait_for_given_timeout(3500) + username = self.username_extraction_from_email( + super().user_secrets_accounts[i] + ) + print(username) + self.store_session_cookies(username) + # Deleting cookies from browser storage (avoiding server invalidation from logout) + # and reloading the page to be signed out before re-entering the loop. + self.delete_cookies() + self.page.reload() diff --git a/selenium_tests/tests/top_navbar_section_tests/test_top_navbar.py b/playwright_tests/tests/top_navbar_section_tests/test_top_navbar.py similarity index 58% rename from selenium_tests/tests/top_navbar_section_tests/test_top_navbar.py rename to playwright_tests/tests/top_navbar_section_tests/test_top_navbar.py index 34e40c26435..4c2749e572b 100644 --- a/selenium_tests/tests/top_navbar_section_tests/test_top_navbar.py +++ b/playwright_tests/tests/top_navbar_section_tests/test_top_navbar.py @@ -2,8 +2,8 @@ import pytest_check as check import requests -from selenium_tests.core.test_utilities import TestUtilities -from selenium_tests.messages.top_navbar_messages import TopNavbarMessages +from playwright_tests.core.testutilities import TestUtilities +from playwright_tests.messages.top_navbar_messages import TopNavbarMessages class TestTopNavbar(TestUtilities): @@ -12,7 +12,7 @@ class TestTopNavbar(TestUtilities): def test_number_of_options_not_signed_in(self): self.logger.info("Verifying that the SUMO logo is successfully displayed") - image = self.pages.top_navbar.get_sumo_nav_logo() + image = self.sumo_pages.top_navbar.get_sumo_nav_logo() image_link = image.get_attribute("src") response = requests.get(image_link, stream=True) check.is_true(response.status_code < 400, f"The {image_link} image is broken") @@ -21,32 +21,26 @@ def test_number_of_options_not_signed_in(self): "Verifying that top-navbar contains only Get Help & " "Contribute options for non signed-in state" ) - top_navbar_items = self.pages.top_navbar.get_available_menu_titles() + top_navbar_items = self.sumo_pages.top_navbar.get_available_menu_titles() expected_top_navbar_items = [ TopNavbarMessages.GET_HELP_OPTION_TEXT, TopNavbarMessages.CONTRIBUTE_OPTION_TEXT, ] assert top_navbar_items == expected_top_navbar_items, ( - "Incorrect elements displayed in top-navbar for " "signed out state" + "Incorrect elements displayed in top-navbar for signed out state" ) # C876539 @pytest.mark.topNavbarTests def test_number_of_options_signed_in(self): - self.logger.info("Clicking on the sign-in/sign-up button") - self.pages.top_navbar.click_on_signin_signup_button() - self.logger.info("Signing in with a simple user account") - # to inspect GH secrets for username & password - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) + self.logger.info("Using saved user session") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts['TEST_ACCOUNT_12'] + )) self.logger.info("Verifying that the SUMO logo is successfully displayed") - - image = self.pages.top_navbar.get_sumo_nav_logo() + image = self.sumo_pages.top_navbar.get_sumo_nav_logo() image_link = image.get_attribute("src") response = requests.get(image_link, stream=True) check.is_true(response.status_code < 400, f"The {image_link} image is broken") @@ -56,7 +50,7 @@ def test_number_of_options_signed_in(self): "Contributor Tools and Contribute options" ) - top_navbar_items = self.pages.top_navbar.get_available_menu_titles() + top_navbar_items = self.sumo_pages.top_navbar.get_available_menu_titles() expected_top_navbar_items = [ TopNavbarMessages.GET_HELP_OPTION_TEXT, TopNavbarMessages.CONTRIBUTOR_TOOLS_TEXT, @@ -70,27 +64,20 @@ def test_number_of_options_signed_in(self): # C876534 @pytest.mark.topNavbarTests def test_contributor_tools_is_removed_after_user_signs_out(self): - self.logger.info("Clicking on the sign-in/sign-up button") - self.pages.top_navbar.click_on_signin_signup_button() - - self.logger.info("Signing in with a simple user account") - - # to inspect GH secrets for username & password - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) + self.logger.info("Using saved user session") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts['TEST_ACCOUNT_12'] + )) - self.logger.info("Signing the user out from SUMO") - self.pages.top_navbar.click_on_sign_out_button() + self.logger.info("Signing the user out from SUMO by clearing session cookies") + self.delete_cookies() self.logger.info( "Verifying that top-navbar contains only Get Help & " "Contribute options for non signed-in state" ) - top_navbar_items = self.pages.top_navbar.get_available_menu_titles() + top_navbar_items = self.sumo_pages.top_navbar.get_available_menu_titles() expected_top_navbar_items = [ TopNavbarMessages.GET_HELP_OPTION_TEXT, TopNavbarMessages.CONTRIBUTE_OPTION_TEXT, diff --git a/playwright_tests/tests/user_page_tests/test_edit_contribution_areas.py b/playwright_tests/tests/user_page_tests/test_edit_contribution_areas.py new file mode 100644 index 00000000000..22bf3a9a02a --- /dev/null +++ b/playwright_tests/tests/user_page_tests/test_edit_contribution_areas.py @@ -0,0 +1,152 @@ +import pytest +import pytest_check as check +from playwright.sync_api import expect + +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) + + +class TestEditContributionAreas(TestUtilities): + # C2206070 + @pytest.mark.userContributionTests + def test_all_checkboxes_can_be_selected_and_saved(self): + self.logger.info("Signing in with a simple user account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts['TEST_ACCOUNT_12'] + )) + + original_user = self.sumo_pages.top_navbar.get_text_of_logged_in_username() + + self.logger.info("Clicking on the 'Edit Contribution areas option'") + self.sumo_pages.top_navbar.click_on_settings_profile_option() + + self.sumo_pages.user_navbar.click_on_edit_contribution_areas_option() + + self.logger.info("Clicking on all checkboxes") + self.sumo_pages.edit_my_profile_con_areas_page._click_on_unchecked_cont_areas_checkboxes() + + self.logger.info("Clicking on the 'Update' button") + + self.sumo_pages.edit_my_profile_con_areas_page._click_on_update_contribution_areas_button() + + self.logger.info("Verifying that the correct notification banner text is displayed") + + check.equal( + self.sumo_pages.edit_my_profile_con_areas_page._edit_con_areas_pref_banner_txt(), + EditContributionAreasPageMessages.PREFERENCES_SAVED_NOTIFICATION_BANNER_TEXT, + f"Incorrect notification banner message displayed. " + f"Expected: " + f"{EditContributionAreasPageMessages.PREFERENCES_SAVED_NOTIFICATION_BANNER_TEXT}" + f" received: " + f"{self.sumo_pages.edit_my_profile_con_areas_page._edit_con_areas_pref_banner_txt()}", + ) + + self.logger.info("Verifying that all the checkboxes are checked") + assert ( + self.sumo_pages.edit_my_profile_con_areas_page._are_all_cont_pref_checkboxes_checked() + ), "Not all checkbox options are checked!" + + contribution_options = ( + self.sumo_pages.edit_my_profile_con_areas_page._get_contrib_areas_checkbox_labels() + ) + + self.logger.info( + "Accessing the my profile page and verifying that " + "the displayed groups are the correct ones" + ) + self.sumo_pages.user_navbar.click_on_my_profile_option() + + assert ( + self.sumo_pages.my_profile_page.get_my_profile_groups_items_text() + == contribution_options + ), ( + f"Not all groups are displayed. Expected:" + f" {contribution_options} " + f"received: {self.sumo_pages.my_profile_page.get_my_profile_groups_items_text()}" + ) + + self.logger.info( + "Signing in with a different account and verifying " + "that the original user groups are displayed" + ) + self.delete_cookies() + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts['TEST_ACCOUNT_13'] + )) + + self.navigate_to_link(MyProfileMessages.get_my_profile_stage_url(original_user)) + + self.logger.info( + "Verifying that the user groups is successfully displayed for the original user" + ) + assert ( + self.sumo_pages.my_profile_page.get_my_profile_groups_items_text() + == contribution_options + ), ( + f"Not all groups are displayed. Expected:" + f" {contribution_options} " + f"received: {self.sumo_pages.my_profile_page.get_my_profile_groups_items_text()}" + ) + + self.logger.info("Signing in back with the original user") + self.delete_cookies() + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts['TEST_ACCOUNT_12'] + )) + + self.logger.info( + "Accessing the edit contribution areas page and unchecking all the checkboxes" + ) + self.sumo_pages.top_navbar.click_on_settings_profile_option() + + self.sumo_pages.user_navbar.click_on_edit_contribution_areas_option() + + (self.sumo_pages.edit_my_profile_con_areas_page + ._click_on_all_checked_cont_areas_checkboxes()) + + self.logger.info( + "Clicking on the update button and verifying that " + "the correct notification banner is displayed" + ) + self.sumo_pages.edit_my_profile_con_areas_page._click_on_update_contribution_areas_button() + + check.equal( + self.sumo_pages.edit_my_profile_con_areas_page._edit_con_areas_pref_banner_txt(), + EditContributionAreasPageMessages.PREFERENCES_SAVED_NOTIFICATION_BANNER_TEXT, + f"Incorrect notification banner text is displayed." + f" Expected:" + f"{EditContributionAreasPageMessages.PREFERENCES_SAVED_NOTIFICATION_BANNER_TEXT}" + f" received: " + f"{self.sumo_pages.edit_my_profile_con_areas_page._edit_con_areas_pref_banner_txt()}", + ) + + self.logger.info( + "Verifying that the profile groups section is no longer " + "displayed inside the profile section" + ) + self.sumo_pages.user_navbar.click_on_my_profile_option() + + expect( + self.sumo_pages.my_profile_page.groups_section_element() + ).to_be_hidden() + + self.logger.info( + "Logging in with a different user and accessing the original user profile" + ) + self.delete_cookies() + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts['TEST_ACCOUNT_13'] + )) + + self.navigate_to_link(MyProfileMessages.get_my_profile_stage_url(original_user)) + + self.logger.info( + "Verifying that the groups section is not longer displayed for the original user" + ) + + expect( + self.sumo_pages.my_profile_page.groups_section_element() + ).to_be_hidden() diff --git a/playwright_tests/tests/user_page_tests/test_edit_my_profile.py b/playwright_tests/tests/user_page_tests/test_edit_my_profile.py new file mode 100644 index 00000000000..72696833935 --- /dev/null +++ b/playwright_tests/tests/user_page_tests/test_edit_my_profile.py @@ -0,0 +1,1619 @@ +import pytest +import pytest_check as check +from playwright.sync_api import expect + +from playwright_tests.core.testutilities import TestUtilities +from playwright_tests.messages.auth_pages_messages.fxa_page_messages import FxAPageMessages +from playwright_tests.messages.my_profile_pages_messages.edit_my_profile_page_messages import ( + EditMyProfilePageMessages) +from playwright_tests.messages.my_profile_pages_messages.my_profile_page_messages import ( + MyProfileMessages) + + +class TestEditMyProfile(TestUtilities): + # C891529 + @pytest.mark.editUserProfileTests + def test_username_field_is_automatically_populated(self): + self.logger.info( + "Signing in with a simple user account and navigating to the 'Edit Profile' page" + ) + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts['TEST_ACCOUNT_12'] + )) + + self.sumo_pages.top_navbar.click_on_edit_profile_option() + + self.logger.info( + "Verifying that username field is automatically populated with the correct data" + ) + top_navbar_displayed_username = self.sumo_pages.top_navbar.get_text_of_logged_in_username() + + assert ( + self.sumo_pages.edit_my_profile_page.get_username_input_field_value() + == top_navbar_displayed_username + ), ( + f"Incorrect username displayed inside the user field. " + f"Expected: {top_navbar_displayed_username}, " + f"received: {self.sumo_pages.edit_my_profile_page.get_username_input_field_value()}" + ) + + # C1491017 + # This test is currently covering the: my profile section, top navbar, and posted questions. + # Might want to extend the coverage + @pytest.mark.editUserProfileTests + def test_edit_profile_field_validation_with_symbols(self): + self.logger.info("Signing in with a normal account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts['TEST_ACCOUNT_12'] + )) + + self.logger.info("Navigating to the profile edit page") + self.sumo_pages.top_navbar.click_on_edit_profile_option() + + self.logger.info("Extracting the username value") + original_username = self.sumo_pages.edit_my_profile_page.get_username_input_field_value() + + self.logger.info( + "Clearing the username and display name fields and inserting the new username" + ) + self.sumo_pages.edit_my_profile_page.clear_username_field() + self.sumo_pages.edit_my_profile_page.clear_display_name_field() + + profile_edit_data = super().profile_edit_test_data + + if self.browser == "chrome": + new_username = profile_edit_data["valid_user_edit_with_symbols"][ + "username_with_valid_symbols_chrome" + ] + elif self.browser == "firefox": + new_username = profile_edit_data["valid_user_edit_with_symbols"][ + "username_with_valid_symbols_firefox" + ] + + self.sumo_pages.edit_my_profile_page.send_text_to_username_field(new_username) + + self.logger.info("Clicking on the 'Update My Profile' button") + self.sumo_pages.edit_my_profile_page.click_update_my_profile_button() + + self.logger.info( + "Verify that the newly set username is successfully applied to the my profile section" + ) + check.equal( + self.sumo_pages.my_profile_page.get_my_profile_display_name_header_text(), + new_username, + f"The username displayed inside the profile section should be {new_username} " + f"but instead is: " + f"{self.sumo_pages.my_profile_page.get_my_profile_display_name_header_text()}", + ) + + self.logger.info("Verify that the newly set username is displayed inside the top navbar") + check.equal( + self.sumo_pages.top_navbar.get_text_of_logged_in_username(), + new_username, + f"The username displayed inside the top navbar section should be {new_username} " + f"but instead is {self.sumo_pages.top_navbar.get_text_of_logged_in_username()}", + ) + + self.logger.info( + "Access a previously posted question and verify that the display name has changed" + ) + self.sumo_pages.my_profile_page.click_on_my_profile_questions_link() + self.sumo_pages.my_questions_page.click_on_a_question_by_index(1) + + check.equal( + self.sumo_pages.question_page.get_question_author_name(), + new_username, + "The new username should be reflected under the posted questions as well", + ) + + self.logger.info( + "Going back to the my profile page and reverting the username back to the original one" + ) + self.sumo_pages.top_navbar.click_on_edit_profile_option() + self.sumo_pages.edit_my_profile_page.clear_username_field() + self.sumo_pages.edit_my_profile_page.send_text_to_username_field(original_username) + self.sumo_pages.edit_my_profile_page.click_update_my_profile_button() + + self.logger.info("Verifying that the username was updated back to the original one") + check.equal( + self.sumo_pages.my_profile_page.get_my_profile_display_name_header_text(), + original_username, + f"The username displayed inside the profile section should be {original_username} " + f"but instead is: " + f"{self.sumo_pages.my_profile_page.get_my_profile_display_name_header_text()}", + ) + + self.logger.info("Verify that the newly set username is displayed inside the top navbar") + check.equal( + self.sumo_pages.top_navbar.get_text_of_logged_in_username(), + original_username, + f"The username displayed inside the top navbar section should be " + f"{original_username} " + f"but instead is {self.sumo_pages.top_navbar.get_text_of_logged_in_username()}", + ) + + self.logger.info( + "Access a previously posted question and verify that the display name has changed" + ) + self.sumo_pages.my_profile_page.click_on_my_profile_questions_link() + self.sumo_pages.my_questions_page.click_on_a_question_by_index(1) + + check.equal( + self.sumo_pages.question_page.get_question_author_name(), + original_username, + "The new username should be reflected under the posted questions as well", + ) + + # C1491017 + @pytest.mark.editUserProfileTests + def test_username_with_invalid_symbols(self): + self.logger.info("Signing in with a normal user account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts['TEST_ACCOUNT_12'] + )) + + self.logger.info("Accessing the edit profile page") + self.sumo_pages.top_navbar.click_on_edit_profile_option() + + self.logger.info("Extracting the original username") + original_username = self.sumo_pages.edit_my_profile_page.get_username_input_field_value() + + self.logger.info("Clearing the username input field and adding an invalid user") + self.sumo_pages.edit_my_profile_page.clear_username_field() + + profile_edit_data = super().profile_edit_test_data + + new_username = profile_edit_data["invalid_username_with_symbols"][ + "username_with_invalid_symbols" + ] + + self.sumo_pages.edit_my_profile_page.send_text_to_username_field(new_username) + + self.logger.info("Clicking on the 'Update My Profile' button") + self.sumo_pages.edit_my_profile_page.click_update_my_profile_button() + + self.logger.info("Verify that the error message is displayed") + check.equal( + self.sumo_pages.edit_my_profile_page.get_username_error_message_text(), + EditMyProfilePageMessages.USERNAME_INPUT_ERROR_MESSAGE, + f"Incorrect error message displayed. " + f"Expected: {EditMyProfilePageMessages.USERNAME_INPUT_ERROR_MESSAGE} " + f"but received: " + f"{self.sumo_pages.edit_my_profile_page.get_username_error_message_text()}", + ) + + self.logger.info( + "Accessing the Edit Profile page and verifying that the username was not changed" + ) + self.sumo_pages.top_navbar.click_on_view_profile_option() + + assert ( + self.sumo_pages.my_profile_page.get_my_profile_display_name_header_text() + == original_username + ), ( + f"The username should be: {original_username} " + f"but instead is: " + f"{self.sumo_pages.my_profile_page.get_my_profile_display_name_header_text}" + ) + + # C891530, C2107866 + @pytest.mark.editUserProfileTests + def test_cancel_profile_edit(self): + self.logger.info("Signing in with a normal user account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts['TEST_ACCOUNT_12'] + )) + + self.logger.info("Accessing the Edit My Profile page") + self.sumo_pages.top_navbar.click_on_edit_profile_option() + + self.logger.info("Extracting all the edit my profile fields values") + original_values = self.sumo_pages.edit_my_profile_page.get_value_of_all_fields() + + self.logger.info("Populating edit profile fields with data") + self.sumo_pages.edit_profile_flow.edit_profile_with_test_data() + + self.logger.info("Clicking on the 'Cancel' button") + self.sumo_pages.edit_my_profile_page.click_cancel_button() + + self.logger.info( + "Verifying that we are on the same page " + "and all the input field values were reverted back to original" + ) + + assert self.sumo_pages.edit_my_profile_page.get_value_of_all_fields() == original_values, ( + f"Fields values were not restored to original values. " + f"Original values: {original_values}, current field " + f"values: {self.sumo_pages.edit_my_profile_page.get_value_of_all_fields()}" + ) + + # C946232 + @pytest.mark.editUserProfileTests + def test_manage_firefox_account_redirects_to_firefox_account_settings_page(self): + self.logger.info("Signing in with a normal user account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts['TEST_ACCOUNT_12'] + )) + + self.logger.info("Accessing the 'Edit my profile' page") + self.sumo_pages.top_navbar.click_on_edit_profile_option() + + self.logger.info("Click on the 'Manage account' button") + self.sumo_pages.edit_my_profile_page.click_manage_firefox_account_button() + + self.logger.info( + "Verifying that the user was redirected to " + "the Mozilla account settings page in a new tab" + ) + + with self.page.context.expect_page() as tab: + fxa_page = tab.value + print("Tab open") + + assert fxa_page.url in FxAPageMessages.ACCOUNT_SETTINGS_URL + + # C1491461 + @pytest.mark.editUserProfileTests + def test_duplicate_usernames_are_not_allowed(self): + self.logger.info("Sign in with a normal user account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts['TEST_ACCOUNT_12'] + )) + + original_username = self.sumo_pages.top_navbar.get_text_of_logged_in_username() + self.sumo_pages.top_navbar.click_on_edit_profile_option() + + self.logger.info("Clearing the username input field and adding an existing username to it") + self.sumo_pages.edit_my_profile_page.clear_username_field() + + self.sumo_pages.edit_my_profile_page.send_text_to_username_field( + super().username_extraction_from_email( + super().user_secrets_accounts["TEST_ACCOUNT_MESSAGE_6"] + ) + ) + + self.sumo_pages.edit_my_profile_page.click_update_my_profile_button() + + self.logger.info( + "Verify that the error message is displayed " + "under the username input field and is the correct one" + ) + + check.equal( + self.sumo_pages.edit_my_profile_page.get_username_error_message_text(), + EditMyProfilePageMessages.DUPLICATE_USERNAME_ERROR_MESSAGE, + f"Incorrect error message displayed! The expected error message is: " + f"{EditMyProfilePageMessages.DUPLICATE_USERNAME_ERROR_MESSAGE}" + f" The displayed error message is:" + f" {self.sumo_pages.edit_my_profile_page.get_username_error_message_text()}", + ) + + self.logger.info( + "Verifying that the username displayed inside the top navbar is the correct one" + ) + + check.equal( + self.sumo_pages.top_navbar.get_text_of_logged_in_username(), + original_username, + f"Incorrect username displayed inside the top-navbar. " + f"Expected to be: {original_username} " + f" but got: {self.sumo_pages.top_navbar.get_text_of_logged_in_username()}", + ) + + self.logger.info("Accessing the my profile page") + self.sumo_pages.top_navbar.click_on_view_profile_option() + + self.logger.info( + "Verifying that the username displayed inside the My Profile page is the correct one" + ) + + assert ( + self.sumo_pages.my_profile_page.get_my_profile_display_name_header_text() + == original_username + ), ( + f"Incorrect username displayed inside the My Profile page." + f" Expected to be: {original_username}" + f" but got: " + f"{self.sumo_pages.my_profile_page.get_my_profile_display_name_header_text()}" + ) + + # C1491462 + @pytest.mark.editUserProfileTests + def test_profile_username_field_cannot_be_left_empty(self): + self.logger.info("Signing in with a normal account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts['TEST_ACCOUNT_12'] + )) + + original_username = self.sumo_pages.top_navbar.get_text_of_logged_in_username() + + self.logger.info("Accessing the Edit My Profile page") + self.sumo_pages.top_navbar.click_on_edit_profile_option() + + self.logger.info( + "Clearing the username input field and clicking on the Update My Profile button" + ) + + self.sumo_pages.edit_my_profile_page.clear_username_field() + self.sumo_pages.edit_my_profile_page.click_update_my_profile_button() + + self.logger.info("Verifying that we are still on the edit profile page") + + check.equal( + self.get_page_url(), + EditMyProfilePageMessages.STAGE_EDIT_MY_PROFILE_URL, + f"We are not on the expected page. Expected page to be:" + f" {EditMyProfilePageMessages.STAGE_EDIT_MY_PROFILE_URL}" + f" but we are on the {self.get_page_url()} page instead", + ) + + self.logger.info( + "Verifying that the displayed username inside the top navbar is the original one" + ) + + assert self.sumo_pages.top_navbar.get_text_of_logged_in_username() == original_username, ( + f"Expected username to be: {original_username}. " + f"The displayed username is " + f"{self.sumo_pages.top_navbar.get_text_of_logged_in_username()}" + ) + + self.logger.info("Accessing the my profile page") + self.sumo_pages.user_navbar.click_on_my_profile_option() + + self.logger.info( + "Verifying that the username displayed inside the my profile page is the original one" + ) + + assert ( + self.sumo_pages.my_profile_page.get_my_profile_display_name_header_text() + == original_username + ), ( + f"Expected username to be: {original_username}. " + f"The displayed username is " + f"{self.sumo_pages.my_profile_page.get_my_profile_display_name_header_text()}" + ) + + # C1491018, C891531,C1491021 + @pytest.mark.editUserProfileTests + def test_username_can_contain_uppercase_and_lowercase_letters(self): + self.logger.info("Signing in with a normal account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts['TEST_ACCOUNT_MESSAGE_4'] + )) + + original_username = self.sumo_pages.top_navbar.get_text_of_logged_in_username() + new_username = super().profile_edit_test_data["uppercase_lowercase_valid_username"][ + "uppercase_lowercase_username" + ] + + self.logger.info("Accessing the edit my profile page") + self.sumo_pages.top_navbar.click_on_edit_profile_option() + + self.logger.info( + "Updating the username field to contain uppercase and lowercase characters" + ) + self.sumo_pages.edit_my_profile_page.clear_username_field() + self.sumo_pages.edit_my_profile_page.send_text_to_username_field(new_username) + + self.logger.info("Clicking on the 'Update my Profile button'") + self.sumo_pages.edit_my_profile_page.click_update_my_profile_button() + + self.logger.info( + "Verifying that the username displayed inside the top-navbar updates successfully" + ) + + assert self.sumo_pages.top_navbar.get_text_of_logged_in_username() == new_username, ( + f"The displayed username is incorrect. Expected: {new_username} " + f"but " + f"{self.sumo_pages.top_navbar.get_text_of_logged_in_username()} is displayed instead" + ) + + self.logger.info( + "Verifying that the username displayed inside " + "the my profile section is the correct one" + ) + + assert ( + self.sumo_pages.my_profile_page.get_my_profile_display_name_header_text() + == new_username + ), ( + f"The displayed username is incorrect. Expected: {new_username}" + f"but {self.sumo_pages.my_profile_page.get_my_profile_display_name_header_text()} " + f"is displayed instead" + ) + + self.logger.info("Reverting the username back to the original one") + self.sumo_pages.top_navbar.click_on_edit_profile_option() + self.sumo_pages.edit_my_profile_page.clear_username_field() + self.sumo_pages.edit_my_profile_page.send_text_to_username_field(original_username) + self.sumo_pages.edit_my_profile_page.click_update_my_profile_button() + + # C1491463, C1491464 + @pytest.mark.editUserProfileTests + def test_display_name_replaces_the_username_text(self): + self.logger.info("Signing in with a normal user account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts['TEST_ACCOUNT_MESSAGE_1'] + )) + + original_username = self.sumo_pages.top_navbar.get_text_of_logged_in_username() + + if self.browser == "chrome": + new_display_name = super().profile_edit_test_data["valid_user_edit"][ + "display_name_chrome" + ] + elif self.browser == "firefox": + new_display_name = super().profile_edit_test_data["valid_user_edit"][ + "display_name_firefox" + ] + + self.logger.info("Accessing the edit profile page and adding a new display name") + self.sumo_pages.top_navbar.click_on_edit_profile_option() + self.sumo_pages.edit_my_profile_page.clear_display_name_field() + self.sumo_pages.edit_my_profile_page.send_text_to_display_name_field(new_display_name) + + self.logger.info("Clicking on the 'Update My Profile' button") + self.sumo_pages.edit_my_profile_page.click_update_my_profile_button() + + self.logger.info("Verifying that the top navbar username updates with the display name") + + assert self.sumo_pages.top_navbar.get_text_of_logged_in_username() == new_display_name, ( + f"Incorrect displayed signed in username in top-navbar. " + f"Expected: {new_display_name} but " + f"{self.sumo_pages.top_navbar.get_text_of_logged_in_username()} is displayed instead" + ) + + self.logger.info( + "Verifying that the 'My profile' display name contains display name (username)" + ) + + assert ( + self.sumo_pages.my_profile_page.get_my_profile_display_name_header_text() + == f"{new_display_name} ({original_username})" + ), ( + f"Incorrect displayed signed in username inside the my profile page. " + f"Expected: {new_display_name} ({original_username})" + f"but {self.sumo_pages.my_profile_page.get_my_profile_display_name_header_text()} " + f"is displayed instead" + ) + + self.logger.info("Reverting back and deleting the display name") + self.sumo_pages.top_navbar.click_on_edit_profile_option() + self.sumo_pages.edit_my_profile_page.clear_display_name_field() + self.sumo_pages.edit_my_profile_page.click_update_my_profile_button() + + self.logger.info( + "Verifying that the displayed name inside the top navbar is reverted back to username" + ) + + assert self.sumo_pages.top_navbar.get_text_of_logged_in_username() == original_username, ( + f"Incorrect displayed signed in username after deleting the display name. " + f"Expected: {original_username}" + f" but received: {self.sumo_pages.top_navbar.get_text_of_logged_in_username()}" + ) + + self.logger.info( + "Verifying that the displayed name inside the main " + "profile page is reverted back to the username" + ) + + assert { + self.sumo_pages.my_profile_page.get_my_profile_display_name_header_text() + == original_username + }, ( + f"Incorrect displayed name inside the profile page. Expected: {original_username} but" + f" received " + f"{self.sumo_pages.my_profile_page.get_my_profile_display_name_header_text()}" + ) + + # This needs update. No longer fails due to: + # https://github.com/mozilla/sumo/issues/1345 + @pytest.mark.skip + def test_biography_field_accepts_html_tags(self): + self.logger.info("Signing in with a normal user account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_12"] + )) + + self.logger.info("Accessing the edit profile page via top-navbar") + self.sumo_pages.top_navbar.click_on_edit_profile_option() + + self.logger.info("Clearing the biography field and inputting html data to it") + self.sumo_pages.edit_my_profile_page.clear_biography_textarea_field() + html_test_data = super().profile_edit_test_data + self.sumo_pages.edit_my_profile_page.send_text_to_biography_field( + html_test_data["biography_field_with_html_data"]["biography_html_data"] + ) + + self.logger.info("Clicking on the 'Update My Profile button'") + self.sumo_pages.edit_my_profile_page.click_update_my_profile_button() + + # C2107899, C2107899 + @pytest.mark.editUserProfileTests + def test_make_my_email_address_visible_checkbox_checked(self): + logged_in_email = super().user_secrets_accounts["TEST_ACCOUNT_12"] + + self.logger.info("Signing in with a normal user account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_12"] + )) + + username_one = self.sumo_pages.top_navbar.get_text_of_logged_in_username() + + self.logger.info("Accessing the 'Edit My Profile' page") + self.sumo_pages.top_navbar.click_on_edit_profile_option() + + if not self.sumo_pages.edit_my_profile_page.is_make_email_visible_checkbox_selected(): + self.sumo_pages.edit_my_profile_page.click_make_email_visible_checkbox() + self.sumo_pages.edit_my_profile_page.click_update_my_profile_button() + + self.logger.info( + "Checkbox is checked, returning to My Profile page " + "and verifying that the email is displayed" + ) + self.sumo_pages.top_navbar.click_on_view_profile_option() + + check.equal( + self.sumo_pages.my_profile_page.get_text_of_publicly_displayed_username(), + logged_in_email, + f"Incorrect email is displayed inside the " + f"'My Profile' page. Expected: {logged_in_email} " + f"received " + f"{self.sumo_pages.my_profile_page.get_text_of_publicly_displayed_username()}", + ) + + self.logger.info("Signing in with a different user") + self.delete_cookies() + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_13"] + )) + + self.logger.info( + "Accessing the previous user profile and verifying that the email address is displayed" + ) + self.navigate_to_link(MyProfileMessages.get_my_profile_stage_url(username_one)) + + check.equal( + self.sumo_pages.my_profile_page.get_text_of_publicly_displayed_username(), + logged_in_email, + f"Incorrect email is displayed inside the 'My Profile' page. " + f"Expected: {logged_in_email} " + f"received " + f"{self.sumo_pages.my_profile_page.get_text_of_publicly_displayed_username()}", + ) + + self.logger.info("Signing out") + self.delete_cookies() + + self.logger.info( + "Accessing the previous user profile and verifying that " + "the email address is not displayed to signed out users" + ) + + # This also needs an update + self.navigate_to_link(MyProfileMessages.get_my_profile_stage_url(username_one)) + + expect( + self.sumo_pages.my_profile_page.publicly_displayed_email_element() + ).to_be_hidden() + + # C2107899 + @pytest.mark.editUserProfileTests + def test_make_my_email_address_visible_checkbox_unchecked(self): + self.logger.info("Signing in with a normal user account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_12"] + )) + + username_one = self.sumo_pages.top_navbar.get_text_of_logged_in_username() + + self.logger.info("Accessing the 'Edit My Profile' page") + self.sumo_pages.top_navbar.click_on_edit_profile_option() + + if self.sumo_pages.edit_my_profile_page.is_make_email_visible_checkbox_selected(): + self.sumo_pages.edit_my_profile_page.click_make_email_visible_checkbox() + self.sumo_pages.edit_my_profile_page.click_update_my_profile_button() + + self.logger.info( + "Checkbox is unchecked, returning to My Profile page " + "and verifying that the email is not displayed" + ) + self.sumo_pages.user_navbar.click_on_my_profile_option() + + expect( + self.sumo_pages.my_profile_page.publicly_displayed_email_element() + ).to_be_hidden() + + self.logger.info("Signing in with a different user") + self.delete_cookies() + + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_13"] + )) + + self.logger.info( + "Accessing the previous user profile and verifying that " + "the email address is not displayed" + ) + + # This also needs an update + self.navigate_to_link(MyProfileMessages.get_my_profile_stage_url(username_one)) + + expect( + self.sumo_pages.my_profile_page.publicly_displayed_email_element() + ).to_be_hidden() + + # C2107900, C2107900 + @pytest.mark.editUserProfileTests + def test_website_information_is_displayed(self): + self.logger.info("Signing in with a normal user account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_12"] + )) + + username_one = self.sumo_pages.top_navbar.get_text_of_logged_in_username() + + self.logger.info("Accessing the 'Edit My Profile' page") + self.sumo_pages.top_navbar.click_on_edit_profile_option() + website_field_test_data = super().profile_edit_test_data["valid_user_edit"]["website"] + self.sumo_pages.edit_my_profile_page.clear_website_field() + self.sumo_pages.edit_my_profile_page.send_text_to_website_field(website_field_test_data) + self.sumo_pages.edit_my_profile_page.click_update_my_profile_button() + + self.logger.info("Verify that the correct website is displayed") + + check.equal( + self.sumo_pages.my_profile_page.get_my_profile_website_text(), + website_field_test_data, + f"Incorrect website displayed. Expected: {website_field_test_data}, " + f"received: {self.sumo_pages.my_profile_page.get_my_profile_website_text()}", + ) + + self.logger.info( + "Signing in with a different user and verifying that the correct website information " + "is displayed for the first user" + ) + + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_13"] + )) + + self.navigate_to_link(MyProfileMessages.get_my_profile_stage_url(username_one)) + + check.equal( + self.sumo_pages.my_profile_page.get_my_profile_website_text(), + website_field_test_data, + f"Incorrect website displayed. Expected: {website_field_test_data}, " + f"received: {self.sumo_pages.my_profile_page.get_my_profile_website_text()}", + ) + + self.logger.info( + "Clicking on the website and verifying that the user is redirected correctly" + ) + self.sumo_pages.my_profile_page.click_on_my_website_link() + + check.is_in( + website_field_test_data, + self.get_page_url(), + f"Incorrect user redirect. Expected: {website_field_test_data} " + f"received: {self.get_page_url()}", + ) + + self.logger.info("Navigating back to the SUMO page") + self.navigate_back() + + self.logger.info("Signin out from SUMO") + self.delete_cookies() + self.navigate_to_link(MyProfileMessages.get_my_profile_stage_url(username_one)) + + check.equal( + self.sumo_pages.my_profile_page.get_my_profile_website_text(), + website_field_test_data, + f"Incorrect website displayed. Expected: {website_field_test_data}, " + f"received: {self.sumo_pages.my_profile_page.get_my_profile_website_text()}", + ) + + self.logger.info( + "Clicking on the website and verifying that the user is redirected correctly" + ) + self.sumo_pages.my_profile_page.click_on_my_website_link() + + check.is_in( + website_field_test_data, + self.get_page_url(), + f"Incorrect user redirect. Expected: {website_field_test_data} " + f"received: {self.get_page_url()}", + ) + + self.logger.info("Navigating back to the SUMO page") + self.navigate_back() + + self.logger.info("Clearing the website field changes") + + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_12"] + )) + + self.sumo_pages.top_navbar.click_on_edit_profile_option() + self.sumo_pages.edit_my_profile_page.clear_website_field() + self.sumo_pages.edit_my_profile_page.click_update_my_profile_button() + + # C2107901, C2107901 + @pytest.mark.editUserProfileTests + def test_twitter_information_is_displayed(self): + self.logger.info("Signing in with a normal user account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_12"] + )) + + username_one = self.sumo_pages.top_navbar.get_text_of_logged_in_username() + + self.logger.info("Accessing the 'Edit My Profile' page") + self.sumo_pages.top_navbar.click_on_edit_profile_option() + + self.logger.info("Clearing and adding data inside the twitter input field") + twitter_field_test_data = super().profile_edit_test_data["valid_user_edit"][ + "twitter_username" + ] + self.sumo_pages.edit_my_profile_page.clear_twitter_field() + self.sumo_pages.edit_my_profile_page.send_text_to_twitter_username_field( + twitter_field_test_data + ) + self.sumo_pages.edit_my_profile_page.click_update_my_profile_button() + + self.logger.info( + "Navigating back to the My Profile page and verify " + "that the correct twitter is displayed" + ) + self.sumo_pages.top_navbar.click_on_view_profile_option() + + check.equal( + self.sumo_pages.my_profile_page.get_my_profile_twitter_text(), + twitter_field_test_data, + f"Incorrect twitter displayed. Expected: {twitter_field_test_data}, " + f"received: {self.sumo_pages.my_profile_page.get_my_profile_twitter_text()}", + ) + + self.logger.info( + "Signing in with a different user and verifying that the correct website information " + "is displayed for the first user" + ) + self.delete_cookies() + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_13"] + )) + + self.navigate_to_link(MyProfileMessages.get_my_profile_stage_url(username_one)) + + check.equal( + self.sumo_pages.my_profile_page.get_my_profile_twitter_text(), + twitter_field_test_data, + f"Incorrect twitter displayed. Expected: {twitter_field_test_data}, " + f"received: {self.sumo_pages.my_profile_page.get_my_profile_twitter_text()}", + ) + + self.logger.info( + "Clicking on the twitter link and verifying that the user is redirected correctly" + ) + self.sumo_pages.my_profile_page.click_on_twitter_link() + + check.is_in( + MyProfileMessages.TWITTER_REDIRECT_LINK + twitter_field_test_data, + self.get_page_url(), + f"Incorrect user redirect. " + f"Expected: {MyProfileMessages.TWITTER_REDIRECT_LINK + twitter_field_test_data} " + f"received: {self.get_page_url()}", + ) + + self.logger.info("Navigating back to the SUMO page") + self.navigate_back() + + self.logger.info( + "Signing out, accessing the profile and verifying that " + "the twitter information is displayed" + ) + self.delete_cookies() + self.navigate_to_link(MyProfileMessages.get_my_profile_stage_url(username_one)) + + check.equal( + self.sumo_pages.my_profile_page.get_my_profile_twitter_text(), + twitter_field_test_data, + f"Incorrect twitter displayed. Expected: {twitter_field_test_data}, " + f"received: {self.sumo_pages.my_profile_page.get_my_profile_twitter_text()}", + ) + + self.logger.info( + "Clicking on the twitter link and verifying that the user is redirected correctly" + ) + self.sumo_pages.my_profile_page.click_on_twitter_link() + + check.is_in( + MyProfileMessages.TWITTER_REDIRECT_LINK + twitter_field_test_data, + self.get_page_url(), + f"Incorrect user redirect. " + f"Expected: {MyProfileMessages.TWITTER_REDIRECT_LINK + twitter_field_test_data} " + f"received: {self.get_page_url()}", + ) + + self.logger.info("Navigating back to the SUMO page") + self.navigate_back() + + self.logger.info("Clearing the twitter field changes") + + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_12"] + )) + + self.sumo_pages.top_navbar.click_on_edit_profile_option() + self.sumo_pages.edit_my_profile_page.clear_twitter_field() + self.sumo_pages.edit_my_profile_page.click_update_my_profile_button() + + # C2107903, C2107903 + @pytest.mark.editUserProfileTests + def test_community_portal_username_is_displayed(self): + self.logger.info("Signing in with a normal user account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_12"] + )) + + username_one = self.sumo_pages.top_navbar.get_text_of_logged_in_username() + + self.logger.info("Accessing the 'Edit My Profile' page") + self.sumo_pages.top_navbar.click_on_edit_profile_option() + + self.logger.info("Clearing and adding data inside the Community Portal input field") + + community_portal_field_test_data = super().profile_edit_test_data["valid_user_edit"][ + "community_portal_username" + ] + self.sumo_pages.edit_my_profile_page.clear_community_portal_field() + self.sumo_pages.edit_my_profile_page.send_text_to_community_portal_field( + community_portal_field_test_data + ) + self.sumo_pages.edit_my_profile_page.click_update_my_profile_button() + + self.logger.info( + "Navigating back to the My Profile page and verify that " + "the correct Community portal information is displayed" + ) + + self.sumo_pages.top_navbar.click_on_view_profile_option() + + check.equal( + self.sumo_pages.my_profile_page.get_my_profile_community_portal_text(), + community_portal_field_test_data, + f"Incorrect community portal information is displayed. " + f"Expected: {community_portal_field_test_data}, " + f"received: {self.sumo_pages.my_profile_page.get_my_profile_community_portal_text()}", + ) + + self.logger.info( + "Signing in with a different user and verifying " + "that the correct community portal information is displayed for the first user" + ) + self.delete_cookies() + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_13"] + )) + + self.navigate_to_link(MyProfileMessages.get_my_profile_stage_url(username_one)) + + check.equal( + self.sumo_pages.my_profile_page.get_my_profile_community_portal_text(), + community_portal_field_test_data, + f"Incorrect website displayed. Expected: {community_portal_field_test_data}, " + f"received: {self.sumo_pages.my_profile_page.get_my_profile_community_portal_text()}", + ) + + self.logger.info( + "Clicking on the community portal link and verifying " + "that the user is redirected correctly" + ) + + self.sumo_pages.my_profile_page.click_on_community_portal_link() + + check.is_in( + MyProfileMessages.COMMUNITY_PORTAL_LINK, + self.get_page_url(), + f"Incorrect user redirect. Expected: {MyProfileMessages.TWITTER_REDIRECT_LINK} " + f"received: {self.get_page_url()}", + ) + + self.logger.info("Navigating back to the SUMO page") + self.navigate_back() + + self.logger.info( + "Signing out, accessing the profile and verifying that " + "the community portal information is displayed" + ) + self.delete_cookies() + + self.navigate_to_link(MyProfileMessages.get_my_profile_stage_url(username_one)) + + check.equal( + self.sumo_pages.my_profile_page.get_my_profile_community_portal_text(), + community_portal_field_test_data, + f"Incorrect community portal displayed. Expected: " + f"{community_portal_field_test_data}, " + f"received: {self.sumo_pages.my_profile_page.get_my_profile_community_portal_text()}", + ) + + self.logger.info( + "Clicking on the community portal link and verifying that " + "the user is redirected correctly" + ) + + self.sumo_pages.my_profile_page.click_on_community_portal_link() + + check.is_in( + MyProfileMessages.COMMUNITY_PORTAL_LINK, + self.get_page_url(), + f"Incorrect user redirect. Expected: {MyProfileMessages.COMMUNITY_PORTAL_LINK} " + f"received: {self.get_page_url()}", + ) + + self.logger.info("Navigating back to the SUMO page") + self.navigate_back() + + self.logger.info("Clearing the community portal field changes") + self.delete_cookies() + + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_12"] + )) + + self.sumo_pages.top_navbar.click_on_edit_profile_option() + self.sumo_pages.edit_my_profile_page.clear_community_portal_field() + self.sumo_pages.edit_my_profile_page.click_update_my_profile_button() + + # C2107902,C2107902 + @pytest.mark.editUserProfileTests + def test_people_directory_information_is_displayed(self): + self.logger.info("Signing in with a normal user account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_12"] + )) + + username_one = self.sumo_pages.top_navbar.get_text_of_logged_in_username() + + self.logger.info("Accessing the 'Edit My Profile' page") + self.sumo_pages.top_navbar.click_on_edit_profile_option() + + self.logger.info("Clearing and adding data inside the People Directory input field") + people_directory_field_test_data = super().profile_edit_test_data["valid_user_edit"][ + "people_directory_username" + ] + self.sumo_pages.edit_my_profile_page.clear_people_directory_field() + self.sumo_pages.edit_my_profile_page.send_text_to_people_directory_username( + people_directory_field_test_data + ) + self.sumo_pages.edit_my_profile_page.click_update_my_profile_button() + + self.logger.info( + "Navigating back to the My Profile page and verify that " + "the correct People Directory information is displayed" + ) + self.sumo_pages.top_navbar.click_on_view_profile_option() + + check.equal( + self.sumo_pages.my_profile_page.get_my_profile_people_directory_text(), + people_directory_field_test_data, + f"Incorrect people directory text displayed. " + f"Expected: {people_directory_field_test_data}, " + f"received: {self.sumo_pages.my_profile_page.get_my_profile_people_directory_text()}", + ) + + self.logger.info( + "Signing in with a different user and verifying that " + "the correct people directory information is displayed for the first user" + ) + self.delete_cookies() + + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_13"] + )) + + self.navigate_to_link(MyProfileMessages.get_my_profile_stage_url(username_one)) + + check.equal( + self.sumo_pages.my_profile_page.get_my_profile_people_directory_text(), + people_directory_field_test_data, + f"Incorrect people directory information displayed. " + f"Expected: {people_directory_field_test_data}, " + f"received: {self.sumo_pages.my_profile_page.get_my_profile_people_directory_text()}", + ) + + self.logger.info( + "Signing out, accessing the profile and verifying that " + "the people directory information is displayed" + ) + self.delete_cookies() + self.navigate_to_link(MyProfileMessages.get_my_profile_stage_url(username_one)) + + check.equal( + self.sumo_pages.my_profile_page.get_my_profile_people_directory_text(), + people_directory_field_test_data, + f"Incorrect people directory displayed. Expected: " + f"{people_directory_field_test_data}, " + f"received: {self.sumo_pages.my_profile_page.get_my_profile_people_directory_text()}", + ) + + self.logger.info("Clearing the people directory field changes") + + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_12"] + )) + + self.sumo_pages.top_navbar.click_on_edit_profile_option() + self.sumo_pages.edit_my_profile_page.clear_people_directory_field() + self.sumo_pages.edit_my_profile_page.click_update_my_profile_button() + + # C2107933, C2107933 + @pytest.mark.editUserProfileTests + def test_matrix_information_is_displayed(self): + self.logger.info("Signing in with a normal user account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_12"] + )) + + username_one = self.sumo_pages.top_navbar.get_text_of_logged_in_username() + + self.logger.info("Accessing the 'Edit My Profile' page") + self.sumo_pages.top_navbar.click_on_edit_profile_option() + + self.logger.info("Clearing and adding data inside the Matrix input field") + matrix_field_test_data = super().profile_edit_test_data["valid_user_edit"][ + "matrix_nickname" + ] + self.sumo_pages.edit_my_profile_page.clear_matrix_field() + self.sumo_pages.edit_my_profile_page.send_text_to_matrix_nickname(matrix_field_test_data) + self.sumo_pages.edit_my_profile_page.click_update_my_profile_button() + + self.logger.info( + "Navigating back to the My Profile page and verify that the " + "correct Matrix information is displayed" + ) + self.sumo_pages.top_navbar.click_on_view_profile_option() + + check.is_in( + matrix_field_test_data, + self.sumo_pages.my_profile_page.get_my_profile_matrix_text(), + f"Incorrect Matrix text displayed. Expected: {matrix_field_test_data}, " + f"received: {self.sumo_pages.my_profile_page.get_my_profile_matrix_text()}", + ) + + self.logger.info( + "Signing in with a different user and verifying that the correct Matrix information " + "is displayed for the first user" + ) + self.delete_cookies() + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_13"] + )) + + self.navigate_to_link(MyProfileMessages.get_my_profile_stage_url(username_one)) + + check.is_in( + matrix_field_test_data, + self.sumo_pages.my_profile_page.get_my_profile_matrix_text(), + f"Incorrect matrix information displayed. Expected: {matrix_field_test_data}, " + f"received: {self.sumo_pages.my_profile_page.get_my_profile_matrix_text()}", + ) + + self.logger.info( + "Signing out, accessing the profile and verifying that the " + "Matrix information is displayed" + ) + self.delete_cookies() + self.navigate_to_link(MyProfileMessages.get_my_profile_stage_url(username_one)) + + check.is_in( + matrix_field_test_data, + self.sumo_pages.my_profile_page.get_my_profile_matrix_text(), + f"Incorrect matrix displayed. Expected: {matrix_field_test_data}, " + f"received: {self.sumo_pages.my_profile_page.get_my_profile_matrix_text()}", + ) + + self.logger.info("Clearing the Matrix field changes") + + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_12"] + )) + + self.sumo_pages.top_navbar.click_on_edit_profile_option() + self.sumo_pages.edit_my_profile_page.clear_matrix_field() + self.sumo_pages.edit_my_profile_page.click_update_my_profile_button() + + # C2107934, C2107934 + @pytest.mark.editUserProfileTests + def test_country_location_information_is_displayed(self): + self.logger.info("Signing in with a normal user account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_12"] + )) + + username_one = self.sumo_pages.top_navbar.get_text_of_logged_in_username() + + self.logger.info("Accessing the 'Edit My Profile' page") + self.sumo_pages.top_navbar.click_on_edit_profile_option() + + self.logger.info("Clearing and adding data inside the Country input field") + country_field_test_data_code = super().profile_edit_test_data["valid_user_edit"][ + "country_code" + ] + country_field_test_data_value = super().profile_edit_test_data["valid_user_edit"][ + "country_value" + ] + self.sumo_pages.edit_my_profile_page.clear_country_dropdown_field() + self.sumo_pages.edit_my_profile_page.select_country_dropdown_option_by_value( + country_field_test_data_code + ) + self.sumo_pages.edit_my_profile_page.click_update_my_profile_button() + + self.logger.info("Verify that the correct Country information is displayed") + + check.is_in( + country_field_test_data_value, + self.sumo_pages.my_profile_page.get_text_of_profile_subheading_location(), + f"Incorrect Country text displayed. Expected: {country_field_test_data_value}, " + f"received: " + f"{self.sumo_pages.my_profile_page.get_text_of_profile_subheading_location()}", + ) + + self.logger.info( + "Signing in with a different user and verifying that the correct Country information " + "is displayed for the first user" + ) + self.delete_cookies() + + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_13"] + )) + + self.navigate_to_link(MyProfileMessages.get_my_profile_stage_url(username_one)) + + check.is_in( + country_field_test_data_value, + self.sumo_pages.my_profile_page.get_text_of_profile_subheading_location(), + f"Incorrect country information displayed. " + f"Expected: {country_field_test_data_value}, " + f"received: " + f"{self.sumo_pages.my_profile_page.get_text_of_profile_subheading_location()}", + ) + + self.logger.info( + "Signing out, accessing the profile and verifying that the " + "Country information is displayed" + ) + + self.delete_cookies() + self.navigate_to_link(MyProfileMessages.get_my_profile_stage_url(username_one)) + + check.is_in( + country_field_test_data_value, + self.sumo_pages.my_profile_page.get_text_of_profile_subheading_location(), + f"Incorrect country displayed. Expected: {country_field_test_data_value}, " + f"received: " + f"{self.sumo_pages.my_profile_page.get_text_of_profile_subheading_location()}", + ) + + self.logger.info("Clearing the Country field changes") + + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_12"] + )) + + self.sumo_pages.top_navbar.click_on_edit_profile_option() + self.sumo_pages.edit_my_profile_page.clear_country_dropdown_field() + self.sumo_pages.edit_my_profile_page.click_update_my_profile_button() + + # C2107935, C2107935 + @pytest.mark.editUserProfileTests + def test_city_location_information_is_displayed(self): + self.logger.info("Signing in with a normal user account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_12"] + )) + + username_one = self.sumo_pages.top_navbar.get_text_of_logged_in_username() + + self.logger.info("Accessing the 'Edit My Profile' page") + self.sumo_pages.top_navbar.click_on_edit_profile_option() + + self.logger.info("Clearing and adding data inside the City input field") + + city_field_test_data_value = super().profile_edit_test_data["valid_user_edit"]["city"] + self.sumo_pages.edit_my_profile_page.clear_city_field() + self.sumo_pages.edit_my_profile_page.sent_text_to_city_field(city_field_test_data_value) + self.sumo_pages.edit_my_profile_page.click_update_my_profile_button() + + self.logger.info("Verify that the correct City information is displayed") + + check.is_in( + city_field_test_data_value, + self.sumo_pages.my_profile_page.get_text_of_profile_subheading_location(), + f"Incorrect City text displayed. Expected: {city_field_test_data_value}, " + f"received: " + f"{self.sumo_pages.my_profile_page.get_text_of_profile_subheading_location()}", + ) + + self.logger.info( + "Signing in with a different user and verifying that the correct City information " + "is displayed for the first user" + ) + self.delete_cookies() + + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_13"] + )) + + self.navigate_to_link(MyProfileMessages.get_my_profile_stage_url(username_one)) + + check.is_in( + city_field_test_data_value, + self.sumo_pages.my_profile_page.get_text_of_profile_subheading_location(), + f"Incorrect city information displayed. Expected: {city_field_test_data_value}, " + f"received: " + f"{self.sumo_pages.my_profile_page.get_text_of_profile_subheading_location()}", + ) + + self.logger.info( + "Signing out, accessing the profile and verifying that the " + "City information is displayed" + ) + self.delete_cookies() + self.navigate_to_link(MyProfileMessages.get_my_profile_stage_url(username_one)) + + check.is_in( + city_field_test_data_value, + self.sumo_pages.my_profile_page.get_text_of_profile_subheading_location(), + f"Incorrect city displayed. Expected: {city_field_test_data_value}, " + f"received: " + f"{self.sumo_pages.my_profile_page.get_text_of_profile_subheading_location()}", + ) + + self.logger.info("Clearing the City field changes") + + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_12"] + )) + + self.sumo_pages.top_navbar.click_on_edit_profile_option() + self.sumo_pages.edit_my_profile_page.clear_city_field() + self.sumo_pages.edit_my_profile_page.click_update_my_profile_button() + + # C2107938, C2107938 + @pytest.mark.editUserProfileTests + def test_involved_since_information_is_displayed(self): + self.logger.info("Signing in with a normal user account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_12"] + )) + + username_one = self.sumo_pages.top_navbar.get_text_of_logged_in_username() + + self.logger.info("Accessing the 'Edit My Profile' page") + self.sumo_pages.top_navbar.click_on_edit_profile_option() + + self.logger.info("Clearing and adding data inside the involved since input fields") + involved_since_month_number_test_data = super().profile_edit_test_data["valid_user_edit"][ + "involved_from_month_number" + ] + involved_since_month_test_data_value = super().profile_edit_test_data["valid_user_edit"][ + "involved_from_month_value" + ] + involved_since_year_test_data_value = super().profile_edit_test_data["valid_user_edit"][ + "involved_from_year" + ] + self.sumo_pages.edit_my_profile_page.clear_involved_from_month_select_field() + self.sumo_pages.edit_my_profile_page.clear_involved_from_year_select_field() + self.sumo_pages.edit_my_profile_page.select_involved_from_month_option_by_value( + involved_since_month_number_test_data + ) + self.sumo_pages.edit_my_profile_page.select_involved_from_year_option_by_value( + involved_since_year_test_data_value + ) + self.sumo_pages.edit_my_profile_page.click_update_my_profile_button() + + self.logger.info("Verify that the correct involved from information is displayed") + + check.is_in( + involved_since_month_test_data_value and involved_since_year_test_data_value, + self.sumo_pages.my_profile_page.get_my_contributed_from_text(), + f"Incorrect involved from text displayed. " + f"Expected to contain: {involved_since_month_test_data_value} " + f"and {involved_since_year_test_data_value}, " + f"received: {self.sumo_pages.my_profile_page.get_my_contributed_from_text()}", + ) + + self.logger.info( + "Signing in with a different user and verifying that the " + "correct involved from information is displayed for the first user" + ) + self.delete_cookies() + + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_13"] + )) + + self.navigate_to_link(MyProfileMessages.get_my_profile_stage_url(username_one)) + + check.is_in( + involved_since_month_test_data_value and involved_since_year_test_data_value, + self.sumo_pages.my_profile_page.get_my_contributed_from_text(), + f"Incorrect involved from information displayed. " + f"Expected to contain: {involved_since_month_test_data_value} and" + f" {involved_since_year_test_data_value}, " + f"received: {self.sumo_pages.my_profile_page.get_my_contributed_from_text()}", + ) + + self.logger.info( + "Signing out, accessing the profile and verifying that the " + "involved from information is displayed" + ) + self.delete_cookies() + self.navigate_to_link(MyProfileMessages.get_my_profile_stage_url(username_one)) + + check.is_in( + involved_since_month_test_data_value and involved_since_year_test_data_value, + self.sumo_pages.my_profile_page.get_my_contributed_from_text(), + f"Incorrect involved from text displayed. " + f"Expected to contain: {involved_since_month_test_data_value} " + f"and {involved_since_year_test_data_value}, " + f"received: {self.sumo_pages.my_profile_page.get_my_contributed_from_text()}", + ) + + self.logger.info("Clearing the involved from field changes") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_12"] + )) + + self.sumo_pages.top_navbar.click_on_edit_profile_option() + self.sumo_pages.edit_my_profile_page.clear_involved_from_month_select_field() + self.sumo_pages.edit_my_profile_page.clear_involved_from_year_select_field() + self.sumo_pages.edit_my_profile_page.click_update_my_profile_button() + + # C2087552, C2108840 + @pytest.mark.editUserProfileTests + def test_edit_user_profile_button_is_not_displayed_for_non_admin_users(self): + target_username = self.remove_character_from_string( + super().username_extraction_from_email( + super().user_special_chars + ), + "*", + ) + + self.logger.info("Accessing a user profile while not being signed in to SUMO") + self.navigate_to_link( + MyProfileMessages.get_my_profile_stage_url(target_username) + ) + + self.logger.info("Verifying that the 'Edit user profile' option is not displayed") + + expect( + self.sumo_pages.my_profile_page.edit_user_profile_option_element() + ).to_be_hidden() + + self.logger.info( + "Navigating to the profile edit link directly and verifying that the " + "user is redirected to the auth page" + ) + + self.navigate_to_link( + EditMyProfilePageMessages.get_url_of_other_profile_edit_page(target_username) + ) + + assert ( + self.sumo_pages.auth_page.is_continue_with_firefox_button_displayed() + ), "The auth page is not displayed! It should be!" + + expect( + self.sumo_pages.edit_my_profile_page.is_my_profile_edit_form_displayed() + ).to_be_hidden() + + self.logger.info("Signin in with a simple user 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_12"] + )) + + self.logger.info("Accessing another user's account") + self.navigate_to_link( + MyProfileMessages.get_my_profile_stage_url(target_username) + ) + + self.logger.info("Verifying that the 'Edit user profile' option is not displayed") + + expect( + self.sumo_pages.my_profile_page.edit_user_profile_option_element() + ).to_be_hidden() + + self.logger.info( + "Navigating to the profile edit link directly and verifying that the " + "correct message is displayed and the " + "edit form is not displayed" + ) + + self.navigate_to_link( + EditMyProfilePageMessages.get_url_of_other_profile_edit_page(target_username) + ) + + check.equal( + self.sumo_pages.edit_my_profile_page.get_access_denied_header_text(), + EditMyProfilePageMessages.PROFILE_ACCESS_DENIED_HEADING, + f"Incorrect access denied heading displayed. " + f"Expected: {EditMyProfilePageMessages.PROFILE_ACCESS_DENIED_HEADING} " + f"received: {self.sumo_pages.edit_my_profile_page.get_access_denied_header_text()}", + ) + + check.equal( + self.sumo_pages.edit_my_profile_page.get_access_denied_subheading_text(), + EditMyProfilePageMessages.PROFILE_ACCESS_DENIED_SUBHEADING, + f"Incorrect access denied subheading displayed. " + f"Expected: {EditMyProfilePageMessages.PROFILE_ACCESS_DENIED_SUBHEADING} " + f" received: " + f"{self.sumo_pages.edit_my_profile_page.get_access_denied_subheading_text()}", + ) + + expect( + self.sumo_pages.edit_my_profile_page.is_my_profile_edit_form_displayed() + ).to_be_hidden() + + # C2108839 + @pytest.mark.editUserProfileTests + def test_report_user_is_displayed_and_accessible_for_signed_in_users_only(self): + target_username = self.remove_character_from_string( + super().username_extraction_from_email( + super().user_special_chars + ), + "*", + ) + self.logger.info("Signing in with a normal user ") + + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_12"] + )) + + self.logger.info( + "Accessing another user profile and verifying that the " + "'Report Abuse' option is displayed" + ) + + self.navigate_to_link( + MyProfileMessages.get_my_profile_stage_url(target_username) + ) + + expect( + self.sumo_pages.my_profile_page.is_report_user_option_displayed() + ).to_be_visible() + + self.logger.info("Clicking on the 'Report Abuse' option") + self.sumo_pages.my_profile_page.click_on_report_abuse_option() + + self.logger.info("Verifying that the report abuse panel is displayed") + + expect( + self.sumo_pages.my_profile_page.is_report_abuse_panel_displayed() + ).to_be_visible() + + self.logger.info("Closing the report abuse panel") + self.sumo_pages.my_profile_page.click_on_report_abuse_close_button() + + self.logger.info("Verifying that the report user panel is no longer displayed") + + expect( + self.sumo_pages.my_profile_page.is_report_abuse_panel_displayed() + ).to_be_hidden() + + self.logger.info( + "Signing out and verifying that the 'Report Abuse' options is not displayed" + ) + self.delete_cookies() + + self.logger.info( + "Accessing another users profile and verifying that the " + "'report abuse' option is not displayed" + ) + self.navigate_to_link( + MyProfileMessages.get_my_profile_stage_url(target_username) + ) + + expect( + self.sumo_pages.my_profile_page.is_report_user_option_displayed() + ).to_be_hidden() + + # C2108841 + @pytest.mark.editUserProfileTests + def test_private_message_button_redirects_non_signed_in_users_to_the_fxa_login_flow(self): + target_username = self.remove_character_from_string( + super().username_extraction_from_email( + super().user_special_chars + ), + "*", + ) + self.logger.info("Accessing another users profile") + self.navigate_to_link( + MyProfileMessages.get_my_profile_stage_url(target_username) + ) + + self.logger.info("Clicking on the 'Private Message' button") + self.sumo_pages.my_profile_page.click_on_private_message_button() + + self.logger.info("Verifying that the non-signed in user is redirected to the fxa page") + + assert ( + self.sumo_pages.auth_page.is_continue_with_firefox_button_displayed() + ), "The auth page is not displayed! It should be!" + + # C916055, C916054 + @pytest.mark.editUserProfileTests + def test_deactivate_this_user_buttons_are_displayed_only_for_admin_users(self): + target_username = self.remove_character_from_string( + super().username_extraction_from_email( + super().user_special_chars + ), + "*", + ) + self.logger.info("Navigating to a user profile while not signed in with a user") + + self.navigate_to_link( + MyProfileMessages.get_my_profile_stage_url(target_username) + ) + + self.logger.info("Verifying that the deactivate this user buttons are not displayed") + + expect( + self.sumo_pages.my_profile_page.is_deactivate_this_user_button_displayed() + ).to_be_hidden() + + expect( + self.sumo_pages.my_profile_page.deactivate_this_user_and_mark_content_as_spam_element() + ).to_be_hidden() + + self.logger.info("Sign in with a normal user 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_12"] + )) + + self.logger.info( + "Accessing another user profile and verify that the " + "deactivate this user buttons are not displayed" + ) + self.navigate_to_link( + MyProfileMessages.get_my_profile_stage_url(target_username) + ) + + expect( + self.sumo_pages.my_profile_page.is_deactivate_this_user_button_displayed() + ).to_be_hidden() + + expect( + self.sumo_pages.my_profile_page.deactivate_this_user_and_mark_content_as_spam_element() + ).to_be_hidden() + + self.logger.info("Signing in with a moderator account") + self.sumo_pages.top_navbar.click_on_sumo_nav_logo() + self.delete_cookies() + + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"] + )) + + self.logger.info( + "Accessing another user profile and verifying that " + "the deactivate user buttons are displayed" + ) + self.navigate_to_link( + MyProfileMessages.get_my_profile_stage_url(target_username) + ) + + expect( + self.sumo_pages.my_profile_page.is_deactivate_this_user_button_displayed() + ).to_be_visible() + + expect( + self.sumo_pages.my_profile_page.deactivate_this_user_and_mark_content_as_spam_element() + ).to_be_visible() diff --git a/playwright_tests/tests/user_page_tests/test_edit_my_settings.py b/playwright_tests/tests/user_page_tests/test_edit_my_settings.py new file mode 100644 index 00000000000..33fed33a9ce --- /dev/null +++ b/playwright_tests/tests/user_page_tests/test_edit_my_settings.py @@ -0,0 +1,66 @@ +import pytest +import pytest_check as check + +from playwright_tests.core.testutilities import TestUtilities +from playwright_tests.messages.my_profile_pages_messages.edit_settings_page_messages import ( + EditSettingsPageMessages) + + +class TestEditMySettings(TestUtilities): + # C891396, C2108836 + @pytest.mark.userSettings + def test_all_checkboxes_can_be_selected_and_saved(self): + self.logger.info( + "Signing in to a normal user account " + ) + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts['TEST_ACCOUNT_12'] + )) + + self.sumo_pages.top_navbar.click_on_settings_profile_option() + + self.logger.info("Clicking on all available checkboxes") + self.sumo_pages.edit_my_profile_settings_page.click_on_all_settings_checkboxes() + + self.logger.info("Clicking on the 'Update' button") + self.sumo_pages.edit_my_profile_settings_page.click_on_update_button() + + self.logger.info("Verifying that the correct notification banner is displayed") + check.equal( + self.sumo_pages.edit_my_profile_settings_page.settings_saved_notif_banner_txt(), + EditSettingsPageMessages.MODIFIED_SETTINGS_NOTIFICATION_BANNER_MESSAGE, + f"Incorrect message displayed inside the notification banner. Expected:" + f" {EditSettingsPageMessages.MODIFIED_SETTINGS_NOTIFICATION_BANNER_MESSAGE} " + f"but received: " + f"{self.sumo_pages.edit_my_profile_settings_page.settings_saved_notif_banner_txt()}", + ) + + self.logger.info("Verifying that all the checkboxes are checked") + + assert ( + self.sumo_pages.edit_my_profile_settings_page.are_all_checkbox_checked() + ), "Not all checkboxes are checked!" + + self.logger.info( + "Unchecking all the available checkboxes and clicking on the 'Update' button" + ) + + self.sumo_pages.edit_my_profile_settings_page.click_on_all_settings_checkboxes() + + self.sumo_pages.edit_my_profile_settings_page.click_on_update_button() + + self.logger.info("Verifying that the correct notification banner is displayed") + + check.equal( + self.sumo_pages.edit_my_profile_settings_page.settings_saved_notif_banner_txt(), + EditSettingsPageMessages.MODIFIED_SETTINGS_NOTIFICATION_BANNER_MESSAGE, + f"Incorrect message displayed inside the notification banner. Expected:" + f" {EditSettingsPageMessages.MODIFIED_SETTINGS_NOTIFICATION_BANNER_MESSAGE} " + f"but received: " + f"{self.sumo_pages.edit_my_profile_settings_page.settings_saved_notif_banner_txt()}", + ) + + self.logger.info("Verifying that all the checkboxes are unchecked") + assert not ( + self.sumo_pages.edit_my_profile_settings_page.are_all_checkbox_checked() + ), "Not all checkboxes are unchecked!" diff --git a/selenium_tests/tests/user_page_tests/test_my_profile_page.py b/playwright_tests/tests/user_page_tests/test_my_profile_page.py similarity index 51% rename from selenium_tests/tests/user_page_tests/test_my_profile_page.py rename to playwright_tests/tests/user_page_tests/test_my_profile_page.py index eb31c44f948..3a1543120dd 100644 --- a/selenium_tests/tests/user_page_tests/test_my_profile_page.py +++ b/playwright_tests/tests/user_page_tests/test_my_profile_page.py @@ -1,14 +1,13 @@ import pytest import pytest_check as check +from playwright.sync_api import expect -from selenium_tests.core.test_utilities import TestUtilities -from selenium_tests.messages.homepage_messages import HomepageMessages -from selenium_tests.messages.my_profile_pages_messages.my_profile_page_messages import ( - MyProfileMessages, -) -from selenium_tests.messages.my_profile_pages_messages.user_profile_navbar_messages import ( - UserProfileNavbarMessages, -) +from playwright_tests.core.testutilities import TestUtilities +from playwright_tests.messages.homepage_messages import HomepageMessages +from playwright_tests.messages.my_profile_pages_messages.my_profile_page_messages import ( + MyProfileMessages) +from playwright_tests.messages.my_profile_pages_messages.user_profile_navbar_messages import ( + UserProfileNavbarMessages) class TestMyProfilePage(TestUtilities): @@ -16,49 +15,36 @@ class TestMyProfilePage(TestUtilities): @pytest.mark.userProfile def test_my_profile_page_can_be_accessed_via_top_navbar(self): self.logger.info("Signing in with a normal user account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts['TEST_ACCOUNT_12'] + )) - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - original_username = self.pages.top_navbar.get_text_of_logged_in_username() + original_username = self.sumo_pages.top_navbar.get_text_of_logged_in_username() self.logger.info("Accessing the 'My profile' page via the top-navbar menu") - - self.pages.top_navbar.click_on_view_profile_option() + self.sumo_pages.top_navbar.click_on_view_profile_option() self.logger.info( "Verifying that we are on the correct URL and viewing the correct profile" ) - - assert ( - self.pages.my_profile_page.current_url() - == MyProfileMessages.get_my_profile_stage_url(username=original_username) - ), ( - f"We are not on the correct page!. " - f"We are on the {self.pages.my_profile_page.current_url()}" - ) + expect( + self.page + ).to_have_url(MyProfileMessages.get_my_profile_stage_url(username=original_username)) self.logger.info("Verifying that the page header is the expected one") - check.equal( - self.pages.my_profile_page.get_my_profile_page_header(), + self.sumo_pages.my_profile_page.get_my_profile_page_header(), MyProfileMessages.STAGE_MY_PROFILE_PAGE_HEADER, - f"Page header is {self.pages.my_profile_page.get_my_profile_page_header()}" + f"Page header is {self.sumo_pages.my_profile_page.get_my_profile_page_header()}" f"Expected to be {MyProfileMessages.STAGE_MY_PROFILE_PAGE_HEADER}", ) self.logger.info("Verifying that the 'My profile' navbar option is selected") - check.equal( - self.pages.my_profile_page.get_text_of_selected_navbar_option(), + self.sumo_pages.my_profile_page.get_text_of_selected_navbar_option(), UserProfileNavbarMessages.NAVBAR_OPTIONS[0], f"Selected navbar option is: " - f"{self.pages.my_profile_page.get_text_of_selected_navbar_option}" + f"{self.sumo_pages.my_profile_page.get_text_of_selected_navbar_option}" f"Expected to be: {UserProfileNavbarMessages.NAVBAR_OPTIONS[0]}", ) @@ -66,97 +52,84 @@ def test_my_profile_page_can_be_accessed_via_top_navbar(self): @pytest.mark.userProfile def test_my_profile_sign_out_button_functionality(self): self.logger.info("Signing in with a normal user account") + self.sumo_pages.top_navbar.click_on_signin_signup_button() - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], + self.sumo_pages.auth_flow_page.sign_in_flow( + username=super().user_special_chars, + account_password=super().user_secrets_pass, sign_in_with_same_account=False, ) self.logger.info("Accessing the 'My profile' page via the top-navbar menu") - - self.pages.top_navbar.click_on_view_profile_option() + self.sumo_pages.top_navbar.click_on_view_profile_option() self.logger.info("Clicking on the 'Sign Out' button from the 'My Profile' page") - - self.pages.my_profile_page.click_my_profile_page_sign_out_button() + self.sumo_pages.my_profile_page.click_my_profile_page_sign_out_button() self.logger.info("Verifying that the user is redirected to the homepage") - assert self.pages.homepage.current_url() == HomepageMessages.STAGE_HOMEPAGE_URL, ( - f"The user is redirected to the {self.pages.homepage.current_url()} page. " - f"Instead of {HomepageMessages.STAGE_HOMEPAGE_URL}" - ) + expect( + self.page + ).to_have_url(HomepageMessages.STAGE_HOMEPAGE_URL) self.logger.info("Verify that the 'Sign in/Up' button from the page header is displayed") - assert self.pages.top_navbar.is_sign_in_up_button_displayed + expect( + self.sumo_pages.top_navbar.sign_in_up_button_displayed_element() + ).to_be_visible() # C2108828 @pytest.mark.userProfile def test_provided_solutions_number_is_successfully_displayed(self): self.logger.info("Signing in with a normal user account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"] + )) - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_MODERATOR"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - repliant_username = self.pages.top_navbar.get_text_of_logged_in_username() + repliant_username = self.sumo_pages.top_navbar.get_text_of_logged_in_username() self.logger.info("Posting a new AAQ question") - question_info = ( - self.pages.aaq_flow.submit_valid_firefox_product_question_via_ask_now_fx_solutions() + self.sumo_pages.aaq_flow.submit_valid_firefox_prod_question_via_ask_now_fx_solutions() ) - self.pages.top_navbar.click_on_view_profile_option() + self.sumo_pages.top_navbar.click_on_view_profile_option() self.logger.info("Extracting original number of posted solutions") - original_number_of_solutions = self.number_extraction_from_string( - self.pages.my_profile_page.get_my_profile_solutions_text() + self.sumo_pages.my_profile_page.get_my_profile_solutions_text() ) self.logger.info("Navigating to the previously posted question") - - self.pages.homepage.navigate_to(question_info["question_page_url"]) + self.navigate_to_link(question_info["question_page_url"]) self.logger.info("Posting a reply for the question") - question_test_data = super().question_test_data - self.pages.question_page.add_text_to_post_a_reply_textarea( + self.sumo_pages.question_page.add_text_to_post_a_reply_textarea( question_test_data["question_reply_solution"] ) self.logger.info("Clicking on the 'Post Reply' button and extracting answer id from url") - - answer_id = self.pages.question_page.click_on_post_reply_button( + answer_id = self.sumo_pages.question_page.click_on_post_reply_button( repliant_username=repliant_username ) self.logger.info("Marking the reply as the solution") - - self.pages.question_page.click_on_solves_the_problem_button(target_reply_id=answer_id) + self.sumo_pages.question_page.click_on_solves_the_problem_button(target_reply_id=answer_id) self.logger.info( "Accessing the 'My profile' page of the account which provided a solution" ) + self.sumo_pages.top_navbar.click_on_view_profile_option() - self.pages.top_navbar.click_on_view_profile_option() new_number = self.number_extraction_from_string( - self.pages.my_profile_page.get_my_profile_solutions_text() + self.sumo_pages.my_profile_page.get_my_profile_solutions_text() ) assert ( self.number_extraction_from_string( - self.pages.my_profile_page.get_my_profile_solutions_text() + self.sumo_pages.my_profile_page.get_my_profile_solutions_text() ) == original_number_of_solutions + 1 ), ( @@ -167,77 +140,66 @@ def test_provided_solutions_number_is_successfully_displayed(self): ) self.logger.info("Deleting the my posted question") + self.navigate_to_link(question_info["question_page_url"]) - self.pages.my_answers_page.navigate_to(question_info["question_page_url"]) - - self.pages.question_page.click_delete_this_question_question_tools_option() + self.sumo_pages.question_page.click_delete_this_question_question_tools_option() - self.pages.question_page.click_delete_this_question_button() + self.sumo_pages.question_page.click_delete_this_question_button() self.logger.info("Verifying that we are on the product support forum page after deletion") - assert ( - self.pages.product_support_page.is_product_product_title_displayed() - ), "The product support forum page is not displayed!" + expect( + self.sumo_pages.product_support_page.product_product_title_element() + ).to_be_visible() # C890832, C2094281 @pytest.mark.userProfile def test_number_of_my_profile_answers_is_successfully_displayed(self): reply_text = None - self.logger.info("Signing in with a user account") - - self.pages.top_navbar.click_on_signin_signup_button() - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_MODERATOR"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) + self.logger.info("Signing in with a user account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"] + )) - repliant_user = self.pages.top_navbar.get_text_of_logged_in_username() + repliant_user = self.sumo_pages.top_navbar.get_text_of_logged_in_username() self.logger.info("Accessing the 'My profile' page via the top-navbar menu") - - self.pages.top_navbar.click_on_view_profile_option() + self.sumo_pages.top_navbar.click_on_view_profile_option() self.logger.info("Extracting original number of posted answers") - original_number_of_answers = self.number_extraction_from_string( - self.pages.my_profile_page.get_my_profile_answers_text() + self.sumo_pages.my_profile_page.get_my_profile_answers_text() ) self.logger.info("Posting a new AAQ question") - question_info = ( - self.pages.aaq_flow.submit_valid_firefox_product_question_via_ask_now_fx_solutions() + self.sumo_pages.aaq_flow.submit_valid_firefox_prod_question_via_ask_now_fx_solutions() ) self.logger.info("Posting a reply for the question") - question_test_data = super().question_test_data reply_text = question_test_data["non_solution_reply"] - self.pages.question_page.add_text_to_post_a_reply_textarea(reply_text) + self.sumo_pages.question_page.add_text_to_post_a_reply_textarea(reply_text) self.logger.info("Clicking on the 'Post Reply' button and extracting answer id from url") - - answer_id = self.pages.question_page.click_on_post_reply_button( + answer_id = self.sumo_pages.question_page.click_on_post_reply_button( repliant_username=repliant_user ) self.logger.info("Accessing the 'My profile' page by clicking on the replient username") - - self.pages.question_page.click_on_the_reply_author(answer_id) + self.sumo_pages.question_page.click_on_the_reply_author(answer_id) self.logger.info("Verify that my number of profile answers has incremented successfully") new_number = self.number_extraction_from_string( - self.pages.my_profile_page.get_my_profile_answers_text() + self.sumo_pages.my_profile_page.get_my_profile_answers_text() ) assert ( self.number_extraction_from_string( - self.pages.my_profile_page.get_my_profile_answers_text() + self.sumo_pages.my_profile_page.get_my_profile_answers_text() ) == original_number_of_answers + 1 ), ( @@ -247,69 +209,58 @@ def test_number_of_my_profile_answers_is_successfully_displayed(self): f"{new_number}" ) - self.pages.my_profile_page.click_my_profile_answers_link() - + self.sumo_pages.my_profile_page.click_my_profile_answers_link() self.logger.info( "Verify that my answer is successfully displayed inside the profile answers list" ) - assert reply_text == self.pages.my_answers_page.get_my_answer_text( + assert reply_text == self.sumo_pages.my_answers_page.get_my_answer_text( answer_id=answer_id ), "My question reply is not displayed inside the my profile answers list" self.logger.info("Deleting the my posted question") + self.navigate_to_link(question_info["question_page_url"]) - self.pages.my_answers_page.navigate_to(question_info["question_page_url"]) + self.sumo_pages.question_page.click_delete_this_question_question_tools_option() - self.pages.question_page.click_delete_this_question_question_tools_option() - - self.pages.question_page.click_delete_this_question_button() + self.sumo_pages.question_page.click_delete_this_question_button() self.logger.info("Verifying that we are on the product support forum page after deletion") - - assert ( - self.pages.product_support_page.is_product_product_title_displayed() - ), "The product support forum page is not displayed!" + expect( + self.sumo_pages.product_support_page.product_product_title_element() + ).to_be_visible() # C2094285, C2094284 @pytest.mark.userProfile def test_number_of_posted_articles_is_successfully_displayed(self): self.logger.info("Logging in with an moderator account") - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_MODERATOR"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"] + )) self.logger.info("Accessing the View Profile page") - - self.pages.top_navbar.click_on_view_profile_option() + self.sumo_pages.top_navbar.click_on_view_profile_option() self.logger.info("Extracting the number of posted documents") - original_number_of_documents = self.number_extraction_from_string( - self.pages.my_profile_page.get_my_profile_documents_text() + self.sumo_pages.my_profile_page.get_my_profile_documents_text() ) self.logger.info("Create a new simple article") - - article_title = self.pages.submit_kb_article_flow.submit_simple_kb_article() + article_title = self.sumo_pages.submit_kb_article_flow.submit_simple_kb_article() self.logger.info("Accessing the View Profile page") - self.pages.top_navbar.click_on_view_profile_option() + self.sumo_pages.top_navbar.click_on_view_profile_option() self.logger.info("Verifying that the number of posted documents has incremented") new_number = self.number_extraction_from_string( - self.pages.my_profile_page.get_my_profile_documents_text() + self.sumo_pages.my_profile_page.get_my_profile_documents_text() ) assert ( self.number_extraction_from_string( - self.pages.my_profile_page.get_my_profile_documents_text() + self.sumo_pages.my_profile_page.get_my_profile_documents_text() ) == original_number_of_documents + 1 ), ( @@ -320,31 +271,27 @@ def test_number_of_posted_articles_is_successfully_displayed(self): ) self.logger.info("Click on the my posted documents link") - - self.pages.my_profile_page.click_on_my_profile_document_link() + self.sumo_pages.my_profile_page.click_on_my_profile_document_link() self.logger.info( "Verifying that the posted document is listed inside the my profile documents list" ) - assert ( - article_title in self.pages.my_documents_page.get_text_of_document_links() + article_title in self.sumo_pages.my_documents_page.get_text_of_document_links() ), f"The {article_title} is not listed inside the my posted documents list" self.logger.info( "Verifying that clicking on the posted article title redirects the " "user to that article" ) - - self.pages.my_documents_page.click_on_a_particular_document(article_title) + self.sumo_pages.my_documents_page.click_on_a_particular_document(article_title) self.logger.info("Deleting the created article") + self.sumo_pages.kb_article_page.click_on_show_history_option() - self.pages.kb_article_page.click_on_show_history_option() - - self.pages.kb_article_show_history_page.click_on_delete_this_document_button() + self.sumo_pages.kb_article_show_history_page.click_on_delete_this_document_button() - self.pages.kb_article_show_history_page.click_on_confirmation_delete_button() + self.sumo_pages.kb_article_show_history_page.click_on_confirmation_delete_button() # C1491023 @pytest.mark.userProfile @@ -353,51 +300,51 @@ def test_accounts_with_symbols_are_getting_a_corresponding_valid_username(self): "Signing in with an account that contains SUMO-supported and unsupported characters" ) - self.pages.top_navbar.click_on_signin_signup_button() + self.sumo_pages.top_navbar.click_on_signin_signup_button() - username = self.remove_character_from_string( - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_SPECIAL_CHARS"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ), - "*", - ) + 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, + sign_in_with_same_account=False, + ), + "*", + )) self.logger.info( "Verifying that the username contains the supported characters " "and doesn't contain the unsupported ones in top navbar" ) - - assert self.pages.top_navbar.get_text_of_logged_in_username() == username, ( + assert self.sumo_pages.top_navbar.get_text_of_logged_in_username() == username, ( f" The displayed username inside the top-navbar is incorrect. " f"The displayed username should be: {username} " - f"but instead is : {self.pages.top_navbar.get_text_of_logged_in_username()}" + f"but instead is : {self.sumo_pages.top_navbar.get_text_of_logged_in_username()}" ) self.logger.info( "Verifying that the username contains the supported characters " "and doesn't contain the unsupported ones in My Profile page" ) + self.sumo_pages.top_navbar.click_on_view_profile_option() - self.pages.top_navbar.click_on_view_profile_option() - - assert self.pages.my_profile_page.get_my_profile_display_name_header_text() == username, ( + assert (self.sumo_pages.my_profile_page.get_my_profile_display_name_header_text() + == username), ( f"The displayed username inside the my profile page is incorrect. " f"The displayed username should be: {username}" f"but instead is: " - f"{self.pages.my_profile_page.get_my_profile_display_name_header_text()}" + f"{self.sumo_pages.my_profile_page.get_my_profile_display_name_header_text()}" ) self.logger.info( "Verifying that the username contains the supported characters and " "doesn't contain the unsupported ones in Edit my Profile page" ) + self.sumo_pages.top_navbar.click_on_edit_profile_option() - self.pages.top_navbar.click_on_edit_profile_option() - - assert self.pages.edit_my_profile_page.get_username_input_field_value() == username, ( + assert self.sumo_pages.edit_my_profile_page.get_username_input_field_value() == username, ( f"The displayed username inside the Edit my Profile page is incorrect. " f"The displayed field value should be: {username}" - f"but instead is: {self.pages.edit_my_profile_page.get_username_input_field_value()}" + f"but instead is: " + f"{self.sumo_pages.edit_my_profile_page.get_username_input_field_value()}" ) diff --git a/playwright_tests/tests/user_page_tests/test_my_questions.py b/playwright_tests/tests/user_page_tests/test_my_questions.py new file mode 100644 index 00000000000..be287253898 --- /dev/null +++ b/playwright_tests/tests/user_page_tests/test_my_questions.py @@ -0,0 +1,249 @@ +import pytest + +from playwright.sync_api import expect +from playwright_tests.core.testutilities import TestUtilities +from playwright_tests.messages.my_profile_pages_messages.my_questions_page_messages import ( + MyQuestionsPageMessages) + + +class TestMyQuestions(TestUtilities): + # C2094280, C890790 + @pytest.mark.userQuestions + def test_number_of_questions_is_incremented_when_posting_a_question(self): + self.logger.info("Signing in wit a normal user account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"] + )) + + self.logger.info("Accessing the 'My profile' page via the top-navbar menu") + self.sumo_pages.top_navbar.click_on_view_profile_option() + + self.logger.info("Extracting original number of posted questions") + original_number_of_questions = self.number_extraction_from_string( + self.sumo_pages.my_profile_page.get_my_profile_questions_text() + ) + + self.logger.info("Posting a new AAQ question") + question_info = ( + self.sumo_pages.aaq_flow.submit_valid_firefox_prod_question_via_ask_now_fx_solutions() + ) + + self.logger.info("Navigating back to the My Profile page") + self.sumo_pages.top_navbar.click_on_view_profile_option() + new_number = self.number_extraction_from_string( + self.sumo_pages.my_profile_page.get_my_profile_questions_text() + ) + + assert ( + self.number_extraction_from_string( + self.sumo_pages.my_profile_page.get_my_profile_questions_text() + ) + == original_number_of_questions + 1 + ), ( + f"The number of questions should have incremented! " + f"The original number of question was: " + f"{original_number_of_questions}" + f" The new number of questions is: " + f"{new_number}" + ) + + self.logger.info("Deleting the my posted question") + self.navigate_to_link(question_info["question_page_url"]) + self.sumo_pages.question_page.click_delete_this_question_question_tools_option() + self.sumo_pages.question_page.click_delete_this_question_button() + + self.logger.info("Verifying that we are on the product support forum page after deletion") + + expect( + self.sumo_pages.product_support_page.product_product_title_element() + ).to_be_visible() + + # write tests to check my questions section as well + + # C1296000, # C890790 + @pytest.mark.userQuestions + def test_my_contributions_questions_reflects_my_questions_page_numbers(self): + self.logger.info("Signing in with a normal user account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_12"] + )) + + self.logger.info("Accessing the 'My profile' page via the top-navbar menu") + self.sumo_pages.top_navbar.click_on_view_profile_option() + + self.logger.info("Extracting the number of questions listed inside the my profile page") + + number_of_questions = self.number_extraction_from_string( + self.sumo_pages.my_profile_page.get_my_profile_questions_text() + ) + + self.logger.info("Clicking on the my profile questions link") + self.sumo_pages.my_profile_page.click_on_my_profile_questions_link() + + self.logger.info( + "Verifying that the number of questions from the" + " my profile pages matches the ones from my questions " + "page" + ) + + assert (number_of_questions + == self.sumo_pages.my_questions_page.get_number_of_questions()), ( + f"The number of questions listed inside the my profile page is:" + f" {number_of_questions} " + f"The number of questions listed inside the my questions page is:" + f" {self.sumo_pages.my_questions_page.get_number_of_questions()}" + ) + + # C890821 + @pytest.mark.userQuestions + def test_correct_messages_is_displayed_if_user_has_no_posted_questions(self): + self.logger.info("Signing in with a user which has no posted questions") + self.sumo_pages.top_navbar.click_on_signin_signup_button() + + self.sumo_pages.auth_flow_page.sign_in_flow( + username=super().user_special_chars, + account_password=super().user_secrets_pass, + sign_in_with_same_account=False + ) + + original_user = self.sumo_pages.top_navbar.get_text_of_logged_in_username() + + self.logger.info("Accessing the 'My questions' page") + self.sumo_pages.top_navbar.click_on_view_profile_option() + self.sumo_pages.user_navbar.click_on_my_questions_option() + + self.logger.info("Verifying that the correct message is displayed") + + assert ( + self.sumo_pages.my_questions_page.get_text_of_no_question_message() + == MyQuestionsPageMessages.NO_POSTED_QUESTIONS_MESSAGE + ), ( + f"Incorrect message is displayed!. " + f"Expected: {MyQuestionsPageMessages.NO_POSTED_QUESTIONS_MESSAGE} " + f"received: {self.sumo_pages.my_questions_page.get_text_of_no_question_message()}" + ) + + self.logger.info("Verifying that a question list is not displayed") + + expect( + self.sumo_pages.my_questions_page.is_question_list_displayed() + ).to_be_hidden() + + self.logger.info("Posting a new aaq question") + + question_info = ( + self.sumo_pages.aaq_flow.submit_valid_firefox_prod_question_via_ask_now_fx_solutions() + ) + + self.logger.info( + "Accessing the my questions page and verifying that the " + "no questions message is no longer displayed" + ) + + self.sumo_pages.top_navbar.click_on_view_profile_option() + self.sumo_pages.user_navbar.click_on_my_questions_option() + + expect( + self.sumo_pages.my_questions_page.is_no_question_message_displayed() + ).to_be_hidden() + + self.logger.info("Signing in with a moderator account") + self.sumo_pages.top_navbar.click_on_sign_out_button() + + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"] + )) + + self.logger.info("Deleting the my posted question") + self.navigate_to_link(question_info["question_page_url"]) + self.sumo_pages.question_page.click_delete_this_question_question_tools_option() + self.sumo_pages.question_page.click_delete_this_question_button() + + self.logger.info( + "Accessing the original user and verifying that the correct message is displayed" + ) + self.navigate_to_link( + MyQuestionsPageMessages.get_stage_my_questions_url(original_user) + ) + + assert ( + self.sumo_pages.my_questions_page.get_text_of_no_question_message() + == MyQuestionsPageMessages.get_no_posted_questions_other_user_message(original_user) + ), ( + f"Incorrect message displayed! " + f"Expected: " + f"{MyQuestionsPageMessages.get_no_posted_questions_other_user_message(original_user)} " + f"received: " + f"{self.sumo_pages.my_questions_page.get_text_of_no_question_message()}" + ) + + self.logger.info( + "Sign in with the original user an verify that the " + "correct message and the question list is no longer displayed" + ) + self.delete_cookies() + self.sumo_pages.top_navbar.click_on_signin_signup_button() + self.sumo_pages.auth_flow_page.sign_in_flow( + username=super().user_special_chars, + account_password=super().user_secrets_pass, + sign_in_with_same_account=True, + ) + + self.sumo_pages.top_navbar.click_on_view_profile_option() + self.sumo_pages.user_navbar.click_on_my_questions_option() + + assert ( + self.sumo_pages.my_questions_page.get_text_of_no_question_message() + == MyQuestionsPageMessages.NO_POSTED_QUESTIONS_MESSAGE + ), ( + f"Incorrect message displayed! " + f"Expected: {MyQuestionsPageMessages.NO_POSTED_QUESTIONS_MESSAGE} " + f"received: {self.sumo_pages.my_questions_page.get_text_of_no_question_message()}" + ) + + # C890823, C890831 + @pytest.mark.userQuestions + def test_my_question_page_reflects_posted_questions_and_redirects_to_the_correct_question( + self, + ): + self.logger.info("Signing in with a moderator user account") + self.start_existing_session(super().username_extraction_from_email( + self.user_secrets_accounts["TEST_ACCOUNT_MODERATOR"] + )) + + self.logger.info("Posting a new aaq question") + question_info = ( + self.sumo_pages.aaq_flow.submit_valid_firefox_prod_question_via_ask_now_fx_solutions() + ) + + self.logger.info( + "Verifying that the first element from the " + "My Questions page is the recently posted question" + ) + self.sumo_pages.top_navbar.click_on_my_questions_profile_option() + + assert self.sumo_pages.my_questions_page.get_text_of_first_listed_question().replace( + " ", "" + ) == question_info["aaq_subject"].replace(" ", ""), ( + f" Expected: {question_info['aaq_subject']} " + f"Received: {self.sumo_pages.my_questions_page.get_text_of_first_listed_question()}" + ) + + self.logger.info( + "Clicking on the first listed item and verifying that " + "the user is redirected to the correct question" + ) + + self.sumo_pages.my_questions_page.click_on_a_question_by_index(1) + + expect( + self.page + ).to_have_url(question_info["question_page_url"]) + + # assert self.sumo_pages.question_page.current_url() == question_info[ + # "question_page_url"], ( f"We are on the wrong page. Expected: {question_info} " + # f"received: {self.sumo_pages.question_page.current_url()}" ) + + self.logger.info("Deleting the posted question") + self.sumo_pages.question_page.click_delete_this_question_question_tools_option() + self.sumo_pages.question_page.click_delete_this_question_button() diff --git a/poetry.lock b/poetry.lock index b4de693b4ff..ea4ce93af11 100644 --- a/poetry.lock +++ b/poetry.lock @@ -136,17 +136,6 @@ six = "*" [package.extras] test = ["astroid", "pytest"] -[[package]] -name = "async-generator" -version = "1.10" -description = "Async generators and context managers for Python 3.5+" -optional = false -python-versions = ">=3.5" -files = [ - {file = "async_generator-1.10-py3-none-any.whl", hash = "sha256:01c7bf666359b4967d2cda0000cc2e4af16a0ae098cbffcb8472fb9e8ad6585b"}, - {file = "async_generator-1.10.tar.gz", hash = "sha256:6ebb3d106c12920aaae42ccb6f787ef5eefdcdd166ea3d628fa8476abe712144"}, -] - [[package]] name = "async-timeout" version = "4.0.2" @@ -1336,20 +1325,6 @@ six = "*" [package.extras] develop = ["coverage (<5.0.0)", "mock", "pytest (>=3.0.0)", "pytest-cov", "pytest-mock (<3.0.0)", "pytz", "sphinx", "sphinx-rtd-theme"] -[[package]] -name = "exceptiongroup" -version = "1.1.1" -description = "Backport of PEP 654 (exception groups)" -optional = false -python-versions = ">=3.7" -files = [ - {file = "exceptiongroup-1.1.1-py3-none-any.whl", hash = "sha256:232c37c63e4f682982c8b6459f33a8981039e5fb8756b2074364e5055c498c9e"}, - {file = "exceptiongroup-1.1.1.tar.gz", hash = "sha256:d484c3090ba2889ae2928419117447a14daf3c1231d5e30d0aae34f354f01785"}, -] - -[package.extras] -test = ["pytest (>=6)"] - [[package]] name = "execnet" version = "1.9.0" @@ -1825,69 +1800,68 @@ graphql-core = ">=3.2,<3.3" [[package]] name = "greenlet" -version = "3.0.0rc3" +version = "3.0.1" description = "Lightweight in-process concurrent programming" optional = false python-versions = ">=3.7" files = [ - {file = "greenlet-3.0.0rc3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2a2affddff9b2f846f40799673e41b29f0500582415c860fca8f146858e9de1a"}, - {file = "greenlet-3.0.0rc3-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:dd00046dfd00767fce18f9933658d126652a500caf7af9dbfbd43818e4b484c2"}, - {file = "greenlet-3.0.0rc3-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e787b00002cef3b98c7cf700fb85c2c01b0d202b1c6731706e5baa4b3325aa1e"}, - {file = "greenlet-3.0.0rc3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:38ffc7538bc66766a8b551888903d415773481c4bd13560a4fb24887222e3cc9"}, - {file = "greenlet-3.0.0rc3-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:dde5deb355b34bbf44b15789e27c56862f51f417207be49eedc58fce34681fe6"}, - {file = "greenlet-3.0.0rc3-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:1fb703a102a02361a0cc6a3d9a7958e1584fdeb536bd37ca9aca529d3356bedd"}, - {file = "greenlet-3.0.0rc3-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:f8661d14d3e07f2ceeb850e4cbcc7114bdf90a8dc82d63d37b08a50bb6955a77"}, - {file = "greenlet-3.0.0rc3-cp310-cp310-win_amd64.whl", hash = "sha256:997456b74efee91ceeb39d63818909da5dbb712a07f7742f4378986ac3473463"}, - {file = "greenlet-3.0.0rc3-cp310-universal2-macosx_11_0_x86_64.whl", hash = "sha256:d3cd3957af8cec1fcfd87d92ca71b7d434d798036e14ae878f9ab1e07d99da0d"}, - {file = "greenlet-3.0.0rc3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:895b689fc52a5bc402f8d624705110df5c265b1410ffe8e0769a66db9d2e7851"}, - {file = "greenlet-3.0.0rc3-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a84a88422b5a0360fae57ad6b3b20fc17c9462880929810b0a26ee43aa05982e"}, - {file = "greenlet-3.0.0rc3-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d79cf299ba1996d8a4f133b317e709a0a3ce87181308280e40664e12cb512c54"}, - {file = "greenlet-3.0.0rc3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ef9789aea735004eba559c7919a73a3b475d0c28e2c1e9de464c6bc761bf69f4"}, - {file = "greenlet-3.0.0rc3-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:66790e1537382e53bce64de3a695d1b12a04b00104df45f7ef472a10561936c2"}, - {file = "greenlet-3.0.0rc3-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:68349987bf2ce274953f9f9b28458869bd8770a0c5461e1ef91d8107b1bae361"}, - {file = "greenlet-3.0.0rc3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:30ffaa6c020a615c8f4be3abfc6029982fda026a3bf9a6dc7205afb033251506"}, - {file = "greenlet-3.0.0rc3-cp311-cp311-win_amd64.whl", hash = "sha256:864619b058f573058cd77f6944cf63d7f42157fe30be494798721bd8ac256d7b"}, - {file = "greenlet-3.0.0rc3-cp311-universal2-macosx_10_9_universal2.whl", hash = "sha256:7c887ecb55374d585d71ff8f9d07c137637694e88fa2b5d5b1450a05ece62ae9"}, - {file = "greenlet-3.0.0rc3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:686821157368c1c4ef53aa68e6801280010da92ab0e4265dad37003341fca6a1"}, - {file = "greenlet-3.0.0rc3-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:242d56d2d5f6859f0f086ce62555a2c692c8053c89721d41fead5e1e8dffdb36"}, - {file = "greenlet-3.0.0rc3-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:81d653ae6c64b85ce4c7bccbea7b630de8799da751b73e55b4c68875b6eb19d6"}, - {file = "greenlet-3.0.0rc3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:beeb5cfbd8f3792c37db4e3c5665aa750d78bbdabe758161a34e7dfe27075e69"}, - {file = "greenlet-3.0.0rc3-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:30daee988fc83078b016fa95a7a1f78a7c86534a44238748b9748675814eb1dc"}, - {file = "greenlet-3.0.0rc3-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:977898b8c24159467c66ed1a8f62aacd33f3d85f852cf413d0d2e2a87a6b3091"}, - {file = "greenlet-3.0.0rc3-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:097a2f75c79c3fa76fea2e5d48a637233722fe72a5ebb1213c55f0a0898f481c"}, - {file = "greenlet-3.0.0rc3-cp312-cp312-win_amd64.whl", hash = "sha256:5770d43b08dfa10f4460c1bd51f8c80e6f2c47611054e9fb80d4d7976d07e560"}, - {file = "greenlet-3.0.0rc3-cp312-universal2-macosx_10_9_universal2.whl", hash = "sha256:f33e7ff85775cb0ec6abb0950ffc631960bae5a203da38166fc3dfde826e0d0a"}, - {file = "greenlet-3.0.0rc3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:07f6d1ce31a1db5102a42b4afa609af330edfd8a81d10faba3e47ae33a07cbdf"}, - {file = "greenlet-3.0.0rc3-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:86e651fa59263f7ff1d4657b086c48cfe7e26db2a36e2d74069f3b5aeab478e6"}, - {file = "greenlet-3.0.0rc3-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:ef7c6e49a9a020d56349c6a769352709bfbe35d3ee7f98bd5efcac6cedbdc162"}, - {file = "greenlet-3.0.0rc3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5585bf8d1d2d3712010ee74988c2ed85c54b127b97f2778fbdcc5b3ea8e801a2"}, - {file = "greenlet-3.0.0rc3-cp37-cp37m-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c706041cd92e1b9d2b602eaa31e94aad14453bdbf186ce77530f25167c173a0e"}, - {file = "greenlet-3.0.0rc3-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:37213e72058d2e6231d18417adc63c698c040fbb47dc59a3fd633973214ab1ab"}, - {file = "greenlet-3.0.0rc3-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:95bc6ec8dd73f8f36e9dfc61a7fa5a2819d1cd52d0bfdb70a43434d6b2aeb239"}, - {file = "greenlet-3.0.0rc3-cp37-cp37m-win32.whl", hash = "sha256:e83c4c7a0814dcfd7e2fe4b74a371f3ce489b62ff02e81d0c5cacc8ba4750395"}, - {file = "greenlet-3.0.0rc3-cp37-cp37m-win_amd64.whl", hash = "sha256:4c35608918f331256be199d3712552fa8a1d12f87ac171a86a31488c60d298f5"}, - {file = "greenlet-3.0.0rc3-cp37-universal2-macosx_11_0_x86_64.whl", hash = "sha256:215bdb33e85fd89fe55f9984dc6f0a96b5774bace663e1a6d051e65d66170ef8"}, - {file = "greenlet-3.0.0rc3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:69db00f775ed9d233f53ef67c66ea40a7add0c0929eb528f633982e27595dd37"}, - {file = "greenlet-3.0.0rc3-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:5fcc7162944c2fedfb2253ca2171267e016a3b065c73369d0d4a27f601e7f162"}, - {file = "greenlet-3.0.0rc3-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3c0082d7b83312c59127811367089f812f8f1386fad7e8cf321fd732b4a6ace6"}, - {file = "greenlet-3.0.0rc3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:66f1131c17dba115ea7cb3b257b6751b3c4cfd324f2121447e2483f57abbbf3c"}, - {file = "greenlet-3.0.0rc3-cp38-cp38-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:f0c5508582339090b99e2863a157fc2708ab9c8b5cd21619bdcb04edcdc6c28d"}, - {file = "greenlet-3.0.0rc3-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:f1c9ad8d6500f7b142a94054281d9628bc8652a14b0923d02e0dfd87392fbc74"}, - {file = "greenlet-3.0.0rc3-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:bd586284bbf18ca3068e1fcc67ef54538e1bb74cb605ebdac9e62048237839f5"}, - {file = "greenlet-3.0.0rc3-cp38-cp38-win32.whl", hash = "sha256:1c16f1bbaf9c75dfac3e52bb778d2fd6099fd5aa59fafa678eca5853eedd99ec"}, - {file = "greenlet-3.0.0rc3-cp38-cp38-win_amd64.whl", hash = "sha256:e388ceb55b8f3f388afea4d4a17a64b619040f0e8e9fa3e17e7c34f4d0fbe103"}, - {file = "greenlet-3.0.0rc3-cp38-universal2-macosx_11_0_x86_64.whl", hash = "sha256:68bd35ad9f99df0ef18836fd0fb34278dca6b3350bdcf1e8809822fc4f57a82e"}, - {file = "greenlet-3.0.0rc3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:256b748fc1e6c97012f217e0a403116cb0dd369bf1cff51c07a9c52899d4a8a8"}, - {file = "greenlet-3.0.0rc3-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:4936e6e051932848c4b237a874da8dbb47bfbb5ae5104497fb78c4f4cf184989"}, - {file = "greenlet-3.0.0rc3-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a31b3a4bd10c540a7eb7d4b43d16779813ca4c79b615ed6d4ebf0e5a782d9fa0"}, - {file = "greenlet-3.0.0rc3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b6f8253fdb00e74b928ab5d04f88ddbc8beb0cc26aa978bb4a12c1513166d481"}, - {file = "greenlet-3.0.0rc3-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:2a7831d04a0f8a14645c010e3fb3fa36b8d2df304dd837948427ccfec2524ddf"}, - {file = "greenlet-3.0.0rc3-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:ae84d2f2658990f29df4ea753061b25c337bd70f805128af328098e5b8afc454"}, - {file = "greenlet-3.0.0rc3-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:cd51cc2528a2985f3bc0564c1b1ce5b2e6fa4ee9924503010428256fa95b0e3c"}, - {file = "greenlet-3.0.0rc3-cp39-cp39-win32.whl", hash = "sha256:e8698f341e78dd0f149511929e92d1507cc26647f047db13987169d244db10fb"}, - {file = "greenlet-3.0.0rc3-cp39-cp39-win_amd64.whl", hash = "sha256:f059457db4e2ae4a4fdae455453c5e5765aa08efcb804e2a106c69c31bd438ba"}, - {file = "greenlet-3.0.0rc3-cp39-universal2-macosx_11_0_x86_64.whl", hash = "sha256:c80cac2776df3dd08f27b7338f467a62ee6cb29668a8f4f408b8da1f981aae9e"}, - {file = "greenlet-3.0.0rc3.tar.gz", hash = "sha256:0df5c2ad154f457fd372e39723493b3df519330a4c1bff3ca901be66130f379b"}, + {file = "greenlet-3.0.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:f89e21afe925fcfa655965ca8ea10f24773a1791400989ff32f467badfe4a064"}, + {file = "greenlet-3.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:28e89e232c7593d33cac35425b58950789962011cc274aa43ef8865f2e11f46d"}, + {file = "greenlet-3.0.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b8ba29306c5de7717b5761b9ea74f9c72b9e2b834e24aa984da99cbfc70157fd"}, + {file = "greenlet-3.0.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:19bbdf1cce0346ef7341705d71e2ecf6f41a35c311137f29b8a2dc2341374565"}, + {file = "greenlet-3.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:599daf06ea59bfedbec564b1692b0166a0045f32b6f0933b0dd4df59a854caf2"}, + {file = "greenlet-3.0.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b641161c302efbb860ae6b081f406839a8b7d5573f20a455539823802c655f63"}, + {file = "greenlet-3.0.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:d57e20ba591727da0c230ab2c3f200ac9d6d333860d85348816e1dca4cc4792e"}, + {file = "greenlet-3.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:5805e71e5b570d490938d55552f5a9e10f477c19400c38bf1d5190d760691846"}, + {file = "greenlet-3.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:52e93b28db27ae7d208748f45d2db8a7b6a380e0d703f099c949d0f0d80b70e9"}, + {file = "greenlet-3.0.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:f7bfb769f7efa0eefcd039dd19d843a4fbfbac52f1878b1da2ed5793ec9b1a65"}, + {file = "greenlet-3.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:91e6c7db42638dc45cf2e13c73be16bf83179f7859b07cfc139518941320be96"}, + {file = "greenlet-3.0.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1757936efea16e3f03db20efd0cd50a1c86b06734f9f7338a90c4ba85ec2ad5a"}, + {file = "greenlet-3.0.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:19075157a10055759066854a973b3d1325d964d498a805bb68a1f9af4aaef8ec"}, + {file = "greenlet-3.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e9d21aaa84557d64209af04ff48e0ad5e28c5cca67ce43444e939579d085da72"}, + {file = "greenlet-3.0.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:2847e5d7beedb8d614186962c3d774d40d3374d580d2cbdab7f184580a39d234"}, + {file = "greenlet-3.0.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:97e7ac860d64e2dcba5c5944cfc8fa9ea185cd84061c623536154d5a89237884"}, + {file = "greenlet-3.0.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:b2c02d2ad98116e914d4f3155ffc905fd0c025d901ead3f6ed07385e19122c94"}, + {file = "greenlet-3.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:22f79120a24aeeae2b4471c711dcf4f8c736a2bb2fabad2a67ac9a55ea72523c"}, + {file = "greenlet-3.0.1-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:100f78a29707ca1525ea47388cec8a049405147719f47ebf3895e7509c6446aa"}, + {file = "greenlet-3.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:60d5772e8195f4e9ebf74046a9121bbb90090f6550f81d8956a05387ba139353"}, + {file = "greenlet-3.0.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:daa7197b43c707462f06d2c693ffdbb5991cbb8b80b5b984007de431493a319c"}, + {file = "greenlet-3.0.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:ea6b8aa9e08eea388c5f7a276fabb1d4b6b9d6e4ceb12cc477c3d352001768a9"}, + {file = "greenlet-3.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8d11ebbd679e927593978aa44c10fc2092bc454b7d13fdc958d3e9d508aba7d0"}, + {file = "greenlet-3.0.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:dbd4c177afb8a8d9ba348d925b0b67246147af806f0b104af4d24f144d461cd5"}, + {file = "greenlet-3.0.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:20107edf7c2c3644c67c12205dc60b1bb11d26b2610b276f97d666110d1b511d"}, + {file = "greenlet-3.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8bef097455dea90ffe855286926ae02d8faa335ed8e4067326257cb571fc1445"}, + {file = "greenlet-3.0.1-cp312-cp312-win_amd64.whl", hash = "sha256:b2d3337dcfaa99698aa2377c81c9ca72fcd89c07e7eb62ece3f23a3fe89b2ce4"}, + {file = "greenlet-3.0.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:80ac992f25d10aaebe1ee15df45ca0d7571d0f70b645c08ec68733fb7a020206"}, + {file = "greenlet-3.0.1-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:337322096d92808f76ad26061a8f5fccb22b0809bea39212cd6c406f6a7060d2"}, + {file = "greenlet-3.0.1-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b9934adbd0f6e476f0ecff3c94626529f344f57b38c9a541f87098710b18af0a"}, + {file = "greenlet-3.0.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dc4d815b794fd8868c4d67602692c21bf5293a75e4b607bb92a11e821e2b859a"}, + {file = "greenlet-3.0.1-cp37-cp37m-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:41bdeeb552d814bcd7fb52172b304898a35818107cc8778b5101423c9017b3de"}, + {file = "greenlet-3.0.1-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:6e6061bf1e9565c29002e3c601cf68569c450be7fc3f7336671af7ddb4657166"}, + {file = "greenlet-3.0.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:fa24255ae3c0ab67e613556375a4341af04a084bd58764731972bcbc8baeba36"}, + {file = "greenlet-3.0.1-cp37-cp37m-win32.whl", hash = "sha256:b489c36d1327868d207002391f662a1d163bdc8daf10ab2e5f6e41b9b96de3b1"}, + {file = "greenlet-3.0.1-cp37-cp37m-win_amd64.whl", hash = "sha256:f33f3258aae89da191c6ebaa3bc517c6c4cbc9b9f689e5d8452f7aedbb913fa8"}, + {file = "greenlet-3.0.1-cp38-cp38-macosx_11_0_universal2.whl", hash = "sha256:d2905ce1df400360463c772b55d8e2518d0e488a87cdea13dd2c71dcb2a1fa16"}, + {file = "greenlet-3.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0a02d259510b3630f330c86557331a3b0e0c79dac3d166e449a39363beaae174"}, + {file = "greenlet-3.0.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:55d62807f1c5a1682075c62436702aaba941daa316e9161e4b6ccebbbf38bda3"}, + {file = "greenlet-3.0.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3fcc780ae8edbb1d050d920ab44790201f027d59fdbd21362340a85c79066a74"}, + {file = "greenlet-3.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4eddd98afc726f8aee1948858aed9e6feeb1758889dfd869072d4465973f6bfd"}, + {file = "greenlet-3.0.1-cp38-cp38-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:eabe7090db68c981fca689299c2d116400b553f4b713266b130cfc9e2aa9c5a9"}, + {file = "greenlet-3.0.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:f2f6d303f3dee132b322a14cd8765287b8f86cdc10d2cb6a6fae234ea488888e"}, + {file = "greenlet-3.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:d923ff276f1c1f9680d32832f8d6c040fe9306cbfb5d161b0911e9634be9ef0a"}, + {file = "greenlet-3.0.1-cp38-cp38-win32.whl", hash = "sha256:0b6f9f8ca7093fd4433472fd99b5650f8a26dcd8ba410e14094c1e44cd3ceddd"}, + {file = "greenlet-3.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:990066bff27c4fcf3b69382b86f4c99b3652bab2a7e685d968cd4d0cfc6f67c6"}, + {file = "greenlet-3.0.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:ce85c43ae54845272f6f9cd8320d034d7a946e9773c693b27d620edec825e376"}, + {file = "greenlet-3.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:89ee2e967bd7ff85d84a2de09df10e021c9b38c7d91dead95b406ed6350c6997"}, + {file = "greenlet-3.0.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:87c8ceb0cf8a5a51b8008b643844b7f4a8264a2c13fcbcd8a8316161725383fe"}, + {file = "greenlet-3.0.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d6a8c9d4f8692917a3dc7eb25a6fb337bff86909febe2f793ec1928cd97bedfc"}, + {file = "greenlet-3.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9fbc5b8f3dfe24784cee8ce0be3da2d8a79e46a276593db6868382d9c50d97b1"}, + {file = "greenlet-3.0.1-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:85d2b77e7c9382f004b41d9c72c85537fac834fb141b0296942d52bf03fe4a3d"}, + {file = "greenlet-3.0.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:696d8e7d82398e810f2b3622b24e87906763b6ebfd90e361e88eb85b0e554dc8"}, + {file = "greenlet-3.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:329c5a2e5a0ee942f2992c5e3ff40be03e75f745f48847f118a3cfece7a28546"}, + {file = "greenlet-3.0.1-cp39-cp39-win32.whl", hash = "sha256:cf868e08690cb89360eebc73ba4be7fb461cfbc6168dd88e2fbbe6f31812cd57"}, + {file = "greenlet-3.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:ac4a39d1abae48184d420aa8e5e63efd1b75c8444dd95daa3e03f6c6310e9619"}, + {file = "greenlet-3.0.1.tar.gz", hash = "sha256:816bd9488a94cba78d93e1abb58000e8266fa9cc2aa9ccdd6eb0696acb24005b"}, ] [package.extras] @@ -1914,17 +1888,6 @@ gevent = ["gevent (>=1.4.0)"] setproctitle = ["setproctitle"] tornado = ["tornado (>=0.2)"] -[[package]] -name = "h11" -version = "0.14.0" -description = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1" -optional = false -python-versions = ">=3.7" -files = [ - {file = "h11-0.14.0-py3-none-any.whl", hash = "sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761"}, - {file = "h11-0.14.0.tar.gz", hash = "sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d"}, -] - [[package]] name = "html5lib" version = "1.1" @@ -2597,20 +2560,6 @@ rsa = ["cryptography (>=3.0.0)"] signals = ["blinker (>=1.4.0)"] signedtoken = ["cryptography (>=3.0.0)", "pyjwt (>=2.0.0,<3)"] -[[package]] -name = "outcome" -version = "1.2.0" -description = "Capture the outcome of Python function calls." -optional = false -python-versions = ">=3.7" -files = [ - {file = "outcome-1.2.0-py2.py3-none-any.whl", hash = "sha256:c4ab89a56575d6d38a05aa16daeaa333109c1f96167aba8901ab18b6b5e0f7f5"}, - {file = "outcome-1.2.0.tar.gz", hash = "sha256:6f82bd3de45da303cf1f771ecafa1633750a358436a8bb60e06a1ceb745d2672"}, -] - -[package.dependencies] -attrs = ">=19.2.0" - [[package]] name = "packaging" version = "23.0" @@ -2813,6 +2762,26 @@ files = [ docs = ["furo (>=2022.12.7)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.22,!=1.23.4)"] test = ["appdirs (==1.4.4)", "covdefaults (>=2.2.2)", "pytest (>=7.2.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] +[[package]] +name = "playwright" +version = "1.40.0" +description = "A high-level API to automate web browsers" +optional = false +python-versions = ">=3.8" +files = [ + {file = "playwright-1.40.0-py3-none-macosx_10_13_x86_64.whl", hash = "sha256:35b7e0b389df2aa632f3614d35be7bace35f6f634d880db44b035c83e4481312"}, + {file = "playwright-1.40.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:382a7465cc0ea3bf7fa66716bd37fd53f66af4bcc5c72283a8eff3f6e87758a8"}, + {file = "playwright-1.40.0-py3-none-macosx_11_0_universal2.whl", hash = "sha256:f11e1ec32f3b3dbd7f24d1481c313cb527001955004ee88a73f9b4a610d0db28"}, + {file = "playwright-1.40.0-py3-none-manylinux1_x86_64.whl", hash = "sha256:6a842dca4dd53feda1d7bd0e14aa65140e4e816452ebddd307e90cad184d92bd"}, + {file = "playwright-1.40.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4ec3746de69e7ba912b70e0fe3a3c6b8af97f21ece793c5db27c251da4d2f3e6"}, + {file = "playwright-1.40.0-py3-none-win32.whl", hash = "sha256:3ae90ea5ad776fe5e1300a9c730244c8e57a183c6eb261044418710d51ae03c0"}, + {file = "playwright-1.40.0-py3-none-win_amd64.whl", hash = "sha256:ba5a89953aedb158025e4581eafb6fdeebb3d58acd9ce24b59f691b1e2a861bc"}, +] + +[package.dependencies] +greenlet = "3.0.1" +pyee = "11.0.1" + [[package]] name = "pluggy" version = "1.0.0" @@ -3049,6 +3018,23 @@ files = [ {file = "pycparser-2.21.tar.gz", hash = "sha256:e644fdec12f7872f86c58ff790da456218b10f863970249516d60a5eaca77206"}, ] +[[package]] +name = "pyee" +version = "11.0.1" +description = "A rough port of Node.js's EventEmitter to Python with a few tricks of its own" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pyee-11.0.1-py3-none-any.whl", hash = "sha256:9bcc9647822234f42c228d88de63d0f9ffa881e87a87f9d36ddf5211f6ac977d"}, + {file = "pyee-11.0.1.tar.gz", hash = "sha256:a642c51e3885a33ead087286e35212783a4e9b8d6514a10a5db4e57ac57b2b29"}, +] + +[package.dependencies] +typing-extensions = "*" + +[package.extras] +dev = ["black", "flake8", "flake8-black", "isort", "jupyter-console", "mkdocs", "mkdocs-include-markdown-plugin", "mkdocstrings[python]", "pytest", "pytest-asyncio", "pytest-trio", "toml", "tox", "trio", "trio", "trio-typing", "twine", "twisted", "validate-pyproject[all]"] + [[package]] name = "pyflakes" version = "3.0.1" @@ -3236,18 +3222,6 @@ files = [ {file = "pyrsistent-0.19.3.tar.gz", hash = "sha256:1a2994773706bbb4995c31a97bc94f1418314923bd1048c6d964837040376440"}, ] -[[package]] -name = "pysocks" -version = "1.7.1" -description = "A Python SOCKS client module. See https://github.com/Anorov/PySocks for more information." -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -files = [ - {file = "PySocks-1.7.1-py27-none-any.whl", hash = "sha256:08e69f092cc6dbe92a0fdd16eeb9b9ffbc13cadfe5ca4c7bd92ffb078b293299"}, - {file = "PySocks-1.7.1-py3-none-any.whl", hash = "sha256:2725bd0a9925919b9b51739eea5f9e2bae91e83288108a9ad338b2e3a4435ee5"}, - {file = "PySocks-1.7.1.tar.gz", hash = "sha256:3f8804571ebe159c380ac6de37643bb4685970655d3bba243530d6558b799aa0"}, -] - [[package]] name = "pytest" version = "7.3.1" @@ -3372,20 +3346,6 @@ files = [ {file = "python_decouple-3.7-py3-none-any.whl", hash = "sha256:1596dad2670cca5b1f87d087d9adb6a1958c590df346b85d4b19a9d6f0d52cef"}, ] -[[package]] -name = "python-dotenv" -version = "1.0.0" -description = "Read key-value pairs from a .env file and set them as environment variables" -optional = false -python-versions = ">=3.8" -files = [ - {file = "python-dotenv-1.0.0.tar.gz", hash = "sha256:a8df96034aae6d2d50a4ebe8216326c61c3eb64836776504fcca410e5937a3ba"}, - {file = "python_dotenv-1.0.0-py3-none-any.whl", hash = "sha256:f5971a9226b701070a4bf2c38c89e5a3f0d64de8debda981d1db98583009122a"}, -] - -[package.extras] -cli = ["click (>=5.0)"] - [[package]] name = "python-memcached" version = "1.59" @@ -3762,23 +3722,6 @@ botocore = ">=1.12.36,<2.0a.0" [package.extras] crt = ["botocore[crt] (>=1.20.29,<2.0a.0)"] -[[package]] -name = "selenium" -version = "4.8.3" -description = "" -optional = false -python-versions = ">=3.7" -files = [ - {file = "selenium-4.8.3-py3-none-any.whl", hash = "sha256:28430ac54a54fa59ad1f5392a1b89b169fe3ab2c2ccd1a9a10b6fe74f36cd6da"}, - {file = "selenium-4.8.3.tar.gz", hash = "sha256:61cda3a304f82637162bc155cae7bf88fdb04c115fa2cb1c1c2e1358fcd19a9f"}, -] - -[package.dependencies] -certifi = ">=2021.10.8" -trio = ">=0.17,<1.0" -trio-websocket = ">=0.9,<1.0" -urllib3 = {version = ">=1.26,<2.0", extras = ["socks"]} - [[package]] name = "sentry-sdk" version = "1.32.0" @@ -3933,17 +3876,6 @@ files = [ {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, ] -[[package]] -name = "sniffio" -version = "1.3.0" -description = "Sniff out which async library your code is running under" -optional = false -python-versions = ">=3.7" -files = [ - {file = "sniffio-1.3.0-py3-none-any.whl", hash = "sha256:eecefdce1e5bbfb7ad2eeaabf7c1eeb404d7757c379bd1f7e5cce9d8bf425384"}, - {file = "sniffio-1.3.0.tar.gz", hash = "sha256:e60305c5e5d314f5389259b7f22aaa33d8f7dee49763119234af3755c55b9101"}, -] - [[package]] name = "snowballstemmer" version = "2.2.0" @@ -3955,17 +3887,6 @@ files = [ {file = "snowballstemmer-2.2.0.tar.gz", hash = "sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1"}, ] -[[package]] -name = "sortedcontainers" -version = "2.4.0" -description = "Sorted Containers -- Sorted List, Sorted Dict, Sorted Set" -optional = false -python-versions = "*" -files = [ - {file = "sortedcontainers-2.4.0-py2.py3-none-any.whl", hash = "sha256:a163dcaede0f1c021485e957a39245190e74249897e2ae4b2aa38595db237ee0"}, - {file = "sortedcontainers-2.4.0.tar.gz", hash = "sha256:25caa5a06cc30b6b83d11423433f65d1f9d76c4c6a0c90e3379eaa43b9bfdb88"}, -] - [[package]] name = "sphinx" version = "5.3.0" @@ -4252,26 +4173,6 @@ files = [ {file = "tomlkit-0.11.6.tar.gz", hash = "sha256:71b952e5721688937fb02cf9d354dbcf0785066149d2855e44531ebdd2b65d73"}, ] -[[package]] -name = "tqdm" -version = "4.65.0" -description = "Fast, Extensible Progress Meter" -optional = false -python-versions = ">=3.7" -files = [ - {file = "tqdm-4.65.0-py3-none-any.whl", hash = "sha256:c4f53a17fe37e132815abceec022631be8ffe1b9381c2e6e30aa70edc99e9671"}, - {file = "tqdm-4.65.0.tar.gz", hash = "sha256:1871fb68a86b8fb3b59ca4cdd3dcccbc7e6d613eeed31f4c332531977b89beb5"}, -] - -[package.dependencies] -colorama = {version = "*", markers = "platform_system == \"Windows\""} - -[package.extras] -dev = ["py-make (>=0.1.0)", "twine", "wheel"] -notebook = ["ipywidgets (>=6)"] -slack = ["slack-sdk"] -telegram = ["requests"] - [[package]] name = "traitlets" version = "5.9.0" @@ -4317,42 +4218,6 @@ tmserver = ["cheroot (==9.0.0)"] trados = ["BeautifulSoup4 (>=4.3)"] yaml = ["ruamel.yaml (==0.17.21)"] -[[package]] -name = "trio" -version = "0.22.0" -description = "A friendly Python library for async concurrency and I/O" -optional = false -python-versions = ">=3.7" -files = [ - {file = "trio-0.22.0-py3-none-any.whl", hash = "sha256:f1dd0780a89bfc880c7c7994519cb53f62aacb2c25ff487001c0052bd721cdf0"}, - {file = "trio-0.22.0.tar.gz", hash = "sha256:ce68f1c5400a47b137c5a4de72c7c901bd4e7a24fbdebfe9b41de8c6c04eaacf"}, -] - -[package.dependencies] -async-generator = ">=1.9" -attrs = ">=19.2.0" -cffi = {version = ">=1.14", markers = "os_name == \"nt\" and implementation_name != \"pypy\""} -idna = "*" -outcome = "*" -sniffio = "*" -sortedcontainers = "*" - -[[package]] -name = "trio-websocket" -version = "0.10.2" -description = "WebSocket library for Trio" -optional = false -python-versions = ">=3.7" -files = [ - {file = "trio-websocket-0.10.2.tar.gz", hash = "sha256:af13e9393f9051111300287947ec595d601758ce3d165328e7d36325135a8d62"}, - {file = "trio_websocket-0.10.2-py3-none-any.whl", hash = "sha256:0908435e4eecc49d830ae1c4d6c47b978a75f00594a2be2104d58b61a04cdb53"}, -] - -[package.dependencies] -exceptiongroup = "*" -trio = ">=0.11" -wsproto = ">=0.14" - [[package]] name = "twython" version = "3.9.1" @@ -4368,6 +4233,17 @@ files = [ requests = ">=2.1.0" requests-oauthlib = ">=0.4.0" +[[package]] +name = "typing-extensions" +version = "4.8.0" +description = "Backported and Experimental Type Hints for Python 3.8+" +optional = false +python-versions = ">=3.8" +files = [ + {file = "typing_extensions-4.8.0-py3-none-any.whl", hash = "sha256:8f92fc8806f9a6b641eaa5318da32b44d401efaac0f6678c9bc448ba3605faa0"}, + {file = "typing_extensions-4.8.0.tar.gz", hash = "sha256:df8e4339e9cb77357558cbdbceca33c303714cf861d1eef15e1070055ae8b7ef"}, +] + [[package]] name = "tzdata" version = "2022.7" @@ -4442,9 +4318,6 @@ files = [ {file = "urllib3-1.26.18.tar.gz", hash = "sha256:f8ecc1bba5667413457c529ab955bf8c67b45db799d159066261719e328580a0"}, ] -[package.dependencies] -PySocks = {version = ">=1.5.6,<1.5.7 || >1.5.7,<2.0", optional = true, markers = "extra == \"socks\""} - [package.extras] brotli = ["brotli (==1.0.9)", "brotli (>=1.0.9)", "brotlicffi (>=0.8.0)", "brotlipy (>=0.6.0)"] secure = ["certifi", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "ipaddress", "pyOpenSSL (>=0.14)", "urllib3-secure-extra"] @@ -4556,23 +4429,6 @@ files = [ {file = "wcwidth-0.2.6.tar.gz", hash = "sha256:a5220780a404dbe3353789870978e472cfe477761f06ee55077256e509b156d0"}, ] -[[package]] -name = "webdriver-manager" -version = "3.8.6" -description = "Library provides the way to automatically manage drivers for different browsers" -optional = false -python-versions = ">=3.7" -files = [ - {file = "webdriver_manager-3.8.6-py2.py3-none-any.whl", hash = "sha256:7d3aa8d67bd6c92a5d25f4abd75eea2c6dd24ea6617bff986f502280903a0e2b"}, - {file = "webdriver_manager-3.8.6.tar.gz", hash = "sha256:ee788d389b8f45222a8a62f6f39b579360a1f87be46dad6da89918354af3ce73"}, -] - -[package.dependencies] -packaging = "*" -python-dotenv = "*" -requests = "*" -tqdm = "*" - [[package]] name = "webencodings" version = "0.5.1" @@ -4704,20 +4560,6 @@ files = [ {file = "wrapt-1.14.1.tar.gz", hash = "sha256:380a85cf89e0e69b7cfbe2ea9f765f004ff419f34194018a6827ac0e3edfed4d"}, ] -[[package]] -name = "wsproto" -version = "1.2.0" -description = "WebSockets state-machine based protocol implementation" -optional = false -python-versions = ">=3.7.0" -files = [ - {file = "wsproto-1.2.0-py3-none-any.whl", hash = "sha256:b9acddd652b585d75b20477888c56642fdade28bdfd3579aa24a4d2c037dd736"}, - {file = "wsproto-1.2.0.tar.gz", hash = "sha256:ad565f26ecb92588a3e43bc3d96164de84cd9902482b130d0ddbaa9664a85065"}, -] - -[package.dependencies] -h11 = ">=0.9.0,<1" - [[package]] name = "zenpy" version = "2.0.25" @@ -4809,4 +4651,4 @@ testing = ["coverage (>=5.0.3)", "zope.event", "zope.testing"] [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "6f812dc9cbe2a4ced4a4e856334e163eb34de1d7adae37da09f3312ab0424571" +content-hash = "c73806b7d17016edfc3bbb6312b3e8b1a07219129eeb8524a0ab91f6998cdace" diff --git a/pyproject.toml b/pyproject.toml index 1117a364b7b..fd55bf14334 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -114,13 +114,12 @@ pylint-django = "^2.5.3" rope = "^1.7.0" black = "^23.1.0" pytest = "^7.3.1" -selenium = "^4.8.3" -webdriver-manager = "^3.8.6" pytest-html = "^3.2.0" pytest-xdist = "^3.2.1" docker = "^6.0.1" pytest-rerunfailures = "^12.0" pytest-check = "^2.2.1" +playwright = "^1.40.0" [build-system] requires = ["poetry-core>=1.0.0"] diff --git a/selenium_tests/core/base_page.py b/selenium_tests/core/base_page.py deleted file mode 100644 index c89c13ba4fa..00000000000 --- a/selenium_tests/core/base_page.py +++ /dev/null @@ -1,186 +0,0 @@ -from selenium.common import NoSuchElementException, TimeoutException -from selenium.webdriver import ActionChains, Keys -from selenium.webdriver.support.ui import Select -from selenium.webdriver.remote.webdriver import WebDriver -from selenium.webdriver.remote.webelement import WebElement -from selenium.webdriver.support.wait import WebDriverWait -from selenium.webdriver.support import expected_conditions as ec - - -# Abstract all common actions into this central location. - - -class BasePage: - def __init__(self, driver: WebDriver): - self._driver = driver - - def current_url(self) -> str: - return self._driver.current_url - - def navigate_back(self): - self._driver.back() - - def navigate_forward(self): - self._driver.forward() - - def navigate_to(self, link): - self._driver.get(link) - - def _find_element(self, locator: tuple) -> WebElement: - self.__wait_until_element_is_visible(locator) - return self._driver.find_element(*locator) - - def _find_elements(self, locator: tuple) -> list[WebElement]: - self.__wait_until_element_is_visible(locator) - return self._driver.find_elements(*locator) - - def _type(self, locator: tuple, text: str): - self._find_element(locator).send_keys(text) - - def _upload_jpg_image(self, locator: tuple, path_to_image: str): - self._find_element(locator).send_keys(path_to_image) - - def _clear_input_field(self, locator: tuple): - self._find_element(locator).clear() - - def _click(self, locator: tuple): - self._find_element(locator).click() - - def _click_on_web_element(self, web_element: WebElement): - web_element.click() - - def _get_text_of_element(self, locator: tuple) -> str: - return self._find_element(locator).text - - def _get_text_of_elements(self, locator: tuple) -> list[str]: - text = [] - elements = self._find_elements(locator) - for element in elements: - text.append(element.text) - return text - - def _get_value_of_web_element_attribute(self, web_element: tuple) -> str: - return self._find_element(web_element).get_attribute("value") - - def _get_values_of_web_elements_attributes(self, web_element: tuple) -> list[str]: - web_elements = self._find_elements(web_element) - values = [] - for element in web_elements: - values.append(element.get_attribute("value")) - return values - - def _get_attribute_value_of_web_element(self, web_element: tuple, attribute: str) -> str: - return self._find_element(web_element).get_attribute(attribute) - - def _get_value_of_css_property(self, web_element: tuple, text: str) -> str: - return self._find_element(web_element).value_of_css_property(text) - - def _get_css_value_of_pseudo_html_element( - self, locator: str, pseudo_element_locator: str, property_to_get: str - ) -> str: - script = ( - f"return window.getComputedStyle(document.querySelector('{locator}')," - f"'{pseudo_element_locator}').getPropertyValue('{property_to_get}')" - ) - return self._driver.execute_script(script) - - def _get_number_of_elements(self, locator: tuple) -> int: - return len(self._find_elements(locator)) - - # Select functions - - def _select_option_by_value(self, web_element: tuple, value: str): - select_element = Select(self._find_element(web_element)) - select_element.select_by_value(value) - - def _select_option_by_text(self, web_element: tuple, text: str): - select_element = Select(self._find_element(web_element)) - select_element.select_by_visible_text(text) - - def _clear_select_option_field(self, web_element: tuple): - select_element = Select(self._find_element(web_element)) - select_element.deselect_all() - - def _get_select_chosen_option(self, web_element: tuple) -> str: - select_element = Select(self._find_element(web_element)) - selected_element = select_element.first_selected_option - return selected_element.text - - # ActionsChains class functions - def _mouseover_element(self, locator: tuple): - action = ActionChains(self._driver) - action.move_to_element(self._find_element(locator)).perform() - - def _mouseover_web_element(self, element: WebElement): - action = ActionChains(self._driver) - action.move_to_element(element).perform() - - def _scroll_element_in_view(self, locator: tuple): - self._driver.execute_script("window.scrollTo(0, arguments[0].offsetTop);", locator) - - def _press_home_keyboard_button(self): - actions = ActionChains(self._driver) - actions.send_keys(Keys.HOME).perform() - - def _press_enter_keyboard_button(self): - actions = ActionChains(self._driver) - actions.send_keys(Keys.ENTER).perform() - - # Alert handling - def _accept_alert(self): - try: - self.__wait_until_alert_is_present() - self._driver.switch_to.alert.accept() - - except TimeoutException: - print("No alert is present") - - def _dismiss_alert(self): - try: - self.__wait_until_alert_is_present() - self._driver.switch_to.alert.dismiss() - - except TimeoutException: - print("No alert is present") - - def _switch_next_child_tab(self): - current_window_handle = self._driver.current_window_handle - first_child_window = self._driver.window_handles - - for window in first_child_window: - if window != current_window_handle: - self._driver.switch_to.window(window) - - def _is_element_displayed(self, locator: tuple) -> bool: - try: - return self._find_element(locator).is_displayed() - except NoSuchElementException: - return False - except TimeoutException: - return False - - def _is_element_selected(self, locator: tuple) -> bool: - return self._find_element(locator).is_selected() - - def _is_web_element_selected(self, web_element: WebElement) -> bool: - return web_element.is_selected() - - def __wait_until_element_is_visible(self, locator: tuple, time: int = 2): - wait = WebDriverWait(self._driver, time) - wait.until(ec.visibility_of_element_located(locator)) - - def wait_until_page_is(self, url: str, time: int = 5): - wait = WebDriverWait(self._driver, time) - wait.until(ec.url_to_be(url)) - - def __wait_until_alert_is_present(self, time: int = 4): - wait = WebDriverWait(self._driver, time) - wait.until(ec.alert_is_present(), "No alert is displayed") - - def wait_for_url_title_to_contain(self, url: str): - wait = WebDriverWait(self._driver, 5) - wait.until(ec.title_contains(url)) - - def _wait_for_element_to_be_clickable(self, locator: tuple, time: int = 10): - wait = WebDriverWait(self._driver, time) - wait.until(ec.element_to_be_clickable(locator)) diff --git a/selenium_tests/docker/browsers.json b/selenium_tests/docker/browsers.json deleted file mode 100644 index 5acd822b0d6..00000000000 --- a/selenium_tests/docker/browsers.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "chrome": { - "default": "latest", - "versions": { - "latest": { - "image": "selenoid/chrome:latest", - "port": "4444", - "path": "/", - "sessionTimeout": "10m", - "shm-size": 2147483648 - } - } - }, - "firefox": { - "default": "latest", - "versions": { - "latest": { - "image": "selenoid/firefox:latest", - "port": "4444", - "path": "/wd/hub", - "sessionTimeout": "10m", - "shm-size": 2147483648 - - } - } - } -} diff --git a/selenium_tests/docker/docker-compose.yml b/selenium_tests/docker/docker-compose.yml deleted file mode 100644 index 4773ed5f931..00000000000 --- a/selenium_tests/docker/docker-compose.yml +++ /dev/null @@ -1,11 +0,0 @@ -version: '3' -services: - selenoid: - image: "aerokube/selenoid" - network_mode: bridge - restart: always - ports: - - "4444:4444" - volumes: - - "$PWD:/etc/selenoid/" # assumed current dir contains browsers.json - - "/var/run/docker.sock:/var/run/docker.sock" diff --git a/selenium_tests/flows/messaging_system_flows/messaging_system_flow.py b/selenium_tests/flows/messaging_system_flows/messaging_system_flow.py deleted file mode 100644 index cc0631d9c65..00000000000 --- a/selenium_tests/flows/messaging_system_flows/messaging_system_flow.py +++ /dev/null @@ -1,13 +0,0 @@ -from selenium_tests.core.test_utilities import TestUtilities -from selenium_tests.pages.messaging_system_pages.new_message import NewMessagePage -from selenium.webdriver.remote.webdriver import WebDriver - - -class MessagingSystemFlows(TestUtilities, NewMessagePage): - def __init__(self, driver: WebDriver): - super().__init__(driver) - - def complete_send_message_form_with_data(self, recipient_username: str, message_body: str): - super().type_into_new_message_to_input_field(recipient_username) - super().click_on_a_searched_user(recipient_username) - super().type_into_new_message_body_textarea(message_body) diff --git a/selenium_tests/messages/contact_support_page_messages.py b/selenium_tests/messages/contact_support_page_messages.py deleted file mode 100644 index fb30dd9e2cf..00000000000 --- a/selenium_tests/messages/contact_support_page_messages.py +++ /dev/null @@ -1,4 +0,0 @@ -class ContactSupportPageMessages: - STAGE_CONTACT_SUPPORT_URL = "https://support.allizom.org/en-US/questions/new" - CONTACT_SUPPORT_PAGE_MAIN_HEADER = "Contact Support" - CONTACT_SUPPORT_PAGE_SECOND_HEADER = "Which product do you need help with?" diff --git a/selenium_tests/messages/my_profile_pages_messages/manage_watch_list_page_messages.py b/selenium_tests/messages/my_profile_pages_messages/manage_watch_list_page_messages.py deleted file mode 100644 index a606dd12904..00000000000 --- a/selenium_tests/messages/my_profile_pages_messages/manage_watch_list_page_messages.py +++ /dev/null @@ -1,2 +0,0 @@ -class ManageWatchListPageMessages: - STAGE_MANAGE_WATCH_LIST_URL = "https://support.allizom.org/en-US/users/watches" diff --git a/selenium_tests/messages/my_profile_pages_messages/my_subscriptions_page_messages.py b/selenium_tests/messages/my_profile_pages_messages/my_subscriptions_page_messages.py deleted file mode 100644 index 7a3cdd4d79a..00000000000 --- a/selenium_tests/messages/my_profile_pages_messages/my_subscriptions_page_messages.py +++ /dev/null @@ -1,3 +0,0 @@ -class MySubscriptionsPageMessages: - def get_my_subscriptions_url(self, username: str) -> str: - return f"https://support.allizom.org/en-US/user/{username}/subscriptions" diff --git a/selenium_tests/messages/search_results_page_messages.py b/selenium_tests/messages/search_results_page_messages.py deleted file mode 100644 index 4a16044d977..00000000000 --- a/selenium_tests/messages/search_results_page_messages.py +++ /dev/null @@ -1,6 +0,0 @@ -class SearchResultsMessages: - STAGE_HOMEPAGE_URL = "https://support.allizom.org/en-US/#search" - MAIN_PAGE_HEADER_TEXT = "Search Support" - DOCTYPE_FILTER_OPTION_ONE_TEXT = "View All" - DOCTYPE_FILTER_OPTION_TWO_TEXT = "Help Articles Only" - DOCTYPE_FILTER_OPTION_THREE_TEXT = "Community Discussion Only" diff --git a/selenium_tests/messages/support_page_messages.py b/selenium_tests/messages/support_page_messages.py deleted file mode 100644 index 940747ddaf6..00000000000 --- a/selenium_tests/messages/support_page_messages.py +++ /dev/null @@ -1,2 +0,0 @@ -class SupportPageMessages: - TITLE_CONTAINS = "Support" diff --git a/selenium_tests/messages/user_questions_messages/aaq_form_page_messages.py b/selenium_tests/messages/user_questions_messages/aaq_form_page_messages.py deleted file mode 100644 index ce2864ba26c..00000000000 --- a/selenium_tests/messages/user_questions_messages/aaq_form_page_messages.py +++ /dev/null @@ -1,11 +0,0 @@ -class AAQFormPageMessages: - AAQ_FORM_PAGE_HEADER = "Ask your question " - AAQ_FORM_PAGE_INTRO = ( - "Be nice. Our volunteers are Mozilla users just like you," - " who take the time out of their day to help." - ) - AAQ_TOPIC_DROPDOWN_FIELD_IS_REQUIRED_ERROR_MESSAGE = "This field is required." - AAQ_FIELD_REQUIRED_ERROR_MESSAGE = "This field is required." - - def get_not_enough_characters_error_message(self, subject_length: int) -> str: - return f"Ensure this value has at least 5 characters (it has {subject_length})." diff --git a/selenium_tests/messages/user_questions_messages/question_page_messages.py b/selenium_tests/messages/user_questions_messages/question_page_messages.py deleted file mode 100644 index 9d054ba94b2..00000000000 --- a/selenium_tests/messages/user_questions_messages/question_page_messages.py +++ /dev/null @@ -1,3 +0,0 @@ -class QuestionPageMessages: - NO_QUESTION_REPLIES_TEXT = "No replies" - HAVE_THIS_PROBLEM_TEXT = "have this problem" diff --git a/selenium_tests/pages/articles/kb_article_page.py b/selenium_tests/pages/articles/kb_article_page.py deleted file mode 100644 index 91fb8bbec17..00000000000 --- a/selenium_tests/pages/articles/kb_article_page.py +++ /dev/null @@ -1,18 +0,0 @@ -from selenium.webdriver.common.by import By -from selenium_tests.core.base_page import BasePage -from selenium.webdriver.remote.webdriver import WebDriver - - -class KBArticlePage(BasePage): - __kb_article_heading = (By.XPATH, "//h1[@class='sumo-page-heading']") - # Editing Tools options - __editing_tools_show_history_option = (By.XPATH, "//a[text()='Show History']") - - def __init__(self, driver: WebDriver): - super().__init__(driver) - - def click_on_show_history_option(self): - super()._click(self.__editing_tools_show_history_option) - - def get_text_of_article_title(self) -> str: - return super()._get_text_of_element(self.__kb_article_heading) diff --git a/selenium_tests/pages/articles/kb_article_show_history_page.py b/selenium_tests/pages/articles/kb_article_show_history_page.py deleted file mode 100644 index f4aa69b9f73..00000000000 --- a/selenium_tests/pages/articles/kb_article_show_history_page.py +++ /dev/null @@ -1,22 +0,0 @@ -from selenium.webdriver.common.by import By -from selenium.webdriver.remote.webdriver import WebDriver -from selenium_tests.core.base_page import BasePage - - -class KBArticleShowHistoryPage(BasePage): - __delete_this_document_button = (By.XPATH, "//div[@id='delete-doc']/a") - __delete_this_document_confirmation_delete_button = (By.XPATH, "//div[@class='submit']/input") - __delete_this_document_confirmation_cancel_button = (By.XPATH, "//div[@class='submit']/a") - __article_deleted_confirmation_message = (By.XPATH, "//article[@id='delete-document']/h1") - - def __init__(self, driver: WebDriver): - super().__init__(driver) - - def click_on_delete_this_document_button(self): - super()._click(self.__delete_this_document_button) - - def click_on_confirmation_delete_button(self): - super()._click(self.__delete_this_document_confirmation_delete_button) - - def is_article_deleted_confirmation_messages_displayed(self) -> bool: - return super()._is_element_displayed(self.__article_deleted_confirmation_message) diff --git a/selenium_tests/pages/articles/submit_kb_article_page.py b/selenium_tests/pages/articles/submit_kb_article_page.py deleted file mode 100644 index fbbec38b7fe..00000000000 --- a/selenium_tests/pages/articles/submit_kb_article_page.py +++ /dev/null @@ -1,137 +0,0 @@ -from selenium.webdriver.common.by import By -from selenium.webdriver.remote.webdriver import WebDriver -from selenium_tests.core.base_page import BasePage - - -class SubmitKBArticlePage(BasePage): - __kb_article_for_contributors_sidebar = (By.XPATH, "//nav[@id='for-contributors-sidebar']") - __kb_article_form_title = (By.XPATH, "//input[@id='id_title']") - __kb_article_form_slug = (By.XPATH, "//input[@id='id_slug']") - __kb_article_category_select = (By.XPATH, "//select[@id='id_category']") - __kb_article_is_localizable_checkbox = (By.XPATH, "//input[@id='id_is_localizable']") - - __kb_article_allow_discussions_on_article = (By.XPATH, "//input[@id='id_allow_discussion']") - __kb_article_search_for_related_documents = (By.XPATH, "//input[@id='search-related']") - __kb_article_keywords_input = (By.XPATH, "//input[@id='id_keywords']") - __kb_article_search_result_summary_textarea = (By.XPATH, "//textarea[@id='id_summary']") - # try - __kb_article_content_textarea = (By.XPATH, "//textarea[@id='id_content'][1]") - __kb_article_insert_media = (By.XPATH, "//button[contains(@class, 'btn-media')]") - __kb_article_insert_media_modal_images = (By.XPATH, "//div[@id='media-modal']//img") - __kb_article_insert_media_modal_insert_button = ( - By.XPATH, - "//button[contains(text(), 'Insert Media')]", - ) - __kb_article_toggle_syntax_highlighting = ( - By.XPATH, - "//a[contains(text(), 'Toggle syntax highlight')]", - ) - __kb_article_expiry_date = (By.XPATH, "//input[@id='id_expires']") - __kb_article_preview_content_button = ( - By.XPATH, - "//div[contains(@class, 'submit')]/button[contains(@class, " "'btn-preview')]", - ) - __kb_article_preview_image = (By.XPATH, "//div[@id='doc-content']//img") - __kb_article_submit_for_preview_button = ( - By.XPATH, - "//div[contains(@class, 'submit')]/button[contains(@class, " "'submit')]", - ) - __kb_article_preview_content = (By.XPATH, "//div[@id='doc-content']") - __kb_article_showfor_panel = (By.XPATH, "//section[@id='showfor-panel']") - __kb_submit_changes_input_field = (By.XPATH, "//input[@id='id_comment']") - __kb_submit_changes_button = (By.XPATH, "//button[@id='submit-document-form']") - - def __init__(self, driver: WebDriver): - super().__init__(driver) - - def is_for_contributors_section_displayed(self) -> bool: - return super()._is_element_displayed(self.__kb_article_for_contributors_sidebar) - - def add_text_to_article_form_title_field(self, text: str): - super()._type(self.__kb_article_form_title, text) - - def add_text_to_related_documents_field(self, text: str): - super()._type(self.__kb_article_search_for_related_documents, text) - - def add_text_to_keywords_field(self, text: str): - super()._type(self.__kb_article_keywords_input, text) - - def add_text_to_search_result_summary_field(self, text: str): - super()._type(self.__kb_article_search_result_summary_textarea, text) - - def add_text_to_expiry_date_field(self, text: str): - super()._type(self.__kb_article_expiry_date, text) - - def add_text_to_changes_description_field(self, text: str): - super()._type(self.__kb_submit_changes_input_field, text) - - def add_text_to_content_textarea(self, text: str): - super()._type(self.__kb_article_content_textarea, text) - - def is_content_textarea_displayed(self) -> bool: - return super()._is_element_displayed(self.__kb_article_content_textarea) - - def click_on_insert_media_button(self): - super()._click(self.__kb_article_insert_media) - - def click_on_toggle_syntax_highlight_option(self): - super()._click(self.__kb_article_toggle_syntax_highlighting) - - def click_on_preview_content_button(self): - super()._click(self.__kb_article_preview_content_button) - - def click_on_submit_for_review_button(self): - super()._click(self.__kb_article_submit_for_preview_button) - - def click_on_changes_submit_button(self): - super()._click(self.__kb_submit_changes_button) - - def is_showfor_panel_displayed(self) -> bool: - return super()._is_element_displayed(self.__kb_article_showfor_panel) - - def is_preview_content_section_displayed(self) -> bool: - return super()._is_element_displayed(self.__kb_article_preview_content) - - def _click_on_a_relevant_to_option_checkbox(self, option_to_click: str): - xpath = ( - By.XPATH, - f"//div[@id='id_products']//label[contains(text(), '{option_to_click}')]/input", - ) - super()._click(xpath) - - def _get_text_of_label_for_relevant_to_checkbox(self, option_to_click) -> str: - xpath = ( - By.XPATH, - f"//div[@id='id_products']//input[@id='id_products_{option_to_click}']/..", - ) - return super()._get_text_of_element(xpath) - - def _click_on_a_particular_parent_topic(self, parent_topic: str): - xpath_parent_topic = ( - By.XPATH, - f"//section[@id='accordion']//button[text()='{parent_topic}']", - ) - super()._click(xpath_parent_topic) - - def _click_on_a_particular_child_topic_checkbox( - self, parent_topic: str, child_topic_checkbox: str - ): - xpath_child_topic_checkbox_option = ( - By.XPATH, - f"//section[@id='accordion']//button[text()='{parent_topic}']" - f"/parent::h3/following-sibling::ul[1]" - f"//label[text()='{child_topic_checkbox}']", - ) - super()._click(xpath_child_topic_checkbox_option) - - def _click_on_insert_media_textarea_option(self): - super()._click(self.__kb_article_insert_media) - - def _click_on_first_image_from_media_panel(self): - super()._click(self.__kb_article_insert_media_modal_images) - - def _click_on_insert_media_modal_button(self): - super()._click(self.__kb_article_insert_media_modal_insert_button) - - def select_category_option_by_text(self, option: str): - super()._select_option_by_text(self.__kb_article_category_select, option) diff --git a/selenium_tests/pages/auth_page.py b/selenium_tests/pages/auth_page.py deleted file mode 100644 index 57bb9be7888..00000000000 --- a/selenium_tests/pages/auth_page.py +++ /dev/null @@ -1,64 +0,0 @@ -from selenium.webdriver.common.by import By -from selenium.webdriver.remote.webdriver import WebDriver -from selenium_tests.core.base_page import BasePage - - -class AuthPage(BasePage): - __auth_page_section = (By.XPATH, "//section[@class='sumo-auth--wrap']") - __fxa_sign_in_page_header = (By.XPATH, "//h1[@id='fxa-signin-password-header']") - __auth_page_main_header = (By.XPATH, "//h1[@class='sumo-page-heading']") - __auth_page_subheading_text = (By.XPATH, "//div[@class='sumo-page-section']/p") - __continue_with_firefox_accounts_button = (By.XPATH, "//p[@class='login-button-wrap']/a") - __use_a_different_account_button = (By.XPATH, "//a[@id='use-different']") - __user_logged_in_sign_in_button = (By.XPATH, "//button[@id='use-logged-in']") - __enter_your_email_input_field = (By.XPATH, "//input[@name='email']") - __enter_your_email_submit_button = (By.XPATH, "//button[@id='submit-btn']") - __enter_your_password_input_field = (By.XPATH, "//input[@id='password']") - __enter_your_password_submit_button = (By.XPATH, "//button[@id='submit-btn']") - __enter_otp_code_input_field = (By.XPATH, "//input[@id='otp-code']") - __enter_otp_code_confirm_button = (By.XPATH, "//button[@id='submit-btn']") - - def __init__(self, driver: WebDriver): - super().__init__(driver) - - def click_on_continue_with_firefox_accounts_button(self): - super()._click(self.__continue_with_firefox_accounts_button) - - def click_on_use_a_different_account_button(self): - super()._click(self.__use_a_different_account_button) - - def click_on_user_logged_in_sign_in_button(self): - super()._click(self.__user_logged_in_sign_in_button) - - def click_on_enter_your_email_submit_button(self): - super()._click(self.__enter_your_email_submit_button) - - def click_on_enter_your_password_submit_button(self): - super()._click(self.__enter_your_password_submit_button) - - def click_on_otp_code_confirm_button(self): - super()._click(self.__enter_otp_code_confirm_button) - - def add_data_to_email_input_field(self, text: str): - super()._type(self.__enter_your_email_input_field, text) - - def add_data_to_password_input_field(self, text: str): - super()._type(self.__enter_your_password_input_field, text) - - def add_data_to_otp_code_input_field(self, text: str): - super()._type(self.__enter_otp_code_input_field, text) - - def clear_email_input_field(self): - super()._clear_input_field(self.__enter_your_email_input_field) - - def is_use_a_different_account_button_displayed(self) -> bool: - return super()._is_element_displayed(self.__use_a_different_account_button) - - def is_logged_in_sign_in_button_displayed(self) -> bool: - return super()._is_element_displayed(self.__user_logged_in_sign_in_button) - - def is_enter_otp_code_input_field_displayed(self) -> bool: - return super()._is_element_displayed(self.__enter_otp_code_input_field) - - def is_continue_with_firefox_button_displayed(self) -> bool: - return super()._is_element_displayed(self.__continue_with_firefox_accounts_button) diff --git a/selenium_tests/pages/contact_support_pages/contact_support_page.py b/selenium_tests/pages/contact_support_pages/contact_support_page.py deleted file mode 100644 index 53781f90e7b..00000000000 --- a/selenium_tests/pages/contact_support_pages/contact_support_page.py +++ /dev/null @@ -1,12 +0,0 @@ -from selenium.webdriver.common.by import By -from selenium_tests.core.base_page import BasePage -from selenium.webdriver.remote.webdriver import WebDriver - - -class ContactSupportPage(BasePage): - __contact_support_page_heading = (By.XPATH, "//article/h1") - __contact_support_page_second_heading = (By.XPATH, "//article/h2") - __contact_support_firefox_card = (By.XPATH, "//a[@data-event-label='Firefox']") - - def __init__(self, driver: WebDriver): - super().__init__(driver) diff --git a/selenium_tests/pages/contribute_pages/contribute_page.py b/selenium_tests/pages/contribute_pages/contribute_page.py deleted file mode 100644 index 3df70d7bd61..00000000000 --- a/selenium_tests/pages/contribute_pages/contribute_page.py +++ /dev/null @@ -1,70 +0,0 @@ -from selenium.webdriver.common.by import By -from selenium.webdriver.remote.webdriver import WebDriver -from selenium.webdriver.remote.webelement import WebElement -from selenium_tests.core.base_page import BasePage - - -class ContributePage(BasePage): - __breadcrumbs = (By.XPATH, "//ol[@id='breadcrumbs']/li") - __breadcrumb_homepage = (By.XPATH, "//ol[@id='breadcrumbs']/li[1]") - __page_hero_main_header = (By.XPATH, "//div[contains(@class,'hero')]/div/h1") - __page_hero_main_header_subtext = ( - By.XPATH, - "//div[contains(@class,'hero')]/div/h1/following-sibling::p[1]", - ) - __page_hero_need_help_header = (By.XPATH, "//div[contains(@class,'hero')]/div/h2") - __page_hero_need_help_subtext = ( - By.XPATH, - "//div[contains(@class,'hero')]/div/h1/following-sibling::p[2]", - ) - __way_to_contribute_header = (By.XPATH, "//nav/preceding-sibling::h2") - __way_to_contribute_cards = ( - By.XPATH, - "//h2[contains(text(),'Pick a way to " "contribute')]/following-sibling::nav/ul/a", - ) - __way_to_contribute_card_titles = (By.XPATH, "//nav/ul/a/li/span") - __about_us_header = (By.XPATH, "//h2[contains(text(),'About us')]") - __about_us_subtext = (By.XPATH, "//h2[contains(text(),'About us')]/following-sibling::p") - __all_page_images = (By.XPATH, "//div[@id='svelte']//img") - - def __init__(self, driver: WebDriver): - super().__init__(driver) - - def get_breadcrumbs_text(self) -> list[str]: - return super()._get_text_of_elements(self.__breadcrumbs) - - def get_all_page_links(self) -> list[WebElement]: - return super()._find_elements(self.__all_page_images) - - def get_page_hero_main_header_text(self) -> str: - return super()._get_text_of_element(self.__page_hero_main_header) - - def get_page_hero_main_subtext(self) -> str: - return super()._get_text_of_element(self.__page_hero_main_header_subtext) - - def get_page_hero_need_help_header_text(self) -> str: - return super()._get_text_of_element(self.__page_hero_need_help_header) - - def get_page_hero_need_help_subtext(self) -> str: - return super()._get_text_of_element(self.__page_hero_need_help_subtext) - - 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]: - return super()._get_text_of_elements(self.__way_to_contribute_card_titles) - - def get_about_us_header_text(self) -> str: - return super()._get_text_of_element(self.__about_us_header) - - def get_about_us_subtext(self) -> str: - return super()._get_text_of_element(self.__about_us_subtext) - - def get_list_of_contribute_cards(self) -> list[WebElement]: - return super()._find_elements(self.__way_to_contribute_cards) - - def click_on_way_to_contribute_card(self, way_to_contribute_card): - super()._click_on_web_element(way_to_contribute_card) - - def click_on_home_breadcrumb(self): - super()._click(self.__breadcrumb_homepage) diff --git a/selenium_tests/pages/contribute_pages/ways_to_contribute_pages.py b/selenium_tests/pages/contribute_pages/ways_to_contribute_pages.py deleted file mode 100644 index 3ae74c8b168..00000000000 --- a/selenium_tests/pages/contribute_pages/ways_to_contribute_pages.py +++ /dev/null @@ -1,81 +0,0 @@ -from selenium.webdriver.common.by import By -from selenium.webdriver.remote.webdriver import WebDriver -from selenium.webdriver.remote.webelement import WebElement -from selenium_tests.core.base_page import BasePage - - -class WaysToContributePages(BasePage): - __interactable_breadcrumbs = (By.XPATH, "//ol[@id='breadcrumbs']/li/a") - __all_breadcrumbs = (By.XPATH, "//ol[@id='breadcrumbs']/li") - __hero_main_header = (By.XPATH, "//div[contains(@class,'hero')]/div/h1") - __hero_second_header = (By.XPATH, "//div[contains(@class,'hero')]/div/h2") - __hero_text = (By.XPATH, "//div[contains(@class,'hero')]/div/p") - __how_to_contribute_header = (By.XPATH, "//section[@class='mzp-l-content']/h2") - __all_how_to_contribute_option_links = ( - By.XPATH, - "//section[@class='mzp-l-content']/div/ol/li/a", - ) - __start_answering_how_to_contribute_option_text = ( - By.XPATH, - "//section[@class='mzp-l-content']/div/ol/li[4]", - ) - __first_fact_text = (By.XPATH, "//div[contains(@class,'fact')]/span[1]") - __second_fact_text = (By.XPATH, "//div[contains(@class,'fact')]/span[2]") - __other_ways_to_contribute_header = (By.XPATH, "//div[@id='svelte']/section[2]/h2") - __other_ways_to_contribute_card_titles = ( - By.XPATH, - "//div[@id='svelte']/section[2]//nav//span", - ) - __other_ways_to_contribute_card_list = (By.XPATH, "//div[@id='svelte']/section[2]//ul/a") - __all_page_images = (By.XPATH, "//div[@id='svelte']//img") - - def __init__(self, driver: WebDriver): - super().__init__(driver) - - def get_text_of_all_breadcrumbs(self) -> list[str]: - return super()._get_text_of_elements(self.__all_breadcrumbs) - - def get_all_interactable_breadcrumbs(self) -> list[WebElement]: - return super()._find_elements(self.__interactable_breadcrumbs) - - def click_on_breadcrumb(self, element: WebElement): - super()._click_on_web_element(element) - - def get_hero_main_header_text(self) -> str: - return super()._get_text_of_element(self.__hero_main_header) - - def get_hero_second_header_text(self) -> str: - return super()._get_text_of_element(self.__hero_second_header) - - def get_hero_text(self) -> str: - return super()._get_text_of_element(self.__hero_text) - - 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]: - return super()._get_text_of_elements(self.__all_how_to_contribute_option_links) - - def get_how_to_contribute_option_four_text(self) -> str: - return super()._get_text_of_element(self.__start_answering_how_to_contribute_option_text) - - def get_first_fact_text(self) -> str: - return super()._get_text_of_element(self.__first_fact_text) - - def get_second_fact_text(self) -> str: - return super()._get_text_of_element(self.__second_fact_text) - - def get_other_ways_to_contribute_header_text(self) -> str: - return super()._get_text_of_element(self.__other_ways_to_contribute_header) - - def get_other_ways_to_contribute_card_titles_text(self) -> list[str]: - return super()._get_text_of_elements(self.__other_ways_to_contribute_card_titles) - - def get_all_page_image_links(self) -> list[WebElement]: - return super()._find_elements(self.__all_page_images) - - def get_all_other_ways_to_contribute_card_list(self) -> list[WebElement]: - return super()._find_elements(self.__other_ways_to_contribute_card_list) - - def click_on_other_way_to_contribute_card(self, card_item: WebElement): - super()._click_on_web_element(card_item) diff --git a/selenium_tests/pages/contributor_forums_pages/contributor_forum_page.py b/selenium_tests/pages/contributor_forums_pages/contributor_forum_page.py deleted file mode 100644 index 7eedcb38cac..00000000000 --- a/selenium_tests/pages/contributor_forums_pages/contributor_forum_page.py +++ /dev/null @@ -1,9 +0,0 @@ -from selenium.webdriver.common.by import By -from selenium_tests.core.base_page import BasePage - - -class ContributorForumPage(BasePage): - __breadcrumbs = (By.XPATH, "//ol[@id='breadcrumbs']/li") - __breadcrumb_homepage = (By.XPATH, "//ol[@id='breadcrumbs']/li[1]") - __main_page_header = (By.XPATH, "//div[@id='forums']/h1[@class='sumo-page-heading']") - __for_contributors_side_navbar_items = (By.XPATH, "//ul[@class='sidebar-nav--list']/li/a") diff --git a/selenium_tests/pages/footer.py b/selenium_tests/pages/footer.py deleted file mode 100644 index 7af2a771777..00000000000 --- a/selenium_tests/pages/footer.py +++ /dev/null @@ -1,15 +0,0 @@ -from selenium.webdriver.common.by import By -from selenium.webdriver.remote.webdriver import WebDriver -from selenium.webdriver.remote.webelement import WebElement -from selenium_tests.core.base_page import BasePage - - -class FooterSection(BasePage): - __all_footer_links = (By.XPATH, "//footer//a") - __language_selector = (By.ID, "mzp-c-language-switcher-select") - - def __init__(self, driver: WebDriver): - super().__init__(driver) - - def get_all_footer_links(self) -> list[WebElement]: - return super()._find_elements(self.__all_footer_links) diff --git a/selenium_tests/pages/homepage.py b/selenium_tests/pages/homepage.py deleted file mode 100644 index ca2a8ab59ee..00000000000 --- a/selenium_tests/pages/homepage.py +++ /dev/null @@ -1,84 +0,0 @@ -from selenium.webdriver.common.by import By -from selenium.webdriver.remote.webdriver import WebDriver -from selenium.webdriver.remote.webelement import WebElement - -from selenium_tests.core.base_page import BasePage - - -class Homepage(BasePage): - # Searchbar section - __search_bar = (By.XPATH, "//form[@id='support-search-masthead']/input[@id='search-q']") - __search_bar_button = ( - By.XPATH, - "//form[@id='support-search-masthead']/button[@class='search-button']", - ) - __popular_searches = (By.XPATH, "//p[@class='popular-searches']/a") - - # Product list section - __product_list = (By.XPATH, "//div[contains(@class, 'card--product')]") - __product_card_titles = ( - By.XPATH, - "//div[contains(@class, 'card--product')]/div[@class='card--details']/h3[" - "@class='card--title']/a", - ) - - # Featured articles section - __featured_articles_list = (By.XPATH, "//div[contains(@class, 'card--article')]") - __featured_articles_first_item_card = (By.XPATH, "//div[contains(@class, 'card--article')][1]") - __featured_articles_card_titles = ( - By.XPATH, - "//div[contains(@class, 'card--article')]/div/h3/a", - ) - - # Join our Community section - __join_our_community_card_title = ( - By.XPATH, - "//div[@class='card--callout-wrap-narrow']//h3[@class='card--title']", - ) - __join_our_community_card_description = ( - By.XPATH, - "//div[@class='card--callout-wrap-narrow']//p[1]", - ) - __learn_more_option = (By.LINK_TEXT, "Learn More") - - def __init__(self, driver: WebDriver): - super().__init__(driver) - - def click_on_product_card(self, product_card): - super()._click_on_web_element(product_card) - - def get_list_of_product_cards(self) -> list[WebElement]: - return super()._find_elements(self.__product_list) - - def get_text_of_product_card_titles(self) -> list[str]: - return super()._get_text_of_elements(self.__product_card_titles) - - def get_number_of_featured_articles(self) -> int: - return super()._get_number_of_elements(self.__featured_articles_list) - - def get_featured_articles_titles(self) -> list[str]: - return super()._get_text_of_elements(self.__featured_articles_card_titles) - - def click_on_featured_article(self): - super()._click(self.__featured_articles_first_item_card) - - def click_learn_more_option(self): - super()._click(self.__learn_more_option) - - def get_community_card_title(self) -> str: - return super()._get_text_of_element(self.__join_our_community_card_title) - - def get_community_card_description(self) -> str: - return super()._get_text_of_element(self.__join_our_community_card_description) - - def click_on_search_button(self): - super()._click(self.__search_bar_button) - - def get_popular_searches_options(self) -> list[WebElement]: - return super()._find_elements(self.__popular_searches) - - def click_on_popular_search_option(self, popular_search_option): - super()._click(popular_search_option) - - def wait_for_searchbar_to_be_displayed_and_clickable(self): - super()._wait_for_element_to_be_clickable(self.__search_bar) diff --git a/selenium_tests/pages/messaging_system_pages/inbox_page.py b/selenium_tests/pages/messaging_system_pages/inbox_page.py deleted file mode 100644 index f866572e474..00000000000 --- a/selenium_tests/pages/messaging_system_pages/inbox_page.py +++ /dev/null @@ -1,140 +0,0 @@ -from selenium_tests.core.base_page import BasePage -from selenium.webdriver.common.by import By -from selenium.webdriver.remote.webdriver import WebDriver - - -class InboxPage(BasePage): - __inbox_page_breadcrumbs = (By.XPATH, "//ol[@id='breadcrumbs']/li") - __inbox_page_main_heading = (By.XPATH, "//h1[@class='sumo-page-heading']") - __inbox_new_message_button = ( - By.XPATH, - "//article[@id='inbox']//a[contains(text(),'New Message')]", - ) - __inbox_no_messages_text = (By.XPATH, "//article[@id='inbox']//p") - __inbox_mark_selected_as_read_button = (By.XPATH, "//input[@name='mark_read']") - __inbox_delete_selected_button = (By.XPATH, "//input[@name='delete']") - __inbox_delete_page_delete_button = (By.XPATH, "//button[@name='delete']") - __inbox_delete_page_cancel_button = (By.XPATH, "//a[contains(text(), 'Cancel')]") - __inbox_page_message_banner_text = (By.XPATH, "//ul[@class='user-messages']/li/p") - __inbox_page_message_banner_close_button = (By.XPATH, "//ul[@class='user-messages']/li/button") - __inbox_messages = (By.XPATH, "//ol[@class='message-list']/li") - __inbox_messages_delete_button = ( - By.XPATH, - "//ol[@class='message-list']/li/a[@class='delete']", - ) - - def __init__(self, driver: WebDriver): - super().__init__(driver) - - def get_text_inbox_page_message_banner_text(self) -> str: - return super()._get_text_of_element(self.__inbox_page_message_banner_text) - - def get_text_of_inbox_page_main_header(self) -> str: - return super()._get_text_of_element(self.__inbox_page_main_heading) - - def get_text_of_inbox_no_message_header(self) -> str: - return super()._get_text_of_element(self.__inbox_no_messages_text) - - def get_inbox_message_subject(self, username: str) -> str: - xpath = ( - By.XPATH, - f"//ol[@class='message-list']//a[contains(text()," - f"'{username}')]/ancestor::li/a[@class='read']", - ) - return super()._get_text_of_element(xpath) - - def click_on_inbox_message_banner_close_button(self): - super()._click(self.__inbox_page_message_banner_close_button) - - def click_on_inbox_message_delete_button(self, username: str): - xpath_to_hover = ( - By.XPATH, - f"//ol[@class='message-list']//a[contains(text(),'{username}')]", - ) - super()._mouseover_element(xpath_to_hover) - - xpath_delete_button = ( - By.XPATH, - f"//ol[@class='message-list']//a[contains(text(),'{username}')]/ancestor::li" - f"/a[@class='delete']", - ) - - super()._click(xpath_delete_button) - - def click_on_inbox_new_message_button(self): - super()._click(self.__inbox_new_message_button) - - def click_on_inbox_mark_selected_as_read_button(self): - super()._click(self.__inbox_mark_selected_as_read_button) - - def click_on_inbox_delete_selected_button(self): - super()._click(self.__inbox_delete_selected_button) - - def click_on_inbox_message_sender_username(self, username: str): - xpath = (By.XPATH, f"//ol[@class='message-list']//a[contains(text(),'{username}')]") - super()._click(xpath) - - def click_on_inbox_message_select_checkbox(self): - xpath = ( - By.XPATH, - "//ol[@class='message-list']//a/ancestor::li/div" - "[contains(@class, 'field checkbox no-label')]/label", - ) - super()._click(xpath) - - def click_on_inbox_message_subject(self, username: str): - xpath = ( - By.XPATH, - f"//ol[@class='message-list']//a[contains(text()," - f"'{username}')]/ancestor::li/a[@class='read']", - ) - super()._click(xpath) - - def click_on_delete_page_delete_button(self): - super()._click(self.__inbox_delete_page_delete_button) - - def click_on_delete_page_cancel_button(self): - super()._click(self.__inbox_delete_page_cancel_button) - - def is_no_message_header_displayed(self) -> bool: - return super()._is_element_displayed(self.__inbox_no_messages_text) - - def is_inbox_page_message_banner_displayed(self) -> bool: - return super()._is_element_displayed(self.__inbox_page_message_banner_text) - - def is_message_displayed_inside_the_inbox_section(self, username: str) -> bool: - xpath = (By.XPATH, f"//ol[@class='message-list']//a[contains(text(),'{username}')]") - return super()._is_element_displayed(xpath) - - def are_inbox_messages_displayed(self) -> bool: - return super()._is_element_displayed(self.__inbox_messages) - - def delete_all_displayed_inbox_messages(self): - inbox_messages_count = super()._find_elements(self.__inbox_messages) - counter = 0 - for i in range(len(inbox_messages_count)): - inbox_messages = super()._find_elements(self.__inbox_messages) - element = inbox_messages[counter] - super()._mouseover_web_element(element) - - inbox_elements_delete_button = super()._find_elements( - self.__inbox_messages_delete_button - ) - delete_button = inbox_elements_delete_button[counter] - - super()._click_on_web_element(delete_button) - self.click_on_delete_page_delete_button() - - def delete_all_displayed_inbox_messages_via_delete_selected_button(self): - inbox_messages_count = super()._find_elements(self.__inbox_messages) - counter = 0 - for i in range(len(inbox_messages_count)): - self.click_on_inbox_message_select_checkbox() - - inbox_elements_delete_button = super()._find_elements( - self.__inbox_delete_selected_button - ) - delete_button = inbox_elements_delete_button[counter] - - super()._click_on_web_element(delete_button) - self.click_on_delete_page_delete_button() diff --git a/selenium_tests/pages/messaging_system_pages/mess_system_user_navbar.py b/selenium_tests/pages/messaging_system_pages/mess_system_user_navbar.py deleted file mode 100644 index 48fe5064913..00000000000 --- a/selenium_tests/pages/messaging_system_pages/mess_system_user_navbar.py +++ /dev/null @@ -1,46 +0,0 @@ -from selenium_tests.core.base_page import BasePage -from selenium.webdriver.common.by import By -from selenium.webdriver.remote.webdriver import WebDriver - - -class MessagingSystemUserNavbar(BasePage): - __messaging_system_user_navbar_inbox_option = ( - By.XPATH, - "//ul[@id='pm-nav']//a[contains(text(),'Inbox')]", - ) - __messaging_system_user_navbar_sent_messages_option = ( - By.XPATH, - "//ul[@id='pm-nav']//a[contains(text(),'Sent Messages')]", - ) - __messaging_system_user_navbar_new_message_option = ( - By.XPATH, - "//ul[@id='pm-nav']//a[contains(text(),'New " "Message')]", - ) - - def __init__(self, driver: WebDriver): - super().__init__(driver) - - 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): - super()._click(self.__messaging_system_user_navbar_sent_messages_option) - - def click_on_messaging_system_navbar_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 - def get_inbox_option_background_value(self) -> str: - return super()._get_value_of_css_property( - self.__messaging_system_user_navbar_inbox_option, "background-color" - ) - - def get_sent_messages_option_background_value(self) -> str: - return super()._get_value_of_css_property( - self.__messaging_system_user_navbar_sent_messages_option, "background-color" - ) - - def get_new_message_option_background_value(self) -> str: - return super()._get_value_of_css_property( - self.__messaging_system_user_navbar_new_message_option, "background-color" - ) diff --git a/selenium_tests/pages/messaging_system_pages/new_message.py b/selenium_tests/pages/messaging_system_pages/new_message.py deleted file mode 100644 index e54ccd6b267..00000000000 --- a/selenium_tests/pages/messaging_system_pages/new_message.py +++ /dev/null @@ -1,133 +0,0 @@ -from selenium_tests.core.base_page import BasePage -from selenium.webdriver.common.by import By -from selenium.webdriver.remote.webdriver import WebDriver - - -class NewMessagePage(BasePage): - __new_message_page_header = (By.XPATH, "//h1[@class='sumo-page-heading']") - __new_message_to_input_field = (By.XPATH, "//input[@id='token-input-id_to']") - __new_message_textarea_input_field = (By.XPATH, "//textarea[@id='id_message']") - __new_message_textarea_remaining_characters = (By.XPATH, "//div[@id='remaining-characters']") - __new_message_cancel_button = (By.XPATH, "//a[contains(text(),'Cancel')]") - __new_message_send_button = (By.XPATH, "//button[@name='send']") - __new_message_preview_section = (By.XPATH, "//section[@id='preview']") - __new_message_preview_section_content = (By.XPATH, "//div[@class='message']") - __new_message_search_for_a_user_option = ( - By.XPATH, - "//div[@class='token-input-dropdown-facebook']", - ) - __new_message_search_results_bolded_characters = (By.XPATH, "//div[@class='name_search']/b") - __new_message_search_results_text = (By.XPATH, "//div[@class='name_search']") - __sent_message_page_to_user_text = (By.XPATH, "//li[@class='token-input-token-facebook']/p") - __sent_message_page_to_user_delete_button = ( - By.XPATH, - "//span[@class='token-input-delete-token-facebook']", - ) - - # Preview Section - __new_message_preview_username = (By.XPATH, "//div[contains(@class, 'user from')]/a") - __new_message_preview_time = (By.XPATH, "//div[contains(@class, 'user from')]/time") - __new_message_preview_data_first_paragraph_content = (By.XPATH, "//div[@class='message']/p[1]") - __new_message_preview_data_first_paragraph_strong_content = ( - By.XPATH, - "//div[@class='message']/p[1]/strong", - ) - __new_message_preview_data_first_paragraph_italic_content = ( - By.XPATH, - "//div[@class='message']/p[1]/em", - ) - __new_message_numbered_list_items = (By.XPATH, "//div[@class='message']/ol/li") - __new_message_bulleted_list_items = (By.XPATH, "//div[@class='message']/ul/li") - __new_message_preview_external_link = (By.XPATH, "//a[contains(text(),'Test external link')]") - __new_message_preview_internal_link = (By.XPATH, "//a[contains(text(),'Test internal Link')]") - __new_message_preview_button = (By.XPATH, "//input[@id='preview-btn']") - - def __init__(self, driver: WebDriver): - super().__init__(driver) - - def get_text_of_test_data_first_paragraph_text(self) -> str: - return super()._get_text_of_element( - self.__new_message_preview_data_first_paragraph_content - ) - - def get_text_of_test_data_first_paragraph_strong_text(self) -> str: - return super()._get_text_of_element( - self.__new_message_preview_data_first_paragraph_strong_content - ) - - def get_text_of_test_data_first_paragraph_italic_text(self) -> str: - return super()._get_text_of_element( - self.__new_message_preview_data_first_paragraph_italic_content - ) - - def get_text_of_numbered_list_items(self) -> list[str]: - return super()._get_text_of_elements(self.__new_message_numbered_list_items) - - def get_text_of_bulleted_list_items(self) -> list[str]: - return super()._get_text_of_elements(self.__new_message_bulleted_list_items) - - def get_text_of_message_preview_username(self) -> str: - return super()._get_text_of_element(self.__new_message_preview_username) - - def get_user_to_text(self) -> str: - return super()._get_text_of_element(self.__sent_message_page_to_user_text) - - def get_new_message_page_header_text(self) -> str: - return super()._get_text_of_element(self.__new_message_page_header) - - # def _get_search_for_a_user_dropdown_text(self) -> str: - # return super()._get_text_of_element(self.__search_for_a_user_option) - - def get_characters_remaining_text(self) -> str: - return super()._get_text_of_element(self.__new_message_textarea_remaining_characters) - - def get_characters_remaining_text_color(self) -> str: - return super()._get_value_of_css_property( - self.__new_message_textarea_remaining_characters, "color" - ) - - def get_text_of_new_message_preview_section(self) -> str: - return super()._get_text_of_element(self.__new_message_preview_section_content) - - def get_text_of_search_result_bolded_character(self) -> str: - return super()._get_text_of_element(self.__new_message_search_results_bolded_characters) - - def get_tet_of_search_results_text(self) -> list[str]: - return super()._get_text_of_elements(self.__new_message_search_results_text) - - def click_on_username_to_delete_button(self): - super()._click(self.__sent_message_page_to_user_delete_button) - - def click_on_new_message_cancel_button(self): - super()._click(self.__new_message_cancel_button) - - def click_on_new_message_preview_button(self): - super()._click(self.__new_message_preview_button) - - def click_on_new_message_send_button(self): - super()._click(self.__new_message_send_button) - - def click_on_a_searched_user(self, username: str): - xpath = (By.XPATH, f"//div[@class='name_search']/b[contains(text(), '{username}')]") - super()._click(xpath) - - def click_on_preview_internal_link(self): - super()._click(self.__new_message_preview_internal_link) - - def type_into_new_message_to_input_field(self, text: str): - super()._type(self.__new_message_to_input_field, text) - - def type_into_new_message_body_textarea(self, text: str): - super()._type(self.__new_message_textarea_input_field, text) - - def is_message_preview_section_displayed(self) -> bool: - return super()._is_element_displayed(self.__new_message_preview_section) - - def is_message_preview_time_displayed(self) -> bool: - return super()._is_element_displayed(self.__new_message_preview_time) - - def is_new_message_preview_internal_link_test_data_displayed(self) -> bool: - return super()._is_element_displayed(self.__new_message_preview_internal_link) - - def is_new_message_preview_external_link_test_data_displayed(self) -> bool: - return super()._is_element_displayed(self.__new_message_preview_external_link) diff --git a/selenium_tests/pages/messaging_system_pages/sent_messages.py b/selenium_tests/pages/messaging_system_pages/sent_messages.py deleted file mode 100644 index 9d6ed08a0ab..00000000000 --- a/selenium_tests/pages/messaging_system_pages/sent_messages.py +++ /dev/null @@ -1,129 +0,0 @@ -from selenium.webdriver.common.by import By -from selenium.webdriver.remote.webdriver import WebDriver -from selenium_tests.core.base_page import BasePage - - -class SentMessagePage(BasePage): - __sent_messages_breadcrumbs = (By.XPATH, "//ol[@id='breadcrumbs']/li") - __sent_messages_page_header = (By.XPATH, "//h1[@class='sumo-page-subheading']") - __sent_messages_no_messages_message = (By.XPATH, "//article[@id='outbox']/p") - __sent_messages_delete_selected_button = ( - By.XPATH, - "//button[contains(text(), 'Delete Selected')]", - ) - __sent_messages_delete_page_delete_button = (By.XPATH, "//button[@name='delete']") - __sent_messages_delete_page_cancel_button = (By.XPATH, "//a[contains(text(), 'Cancel')]") - __sent_messages_page_message_banner_text = (By.XPATH, "//ul[@class='user-messages']/li/p") - __sent_message_page_message_banner_close_button = ( - By.XPATH, - "//ul[@class='user-messages']/li/button", - ) - __sent_messages = (By.XPATH, "//ol[@class='message-list']/li") - __sent_messages_delete_button = (By.XPATH, "//ol[@class='message-list']/li/a[@class='delete']") - - def __init__(self, driver: WebDriver): - super().__init__(driver) - - def get_sent_messages_page_deleted_banner_text(self) -> str: - return super()._get_text_of_element(self.__sent_messages_page_message_banner_text) - - def get_sent_messages_page_header(self) -> str: - return super()._get_text_of_element(self.__sent_messages_page_header) - - def get_sent_messages_no_message_text(self) -> str: - return super()._get_text_of_element(self.__sent_messages_no_messages_message) - - def get_sent_message_subject(self, username: str) -> str: - xpath = ( - By.XPATH, - f"//ol[@class='message-list']//a[contains(text()," - f"'{username}')]/ancestor::li/a[@class='read']", - ) - return super()._get_text_of_element(xpath) - - def click_on_sent_messages_page_banner_close_button(self): - super()._click(self.__sent_message_page_message_banner_close_button) - - def click_on_delete_selected_button(self): - super()._click(self.__sent_messages_delete_selected_button) - - def click_on_sent_message_delete_button(self, username: str): - xpath_to_hover = ( - By.XPATH, - f"//ol[@class='message-list']//a[contains(text(),'{username}')]", - ) - super()._mouseover_element(xpath_to_hover) - - xpath_delete_button = ( - By.XPATH, - f"//ol[@class='message-list']//a[contains(text(),'{username}')]/ancestor::li" - f"/a[@class='delete']", - ) - - super()._click(xpath_delete_button) - - def click_on_sent_message_sender_username(self, username: str): - xpath = (By.XPATH, f"//ol[@class='message-list']//a[contains(text(),'{username}')]") - super()._click(xpath) - - def click_on_sent_message_select_checkbox(self): - xpath = ( - By.XPATH, - "//ol[@class='message-list']//a/ancestor::li/div[contains(" - "@class, 'field checkbox no-label')]/label", - ) - super()._click(xpath) - - def click_on_sent_message_subject(self, username: str): - xpath = ( - By.XPATH, - f"//ol[@class='message-list']//a[contains(text(),'{username}')]/ancestor::li/a[" - f"@class='read']", - ) - super()._click(xpath) - - def click_on_delete_page_delete_button(self): - super()._click(self.__sent_messages_delete_page_delete_button) - - def click_on_delete_page_cancel_button(self): - super()._click(self.__sent_messages_delete_page_cancel_button) - - def is_sent_message_displayed(self, username: str) -> bool: - xpath = (By.XPATH, f"//ol[@class='message-list']//a[contains(text(),'{username}')]") - return super()._is_element_displayed(xpath) - - def is_sent_message_banner_displayed(self) -> bool: - return super()._is_element_displayed(self.__sent_messages_page_message_banner_text) - - def are_sent_messages_displayed(self) -> bool: - return super()._is_element_displayed(self.__sent_messages) - - def delete_all_displayed_sent_messages(self): - sent_messages = super()._find_elements(self.__sent_messages) - counter = 0 - for i in range(len(sent_messages), 0, -1): - sent_messages = super()._find_elements(self.__sent_messages) - element = sent_messages[counter] - super()._mouseover_web_element(element) - - sent_elements_delete_button = super()._find_elements( - self.__sent_messages_delete_button - ) - delete_button = sent_elements_delete_button[counter] - - super()._click_on_web_element(delete_button) - self.click_on_delete_page_delete_button() - - def delete_all_sent_messages_via_delete_selected_button(self): - inbox_messages_count = super()._find_elements(self.__sent_messages) - counter = 0 - for i in range(len(inbox_messages_count)): - self.click_on_sent_message_select_checkbox() - - inbox_elements_delete_button = super()._find_elements( - self.__sent_messages_delete_selected_button - ) - delete_button = inbox_elements_delete_button[counter] - - super()._click_on_web_element(delete_button) - self.click_on_delete_page_delete_button() diff --git a/selenium_tests/pages/pages.py b/selenium_tests/pages/pages.py deleted file mode 100644 index 6ddfec4d010..00000000000 --- a/selenium_tests/pages/pages.py +++ /dev/null @@ -1,111 +0,0 @@ -from selenium.webdriver.remote.webdriver import WebDriver - -from selenium_tests.flows.aaq_flows.aaq_flow import AAQFlow -from selenium_tests.flows.article_flows.add_kb_article_flow import AddKbArticleFlow -from selenium_tests.flows.auth_flows.auth_flow import AuthFlowPage -from selenium_tests.flows.messaging_system_flows.messaging_system_flow import MessagingSystemFlows -from selenium_tests.flows.user_profile_flows.edit_profile_data_flow import EditProfileDataFlow -from selenium_tests.pages.articles.kb_article_page import KBArticlePage -from selenium_tests.pages.articles.kb_article_show_history_page import KBArticleShowHistoryPage -from selenium_tests.pages.auth_page import AuthPage -from selenium_tests.pages.contact_support_pages.contact_support_page import ContactSupportPage -from selenium_tests.pages.contribute_pages.contribute_page import ContributePage -from selenium_tests.pages.contribute_pages.ways_to_contribute_pages import WaysToContributePages -from selenium_tests.pages.footer import FooterSection -from selenium_tests.pages.homepage import Homepage -from selenium_tests.pages.messaging_system_pages.inbox_page import InboxPage -from selenium_tests.pages.messaging_system_pages.mess_system_user_navbar import ( - MessagingSystemUserNavbar, -) -from selenium_tests.pages.messaging_system_pages.new_message import NewMessagePage -from selenium_tests.pages.messaging_system_pages.sent_messages import SentMessagePage -from selenium_tests.pages.product_solutions_pages.product_solutions_page import ( - ProductSolutionsPage, -) - -# from pages.search_result_page import SearchResultPage -from selenium_tests.pages.top_navbar import TopNavbar -from selenium_tests.pages.product_support_page import ProductSupportPage -from selenium_tests.pages.user_pages.my_profile_answers_page import MyProfileAnswersPage -from selenium_tests.pages.user_pages.my_profile_documents_page import MyProfileDocumentsPage -from selenium_tests.pages.user_pages.my_profile_edit import MyProfileEdit -from selenium_tests.pages.user_pages.my_profile_edit_contribution_areas_page import ( - MyProfileEditContributionAreasPage, -) -from selenium_tests.pages.user_pages.my_profile_edit_settings_page import MyProfileEditSettingsPage -from selenium_tests.pages.user_pages.my_profile_manage_watch_list_page import ( - MyProfileManageWatchListPage, -) -from selenium_tests.pages.user_pages.my_profile_my_questions_page import MyProfileMyQuestionsPage -from selenium_tests.pages.user_pages.my_profile_page import MyProfilePage -from selenium_tests.pages.user_pages.my_profile_user_navbar import UserNavbar -from selenium_tests.pages.user_questions_pages.questions_page import QuestionPage - - -class Pages: - def __init__(self, driver: WebDriver): - # Contribute pages - self.contribute_page = ContributePage(driver) - self.ways_to_contribute_pages = WaysToContributePages(driver) - - # Contact support page - self.contact_support_page = ContactSupportPage(driver) - - # Homepage - self.homepage = Homepage(driver) - - # Footer section - self.footer_section = FooterSection(driver) - - # Top-Navbar - self.top_navbar = TopNavbar(driver) - - # Questions pages - self.question_page = QuestionPage(driver) - - # Product solutions pages - self.product_solutions_page = ProductSolutionsPage(driver) - - # Profile pages - self.my_profile_page = MyProfilePage(driver) - self.edit_my_profile_page = MyProfileEdit(driver) - self.edit_my_profile_settings_page = MyProfileEditSettingsPage(driver) - self.edit_my_profile_con_areas_page = MyProfileEditContributionAreasPage(driver) - self.edit_my_profile_watch_list_page = MyProfileManageWatchListPage(driver) - self.my_questions_page = MyProfileMyQuestionsPage(driver) - self.my_answers_page = MyProfileAnswersPage(driver) - self.my_documents_page = MyProfileDocumentsPage(driver) - self.user_navbar = UserNavbar(driver) - - # Messaging system - self.sent_message_page = SentMessagePage(driver) - self.new_message_page = NewMessagePage(driver) - self.inbox_page = InboxPage(driver) - self.mess_system_user_navbar = MessagingSystemUserNavbar(driver) - - # Auth page - self.auth_page = AuthPage(driver) - - # Auth flow - self.auth_flow_page = AuthFlowPage(driver) - - # AAQ Flow - self.aaq_flow = AAQFlow(driver) - - # KB article Flow - self.submit_kb_article_flow = AddKbArticleFlow(driver) - - # Edit profile flow - self.edit_profile_flow = EditProfileDataFlow(driver) - - # Messaging system flow - self.messaging_system_flow = MessagingSystemFlows(driver) - - # Articles - self.kb_article_page = KBArticlePage(driver) - self.kb_article_show_history_page = KBArticleShowHistoryPage(driver) - - # Product Support Page - self.product_support_page = ProductSupportPage(driver) - - # self.search_results_page = SearchResultPage(driver) diff --git a/selenium_tests/pages/product_solutions_pages/product_solutions_page.py b/selenium_tests/pages/product_solutions_pages/product_solutions_page.py deleted file mode 100644 index 9f85db81a16..00000000000 --- a/selenium_tests/pages/product_solutions_pages/product_solutions_page.py +++ /dev/null @@ -1,38 +0,0 @@ -from selenium.webdriver.common.by import By -from selenium_tests.core.base_page import BasePage -from selenium.webdriver.remote.webdriver import WebDriver - - -class ProductSolutionsPage(BasePage): - __complete_progress_item = (By.XPATH, "//li[@class='progress--item is-complete']/a") - __complete_progress_item_label = ( - By.XPATH, - "//li[@class='progress--item is-complete']//span[" "@class='progress--label']", - ) - __current_progress_item = (By.XPATH, "//li[@class='progress--item is-current']/a") - __current_progress_item_label = ( - By.XPATH, - "//li[@class='progress--item is-current']//span[@class='progress--label']", - ) - __product_title_heading = (By.XPATH, "//span[@class='product-title-text']") - __product_solutions_find_help_searchbar = ( - By.XPATH, - "//form[@id='question-search-masthead']/input", - ) - __product_solutions_find_help_search_button = ( - By.XPATH, - "//form[@id='question-search-masthead']/button", - ) - __page_heading_intro_text = (By.XPATH, "//p[@class='page-heading--intro-text']") - __still_need_help_ask_now_button = (By.XPATH, "//a[@data-event-action='aaq']") - __featured_articles_cards = (By.XPATH, "//h2[contains(text(),'Featured Articles')]/../..//a") - __popular_topics_cards = (By.XPATH, "//h2[contains(text(),'Popular Topics')]/../..//a") - - def __init__(self, driver: WebDriver): - super().__init__(driver) - - def click_ask_now_button(self): - super()._click(self.__still_need_help_ask_now_button) - - def is_product_solutions_page_header_displayed(self): - super()._is_element_displayed(self.__product_title_heading) diff --git a/selenium_tests/pages/product_support_page.py b/selenium_tests/pages/product_support_page.py deleted file mode 100644 index 3fc89763e5a..00000000000 --- a/selenium_tests/pages/product_support_page.py +++ /dev/null @@ -1,16 +0,0 @@ -from selenium.webdriver.common.by import By -from selenium.webdriver.remote.webdriver import WebDriver -from selenium_tests.core.base_page import BasePage - - -class ProductSupportPage(BasePage): - __product_title = (By.XPATH, "//span[@class='product-title-text']") - - def __init__(self, driver: WebDriver): - super().__init__(driver) - - def get_product_title_text(self) -> str: - return super()._get_text_of_element(self.__product_title) - - def is_product_product_title_displayed(self) -> bool: - return super()._is_element_displayed(self.__product_title) diff --git a/selenium_tests/pages/top_navbar.py b/selenium_tests/pages/top_navbar.py deleted file mode 100644 index 2b43a20391a..00000000000 --- a/selenium_tests/pages/top_navbar.py +++ /dev/null @@ -1,134 +0,0 @@ -from selenium.webdriver.common.by import By -from selenium.webdriver.remote.webdriver import WebDriver -from selenium.webdriver.remote.webelement import WebElement -from selenium.common import TimeoutException -from selenium_tests.core.base_page import BasePage -import time - - -class TopNavbar(BasePage): - __menu_titles = ( - By.XPATH, - "//div[@id='main-navigation']//a[contains(@class,'mzp-c-menu-title')]", - ) - - __sumo_nav_logo = (By.XPATH, "//div[@class='sumo-nav--logo']/a/img") - __get_help_option = (By.XPATH, "//a[contains(text(),'Get Help')]") - __contribute_option = (By.XPATH, "//a[contains(text(),'Contribute')]") - __signin_signup_button = ( - By.XPATH, - "//div[@id='profile-navigation']//a[@data-event-label='Sign In']", - ) - __signed_in_username = (By.XPATH, "//span[@class='sumo-nav--username']") - - # Sub menu items ask a Question section - __ask_a_question_option = (By.XPATH, "//h4[contains(text(),'Ask a Question')]/parent::a") - __aaq_firefox_browser_option = ( - By.XPATH, - "//div[@id='main-navigation']//h4[contains(text(), 'Ask a " - "Question')]/../..//a[contains(text(),'Firefox Browser')]", - ) - - __signed_in_view_profile_option = ( - By.XPATH, - "//h4[contains(text(), 'View Profile')]/parent::a", - ) - __signed_in_edit_profile_option = (By.XPATH, "//a[contains(text(),'Edit Profile')]") - __signed_in_my_questions_option = (By.XPATH, "//a[contains(text(),'My Questions')]") - __signed_in_settings_option = (By.XPATH, "//h4[contains(text(), 'Settings')]/parent::a") - __signed_in_inbox_option = (By.XPATH, "//h4[contains(text(), 'Inbox')]/parent::a") - __sign_out_button = (By.XPATH, "//a[@data-event-label='Sign Out']") - - def __init__(self, driver: WebDriver): - super().__init__(driver) - - def get_available_menu_titles(self) -> list[str]: - return super()._get_text_of_elements(self.__menu_titles) - - def get_sumo_nav_logo(self) -> WebElement: - return super()._find_element(self.__sumo_nav_logo) - - def click_on_contribute_top_navbar_option(self): - super()._click(self.__contribute_option) - - def click_on_signin_signup_button(self): - super()._click(self.__signin_signup_button) - - def click_on_sumo_nav_logo(self): - super()._click(self.__sumo_nav_logo) - - def click_on_view_profile_option(self, max_attempts=3, poll_interval=1): - super()._press_home_keyboard_button() - for attempt in range(max_attempts): - try: - super()._mouseover_element(self.__signed_in_username) - super()._click(self.__signed_in_view_profile_option) - except TimeoutException as err: - print(err) - time.sleep(poll_interval) - - def click_on_edit_profile_option(self, max_attempts=3, poll_interval=1): - super()._press_home_keyboard_button() - for attempt in range(max_attempts): - try: - super()._mouseover_element(self.__signed_in_username) - super()._click(self.__signed_in_edit_profile_option) - except TimeoutException as err: - print(err) - time.sleep(poll_interval) - - def click_on_settings_profile_option(self, max_attempts=3, poll_interval=1): - super()._press_home_keyboard_button() - for attempt in range(max_attempts): - try: - super()._mouseover_element(self.__signed_in_username) - super()._click(self.__signed_in_settings_option) - except TimeoutException as err: - print(err) - time.sleep(poll_interval) - - def click_on_inbox_option(self, max_attempts=3, poll_interval=1): - super()._press_home_keyboard_button() - for attempt in range(max_attempts): - try: - super()._mouseover_element(self.__signed_in_username) - super()._click(self.__signed_in_inbox_option) - except TimeoutException as err: - print(err) - time.sleep(poll_interval) - - def click_on_sign_out_button(self, max_attempts=3, poll_interval=1): - super()._press_home_keyboard_button() - for attempt in range(max_attempts): - try: - super()._mouseover_element(self.__signed_in_username) - super()._click(self.__sign_out_button) - except TimeoutException as err: - print(err) - time.sleep(poll_interval) - - def click_on_my_questions_profile_option(self, max_attempts=3, poll_interval=1): - super()._press_home_keyboard_button() - for attempt in range(max_attempts): - try: - super()._mouseover_element(self.__signed_in_username) - super()._click(self.__signed_in_my_questions_option) - except TimeoutException as err: - print(err) - time.sleep(poll_interval) - - def click_on_ask_a_question_firefox_browser_option(self, max_attempts=3, poll_interval=1): - super()._press_home_keyboard_button() - for attempt in range(max_attempts): - try: - super()._mouseover_element(self.__get_help_option) - super()._click(self.__aaq_firefox_browser_option) - except TimeoutException as err: - print(err) - time.sleep(poll_interval) - - def get_text_of_logged_in_username(self) -> str: - return super()._get_text_of_element(self.__signed_in_username) - - def is_sign_in_up_button_displayed(self) -> bool: - return super()._is_element_displayed(self.__signin_signup_button) diff --git a/selenium_tests/pages/user_pages/my_profile_answers_page.py b/selenium_tests/pages/user_pages/my_profile_answers_page.py deleted file mode 100644 index 6f8fce463a3..00000000000 --- a/selenium_tests/pages/user_pages/my_profile_answers_page.py +++ /dev/null @@ -1,29 +0,0 @@ -from selenium.webdriver.common.by import By -from selenium_tests.core.base_page import BasePage -from selenium.webdriver.remote.webdriver import WebDriver - - -class MyProfileAnswersPage(BasePage): - __my_answers_page_header = (By.XPATH, "//h2[@class='sumo-page-subheading']") - __my_answers_question_subject_links = (By.XPATH, "//article[@id='profile']//li/a") - - def __init__(self, driver: WebDriver): - super().__init__(driver) - - def get_page_header(self) -> str: - return super()._get_text_of_element(self.__my_answers_page_header) - - def get_text_of_question_subjects(self) -> list[str]: - return super()._get_text_of_elements(self.__my_answers_question_subject_links) - - def click_on_specific_answer(self, answer_id: str): - xpath = (By.XPATH, f"//article[@id='profile']//a[contains(@href, '{answer_id}')]") - super()._click(xpath) - - def get_my_answer_text(self, answer_id: str) -> str: - xpath = ( - By.XPATH, - f"//article[@id='profile']//a[contains(@href, '{answer_id}')]/following" - f"-sibling::blockquote", - ) - return super()._get_text_of_element(xpath) diff --git a/selenium_tests/pages/user_pages/my_profile_documents_page.py b/selenium_tests/pages/user_pages/my_profile_documents_page.py deleted file mode 100644 index a716c5d96d3..00000000000 --- a/selenium_tests/pages/user_pages/my_profile_documents_page.py +++ /dev/null @@ -1,17 +0,0 @@ -from selenium.webdriver.common.by import By -from selenium.webdriver.remote.webdriver import WebDriver -from selenium_tests.core.base_page import BasePage - - -class MyProfileDocumentsPage(BasePage): - __documents_link_list = (By.XPATH, "//main//a") - - def __init__(self, driver: WebDriver): - super().__init__(driver) - - def click_on_a_particular_document(self, document_name: str): - xpath = (By.XPATH, f"//main//a[contains(text(),'{document_name}')]") - super()._click(xpath) - - def get_text_of_document_links(self) -> list[str]: - return super()._get_text_of_elements(self.__documents_link_list) diff --git a/selenium_tests/pages/user_pages/my_profile_edit.py b/selenium_tests/pages/user_pages/my_profile_edit.py deleted file mode 100644 index 15bd64c593c..00000000000 --- a/selenium_tests/pages/user_pages/my_profile_edit.py +++ /dev/null @@ -1,231 +0,0 @@ -from selenium.webdriver.common.by import By -from selenium.webdriver.remote.webdriver import WebDriver -from selenium_tests.core.base_page import BasePage -from selenium_tests.messages.my_profile_pages_messages.edit_my_profile_page_messages import ( - EditMyProfilePageMessages, -) - - -class MyProfileEdit(BasePage): - # Access denied section - __access_denied_main_header = (By.XPATH, "//article[@id='error-page']/h1") - __access_denied_subheading_message = (By.XPATH, "//div[@class='center-on-mobile']/p") - - # Navbar section - __my_profile_user_navbar_options = (By.XPATH, "//ul[@id='user-nav']/li/a") - __my_profile_user_navbar_selected_element = (By.XPATH, "//a[@class='selected']") - - # Edit profile page - __edit_my_profile_edit_input_form = (By.XPATH, "//article[@id='edit-profile']/form") - __edit_my_profile_main_header = (By.XPATH, "//h1[@class='sumo-page-heading']") - __manage_firefox_account_button = (By.XPATH, "//a[contains(text(),'Manage account')]") - __username_input_field = (By.XPATH, "//input[@id='id_username']") - __username_error_message = ( - By.XPATH, - "//input[@id='id_username']/following-sibling::span[contains(@class, " - "'form-error is-visible')]", - ) - __display_name_input_field = (By.XPATH, "//input[@id='id_name']") - __biography_textarea_field = (By.XPATH, "//textarea[@id='id_bio']") - __make_email_visible_to_logged_in_users_checkbox = ( - By.XPATH, - "//label[@for='id_public_email']", - ) - __website_input_field = (By.XPATH, "//input[@id='id_website']") - __twitter_username_field = (By.XPATH, "//input[@id='id_twitter']") - __community_portal_username_field = (By.XPATH, "//input[@id='id_community_mozilla_org']") - __people_directory_username_field = (By.XPATH, "//input[@id='id_people_mozilla_org']") - __matrix_nickname_field = (By.XPATH, "//input[@id='id_matrix_handle']") - __country_dropdown = (By.XPATH, "//select[@id='id_country']") - __city_field = (By.XPATH, "//input[@id='id_city']") - __timezone_dropdown = (By.XPATH, "//select[@id='id_timezone']") - __preferred_locale_dropdown = (By.XPATH, "//select[@id='id_locale']") - __involved_with_mozilla_from_month = (By.XPATH, "//select[@id='id_involved_from_month']") - __involved_with_mozilla_from_year = (By.XPATH, "//select[@id='id_involved_from_year']") - __cancel_button = (By.XPATH, "//button[contains(text(),'Cancel')]") - __update_my_profile_button = (By.XPATH, "//button[contains(text(),'Update My Profile')]") - __close_account_and_delete_all_profile_information_link = ( - By.XPATH, - "//p[@class='delete-account-link']/a", - ) - __all_input_edit_profile_input_fields = ( - By.XPATH, - "//form[not(contains(@action, " - "'/en-US/users/close_account'))]/div[@class='field']/input[" - "not(contains(@id, 'id_username'))]", - ) - - def __init__(self, driver: WebDriver): - super().__init__(driver) - - def get_access_denied_header_text(self) -> str: - return super()._get_text_of_element(self.__access_denied_main_header) - - def get_access_denied_subheading_text(self) -> str: - return super()._get_text_of_element(self.__access_denied_subheading_message) - - def get_value_of_all_input_fields(self) -> list[str]: - return super()._get_values_of_web_elements_attributes( - self.__all_input_edit_profile_input_fields - ) - - def get_timezone_select_value(self) -> str: - return super()._get_select_chosen_option(self.__timezone_dropdown) - - def get_preferred_locale_select_value(self) -> str: - return super()._get_select_chosen_option(self.__preferred_locale_dropdown) - - def get_involved_with_mozilla_month_select_value(self) -> str: - return super()._get_select_chosen_option(self.__involved_with_mozilla_from_month) - - def get_involved_with_mozilla_year_select_value(self) -> str: - return super()._get_select_chosen_option(self.__involved_with_mozilla_from_year) - - def get_value_of_all_fields(self) -> list[str]: - values = [ - self.get_value_of_all_input_fields(), - self.get_timezone_select_value(), - self.get_preferred_locale_select_value(), - self.get_involved_with_mozilla_month_select_value(), - self.get_involved_with_mozilla_year_select_value(), - ] - return values - - def get_username_input_field_value(self) -> str: - return super()._get_value_of_web_element_attribute(self.__username_input_field) - - def get_username_error_message_text(self) -> str: - return super()._get_text_of_element(self.__username_error_message) - - def get_display_name_input_field_value(self) -> str: - return super()._get_value_of_web_element_attribute(self.__display_name_input_field) - - def get_website_input_field_value(self) -> str: - return super()._get_value_of_web_element_attribute(self.__website_input_field) - - def get_twitter_input_field_value(self) -> str: - return super()._get_value_of_web_element_attribute(self.__twitter_username_field) - - def get_community_portal_field_value(self) -> str: - return super()._get_value_of_web_element_attribute(self.__community_portal_username_field) - - def get_people_directory_field_value(self) -> str: - return super()._get_value_of_web_element_attribute(self.__people_directory_username_field) - - def get_matrix_username_field_value(self) -> str: - return super()._get_value_of_web_element_attribute(self.__matrix_nickname_field) - - def get_city_field_value(self) -> str: - return super()._get_value_of_web_element_attribute(self.__city_field) - - def send_text_to_username_field(self, text: str): - super()._type(self.__username_input_field, text) - - def send_text_to_display_name_field(self, text: str): - super()._type(self.__display_name_input_field, text) - - def send_text_to_biography_field(self, text: str): - super()._type(self.__biography_textarea_field, text) - - def send_text_to_website_field(self, text: str): - super()._type(self.__website_input_field, text) - - def send_text_to_twitter_username_field(self, text: str): - super()._type(self.__twitter_username_field, text) - - def send_text_to_community_portal_field(self, text: str): - super()._type(self.__community_portal_username_field, text) - - def send_text_to_people_directory_username(self, text: str): - super()._type(self.__people_directory_username_field, text) - - def send_text_to_matrix_nickname_field(self, text: str): - super()._type(self.__matrix_nickname_field, text) - - def sent_text_to_city_field(self, text: str): - super()._type(self.__city_field, text) - - def select_country_dropdown_option_by_value(self, option_value: str): - super()._select_option_by_value(self.__country_dropdown, option_value) - - def select_timezone_dropdown_option_by_value(self, option_value: str): - super()._select_option_by_value(self.__timezone_dropdown, option_value) - - def select_preferred_language_dropdown_option_by_value(self, option_value: str): - super()._select_option_by_value(self.__preferred_locale_dropdown, option_value) - - def select_involved_with_mozilla_from_month_option_by_value(self, option_value: str): - super()._select_option_by_value(self.__involved_with_mozilla_from_month, option_value) - - def select_involved_with_mozilla_from_year_option_by_value(self, option_value: str): - super()._select_option_by_value(self.__involved_with_mozilla_from_year, option_value) - - def clear_all_input_fields(self): - for element in super()._find_elements(self.__all_input_edit_profile_input_fields): - element.clear() - - def clear_biography_textarea_field(self): - super()._find_element(self.__biography_textarea_field).clear() - - def clear_username_field(self): - super()._find_element(self.__username_input_field).clear() - - def clear_display_name_field(self): - super()._find_element(self.__display_name_input_field).clear() - - def clear_website_field(self): - super()._find_element(self.__website_input_field).clear() - - def clear_twitter_field(self): - super()._find_element(self.__twitter_username_field).clear() - - def clear_community_portal_field(self): - super()._find_element(self.__community_portal_username_field).clear() - - def clear_people_directory_field(self): - super()._find_element(self.__people_directory_username_field).clear() - - def clear_matrix_field(self): - super()._find_element(self.__matrix_nickname_field).clear() - - def clear_country_dropdown_field(self): - super()._select_option_by_value(self.__country_dropdown, "") - - def clear_city_field(self): - super()._find_element(self.__city_field).clear() - - def clear_involved_from_month_select_field(self): - super()._select_option_by_value(self.__involved_with_mozilla_from_month, "0") - - def clear_involved_from_year_select_field(self): - super()._select_option_by_value(self.__involved_with_mozilla_from_year, "0") - - def click_cancel_button(self): - super()._click(self.__cancel_button) - - def click_update_my_profile_button(self): - super()._click(self.__update_my_profile_button) - - def click_close_account_option(self): - super()._click(self.__close_account_and_delete_all_profile_information_link) - - def click_manage_firefox_account_button(self): - super()._click(self.__manage_firefox_account_button) - - def click_make_email_visible_checkbox(self): - super()._click(self.__make_email_visible_to_logged_in_users_checkbox) - - def is_make_email_visible_checkbox_selected(self) -> bool: - checkbox_background_color = super()._get_css_value_of_pseudo_html_element( - 'label[for="id_public_email"]', ":before", "background-color" - ) - if ( - checkbox_background_color - == EditMyProfilePageMessages.MAKE_EMAIL_ADDRESS_VISIBLE_PSEUDO_ELEMENT_CHECKBOX_COLOR - ): - return True - else: - return False - - def is_my_profile_edit_form_displayed(self) -> bool: - return super()._is_element_displayed(self.__edit_my_profile_edit_input_form) diff --git a/selenium_tests/pages/user_pages/my_profile_edit_contribution_areas_page.py b/selenium_tests/pages/user_pages/my_profile_edit_contribution_areas_page.py deleted file mode 100644 index e90c1891529..00000000000 --- a/selenium_tests/pages/user_pages/my_profile_edit_contribution_areas_page.py +++ /dev/null @@ -1,123 +0,0 @@ -from selenium.webdriver.common.by import By -from selenium.webdriver.remote.webdriver import WebDriver -from selenium_tests.core.base_page import BasePage - - -class MyProfileEditContributionAreasPage(BasePage): - __edit_contribution_areas_page_header = (By.XPATH, "//h3[@class='sumo-page-heading']") - __edit_contribution_areas_checkboxes = (By.XPATH, "//input[@type='checkbox']") - __edit_contribution_areas_kb_contributors = (By.XPATH, "//input[@value='kb-contributors']") - __edit_contribution_areas_l10n_contributors = (By.XPATH, "//input[@value='l10n-contributors']") - __edit_contribution_areas_forum_contributors = ( - By.XPATH, - "//input[@value='forum-contributors']", - ) - __edit_contribution_areas_social_media_contributors = ( - By.XPATH, - "//input[@value='social-contributors']", - ) - __edit_contribution_areas_mobile_support_contributors = ( - By.XPATH, - "//input[@value='mobile-contributors']", - ) - __edit_contribution_areas_checkbox_labels = ( - By.XPATH, - "//input[@type='checkbox']/parent::label", - ) - __edit_contribution_areas_update_button = ( - By.XPATH, - "//article[@id='edit-contributions']/form//button[" "@type='submit']", - ) - __edit_contribution_areas_preferences_saved_banner = ( - By.XPATH, - "//ul[@class='user-messages']/li", - ) - __edit_contribution_areas_preferences_saved_banner_text = ( - By.XPATH, - "//ul[@class='user-messages']/li/p", - ) - __edit_contribution_areas_preferences_saved_banner_close_button = ( - By.XPATH, - "//ul[@class='user-messages']/li/button", - ) - - def __init__(self, driver: WebDriver): - super().__init__(driver) - - def _get_edit_con_areas_pref_banner_txt(self) -> str: - return super()._get_text_of_element( - self.__edit_contribution_areas_preferences_saved_banner_text - ) - - def _get_edit_contribution_areas_page_header(self) -> str: - return super()._get_text_of_element(self.__edit_contribution_areas_page_header) - - def _get_all_contribution_areas_checkbox_labels(self) -> set[str]: - initial_list = set( - super()._get_text_of_elements(self.__edit_contribution_areas_checkbox_labels) - ) - normalized_list = set( - [ - item.lower() - .replace(" ", "-") - .replace("media", "") - .replace("support", "") - .replace("--", "-") - for item in initial_list - ] - ) - return normalized_list - - def _click_on_update_contribution_areas_button(self): - super()._click(self.__edit_contribution_areas_update_button) - - def _click_on_all_unchecked_cont_areas_checkboxes(self): - for checkbox in super()._find_elements(self.__edit_contribution_areas_checkboxes): - if not super()._is_web_element_selected(checkbox): - super()._click_on_web_element(checkbox) - - def _click_on_all_checked_cont_areas_checkboxes(self): - for checkbox in super()._find_elements(self.__edit_contribution_areas_checkboxes): - if super()._is_web_element_selected(checkbox): - super()._click_on_web_element(checkbox) - - def _click_on_edit_cont_pref_banner_close_button(self): - super()._click(self.__edit_contribution_areas_preferences_saved_banner_close_button) - - def _is_edit_cont_pref_banner_displayed(self) -> bool: - return super()._is_element_displayed( - self.__edit_contribution_areas_preferences_saved_banner - ) - - def _is_kb_contributors_checkbox_checked(self) -> bool: - return super()._is_element_selected(self.__edit_contribution_areas_kb_contributors) - - def _is_l10n_contributors_checkbox_checked(self) -> bool: - return super()._is_element_selected(self.__edit_contribution_areas_l10n_contributors) - - def _is_forum_contributors_checkbox_checked(self) -> bool: - return super()._is_element_selected(self.__edit_contribution_areas_forum_contributors) - - def _is_social_media_contributors_checkbox_checked(self) -> bool: - return super()._is_element_selected( - self.__edit_contribution_areas_social_media_contributors - ) - - def _is_mobile_support_contributors_checkbox_checked(self) -> bool: - return super()._is_element_selected( - self.__edit_contribution_areas_mobile_support_contributors - ) - - def _are_all_cont_pref_checkboxes_checked(self) -> bool: - is_checked = [ - self._is_kb_contributors_checkbox_checked(), - self._is_l10n_contributors_checkbox_checked(), - self._is_forum_contributors_checkbox_checked(), - self._is_social_media_contributors_checkbox_checked(), - self._is_mobile_support_contributors_checkbox_checked(), - ] - - if False in is_checked: - return False - else: - return True diff --git a/selenium_tests/pages/user_pages/my_profile_edit_settings_page.py b/selenium_tests/pages/user_pages/my_profile_edit_settings_page.py deleted file mode 100644 index a42750b51af..00000000000 --- a/selenium_tests/pages/user_pages/my_profile_edit_settings_page.py +++ /dev/null @@ -1,171 +0,0 @@ -from selenium.webdriver.common.by import By -from selenium.webdriver.remote.webdriver import WebDriver -from selenium_tests.core.base_page import BasePage -from selenium_tests.messages.my_profile_pages_messages.edit_settings_page_messages import ( - EditSettingsPageMessages, -) - - -class MyProfileEditSettingsPage(BasePage): - __edit_settings_page_header = (By.XPATH, "//h3[@class='sumo-page-heading']") - __edit_settings_checkbox_options_label = (By.XPATH, "//div[@class='field checkbox']/label") - __watch_forum_threads_I_start_checkbox = ( - By.XPATH, - "//input[@id='id_forums_watch_new_thread']/following-sibling" "::label", - ) - __watch_forum_threads_I_comment_in_checkbox = ( - By.XPATH, - "//input[@id='id_forums_watch_after_reply']/following" "-sibling::label", - ) - __watch_kb_discussions_threads_I_start_checkbox = ( - By.XPATH, - "//input[@id='id_kbforums_watch_new_thread" "']/following-sibling::label", - ) - __watch_kb_discussion_threads_I_comment_in_checkbox = ( - By.XPATH, - "//input[@id='id_kbforums_watch_after_reply" "']/following-sibling::label", - ) - __watch_question_threads_I_comment_in_checkbox = ( - By.XPATH, - "//input[@id='id_questions_watch_after_reply" "']/following-sibling::label", - ) - __send_emails_for_private_messages_checkbox = ( - By.XPATH, - "//input[@id='id_email_private_messages']/following" "-sibling::label", - ) - __edit_settings_update_button = ( - By.XPATH, - "//article[@id='edit-settings']/form//button[@type='submit']", - ) - __your_settings_have_been_saved_notification_banner = ( - By.XPATH, - "//ul[@class='user-messages']//li", - ) - __your_settings_have_been_saved_notification_banner_text = ( - By.XPATH, - "//ul[@class='user-messages']//li/p", - ) - __your_settings_have_been_saved_notification_banner_close_button = ( - By.XPATH, - "//ul[@class='user-messages']//button", - ) - __my_profile_user_navbar = (By.XPATH, "//ul[@id='user-nav']/li") - __my_profile_user_navbar_selected_element = (By.XPATH, "//a[@class='selected']") - - def __init__(self, driver: WebDriver): - super().__init__(driver) - - def get_edit_settings_page_header(self) -> str: - return super()._get_text_of_element(self.__edit_settings_page_header) - - def get_text_of_checkbox_options(self) -> list[str]: - return super()._get_text_of_elements(self.__edit_settings_checkbox_options_label) - - def get_settings_saved_notif_banner_text(self) -> str: - return super()._get_text_of_element( - self.__your_settings_have_been_saved_notification_banner_text - ) - - def click_settings_saved_notification_banner(self): - super()._click(self.__your_settings_have_been_saved_notification_banner_close_button) - - def click_on_all_settings_checkboxes(self): - for checkbox in super()._find_elements(self.__edit_settings_checkbox_options_label): - super()._click_on_web_element(checkbox) - - def click_on_watch_forum_threads_i_start_checkbox(self): - super()._click(self.__watch_forum_threads_I_start_checkbox) - - def click_on_watch_forum_threads_i_comment_in_checkbox(self): - super()._click(self.__watch_forum_threads_I_comment_in_checkbox) - - def click_on_watch_kb_discussions_threads_i_start_checkbox(self): - super()._click(self.__watch_kb_discussions_threads_I_start_checkbox) - - def click_on_watch_kb_discussions_threads_i_comment_checkbox(self): - super()._click(self.__watch_kb_discussion_threads_I_comment_in_checkbox) - - def click_on_watch_question_threads_i_comment(self): - super()._click(self.__watch_question_threads_I_comment_in_checkbox) - - def click_on_send_emails_for_private_messages(self): - super()._click(self.__send_emails_for_private_messages_checkbox) - - def click_on_update_button(self): - super()._click(self.__edit_settings_update_button) - - def is_watch_forum_threads_i_start_checkbox_checked(self) -> bool: - checkbox_background_color = super()._get_css_value_of_pseudo_html_element( - "label[" 'for="id_forums_watch_new_thread"]', ":before", "background-color" - ) - if checkbox_background_color == EditSettingsPageMessages.CHECKBOX_CHECKED_COLOR: - return True - else: - return False - - def is_watch_forum_threads_i_comment_checkbox_checked(self) -> bool: - checkbox_background_color = super()._get_css_value_of_pseudo_html_element( - "label[" 'for="id_forums_watch_after_reply"]', ":before", "background-color" - ) - if checkbox_background_color == EditSettingsPageMessages.CHECKBOX_CHECKED_COLOR: - return True - else: - return False - - def is_watch_kb_discussion_threads_i_start_checkbox_checked(self) -> bool: - checkbox_background_color = super()._get_css_value_of_pseudo_html_element( - "label[" 'for="id_kbforums_watch_new_thread"]', ":before", "background-color" - ) - if checkbox_background_color == EditSettingsPageMessages.CHECKBOX_CHECKED_COLOR: - return True - else: - return False - - def is_watch_kb_discussion_threads_i_comment_checkbox_checked(self) -> bool: - checkbox_background_color = super()._get_css_value_of_pseudo_html_element( - "label[" 'for="id_kbforums_watch_after_reply"]', ":before", "background-color" - ) - if checkbox_background_color == EditSettingsPageMessages.CHECKBOX_CHECKED_COLOR: - return True - else: - return False - - def is_watch_question_threads_i_comment_checkbox_checked(self) -> bool: - checkbox_background_color = super()._get_css_value_of_pseudo_html_element( - "label[" 'for="id_questions_watch_after_reply"]', ":before", "background-color" - ) - if checkbox_background_color == EditSettingsPageMessages.CHECKBOX_CHECKED_COLOR: - return True - else: - return False - - def is_send_emails_for_private_messages_checkbox_checked(self) -> bool: - checkbox_background_color = super()._get_css_value_of_pseudo_html_element( - "label[" 'for="id_email_private_messages"]', ":before", "background-color" - ) - if checkbox_background_color == EditSettingsPageMessages.CHECKBOX_CHECKED_COLOR: - return True - else: - return False - - def is_notification_banner_displayed(self) -> bool: - return super()._is_element_displayed( - self.__your_settings_have_been_saved_notification_banner - ) - - def are_all_checkbox_checked(self) -> bool: - is_checked = [ - self.is_watch_forum_threads_i_start_checkbox_checked(), - self.is_watch_forum_threads_i_comment_checkbox_checked(), - self.is_watch_kb_discussion_threads_i_start_checkbox_checked(), - self.is_watch_kb_discussion_threads_i_comment_checkbox_checked(), - self.is_watch_question_threads_i_comment_checkbox_checked(), - self.is_watch_question_threads_i_comment_checkbox_checked(), - self.is_watch_question_threads_i_comment_checkbox_checked(), - self.is_send_emails_for_private_messages_checkbox_checked(), - ] - - if False in is_checked: - return False - else: - return True diff --git a/selenium_tests/pages/user_pages/my_profile_manage_watch_list_page.py b/selenium_tests/pages/user_pages/my_profile_manage_watch_list_page.py deleted file mode 100644 index e06d8511404..00000000000 --- a/selenium_tests/pages/user_pages/my_profile_manage_watch_list_page.py +++ /dev/null @@ -1,12 +0,0 @@ -from selenium.webdriver.common.by import By -from selenium.webdriver.remote.webdriver import WebDriver -from selenium_tests.core.base_page import BasePage - - -class MyProfileManageWatchListPage(BasePage): - __my_profile_user_navbar = (By.XPATH, "//ul[@id='user-nav']/li") - __my_profile_user_navbar_selected_element = (By.XPATH, "//a[@class='selected']") - __my_profile_manage_watch_list_page_heading = (By.XPATH, "//h1[@class='sumo-page-heading']") - - def __init__(self, driver: WebDriver): - super().__init__(driver) diff --git a/selenium_tests/pages/user_pages/my_profile_my_questions_page.py b/selenium_tests/pages/user_pages/my_profile_my_questions_page.py deleted file mode 100644 index fd2273d5768..00000000000 --- a/selenium_tests/pages/user_pages/my_profile_my_questions_page.py +++ /dev/null @@ -1,33 +0,0 @@ -from selenium.webdriver.common.by import By -from selenium.webdriver.remote.webdriver import WebDriver -from selenium_tests.core.base_page import BasePage - - -class MyProfileMyQuestionsPage(BasePage): - __my_profile_my_questions_page_heading = (By.XPATH, "//h2[@class='sumo-page-subheading']") - __my_profile_my_questions_no_question_message = (By.XPATH, "//article[@id='profile']/p") - __my_profile_my_questions_list = (By.XPATH, "//article[@id='profile']/ul/a") - __my_profile_my_questions_titles = (By.XPATH, "//article[@id='profile']/ul/a/li") - - def __init__(self, driver: WebDriver): - super().__init__(driver) - - def is_question_list_displayed(self) -> bool: - return super()._is_element_displayed(self.__my_profile_my_questions_list) - - def is_no_question_message_displayed(self) -> bool: - return super()._is_element_displayed(self.__my_profile_my_questions_no_question_message) - - def get_text_of_no_question_message(self) -> str: - return super()._get_text_of_element(self.__my_profile_my_questions_no_question_message) - - def get_number_of_questions(self) -> int: - return super()._get_number_of_elements(self.__my_profile_my_questions_list) - - def click_on_a_question_by_index(self, index_of_question: int): - xpath = (By.XPATH, f"//article[@id='profile']/ul/a[{index_of_question}]/li") - super()._click(xpath) - - def get_text_of_first_listed_question(self) -> str: - xpath = (By.XPATH, "//article[@id='profile']/ul/a[1]") - return super()._get_text_of_element(xpath) diff --git a/selenium_tests/pages/user_pages/my_profile_my_subscriptions.py b/selenium_tests/pages/user_pages/my_profile_my_subscriptions.py deleted file mode 100644 index ce2c76e2dad..00000000000 --- a/selenium_tests/pages/user_pages/my_profile_my_subscriptions.py +++ /dev/null @@ -1,11 +0,0 @@ -from selenium.webdriver.common.by import By -from selenium.webdriver.remote.webdriver import WebDriver -from selenium_tests.core.base_page import BasePage - - -class MyProfileMySubscriptions(BasePage): - __my_profile_user_navbar_options = (By.XPATH, "//ul[@id='user-nav']/li/a") - __my_profile_user_navbar_selected_element = (By.XPATH, "//a[@class='selected']") - - def __init__(self, driver: WebDriver): - super().__init__(driver) diff --git a/selenium_tests/pages/user_pages/my_profile_page.py b/selenium_tests/pages/user_pages/my_profile_page.py deleted file mode 100644 index 7fc1ae2fd0a..00000000000 --- a/selenium_tests/pages/user_pages/my_profile_page.py +++ /dev/null @@ -1,246 +0,0 @@ -from selenium.webdriver.common.by import By -from selenium.webdriver.remote.webelement import WebElement -from selenium.webdriver.remote.webdriver import WebDriver -from selenium_tests.core.base_page import BasePage - - -class MyProfilePage(BasePage): - # Sidebar - __my_profile_user_navbar_options = (By.XPATH, "//ul[@id='user-nav']/li/a") - __my_profile_user_navbar_selected_element = (By.XPATH, "//a[@class='selected']") - - # Admin/other user actions - __edit_user_profile_option = ( - By.XPATH, - "//div[@id='admin-actions']/a[contains(text(), 'Edit user profile')]", - ) - __report_abuse_profile_option = ( - By.XPATH, - "//article[@id='profile']/a[contains(text(), 'Report Abuse')]", - ) - __deactivate_this_user_button = (By.XPATH, "//input[@value='Deactivate this user']") - __deactivate_this_user_and_mark_all_content_as_spam = ( - By.XPATH, - "//input[@value='Deactivate this user and mark " "all content as spam']", - ) - __private_message_button = (By.XPATH, "//p[@class='pm']/a") - - # Report Abuse - __report_abuse_panel = (By.XPATH, "//section[@id='report-abuse']") - __spam_or_other_unrelated_content_option = ( - By.XPATH, - "//label[contains(text(),'Spam or other unrelated content')]", - ) - __inappropriate_language_or_dialog_option = ( - By.XPATH, - "//label[contains(text(),'Inappropriate language/dialog')]", - ) - __other_please_specify_option = ( - By.XPATH, - "//label[contains(text(),'Other (please specify)')]", - ) - __have_more_to_say_textarea = (By.XPATH, "//textarea[@name='other']") - __report_abuse_close_panel_button = (By.XPATH, "//div[@class='mzp-c-modal-close']/button") - __report_abuse_submit_button = ( - By.XPATH, - "//section[@id='report-abuse']//button[@type='submit']", - ) - __reported_user_confirmation_message = (By.XPATH, "//span[@class='message']") - - # Contributions section - __my_profile_contributions_questions_link = ( - By.XPATH, - "//section[@class='contributions']//a[contains(text(), " "'question')]", - ) - __my_profile_contributions_answers_link = ( - By.XPATH, - "//section[@class='contributions']//a[contains(text(), " "'answer')]", - ) - __my_profile_provided_solutions_text = ( - By.XPATH, - "//section[@class='contributions']//li[contains(text(),'solution')]", - ) - - __my_profile_provided_documents_link = ( - By.XPATH, - "//section[@class='contributions']//a[contains(text(),'document')]", - ) - - # My Profile page details - __my_profile_page_header = (By.XPATH, "//h1[@class='sumo-page-heading']") - __my_profile_page_subheading = ( - By.XPATH, - "//article[@id='profile']/h2[contains(@class, 'sumo-page-subheading')]", - ) - __my_profile_email_address = (By.XPATH, "//p/strong") - __my_profile_displayed_email_address = ( - By.XPATH, - "//li[@class='avatar-group--details-item']/span[@class='email']/a", - ) - __my_profile_sign_out_button = ( - By.XPATH, - "//article[@id='profile']//a[@data-event-label='Sign Out']", - ) - __my_profile_display_name_header = (By.XPATH, "//h2[@class='sumo-callout-heading user']") - __my_profile_username_info = (By.XPATH, "//span[@class='username']") - __my_profile_location_info = (By.XPATH, "//h2[contains(@class,'location')]") - __my_profile_website_info = ( - By.XPATH, - "//label[contains(text(), 'Website')]/following-sibling::a", - ) - __my_profile_twitter_info = ( - By.XPATH, - "//label[contains(text(), 'Twitter')]/following-sibling::a", - ) - __my_profile_community_portal_info = ( - By.XPATH, - "//label[contains(text(), 'Community Portal')]/following-sibling::a", - ) - __my_profile_people_directory_info = ( - By.XPATH, - "//label[contains(text(), 'People Directory')]/following-sibling::a", - ) - __my_profile_matrix_info = (By.XPATH, "//label[contains(text(),'Matrix')]/parent::li") - __my_profile_contributed_from_info = (By.XPATH, "//section[@class='contributions']//li[1]") - __my_profile_bio_info = (By.XPATH, "//section[@class='bio']/p") - __my_profile_groups_section = (By.XPATH, "//section[@class='groups']") - __my_profile_groups_heading = (By.XPATH, "//section[@class='groups']/h2") - __my_profile_groups_list_items = (By.XPATH, "//section[@class='groups']/ul/li") - - def __init__(self, driver: WebDriver): - super().__init__(driver) - - def get_my_profile_display_name_header_text(self) -> str: - return super()._get_text_of_element(self.__my_profile_display_name_header) - - def get_my_profile_display_name_username_text(self) -> str: - return super()._get_text_of_element(self.__my_profile_username_info) - - def get_my_profile_location_text(self) -> str: - return super()._get_text_of_element(self.__my_profile_location_info) - - def get_my_profile_website_text(self) -> str: - return super()._get_text_of_element(self.__my_profile_website_info) - - def get_my_profile_twitter_text(self) -> str: - return super()._get_text_of_element(self.__my_profile_twitter_info) - - def get_my_profile_community_portal_text(self) -> str: - return super()._get_text_of_element(self.__my_profile_community_portal_info) - - def get_my_profile_people_directory_text(self) -> str: - return super()._get_text_of_element(self.__my_profile_people_directory_info) - - def get_my_profile_matrix_text(self) -> str: - return super()._get_text_of_element(self.__my_profile_matrix_info) - - def get_my_contributed_from_text(self) -> str: - return super()._get_text_of_element(self.__my_profile_contributed_from_info) - - def get_my_profile_bio_text(self) -> str: - return super()._get_text_of_element(self.__my_profile_bio_info) - - def get_my_profile_page_header(self) -> str: - return super()._get_text_of_element(self.__my_profile_page_header) - - def get_my_profile_email_information(self) -> str: - return super()._get_text_of_element(self.__my_profile_email_address) - - def get_text_of_selected_navbar_option(self) -> str: - return super()._get_text_of_element(self.__my_profile_user_navbar_selected_element) - - def get_navbar_menu_options(self) -> list[WebElement]: - return super()._find_elements(self.__my_profile_user_navbar_options) - - def get_text_of_all_navbar_menu_options(self) -> list[str]: - return super()._get_text_of_elements(self.__my_profile_user_navbar_options) - - def get_text_of_publicly_displayed_username(self) -> str: - return super()._get_text_of_element(self.__my_profile_displayed_email_address) - - def get_text_of_profile_subheading_location(self) -> str: - return super()._get_text_of_element(self.__my_profile_page_subheading) - - def get_my_profile_questions_text(self) -> str: - return super()._get_text_of_element(self.__my_profile_contributions_questions_link) - - def get_my_profile_solutions_text(self) -> str: - return super()._get_text_of_element(self.__my_profile_provided_solutions_text) - - def get_my_profile_documents_text(self) -> str: - return super()._get_text_of_element(self.__my_profile_provided_documents_link) - - def get_my_profile_answers_text(self) -> str: - return super()._get_text_of_element(self.__my_profile_contributions_answers_link) - - def get_my_profile_groups_heading_text(self) -> str: - return super()._get_text_of_element(self.__my_profile_groups_heading) - - def get_my_profile_groups_items_text(self) -> set[str]: - initial_list = set(super()._get_text_of_elements(self.__my_profile_groups_list_items)) - return initial_list - - def click_on_edit_user_profile_button(self): - super()._click(self.__edit_user_profile_option) - - def click_my_profile_answers_link(self): - super()._click(self.__my_profile_contributions_answers_link) - - def click_on_my_profile_questions_link(self): - super()._click(self.__my_profile_contributions_questions_link) - - def click_on_my_profile_document_link(self): - super()._click(self.__my_profile_provided_documents_link) - - def click_on_my_website_link(self): - super()._click(self.__my_profile_website_info) - - def click_on_twitter_link(self): - super()._click(self.__my_profile_twitter_info) - - def click_on_community_portal_link(self): - super()._click(self.__my_profile_community_portal_info) - - def click_on_people_directory_link(self): - super()._click(self.__my_profile_people_directory_info) - - def click_on_element(self, element: WebElement): - super()._click_on_web_element(element) - - def click_my_profile_page_sign_out_button(self): - super()._click(self.__my_profile_sign_out_button) - - def click_on_report_abuse_option(self): - super()._click(self.__report_abuse_profile_option) - - def click_on_report_abuse_close_button(self): - super()._click(self.__report_abuse_close_panel_button) - - def click_on_private_message_button(self): - super()._click(self.__private_message_button) - - def is_publicly_displayed_email_displayed(self) -> bool: - return super()._is_element_displayed(self.__my_profile_displayed_email_address) - - def is_website_information_displayed(self) -> bool: - return super()._is_element_displayed(self.__my_profile_website_info) - - def is_groups_section_displayed(self) -> bool: - return super()._is_element_displayed(self.__my_profile_groups_section) - - def is_edit_user_profile_option_displayed(self) -> bool: - return super()._is_element_displayed(self.__edit_user_profile_option) - - def is_report_user_option_displayed(self) -> bool: - return super()._is_element_displayed(self.__report_abuse_profile_option) - - def is_report_abuse_panel_displayed(self) -> bool: - return super()._is_element_displayed(self.__report_abuse_panel) - - def is_deactivate_this_user_button_displayed(self) -> bool: - return super()._is_element_displayed(self.__deactivate_this_user_button) - - def is_deactivate_this_user_and_mark_content_as_spam_displayed(self) -> bool: - return super()._is_element_displayed( - self.__deactivate_this_user_and_mark_all_content_as_spam - ) diff --git a/selenium_tests/pages/user_pages/my_profile_user_navbar.py b/selenium_tests/pages/user_pages/my_profile_user_navbar.py deleted file mode 100644 index c1aa0eb60ba..00000000000 --- a/selenium_tests/pages/user_pages/my_profile_user_navbar.py +++ /dev/null @@ -1,46 +0,0 @@ -from selenium.webdriver.common.by import By -from selenium.webdriver.remote.webdriver import WebDriver -from selenium_tests.core.base_page import BasePage - - -class UserNavbar(BasePage): - __my_profile_option = (By.XPATH, "//ul[@id='user-nav']//a[contains(text(), 'My profile')]") - __edit_my_profile_option = ( - By.XPATH, - "//ul[@id='user-nav']//a[contains(text(),'Edit my profile')]", - ) - __edit_my_profile_settings_option = ( - By.XPATH, - "//ul[@id='user-nav']//a[contains(text(),'Edit settings')]", - ) - __edit_my_profile_contribution_areas_option = ( - By.XPATH, - "//ul[@id='user-nav']//a[contains(text(),'Edit " "contribution areas')]", - ) - __edit_my_profile_manage_watch_list_option = ( - By.XPATH, - "//ul[@id='user-nav']//a[contains(text(),'Manage watch " "list')]", - ) - __edit_my_profile_my_questions_option = ( - By.XPATH, - "//ul[@id='user-nav']//a[contains(text(),'My questions')]", - ) - - def __init__(self, driver: WebDriver): - super().__init__(driver) - - def click_on_my_profile_option(self): - super()._mouseover_element(self.__my_profile_option) - super()._click(self.__my_profile_option) - - def click_on_edit_my_profile_option(self): - super()._mouseover_element(self.__edit_my_profile_option) - super()._click(self.__edit_my_profile_option) - - def click_on_edit_contribution_areas_option(self): - super()._mouseover_element(self.__edit_my_profile_contribution_areas_option) - super()._click(self.__edit_my_profile_contribution_areas_option) - - def click_on_my_questions_option(self): - super()._mouseover_element(self.__edit_my_profile_my_questions_option) - super()._click(self.__edit_my_profile_my_questions_option) diff --git a/selenium_tests/pages/user_questions_pages/aaq_form_page.py b/selenium_tests/pages/user_questions_pages/aaq_form_page.py deleted file mode 100644 index 16e64b5ce59..00000000000 --- a/selenium_tests/pages/user_questions_pages/aaq_form_page.py +++ /dev/null @@ -1,115 +0,0 @@ -from selenium.webdriver.common.by import By -from selenium.webdriver.remote.webdriver import WebDriver -from selenium_tests.core.base_page import BasePage - - -class AAQFormPage(BasePage): - __uploaded_image_title = "" - - __complete_progress_items = (By.XPATH, "//li[@class='progress--item is-complete']/a") - __complete_progress_items_labels = ( - By.XPATH, - "//li[@class='progress--item is-complete']//span[" "@class='progress--label']", - ) - __in_progress_item_label = ( - By.XPATH, - "//li[@class='progress--item is-current']//span[@class='progress--label']", - ) - __aaq_page_heading = (By.XPATH, "//h2[@class='sumo-page-heading']") - __aaq_page_intro_text = (By.XPATH, "//form[@id='question-form']/p[@class='sumo-page-intro']") - __aaq_page_info_card = (By.XPATH, "//div[contains(@class, 'info card')]") - - # AAQ Subject - __aaq_subject_input_field = (By.XPATH, "//input[@id='id_title']") - __aaq_subject_input_field_error_message = ( - By.XPATH, - "//input[@id='id_title']/../ul[@class='errorlist']/li", - ) - - # Product topic dropdown - __product_topic_select_dropdown = (By.XPATH, "//select[@id='id_category']") - __product_topic_select_dropdown_error_message = ( - By.XPATH, - "//select[@id='id_category']/../ul[@class='errorlist']/li", - ) - - # How can we help textarea field - __how_can_we_help_textarea = (By.XPATH, "//textarea[@id='id_content']") - __how_can_we_help_textarea_error_field = ( - By.XPATH, - "//textarea[@id='id_content']/../following-sibling::ul/li", - ) - - # Add Image - __add_image_browse_button = (By.XPATH, "//input[@id='id_image']") - __uploaded_test_image_preview = (By.XPATH, f"//img[@title='{__uploaded_image_title}']") - __uploaded_test_image_delete_button = ( - By.XPATH, - "//form[@class='upload-input']/input[@class='delete']", - ) - __uploaded_image = (By.XPATH, "//a[@class='image']/img") - # Email me when someone answers the thread checkbox - __email_me_checkbox = (By.XPATH, "//input[@id='id_notifications']") - - # form buttons - __form_submit_button = (By.XPATH, "//button[contains(text(), 'Submit')]") - __form_cancel_option = (By.XPATH, "//a[contains(text(),'Cancel')]") - - # Learn more button - - def __init__(self, driver: WebDriver): - super().__init__(driver) - - def get_complete_progress_item_labels(self) -> list[str]: - return super()._get_text_of_elements(self.__complete_progress_items_labels) - - def get_in_progress_item_label(self) -> str: - return super()._get_text_of_element(self.__in_progress_item_label) - - def get_aaq_form_page_heading(self) -> str: - return super()._get_text_of_element(self.__aaq_page_heading) - - def get_aaq_form_page_intro_text(self) -> str: - return super()._get_text_of_element(self.__aaq_page_intro_text) - - def get_aaq_form_info_card_text(self) -> str: - return super()._get_text_of_element(self.__aaq_page_info_card) - - def get_aaq_form_subject_error(self) -> str: - return super()._get_text_of_element(self.__aaq_subject_input_field_error_message) - - def get_aaq_form_topic_select_error(self) -> str: - return super()._get_text_of_element(self.__product_topic_select_dropdown_error_message) - - def add_text_to_aaq_form_subject_field(self, text: str): - super()._type(self.__aaq_subject_input_field, text) - - def select_aaq_form_topic_value(self, value: str): - super()._select_option_by_value(self.__product_topic_select_dropdown, value) - - def add_text_to_aaq_textarea_field(self, text: str): - super()._type(self.__how_can_we_help_textarea, text) - - def attach_image_to_question(self, image_path: str, image_title: str): - self.__uploaded_image_title = image_title - super()._upload_jpg_image(locator=self.__add_image_browse_button, path_to_image=image_path) - - def is_image_preview_displayed(self) -> bool: - return super()._is_element_displayed(self.__uploaded_test_image_preview) - - def is_uploaded_image_displayed(self) -> bool: - return super()._is_element_displayed(self.__uploaded_image) - - def click_on_email_me_when_someone_answers_the_thread_checkbox(self): - super()._click(self.__email_me_checkbox) - - def click_aaq_form_cancel_button(self): - super()._click(self.__form_cancel_option) - - def click_aaq_form_submit_button(self): - super()._click(self.__form_submit_button) - - def delete_uploaded_image(self): - super()._mouseover_element(self.__uploaded_image) - super()._click(self.__uploaded_test_image_delete_button) - super()._accept_alert() diff --git a/selenium_tests/pages/user_questions_pages/questions_page.py b/selenium_tests/pages/user_questions_pages/questions_page.py deleted file mode 100644 index 7f3faf8460b..00000000000 --- a/selenium_tests/pages/user_questions_pages/questions_page.py +++ /dev/null @@ -1,117 +0,0 @@ -from selenium.webdriver.common.by import By -from selenium_tests.core.base_page import BasePage -from selenium.webdriver.remote.webdriver import WebDriver - - -class QuestionPage(BasePage): - # "Posted successfully" green banner - __posted_questions_success_banner_message = (By.XPATH, "//ul[@class='user-messages']/li/p") - __posted_questions_success_banner_my_questions_link = ( - By.XPATH, - "//ul[@class='user-messages']/li/p/a", - ) - __posted_questions_success_banner_close_button = ( - By.XPATH, - "//ul[@class='user-messages']/li/button", - ) - - # Question - __question_author = (By.XPATH, "//div[@class='question']//span[@class='display-name']") - - # Progress bar - __complete_progress_items_label = ( - By.XPATH, - "//li[@class='progress--item is-complete']//span[@class='progress--label']", - ) - - # Breadcrumbs - __aaq_page_breadcrumbs = (By.XPATH, "//ol[@id='breadcrumbs']/li") - - # Question details - __questions_header = (By.XPATH, "//article//h2") - - # Searchbar - __search_support_searchbar = (By.XPATH, "//form[@id='support-search-sidebar']/input") - __search_support_search_button = (By.XPATH, "//form[@id='support-search-sidebar']/button") - - # Still need help widget - __still_need_help_ask_now_button = (By.XPATH, "//a[@data-event-label='aaq widget']") - - # Question Tools - __edit_this_question_option = (By.XPATH, "//ul[@id='related-content']/li[@class='edit']/a") - __stop_email_updates_option = (By.XPATH, "//ul[@id='related-content']/li[@class='email']/a") - __subscribe_to_feed_option = (By.XPATH, "//ul[@id='related-content']/li[@class='rss']/a") - __delete_this_question_option = (By.XPATH, "//ul[@id='related-content']//a[@class='delete']") - - # Tags section - __question_tags_options = (By.XPATH, "//li[@class='tag']/a") - - # Post a reply section - __post_a_reply_section_heading = (By.XPATH, "//h3[@class='sumo-card-heading']") - __post_a_reply_textarea = (By.XPATH, "//textarea[@id='id_content']") - __post_a_reply_textarea_bold_button = (By.XPATH, "//button[@title='Bold']") - __post_a_reply_textarea_italic_button = (By.XPATH, "//button[@title='Italic']") - __post_a_reply_textarea_link_button = (By.XPATH, "//button[@title='Insert a link...']") - __post_a_reply_textarea_numbered_list_button = (By.XPATH, "//button[@title='Numbered List']") - __post_a_reply_textarea_bulleted_list_button = (By.XPATH, "//button[@title='Bulleted List']") - __common_responses_option = (By.XPATH, "//a[@title='Common responses']") - - # Needs more information from the user - __needs_more_information_from_the_user_checkbox = (By.XPATH, "//input[@id='id_needs_info']") - - # Add images button - - # Preview Reply button - __preview_reply_button = (By.XPATH, "//input[@id='preview']") - - # Post Reply button - __post_reply_button = (By.XPATH, "//button[contains(text(),'Post Reply')]") - - # Delete question - __delete_question_delete_button = (By.XPATH, "//input[@value='Delete']") - __delete_question_cancel_button = (By.XPATH, "//a[contains(text(),'Cancel')]") - - def __init__(self, driver: WebDriver): - super().__init__(driver) - - def get_question_author_name(self) -> str: - return super()._get_text_of_element(self.__question_author) - - def add_text_to_post_a_reply_textarea(self, text: str): - super()._type(self.__post_a_reply_textarea, text) - - def click_on_post_reply_button(self, repliant_username) -> str: - xpath_display_name = ( - By.XPATH, - f"//span[@class='display-name' and contains(text(), '{repliant_username}')]", - ) - xpath_reply_id = ( - By.XPATH, - f"//span[@class='display-name' and contains(text()," - f" '{repliant_username}')]/ancestor::div[@class='answer ']", - ) - super()._click(self.__post_reply_button) - super()._is_element_displayed(xpath_display_name) - return super()._get_attribute_value_of_web_element( - web_element=xpath_reply_id, attribute="id" - ) - - def click_on_solves_the_problem_button(self, target_reply_id: str): - xpath = ( - By.XPATH, - f"//div[@id='{target_reply_id}']/following-sibling::aside//input[" f"@type='submit']", - ) - super()._click(xpath) - - def is_post_reply_button_visible(self) -> bool: - return super()._is_element_displayed(self.__post_reply_button) - - def click_on_the_reply_author(self, reply_id: str): - xpath = (By.XPATH, f"//div[@id='{reply_id}']//a[@class='author-name']") - super()._click(xpath) - - def click_delete_this_question_question_tools_option(self): - super()._click(self.__delete_this_question_option) - - def click_delete_this_question_button(self): - super()._click(self.__delete_question_delete_button) diff --git a/selenium_tests/test_data/images/test-image.jpg b/selenium_tests/test_data/images/test-image.jpg deleted file mode 100644 index 7fb175b3420..00000000000 Binary files a/selenium_tests/test_data/images/test-image.jpg and /dev/null differ diff --git a/selenium_tests/tests/conftest.py b/selenium_tests/tests/conftest.py deleted file mode 100644 index 87d8a74d814..00000000000 --- a/selenium_tests/tests/conftest.py +++ /dev/null @@ -1,103 +0,0 @@ -import os.path -import pytest -from selenium import webdriver -from selenium.webdriver.chrome.options import Options as ChromeOptions -from selenium.webdriver.firefox.options import Options as FirefoxOptions -from selenium_tests.core.test_utilities import TestUtilities -from selenium_tests.messages.homepage_messages import HomepageMessages -from selenium_tests.pages.pages import Pages - - -@pytest.fixture() -def setup(request, logger_setup, browser): - browser = browser - logger = logger_setup - global driver - - if browser == "chrome": - browser_options = ChromeOptions() - browser_options.add_argument("-disable-gpu") - browser_options.add_argument("--no-sandbox") - browser_options.add_argument("--log-level=3") - browser_options.add_argument("--ignore-ssl-errors=yes") - browser_options.add_argument("--ignore-certificate-errors") - browser_options.add_argument("--force-device-scale-factor=0.1") - browser_options.add_argument("start-maximized") - - else: - browser_options = FirefoxOptions() - browser_options.add_argument("-disable-gpu") - browser_options.add_argument("--no-sandbox") - browser_options.set_preference("log.level", "warn") - browser_options.add_argument("start-maximized") - - driver = webdriver.Remote( - command_executor="http://0.0.0.0:4444/wd/hub", options=browser_options - ) - - driver.set_page_load_timeout(60) - driver.set_script_timeout(60) - driver.implicitly_wait(3) - driver.maximize_window() - pages = Pages(driver) - logger.info(f"Running tests on {browser} browser") - driver.get(HomepageMessages.STAGE_HOMEPAGE_URL) - - request.cls.pages = pages - request.cls.driver = driver - request.cls.browser = browser - request.cls.logger = logger - yield - driver.quit() - - -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(item): - try: - pytest_html = item.config.pluginmanager.getplugin("html") - outcome = yield - report = outcome.get_result() - extra = getattr(report, "extra", []) - if report.when == "call": - xfail = hasattr(report, "wasxfail") - if (report.skipped and xfail) or (report.failed and not xfail): - report_directory = "reports/" - file_name_edit = report.nodeid.split("::") - file_name = file_name_edit[2] + ".png" - destination_file = os.path.join(report_directory, file_name) - driver.save_screenshot(destination_file) - if file_name: - html = ( - '' % file_name - ) - - extra.append(pytest_html.extras.html(html)) - report.extra = extra - except Exception as e: - print(e) diff --git a/selenium_tests/tests/contribute_pages_tests/test_contribute_page.py b/selenium_tests/tests/contribute_pages_tests/test_contribute_page.py deleted file mode 100644 index 227fb14791b..00000000000 --- a/selenium_tests/tests/contribute_pages_tests/test_contribute_page.py +++ /dev/null @@ -1,172 +0,0 @@ -import pytest -import pytest_check as check -import requests - -from selenium_tests.core.test_utilities import TestUtilities -from selenium_tests.messages.contribute_pages_messages.con_forum_page_messages import ( - ContributeForumMessages, -) -from selenium_tests.messages.contribute_pages_messages.con_help_articles_page_messages import ( - ContributeHelpArticlesMessages, -) -from selenium_tests.messages.contribute_pages_messages.con_localization_page_messages import ( - ContributeLocalizationMessages, -) -from selenium_tests.messages.contribute_pages_messages.con_mobile_support_page_messages import ( - ContributeMobileSupportMessages, -) -from selenium_tests.messages.contribute_pages_messages.con_page_messages import ( - ContributePageMessages, -) -from selenium_tests.messages.contribute_pages_messages.con_social_support_messages import ( - ContributeSocialSupportMessages, -) -from selenium_tests.messages.homepage_messages import HomepageMessages - - -class TestContributePage(TestUtilities): - # C2165413 - @pytest.mark.contributePagesTests - def test_contribute_page_text(self): - self.logger.info("Clicking on the Contribute top-navbar option") - self.pages.top_navbar.click_on_contribute_top_navbar_option() - - self.logger.info("Verify that the contribute page contains the correct strings") - - check.equal( - self.pages.contribute_page.get_page_hero_main_header_text(), - ContributePageMessages.HERO_MAIN_PAGE_TITLE, - f"Text is: {self.pages.contribute_page.get_page_hero_main_header_text()}" - f"Expected: {ContributePageMessages.HERO_MAIN_PAGE_TITLE}", - ) - - check.equal( - self.pages.contribute_page.get_page_hero_main_subtext(), - ContributePageMessages.HERO_HELP_MILLION_OF_USERS_TEXT, - f"Text is: {self.pages.contribute_page.get_page_hero_main_subtext()}" - f"Expected: {ContributePageMessages.HERO_HELP_MILLION_OF_USERS_TEXT}", - ) - - check.equal( - self.pages.contribute_page.get_page_hero_need_help_header_text(), - ContributePageMessages.HERO_NEED_YOUR_HELP_TITLE, - f"Text is: {self.pages.contribute_page.get_page_hero_need_help_header_text()}" - f"Expected: {ContributePageMessages.HERO_NEED_YOUR_HELP_TITLE}", - ) - - check.equal( - self.pages.contribute_page.get_page_hero_need_help_subtext(), - ContributePageMessages.HERO_NEED_YOUR_HELP_PARAGRAPH, - f"Text is: {self.pages.contribute_page.get_page_hero_need_help_subtext()}." - f"Expected: {ContributePageMessages.HERO_NEED_YOUR_HELP_PARAGRAPH}", - ) - - check.equal( - self.pages.contribute_page.get_way_to_contribute_header_text(), - ContributePageMessages.PICK_A_WAY_TO_CONTRIBUTE_HEADER, - f"Text is: {self.pages.contribute_page.get_way_to_contribute_header_text()}" - f"Expected: {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, - ] - - check.equal( - card_titles, - self.pages.contribute_page.get_way_to_contribute_card_titles_text(), - "Pick a way to contribute card titles are not the correct ones", - ) - - check.equal( - self.pages.contribute_page.get_about_us_header_text(), - ContributePageMessages.ABOUT_US_HEADER, - f"Text is: {self.pages.contribute_page.get_about_us_header_text()}" - f"Expected: {ContributePageMessages.ABOUT_US_HEADER}", - ) - - check.equal( - self.pages.contribute_page.get_about_us_subtext(), - ContributePageMessages.ABOUT_US_CONTENT, - f"Text is: {self.pages.contribute_page.get_about_us_subtext()}" - f"Expected: {ContributePageMessages.ABOUT_US_CONTENT}", - ) - - # C2165413 - @pytest.mark.contributePagesTests - def test_contribute_page_images_are_not_broken(self): - self.logger.info("Clicking on the Contribute top-navbar option") - - self.pages.top_navbar.click_on_contribute_top_navbar_option() - - self.logger.info("Verifying that the Contribute page images are not broken") - - for link in self.pages.contribute_page.get_all_page_links(): - image_link = link.get_attribute("src") - response = requests.get(image_link, stream=True) - check.is_true(response.status_code < 400, f"The {image_link} image is broken") - - # C1949333 - @pytest.mark.contributePagesTests - def test_contribute_page_breadcrumbs(self): - self.logger.info("Clicking on the Contribute top-navbar option") - - self.pages.top_navbar.click_on_contribute_top_navbar_option() - - self.logger.info("Verifying that the correct breadcrumbs are displayed") - - breadcrumbs = [ - ContributePageMessages.FIRST_BREADCRUMB, - ContributePageMessages.SECOND_BREADCRUMB, - ] - - check.equal( - self.pages.contribute_page.get_breadcrumbs_text(), - breadcrumbs, - f"Breadcrumbs are: {self.pages.contribute_page.get_breadcrumbs_text()}" - f"Expected to be: {breadcrumbs}", - ) - - self.logger.info("Verifying that the home breadcrumb redirects to the homepage") - - self.pages.contribute_page.click_on_home_breadcrumb() - - assert self.pages.homepage.current_url() == HomepageMessages.STAGE_HOMEPAGE_URL, ( - f"{HomepageMessages.STAGE_HOMEPAGE_URL} page was expected to be displayed" - f"{self.pages.homepage.current_url()} is displayed instead" - ) - - # C1949335,C1949336,C1949337,C1949338,C1949339,C1949355 - @pytest.mark.contributePagesTests - def test_way_to_contribute_redirects_to_correct_page(self): - self.logger.info("Clicking on the Contribute top-navbar option") - - self.pages.top_navbar.click_on_contribute_top_navbar_option() - - self.logger.info( - "Verifying that the 'way to contribute' cards are redirecting to the correct SUMO page" - ) - - ways_to_contribute_links = [ - ContributeForumMessages.STAGE_CONTRIBUTE_FORUM_PAGE_URL, - ContributeHelpArticlesMessages.STAGE_CONTRIBUTE_HELP_ARTICLES_PAGE_URL, - 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.pages.contribute_page.get_list_of_contribute_cards(): - card = self.pages.contribute_page.get_list_of_contribute_cards()[counter] - self.pages.contribute_page.click_on_way_to_contribute_card(card) - check.equal( - ways_to_contribute_links[counter], - self.pages.contribute_page.current_url(), - f"Expected the following URL: {ways_to_contribute_links[counter]}" - f"Received: {self.pages.contribute_page.current_url()}", - ) - self.pages.contribute_page.navigate_back() - counter += 1 diff --git a/selenium_tests/tests/homepage_tests/test_homepage.py b/selenium_tests/tests/homepage_tests/test_homepage.py deleted file mode 100644 index e4cfb4aac94..00000000000 --- a/selenium_tests/tests/homepage_tests/test_homepage.py +++ /dev/null @@ -1,90 +0,0 @@ -import pytest -import pytest_check as check - -from selenium_tests.core.test_utilities import TestUtilities -from selenium_tests.messages.contribute_pages_messages.con_page_messages import ( - ContributePageMessages, -) -from selenium_tests.messages.homepage_messages import HomepageMessages -from selenium_tests.messages.support_page_messages import SupportPageMessages - - -class TestHomepage(TestUtilities): - # C876542 - @pytest.mark.homePageTests - def test_join_our_community_card_learn_more_redirects_to_contribute_page(self): - self.logger.info("Clicking on the 'Learn More' option") - self.pages.homepage.click_learn_more_option() - self.logger.info("Verifying that we are redirected to the 'Contribute' page successfully") - - assert ( - self.pages.contribute_page.current_url() - == ContributePageMessages.STAGE_CONTRIBUTE_PAGE_URL - ), "We are not on the Contribute page!" - - # C876542 - @pytest.mark.homePageTests - def test_join_our_community_card_has_the_correct_content(self): - self.logger.info( - "Verifying that the 'Join Our Community' card has the correct strings applied" - ) - - assert ( - self.pages.homepage.get_community_card_title() - == HomepageMessages.JOIN_OUR_COMMUNITY_CARD_TITLE - and self.pages.homepage.get_community_card_description() - == HomepageMessages.JOIN_OUR_COMMUNITY_CARD_DESCRIPTION - ), "Incorrect strings are displayed" - - # C876541 - @pytest.mark.homePageTests - def test_homepage_feature_articles_are_available_and_interactable(self): - self.logger.info( - "Verify that the correct number of featured articles are present on the homepage " - ) - - check.equal( - self.pages.homepage.get_number_of_featured_articles(), - HomepageMessages.EXPECTED_FEATURED_ARTICLES_COUNT, - "Unexpected featured article count", - ) - - article_name = self.pages.homepage.get_featured_articles_titles()[0] - - self.pages.homepage.click_on_featured_article() - - self.logger.info( - "Verifying that the featured article card redirects to the correct article" - ) - - check.equal( - self.pages.kb_article_page.get_text_of_article_title(), - article_name, - "Incorrect featured article displayed on click", - ) - - # C873774 - @pytest.mark.homePageTests - def test_product_cards_are_functional_and_redirect_to_proper_support_page(self): - self.logger.info( - "Verifying that the product cards are redirecting to the correct support page" - ) - - card_titles = self.pages.homepage.get_text_of_product_card_titles() - counter = 0 - for element in self.pages.homepage.get_list_of_product_cards(): - card = self.pages.homepage.get_list_of_product_cards()[counter] - self.pages.homepage.click_on_product_card(card) - support_page_title = self.pages.product_support_page.get_product_title_text() - check.equal( - card_titles[counter] + " " + SupportPageMessages.TITLE_CONTAINS, - support_page_title, - f"Incorrect support page title: " - f"{support_page_title} " - f"for clicked card with title: " - f"{card_titles[counter]}!", - ) - self.pages.homepage.wait_for_url_title_to_contain(card_titles[counter]) - self.pages.homepage.navigate_back() - - counter += 1 diff --git a/selenium_tests/tests/messaging_system_tests/test_messaging_system.py b/selenium_tests/tests/messaging_system_tests/test_messaging_system.py deleted file mode 100644 index e7f7855263f..00000000000 --- a/selenium_tests/tests/messaging_system_tests/test_messaging_system.py +++ /dev/null @@ -1,1167 +0,0 @@ -import pytest -import pytest_check as check - -from selenium_tests.core.test_utilities import TestUtilities -from selenium_tests.messages.messaging_system_pages_messages.inbox_page_messages import ( - InboxPageMessages, -) -from selenium_tests.messages.messaging_system_pages_messages.new_message_page_messages import ( - NewMessagePageMessages, -) -from selenium_tests.messages.messaging_system_pages_messages.sent_messages_page_messages import ( - SentMessagesPageMessages, -) -from selenium_tests.messages.my_profile_pages_messages.my_profile_page_messages import ( - MyProfileMessages, -) - - -class TestMessagingSystem(TestUtilities): - # C891415 - @pytest.mark.messagingSystem - def test_there_are_no_messages_here_text_is_displayed_when_no_messages_are_available(self): - self.logger.info("Signing in with a normal user account") - - self.pages.top_navbar.click_on_signin_signup_button() - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.logger.info("Navigating to the inbox page") - - self.pages.top_navbar.click_on_inbox_option() - - self.logger.info( - "Verifying if there are messages displayed inside the inbox section." - " If there are, we are clearing them all" - ) - - if self.pages.inbox_page.are_inbox_messages_displayed(): - self.pages.inbox_page.delete_all_displayed_inbox_messages() - self.logger.info("Messages found. Clearing the list") - - self.logger.info("Verifying that the correct page message is displayed") - - check.equal( - self.pages.inbox_page.get_text_of_inbox_no_message_header(), - InboxPageMessages.NO_MESSAGES_IN_INBOX_TEXT, - f"Incorrect message displayed. " - f"Expected: " - f"{InboxPageMessages.NO_MESSAGES_IN_INBOX_TEXT} " - f"Received: " - f"{self.pages.inbox_page.get_text_of_inbox_no_message_header()}", - ) - - self.logger.info("Navigating to the 'Sent Messages' page") - - self.pages.mess_system_user_navbar.click_on_messaging_system_navbar_sent_messages() - - self.logger.info( - "Verifying if there are messages displayed inside the inbox section. " - "If there are, we are clearing them all" - ) - - if self.pages.sent_message_page.are_sent_messages_displayed(): - self.pages.sent_message_page.delete_all_displayed_sent_messages() - self.logger.info("Messages found. Clearing the list") - - self.logger.info("Verifying that the correct page message is displayed") - - check.equal( - self.pages.sent_message_page.get_sent_messages_no_message_text(), - SentMessagesPageMessages.NO_MESSAGES_IN_SENT_MESSAGES_TEXT, - f"Incorrect message displayed. " - f"Expected: " - f"{SentMessagesPageMessages.NO_MESSAGES_IN_SENT_MESSAGES_TEXT} " - f"Received: " - f"{self.pages.sent_message_page.get_sent_messages_no_message_text()}", - ) - - # C2094292 - # This test needs to be updated to fetch the username from a different place - @pytest.mark.messagingSystem - def test_private_messages_can_be_sent_via_user_profiles(self): - user_two = super().username_extraction_from_email( - super().user_secrets_data["TEST_ACCOUNT_MESSAGE_2"] - ) - - self.logger.info("Signing in with user one") - - self.pages.top_navbar.click_on_signin_signup_button() - - user_one = self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_MESSAGE_1"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.pages.homepage.navigate_to( - MyProfileMessages.get_my_profile_stage_url(username=user_two) - ) - - self.logger.info("Clicking on the 'Private Message button'") - - self.pages.my_profile_page.click_on_private_message_button() - - self.logger.info( - "Verifying that the receiver is automatically added inside the 'To' field" - ) - - assert self.pages.new_message_page.get_user_to_text() == user_two, ( - f"Incorrect 'To' receiver. Expected: {user_two}. " - f"Received: {self.pages.new_message_page.get_user_to_text()}" - ) - - self.logger.info("Adding text into the new message textarea field") - - self.pages.new_message_page.type_into_new_message_body_textarea( - super().user_message_test_data["valid_user_message"]["message"] - ) - - self.logger.info("Clicking on the 'Send' button") - - self.pages.new_message_page.click_on_new_message_send_button() - - self.logger.info("Verifying that the correct message sent banner is displayed") - - check.equal( - self.pages.inbox_page.get_text_inbox_page_message_banner_text(), - InboxPageMessages.MESSAGE_SENT_BANNER_TEXT, - f"Incorrect banner text displayed. " - f"Expected: " - f"{InboxPageMessages.MESSAGE_SENT_BANNER_TEXT}. " - f"Received: " - f"{self.pages.inbox_page.get_text_inbox_page_message_banner_text()}", - ) - - self.logger.info( - "Clicking on the close button of the banner " - "and verifying that the banner is no longer displayed" - ) - - self.pages.inbox_page.click_on_inbox_message_banner_close_button() - - check.is_false( - self.pages.inbox_page.is_inbox_page_message_banner_displayed(), - "The banner is displayed. It shouldn't be!", - ) - - self.logger.info( - "Clicking on the 'Sent Messages option' " - "and verifying that the message was successfully sent" - ) - - self.pages.mess_system_user_navbar.click_on_messaging_system_navbar_sent_messages() - - self.logger.info("Verifying that the sent message is displayed") - - assert self.pages.sent_message_page.is_sent_message_displayed( - username=user_two - ), "The message is not displayed! it should be!" - - self.logger.info( - "Deleting the message from the sent messages link " - "and verifying that the message is no longer displayed" - ) - - self.pages.sent_message_page.click_on_sent_message_delete_button(username=user_two) - self.pages.sent_message_page.click_on_delete_page_delete_button() - - self.logger.info("Verifying that the correct banner is displayed") - - check.equal( - self.pages.sent_message_page.get_sent_messages_page_deleted_banner_text(), - SentMessagesPageMessages.DELETE_MESSAGE_BANNER_TEXT, - f"Wrong message displayed inside the banner. " - f"Expected: " - f"{SentMessagesPageMessages.DELETE_MESSAGE_BANNER_TEXT} " - f"Received: " - f"{self.pages.sent_message_page.get_sent_messages_page_deleted_banner_text()}", - ) - - self.logger.info( - "Closing the banner and verifying that the banner was closed successfully" - ) - - self.pages.sent_message_page.click_on_sent_messages_page_banner_close_button() - - check.is_false( - self.pages.sent_message_page.is_sent_message_banner_displayed(), - "Banner is still displayed! It shouldn't be!", - ) - - assert not ( - self.pages.sent_message_page.is_sent_message_displayed(username=user_two) - ), "The message is displayed! it shouldn't be!" - - self.logger.info("Signing in with the user which received the message") - - self.pages.top_navbar.click_on_sign_out_button() - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_MESSAGE_2"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.logger.info( - "Accessing the Inbox section " "and verifying that the message was received" - ) - - self.pages.top_navbar.click_on_inbox_option() - - assert self.pages.inbox_page.is_message_displayed_inside_the_inbox_section( - username=user_one - ), "The message is not displayed! It should be!" - - self.logger.info( - "Deleting the message and verifying that it " - "is no longer displayed inside the inbox section" - ) - - self.pages.inbox_page.click_on_inbox_message_delete_button(username=user_one) - - self.pages.inbox_page.click_on_delete_page_delete_button() - - assert not ( - self.pages.inbox_page.is_message_displayed_inside_the_inbox_section(username=user_one) - ), "Message is displayed! It shouldn't be!" - - self.logger.info("Verifying that the correct banner is displayed") - - check.equal( - self.pages.sent_message_page.get_sent_messages_page_deleted_banner_text(), - SentMessagesPageMessages.DELETE_MESSAGE_BANNER_TEXT, - f"Wrong message displayed inside the banner. " - f"Expected: " - f"{SentMessagesPageMessages.DELETE_MESSAGE_BANNER_TEXT} " - f"Received: " - f"{self.pages.sent_message_page.get_sent_messages_page_deleted_banner_text()}", - ) - - self.logger.info( - "Closing the banner and verifying that the banner was closed successfully" - ) - - self.pages.sent_message_page.click_on_sent_messages_page_banner_close_button() - - # C891419 - @pytest.mark.messagingSystem - def test_private_message_can_be_sent_via_new_message_page(self): - test_user = super().username_extraction_from_email( - super().user_secrets_data["TEST_ACCOUNT_MESSAGE_4"] - ) - - self.logger.info("Signing in with a normal user account") - self.pages.top_navbar.click_on_signin_signup_button() - - user_one = self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_MESSAGE_3"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - self.logger.info( - "Accessing the 'New Message page " "and sending a message to another user'" - ) - - self.pages.top_navbar.click_on_inbox_option() - self.pages.mess_system_user_navbar.click_on_messaging_system_navbar_new_message() - self.pages.messaging_system_flow.complete_send_message_form_with_data( - recipient_username=test_user, - message_body=super().user_message_test_data["valid_user_message"]["message"], - ) - self.pages.new_message_page.click_on_new_message_send_button() - - self.logger.info("Verifying that the correct banner is displayed") - - check.equal( - self.pages.inbox_page.get_text_inbox_page_message_banner_text(), - InboxPageMessages.MESSAGE_SENT_BANNER_TEXT, - f"Incorrect banner text displayed. " - f"Expected: " - f"{InboxPageMessages.MESSAGE_SENT_BANNER_TEXT} " - f"Received: " - f"{self.pages.inbox_page.get_text_inbox_page_message_banner_text()}", - ) - - self.logger.info("Closing the banner and verifying that it is no longer displayed") - - self.pages.inbox_page.click_on_inbox_message_banner_close_button() - - check.is_false( - self.pages.inbox_page.is_inbox_page_message_banner_displayed(), - "Banner is still displayed! It shouldn't be!", - ) - - self.logger.info( - "Verifying that the sent message is displayed inside the 'sent messages' page" - ) - - self.pages.mess_system_user_navbar.click_on_messaging_system_navbar_sent_messages() - - assert self.pages.sent_message_page.is_sent_message_displayed(test_user), ( - "The sent message is not displayed inside the 'Sent Messages page'. " - "It should have been!" - ) - - self.logger.info("Clearing the sent messages list") - - self.pages.sent_message_page.delete_all_displayed_sent_messages() - - self.logger.info( - "Signing in with the receiver account and verifying that the message " - "is displayed inside the inbox section" - ) - - self.pages.top_navbar.click_on_sign_out_button() - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_MESSAGE_4"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.pages.top_navbar.click_on_inbox_option() - - assert self.pages.inbox_page.is_message_displayed_inside_the_inbox_section( - username=user_one - ) - - self.logger.info("Clearing the inbox") - - self.pages.inbox_page.delete_all_displayed_inbox_messages() - - # C891412, C891413 - @pytest.mark.messagingSystem - def test_navbar_options_redirect_to_the_correct_page_and_options_are_correctly_highlighted( - self, - ): - self.logger.info("Signing in with a normal user account") - - self.pages.top_navbar.click_on_signin_signup_button() - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.logger.info("Accessing the inbox section via the top-navbar") - - self.pages.top_navbar.click_on_inbox_option() - - self.logger.info( - "Verifying that we are on the correct page " - "and the 'Inbox' navbar option is highlighted" - ) - - assert self.pages.inbox_page.current_url() == InboxPageMessages.INBOX_PAGE_STAGE_URL, ( - f"Incorrect page displayed. " - f"Expected: " - f"{InboxPageMessages.INBOX_PAGE_STAGE_URL} " - f"Received: " - f"{self.pages.inbox_page.current_url()}" - ) - - if self.browser == "chrome": - assert ( - self.pages.mess_system_user_navbar.get_inbox_option_background_value() - == InboxPageMessages.NAVBAR_INBOX_SELECTED_BG_COLOR_CHROME - ), ( - f"Incorrect background color displayed. " - f"Expected: " - f"{InboxPageMessages.NAVBAR_INBOX_SELECTED_BG_COLOR_CHROME} " - f"Received: " - f"{self.pages.mess_system_user_navbar.get_inbox_option_background_value()}" - ) - elif self.browser == "firefox": - assert ( - self.pages.mess_system_user_navbar.get_inbox_option_background_value() - == InboxPageMessages.NAVBAR_INBOX_SELECTED_BG_COLOR_FIREFOX - ), ( - f"Incorrect background color displayed. " - f"Expected: " - f"{InboxPageMessages.NAVBAR_INBOX_SELECTED_BG_COLOR_FIREFOX} " - f"Received: " - f"{self.pages.mess_system_user_navbar.get_inbox_option_background_value()}" - ) - - self.pages.mess_system_user_navbar.click_on_messaging_system_navbar_sent_messages() - - self.logger.info( - "Verifying that we are on the correct page " - "and the 'Sent Messages' page is successfully displayed" - ) - - assert ( - self.pages.sent_message_page.current_url() - == SentMessagesPageMessages.SENT_MESSAGES_PAGE_URL - ), ( - f"Incorrect page displayed. " - f"Expected: " - f"{SentMessagesPageMessages.SENT_MESSAGES_PAGE_URL} " - f"Received: " - f"{self.pages.sent_message_page.current_url()}" - ) - - self.logger.info("Verifying that the 'Sent Messages' option is highlighted") - - if self.browser == "chrome": - assert ( - self.pages.mess_system_user_navbar.get_sent_messages_option_background_value() - == SentMessagesPageMessages.NAVBAR_SENT_MESSAGES_SELECTED_BG_COLOR_CHROME - ), ( - f"Incorrect background color displayed. " - f"Expected: " - f"{SentMessagesPageMessages.NAVBAR_SENT_MESSAGES_SELECTED_BG_COLOR_CHROME}" - f"Received: " - f"{self.pages.mess_system_user_navbar.get_sent_messages_option_background_value()}" - ) - elif self.browser == "firefox": - assert ( - self.pages.mess_system_user_navbar.get_sent_messages_option_background_value() - == SentMessagesPageMessages.NAVBAR_SENT_MESSAGES_SELECTED_BG_COLOR_FIREFOX - ), ( - f"Incorrect background color displayed. " - f"Expected: " - f"{SentMessagesPageMessages.NAVBAR_SENT_MESSAGES_SELECTED_BG_COLOR_FIREFOX} " - f"Received: " - f"{self.pages.mess_system_user_navbar.get_sent_messages_option_background_value()}" - ) - - self.logger.info("Clicking on the 'New message' navbar option") - - self.pages.mess_system_user_navbar.click_on_messaging_system_navbar_new_message() - - self.logger.info("Verifying that the 'New Message' page is displayed") - - assert ( - self.pages.new_message_page.current_url() - == NewMessagePageMessages.NEW_MESSAGE_PAGE_STAGE_URL - ), ( - f"Incorrect page displayed. " - f"Expected: {NewMessagePageMessages.NEW_MESSAGE_PAGE_STAGE_URL} " - f"Received: {self.pages.new_message_page.current_url()}" - ) - - self.logger.info("Verifying that the 'New Message' navbar option is highlighted") - - if self.browser == "chrome": - assert ( - self.pages.mess_system_user_navbar.get_new_message_option_background_value() - == NewMessagePageMessages.NAVBAR_NEW_MESSAGE_SELECTED_BG_COLOR_CHROME - ), ( - f"Incorrect background color displayed. " - f"Expected: " - f"{NewMessagePageMessages.NAVBAR_NEW_MESSAGE_SELECTED_BG_COLOR_CHROME} " - f"Received: " - f"{self.pages.mess_system_user_navbar.get_new_message_option_background_value()}" - ) - elif self.browser == "firefox": - assert ( - self.pages.mess_system_user_navbar.get_new_message_option_background_value() - == NewMessagePageMessages.NAVBAR_NEW_MESSAGE_SELECTED_BG_COLOR_FIREFOX - ), ( - f"Incorrect background color displayed. " - f"Expected: " - f"{NewMessagePageMessages.NAVBAR_NEW_MESSAGE_SELECTED_BG_COLOR_FIREFOX} " - f"Received: " - f"{self.pages.mess_system_user_navbar.get_new_message_option_background_value()}" - ) - - self.logger.info("Clicking on the navbar inbox messaging system navbar option") - - self.pages.mess_system_user_navbar.click_on_messaging_system_navbar_inbox() - - self.logger.info( - "Verifying that we are on the correct page " - "and the 'Inbox' navbar option is highlighted" - ) - - assert self.pages.inbox_page.current_url() == InboxPageMessages.INBOX_PAGE_STAGE_URL, ( - f"Incorrect page displayed. Expected: {InboxPageMessages.INBOX_PAGE_STAGE_URL} " - f"Received: {self.pages.inbox_page.current_url()}" - ) - - if self.browser == "chrome": - assert ( - self.pages.mess_system_user_navbar.get_inbox_option_background_value() - == InboxPageMessages.NAVBAR_INBOX_SELECTED_BG_COLOR_CHROME - ), ( - f"Incorrect background color displayed. " - f"Expected: " - f"{InboxPageMessages.NAVBAR_INBOX_SELECTED_BG_COLOR_CHROME} " - f"Received: " - f"{self.pages.mess_system_user_navbar.get_inbox_option_background_value()}" - ) - elif self.browser == "firefox": - assert ( - self.pages.mess_system_user_navbar.get_inbox_option_background_value() - == InboxPageMessages.NAVBAR_INBOX_SELECTED_BG_COLOR_FIREFOX - ), ( - f"Incorrect background color displayed. " - f"Expected: " - f"{InboxPageMessages.NAVBAR_INBOX_SELECTED_BG_COLOR_FIREFOX} " - f"Received: " - f"{self.pages.mess_system_user_navbar.get_inbox_option_background_value()}" - ) - - # C891416 - @pytest.mark.messagingSystem - def test_new_message_field_validation(self): - user_two = super().username_extraction_from_email( - super().user_secrets_data["TEST_ACCOUNT_MESSAGE_1"] - ) - self.logger.info("Signing in with normal user account") - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.logger.info("Accessing the New Message page") - - self.pages.top_navbar.click_on_inbox_option() - self.pages.mess_system_user_navbar.click_on_messaging_system_navbar_new_message() - - self.pages.new_message_page.click_on_new_message_send_button() - - self.logger.info("Verifying that we are still on the 'New Message page'") - - check.equal( - self.pages.new_message_page.current_url(), - NewMessagePageMessages.NEW_MESSAGE_PAGE_STAGE_URL, - f"We are on the incorrect page!. " - f"Expected to be on: {NewMessagePageMessages.NEW_MESSAGE_PAGE_STAGE_URL} " - f"We are on the: {self.pages.new_message_page.current_url()} page", - ) - - self.logger.info("Adding a valid user inside the 'To' field") - - self.pages.new_message_page.type_into_new_message_to_input_field(text=user_two) - self.pages.new_message_page.click_on_a_searched_user(username=user_two) - - self.logger.info( - "Clicking the 'Send' button and verifying that we are still on the same page" - ) - - self.pages.new_message_page.click_on_new_message_send_button() - - check.equal( - self.pages.new_message_page.current_url(), - NewMessagePageMessages.NEW_MESSAGE_PAGE_STAGE_URL, - f"We are on the incorrect page!. " - f"Expected to be on: {NewMessagePageMessages.NEW_MESSAGE_PAGE_STAGE_URL} " - f"We are on the: {self.pages.new_message_page.current_url()} page", - ) - - self.logger.info("Verifying that the default remaining characters is the correct one") - - check.equal( - self.pages.new_message_page.get_characters_remaining_text(), - NewMessagePageMessages.NEW_MESSAGE_DEFAULT_REMAINING_CHARACTERS, - f" The default character remaining string is not the correct one! " - f"Expected: {NewMessagePageMessages.NEW_MESSAGE_DEFAULT_REMAINING_CHARACTERS}" - f"Received: {self.pages.new_message_page.get_characters_remaining_text()}", - ) - - self.logger.info("Verifying that the characters remaining color is the expected one") - - if self.browser == "chrome": - check.equal( - self.pages.new_message_page.get_characters_remaining_text_color(), - NewMessagePageMessages.ENOUGH_CHARACTERS_REMAINING_COLOR_CHROME, - f"Incorrect color displayed. " - f"Expected: {NewMessagePageMessages.ENOUGH_CHARACTERS_REMAINING_COLOR_CHROME} " - f"Received: {self.pages.new_message_page.get_characters_remaining_text_color()}", - ) - elif self.browser == "firefox": - check.equal( - self.pages.new_message_page.get_characters_remaining_text_color(), - NewMessagePageMessages.ENOUGH_CHARACTERS_REMAINING_COLOR_FIREFOX, - f"Incorrect color displayed. " - f"Expected: {NewMessagePageMessages.ENOUGH_CHARACTERS_REMAINING_COLOR_FIREFOX} " - f"Received: {self.pages.new_message_page.get_characters_remaining_text_color()}", - ) - - # Firefox container crashes when performing the below steps. Executing in Chrome for now - - if self.browser == "chrome": - self.logger.info("Adding 9990 characters inside the input field") - - self.pages.new_message_page.type_into_new_message_body_textarea( - text=super().user_message_test_data["valid_user_message"][ - "9990_characters_long_message" - ] - ) - check.equal( - self.pages.new_message_page.get_characters_remaining_text(), - NewMessagePageMessages.TEN_CHARACTERS_REMAINING_MESSAGE, - f"Incorrect remaining characters string displayed. " - f"Expected: {NewMessagePageMessages.TEN_CHARACTERS_REMAINING_MESSAGE}" - f"Displayed: {self.pages.new_message_page.get_characters_remaining_text()}", - ) - self.logger.info("Verifying that the characters remaining color is the expected one") - - check.equal( - self.pages.new_message_page.get_characters_remaining_text_color(), - NewMessagePageMessages.ENOUGH_CHARACTERS_REMAINING_COLOR_CHROME, - f"Incorrect color displayed. " - f"Expected: {NewMessagePageMessages.ENOUGH_CHARACTERS_REMAINING_COLOR_CHROME} " - f"Received: {self.pages.new_message_page.get_characters_remaining_text_color()}", - ) - - # elif self.browser == "firefox": - # check.equal( - # self.pages.new_message_page.get_characters_remaining_text_color(), - # NewMessagePageMessages.ENOUGH_CHARACTERS_REMAINING_COLOR_FIREFOX, - # f"Incorrect color displayed. " - # f"Expected: {NewMessagePageMessages.ENOUGH_CHARACTERS_REMAINING_COLOR_FIREFOX} " - # f"Received: {self.pages.new_message_page.get_characters_remaining_text_color()}", - # ) - - self.logger.info("Adding one character inside the textarea field") - - self.pages.new_message_page.type_into_new_message_body_textarea( - text=super().user_message_test_data["valid_user_message"]["one_character_message"] - ) - - self.logger.info("Verifying that the char remaining string is updated accordingly") - - check.equal( - self.pages.new_message_page.get_characters_remaining_text(), - NewMessagePageMessages.NINE_CHARACTERS_REMAINING_MESSAGE, - f"Incorrect remaining characters string displayed. " - f"Expected:{NewMessagePageMessages.NINE_CHARACTERS_REMAINING_MESSAGE} " - f"Displayed: {self.pages.new_message_page.get_characters_remaining_text()}", - ) - - self.logger.info("Verifying that the characters remaining color is the expected one") - - check.equal( - self.pages.new_message_page.get_characters_remaining_text_color(), - NewMessagePageMessages.NO_CHARACTERS_REMAINING_COLOR_CHROME, - f"Incorrect color displayed. " - f"Expected: {NewMessagePageMessages.NO_CHARACTERS_REMAINING_COLOR_CHROME} " - f"Received: {self.pages.new_message_page.get_characters_remaining_text_color()}", - ) - # elif self.browser == "firefox": - # check.equal( - # self.pages.new_message_page.get_characters_remaining_text_color(), - # NewMessagePageMessages.NO_CHARACTERS_REMAINING_COLOR_FIREFOX, - # f"Incorrect color displayed. " - # f"Expected: {NewMessagePageMessages.NO_CHARACTERS_REMAINING_COLOR_FIREFOX} " - # f"Received: {self.pages.new_message_page.get_characters_remaining_text_color()}", - # ) - - self.logger.info("Adding 9 characters inside the textarea field") - - self.pages.new_message_page.type_into_new_message_body_textarea( - text=super().user_message_test_data["valid_user_message"]["9_characters_message"] - ) - - self.logger.info("Verifying that the char remaining string is updated accordingly") - - check.equal( - self.pages.new_message_page.get_characters_remaining_text_color(), - NewMessagePageMessages.NO_CHARACTERS_REMAINING_COLOR_CHROME, - f"Incorrect color displayed. " - f"Expected: {NewMessagePageMessages.NO_CHARACTERS_REMAINING_COLOR_CHROME} " - f"Received: {self.pages.new_message_page.get_characters_remaining_text_color()}", - ) - # elif self.browser == "firefox": - # check.equal( - # self.pages.new_message_page.get_characters_remaining_text_color(), - # NewMessagePageMessages.NO_CHARACTERS_REMAINING_COLOR_FIREFOX, - # f"Incorrect color displayed. " - # f"Expected: {NewMessagePageMessages.NO_CHARACTERS_REMAINING_COLOR_FIREFOX} " - # f"Received: {self.pages.new_message_page.get_characters_remaining_text_color()}", - # ) - - self.logger.info("Verifying that the characters remaining color is the expected one") - - check.equal( - self.pages.new_message_page.get_characters_remaining_text_color(), - NewMessagePageMessages.NO_CHARACTERS_REMAINING_COLOR_CHROME, - f"Incorrect color displayed. " - f"Expected: {NewMessagePageMessages.NO_CHARACTERS_REMAINING_COLOR_CHROME} " - f"Received: {self.pages.new_message_page.get_characters_remaining_text_color()}", - ) - # elif self.browser == "firefox": - # check.equal( - # self.pages.new_message_page.get_characters_remaining_text_color(), - # NewMessagePageMessages.NO_CHARACTERS_REMAINING_COLOR_FIREFOX, - # f"Incorrect color displayed. " - # f"Expected: {NewMessagePageMessages.NO_CHARACTERS_REMAINING_COLOR_FIREFOX} " - # f"Received: {self.pages.new_message_page.get_characters_remaining_text_color()}", - # ) - - # C891417 - @pytest.mark.messagingSystem - def test_new_message_cancel_button(self): - user_two = super().username_extraction_from_email( - super().user_secrets_data["TEST_ACCOUNT_13"] - ) - self.logger.info("Signing in with a normal user account") - - self.pages.top_navbar.click_on_signin_signup_button() - user_one = self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.logger.info("Accessing the 'New Message' section") - - self.pages.top_navbar.click_on_inbox_option() - self.pages.mess_system_user_navbar.click_on_messaging_system_navbar_new_message() - - self.logger.info("Filling the new message form with data") - - self.pages.messaging_system_flow.complete_send_message_form_with_data( - recipient_username=user_two, - message_body=super().user_message_test_data["valid_user_message"]["message"], - ) - - self.logger.info("Clicking on the 'Cancel' button") - - self.pages.new_message_page.click_on_new_message_cancel_button() - - self.logger.info("Verifying that the user is redirected to the inbox page") - - if self.browser == "chrome": - check.equal( - self.pages.mess_system_user_navbar.get_inbox_option_background_value(), - InboxPageMessages.NAVBAR_INBOX_SELECTED_BG_COLOR_CHROME, - "The inbox option is not highlighted! It should have been!", - ) - elif self.browser == "firefox": - check.equal( - self.pages.mess_system_user_navbar.get_inbox_option_background_value(), - InboxPageMessages.NAVBAR_INBOX_SELECTED_BG_COLOR_FIREFOX, - "The inbox option is not highlighted! It should have been!", - ) - - check.equal( - self.pages.inbox_page.current_url(), - InboxPageMessages.INBOX_PAGE_STAGE_URL, - f"We are not on the correct page. Expected: {InboxPageMessages.INBOX_PAGE_STAGE_URL} " - f"Received: {self.pages.inbox_page.current_url()}", - ) - - self.logger.info( - "Navigating to the 'Sent Messages' page nad verifying that the message was not sent" - ) - - self.pages.mess_system_user_navbar.click_on_messaging_system_navbar_sent_messages() - - assert not (self.pages.sent_message_page.is_sent_message_displayed(username=user_two)) - - self.logger.info("Signing out and signing in with the receiver account") - - self.pages.top_navbar.click_on_sign_out_button() - self.pages.top_navbar.click_on_signin_signup_button() - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_13"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.logger.info( - "Navigating to the receiver inbox and verifying that no message was received" - ) - - self.pages.top_navbar.click_on_inbox_option() - - assert not ( - self.pages.inbox_page.is_message_displayed_inside_the_inbox_section(username=user_one) - ) - - # C891418 - @pytest.mark.messagingSystem - def test_new_message_preview(self): - test_user = super().username_extraction_from_email( - super().user_secrets_data["TEST_ACCOUNT_13"] - ) - - self.logger.info("Signing in with a normal user account") - - self.pages.top_navbar.click_on_signin_signup_button() - username = self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.logger.info("Accessing the inbox section") - - self.pages.top_navbar.click_on_inbox_option() - - self.logger.info("Navigating to the new message page") - - self.pages.mess_system_user_navbar.click_on_messaging_system_navbar_new_message() - - self.logger.info("Adding text inside the message content section") - - self.pages.messaging_system_flow.complete_send_message_form_with_data( - recipient_username=test_user, - message_body=super().user_message_test_data["valid_user_message"]["message"], - ) - - self.logger.info("Clicking on the 'Preview' button") - - self.pages.new_message_page.click_on_new_message_preview_button() - - self.logger.info("Verifying that the preview section is successfully displayed") - - assert ( - self.pages.new_message_page.is_message_preview_section_displayed() - ), " The message preview section is not displayed. It should be!" - - self.logger.info("Verifying that all the preview items are displayed") - - check.equal( - self.pages.new_message_page.get_text_of_test_data_first_paragraph_text(), - NewMessagePageMessages.PREVIEW_MESSAGE_CONTENT_FIRST_PARAGRAPH_TEXT, - f"Wrong text displayed. " - f"Expected: " - f"{NewMessagePageMessages.PREVIEW_MESSAGE_CONTENT_FIRST_PARAGRAPH_TEXT} " - f"Received: " - f"{self.pages.new_message_page.get_text_of_test_data_first_paragraph_text()}", - ) - - check.equal( - self.pages.new_message_page.get_text_of_test_data_first_paragraph_strong_text(), - NewMessagePageMessages.PREVIEW_MESSAGE_CONTENT_FIRST_PARAGRAPH_STRONG_TEXT, - f"Wrong text displayed. " - f"Expected:" - f"{NewMessagePageMessages.PREVIEW_MESSAGE_CONTENT_FIRST_PARAGRAPH_STRONG_TEXT} " - f"Received: " - f"{self.pages.new_message_page.get_text_of_test_data_first_paragraph_strong_text()}", - ) - - check.equal( - self.pages.new_message_page.get_text_of_test_data_first_paragraph_italic_text(), - NewMessagePageMessages.PREVIEW_MESSAGE_CONTENT_FIRST_PARAGRAPH_ITALIC_TEXT, - f"Wrong text displayed. " - f"Expected:" - f"{NewMessagePageMessages.PREVIEW_MESSAGE_CONTENT_FIRST_PARAGRAPH_ITALIC_TEXT} " - f"Received: " - f"{self.pages.new_message_page.get_text_of_test_data_first_paragraph_italic_text()}", - ) - - numbered_list_items = [ - NewMessagePageMessages.PREVIEW_MESSAGE_OL_LI_NUMBER_ONE, - NewMessagePageMessages.PREVIEW_MESSAGE_OL_LI_NUMBER_TWO, - NewMessagePageMessages.PREVIEW_MESSAGE_OL_LI_NUMBER_THREE, - ] - - bulleted_list_items = [ - NewMessagePageMessages.PREVIEW_MESSAGE_UL_LI_NUMBER_ONE, - NewMessagePageMessages.PREVIEW_MESSAGE_UL_LI_NUMBER_TWO, - NewMessagePageMessages.PREVIEW_MESSAGE_UL_LI_NUMBER_THREE, - ] - - check.equal( - self.pages.new_message_page.get_text_of_numbered_list_items(), - numbered_list_items, - f"Wrong data displayed in the numbered list. Expected {numbered_list_items} " - f"Received: {self.pages.new_message_page.get_text_of_numbered_list_items()}", - ) - - check.equal( - self.pages.new_message_page.get_text_of_bulleted_list_items(), - bulleted_list_items, - f"Wrong data displayed in the numbered list. Expected {bulleted_list_items} " - f"Received: {self.pages.new_message_page.get_text_of_numbered_list_items()}", - ) - - check.is_true( - self.pages.new_message_page.is_new_message_preview_external_link_test_data_displayed(), - "The external link data is not displayed! It should have been!", - ) - - check.is_true( - self.pages.new_message_page.is_new_message_preview_internal_link_test_data_displayed(), - "The internal link data is not displayed! It should have been!", - ) - - self.logger.info( - "Clicking on the internal link and " - "verifying that the user is redirected to the correct article" - ) - - self.pages.new_message_page.click_on_preview_internal_link() - - assert ( - self.pages.kb_article_page.get_text_of_article_title() - == NewMessagePageMessages.PREVIEW_MESSAGE_INTERNAL_LINK_TITLE - ), ( - f"Incorrect article title displayed! " - f"Expected: {NewMessagePageMessages.PREVIEW_MESSAGE_INTERNAL_LINK_TITLE} " - f"Received: {self.pages.kb_article_page.get_text_of_article_title()}" - ) - - self.logger.info( - "Verifying that the message was no sent by checking the 'Sent Messages page'" - ) - - self.pages.top_navbar.click_on_inbox_option() - - self.pages.mess_system_user_navbar.click_on_messaging_system_navbar_sent_messages() - - assert not ( - self.pages.sent_message_page.is_sent_message_displayed(username=test_user) - ), "The message is displayed. It shouldn't be" - - self.logger.info( - "Signing in with the potential message receiver " - "and verifying that no message was received" - ) - - self.pages.top_navbar.click_on_sign_out_button() - self.pages.top_navbar.click_on_signin_signup_button() - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_13"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.pages.top_navbar.click_on_inbox_option() - - assert not ( - self.pages.inbox_page.is_message_displayed_inside_the_inbox_section(username=username) - ), "The message is displayed. It shouldn't be" - - # C891421, C891424 - @pytest.mark.messagingSystem - def test_messages_can_be_selected_and_deleted(self): - test_user = super().username_extraction_from_email( - super().user_secrets_data["TEST_ACCOUNT_MESSAGE_6"] - ) - - self.logger.info("Signing in with a normal user account") - - self.pages.top_navbar.click_on_signin_signup_button() - - user_one = self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_MESSAGE_5"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.logger.info( - "Accessing the 'New Message' page and sending a message to a different user" - ) - - self.pages.top_navbar.click_on_inbox_option() - self.pages.mess_system_user_navbar.click_on_messaging_system_navbar_new_message() - self.pages.messaging_system_flow.complete_send_message_form_with_data( - recipient_username=test_user, - message_body=super().user_message_test_data["valid_user_message"]["message"], - ) - self.pages.new_message_page.click_on_new_message_send_button() - - self.logger.info("Navigating to the sent messages page") - - self.pages.mess_system_user_navbar.click_on_messaging_system_navbar_sent_messages() - - self.logger.info("Clicking on the 'Delete Selected' button") - - self.pages.sent_message_page.click_on_delete_selected_button() - - self.logger.info( - "Verifying that the correct message is displayed " - "and is no longer displayed when dismissed" - ) - - check.equal( - self.pages.sent_message_page.get_sent_messages_page_deleted_banner_text(), - SentMessagesPageMessages.NO_MESSAGES_SELECTED_BANNER_TEXT, - f"Incorrect banner text displayed. " - f"Expected: " - f"{SentMessagesPageMessages.NO_MESSAGES_SELECTED_BANNER_TEXT} " - f"Received: " - f"{self.pages.sent_message_page.get_sent_messages_page_deleted_banner_text()}", - ) - - self.logger.info("Closing the banner and verifying that the banner is no longer displayed") - - self.pages.sent_message_page.click_on_sent_messages_page_banner_close_button() - - check.is_false( - self.pages.sent_message_page.is_sent_message_banner_displayed(), - "The banner is still displayed! It shouldn't be!", - ) - - self.logger.info( - "Verifying that the message is still listed inside the sent messages section" - ) - - assert self.pages.sent_message_page.is_sent_message_displayed( - username=test_user - ), "The message is no longer displayed inside the sent messages page! It should be!" - - self.logger.info("Sending another message to self twice") - - for i in range(2): - self.pages.mess_system_user_navbar.click_on_messaging_system_navbar_new_message() - self.pages.messaging_system_flow.complete_send_message_form_with_data( - recipient_username=user_one, - message_body=super().user_message_test_data["valid_user_message"]["message"], - ) - self.pages.new_message_page.click_on_new_message_send_button() - - self.logger.info( - "Clicking on the 'delete selected' button while no messages is selected " - "and verifying that the correct " - "banner is displayed" - ) - - self.pages.inbox_page.click_on_inbox_delete_selected_button() - - check.equal( - self.pages.inbox_page.get_text_inbox_page_message_banner_text(), - InboxPageMessages.NO_MESSAGES_SELECTED_BANNER_TEXT, - f"Incorrect messages displayed. " - f"Expected: {InboxPageMessages.NO_MESSAGES_SELECTED_BANNER_TEXT} " - f"Received: {self.pages.inbox_page.get_text_inbox_page_message_banner_text()}", - ) - - self.logger.info( - "Closing the banner and verifying that it is no longer displayed and " - "no messages were deleted" - ) - - self.pages.inbox_page.click_on_inbox_message_banner_close_button() - - check.is_false( - self.pages.inbox_page.is_inbox_page_message_banner_displayed(), - "The banner is still displayed! It shouldn't be!", - ) - - assert self.pages.inbox_page.is_message_displayed_inside_the_inbox_section( - username=user_one - ), "Messages are no longer displayed. They should have been!" - - self.logger.info("Selecting the messages and deleting it via the 'delete selected button'") - - self.pages.inbox_page.delete_all_displayed_inbox_messages_via_delete_selected_button() - - self.logger.info("Verifying that the messages are no longer displayed") - - assert not ( - self.pages.inbox_page.is_message_displayed_inside_the_inbox_section(username=user_one) - ) - - self.logger.info("Verifying that the correct banner is displayed") - - check.equal( - self.pages.inbox_page.get_text_inbox_page_message_banner_text(), - InboxPageMessages.MESSAGE_DELETED_BANNER_TEXT, - f"Incorrect message banner displayed. " - f"Expected: {InboxPageMessages.MESSAGE_DELETED_BANNER_TEXT} " - f"Received: {self.pages.inbox_page.get_text_inbox_page_message_banner_text()}", - ) - - self.logger.info( - "Navigating to the sent messages section and " - "clearing all messages via the 'delete selected button'" - ) - - self.pages.mess_system_user_navbar.click_on_messaging_system_navbar_sent_messages() - - self.pages.sent_message_page.delete_all_sent_messages_via_delete_selected_button() - - self.logger.info("Verifying that the messages are no longer displayed") - - assert not (self.pages.sent_message_page.is_sent_message_displayed(username=test_user)) - - self.logger.info("Verifying that the correct banner is displayed") - - check.equal( - self.pages.sent_message_page.get_sent_messages_page_deleted_banner_text(), - SentMessagesPageMessages.DELETE_MESSAGE_BANNER_TEXT, - f"Incorrect message banner displayed. " - f"Expected: " - f"{SentMessagesPageMessages.DELETE_MESSAGE_BANNER_TEXT} " - f"Received: " - f"{self.pages.sent_message_page.get_sent_messages_page_deleted_banner_text()}", - ) - - self.logger.info( - "Signing in with the receiver account and navigating to the inbox section" - ) - - self.pages.top_navbar.click_on_sign_out_button() - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_MESSAGE_6"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.pages.top_navbar.click_on_inbox_option() - - self.logger.info("Verifying that the messages are displayed inside the inbox section") - - assert self.pages.inbox_page.is_message_displayed_inside_the_inbox_section( - username=user_one - ), "Messages are not displayed inside the inbox section. They should have been!" - - self.logger.info( - "Deleting all messages from the inbox page via the 'delete selected button'" - ) - - self.pages.inbox_page.delete_all_displayed_inbox_messages_via_delete_selected_button() - - self.logger.info( - "Verifying that the messages are no longer displayed inside the inbox section" - ) - - assert not ( - self.pages.inbox_page.is_message_displayed_inside_the_inbox_section(username=user_one) - ) - - self.logger.info("Verifying that the correct banner is displayed") - - check.equal( - self.pages.inbox_page.get_text_inbox_page_message_banner_text(), - InboxPageMessages.MESSAGE_DELETED_BANNER_TEXT, - f"Incorrect message banner displayed. " - f"Expected: {InboxPageMessages.MESSAGE_DELETED_BANNER_TEXT} " - f"Received: {self.pages.inbox_page.get_text_inbox_page_message_banner_text()}", - ) diff --git a/selenium_tests/tests/user_page_tests/test_edit_contribution_areas.py b/selenium_tests/tests/user_page_tests/test_edit_contribution_areas.py deleted file mode 100644 index a6ed24e040f..00000000000 --- a/selenium_tests/tests/user_page_tests/test_edit_contribution_areas.py +++ /dev/null @@ -1,204 +0,0 @@ -import pytest -import pytest_check as check - -from selenium_tests.core.test_utilities import TestUtilities -from selenium_tests.messages.my_profile_pages_messages.edit_cont_areas_page_messages import ( - EditContributionAreasPageMessages, -) -from selenium_tests.messages.my_profile_pages_messages.my_profile_page_messages import ( - MyProfileMessages, -) - - -class TestEditContributionAreas(TestUtilities): - # C2206070 - @pytest.mark.userContributionTests - def test_all_checkboxes_can_be_selected_and_saved(self): - self.logger.info("Signing in with a simple user account") - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - original_user = self.pages.top_navbar.get_text_of_logged_in_username() - - self.logger.info("Clicking on the 'Edit Contribution areas option'") - - self.pages.top_navbar.click_on_settings_profile_option() - - self.pages.user_navbar.click_on_edit_contribution_areas_option() - - self.logger.info("Clicking on all checkboxes") - - self.pages.edit_my_profile_con_areas_page._click_on_all_unchecked_cont_areas_checkboxes() - - self.logger.info("Clicking on the 'Update' button") - - self.pages.edit_my_profile_con_areas_page._click_on_update_contribution_areas_button() - - self.logger.info("Verifying that the correct notification banner text is displayed") - - check.equal( - self.pages.edit_my_profile_con_areas_page._get_edit_con_areas_pref_banner_txt(), - EditContributionAreasPageMessages.PREFERENCES_SAVED_NOTIFICATION_BANNER_TEXT, - f"Incorrect notification banner message displayed. " - f"Expected: " - f"{EditContributionAreasPageMessages.PREFERENCES_SAVED_NOTIFICATION_BANNER_TEXT}" - f" received: " - f"{self.pages.edit_my_profile_con_areas_page._get_edit_con_areas_pref_banner_txt()}", - ) - - self.logger.info( - "Clicking on the notification banner close button and " - "verifying that the banner is no longer displayed" - ) - - self.pages.edit_my_profile_con_areas_page._click_on_edit_cont_pref_banner_close_button() - - check.is_false( - self.pages.edit_my_profile_con_areas_page._is_edit_cont_pref_banner_displayed(), - "The notification banner is displayed and it shouldn't be!", - ) - - self.logger.info("Verifying that all the checkboxes are checked") - - assert ( - self.pages.edit_my_profile_con_areas_page._are_all_cont_pref_checkboxes_checked() - ), "Not all checkbox options are checked!" - - contribution_options = ( - self.pages.edit_my_profile_con_areas_page._get_all_contribution_areas_checkbox_labels() - ) - - self.logger.info( - "Accessing the my profile page and verifying that " - "the displayed groups are the correct ones" - ) - - self.pages.user_navbar.click_on_my_profile_option() - - assert ( - self.pages.my_profile_page.get_my_profile_groups_items_text() == contribution_options - ), ( - f"Not all groups are displayed. Expected:" - f" {contribution_options} " - f"received: {self.pages.my_profile_page.get_my_profile_groups_items_text()}" - ) - - self.logger.info( - "Signing in with a different account and verifying " - "that the original user groups are displayed" - ) - - self.pages.top_navbar.click_on_sign_out_button() - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_13"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.homepage.navigate_to(MyProfileMessages.get_my_profile_stage_url(original_user)) - - self.logger.info( - "Verifying that the user groups is successfully displayed for the original user" - ) - - assert ( - self.pages.my_profile_page.get_my_profile_groups_items_text() == contribution_options - ), ( - f"Not all groups are displayed. Expected:" - f" {contribution_options} " - f"received: {self.pages.my_profile_page.get_my_profile_groups_items_text()}" - ) - - self.logger.info("Signing in back with the original user") - - self.pages.top_navbar.click_on_sign_out_button() - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.logger.info( - "Accessing the edit contribution areas page and unchecking all the checkboxes" - ) - - self.pages.top_navbar.click_on_settings_profile_option() - - self.pages.user_navbar.click_on_edit_contribution_areas_option() - - self.pages.edit_my_profile_con_areas_page._click_on_all_checked_cont_areas_checkboxes() - - self.logger.info( - "Clicking on the update button and verifying that " - "the correct notification banner is displayed" - ) - - self.pages.edit_my_profile_con_areas_page._click_on_update_contribution_areas_button() - - check.equal( - self.pages.edit_my_profile_con_areas_page._get_edit_con_areas_pref_banner_txt(), - EditContributionAreasPageMessages.PREFERENCES_SAVED_NOTIFICATION_BANNER_TEXT, - f"Incorrect notification banner text is displayed." - f" Expected:" - f"{EditContributionAreasPageMessages.PREFERENCES_SAVED_NOTIFICATION_BANNER_TEXT}" - f" received: " - f"{self.pages.edit_my_profile_con_areas_page._get_edit_con_areas_pref_banner_txt()}", - ) - - self.logger.info( - "Closing the notification banner and verifying that is no longer displayed" - ) - - self.pages.edit_my_profile_con_areas_page._click_on_edit_cont_pref_banner_close_button() - - check.is_false( - self.pages.edit_my_profile_con_areas_page._is_edit_cont_pref_banner_displayed(), - "The notification banner is displayed! It shouldn't be!", - ) - - self.logger.info( - "Verifying that the profile groups section is no longer " - "displayed inside the profile section" - ) - - self.pages.user_navbar.click_on_my_profile_option() - - assert not ( - self.pages.my_profile_page.is_groups_section_displayed() - ), "The user groups is displayed!. It shouldn't be!" - - self.logger.info( - "Logging in with a different user and accessing the original user profile" - ) - - self.pages.top_navbar.click_on_sign_out_button() - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_13"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.homepage.navigate_to(MyProfileMessages.get_my_profile_stage_url(original_user)) - - self.logger.info( - "Verifying that the groups section is not longer displayed for the original user" - ) - - assert not ( - self.pages.my_profile_page.is_groups_section_displayed() - ), "The user groups is displayed!. It shouldn't be!" diff --git a/selenium_tests/tests/user_page_tests/test_edit_my_profile.py b/selenium_tests/tests/user_page_tests/test_edit_my_profile.py deleted file mode 100644 index 3fbb5becae3..00000000000 --- a/selenium_tests/tests/user_page_tests/test_edit_my_profile.py +++ /dev/null @@ -1,1958 +0,0 @@ -import pytest -import pytest_check as check - -from selenium_tests.core.test_utilities import TestUtilities -from selenium_tests.messages.auth_pages_messages.fxa_page_messages import ( - FxAPageMessages, -) -from selenium_tests.messages.my_profile_pages_messages.edit_my_profile_page_messages import ( - EditMyProfilePageMessages, -) -from selenium_tests.messages.my_profile_pages_messages.my_profile_page_messages import ( - MyProfileMessages, -) - - -class TestEditMyProfile(TestUtilities): - # C891529 - @pytest.mark.userPageTests - def test_username_field_is_automatically_populated(self): - self.logger.info( - "Signing in with a simple user account and navigating to the 'Edit Profile' page" - ) - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.top_navbar.click_on_edit_profile_option() - - self.logger.info( - "Verifying that username field is automatically populated with the correct data" - ) - - top_navbar_displayed_username = self.pages.top_navbar.get_text_of_logged_in_username() - - assert ( - self.pages.edit_my_profile_page.get_username_input_field_value() - == top_navbar_displayed_username - ), ( - f"Incorrect username displayed inside the user field. " - f"Expected: {top_navbar_displayed_username}, " - f"received: {self.pages.edit_my_profile_page.get_username_input_field_value()}" - ) - - # C1491017 - # This test is currently covering the: my profile section, top navbar, and posted questions. - # Might want to extend the coverage - @pytest.mark.userPageTests - def test_edit_profile_field_validation_with_symbols(self): - self.logger.info("Signing in with a normal account") - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.logger.info("Navigating to the profile edit page") - - self.pages.top_navbar.click_on_edit_profile_option() - - self.logger.info("Extracting the username value") - - original_username = self.pages.edit_my_profile_page.get_username_input_field_value() - - self.logger.info( - "Clearing the username and display name fields and inserting the new username" - ) - - self.pages.edit_my_profile_page.clear_username_field() - self.pages.edit_my_profile_page.clear_display_name_field() - - profile_edit_data = super().profile_edit_test_data - - if self.browser == "chrome": - new_username = profile_edit_data["valid_user_edit_with_symbols"][ - "username_with_valid_symbols_chrome" - ] - elif self.browser == "firefox": - new_username = profile_edit_data["valid_user_edit_with_symbols"][ - "username_with_valid_symbols_firefox" - ] - - self.pages.edit_my_profile_page.send_text_to_username_field(new_username) - - self.logger.info("Clicking on the 'Update My Profile' button") - - self.pages.edit_my_profile_page.click_update_my_profile_button() - - self.logger.info( - "Verify that the newly set username is successfully applied to the my profile section" - ) - - check.equal( - self.pages.my_profile_page.get_my_profile_display_name_header_text(), - new_username, - f"The username displayed inside the profile section should be {new_username} " - f"but instead is: " - f"{self.pages.my_profile_page.get_my_profile_display_name_header_text()}", - ) - - self.logger.info("Verify that the newly set username is displayed inside the top navbar") - - check.equal( - self.pages.top_navbar.get_text_of_logged_in_username(), - new_username, - f"The username displayed inside the top navbar section should be {new_username} " - f"but instead is {self.pages.top_navbar.get_text_of_logged_in_username()}", - ) - - self.logger.info( - "Access a previously posted question and verify that the display name has changed" - ) - - self.pages.my_profile_page.click_on_my_profile_questions_link() - - self.pages.my_questions_page.click_on_a_question_by_index(1) - - check.equal( - self.pages.question_page.get_question_author_name(), - new_username, - "The new username should be reflected under the posted questions as well", - ) - - self.logger.info( - "Going back to the my profile page and reverting the username back to the original one" - ) - - self.pages.top_navbar.click_on_edit_profile_option() - - self.pages.edit_my_profile_page.clear_username_field() - - self.pages.edit_my_profile_page.send_text_to_username_field(original_username) - - self.pages.edit_my_profile_page.click_update_my_profile_button() - - self.logger.info("Verifying that the username was updated back to the original one") - - check.equal( - self.pages.my_profile_page.get_my_profile_display_name_header_text(), - original_username, - f"The username displayed inside the profile section should be {original_username} " - f"but instead is: " - f"{self.pages.my_profile_page.get_my_profile_display_name_header_text()}", - ) - - self.logger.info("Verify that the newly set username is displayed inside the top navbar") - - check.equal( - self.pages.top_navbar.get_text_of_logged_in_username(), - original_username, - f"The username displayed inside the top navbar section should be {original_username} " - f"but instead is {self.pages.top_navbar.get_text_of_logged_in_username()}", - ) - - self.logger.info( - "Access a previously posted question and verify that the display name has changed" - ) - - self.pages.my_profile_page.click_on_my_profile_questions_link() - - self.pages.my_questions_page.click_on_a_question_by_index(1) - - check.equal( - self.pages.question_page.get_question_author_name(), - original_username, - "The new username should be reflected under the posted questions as well", - ) - - # C1491017 - @pytest.mark.userPageTests - def test_username_with_invalid_symbols(self): - self.logger.info("Signing in with a normal user account") - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.logger.info("Accessing the edit profile page") - - self.pages.top_navbar.click_on_edit_profile_option() - - self.logger.info("Extracting the original username") - - original_username = self.pages.edit_my_profile_page.get_username_input_field_value() - - self.logger.info("Clearing the username input field and adding an invalid user") - - self.pages.edit_my_profile_page.clear_username_field() - - profile_edit_data = super().profile_edit_test_data - - new_username = profile_edit_data["invalid_username_with_symbols"][ - "username_with_invalid_symbols" - ] - - self.pages.edit_my_profile_page.send_text_to_username_field(new_username) - - self.logger.info("Clicking on the 'Update My Profile' button") - - self.pages.edit_my_profile_page.click_update_my_profile_button() - - self.logger.info("Verify that the error message is displayed") - - check.equal( - self.pages.edit_my_profile_page.get_username_error_message_text(), - EditMyProfilePageMessages.USERNAME_INPUT_ERROR_MESSAGE, - f"Incorrect error message displayed. " - f"Expected: {EditMyProfilePageMessages.USERNAME_INPUT_ERROR_MESSAGE} " - f"but received: {self.pages.edit_my_profile_page.get_username_error_message_text()}", - ) - - self.logger.info( - "Accessing the Edit Profile page and verifying that the username was not changed" - ) - - self.pages.top_navbar.click_on_view_profile_option() - - assert ( - self.pages.my_profile_page.get_my_profile_display_name_header_text() - == original_username - ), ( - f"The username should be: {original_username} " - f"but instead is: {self.pages.my_profile_page.get_my_profile_display_name_header_text}" - ) - - # C891530, C2107866 - @pytest.mark.userPageTests - def test_cancel_profile_edit(self): - self.logger.info("Signing in with a normal user account") - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.logger.info("Accessing the Edit My Profile page") - - self.pages.top_navbar.click_on_edit_profile_option() - - self.logger.info("Extracting all the edit my profile fields values") - - original_values = self.pages.edit_my_profile_page.get_value_of_all_fields() - - self.logger.info("Populating edit profile fields with data") - - self.pages.edit_profile_flow.edit_profile_with_test_data() - - self.logger.info("Clicking on the 'Cancel' button") - - self.pages.edit_my_profile_page.click_cancel_button() - - self.logger.info( - "Verifying that we are on the same page " - "and all the input field values were reverted back to original" - ) - - assert self.pages.edit_my_profile_page.get_value_of_all_fields() == original_values, ( - f"Fields values were not restored to original values. " - f"Original values: {original_values}, current field " - f"values: {self.pages.edit_my_profile_page.get_value_of_all_fields()}" - ) - - # C946232 - @pytest.mark.skip - def test_manage_firefox_account_redirects_to_firefox_account_settings_page(self): - self.logger.info("Signing in with a normal user account") - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.logger.info("Accessing the 'Edit my profile' page") - - self.pages.top_navbar.click_on_edit_profile_option() - - self.logger.info("Click on the 'Manage account' button") - - self.pages.edit_my_profile_page.click_manage_firefox_account_button() - - self.logger.info( - "Verifying that the user was redirected to " - "the Mozilla account settings page in a new tab" - ) - - self.pages.edit_my_profile_page._switch_next_child_tab() - - assert ( - FxAPageMessages.ACCOUNT_SETTINGS_URL in self.pages.edit_my_profile_page.current_url() - ), ( - f"User was not redirected to the Mozilla account settings page. " - f"The current url is {self.pages.edit_my_profile_page.current_url()}" - ) - - # C1491461 - @pytest.mark.userPageTests - def test_duplicate_usernames_are_not_allowed(self): - self.logger.info("Sign in with a normal user account") - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - original_username = self.pages.top_navbar.get_text_of_logged_in_username() - - self.pages.top_navbar.click_on_edit_profile_option() - - self.logger.info("Clearing the username input field and adding an existing username to it") - - self.pages.edit_my_profile_page.clear_username_field() - - self.pages.edit_my_profile_page.send_text_to_username_field( - super().username_extraction_from_email( - super().user_secrets_data["TEST_ACCOUNT_MESSAGE_6"] - ) - ) - - self.pages.edit_my_profile_page.click_update_my_profile_button() - - self.logger.info( - "Verify that the error message is displayed " - "under the username input field and is the correct one" - ) - - check.equal( - self.pages.edit_my_profile_page.get_username_error_message_text(), - EditMyProfilePageMessages.DUPLICATE_USERNAME_ERROR_MESSAGE, - f"Incorrect error message displayed! The expected error message is: " - f"{EditMyProfilePageMessages.DUPLICATE_USERNAME_ERROR_MESSAGE}" - f" The displayed error message is:" - f" {self.pages.edit_my_profile_page.get_username_error_message_text()}", - ) - - self.logger.info( - "Verifying that the username displayed inside the top navbar is the correct one" - ) - - check.equal( - self.pages.top_navbar.get_text_of_logged_in_username(), - original_username, - f"Incorrect username displayed inside the top-navbar. " - f"Expected to be: {original_username} " - f" but got: {self.pages.top_navbar.get_text_of_logged_in_username()}", - ) - - self.logger.info("Accessing the my profile page") - - self.pages.top_navbar.click_on_view_profile_option() - - self.logger.info( - "Verifying that the username displayed inside the My Profile page is the correct one" - ) - - assert ( - self.pages.my_profile_page.get_my_profile_display_name_header_text() - == original_username - ), ( - f"Incorrect username displayed inside the My Profile page." - f" Expected to be: {original_username}" - f" but got: {self.pages.my_profile_page.get_my_profile_display_name_header_text()}" - ) - - # C1491462 - @pytest.mark.skip - def test_profile_username_field_cannot_be_left_empty(self): - self.logger.info("Signing in with a normal account") - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - original_username = self.pages.top_navbar.get_text_of_logged_in_username() - - self.logger.info("Accessing the Edit My Profile page") - - self.pages.top_navbar.click_on_edit_profile_option() - - self.logger.info( - "Clearing the username input field and clicking on the Update My Profile button" - ) - - self.pages.edit_my_profile_page.clear_username_field() - - self.pages.edit_my_profile_page.click_update_my_profile_button() - - self.logger.info("Verifying that we are still on the edit profile page") - - check.equal( - self.pages.edit_my_profile_page.current_url(), - EditMyProfilePageMessages.STAGE_EDIT_MY_PROFILE_URL, - f"We are not on the expected page. Expected page to be:" - f" {EditMyProfilePageMessages.STAGE_EDIT_MY_PROFILE_URL}" - f" but we are on the {self.pages.edit_my_profile_page.current_url()} page instead", - ) - - self.logger.info( - "Verifying that the displayed username inside the top navbar is the original one" - ) - - assert self.pages.top_navbar.get_text_of_logged_in_username() == original_username, ( - f"Expected username to be: {original_username}. " - f"The displayed username is {self.pages.top_navbar.get_text_of_logged_in_username()}" - ) - - self.logger.info("Accessing the my profile page") - - self.pages.user_navbar.click_on_my_profile_option() - - self.logger.info( - "Verifying that the username displayed inside the my profile page is the original one" - ) - - assert ( - self.pages.my_profile_page.get_my_profile_display_name_header_text() - == original_username - ), ( - f"Expected username to be: {original_username}. " - f"The displayed username is " - f"{self.pages.my_profile_page.get_my_profile_display_name_header_text()}" - ) - - # C1491018, C891531,C1491021 - @pytest.mark.userPageTests - def test_username_can_contain_uppercase_and_lowercase_letters(self): - self.logger.info("Signing in with a normal account") - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_MESSAGE_4"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - original_username = self.pages.top_navbar.get_text_of_logged_in_username() - - new_username = super().profile_edit_test_data["uppercase_lowercase_valid_username"][ - "uppercase_lowercase_username" - ] - - self.logger.info("Accessing the edit my profile page") - - self.pages.top_navbar.click_on_edit_profile_option() - - self.logger.info( - "Updating the username field to contain uppercase and lowercase characters" - ) - - self.pages.edit_my_profile_page.clear_username_field() - self.pages.edit_my_profile_page.send_text_to_username_field(new_username) - - self.logger.info("Clicking on the 'Update my Profile button'") - - self.pages.edit_my_profile_page.click_update_my_profile_button() - - self.logger.info( - "Verifying that the username displayed inside the top-navbar updates successfully" - ) - - assert self.pages.top_navbar.get_text_of_logged_in_username() == new_username, ( - f"The displayed username is incorrect. Expected: {new_username} " - f"but {self.pages.top_navbar.get_text_of_logged_in_username()} is displayed instead" - ) - - self.logger.info( - "Verifying that the username displayed inside " - "the my profile section is the correct one" - ) - - assert ( - self.pages.my_profile_page.get_my_profile_display_name_header_text() == new_username - ), ( - f"The displayed username is incorrect. Expected: {new_username}" - f"but {self.pages.my_profile_page.get_my_profile_display_name_header_text()} " - f"is displayed instead" - ) - - self.logger.info("Reverting the username back to the original one") - - self.pages.top_navbar.click_on_edit_profile_option() - self.pages.edit_my_profile_page.clear_username_field() - self.pages.edit_my_profile_page.send_text_to_username_field(original_username) - self.pages.edit_my_profile_page.click_update_my_profile_button() - - # C1491463, C1491464 - @pytest.mark.userPageTests - def test_display_name_replaces_the_username_text(self): - self.logger.info("Signing in with a normal user account") - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_MESSAGE_1"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - original_username = self.pages.top_navbar.get_text_of_logged_in_username() - - if self.browser == "chrome": - new_display_name = super().profile_edit_test_data["valid_user_edit"][ - "display_name_chrome" - ] - elif self.browser == "firefox": - new_display_name = super().profile_edit_test_data["valid_user_edit"][ - "display_name_firefox" - ] - - self.logger.info("Accessing the edit profile page and adding a new display name") - - self.pages.top_navbar.click_on_edit_profile_option() - - self.pages.edit_my_profile_page.clear_display_name_field() - - self.pages.edit_my_profile_page.send_text_to_display_name_field(new_display_name) - - self.logger.info("Clicking on the 'Update My Profile' button") - - self.pages.edit_my_profile_page.click_update_my_profile_button() - - self.logger.info("Verifying that the top navbar username updates with the display name") - - assert self.pages.top_navbar.get_text_of_logged_in_username() == new_display_name, ( - f"Incorrect displayed signed in username in top-navbar. " - f"Expected: {new_display_name} but " - f"{self.pages.top_navbar.get_text_of_logged_in_username()} is displayed instead" - ) - - self.logger.info( - "Verifying that the 'My profile' display name contains display name (username)" - ) - - assert ( - self.pages.my_profile_page.get_my_profile_display_name_header_text() - == f"{new_display_name} ({original_username})" - ), ( - f"Incorrect displayed signed in username inside the my profile page. " - f"Expected: {new_display_name} ({original_username})" - f"but {self.pages.my_profile_page.get_my_profile_display_name_header_text()} " - f"is displayed instead" - ) - - self.logger.info("Reverting back and deleting the display name") - - self.pages.top_navbar.click_on_edit_profile_option() - self.pages.edit_my_profile_page.clear_display_name_field() - self.pages.edit_my_profile_page.click_update_my_profile_button() - - self.logger.info( - "Verifying that the displayed name inside the top navbar is reverted back to username" - ) - - assert self.pages.top_navbar.get_text_of_logged_in_username() == original_username, ( - f"Incorrect displayed signed in username after deleting the display name. " - f"Expected: {original_username}" - f" but received: {self.pages.top_navbar.get_text_of_logged_in_username()}" - ) - - self.logger.info( - "Verifying that the displayed name inside the main " - "profile page is reverted back to the username" - ) - assert { - self.pages.my_profile_page.get_my_profile_display_name_header_text() - == original_username - }, ( - f"Incorrect displayed name inside the profile page. Expected: {original_username} but" - f" received {self.pages.my_profile_page.get_my_profile_display_name_header_text()}" - ) - - # This needs update. It currently fails due to: - # https://github.com/mozilla/sumo/issues/1345 - @pytest.mark.skip - def test_biography_field_accepts_html_tags(self): - self.logger.info("Signing in with a normal user account") - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.logger.info("Accessing the edit profile page via top-navbar") - - self.pages.top_navbar.click_on_edit_profile_option() - - self.logger.info("Clearing the biography field and inputting html data to it") - - self.pages.edit_my_profile_page.clear_biography_textarea_field() - - html_test_data = super().profile_edit_test_data - - self.pages.edit_my_profile_page.send_text_to_biography_field( - html_test_data["biography_field_with_html_data"]["biography_html_data"] - ) - - self.logger.info("Clicking on the 'Update My Profile button'") - - self.pages.edit_my_profile_page.click_update_my_profile_button() - - # C2107899, C2107899 - @pytest.mark.userPageTests - def test_make_my_email_address_visible_checkbox_checked(self): - logged_in_email = super().user_secrets_data["TEST_ACCOUNT_12"] - - self.logger.info("Signing in with a normal user account") - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - username_one = self.pages.top_navbar.get_text_of_logged_in_username() - - self.logger.info("Accessing the 'Edit My Profile' page") - - self.pages.top_navbar.click_on_edit_profile_option() - - if not self.pages.edit_my_profile_page.is_make_email_visible_checkbox_selected(): - self.pages.edit_my_profile_page.click_make_email_visible_checkbox() - self.pages.edit_my_profile_page.click_update_my_profile_button() - - self.logger.info( - "Checkbox is checked, returning to My Profile page " - "and verifying that the email is displayed" - ) - - self.pages.top_navbar.click_on_view_profile_option() - - check.equal( - self.pages.my_profile_page.get_text_of_publicly_displayed_username(), - logged_in_email, - f"Incorrect email is displayed inside the " - f"'My Profile' page. Expected: {logged_in_email} " - f"received {self.pages.my_profile_page.get_text_of_publicly_displayed_username()}", - ) - - self.logger.info("Signing in with a different user") - - self.pages.my_profile_page.click_my_profile_page_sign_out_button() - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_13"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.logger.info( - "Accessing the previous user profile and verifying that the email address is displayed" - ) - - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - self.pages.homepage.navigate_to(MyProfileMessages.get_my_profile_stage_url(username_one)) - - check.equal( - self.pages.my_profile_page.get_text_of_publicly_displayed_username(), - logged_in_email, - f"Incorrect email is displayed inside the 'My Profile' page. " - f"Expected: {logged_in_email} " - f"received {self.pages.my_profile_page.get_text_of_publicly_displayed_username()}", - ) - - self.logger.info("Signing out") - - self.pages.top_navbar.click_on_sign_out_button() - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.logger.info( - "Accessing the previous user profile and verifying that " - "the email address is not displayed to signed out users" - ) - - # This also needs an update - self.pages.homepage.navigate_to(MyProfileMessages.get_my_profile_stage_url(username_one)) - - check.is_false( - self.pages.my_profile_page.is_publicly_displayed_email_displayed(), - "The email is displayed and it shouldn't be!", - ) - - # C2107899 - @pytest.mark.userPageTests - def test_make_my_email_address_visible_checkbox_unchecked(self): - self.logger.info("Signing in with a normal user account") - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - username_one = self.pages.top_navbar.get_text_of_logged_in_username() - - self.logger.info("Accessing the 'Edit My Profile' page") - - self.pages.top_navbar.click_on_edit_profile_option() - - if self.pages.edit_my_profile_page.is_make_email_visible_checkbox_selected(): - self.pages.edit_my_profile_page.click_make_email_visible_checkbox() - self.pages.edit_my_profile_page.click_update_my_profile_button() - - self.logger.info( - "Checkbox is unchecked, returning to My Profile page " - "and verifying that the email is not displayed" - ) - self.pages.user_navbar.click_on_my_profile_option() - - assert not ( - self.pages.my_profile_page.is_publicly_displayed_email_displayed() - ), "The email address is displayed inside the profile! It shouldn't be!" - - self.logger.info("Signing in with a different user") - - self.pages.my_profile_page.click_my_profile_page_sign_out_button() - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_13"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.logger.info( - "Accessing the previous user profile and verifying that " - "the email address is not displayed" - ) - - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - # This also needs an update - self.pages.homepage.navigate_to(MyProfileMessages.get_my_profile_stage_url(username_one)) - - assert not ( - self.pages.my_profile_page.is_publicly_displayed_email_displayed() - ), "The email address is displayed inside the profile! It shouldn't be!" - - # C2107900, C2107900 - @pytest.mark.userPageTests - def test_website_information_is_displayed(self): - self.logger.info("Signing in with a normal user account") - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - username_one = self.pages.top_navbar.get_text_of_logged_in_username() - - self.logger.info("Accessing the 'Edit My Profile' page") - - self.pages.top_navbar.click_on_edit_profile_option() - - website_field_test_data = super().profile_edit_test_data["valid_user_edit"]["website"] - self.pages.edit_my_profile_page.clear_website_field() - self.pages.edit_my_profile_page.send_text_to_website_field(website_field_test_data) - self.pages.edit_my_profile_page.click_update_my_profile_button() - - self.logger.info("Verify that the correct website is displayed") - - check.equal( - self.pages.my_profile_page.get_my_profile_website_text(), - website_field_test_data, - f"Incorrect website displayed. Expected: {website_field_test_data}, " - f"received: {self.pages.my_profile_page.get_my_profile_website_text()}", - ) - - self.logger.info( - "Signing in with a different user and verifying that the correct website information " - "is displayed for the first user" - ) - - self.pages.my_profile_page.click_my_profile_page_sign_out_button() - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_13"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.pages.homepage.navigate_to(MyProfileMessages.get_my_profile_stage_url(username_one)) - - check.equal( - self.pages.my_profile_page.get_my_profile_website_text(), - website_field_test_data, - f"Incorrect website displayed. Expected: {website_field_test_data}, " - f"received: {self.pages.my_profile_page.get_my_profile_website_text()}", - ) - - self.logger.info( - "Clicking on the website and verifying that the user is redirected correctly" - ) - - self.pages.my_profile_page.click_on_my_website_link() - - check.is_in( - website_field_test_data, - self.pages.homepage.current_url(), - f"Incorrect user redirect. Expected: {website_field_test_data} " - f"received: {self.pages.homepage.current_url()}", - ) - - self.logger.info("Navigating back to the SUMO page") - - self.pages.homepage.navigate_back() - - self.pages.top_navbar.click_on_sign_out_button() - - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.pages.homepage.navigate_to(MyProfileMessages.get_my_profile_stage_url(username_one)) - - check.equal( - self.pages.my_profile_page.get_my_profile_website_text(), - website_field_test_data, - f"Incorrect website displayed. Expected: {website_field_test_data}, " - f"received: {self.pages.my_profile_page.get_my_profile_website_text()}", - ) - - self.logger.info( - "Clicking on the website and verifying that the user is redirected correctly" - ) - - self.pages.my_profile_page.click_on_my_website_link() - - check.is_in( - website_field_test_data, - self.pages.homepage.current_url(), - f"Incorrect user redirect. Expected: {website_field_test_data} " - f"received: {self.pages.homepage.current_url()}", - ) - - self.logger.info("Navigating back to the SUMO page") - - self.pages.homepage.navigate_back() - - self.logger.info("Clearing the website field changes") - - self.pages.top_navbar.click_on_sign_out_button() - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - self.pages.top_navbar.click_on_edit_profile_option() - self.pages.edit_my_profile_page.clear_website_field() - self.pages.edit_my_profile_page.click_update_my_profile_button() - - # C2107901, C2107901 - @pytest.mark.userPageTests - def test_twitter_information_is_displayed(self): - self.logger.info("Signing in with a normal user account") - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - username_one = self.pages.top_navbar.get_text_of_logged_in_username() - - self.logger.info("Accessing the 'Edit My Profile' page") - - self.pages.top_navbar.click_on_edit_profile_option() - - self.logger.info("Clearing and adding data inside the twitter input field") - - twitter_field_test_data = super().profile_edit_test_data["valid_user_edit"][ - "twitter_username" - ] - self.pages.edit_my_profile_page.clear_twitter_field() - self.pages.edit_my_profile_page.send_text_to_twitter_username_field( - twitter_field_test_data - ) - self.pages.edit_my_profile_page.click_update_my_profile_button() - - self.logger.info( - "Navigating back to the My Profile page and verify " - "that the correct twitter is displayed" - ) - - self.pages.top_navbar.click_on_view_profile_option() - - check.equal( - self.pages.my_profile_page.get_my_profile_twitter_text(), - twitter_field_test_data, - f"Incorrect twitter displayed. Expected: {twitter_field_test_data}, " - f"received: {self.pages.my_profile_page.get_my_profile_twitter_text()}", - ) - - self.logger.info( - "Signing in with a different user and verifying that the correct website information " - "is displayed for the first user" - ) - - self.pages.my_profile_page.click_my_profile_page_sign_out_button() - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_13"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.pages.homepage.navigate_to(MyProfileMessages.get_my_profile_stage_url(username_one)) - - check.equal( - self.pages.my_profile_page.get_my_profile_twitter_text(), - twitter_field_test_data, - f"Incorrect twitter displayed. Expected: {twitter_field_test_data}, " - f"received: {self.pages.my_profile_page.get_my_profile_twitter_text()}", - ) - - self.logger.info( - "Clicking on the twitter link and verifying that the user is redirected correctly" - ) - - self.pages.my_profile_page.click_on_twitter_link() - - check.is_in( - MyProfileMessages.TWITTER_REDIRECT_LINK + twitter_field_test_data, - self.pages.homepage.current_url(), - f"Incorrect user redirect. " - f"Expected: {MyProfileMessages.TWITTER_REDIRECT_LINK + twitter_field_test_data} " - f"received: {self.pages.homepage.current_url()}", - ) - - self.logger.info("Navigating back to the SUMO page") - - self.pages.homepage.navigate_back() - - self.logger.info( - "Signing out, accessing the profile and verifying that " - "the twitter information is displayed" - ) - - self.pages.top_navbar.click_on_sign_out_button() - - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.pages.homepage.navigate_to(MyProfileMessages.get_my_profile_stage_url(username_one)) - - check.equal( - self.pages.my_profile_page.get_my_profile_twitter_text(), - twitter_field_test_data, - f"Incorrect twitter displayed. Expected: {twitter_field_test_data}, " - f"received: {self.pages.my_profile_page.get_my_profile_twitter_text()}", - ) - - self.logger.info( - "Clicking on the twitter link and verifying that the user is redirected correctly" - ) - - self.pages.my_profile_page.click_on_twitter_link() - - check.is_in( - MyProfileMessages.TWITTER_REDIRECT_LINK + twitter_field_test_data, - self.pages.homepage.current_url(), - f"Incorrect user redirect. " - f"Expected: {MyProfileMessages.TWITTER_REDIRECT_LINK + twitter_field_test_data} " - f"received: {self.pages.homepage.current_url()}", - ) - - self.logger.info("Navigating back to the SUMO page") - - self.pages.homepage.navigate_back() - - self.logger.info("Clearing the twitter field changes") - - self.pages.top_navbar.click_on_sign_out_button() - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.top_navbar.click_on_edit_profile_option() - self.pages.edit_my_profile_page.clear_twitter_field() - self.pages.edit_my_profile_page.click_update_my_profile_button() - - # C2107903, C2107903 - @pytest.mark.userPageTests - def test_community_portal_username_is_displayed(self): - self.logger.info("Signing in with a normal user account") - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - username_one = self.pages.top_navbar.get_text_of_logged_in_username() - - self.logger.info("Accessing the 'Edit My Profile' page") - - self.pages.top_navbar.click_on_edit_profile_option() - - self.logger.info("Clearing and adding data inside the Community Portal input field") - - community_portal_field_test_data = super().profile_edit_test_data["valid_user_edit"][ - "community_portal_username" - ] - self.pages.edit_my_profile_page.clear_community_portal_field() - self.pages.edit_my_profile_page.send_text_to_community_portal_field( - community_portal_field_test_data - ) - self.pages.edit_my_profile_page.click_update_my_profile_button() - - self.logger.info( - "Navigating back to the My Profile page and verify that " - "the correct Community portal information is displayed" - ) - - self.pages.top_navbar.click_on_view_profile_option() - - check.equal( - self.pages.my_profile_page.get_my_profile_community_portal_text(), - community_portal_field_test_data, - f"Incorrect community portal information is displayed. " - f"Expected: {community_portal_field_test_data}, " - f"received: {self.pages.my_profile_page.get_my_profile_community_portal_text()}", - ) - - self.logger.info( - "Signing in with a different user and verifying " - "that the correct community portal information is displayed for the first user" - ) - - self.pages.my_profile_page.click_my_profile_page_sign_out_button() - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_13"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.pages.homepage.navigate_to(MyProfileMessages.get_my_profile_stage_url(username_one)) - - check.equal( - self.pages.my_profile_page.get_my_profile_community_portal_text(), - community_portal_field_test_data, - f"Incorrect website displayed. Expected: {community_portal_field_test_data}, " - f"received: {self.pages.my_profile_page.get_my_profile_community_portal_text()}", - ) - - self.logger.info( - "Clicking on the community portal link and verifying " - "that the user is redirected correctly" - ) - - self.pages.my_profile_page.click_on_community_portal_link() - - check.is_in( - MyProfileMessages.COMMUNITY_PORTAL_LINK, - self.pages.homepage.current_url(), - f"Incorrect user redirect. Expected: {MyProfileMessages.TWITTER_REDIRECT_LINK} " - f"received: {self.pages.homepage.current_url()}", - ) - - self.logger.info("Navigating back to the SUMO page") - - self.pages.homepage.navigate_back() - - self.logger.info( - "Signing out, accessing the profile and verifying that " - "the community portal information is displayed" - ) - - self.pages.top_navbar.click_on_sign_out_button() - - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.pages.homepage.navigate_to(MyProfileMessages.get_my_profile_stage_url(username_one)) - - check.equal( - self.pages.my_profile_page.get_my_profile_community_portal_text(), - community_portal_field_test_data, - f"Incorrect community portal displayed. Expected: {community_portal_field_test_data}, " - f"received: {self.pages.my_profile_page.get_my_profile_community_portal_text()}", - ) - - self.logger.info( - "Clicking on the community portal link and verifying that " - "the user is redirected correctly" - ) - - self.pages.my_profile_page.click_on_community_portal_link() - - check.is_in( - MyProfileMessages.COMMUNITY_PORTAL_LINK, - self.pages.homepage.current_url(), - f"Incorrect user redirect. Expected: {MyProfileMessages.COMMUNITY_PORTAL_LINK} " - f"received: {self.pages.homepage.current_url()}", - ) - - self.logger.info("Navigating back to the SUMO page") - - self.pages.homepage.navigate_back() - - self.logger.info("Clearing the community portal field changes") - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.top_navbar.click_on_edit_profile_option() - self.pages.edit_my_profile_page.clear_community_portal_field() - self.pages.edit_my_profile_page.click_update_my_profile_button() - - # C2107902,C2107902 - @pytest.mark.userPageTests - def test_people_directory_information_is_displayed(self): - self.logger.info("Signing in with a normal user account") - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - username_one = self.pages.top_navbar.get_text_of_logged_in_username() - - self.logger.info("Accessing the 'Edit My Profile' page") - - self.pages.top_navbar.click_on_edit_profile_option() - - self.logger.info("Clearing and adding data inside the People Directory input field") - - people_directory_field_test_data = super().profile_edit_test_data["valid_user_edit"][ - "people_directory_username" - ] - self.pages.edit_my_profile_page.clear_people_directory_field() - self.pages.edit_my_profile_page.send_text_to_people_directory_username( - people_directory_field_test_data - ) - self.pages.edit_my_profile_page.click_update_my_profile_button() - - self.logger.info( - "Navigating back to the My Profile page and verify that " - "the correct People Directory information is displayed" - ) - - self.pages.top_navbar.click_on_view_profile_option() - - check.equal( - self.pages.my_profile_page.get_my_profile_people_directory_text(), - people_directory_field_test_data, - f"Incorrect people directory text displayed. " - f"Expected: {people_directory_field_test_data}, " - f"received: {self.pages.my_profile_page.get_my_profile_people_directory_text()}", - ) - - self.logger.info( - "Signing in with a different user and verifying that " - "the correct people directory information is displayed for the first user" - ) - - self.pages.my_profile_page.click_my_profile_page_sign_out_button() - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_13"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.pages.homepage.navigate_to(MyProfileMessages.get_my_profile_stage_url(username_one)) - - check.equal( - self.pages.my_profile_page.get_my_profile_people_directory_text(), - people_directory_field_test_data, - f"Incorrect people directory information displayed. " - f"Expected: {people_directory_field_test_data}, " - f"received: {self.pages.my_profile_page.get_my_profile_people_directory_text()}", - ) - - self.logger.info( - "Signing out, accessing the profile and verifying that " - "the people directory information is displayed" - ) - - self.pages.top_navbar.click_on_sign_out_button() - - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.pages.homepage.navigate_to(MyProfileMessages.get_my_profile_stage_url(username_one)) - - check.equal( - self.pages.my_profile_page.get_my_profile_people_directory_text(), - people_directory_field_test_data, - f"Incorrect people directory displayed. Expected: {people_directory_field_test_data}, " - f"received: {self.pages.my_profile_page.get_my_profile_people_directory_text()}", - ) - - self.logger.info("Clearing the people directory field changes") - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.top_navbar.click_on_edit_profile_option() - self.pages.edit_my_profile_page.clear_people_directory_field() - self.pages.edit_my_profile_page.click_update_my_profile_button() - - # C2107933, C2107933 - @pytest.mark.userPageTests - def test_matrix_information_is_displayed(self): - self.logger.info("Signing in with a normal user account") - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - username_one = self.pages.top_navbar.get_text_of_logged_in_username() - - self.logger.info("Accessing the 'Edit My Profile' page") - - self.pages.top_navbar.click_on_edit_profile_option() - - self.logger.info("Clearing and adding data inside the Matrix input field") - - matrix_field_test_data = super().profile_edit_test_data["valid_user_edit"][ - "matrix_nickname" - ] - self.pages.edit_my_profile_page.clear_matrix_field() - self.pages.edit_my_profile_page.send_text_to_matrix_nickname_field(matrix_field_test_data) - self.pages.edit_my_profile_page.click_update_my_profile_button() - - self.logger.info( - "Navigating back to the My Profile page and verify that the " - "correct Matrix information is displayed" - ) - - self.pages.top_navbar.click_on_view_profile_option() - - check.is_in( - matrix_field_test_data, - self.pages.my_profile_page.get_my_profile_matrix_text(), - f"Incorrect Matrix text displayed. Expected: {matrix_field_test_data}, " - f"received: {self.pages.my_profile_page.get_my_profile_matrix_text()}", - ) - - self.logger.info( - "Signing in with a different user and verifying that the correct Matrix information " - "is displayed for the first user" - ) - - self.pages.my_profile_page.click_my_profile_page_sign_out_button() - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_13"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.pages.homepage.navigate_to(MyProfileMessages.get_my_profile_stage_url(username_one)) - - check.is_in( - matrix_field_test_data, - self.pages.my_profile_page.get_my_profile_matrix_text(), - f"Incorrect matrix information displayed. Expected: {matrix_field_test_data}, " - f"received: {self.pages.my_profile_page.get_my_profile_matrix_text()}", - ) - - self.logger.info( - "Signing out, accessing the profile and verifying that the " - "Matrix information is displayed" - ) - - self.pages.top_navbar.click_on_sign_out_button() - - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.pages.homepage.navigate_to(MyProfileMessages.get_my_profile_stage_url(username_one)) - - check.is_in( - matrix_field_test_data, - self.pages.my_profile_page.get_my_profile_matrix_text(), - f"Incorrect matrix displayed. Expected: {matrix_field_test_data}, " - f"received: {self.pages.my_profile_page.get_my_profile_matrix_text()}", - ) - - self.logger.info("Clearing the Matrix field changes") - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.top_navbar.click_on_edit_profile_option() - self.pages.edit_my_profile_page.clear_matrix_field() - self.pages.edit_my_profile_page.click_update_my_profile_button() - - # C2107934, C2107934 - @pytest.mark.userPageTests - def test_country_location_information_is_displayed(self): - self.logger.info("Signing in with a normal user account") - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - username_one = self.pages.top_navbar.get_text_of_logged_in_username() - - self.logger.info("Accessing the 'Edit My Profile' page") - - self.pages.top_navbar.click_on_edit_profile_option() - - self.logger.info("Clearing and adding data inside the Country input field") - - country_field_test_data_code = super().profile_edit_test_data["valid_user_edit"][ - "country_code" - ] - country_field_test_data_value = super().profile_edit_test_data["valid_user_edit"][ - "country_value" - ] - self.pages.edit_my_profile_page.clear_country_dropdown_field() - self.pages.edit_my_profile_page.select_country_dropdown_option_by_value( - country_field_test_data_code - ) - self.pages.edit_my_profile_page.click_update_my_profile_button() - - self.logger.info("Verify that the correct Country information is displayed") - - check.is_in( - country_field_test_data_value, - self.pages.my_profile_page.get_text_of_profile_subheading_location(), - f"Incorrect Country text displayed. Expected: {country_field_test_data_value}, " - f"received: {self.pages.my_profile_page.get_text_of_profile_subheading_location()}", - ) - - self.logger.info( - "Signing in with a different user and verifying that the correct Country information " - "is displayed for the first user" - ) - - self.pages.my_profile_page.click_my_profile_page_sign_out_button() - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_13"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.pages.homepage.navigate_to(MyProfileMessages.get_my_profile_stage_url(username_one)) - - check.is_in( - country_field_test_data_value, - self.pages.my_profile_page.get_text_of_profile_subheading_location(), - f"Incorrect country information displayed. Expected: {country_field_test_data_value}, " - f"received: {self.pages.my_profile_page.get_text_of_profile_subheading_location()}", - ) - - self.logger.info( - "Signing out, accessing the profile and verifying that the " - "Country information is displayed" - ) - - self.pages.top_navbar.click_on_sign_out_button() - - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.pages.homepage.navigate_to(MyProfileMessages.get_my_profile_stage_url(username_one)) - - check.is_in( - country_field_test_data_value, - self.pages.my_profile_page.get_text_of_profile_subheading_location(), - f"Incorrect country displayed. Expected: {country_field_test_data_value}, " - f"received: {self.pages.my_profile_page.get_text_of_profile_subheading_location()}", - ) - - self.logger.info("Clearing the Country field changes") - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.top_navbar.click_on_edit_profile_option() - self.pages.edit_my_profile_page.clear_country_dropdown_field() - self.pages.edit_my_profile_page.click_update_my_profile_button() - - # C2107935, C2107935 - @pytest.mark.userPageTests - def test_city_location_information_is_displayed(self): - self.logger.info("Signing in with a normal user account") - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - username_one = self.pages.top_navbar.get_text_of_logged_in_username() - - self.logger.info("Accessing the 'Edit My Profile' page") - - self.pages.top_navbar.click_on_edit_profile_option() - - self.logger.info("Clearing and adding data inside the City input field") - - city_field_test_data_value = super().profile_edit_test_data["valid_user_edit"]["city"] - self.pages.edit_my_profile_page.clear_city_field() - self.pages.edit_my_profile_page.sent_text_to_city_field(city_field_test_data_value) - self.pages.edit_my_profile_page.click_update_my_profile_button() - - self.logger.info("Verify that the correct City information is displayed") - - check.is_in( - city_field_test_data_value, - self.pages.my_profile_page.get_text_of_profile_subheading_location(), - f"Incorrect City text displayed. Expected: {city_field_test_data_value}, " - f"received: {self.pages.my_profile_page.get_text_of_profile_subheading_location()}", - ) - - self.logger.info( - "Signing in with a different user and verifying that the correct City information " - "is displayed for the first user" - ) - - self.pages.my_profile_page.click_my_profile_page_sign_out_button() - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_13"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.pages.homepage.navigate_to(MyProfileMessages.get_my_profile_stage_url(username_one)) - - check.is_in( - city_field_test_data_value, - self.pages.my_profile_page.get_text_of_profile_subheading_location(), - f"Incorrect city information displayed. Expected: {city_field_test_data_value}, " - f"received: {self.pages.my_profile_page.get_text_of_profile_subheading_location()}", - ) - - self.logger.info( - "Signing out, accessing the profile and verifying that the " - "City information is displayed" - ) - - self.pages.top_navbar.click_on_sign_out_button() - - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.pages.homepage.navigate_to(MyProfileMessages.get_my_profile_stage_url(username_one)) - - check.is_in( - city_field_test_data_value, - self.pages.my_profile_page.get_text_of_profile_subheading_location(), - f"Incorrect city displayed. Expected: {city_field_test_data_value}, " - f"received: {self.pages.my_profile_page.get_text_of_profile_subheading_location()}", - ) - - self.logger.info("Clearing the City field changes") - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.top_navbar.click_on_edit_profile_option() - self.pages.edit_my_profile_page.clear_city_field() - self.pages.edit_my_profile_page.click_update_my_profile_button() - - # C2107938, C2107938 - @pytest.mark.userPageTests - def test_involved_since_information_is_displayed(self): - self.logger.info("Signing in with a normal user account") - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - username_one = self.pages.top_navbar.get_text_of_logged_in_username() - - self.logger.info("Accessing the 'Edit My Profile' page") - - self.pages.top_navbar.click_on_edit_profile_option() - - self.logger.info("Clearing and adding data inside the involved since input fields") - - involved_since_month_number_test_data = super().profile_edit_test_data["valid_user_edit"][ - "involved_from_month_number" - ] - involved_since_month_test_data_value = super().profile_edit_test_data["valid_user_edit"][ - "involved_from_month_value" - ] - involved_since_year_test_data_value = super().profile_edit_test_data["valid_user_edit"][ - "involved_from_year" - ] - self.pages.edit_my_profile_page.clear_involved_from_month_select_field() - self.pages.edit_my_profile_page.clear_involved_from_year_select_field() - self.pages.edit_my_profile_page.select_involved_with_mozilla_from_month_option_by_value( - involved_since_month_number_test_data - ) - self.pages.edit_my_profile_page.select_involved_with_mozilla_from_year_option_by_value( - involved_since_year_test_data_value - ) - self.pages.edit_my_profile_page.click_update_my_profile_button() - - self.logger.info("Verify that the correct involved from information is displayed") - - check.is_in( - involved_since_month_test_data_value and involved_since_year_test_data_value, - self.pages.my_profile_page.get_my_contributed_from_text(), - f"Incorrect involved from text displayed. " - f"Expected to contain: {involved_since_month_test_data_value} " - f"and {involved_since_year_test_data_value}, " - f"received: {self.pages.my_profile_page.get_my_contributed_from_text()}", - ) - - self.logger.info( - "Signing in with a different user and verifying that the " - "correct involved from information is displayed for the first user" - ) - - self.pages.my_profile_page.click_my_profile_page_sign_out_button() - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_13"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.pages.homepage.navigate_to(MyProfileMessages.get_my_profile_stage_url(username_one)) - - check.is_in( - involved_since_month_test_data_value and involved_since_year_test_data_value, - self.pages.my_profile_page.get_my_contributed_from_text(), - f"Incorrect involved from information displayed. " - f"Expected to contain: {involved_since_month_test_data_value} and" - f" {involved_since_year_test_data_value}, " - f"received: {self.pages.my_profile_page.get_my_contributed_from_text()}", - ) - - self.logger.info( - "Signing out, accessing the profile and verifying that the " - "involved from information is displayed" - ) - - self.pages.top_navbar.click_on_sign_out_button() - - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.pages.homepage.navigate_to(MyProfileMessages.get_my_profile_stage_url(username_one)) - - check.is_in( - involved_since_month_test_data_value and involved_since_year_test_data_value, - self.pages.my_profile_page.get_my_contributed_from_text(), - f"Incorrect involved from text displayed. " - f"Expected to contain: {involved_since_month_test_data_value} " - f"and {involved_since_year_test_data_value}, " - f"received: {self.pages.my_profile_page.get_my_contributed_from_text()}", - ) - - self.logger.info("Clearing the involved from field changes") - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.top_navbar.click_on_edit_profile_option() - self.pages.edit_my_profile_page.clear_involved_from_month_select_field() - self.pages.edit_my_profile_page.clear_involved_from_year_select_field() - self.pages.edit_my_profile_page.click_update_my_profile_button() - - # C2087552, C2108840 - @pytest.mark.userPageTests - def test_edit_user_profile_button_is_not_displayed_for_non_admin_users(self): - target_username = self.remove_character_from_string( - super().username_extraction_from_email( - super().user_secrets_data["TEST_ACCOUNT_SPECIAL_CHARS"] - ), - "*", - ) - - self.logger.info("Accessing a user profile while not being signed in to SUMO") - - self.pages.homepage.navigate_to( - MyProfileMessages.get_my_profile_stage_url(target_username) - ) - - self.logger.info("Verifying that the 'Edit user profile' option is not displayed") - - assert not ( - self.pages.my_profile_page.is_edit_user_profile_option_displayed() - ), "The edit user profile button is displayed!. It shouldn't be!" - - self.logger.info( - "Navigating to the profile edit link directly and verifying that the " - "user is redirected to the auth page" - ) - - self.pages.my_profile_page.navigate_to( - EditMyProfilePageMessages.get_url_of_other_profile_edit_page(target_username) - ) - - assert ( - self.pages.auth_page.is_continue_with_firefox_button_displayed() - ), "The auth page is not displayed! It should be!" - - assert not ( - self.pages.edit_my_profile_page.is_my_profile_edit_form_displayed() - ), "The my profile edit input form is displayed! It shouldn't be!" - - self.logger.info("Signin in with a simple user account") - - self.pages.top_navbar.click_on_sumo_nav_logo() - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.logger.info("Accessing another user's account") - - self.pages.homepage.navigate_to( - MyProfileMessages.get_my_profile_stage_url(target_username) - ) - - self.logger.info("Verifying that the 'Edit user profile' option is not displayed") - - assert not ( - self.pages.my_profile_page.is_edit_user_profile_option_displayed() - ), "The edit user profile button is displayed!. It shouldn't be!" - - self.logger.info( - "Navigating to the profile edit link directly and verifying that the " - "correct message is displayed and the " - "edit form is not displayed" - ) - - self.pages.my_profile_page.navigate_to( - EditMyProfilePageMessages.get_url_of_other_profile_edit_page(target_username) - ) - - check.equal( - self.pages.edit_my_profile_page.get_access_denied_header_text(), - EditMyProfilePageMessages.PROFILE_ACCESS_DENIED_HEADING, - f"Incorrect access denied heading displayed. " - f"Expected: {EditMyProfilePageMessages.PROFILE_ACCESS_DENIED_HEADING} " - f"received: {self.pages.edit_my_profile_page.get_access_denied_header_text()}", - ) - - check.equal( - self.pages.edit_my_profile_page.get_access_denied_subheading_text(), - EditMyProfilePageMessages.PROFILE_ACCESS_DENIED_SUBHEADING, - f"Incorrect access denied subheading displayed. " - f"Expected: {EditMyProfilePageMessages.PROFILE_ACCESS_DENIED_SUBHEADING} " - f" received: {self.pages.edit_my_profile_page.get_access_denied_subheading_text()}", - ) - - assert not ( - self.pages.edit_my_profile_page.is_my_profile_edit_form_displayed() - ), "The my profile edit input form is displayed! It shouldn't be!" - - # C2108839 - @pytest.mark.userPageTests - def test_report_user_is_displayed_and_accessible_for_signed_in_users_only(self): - target_username = self.remove_character_from_string( - super().username_extraction_from_email( - super().user_secrets_data["TEST_ACCOUNT_SPECIAL_CHARS"] - ), - "*", - ) - self.logger.info("Signing in with a normal user ") - - self.pages.top_navbar.click_on_signin_signup_button() - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.logger.info( - "Accessing another user profile and verifying that the " - "'Report Abuse' option is displayed" - ) - - self.pages.homepage.navigate_to( - MyProfileMessages.get_my_profile_stage_url(target_username) - ) - - check.is_true( - self.pages.my_profile_page.is_report_user_option_displayed(), - "The Report Abuse option is not displayed! It should be!", - ) - - self.logger.info("Clicking on the 'Report Abuse' option") - - self.pages.my_profile_page.click_on_report_abuse_option() - - self.logger.info("Verifying that the report abuse panel is displayed") - - check.is_true( - self.pages.my_profile_page.is_report_abuse_panel_displayed(), - "The report abuse panel is not displayed. It should be!", - ) - - self.logger.info("Closing the report abuse panel") - self.pages.my_profile_page.click_on_report_abuse_close_button() - - self.logger.info("Verifying that the report user panel is no longer displayed") - - check.is_false( - self.pages.my_profile_page.is_report_abuse_panel_displayed(), - "The report user panel is displayed! It shouldn't be!", - ) - - self.logger.info( - "Signing out and verifying that the 'Report Abuse' options is not displayed" - ) - self.pages.top_navbar.click_on_sign_out_button() - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.logger.info( - "Accessing another users profile and verifying that the " - "'report abuse' option is not displayed" - ) - - self.pages.homepage.navigate_to( - MyProfileMessages.get_my_profile_stage_url(target_username) - ) - - check.is_false( - self.pages.my_profile_page.is_report_user_option_displayed(), - "The Report Abuse option is displayed! It shouldn't be while " - "not signed in with a SUMO account", - ) - - # C2108841 - @pytest.mark.userPageTests - def test_private_message_button_redirects_non_signed_in_users_to_the_fxa_login_flow(self): - target_username = self.remove_character_from_string( - super().username_extraction_from_email( - super().user_secrets_data["TEST_ACCOUNT_SPECIAL_CHARS"] - ), - "*", - ) - self.logger.info("Accessing another users profile") - - self.pages.homepage.navigate_to( - MyProfileMessages.get_my_profile_stage_url(target_username) - ) - - self.logger.info("Clicking on the 'Private Message' button") - - self.pages.my_profile_page.click_on_private_message_button() - - self.logger.info("Verifying that the non-signed in user is redirected to the fxa page") - - assert ( - self.pages.auth_page.is_continue_with_firefox_button_displayed() - ), "The auth page is not displayed! It should be!" - - # C916055, C916054 - @pytest.mark.userPageTests - def test_deactivate_this_user_buttons_are_displayed_only_for_admin_users(self): - target_username = self.remove_character_from_string( - super().username_extraction_from_email( - super().user_secrets_data["TEST_ACCOUNT_SPECIAL_CHARS"] - ), - "*", - ) - self.logger.info("Navigating to a user profile while not signed in with a user") - - self.pages.homepage.navigate_to( - MyProfileMessages.get_my_profile_stage_url(target_username) - ) - - self.logger.info("Verifying that the deactivate this user buttons are not displayed") - - assert not ( - self.pages.my_profile_page.is_deactivate_this_user_button_displayed() - ), "The deactivate this user button is displayed. It shouldn't be!" - - assert not ( - self.pages.my_profile_page.is_deactivate_this_user_and_mark_content_as_spam_displayed() - ), ( - "The deactivate this user and mark all content as " - "spam button is displayed. It shouldn't be!" - ) - - self.logger.info("Sign in with a normal user account") - - self.pages.top_navbar.click_on_sumo_nav_logo() - self.pages.top_navbar.click_on_signin_signup_button() - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.logger.info( - "Accessing another user profile and verify that the " - "deactivate this user buttons are not displayed" - ) - - self.pages.homepage.navigate_to( - MyProfileMessages.get_my_profile_stage_url(target_username) - ) - - assert not ( - self.pages.my_profile_page.is_deactivate_this_user_button_displayed() - ), "The deactivate this user button is displayed. It shouldn't be!" - - assert not ( - self.pages.my_profile_page.is_deactivate_this_user_and_mark_content_as_spam_displayed() - ), "The deactivate this user and mark all content as spam but" - - self.logger.info("Signing in with a moderator account") - - self.pages.top_navbar.click_on_sumo_nav_logo() - self.pages.top_navbar.click_on_sign_out_button() - - self.pages.top_navbar.click_on_signin_signup_button() - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_MODERATOR"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.logger.info( - "Accessing another user profile and verifying that " - "the deactivate user buttons are displayed" - ) - - self.pages.homepage.navigate_to( - MyProfileMessages.get_my_profile_stage_url(target_username) - ) - - assert ( - self.pages.my_profile_page.is_deactivate_this_user_button_displayed() - ), "The deactivate this user button is not displayed. It should be!" - - assert ( - self.pages.my_profile_page.is_deactivate_this_user_and_mark_content_as_spam_displayed() - ), "The deactivate this user button is not displayed. It should be!" diff --git a/selenium_tests/tests/user_page_tests/test_edit_my_settings.py b/selenium_tests/tests/user_page_tests/test_edit_my_settings.py deleted file mode 100644 index eabce21345c..00000000000 --- a/selenium_tests/tests/user_page_tests/test_edit_my_settings.py +++ /dev/null @@ -1,99 +0,0 @@ -import pytest -import pytest_check as check - -from selenium_tests.core.test_utilities import TestUtilities -from selenium_tests.messages.my_profile_pages_messages.edit_settings_page_messages import ( - EditSettingsPageMessages, -) - - -class TestEditMySettings(TestUtilities): - # C891396, C2108836 - @pytest.mark.userSettings - def test_all_checkboxes_can_be_selected_and_saved(self): - self.logger.info( - "Signing in to a normal user account " - "and accessing edit settings page via the top-navbar menu" - ) - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.top_navbar.click_on_settings_profile_option() - - self.logger.info("Clicking on all available checkboxes") - - self.pages.edit_my_profile_settings_page.click_on_all_settings_checkboxes() - - self.logger.info("Clicking on the 'Update' button") - - self.pages.edit_my_profile_settings_page.click_on_update_button() - - self.logger.info("Verifying that the correct notification banner is displayed") - - check.equal( - self.pages.edit_my_profile_settings_page.get_settings_saved_notif_banner_text(), - EditSettingsPageMessages.MODIFIED_SETTINGS_NOTIFICATION_BANNER_MESSAGE, - f"Incorrect message displayed inside the notification banner. Expected:" - f" {EditSettingsPageMessages.MODIFIED_SETTINGS_NOTIFICATION_BANNER_MESSAGE} " - f"but received: " - f"{self.pages.edit_my_profile_settings_page.get_settings_saved_notif_banner_text()}", - ) - - self.logger.info( - "Closing the notification banner and verifying that the banner is no longer displayed" - ) - - self.pages.edit_my_profile_settings_page.click_settings_saved_notification_banner() - - check.is_false( - self.pages.edit_my_profile_settings_page.is_notification_banner_displayed(), - "The notification banner is displayed. It shouldn't be!", - ) - - self.logger.info("Verifying that all the checkboxes are checked") - - assert ( - self.pages.edit_my_profile_settings_page.are_all_checkbox_checked() - ), "Not all checkboxes are checked!" - - self.logger.info( - "Unchecking all the available checkboxes and clicking on the 'Update' button" - ) - - self.pages.edit_my_profile_settings_page.click_on_all_settings_checkboxes() - - self.pages.edit_my_profile_settings_page.click_on_update_button() - - self.logger.info("Verifying that the correct notification banner is displayed") - - check.equal( - self.pages.edit_my_profile_settings_page.get_settings_saved_notif_banner_text(), - EditSettingsPageMessages.MODIFIED_SETTINGS_NOTIFICATION_BANNER_MESSAGE, - f"Incorrect message displayed inside the notification banner. Expected:" - f" {EditSettingsPageMessages.MODIFIED_SETTINGS_NOTIFICATION_BANNER_MESSAGE} " - f"but received: " - f"{self.pages.edit_my_profile_settings_page.get_settings_saved_notif_banner_text()}", - ) - - self.logger.info( - "Closing the notification banner and verifying that the banner is no longer displayed" - ) - - self.pages.edit_my_profile_settings_page.click_settings_saved_notification_banner() - - check.is_false( - self.pages.edit_my_profile_settings_page.is_notification_banner_displayed(), - "The notification banner is displayed. It shouldn't be!", - ) - - self.logger.info("Verifying that all the checkboxes are unchecked") - - assert not ( - self.pages.edit_my_profile_settings_page.are_all_checkbox_checked() - ), "Not all checkboxes are unchecked!" diff --git a/selenium_tests/tests/user_page_tests/test_my_questions.py b/selenium_tests/tests/user_page_tests/test_my_questions.py deleted file mode 100644 index d543659e684..00000000000 --- a/selenium_tests/tests/user_page_tests/test_my_questions.py +++ /dev/null @@ -1,284 +0,0 @@ -import pytest -from selenium_tests.core.test_utilities import TestUtilities -from selenium_tests.messages.my_profile_pages_messages.my_questions_page_messages import ( - MyQuestionsPageMessages, -) - - -class TestMyQuestions(TestUtilities): - # C2094280, C890790 - @pytest.mark.userQuestions - def test_number_of_questions_is_incremented_when_posting_a_question(self): - self.logger.info("Signing in wit a normal user account") - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_MODERATOR"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.logger.info("Accessing the 'My profile' page via the top-navbar menu") - - self.pages.top_navbar.click_on_view_profile_option() - - self.logger.info("Extracting original number of posted questions") - - original_number_of_questions = self.number_extraction_from_string( - self.pages.my_profile_page.get_my_profile_questions_text() - ) - - self.logger.info("Posting a new AAQ question") - - question_info = ( - self.pages.aaq_flow.submit_valid_firefox_product_question_via_ask_now_fx_solutions() - ) - - self.logger.info("Navigating back to the My Profile page") - - self.pages.top_navbar.click_on_view_profile_option() - new_number = self.number_extraction_from_string( - self.pages.my_profile_page.get_my_profile_questions_text() - ) - - assert ( - self.number_extraction_from_string( - self.pages.my_profile_page.get_my_profile_questions_text() - ) - == original_number_of_questions + 1 - ), ( - f"The number of questions should have incremented! " - f"The original number of question was: " - f"{original_number_of_questions}" - f" The new number of questions is: " - f"{new_number}" - ) - - self.logger.info("Deleting the my posted question") - - self.pages.my_answers_page.navigate_to(question_info["question_page_url"]) - - self.pages.question_page.click_delete_this_question_question_tools_option() - - self.pages.question_page.click_delete_this_question_button() - - self.logger.info("Verifying that we are on the product support forum page after deletion") - - assert ( - self.pages.product_support_page.is_product_product_title_displayed() - ), "The product support forum page is not displayed!" - - # write tests to check my questions section as well - - # C1296000, # C890790 - @pytest.mark.userQuestions - def test_my_contributions_questions_reflects_my_questions_page_numbers(self): - self.logger.info("Signing in wit a normal user account") - - self.pages.top_navbar.click_on_signin_signup_button() - - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_12"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.logger.info("Accessing the 'My profile' page via the top-navbar menu") - - self.pages.top_navbar.click_on_view_profile_option() - - self.logger.info("Extracting the number of questions listed inside the my profile page") - - number_of_questions = self.number_extraction_from_string( - self.pages.my_profile_page.get_my_profile_questions_text() - ) - - self.logger.info("Clicking on the my profile questions link") - - self.pages.my_profile_page.click_on_my_profile_questions_link() - - self.logger.info( - "Verifying that the number of questions from the" - " my profile pages matches the ones from my questions " - "page" - ) - - assert number_of_questions == self.pages.my_questions_page.get_number_of_questions(), ( - f"The number of questions listed inside the my profile page is:" - f" {number_of_questions} " - f"The number of questions listed inside the my questions page is:" - f" {self.pages.my_questions_page.get_number_of_questions()}" - ) - - # C890821 - @pytest.mark.userQuestions - def test_correct_messages_is_displayed_if_user_has_no_posted_questions(self): - self.logger.info("Signing in with a user which has no posted questions") - - self.pages.top_navbar.click_on_signin_signup_button() - - original_user = super().remove_character_from_string( - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_SPECIAL_CHARS"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ), - "*", - ) - - self.logger.info("Accessing the 'My questions' page") - - self.pages.top_navbar.click_on_view_profile_option() - - self.pages.user_navbar.click_on_my_questions_option() - - self.logger.info("Verifying that the correct message is displayed") - - assert ( - self.pages.my_questions_page.get_text_of_no_question_message() - == MyQuestionsPageMessages.NO_POSTED_QUESTIONS_MESSAGE - ), ( - f"Incorrect message is displayed!. " - f"Expected: {MyQuestionsPageMessages.NO_POSTED_QUESTIONS_MESSAGE} " - f"received: {self.pages.my_questions_page.get_text_of_no_question_message()}" - ) - - self.logger.info("Verifying that a question list is not displayed") - - assert not ( - self.pages.my_questions_page.is_question_list_displayed() - ), "Question list displayed! It shouldn't be" - - self.logger.info("Posting a new aaq question") - - question_info = ( - self.pages.aaq_flow.submit_valid_firefox_product_question_via_ask_now_fx_solutions() - ) - - self.logger.info( - "Accessing the my questions page and verifying that the " - "no questions message is no longer displayed" - ) - - self.pages.top_navbar.click_on_view_profile_option() - self.pages.user_navbar.click_on_my_questions_option() - - assert not ( - self.pages.my_questions_page.is_no_question_message_displayed() - ), "The no questions message is displayed! It shouldn't be!" - - self.logger.info("Signing in with a moderator account") - - self.pages.top_navbar.click_on_sign_out_button() - self.pages.top_navbar.click_on_signin_signup_button() - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_MODERATOR"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.logger.info("Deleting the my posted question") - - self.pages.my_questions_page.navigate_to(question_info["question_page_url"]) - - self.pages.question_page.click_delete_this_question_question_tools_option() - - self.pages.question_page.click_delete_this_question_button() - - self.logger.info( - "Accessing the original user and verifying that the correct message is displayed" - ) - - self.pages.homepage.navigate_to( - MyQuestionsPageMessages.get_stage_my_questions_url(original_user) - ) - - assert ( - self.pages.my_questions_page.get_text_of_no_question_message() - == MyQuestionsPageMessages.get_no_posted_questions_other_user_message(original_user) - ), ( - f"Incorrect message displayed! " - f"Expected: " - f"{MyQuestionsPageMessages.get_no_posted_questions_other_user_message(original_user)} " - f"received: " - f"{self.pages.my_questions_page.get_text_of_no_question_message()}" - ) - - self.logger.info( - "Sign in with the original user an verify that the " - "correct message and the question list is no longer displayed" - ) - - self.pages.top_navbar.click_on_sign_out_button() - self.pages.top_navbar.click_on_signin_signup_button() - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_SPECIAL_CHARS"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - - self.pages.top_navbar.click_on_view_profile_option() - self.pages.user_navbar.click_on_my_questions_option() - - assert ( - self.pages.my_questions_page.get_text_of_no_question_message() - == MyQuestionsPageMessages.NO_POSTED_QUESTIONS_MESSAGE - ), ( - f"Incorrect message displayed! " - f"Expected: {MyQuestionsPageMessages.NO_POSTED_QUESTIONS_MESSAGE} " - f"received: {self.pages.my_questions_page.get_text_of_no_question_message()}" - ) - - # C890823, C890831 - @pytest.mark.userQuestions - def test_my_question_page_reflects_posted_questions_and_redirects_to_the_correct_question( - self, - ): - self.logger.info("Signing in with a moderator user account") - - self.pages.top_navbar.click_on_signin_signup_button() - self.pages.auth_flow_page.sign_in_flow( - username=super().user_secrets_data["TEST_ACCOUNT_MODERATOR"], - account_password=super().user_secrets_data["TEST_ACCOUNTS_PS"], - sign_in_with_same_account=False, - ) - self.pages.homepage.wait_for_searchbar_to_be_displayed_and_clickable() - - self.logger.info("Posting a new aaq question") - - question_info = ( - self.pages.aaq_flow.submit_valid_firefox_product_question_via_ask_now_fx_solutions() - ) - - self.logger.info( - "Verifying that the first element from the " - "My Questions page is the recently posted question" - ) - - self.pages.top_navbar.click_on_my_questions_profile_option() - - assert self.pages.my_questions_page.get_text_of_first_listed_question().replace( - " ", "" - ) == question_info["aaq_subject"].replace(" ", ""), ( - f" Expected: {question_info['aaq_subject']} " - f"Received: {self.pages.my_questions_page.get_text_of_first_listed_question()}" - ) - - self.logger.info( - "Clicking on the first listed item and verifying that " - "the user is redirected to the correct question" - ) - - self.pages.my_questions_page.click_on_a_question_by_index(1) - - assert self.pages.question_page.current_url() == question_info["question_page_url"], ( - f"We are on the wrong page. Expected: {question_info} " - f"received: {self.pages.question_page.current_url()}" - ) - - self.logger.info("Deleting the posted question") - - self.pages.question_page.click_delete_this_question_question_tools_option() - self.pages.question_page.click_delete_this_question_button()