Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added IDE markers for intellij and vscode #57

Merged
merged 15 commits into from
Nov 20, 2023
44 changes: 23 additions & 21 deletions src/fixtures/video_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,26 @@


@pytest.fixture(autouse=True)
def record_test_run(ide, frame_rate=24):

if not pytest.record_video:
return

screen_size = get_screen_size()

run_time = datetime.now().strftime("%d-%m-%Y_%H:%M")
output_file = f"{RECORD_DIR}/{ide}_{run_time}.mp4"
cmd = (
f"ffmpeg -video_size {screen_size} -framerate {frame_rate} -f x11grab -i :0.0 {output_file}"
)
print("Executing command: " + cmd)
p = subprocess.Popen(cmd, shell=True)

yield

# Stop the recording
p.terminate()
# Ensure the process has terminated before exiting
p.wait()
def record_test_run(frame_rate=24):
p = None

if pytest.record_video:
ide = "intellij" if pytest.intellij else "vscode"

screen_size = get_screen_size()

run_time = datetime.now().strftime("%d-%m-%Y_%H:%M")
output_file = f"{RECORD_DIR}/{ide}_{run_time}.mp4"
cmd = (
f"ffmpeg -video_size {screen_size} -framerate "
f"{frame_rate} -f x11grab -i :0.0 {output_file}"
)
print("Executing command: " + cmd)
p = subprocess.Popen(cmd, shell=True)

yield p
if p:
# Stop the recording
p.terminate()
# Ensure the process has terminated before exiting
p.wait()
3 changes: 3 additions & 0 deletions src/tests/intellij/test_advanced_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

@pytest.mark.parametrize("app_name", ["weblogic_to_eap7"])
@pytest.mark.parametrize("ide", ["intellij"])
@pytest.mark.intellij
def test_csv_report_intellij(configurations, setup_intellij, app_name, analysis_data, ide):
"""Analysis test for IntelliJ using --exportCSV option"""
intellij = setup_intellij
Expand All @@ -28,6 +29,7 @@ def test_csv_report_intellij(configurations, setup_intellij, app_name, analysis_

@pytest.mark.parametrize("app_name", ["weblogic_to_eap7_skip_reports"])
@pytest.mark.parametrize("ide", ["intellij"])
@pytest.mark.intellij
def test_skip_reports_intellij(configurations, setup_intellij, app_name, analysis_data, ide):
"""Analysis test for IntelliJ using --skipReports option"""
intellij = setup_intellij
Expand All @@ -47,6 +49,7 @@ def test_skip_reports_intellij(configurations, setup_intellij, app_name, analysi

@pytest.mark.parametrize("app_name", ["weblogic_to_eap7_legacy_reports"])
@pytest.mark.parametrize("ide", ["intellij"])
@pytest.mark.intellij
def test_legacy_reports_intellij(configurations, setup_intellij, app_name, analysis_data, ide):
"""Analysis test for IntelliJ using --legacyReports option"""
intellij = setup_intellij
Expand Down
1 change: 1 addition & 0 deletions src/tests/intellij/test_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

@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):
"""
Analysis tests for intellij using various migration paths
Expand Down
1 change: 1 addition & 0 deletions src/tests/intellij/test_cancel_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

@pytest.mark.parametrize("app_name", ["weblogic_to_eap7"])
@pytest.mark.parametrize("ide", ["intellij"])
@pytest.mark.intellij
def test_cancel_analysis_intellij(configurations, setup_intellij, app_name, analysis_data, ide):
"""
Tests the behaviour of canceling an analysis
Expand Down
2 changes: 2 additions & 0 deletions src/tests/intellij/test_cli_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from src.utils.ocr import find_all_sentence_occurrences


@pytest.mark.intellij
def test_empty_cli_path_intellij(setup_intellij):
"""
Tests the validation of empty cli path
Expand All @@ -22,6 +23,7 @@ def test_empty_cli_path_intellij(setup_intellij):
assert len(find_all_sentence_occurrences("")) > 0


@pytest.mark.intellij
@pytest.mark.parametrize("app_name", ["weblogic_to_eap7"])
def test_invalid_cli_path_intellij(
setup_intellij,
Expand Down
2 changes: 2 additions & 0 deletions src/tests/intellij/test_input_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from src.utils.ocr import find_all_sentence_occurrences


@pytest.mark.intellij
def test_empty_input_validation(setup_intellij):
"""
Analysis tests for intellij using various migration paths
Expand All @@ -22,6 +23,7 @@ def test_empty_input_validation(setup_intellij):
assert len(find_all_sentence_occurrences("Path to input required")) > 0


@pytest.mark.intellij
@pytest.mark.parametrize("app_name", ["weblogic_to_eap7"])
@pytest.mark.parametrize("ide", ["intellij"])
def test_invalid_input_validation(
Expand Down
1 change: 1 addition & 0 deletions src/tests/intellij/test_miscellaneous_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# https://polarion.engineering.redhat.com/polarion/#/project/MigrationToolkitAppl/workitem?id=MTR-271


@pytest.mark.intellij
def test_plugin_info(setup_intellij):

plugin_short_name = "MTA" if pytest.mtr else "MTR"
Expand Down
2 changes: 2 additions & 0 deletions src/tests/vscode/test_advanced_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

@pytest.mark.parametrize("app_name", ["thorntail_to_eapxp"])
@pytest.mark.parametrize("ide", ["vscode"])
@pytest.mark.vscode
def test_csv_report_vscode(configurations, setup_vscode, app_name, analysis_data, ide):
"""Analysis test for VScode using --exportCSV option"""
vscode = setup_vscode
Expand All @@ -25,6 +26,7 @@ def test_csv_report_vscode(configurations, setup_vscode, app_name, analysis_data

@pytest.mark.parametrize("app_name", ["weblogic_to_eap7_skip_reports"])
@pytest.mark.parametrize("ide", ["vscode"])
@pytest.mark.vscode
def test_skip_reports_vscode(configurations, setup_vscode, app_name, analysis_data, ide):
"""Analysis test for VScode using --skipReports option"""
vscode = setup_vscode
Expand Down
1 change: 1 addition & 0 deletions src/tests/vscode/test_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

@pytest.mark.parametrize("app_name", json.load(open(DATA_DIR + "analysis.json")))
@pytest.mark.parametrize("ide", ["vscode"])
@pytest.mark.intellij
def test_analysis_vscode(configurations, setup_vscode, app_name, analysis_data, ide):
"""Analysis tests for VScode using various migration paths"""
vscode = setup_vscode
Expand Down