Code/tests/integration/test_analyse.py
Stéphan Peccini cf91d0b69e
test(integration): 3 scénarios E2E Playwright (Fiches, Analyse, Plan d'action)
- Infrastructure test : StreamlitApp helper, réinitialisation session, serveur dédié port 8502
- Scénario Fiches : sélection dossier Assemblage + fiche casques VR
- Scénario Analyse : Serveur→Pays géo, Germanium, Chine, filtre IHH Pays, vérification Sankey
- Scénario Plan d'action : Serveur + Germanium, vérification dashboard criticités

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 11:52:40 +01:00

49 lines
1.7 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""Test E2E Scénario 2 : Analyse complète Produit final → Pays géographique."""
import pytest
from playwright.sync_api import expect
pytestmark = pytest.mark.integration
def test_analyse_serveur_germanium_chine(app):
"""Formulaire complet : Serveur → Pays géo, Germanium, Chine, filtre IHH Pays."""
page = app.page
# Naviguer vers l'onglet Analyse (le graphe se charge automatiquement)
app.naviguer_vers("Analyse")
expect(page.get_by_role("heading", name="Analyse du graphe")).to_be_visible(timeout=15000)
# Sélectionner le niveau de départ : Produit final
app.choisir_selectbox("Niveau de départ", "Produit final")
# Sélectionner le niveau d'arrivée : Pays géographique
app.choisir_selectbox("Niveau d'arrivée", "Pays géographique")
# Ajouter le minerai Germanium
expect(page.get_by_text("Filtrer par minerais")).to_be_visible(timeout=10000)
app.ajouter_multiselect("minerais", "Germanium")
# Ajouter le nœud de départ : Serveur
app.ajouter_multiselect("noeuds de départ", "Serveur")
# Ajouter le nœud d'arrivée : Chine
app.ajouter_multiselect("noeuds d'arrivée", "Chine")
# Cocher le filtre IHH
app.cocher("IHH")
# Sélectionner Pays pour le filtre IHH
app.choisir_radio("Pays")
# Lancer l'analyse
app.cliquer_bouton("Lancer l'analyse")
# Vérifier que le diagramme Sankey s'affiche
expect(page.get_by_text("Hiérarchie filtrée")).to_be_visible(timeout=15000)
# Vérifier la présence de nœuds clés dans le graphe Sankey (Plotly)
sankey = page.get_by_test_id("stPlotlyChart")
expect(sankey.get_by_text("Serveur").first).to_be_visible()
expect(sankey.get_by_text("Germanium").first).to_be_visible()