1A_baseCest.php 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <?php
  2. use Codeception\Util\Locator;
  3. # comando para correr el test: php ./vendor/bin/codecept run --steps tests/acceptance/1_baseCest.php
  4. class BaseCest
  5. {
  6. public function frontpageWorks(AcceptanceTester $I)
  7. {
  8. $I->maximizeWindow();
  9. $cliente = "fd3";
  10. shell_exec('mkdir -p ./tests/_output/debug/01_Add_Base/');
  11. #log in
  12. try{
  13. $I->amOnPage('/');
  14. try{
  15. $I->acceptPopup();
  16. }catch(\Exception $e){}
  17. $I->see('Nombre de usuario');
  18. $I->fillField('_username', 'admin');
  19. $I->fillField('_password', 'admin');
  20. #$I->click("//*[@title='Close Toolbar']");
  21. $I->click('_submit');
  22. $I->wait('5');
  23. }catch(\Exception $e){
  24. $I->makeScreenshot('01_Add_Base/0_login');
  25. }
  26. # ____________________ Base _____________________
  27. /*
  28. # Codigos de Autenticación
  29. try{
  30. $I->amOnUrl('https://base.' . $cliente . '.flowdat.com/admin/base/oauthserver/authcode/create');
  31. $I->fillField('Usuario', 'iksop'."\n");
  32. $I->fillField('Token', '002');
  33. $I->fillField('URI de Redirección','TestDirección');
  34. $I->fillField('Expiración','4');
  35. $I->fillField('Alcance','TestFernando');
  36. $I->click('button.btn.btn-success');
  37. $I->wait('5');
  38. $I->see('ha sido creado con éxito');
  39. }catch(\Exception $e){
  40. $I->makeScreenshot('01_Add_Base/1_oauthcode');
  41. }
  42. # Clientes OAuth
  43. try{
  44. $I->amOnUrl('https://base.'.$cliente.'.flowdat.com/admin/base/oauthserver/oauthclient/create');
  45. $I->click('button.btn.btn-success');
  46. $I->wait('5');
  47. $I->see('ha sido creado con éxito');
  48. }catch(\Exception $e){
  49. $I->makeScreenshot('01_Add_Base/2_oauthclient');
  50. }
  51. # Tokens de Acceso
  52. try{
  53. $I->amOnUrl('https://base.'.$cliente.'.flowdat.com/admin/base/oauthserver/accesstoken/create');
  54. $I->fillField('Usuario', 'iksop'."\n");
  55. $I->fillField('Token', '002');
  56. $I->fillField('Expiración','4');
  57. $I->fillField('Alcance','TestFernando');
  58. $I->click('button.btn.btn-success');
  59. $I->wait('5');
  60. $I->see('ha sido creado con éxito');
  61. }catch(\Exception $e){
  62. $I->makeScreenshot('01_Add_Base/3_accesstoken');
  63. }
  64. # Tokens de Refresco
  65. try{
  66. $I->amOnUrl('https://base.'.$cliente.'.flowdat.com/admin/base/oauthserver/refreshtoken/create');
  67. $I->fillField('Usuario', 'iksop'."\n");
  68. $I->fillField('Token', '002');
  69. $I->fillField('Expiración','4');
  70. $I->fillField('Alcance','TestFernando');
  71. $I->click('button.btn.btn-success');
  72. $I->wait('5');
  73. $I->see('ha sido creado con éxito');
  74. }catch(\Exception $e){
  75. $I->makeScreenshot('01_Add_Base/4_refreshtoken');
  76. }
  77. */
  78. # Workflow
  79. try{
  80. $I->amOnUrl('https://base.'.$cliente.'.flowdat.com/admin/workflow/workflow/create');
  81. $I->fillField('Nombre','fernandotest');
  82. $I->fillField('Descripción', 'FernandoTest');
  83. $I->fillField('Tipo de Workflow', 'workflow'."\n");
  84. $I->fillField('Supports', 'ClientBundle\Entity\Client'."\n");
  85. $I->click('button.btn.btn-success');
  86. $I->wait('18');
  87. $I->see('ha sido creado con éxito');
  88. }catch(\Exception $e){
  89. $I->makeScreenshot('01_Add_Base/1_workflow');
  90. }
  91. # Action
  92. try{
  93. $I->amOnUrl('https://base.'.$cliente.'.flowdat.com/admin/workflow/action/create');
  94. $I->fillField('Nombre', 'FernandoTest');
  95. $I->fillField('Evento', 'transition'."\n");
  96. $I->fillField('Workflow', 'FernandoTest');
  97. $I->fillField('Referencia', 'FernandoTest'."\t");
  98. $I->fillField('Clase', "\n"."\n");
  99. $I->fillField("//*[@class='ace_text-input']", 'template');
  100. $I->wait('5');
  101. $I->click('button.btn.btn-success');
  102. $I->wait('5');
  103. $I->see('ha sido creado con éxito');
  104. }catch(\Exception $e){
  105. $I->makeScreenshot('01_Add_Base/2_action');
  106. }
  107. # Alertas
  108. try{
  109. $I->amOnUrl('https://base.'.$cliente.'.flowdat.com/admin/alert/alert/create');
  110. $I->fillField('Título','TestFernando');
  111. $I->fillField('Cuerpo','TestFernando');
  112. $I->click('span.control-label__text');
  113. $I->click('button.btn.btn-success');
  114. $I->wait('5');
  115. $I->see('ha sido creado con éxito');
  116. }catch(\Exception $e){
  117. $I->makeScreenshot('01_Add_Base/3_alert');
  118. }
  119. # Tipo de Alertas
  120. try{
  121. $I->amOnUrl('https://base.'.$cliente.'.flowdat.com/admin/alert/alerttype/create');
  122. try{
  123. $I->acceptPopup();
  124. }catch(\Exception $e){
  125. }
  126. $I->fillField('Nombre Corto','Test');
  127. $I->fillField("(//*[@class=' form-control'])[2]",'TestFernando');
  128. $I->wait('5');
  129. $I->click("(//*[@class='iCheck-helper'])[1]");
  130. $I->click("(//*[@class='iCheck-helper'])[2]");
  131. $I->click('button.btn.btn-success');
  132. $I->wait('5');
  133. $I->see('ha sido creado con éxito');
  134. }catch(\Exception $e){
  135. $I->makeScreenshot('01_Add_Base/4_alerttype');
  136. }
  137. # Crear Usuarios
  138. try{
  139. $I->amOnUrl('https://base.'.$cliente.'.flowdat.com/admin/user/create');
  140. try{
  141. $I->acceptPopup();
  142. }catch(\Exception $e){
  143. }
  144. $I->fillField('Nombre de Usuario', 'TestFernando');
  145. $I->fillField('E-Mail', 'TestFernando@test');
  146. $I->fillField('Contraseña', 'TestFernando');
  147. $I->fillField('Nombre', 'TestFernando');
  148. $I->fillField('Apellido', 'TestFernando');
  149. $I->click("(//*[@class='iCheck-helper'])[1]");
  150. $I->fillField('Acción inicial', 'Inicio'."\n");
  151. $I->fillField('Grupos', 'Administrador General'."\n");
  152. $I->fillField('Tenencias', 'Base'."\n");
  153. # solo Role de Admin y User
  154. # Roles
  155. # $I->click("(//*[@class='iCheck-helper'])[4]");
  156. # $I->click("(//*[@class='iCheck-helper'])[5]");
  157. $I->click('Crear y regresar al listado');
  158. $I->wait('5');
  159. $I->see('ha sido creado con éxito');
  160. }catch(\Exception $e){
  161. $I->makeScreenshot('01_Add_Base/5_user');
  162. }
  163. # Grupos
  164. try{
  165. $I->amOnUrl('https://base.'.$cliente.'.flowdat.com/admin/group/create');
  166. try{
  167. $I->acceptPopup();
  168. }catch(\Exception $e){
  169. }
  170. $I->fillField('Nombre de Grupo', 'TestFernando');
  171. #$I->click("(//*[@class='icheckbox_square-blue'])[1]"); # selecciona el checkbox 1
  172. #$I->fillField('Usuarios', 'TestFernando'."\n");
  173. $I->fillField('Roles', 'ROLE_SONATA_ALERT_READER'."\n");
  174. $I->click('Crear y regresar al listado');
  175. $I->wait('5');
  176. $I->see('ha sido creado con éxito');
  177. }catch(\Exception $e){
  178. $I->makeScreenshot('01_Add_Base/6_group');
  179. }
  180. # Tenencias
  181. # ________________________ NO BORRA LA TENENCIA DESPUÉS ________________________
  182. try{
  183. $I->amOnUrl('https://base.'.$cliente.'.flowdat.com/admin/tenancy/create');
  184. try{
  185. $I->acceptPopup();
  186. }catch(\Exception $e){
  187. }
  188. $I->fillField('Tenencia','TestFernando');
  189. $I->click("(//*[@class='icheckbox_square-blue'])[1]");
  190. $I->click('Crear y regresar al listado');
  191. $I->wait('5');
  192. $I->see('ha sido creado con éxito');
  193. }catch(\Exception $e){
  194. $I->makeScreenshot('01_Add_Base/7_tenancy');
  195. }
  196. # Clientes
  197. try{
  198. $I->amOnUrl('https://base.'.$cliente.'.flowdat.com/admin/client/client/create');
  199. try{
  200. $I->acceptPopup();
  201. }catch(\Exception $e){
  202. }
  203. $I->fillField('External Id', 'extId_001336');
  204. $I->fillField('Nombre', 'TestFernando');
  205. $I->fillField('Companía', 'TestFernando');
  206. $I->fillField('Comentario', 'TestFernando');
  207. $I->fillField('Email', 'fernando@interlink.com.ar');
  208. $I->fillField('Teléfono', '034070304');
  209. $I->click('Mapa');
  210. $I->wait('3');
  211. $I->fillField("//*[@id='searchtext9']",'Mariano Moreno 535, Rosario'."\n"."\n");
  212. $I->click("//*[@id='searchtext9']");
  213. $I->pressKey("//*[@id='searchtext9']", WebDriverKeys::ENTER);
  214. $I->wait('3');
  215. $I->click('Crear y regresar al listado');
  216. $I->wait('8');
  217. $I->see('ha sido creado con éxito');
  218. }catch(\Exception $e){
  219. $I->makeScreenshot('01_Add_Base/8_client');
  220. }
  221. # Dispositivos
  222. try{
  223. $I->amOnUrl('https://base.'.$cliente.'.flowdat.com/admin/license/device/create');
  224. try{
  225. $I->acceptPopup();
  226. }catch(\Exception $e){
  227. }
  228. $I->fillField('Id Dispositivo', '342234');
  229. $I->fillField('Ip', '193.12.29.4');
  230. $I->click('Crear y regresar al listado');
  231. $I->wait('8');
  232. $I->see('ha sido creado con éxito');
  233. }catch(\Exception $e){
  234. $I->makeScreenshot('01_Add_Base/9_device');
  235. }
  236. try{
  237. $I->acceptPopup();
  238. }catch(\Exception $e){}
  239. }
  240. }