29 lines
1.4 KiB
Python
29 lines
1.4 KiB
Python
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 = [
|
|
("/", "Dashboard · CalMiner", "Operations Overview"),
|
|
("/ui/dashboard", "Dashboard · CalMiner", "Operations Overview"),
|
|
("/ui/scenarios", "Scenario Management · CalMiner", "Create a New Scenario"),
|
|
("/ui/parameters", "Process Parameters · CalMiner", "Scenario Parameters"),
|
|
("/ui/costs", "Costs · CalMiner", "Cost Overview"),
|
|
("/ui/consumption", "Consumption · CalMiner", "Consumption Tracking"),
|
|
("/ui/production", "Production · CalMiner", "Production Output"),
|
|
("/ui/equipment", "Equipment · CalMiner", "Equipment Inventory"),
|
|
("/ui/maintenance", "Maintenance · CalMiner", "Maintenance Schedule"),
|
|
("/ui/simulations", "Simulations · CalMiner", "Monte Carlo Simulations"),
|
|
("/ui/reporting", "Reporting · CalMiner", "Scenario KPI Summary"),
|
|
]
|
|
|
|
|
|
@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()
|