/[openfoncier]/trunk/tests/testSuivi.php
ViewVC logotype

Annotation of /trunk/tests/testSuivi.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1721 - (hide annotations)
Thu Apr 18 10:57:39 2013 UTC (11 years, 9 months ago) by fmichon
File size: 7981 byte(s)
Ajout du verifyNoErrors

1 fmichon 1673 <?php
2     /**
3     *
4     *
5     * @package openfoncier
6     * @version SVN : $Id$
7     */
8    
9     //
10 fmichon 1677 require_once "base.php";
11 fmichon 1673
12     /**
13     *
14     */
15     class Suivi extends BaseTestCase {
16    
17     private function login() {
18     // on commence par se connecter
19     $this->connect("suivi", "suivi");
20     // On doit être connecté
21     $this->assertTrue($this->isTextPresent("Votre session est maintenant ouverte."));
22     }
23    
24     private function logout() {
25     // puis on se déconnecte
26     $this->deconnect();
27     // on doit avoir un message nous indiquant que la session est finie
28     $this->assertTrue($this->isTextPresent("Votre session est maintenant terminée."));
29     // on ne doit plus avoir de lien de déconnexion
30     $this->assertFalse($this->isElementPresent("link=Déconnexion"));
31     }
32    
33     /**
34     * Ce test vise uniquement à vérifier que les écrans correspondant à chaque
35     * entrée de menu ne génère pas une erreur de base de données
36 fmichon 1690 *
37     * Ce test est temporaire, il permet d'effectuer un test grossier sur chacun
38     * des écrans en attendant que l'intégralité des cas d'utilisation soient
39     * testés
40 fmichon 1673 */
41     public function testGeneral() {
42     //
43     $this->login();
44 fmichon 1690
45 fmichon 1673 //
46     $this->clickAndWait("link=Mise à jour des dates");
47 fmichon 1681 $this->verifyTextPresent("suivi > suivi des pièces > mise à jour des dates");
48 fmichon 1719 $this->verifyNoErrors();
49 fmichon 1673 //
50     $this->clickAndWait("link=gestion");
51     $this->verifyTextPresent("suivi > commissions > gestion");
52 fmichon 1719 $this->verifyNoErrors();
53 fmichon 1673 //
54     $this->clickAndWait("link=demandes");
55     $this->verifyTextPresent("suivi > commissions > demandes");
56 fmichon 1719 $this->verifyNoErrors();
57 fmichon 1690
58 fmichon 1673 //
59     $this->logout();
60     }
61 nhaye 1695
62     /**
63     * XXX tous les cas d'utilisation ne sont pas testés
64     * Permet de tester la génération de feuillets pour lettre avec accusé de récéption
65     */
66     public function testEnvoiLettreRAR() {
67     //
68     $this->login();
69    
70     //
71     $this->clickAndWait("link=envoi lettre RAR");
72     $this->verifyTextPresent("suivi > suivi des pièces > envoi lettre RAR");
73 fmichon 1719 $this->verifyNoErrors();
74 fmichon 1710
75 nhaye 1695 // Vérification sans valeur saisie
76     $this->clickAndWait("//input[@value='Valider']");
77 fmichon 1721 $this->verifyNoErrors();
78 nhaye 1695 $this->verifyTextPresent("Tous les champs doivent être remplis.");
79 fmichon 1710
80     // Vérification avec un numéro non valide
81 nhaye 1695 $this->type("id=liste_instruction", "a");
82     $this->clickAndWait("//input[@value='Valider']");
83 fmichon 1721 $this->verifyNoErrors();
84 fmichon 1710 $this->verifyTextPresent("Le code d'instruction a n'est pas valide.");
85    
86     // Vérification avec un numéro non présent en base
87     $this->type("id=liste_instruction", "123");
88     $this->clickAndWait("//input[@value='Valider']");
89 fmichon 1721 $this->verifyNoErrors();
90 fmichon 1710 $this->verifyTextPresent("Le numéro 123 ne correspond à aucune instruction.");
91    
92 nhaye 1695 // Vérification formulaire valide
93     $this->type("id=liste_instruction", "1");
94     $this->clickAndWait("//input[@value='Valider']");
95 fmichon 1719 $this->verifyNoErrors();
96 fmichon 1710 $this->verifyTextPresent("Cliquez sur le lien ci-dessous pour télécharger votre document :");
97     $this->verifyTextPresent("Télécharger le document pour 1 RAR");
98 nhaye 1695 //
99     $this->logout();
100     }
101 fmichon 1710
102 fmichon 1685 /**
103     *
104     */
105     public function testRetoursDeConsultation() {
106     //
107     $this->login();
108 fmichon 1690
109 fmichon 1685 //
110     $this->clickAndWait("link=retours de consultation");
111 fmichon 1721 $this->verifyNoErrors();
112 fmichon 1685 $this->verifyTextPresent("suivi > suivi des pièces > retours de consultation");
113 fmichon 1690
114 fmichon 1685 //
115     $this->clickAndWait("//input[@value='Valider']");
116 fmichon 1719 $this->verifyNoErrors();
117 fmichon 1685 $this->verifyTextPresent("Veuiller saisir un N° de consultation.");
118 fmichon 1690
119 fmichon 1685 //
120     $this->type("id=consultation", "aze");
121     $this->clickAndWait("//input[@value='Valider']");
122 fmichon 1719 $this->verifyNoErrors();
123 fmichon 1685 $this->verifyTextPresent("Cette consultation n'existe pas.");
124    
125     // XXX Aller plus loin dans les cas d'utilisation lors de la saisie
126     $this->type("id=consultation", "1");
127     $this->clickAndWait("//input[@value='Valider']");
128 fmichon 1719 $this->verifyNoErrors();
129 fmichon 1685 $this->verifyTextPresent("suivi > suivi des pièces > retours de consultation > 1");
130     $this->verifyTextPresent("AZ0130551200001P0");
131     $this->select("id=avis_consultation", "label=Favorable");
132     $this->type("id=motivation", "blablabla");
133 nhaye 1699 // Ajout d'un fichier
134     // Test l'affichage d'un fichier si le champ est vide
135     $this->click("css=span.ui-icon.ui-icon-newwin");
136     $this->setSpeed('120');
137     $this->assertEquals("zone vide", $this->getAlert());
138     $this->click("css=span.ui-icon.ui-icon-closethick");
139     // Upload de fichier
140     $this->click("css=span.ui-icon.ui-icon-arrowthickstop-1-s");
141     // Validation sans saisie de fichier
142     $this->click("name=submit");
143 fmichon 1721 $this->verifyNoErrors();
144 nhaye 1699 $this->verifyTextPresent("Vous devez sélectionner un fichier.");
145     // Saisie de fichier
146 nhaye 1700 $this->type("name=userfile[]", dirname(__FILE__)."/binaire/lettre_rar16042013124515.pdf");
147 nhaye 1699 $this->click("name=submit");
148 fmichon 1721 $this->verifyNoErrors();
149 nhaye 1699 // Visualisation du fichier
150     $this->click("css=span.ui-icon.ui-icon-newwin");
151 nhaye 1700 $this->verifyTextPresent("Voir > [ lettre_rar16042013124515.pdf ]");
152 nhaye 1699 $this->click("css=span.ui-icon.ui-icon-closethick");
153 nhaye 1695 //
154 fmichon 1685 $this->clickAndWait("//input[@value='Modifier']");
155 fmichon 1719 $this->verifyNoErrors();
156 fmichon 1685 $this->verifyTextPresent("Vos modifications ont bien été enregistrées.");
157 fmichon 1721
158     //
159 fmichon 1685 $this->clickAndWait("link=Retour");
160 fmichon 1721 $this->verifyNoErrors();
161 fmichon 1685 $this->verifyTextPresent("suivi > suivi des pièces > retours de consultation");
162 fmichon 1690
163     //
164     $this->logout();
165     }
166 fmichon 1710
167 fmichon 1690 /**
168     *
169     */
170     public function testBordereaux() {
171 fmichon 1685 //
172 fmichon 1690 $this->login();
173 fmichon 1710
174 fmichon 1690 //
175     $this->clickAndWait("link=Bordereaux");
176 fmichon 1721 $this->verifyNoErrors();
177 fmichon 1690 $this->verifyTextPresent("suivi > suivi des pièces > bordereaux");
178 fmichon 1710
179 fmichon 1690 //
180     $this->clickAndWait("//input[@value='Valider']");
181 fmichon 1719 $this->verifyNoErrors();
182 fmichon 1690 $this->verifyTextPresent("Veuillez sélectionner un bordereau.");
183    
184     //
185     $this->select("id=bordereau", "label=Bordereau d'envoi des avis du Maire au Préfet");
186     $this->click("id=date_bordereau");
187     $this->type("id=date_bordereau", "");
188     $this->assertEquals("La date saisie n'est pas valide", $this->getAlert());
189     $this->clickAndWait("//input[@value='Valider']");
190 fmichon 1719 $this->verifyNoErrors();
191 fmichon 1690 $this->verifyTextPresent("Veuillez saisir une date valide.");
192 fmichon 1710
193 fmichon 1690 //
194     $bordereaux = array(
195     "Bordereau d'envoi des avis du Maire au Préfet",
196     "Bordereau d'envoi des contrôles de légalité",
197     "Bordereau d'envoi de courriers signature Maire",
198     "Bordereau d'envoi des décisions",
199     );
200     foreach ($bordereaux as $bordereau) {
201     //
202     $this->select("id=bordereau", "label=".$bordereau."");
203     $this->clickAndWait("//input[@value='Valider']");
204     $this->verifyTextPresent("Cliquez sur le lien ci-dessous pour télécharger votre bordereau : \n\n".$bordereau." au ".date("d/m/Y"));
205     //
206     $this->click("link=".$bordereau." au ".date("d/m/Y"));
207     $this->waitForPopUp("", "30000");
208     $this->selectPopUp();
209     sleep(5);
210 fmichon 1719 $this->verifyNoErrors();
211 fmichon 1690 $this->verifyTextPresent("Edition du ".date("d/m/Y"));
212     $this->close();
213     $this->selectWindow();
214     }
215 fmichon 1710
216 fmichon 1690 //
217 fmichon 1685 $this->logout();
218     }
219    
220 fmichon 1673 }
221    
222     ?>

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26