From fe5d23c4bf8d22105788b134ae4e2a8e09568755 Mon Sep 17 00:00:00 2001 From: midays Date: Wed, 4 Oct 2023 23:18:08 +0300 Subject: [PATCH] working TC --- src/models/IDE/Intellij.py | 4 ++-- .../intellij/test_miscellaneous_items.py | 20 +++++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/models/IDE/Intellij.py b/src/models/IDE/Intellij.py index 1b12afe..da69ad5 100644 --- a/src/models/IDE/Intellij.py +++ b/src/models/IDE/Intellij.py @@ -173,10 +173,10 @@ def cancel_analysis(self): self.click_element(locator_type="image", locator="cancel_analysis.png") self.click() - def open_plugin_info(self, plugin_name): + def open_plugin_info(self, plugin): self.press_keys("ctrl", "alt", "s") self.press_keys("ctrl", "f") self.type_text("plugins") self.press_keys("enter") - self.type_text(f"Migration Toolkit for {plugin_name}") + self.type_text(f"Migration Toolkit for {plugin}") self.press_keys("enter") diff --git a/src/tests/intellij/test_miscellaneous_items.py b/src/tests/intellij/test_miscellaneous_items.py index e5c69f4..a3cf48d 100644 --- a/src/tests/intellij/test_miscellaneous_items.py +++ b/src/tests/intellij/test_miscellaneous_items.py @@ -1,12 +1,20 @@ import os import time +import pytest + from src.utils.ocr import find_all_sentence_occurrences DATA_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) + "/data/" +# Polarion TC: +# https://polarion.engineering.redhat.com/polarion/#/project/MigrationToolkitAppl/workitem?id=MTR-271 + def test_plugin_info(setup_intellij): + + plugin_short_name = "MTA" if pytest.mtr else "MTR" + plugin = "Applications" if pytest.mtr else "Runtimes" """ Test if the plugin panel shows the expected information """ @@ -14,19 +22,19 @@ def test_plugin_info(setup_intellij): # Intellij freezes without this sleep time.sleep(3) - intellij.open_mta_plugin_info() + intellij.open_plugin_info(plugin) # assert all the following sentences are present in the panel assert ( len( find_all_sentence_occurrences( - "The Migration Toolkit for Applications (MTA) plugin for IntelliJ", + f"The Migration Toolkit for {plugin} ({plugin_short_name}) plugin for IntelliJ", ), ) > 0 ), ( 'the sentence "The Migration ' - "Toolkit for Applications (MTA) " + f"Toolkit for {plugin} ({plugin_short_name}) " 'plugin for IntelliJ" was not ' "found in the plugin info panel" ) @@ -73,6 +81,6 @@ def test_plugin_info(setup_intellij): 'possible" was not found in the plugin ' "info panel" ) - assert len(find_all_sentence_occurrences("Read more about MTA here")) > 0, ( - 'the sentence "Read more about MTA here" was not found in the plugin info ' "panel" - ) + assert ( + len(find_all_sentence_occurrences("Read more about MTA here")) > 0 + ), 'the sentence "Read more about MTA here" was not found in the plugin info panel'