Commit ·
ca7ab25
1
Parent(s): 0a52c46
Refactor document type selection tests: consolidate scenarios into a single test function and improve import structure
Browse files
tests/e2e/test_document_type_selection.py
CHANGED
|
@@ -1,57 +1,22 @@
|
|
| 1 |
"""E2E tests for document type and podcast mode selection."""
|
|
|
|
| 2 |
|
| 3 |
import pytest
|
| 4 |
-
|
| 5 |
|
| 6 |
-
from tests.e2e.features.steps.
|
| 7 |
-
|
| 8 |
-
check_available_podcast_modes,
|
| 9 |
-
check_document_type_changed,
|
| 10 |
-
check_podcast_mode_changed,
|
| 11 |
-
select_document_type,
|
| 12 |
-
select_podcast_mode,
|
| 13 |
-
)
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
"features/document_type_selection.feature",
|
| 19 |
-
"Default document type and mode selection",
|
| 20 |
-
)
|
| 21 |
-
def test_default_document_type_and_mode():
|
| 22 |
-
"""Test that default document type and mode are correctly selected."""
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
@pytest.mark.e2e
|
| 26 |
-
@scenario("features/document_type_selection.feature", "Changing document type")
|
| 27 |
-
def test_changing_document_type():
|
| 28 |
-
"""Test changing the document type."""
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
@pytest.mark.e2e
|
| 32 |
-
@scenario("features/document_type_selection.feature", "Changing podcast mode")
|
| 33 |
-
def test_changing_podcast_mode():
|
| 34 |
-
"""Test changing the podcast mode."""
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
@pytest.mark.e2e
|
| 38 |
-
@scenario(
|
| 39 |
-
"features/document_type_selection.feature",
|
| 40 |
-
"Changing both document type and podcast mode",
|
| 41 |
-
)
|
| 42 |
-
def test_changing_both_document_type_and_podcast_mode():
|
| 43 |
-
"""Test changing both document type and podcast mode."""
|
| 44 |
|
| 45 |
|
|
|
|
| 46 |
@pytest.mark.e2e
|
| 47 |
-
|
| 48 |
-
"
|
| 49 |
-
)
|
| 50 |
-
def test_all_document_types_are_available():
|
| 51 |
-
"""Test that all expected document types are available."""
|
| 52 |
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
def test_all_podcast_modes_are_available():
|
| 57 |
-
"""Test that all expected podcast modes are available."""
|
|
|
|
| 1 |
"""E2E tests for document type and podcast mode selection."""
|
| 2 |
+
import os
|
| 3 |
|
| 4 |
import pytest
|
| 5 |
+
import pytest_bdd
|
| 6 |
|
| 7 |
+
from tests.e2e.features.steps.common_steps import * # noqa: F401, F403
|
| 8 |
+
from tests.e2e.features.steps.document_type_steps import * # noqa: F401, F403
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
+
# Get the directory of this file and resolve the feature path
|
| 11 |
+
current_dir = os.path.dirname(os.path.abspath(__file__))
|
| 12 |
+
feature_path = os.path.join(current_dir, "features", "document_type_selection.feature")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
|
| 15 |
+
# Apply E2E marker to all scenarios in the feature file
|
| 16 |
@pytest.mark.e2e
|
| 17 |
+
def test_all_document_type_selection_scenarios():
|
| 18 |
+
"""Container for all document type selection scenarios."""
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
|
| 21 |
+
# Load all scenarios from the feature file
|
| 22 |
+
pytest_bdd.scenarios(feature_path)
|
|
|
|
|
|