salesforce / utam-java

UTAM Java implementation
MIT License
25 stars 16 forks source link

feat: ability for container and custom types to have nested elements #216

Closed lizaiv77 closed 5 months ago

lizaiv77 commented 5 months ago

Grammar changes reflected in doc https://github.com/salesforce-experience-platform-emu/utam-docs/pull/985 Implementation required to create getter that returns basic type instead of container and custom, for container we also needed to add field with proper locator. For example after this change if container rootContainer element has nested elements, we now also create field and private method that returns container element as basic scope:

@ElementMarker.Find(css = "slot")
 private ElementLocation rootContainerScope;

final BasicElement getRootContainerScopeElement() {
    BasicElement root = this.getRootElement();
    return basic(root, this.rootContainerScope).build(BasicElement.class, BasePageElement.class);
  }

Similarly if custom element customRoot has nested elements, we create private getter to return custom element as basic scope (field for custom element is created anyway):

final BasicElement getCustomRootScopeElement() {
    BasicElement root = this.getRootElement();
    return basic(root, this.customRoot).build(BasicElement.class, BasePageElement.class);
 }