Skip to content
This repository has been archived by the owner on Nov 23, 2021. It is now read-only.

Using Aem Author Helper

Mikołaj Mański edited this page Jul 18, 2016 · 1 revision

Using Aem Author Helper

AemAuthorHelper is a utility class which provides methods to easily obtain parsys, component's scope or a component dialog. Let's obtain a dialog for given component on the n-th level using this BDD example:

  @Inject
  private AemClassicAuthorHelper authorHelper;
//..
  @And("^I configure the \"([^\"]*)\" component index \"([^\"]*)\" using my component configuration data$")
  public void iConfigureTheComponentIndexXUsingMyComponentConfigurationData(String componentName,
      Integer x) {
    aemDialog = authorHelper.getDialog(scenarioContext.getString(PARSYS_NAME_KEY),
        DemoComponents.fromString(componentName), x);
    aemDialog.open();
    //..
  }

For more information about ScenarioContext you should refer to the Scenario Context tutorial.

Example DemoComponents implementation:

public enum DemoComponents implements Components {

  SECTION_HEADER_COMPONENT(SectionHeaderComponent.class)
  //..

  private Class<?> clazz;

  DemoComponents(Class<?> clazz) {
    this.clazz = clazz;
  }

  public static DemoComponents fromString(String componentName) {
    String normalized = componentName.replace(" ", "_").toUpperCase();
    return DemoComponents.valueOf(normalized);
  }

  @Override
  public Class<?> getComponentClass() {
    return clazz;
  }
}

Appropriate Gherkin scenario:

 Scenario: As an author I can show title of Section Header Component
    Given I have opened Feedback page
    And parsys I'm working with is named "par"
    And my component configuration data is:
      | tab            | type       | label        | value       |
      | Section header | text field | Header Text  | text        |
      | Section header | dropdown   | Header size  | Medium (h3) |
    And I configure the "Section Header Component" component index "2" using my component configuration data
    Then Text Field Component with index "2" Title field is visible

You can see other available methods by reading javadoc.

Getting started with Bobcat

  1. Getting started

AEM Related Features

  1. Authoring tutorial - Classic
  1. AEM Classic Authoring Advanced usage
  1. Authoring tutorial - Touch UI
Clone this wiki locally