- Fix failing AAQ and product solutions tests in Chrome.

This commit is contained in:
Emil Ghitta 2023-12-15 12:45:38 +02:00
Родитель 696baf8d2c
Коммит 1cd545467a
3 изменённых файлов: 19 добавлений и 7 удалений

Просмотреть файл

@ -27,6 +27,10 @@ class MyProfileMyQuestionsPage(BasePage):
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)

Просмотреть файл

@ -244,7 +244,9 @@ class TestAAQPage(TestUtilities):
).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()

Просмотреть файл

@ -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 (
@ -78,10 +78,17 @@ class TestProductSolutionsPage(TestUtilities):
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']")
@ -94,7 +101,6 @@ class TestProductSolutionsPage(TestUtilities):
f"Received: {popular_topic}"
)
feature_article_page.close()
else:
self.logger.info(f"{card} has no featured articles displayed!!!")