BREAKING NEWS: Exadel named a Leader in this Forrester Agile Software Development Service Providers report... Learn more!  

AEM Tip: Automating Verification in AEM Author

 
 
 

QAs that work on AEM-based systems not only have to test the front-end functionality for users, but also the authoring part on the back end. With big systems, this task can involve significant complexity for manual verification.

In web technology, we usually talk about automated testing as part of testing the functionality of sites for users. But, what if we look at AEM Author as if it were a bunch of web pages? Doing so allows us to make automated scripts for almost any aspect of authoring as we would for any other web page. Now it becomes as easy as boiling an egg. We just need to remember a few things like the fact that in AEM the source code of a web interface page is dynamically generated based on user interactions. In this tip, we describe an example of an automated case to check the list of available templates for creating a page (based on AEM Classic UI).

Knowing that some templates are limited to specific paths/folders we need to run a test on each individual path/folder. The problem is that every opening of “create window” adds its source code to the web page source and it just sits there until the page is reloaded. So either we need to refresh the page (or open it in a new browser) for each test, or add a few verification steps to match the current opened path/folder along with its “create window” action.

For the second approach in the script, we need to first specify the testing path/folder. The Collection document.getElementsByClassName(' x-form-hidden x-form-field') will contain all previously opened “create windows” instances. From this collection we need an HTML element that has name=”parentPage” and value=<our test path/folder>. Now getElementsByClassName('template-item') from the found element will collect all templates presented in the open window.

Keep in mind that some elements have thumbnail images and some do not, so gathering template names and descriptions will look like this:

BREAKING NEWS! Want to test new technologies like blockchain, AI, mobile, chatbot, and machine learning models? Learn about our Innovation Cloud.