diff --git a/scripts/smoke_test_main_menu_ui.gd b/scripts/smoke_test_main_menu_ui.gd index 9195b4a..570e81c 100644 --- a/scripts/smoke_test_main_menu_ui.gd +++ b/scripts/smoke_test_main_menu_ui.gd @@ -1,9 +1,14 @@ extends SceneTree -## Verifies the main menu's Login/Register buttons actually open the auth -## panel via a real signal emission (not calling the handler method -## directly) -- that's the exact gap that shipped without ever being -## caught: the AuthPanel and its logic were all correct, but nothing in -## the scene was ever wired to open it. +## Verifies the main menu's Login/Register buttons correctly open the auth +## panel and toggle between Login and Register modes via signal emission. +## +## Key tests: +## - AuthPanel starts hidden. +## - LoginButton press opens the panel in Login mode. +## - RegisterButton press opens the panel in Register mode. +## - Clicking Login while in Register mode switches back to Login mode. +## - Clicking Register while in Login mode switches to Register mode. +## - The ModeToggle CheckButton no longer exists in the scene. func _initialize() -> void: @@ -24,26 +29,87 @@ func _run() -> void: var login_button: Button = instance.get_node("CenterContainer/VBoxContainer/AuthButtonsRow/LoginButton") var register_button: Button = instance.get_node("CenterContainer/VBoxContainer/AuthButtonsRow/RegisterButton") var auth_panel: PanelContainer = instance.get_node("CenterContainer/VBoxContainer/AuthPanel") + var auth_mode_label: Label = instance.get_node("CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox/AuthModeLabel") + var email_edit: LineEdit = instance.get_node("CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox/EmailEdit") + var dob_edit: LineEdit = instance.get_node("CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox/DOBEdit") + # --- Test 1: auth panel starts hidden --- if _check("auth panel starts hidden", not auth_panel.visible): passed += 1 else: failed += 1 + # --- Test 2: LoginButton press opens panel in Login mode --- login_button.pressed.emit() await process_frame - if _check("auth panel visible after a real LoginButton press signal", auth_panel.visible): + if _check("auth panel visible after LoginButton press", auth_panel.visible): passed += 1 else: failed += 1 - # Reset and check RegisterButton independently too. - auth_panel.visible = false + if _check("Login mode label after LoginButton press", auth_mode_label.text == "Login"): + passed += 1 + else: + failed += 1 + + if _check("Email field hidden in Login mode", not email_edit.visible): + passed += 1 + else: + failed += 1 + + if _check("DOB field hidden in Login mode", not dob_edit.visible): + passed += 1 + else: + failed += 1 + + # --- Test 3: RegisterButton press switches to Register mode --- register_button.pressed.emit() await process_frame - if _check("auth panel visible after a real RegisterButton press signal", auth_panel.visible): + if _check("auth panel still visible after RegisterButton press", auth_panel.visible): + passed += 1 + else: + failed += 1 + + if _check("Register mode label after RegisterButton press", auth_mode_label.text == "Register"): + passed += 1 + else: + failed += 1 + + if _check("Email field visible in Register mode", email_edit.visible): + passed += 1 + else: + failed += 1 + + if _check("DOB field visible in Register mode", dob_edit.visible): + passed += 1 + else: + failed += 1 + + # --- Test 4: LoginButton press switches back to Login mode --- + login_button.pressed.emit() + await process_frame + + if _check("Login mode label after second LoginButton press", auth_mode_label.text == "Login"): + passed += 1 + else: + failed += 1 + + if _check("Email field hidden after switching back to Login", not email_edit.visible): + passed += 1 + else: + failed += 1 + + if _check("DOB field hidden after switching back to Login", not dob_edit.visible): + passed += 1 + else: + failed += 1 + + # --- Test 5: ModeToggle CheckButton no longer exists --- + var mode_toggle_path = "CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox/ModeToggle" + var has_mode_toggle = instance.has_node(mode_toggle_path) + if _check("ModeToggle CheckButton removed from scene", not has_mode_toggle): passed += 1 else: failed += 1