Otomatisasi Tes AEM - Membuat Halaman melalui Permintaan HTTP

Jika Anda sudah terbiasa dengan AEM, jangan ragu untuk melewati bagian ini. Jika tidak, Anda harus memahami apa itu AEM dan mengapa sulit untuk mengujinya.





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



( , ).





[Contoh Permintaan] URL yang dikodekan FormData
[Request Example] URL encoded FormData
[Contoh Permintaan] Parsed FormData
[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).





Implementasi pengiriman permintaan POST dengan 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/



`.





[Contoh Permintaan] Tambahkan Komponen ke halaman
[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}



`.





[Contoh Permintaan] Konfigurasi Komponen
[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 .





[Contoh Permintaan] Periksa Aset yang terkait dengan halaman yang dipublikasikan
[Request Example] Check Assets related to the published page

โ€” query string params



. path



.





. path`s



, published



false



.





[Contoh Responce] Periksa Aset
[Responce Example] Check Assets

4.1.2.

replicate โ€” `${aem-author-URL}/bin/replicate



` โ€” .





[Contoh Permintaan] Publikasikan Halaman dan Aset Terkait
[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



`.





[Contoh Permintaan] Hapus Halaman
[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