WIP checkpoint: Main menu: hide the login/register form once authenticated, keep only the welcome message
This commit is contained in:
+10
-4
@@ -8,6 +8,7 @@ extends Control
|
||||
##
|
||||
## On successful auth the token is stored via ApiClient, AuthButtonsRow hides,
|
||||
## the welcome label shows the username, and the Play button becomes enabled.
|
||||
## The auth form fields are hidden, leaving only the welcome message visible.
|
||||
|
||||
|
||||
# ── UI references ────────────────────────────────────────────────────────────
|
||||
@@ -173,12 +174,17 @@ func _on_auth_complete(result: Dictionary) -> void:
|
||||
_is_authenticating = false
|
||||
|
||||
if result.ok:
|
||||
# Success — show welcome, enable Play, hide the now-redundant
|
||||
# Login/Register entry points (the auth panel itself stays open,
|
||||
# showing the welcome message in place of the form).
|
||||
# Success — hide the auth form fields, show only the welcome label.
|
||||
_username_edit.visible = false
|
||||
_password_edit.visible = false
|
||||
_email_edit.visible = false
|
||||
_dob_edit.visible = false
|
||||
_mode_toggle.visible = false
|
||||
_auth_button.visible = false
|
||||
_auth_mode_label.visible = false
|
||||
_status_label.visible = false
|
||||
_welcome_label.text = "Welcome, %s!" % _username_edit.text.strip_edges()
|
||||
_welcome_label.visible = true
|
||||
_status_label.visible = false
|
||||
_play_button.disabled = false
|
||||
_auth_buttons_row.visible = false
|
||||
print("Auth successful. Token stored.")
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
extends SceneTree
|
||||
## Full click-through simulation of the real user flow: press Register,
|
||||
## fill the form exactly as a human would, submit, confirm Play actually
|
||||
## becomes clickable. This is the check that would have caught the
|
||||
## original bug (no way to even open the form) and would catch a repeat
|
||||
## of it.
|
||||
## becomes clickable. Also verifies that after successful auth the auth
|
||||
## form fields are hidden, leaving only the welcome message visible.
|
||||
|
||||
var passed := 0
|
||||
var failed := 0
|
||||
@@ -27,7 +26,9 @@ func _run() -> void:
|
||||
var password_edit: LineEdit = instance.get_node("CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox/PasswordEdit")
|
||||
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")
|
||||
var mode_toggle: CheckButton = instance.get_node("CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox/ModeToggle")
|
||||
var auth_button: Button = instance.get_node("CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox/AuthButton")
|
||||
var auth_mode_label: Label = instance.get_node("CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox/AuthModeLabel")
|
||||
var welcome_label: Label = instance.get_node("CenterContainer/VBoxContainer/AuthPanel/MarginContainer/AuthVBox/WelcomeLabel")
|
||||
var play_button: Button = instance.get_node("CenterContainer/VBoxContainer/PlayButton")
|
||||
|
||||
@@ -63,6 +64,17 @@ func _run() -> void:
|
||||
_check("Welcome label visible", welcome_label.visible)
|
||||
_check("Auth buttons row hid itself after success", not auth_buttons_row.visible)
|
||||
|
||||
# Verify the auth form fields are hidden after successful auth,
|
||||
# leaving only the welcome message visible within the panel.
|
||||
_check("Username edit hidden after auth", not username_edit.visible)
|
||||
_check("Password edit hidden after auth", not password_edit.visible)
|
||||
_check("Email edit hidden after auth", not email_edit.visible)
|
||||
_check("DOB edit hidden after auth", not dob_edit.visible)
|
||||
_check("Mode toggle hidden after auth", not mode_toggle.visible)
|
||||
_check("Auth button hidden after auth", not auth_button.visible)
|
||||
_check("Auth mode label hidden after auth", not auth_mode_label.visible)
|
||||
_check("Welcome label contains username", welcome_label.text.begins_with("Welcome, mainmenu_e2e_"))
|
||||
|
||||
print("\n=== SMOKE RESULT: %d/%d passed ===" % [passed, passed + failed])
|
||||
quit(0 if failed == 0 else 1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user