Enhance testing framework and UI feedback

- Updated architecture documentation to include details on UI rendering checks and Playwright end-to-end tests.
- Revised testing documentation to specify Playwright for frontend E2E tests and added details on running tests.
- Implemented feedback mechanism in scenario form for successful creation notifications.
- Added feedback div in ScenarioForm.html for user notifications.
- Created new fixtures for Playwright tests to manage server and browser instances.
- Developed comprehensive E2E tests for consumption, costs, equipment, maintenance, production, and scenarios.
- Added smoke tests to verify UI page loading and form submissions.
- Enhanced unit tests for simulation and validation, including new tests for report generation and validation errors.
- Created new test files for router validation to ensure consistent error handling.
- Established a new test suite for UI routes to validate dashboard and reporting functionalities.
- Implemented validation tests to ensure proper handling of JSON payloads.
This commit is contained in:
2025-10-21 08:29:11 +02:00
parent ae4b9c136f
commit f020d276bc
20 changed files with 939 additions and 21 deletions

29
tests/e2e/test_smoke.py Normal file
View File

@@ -0,0 +1,29 @@
import pytest
from playwright.sync_api import Page, expect
# A list of UI routes to check, with their URL, expected title, and a key heading text.
UI_ROUTES = [
("/", "CalMiner Dashboard", "Dashboard"),
("/ui/dashboard", "CalMiner Dashboard", "Dashboard"),
("/ui/scenarios", "CalMiner Scenarios", "Scenarios"),
("/ui/parameters", "CalMiner Parameters", "Parameters"),
("/ui/costs", "CalMiner Costs", "Costs"),
("/ui/consumption", "CalMiner Consumption", "Consumption"),
("/ui/production", "CalMiner Production", "Production"),
("/ui/equipment", "CalMiner Equipment", "Equipment"),
("/ui/maintenance", "CalMiner Maintenance", "Maintenance"),
("/ui/simulations", "CalMiner Simulations", "Simulations"),
("/ui/reporting", "CalMiner Reporting", "Reporting"),
]
@pytest.mark.usefixtures("live_server")
@pytest.mark.parametrize("url, title, heading", UI_ROUTES)
def test_ui_pages_load_correctly(page: Page, url: str, title: str, heading: str):
"""Verify that all UI pages load with the correct title and a visible heading."""
page.goto(url)
expect(page).to_have_title(title)
# The app uses a mix of h1 and h2 for main page headings.
heading_locator = page.locator(
f"h1:has-text('{heading}'), h2:has-text('{heading}')")
expect(heading_locator.first).to_be_visible()