feat: Add application-level settings for CSS color management
Some checks failed
Run Tests / test (push) Failing after 1m51s
Some checks failed
Run Tests / test (push) Failing after 1m51s
- Introduced a new table `application_setting` to store configurable application options. - Implemented functions to manage CSS color settings, including loading, updating, and reading environment overrides. - Added a new settings view to render and manage theme colors. - Updated UI to include a settings page with theme color management and environment overrides display. - Enhanced CSS styles for the settings page and sidebar navigation. - Created unit and end-to-end tests for the new settings functionality and CSS management.
This commit is contained in:
@@ -7,6 +7,7 @@ UI_ROUTES = [
|
||||
("/ui/dashboard", "Dashboard · CalMiner", "Operations Overview"),
|
||||
("/ui/scenarios", "Scenario Management · CalMiner", "Create a New Scenario"),
|
||||
("/ui/parameters", "Process Parameters · CalMiner", "Scenario Parameters"),
|
||||
("/ui/settings", "Settings · CalMiner", "Settings"),
|
||||
("/ui/costs", "Costs · CalMiner", "Cost Overview"),
|
||||
("/ui/consumption", "Consumption · CalMiner", "Consumption Tracking"),
|
||||
("/ui/production", "Production · CalMiner", "Production Output"),
|
||||
@@ -27,3 +28,45 @@ def test_ui_pages_load_correctly(page: Page, url: str, title: str, heading: str)
|
||||
heading_locator = page.locator(
|
||||
f"h1:has-text('{heading}'), h2:has-text('{heading}')")
|
||||
expect(heading_locator.first).to_be_visible()
|
||||
|
||||
|
||||
def test_settings_theme_form_interaction(page: Page):
|
||||
page.goto("/ui/settings")
|
||||
expect(page).to_have_title("Settings · CalMiner")
|
||||
|
||||
env_rows = page.locator("#theme-env-overrides tbody tr")
|
||||
disabled_inputs = page.locator(
|
||||
"#theme-settings-form input.color-value-input[disabled]")
|
||||
env_row_count = env_rows.count()
|
||||
disabled_count = disabled_inputs.count()
|
||||
assert disabled_count == env_row_count
|
||||
|
||||
color_input = page.locator(
|
||||
"#theme-settings-form input[name='--color-primary']")
|
||||
expect(color_input).to_be_visible()
|
||||
expect(color_input).to_be_enabled()
|
||||
|
||||
original_value = color_input.input_value()
|
||||
candidate_values = ("#114455", "#225566")
|
||||
new_value = candidate_values[0] if original_value != candidate_values[0] else candidate_values[1]
|
||||
|
||||
color_input.fill(new_value)
|
||||
page.click("#theme-settings-form button[type='submit']")
|
||||
|
||||
feedback = page.locator("#theme-settings-feedback")
|
||||
expect(feedback).to_contain_text("updated successfully")
|
||||
|
||||
computed_color = page.evaluate(
|
||||
"() => getComputedStyle(document.documentElement).getPropertyValue('--color-primary').trim()"
|
||||
)
|
||||
assert computed_color.lower() == new_value.lower()
|
||||
|
||||
page.reload()
|
||||
expect(color_input).to_have_value(new_value)
|
||||
|
||||
color_input.fill(original_value)
|
||||
page.click("#theme-settings-form button[type='submit']")
|
||||
expect(feedback).to_contain_text("updated successfully")
|
||||
|
||||
page.reload()
|
||||
expect(color_input).to_have_value(original_value)
|
||||
|
||||
Reference in New Issue
Block a user