Automatización de pruebas de AEM: creación de páginas a través de solicitudes HTTP

Si ya está familiarizado con AEM, no dude en omitir esta parte. De lo contrario, debe comprender qué es este AEM y por qué es difícil probarlo.





AEM - content management system Adobe ( - WordPress ). ? , (AEM-author), (Editors) , . ( publish ) (AEM-publish). , , . 





. , user interface, , . , , . , , Google , - .





, — AEM version 6.4.4.0.  , . :





  1. Screenshots tests — AEM — content management system => , , ( ).





  2. Web-component tests — UI Cypress . , .





  3. Web Performance tests — Web- ( Sitespeed)





— ( ). . , , , .





? , . . , , . , , - . 





, — . ? . — , . . .





, . . 5 , , 10+ .





?









, , , .





Long story short

, API. - , . - — ( ? — ). 





— reverse engineering (AEM-author) .





, — , - - :





  1. (page template)

















  2. , , :










...





dev-tools Network. 





1.

  1. AEM-author





  2. Sites









  3. Create





  4. template









  5. Network dev-tools





  6. Create





`${aem-author-URL}/libs/wcm/core/content/sites/createpagewizard/_jcr_content



` .





. POST FormData



. .. body JSON/XML



. Content-Type: application/x-www-form-urlencoded.





JS (-, url encoded key=value



&



). , , , (key



) . .. Form Data



tags=Tag1&tags=Tag2



( , ).





[Ejemplo de solicitud] FormData codificado en URL
[Request Example] URL encoded FormData
[Ejemplo de solicitud] FormData analizado
[Request Example] Parsed FormData

:





  • parentPath



    — / AEM-e,





  • template



    — ,





… , …





  • ./jcr:title



    — / ( UI)





  • ./cq:tags



    — , ( )





  • ./articleDate



    , ./articleTimeToRead



    :cq_csrf_token







, .





, . , token



. cypress.io , API auth



username



password



, , body. (For more info check Cypress: Request - arguments and http-authentication).





ImplementaciĂłn del envĂ­o de una solicitud POST con FormData
POST FormData

key takeaways: `${aem-author-URL}/libs/wcm/core/content/sites/createpagewizard/_jcr_content



`, parentPath



template



.






2.

  1. AEM author





  2. Edit





  3. ()  





  4. +







  5. Network dev-tools









`${aem-author-URL}/content/${page-path}/jcr:content/par/${some-url-part}/par/



`.





[Ejemplo de solicitud] Agregar componente a la página
[Request Example] Add Component to the page

:





  • ./@CopyFrom



    — (default) (button )





  • ./sling:resourceType



    — ,





  • parentResourceType



    — , ,






3.





  1. “ ”









  2. Network dev-tools





  3. Done





`${aem-author-URL}/content/${page-path}/_jcr_content/par/${component-name}



`.





[Ejemplo de solicitud] Configurar componente
[Request Example] Configure Component

:





  • ./sling:resourceType



    — ,





  • :cq_csrf_token



    — , auth






4.





  1. Network dev-tools





  2. Quick Publish -> Publish





4.1.

2 .





4.1.1.

reference.json… — `${aem-author-URL}/libs/wcm/core/content/reference.json?${url-params}



` — (assets), c .





[Ejemplo de solicitud] Verificar activos relacionados con la página publicada
[Request Example] Check Assets related to the published page

— query string params



. path



.





. path`s



, published



false



.





[Ejemplo de respuesta] Comprobar activos
[Responce Example] Check Assets

4.1.2.

replicate — `${aem-author-URL}/bin/replicate



` — .





[Ejemplo de solicitud] Página de publicación y activos relacionados
[Request Example] Publish Page and Related Assets

, :





  • cmd: Activate



    —





  • path



    — 2





4.2.

— . , .





— GET `${aem-author-URL}/etc/replication/agents.author/publish_publish/jcr:content.queue.json



`.  . , ,  body.queue



path



. , ( timeout 1 , ).






5.









  1. Network dev-tools





  2. Delete-> Delete





`${aem-author-URL}/bin/wcmcommand



`.





[Ejemplo de solicitud] Eliminar página
[Request Example] Delete Page

:





  • cmd



    — deletePage





  • path



    —





  • force: false



    — true



    ( )





  • checkChildren: true



    —






, … 

- . — . 





FormData



. , ( ). FormData



( ).





, :





  • AEM `-



    `. `Bla 1 2 3 4



    ` , …/bla-1-2-3-4







  • lowerCase



    ( . )





  • `_



    ` ( 18 ) `_



    `. BlaBla123456789123456_blabla



    , …/blabla123456789123456_blabla



    , …/blabla123456789123456blabla







  • id



    . .








All Articles