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

Contents of /trunk/tests/testGuichetUnique.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1674 - (show annotations)
Mon Apr 15 11:17:16 2013 UTC (11 years, 9 months ago) by fmichon
File size: 6650 byte(s)
Factoratisation d'un morceau de code permettant de vérifier qu'il n'y a pas eu d'erreur de base de données affichée à l'écran

1 <?php
2 /**
3 *
4 *
5 * @package openfoncier
6 * @version SVN : $Id$
7 */
8
9 //
10 require "base.php";
11
12 /**
13 *
14 */
15 class GuichetUnique extends BaseTestCase {
16
17 private function login() {
18 // on commence par se connecter
19 $this->connect("guichet", "guichet");
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 doit être réalisé juste après la réinitialisation de la base
35 * de données.
36 */
37 public function testAffichageReglementaire() {
38 //
39 $this->login();
40
41 //
42 $this->clickAndWait("link=attestation");
43 $this->verifyTextPresent("imprimer l'attestation d'affichage réglementaire");
44 //
45 $this->type("id=dossier", "PC0130551200002P0");
46 $this->clickAndWait("//input[@value='Valider']");
47 $this->verifyTextPresent("Ce dossier n'a jamais été affiché.");
48
49 //
50 $this->clickAndWait("link=registre");
51 $this->verifyTextPresent("imprimer le registre d'affichage réglementaire");
52 //
53 $this->click("//input[@value='Valider']");
54 $this->assertTrue((bool)preg_match('/^Etes-vous sur de vouloir confirmer cette action [\s\S]$/',$this->getConfirmation()));
55 //
56 $this->waitForPopUp("", "30000");
57 $this->selectPopUp();
58 sleep(5);
59 $this->verifyNoDatabaseError();
60 $this->verifyTextPresent("Registre des dossiers en cours");
61 $this->close();
62 //
63 $this->selectWindow();
64 $this->verifyTextPresent("Traitement terminé. Le registre a été téléchargé.");
65
66 //
67 $this->clickAndWait("link=attestation");
68 $this->verifyTextPresent("imprimer l'attestation d'affichage réglementaire");
69 //
70 $this->clickAndWait("//input[@value='Valider']");
71 $this->verifyTextPresent("Veuiller saisir un N° de dossier.");
72 //
73 $this->type("id=dossier", "123");
74 $this->clickAndWait("//input[@value='Valider']");
75 $this->verifyTextPresent("Ce dossier n'existe pas.");
76 //
77 $this->type("id=dossier", "PC0130551200002P0");
78 $this->clickAndWait("//input[@value='Valider']");
79 $this->verifyTextPresent("Cliquez sur le lien ci-dessous pour télécharger votre attestation d'affichage : \n\nAttestation d'affichage");
80 //
81 $this->click("link=Attestation d'affichage");
82 $this->waitForPopUp("", "30000");
83 $this->selectPopUp();
84 sleep(5);
85 $this->verifyNoDatabaseError();
86 $this->verifyTextPresent("ATTESTATION D'AFFICHAGE REGLEMENTAIRE");
87 $this->close();
88 //
89 $this->selectWindow();
90
91 //
92 $this->logout();
93 }
94
95 /**
96 *
97 */
98 public function testRecepisse() {
99 //
100 $this->login();
101
102 //
103 $this->clickAndWait("link=récépissé");
104 $this->verifyTextPresent("demande");
105 //
106 $this->clickAndWait("link=DAT0130551200001P0");
107 $this->verifyTextPresent("Demande d'autorisation de construire, d'aménager ou de modifier un ERP");
108 //
109 $this->click("link=Éditer le récépissé PDF");
110 $this->waitForPopUp("", "30000");
111 $this->selectPopUp();
112 sleep(5);
113 $this->verifyNoDatabaseError();
114 $this->verifyTextPresent("RECEPISSE DE DEPOT");
115 $this->close();
116 //
117 $this->selectWindow();
118 //
119 $this->clickAndWait("link=Retour");
120 $this->verifyTextPresent("demande");
121
122 //
123 $this->logout();
124 }
125
126 /**
127 *
128 */
129 public function testPetitionnaireFrequent() {
130 //
131 $this->login();
132
133 //
134 $this->clickAndWait("link=nouveau dossier");
135 $this->verifyTextPresent("demande");
136 //
137 $this->select("id=dossier_autorisation_type_detaille", "label=Permis de construire pour une maison individuelle et / ou ses annexes");
138 $this->select("id=demande_type", "label=Dépôt Initial");
139 $this->click("id=add_petitionnaire_principal");
140 $this->type("id=particulier_nom", "DURAND");
141 $this->type("id=particulier_prenom", "MICKAEL");
142 $this->type("id=particulier_date_naissance", "03/01/1956");
143 $this->type("id=particulier_commune_naissance", "LILLE");
144 $this->type("id=particulier_departement_naissance", "NORD");
145 $this->type("id=numero", "12");
146 $this->type("id=voie", "RUE DE LA LOI");
147 $this->type("document.f2.complement", "APPT 12");
148 $this->type("id=localite", "MARSEILLE");
149 $this->type("id=code_postal", "13012");
150 $this->type("id=telephone_fixe", "0404040404");
151 $this->click("id=frequent");
152
153 $this->click("//input[@value=\"Ajouter l'enregistrement de la table : 'demandeur'\"]");
154 sleep(1);
155 $this->verifyTextPresent("Vos modifications ont bien été enregistrées.");
156 $this->click("css=form[name=\"f2\"] > div.formControls > a.retour");
157 sleep(1);
158 //
159 $this->verifyTextPresent("DURAND MICKAEL\n 12 RUE DE LA LOI APPT 12 \n 13012 MARSEILLE \n 0404040404");
160 $this->clickAndWait("//input[@value='Ajouter']");
161 $this->verifyTextPresent("Création du dossier d'autorisation n°PC0130551300003");
162 //
163 //$this->click("link= Télécharger le récépissé de la demande");
164 $this->click("css=a.lien");
165 $this->waitForPopUp("", "30000");
166 $this->selectPopUp();
167 sleep(5);
168 $this->verifyNoDatabaseError();
169 $this->verifyTextPresent("RECEPISSE DE DEPOT");
170 $this->close();
171 //
172 $this->selectWindow();
173 //
174 $this->clickAndWait("link=Retour");
175 //
176 $this->clickAndWait("link=pétitionnaire fréquent");
177 $this->verifyTextPresent("pétitionnaire fréquent");
178 //
179 $this->verifyTextPresent("DURAND MICKAEL");
180 //
181 $this->clickAndWait("link=DURAND MICKAEL");
182 $this->verifyTextPresent("RUE DE LA LOI ");
183 //
184 $this->clickAndWait("link=Retour");
185 $this->verifyTextPresent("pétitionnaire fréquent");
186 //
187 $this->logout();
188 }
189
190 }
191
192 ?>

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26