Skip to content

Commit

Permalink
Merge pull request #5820 from emilghittasv/fix-failing-chrome-tests
Browse files Browse the repository at this point in the history
Fix failing AAQ and product solutions tests in Chrome.
  • Loading branch information
emilghittasv authored Dec 15, 2023
2 parents d09c978 + 1cd5454 commit 6fba803
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ 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 click_on_a_question_by_name(self, question_title: str):
xpath = f"//article[@id='profile']/ul/a/li[text()='{question_title}']"
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)
Expand Down
4 changes: 3 additions & 1 deletion playwright_tests/tests/aaq_tests/test_aaq_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,9 @@ def test_post_aaq_questions_for_all_freemium_products_topics(self):
).to_be_visible()

self.logger.info("Clicking on the question and deleting it")
self.sumo_pages.my_questions_page.click_on_a_question_by_index(1)
self.sumo_pages.my_questions_page.click_on_a_question_by_name(
question_info['aaq_subject']
)

self.sumo_pages.question_page.click_delete_this_question_question_tools_option()
self.sumo_pages.question_page.click_delete_this_question_button()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
import pytest_check as check

from playwright.sync_api import expect
from playwright.sync_api import expect, TimeoutError
from playwright_tests.core.testutilities import TestUtilities
from playwright_tests.messages.AAQ_messages.aaq_widget import AAQWidgetMessages
from playwright_tests.messages.product_solutions_page_messages.product_solutions_messages import (
Expand Down Expand Up @@ -78,10 +78,17 @@ def test_popular_topics_redirect(self):
if self.sumo_pages.product_solutions_page._is_popular_topics_section_displayed:
for topic in self.sumo_pages.product_solutions_page._get_popular_topics():
self.sumo_pages.product_solutions_page._click_on_a_popular_topic_card(topic)

with self.page.context.expect_page() as tab:
feature_article_page = tab.value
print("Tab open")
try:
with self.page.context.expect_page() as tab:
feature_article_page = tab.value
print(f"Tab open for topic: {topic}")
except TimeoutError:
print("Trying to click on the popular topic again")
self.sumo_pages.product_solutions_page._click_on_a_popular_topic_card(
topic)
with self.page.context.expect_page() as tab:
feature_article_page = tab.value
print(f"Tab open for topic: {topic}")

popular_topic = (feature_article_page
.locator("//h1[@class='topic-title sumo-page-heading']")
Expand All @@ -94,7 +101,6 @@ def test_popular_topics_redirect(self):
f"Received: {popular_topic}"
)
feature_article_page.close()

else:
self.logger.info(f"{card} has no featured articles displayed!!!")

Expand Down

0 comments on commit 6fba803

Please sign in to comment.