Supprime le type d'écran "document" et recentre le produit sur le jeu 2D
Le document de cadrage produit cible des formateurs non techniques créant des serious games/quiz gamifiés — l'éditeur générique "document" (blocs de logique en nœuds, timeline d'animation, définitions d'objets/relations, templates réutilisables) est une complexité hors cible que l'effort d'ingénierie récent avait déjà abandonnée au profit du jeu_2d. - Onboarding : ne garde que le parcours "RPG" (jeu_2d), retire Quiz/Embranchement/Créer mon jeu de A à Z (tous document-only) - Suppression en bloc des modules exclusifs au document : routes/elements, routes/element_types, routes/objects, routes/legacy_actions, screens/elements, screens/element_types, screens/widgets, screens/legacy_actions, le rendu render_element_html.py et son cluster, templates/screen_edit.html, templates/game_dashboard.html, flow-editor.js/tabs-and-blocks.js/animation-timeline.js - Dashboard toujours simplifié (un seul mode possible désormais) - Tests document-only supprimés, tests de logique partagée (flow, événements personnalisés, animations) retargetés sur des écrans jeu_2d - Aucune régression jeu_2d : 299 tests passent Carte d'onboarding retravaillée : argumentaire RH non technique (liste à coche, badge "Compatible LMS"), taille et interaction de retournement ajustées.
This commit is contained in:
+30
-60
@@ -1,8 +1,9 @@
|
||||
"""Onboarding guidé (routes/onboarding/onboarding_new.py) : un compte
|
||||
"user" fraîchement inscrit choisit un type de jeu (Quiz/Embranchement/
|
||||
RPG/Créer mon jeu de A à Z) avant d'avoir accès à quoi que ce soit — voir
|
||||
le plan "Fusion des deux moteurs + structure de dossiers + onboarding
|
||||
guidé". Réutilise les fixtures de test_auth.py (inscription/2FA)."""
|
||||
"user" fraîchement inscrit choisit un type de jeu avant d'avoir accès à
|
||||
quoi que ce soit — désormais un seul type, "rpg" (jeu RPG 2D), les types
|
||||
Quiz/Embranchement/"Créer mon jeu de A à Z" ayant été retirés avec le
|
||||
moteur d'écran "document". Réutilise les fixtures de test_auth.py
|
||||
(inscription/2FA)."""
|
||||
import os
|
||||
|
||||
import auth
|
||||
@@ -22,52 +23,22 @@ def test_account_without_a_project_is_redirected_to_onboarding(anon_client):
|
||||
|
||||
resp = anon_client.get("/onboarding")
|
||||
assert resp.status_code == 200
|
||||
assert "Quiz" in resp.get_data(as_text=True)
|
||||
assert "Créer un jeu 2D ludique" in resp.get_data(as_text=True)
|
||||
finally:
|
||||
_cleanup_project("needsonboarding@example.com")
|
||||
|
||||
|
||||
def test_quiz_lands_on_simplified_dashboard_with_one_document_screen(anon_client):
|
||||
"""Le dashboard simplifié (routes/games/game_dashboard.py) — un compte
|
||||
restreint (quiz/embranchement/rpg) atterrit maintenant sur SON
|
||||
tableau de bord (même route que "custom"), juste rendu en version
|
||||
simplifiée : que des écrans en cartes, pas d'onglets Objets/Éléments
|
||||
de jeu/Variables (réservés à "Créer mon jeu de A à Z")."""
|
||||
_register(anon_client, "quizuser@example.com")
|
||||
_confirm_2fa(anon_client)
|
||||
try:
|
||||
resp = _complete_onboarding(anon_client, name="Mon Quiz", onboarding_type="quiz")
|
||||
assert resp.status_code == 302
|
||||
user = auth.get_user_by_email("quizuser@example.com")
|
||||
slug = user["project_slug"]
|
||||
assert resp.headers["Location"] == f"/game/{slug}"
|
||||
assert db.get_onboarding_type(slug) == "quiz"
|
||||
|
||||
screen_list = screens.list_screens(slug)
|
||||
assert len(screen_list) == 1
|
||||
assert screen_list[0]["kind"] == "document"
|
||||
|
||||
html = anon_client.get(f"/game/{slug}").get_data(as_text=True)
|
||||
assert "screenCardGrid" in html
|
||||
assert "+ Ajouter un écran" in html
|
||||
assert 'name="kind"' not in html # pas de choix de type à l'ajout
|
||||
assert "openNewObjectPanel" not in html # onglet Objets du dashboard complet absent
|
||||
|
||||
# L'éditeur de l'écran, lui, reste atteignable comme avant.
|
||||
edit_html = anon_client.get(f"/game/{slug}/screens/{screen_list[0]['id']}/edit").get_data(as_text=True)
|
||||
assert "scene-editor.js" not in edit_html
|
||||
finally:
|
||||
_cleanup_project("quizuser@example.com")
|
||||
|
||||
|
||||
def test_rpg_dashboard_shows_scene_preview_and_forces_jeu2d_on_new_screens(anon_client):
|
||||
_register(anon_client, "rpguser@example.com")
|
||||
_confirm_2fa(anon_client)
|
||||
try:
|
||||
resp = _complete_onboarding(anon_client, name="Mon RPG", onboarding_type="rpg")
|
||||
assert resp.status_code == 302
|
||||
slug = auth.get_user_by_email("rpguser@example.com")["project_slug"]
|
||||
assert resp.headers["Location"] == f"/game/{slug}"
|
||||
assert db.get_onboarding_type(slug) == "rpg"
|
||||
screen_list = screens.list_screens(slug)
|
||||
assert len(screen_list) == 1
|
||||
assert screen_list[0]["kind"] == "jeu_2d"
|
||||
|
||||
html = anon_client.get(f"/game/{slug}").get_data(as_text=True)
|
||||
@@ -88,22 +59,6 @@ def test_rpg_dashboard_shows_scene_preview_and_forces_jeu2d_on_new_screens(anon_
|
||||
_cleanup_project("rpguser@example.com")
|
||||
|
||||
|
||||
def test_custom_keeps_todays_full_dashboard_behavior(anon_client):
|
||||
_register(anon_client, "customuser@example.com")
|
||||
_confirm_2fa(anon_client)
|
||||
try:
|
||||
resp = _complete_onboarding(anon_client, name="Mon jeu complet", onboarding_type="custom")
|
||||
assert resp.status_code == 302
|
||||
|
||||
slug = auth.get_user_by_email("customuser@example.com")["project_slug"]
|
||||
assert resp.headers["Location"] == f"/game/{slug}"
|
||||
|
||||
html = anon_client.get(f"/game/{slug}").get_data(as_text=True)
|
||||
assert "Tableau de bord" in html or "gameNavLink" in html
|
||||
finally:
|
||||
_cleanup_project("customuser@example.com")
|
||||
|
||||
|
||||
def test_onboarding_rejects_unknown_type(anon_client):
|
||||
_register(anon_client, "badtype@example.com")
|
||||
_confirm_2fa(anon_client)
|
||||
@@ -115,18 +70,33 @@ def test_onboarding_rejects_unknown_type(anon_client):
|
||||
_cleanup_project("badtype@example.com")
|
||||
|
||||
|
||||
def test_onboarding_rejects_removed_types(anon_client):
|
||||
"""Les anciens types (quiz/embranchement/custom) ne sont plus des choix
|
||||
valides — voir db/games/game_type_catalog.py, ONBOARDING_TYPES ne
|
||||
contient plus que "rpg"."""
|
||||
_register(anon_client, "removedtype@example.com")
|
||||
_confirm_2fa(anon_client)
|
||||
try:
|
||||
for removed_type in ("quiz", "embranchement", "custom"):
|
||||
resp = anon_client.post("/onboarding", data={"onboarding_type": removed_type, "name": "Test"})
|
||||
assert resp.status_code == 200
|
||||
assert auth.get_user_by_email("removedtype@example.com")["project_slug"] is None
|
||||
finally:
|
||||
_cleanup_project("removedtype@example.com")
|
||||
|
||||
|
||||
def test_revisiting_onboarding_after_completion_redirects_without_recreating(anon_client):
|
||||
_register(anon_client, "revisit@example.com")
|
||||
_confirm_2fa(anon_client)
|
||||
try:
|
||||
first = _complete_onboarding(anon_client, name="Premier jeu", onboarding_type="custom")
|
||||
first = _complete_onboarding(anon_client, name="Premier jeu", onboarding_type="rpg")
|
||||
first_slug = auth.get_user_by_email("revisit@example.com")["project_slug"]
|
||||
|
||||
resp = anon_client.get("/onboarding", follow_redirects=False)
|
||||
assert resp.status_code == 302
|
||||
assert resp.headers["Location"] == first.headers["Location"]
|
||||
|
||||
again = anon_client.post("/onboarding", data={"onboarding_type": "quiz", "name": "Second jeu"}, follow_redirects=False)
|
||||
again = anon_client.post("/onboarding", data={"onboarding_type": "rpg", "name": "Second jeu"}, follow_redirects=False)
|
||||
assert auth.get_user_by_email("revisit@example.com")["project_slug"] == first_slug
|
||||
assert again.headers["Location"] == first.headers["Location"]
|
||||
finally:
|
||||
@@ -138,13 +108,13 @@ def test_admin_is_never_redirected_to_onboarding(client, game):
|
||||
assert resp.status_code == 200
|
||||
|
||||
|
||||
def test_admin_can_create_several_games_of_different_types_via_onboarding(client):
|
||||
def test_admin_can_create_several_games_via_onboarding(client):
|
||||
"""Comportement systématique à CHAQUE création de jeu, pas une
|
||||
formalité réservée à la toute première inscription (voir le plan) —
|
||||
un admin, illimité (pas de project_slug dédié), doit pouvoir repasser
|
||||
par /onboarding autant de fois qu'il crée un nouveau jeu, sans jamais
|
||||
être bloqué/redirigé vers un projet précédent."""
|
||||
resp1 = _complete_onboarding(client, name="Jeu Quiz Admin", onboarding_type="quiz")
|
||||
resp1 = _complete_onboarding(client, name="Jeu RPG Admin 1", onboarding_type="rpg")
|
||||
assert resp1.status_code == 302
|
||||
slug1 = resp1.headers["Location"].split("/game/", 1)[1].split("/", 1)[0]
|
||||
slug2 = None
|
||||
@@ -155,9 +125,9 @@ def test_admin_can_create_several_games_of_different_types_via_onboarding(client
|
||||
# le premier projet créé, la page de choix s'affiche à nouveau.
|
||||
resp = client.get("/onboarding")
|
||||
assert resp.status_code == 200
|
||||
assert "Quiz" in resp.get_data(as_text=True)
|
||||
assert "Créer un jeu 2D ludique" in resp.get_data(as_text=True)
|
||||
|
||||
resp2 = _complete_onboarding(client, name="Jeu RPG Admin", onboarding_type="rpg")
|
||||
resp2 = _complete_onboarding(client, name="Jeu RPG Admin 2", onboarding_type="rpg")
|
||||
assert resp2.status_code == 302
|
||||
slug2 = resp2.headers["Location"].split("/game/", 1)[1].split("/", 1)[0]
|
||||
assert slug2 != slug1
|
||||
|
||||
Reference in New Issue
Block a user