retrieve the full content of AEM page AEM

Firstly, why do we need to retrieve all the content from an AEM page? This requirement typically arises when conducting unit tests to improve code quality and examine the logic within each function or method.

Navigate to CRXDE Lite and inspect the en node to see all of its child nodes.

Follow the structure of the en node and its children. Access the URL http://localhost:4502/content/flagtick/us/en.html.-1.json to retrieve the full content of the en page expressed in JSON format.

Note: You can also use .infinity.json instead of .-1.json to achieve the same result.

Then, let import or load content from JSON file (en.json) into specific location in the Adobe Experience Manager (AEM) repository (/content/flagtick/us/en).

package com.flagtick.core.models.impl;

import io.wcm.testing.mock.aem.junit5.AemContext;
import io.wcm.testing.mock.aem.junit5.AemContextExtension;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

import static com.flagtick.core.utils.TestConstants.RESOURCE_MODELS_ROOT_PATH;

class ContentLoadingTest {

    private final AemContext context = new AemContext();

    void setUp() {
        // Load content
        context.load().json(RESOURCE_MODELS_ROOT_PATH + "/en.json", "/content/flagtick/us/en");

    void testContentLoading() {
        // Your test logic related to content loading if needed

If you debug the code fragment context.currentResource(), you can view all the paths inside the resolver/resources in IntelliJ. One of the paths you can find is /content/flagtick/us/en/dashboard.

void testContentLoading() {
    Resource homePageRes = context.resourceResolver().resolve("/content/flagtick/us/en/dashboard");
    Page homePage = homePageRes.adaptTo(Page.class);

    when(PageUtils.isPageOfTemplate(homePage, Constants.HOME_PAGE_TEMPLATE_TYPE)).thenReturn(true);

The code above retrieves the dashboard page and checks if the template of the dashboard page matches the constant HOME_PAGE_TEMPLATE_TYPE (specifically, with the value /conf/flagtick/settings/wcm/templates/dashboard-template).

aem component checkbox default checked styleString in HTL AEM component add clientlibs in AEM component include client libraries in AEM component Dynamically change a web page's title in AEM component
You need to login to do this manipulation!