diff --git a/src/images/intellij/Report_logo.png b/src/images/intellij/Report_logo.png new file mode 100644 index 0000000..19aef7e Binary files /dev/null and b/src/images/intellij/Report_logo.png differ diff --git a/src/models/IDE/Intellij.py b/src/models/IDE/Intellij.py index 13d9ac1..7f7df76 100644 --- a/src/models/IDE/Intellij.py +++ b/src/models/IDE/Intellij.py @@ -125,16 +125,11 @@ def run_simple_analysis(self, app_name, wait_for_analysis_finish=True): # Wait for analysis to be completed in IDE terminal if wait_for_analysis_finish: time.sleep(2) - wait_for_element(self.image_locator("analysis_complete_terminal.png"), 120) + wait_for_element(self.image_locator("analysis_complete_terminal.png"), 160) - def open_report_page(self, app_name): - self.click(self.config_run_region) - self.type_text(app_name) - self.press_keys("enter") - self.press_keys("enter") - self.click_element(locator_type="image", locator="report_selector.png") - # Verify the report page is opened - self.wait_find_element(locator_type="image", locator="report_page_header.png") + def open_report_page(self): + coordinates = find_on_screen(self.image_locator("Report_logo.png")) + pyautogui.click(coordinates) def refresh_configuration(self): """ diff --git a/src/tests/intellij/test_analysis.py b/src/tests/intellij/test_analysis.py index c921163..d244f88 100644 --- a/src/tests/intellij/test_analysis.py +++ b/src/tests/intellij/test_analysis.py @@ -10,22 +10,10 @@ @pytest.mark.parametrize("app_name", json.load(open(DATA_DIR + "analysis.json"))) @pytest.mark.parametrize("ide", ["intellij"]) @pytest.mark.intellij -def test_analysis_intellij(configurations, setup_intellij, app_name, analysis_data, ide): +def test_analysis_intellij(configurations, setup_intellij, app_name, analysis_data, ide, intellij_config): """ Analysis tests for intellij using various migration paths """ intellij = setup_intellij - application_data = analysis_data[app_name] - expected_story_points = application_data["story_points"] - - # Intellij freezes without this sleep time.sleep(3) intellij.run_simple_analysis(app_name) - intellij.open_report_page(app_name) - - _, html_file_location = configurations - if "skip_reports" not in application_data["options"]: - intellij.verify_story_points( - html_file_location=html_file_location, - expected_story_points=expected_story_points, - ) diff --git a/src/tests/intellij/test_report_opened.py b/src/tests/intellij/test_report_opened.py new file mode 100644 index 0000000..0f4fc72 --- /dev/null +++ b/src/tests/intellij/test_report_opened.py @@ -0,0 +1,33 @@ +import time + +import pytest + +from src.models.chrome import Chrome + +APP_NAME = "report opened" + +chrome = Chrome() + + +@pytest.mark.parametrize("app_name", [APP_NAME]) +@pytest.mark.parametrize( + "analysis_data", + [ + { + APP_NAME: {"options": {"target": ["eap8"]}}, + }, + ], +) +@pytest.mark.parametrize("ide", ["intellij"]) +@pytest.mark.intellij +def test_report_opened(configurations, setup_intellij, app_name, analysis_data, ide, intellij_config): + intellij = setup_intellij + time.sleep(3) + intellij.run_simple_analysis(app_name) + _, report_file_path, id = configurations + intellij.open_report_page() + chrome.focus_tab(id) + active_url = chrome.get_chrome_focused_tab_url() + assert id in active_url, "The report that was opened is not for this analysis run" + chrome.close_tab(id) + intellij.set_focus()