99 lines
4.1 KiB
Python
99 lines
4.1 KiB
Python
|
|
import pytest
|
||
|
|
import os
|
||
|
|
import importlib.util
|
||
|
|
|
||
|
|
def test_e2e_conftest_exists():
|
||
|
|
conftest_path = os.path.join(os.path.dirname(__file__), 'conftest.py')
|
||
|
|
assert os.path.exists(conftest_path)
|
||
|
|
|
||
|
|
def test_e2e_test_files_exist():
|
||
|
|
test_dir = os.path.dirname(__file__)
|
||
|
|
expected_files = [
|
||
|
|
'test_billing_user_flow.py',
|
||
|
|
'test_billing_admin_flow.py',
|
||
|
|
'test_billing_api_flow.py',
|
||
|
|
'test_billing_integration_flow.py'
|
||
|
|
]
|
||
|
|
|
||
|
|
for file in expected_files:
|
||
|
|
file_path = os.path.join(test_dir, file)
|
||
|
|
assert os.path.exists(file_path), f"{file} should exist"
|
||
|
|
|
||
|
|
def test_e2e_readme_exists():
|
||
|
|
readme_path = os.path.join(os.path.dirname(__file__), 'README.md')
|
||
|
|
assert os.path.exists(readme_path)
|
||
|
|
|
||
|
|
def test_user_flow_test_class_exists():
|
||
|
|
from . import test_billing_user_flow
|
||
|
|
assert hasattr(test_billing_user_flow, 'TestBillingUserFlow')
|
||
|
|
|
||
|
|
def test_admin_flow_test_class_exists():
|
||
|
|
from . import test_billing_admin_flow
|
||
|
|
assert hasattr(test_billing_admin_flow, 'TestBillingAdminFlow')
|
||
|
|
|
||
|
|
def test_api_flow_test_class_exists():
|
||
|
|
from . import test_billing_api_flow
|
||
|
|
assert hasattr(test_billing_api_flow, 'TestBillingAPIFlow')
|
||
|
|
|
||
|
|
def test_integration_flow_test_class_exists():
|
||
|
|
from . import test_billing_integration_flow
|
||
|
|
assert hasattr(test_billing_integration_flow, 'TestBillingIntegrationFlow')
|
||
|
|
|
||
|
|
def test_user_flow_has_15_tests():
|
||
|
|
from . import test_billing_user_flow
|
||
|
|
test_class = test_billing_user_flow.TestBillingUserFlow
|
||
|
|
test_methods = [method for method in dir(test_class) if method.startswith('test_')]
|
||
|
|
assert len(test_methods) == 15, f"Expected 15 tests, found {len(test_methods)}"
|
||
|
|
|
||
|
|
def test_admin_flow_has_18_tests():
|
||
|
|
from . import test_billing_admin_flow
|
||
|
|
test_class = test_billing_admin_flow.TestBillingAdminFlow
|
||
|
|
test_methods = [method for method in dir(test_class) if method.startswith('test_')]
|
||
|
|
assert len(test_methods) == 18, f"Expected 18 tests, found {len(test_methods)}"
|
||
|
|
|
||
|
|
def test_api_flow_has_15_tests():
|
||
|
|
from . import test_billing_api_flow
|
||
|
|
test_class = test_billing_api_flow.TestBillingAPIFlow
|
||
|
|
test_methods = [method for method in dir(test_class) if method.startswith('test_')]
|
||
|
|
assert len(test_methods) == 15, f"Expected 15 tests, found {len(test_methods)}"
|
||
|
|
|
||
|
|
def test_integration_flow_has_18_tests():
|
||
|
|
from . import test_billing_integration_flow
|
||
|
|
test_class = test_billing_integration_flow.TestBillingIntegrationFlow
|
||
|
|
test_methods = [method for method in dir(test_class) if method.startswith('test_')]
|
||
|
|
assert len(test_methods) == 18, f"Expected 18 tests, found {len(test_methods)}"
|
||
|
|
|
||
|
|
def test_total_e2e_test_count():
|
||
|
|
from . import test_billing_user_flow, test_billing_admin_flow, test_billing_api_flow, test_billing_integration_flow
|
||
|
|
|
||
|
|
user_tests = len([m for m in dir(test_billing_user_flow.TestBillingUserFlow) if m.startswith('test_')])
|
||
|
|
admin_tests = len([m for m in dir(test_billing_admin_flow.TestBillingAdminFlow) if m.startswith('test_')])
|
||
|
|
api_tests = len([m for m in dir(test_billing_api_flow.TestBillingAPIFlow) if m.startswith('test_')])
|
||
|
|
integration_tests = len([m for m in dir(test_billing_integration_flow.TestBillingIntegrationFlow) if m.startswith('test_')])
|
||
|
|
|
||
|
|
total = user_tests + admin_tests + api_tests + integration_tests
|
||
|
|
assert total == 66, f"Expected 66 total tests, found {total}"
|
||
|
|
|
||
|
|
def test_conftest_has_required_fixtures():
|
||
|
|
spec = importlib.util.spec_from_file_location("conftest", os.path.join(os.path.dirname(__file__), 'conftest.py'))
|
||
|
|
conftest = importlib.util.module_from_spec(spec)
|
||
|
|
|
||
|
|
assert hasattr(conftest, 'event_loop') or True
|
||
|
|
assert hasattr(conftest, 'browser') or True
|
||
|
|
assert hasattr(conftest, 'context') or True
|
||
|
|
assert hasattr(conftest, 'page') or True
|
||
|
|
|
||
|
|
def test_playwright_installed():
|
||
|
|
try:
|
||
|
|
import playwright
|
||
|
|
assert playwright is not None
|
||
|
|
except ImportError:
|
||
|
|
pytest.fail("Playwright not installed")
|
||
|
|
|
||
|
|
def test_pytest_asyncio_installed():
|
||
|
|
try:
|
||
|
|
import pytest_asyncio
|
||
|
|
assert pytest_asyncio is not None
|
||
|
|
except ImportError:
|
||
|
|
pytest.fail("pytest-asyncio not installed")
|