client-java icon indicating copy to clipboard operation
client-java copied to clipboard

@Step templating not supports `this` object reference in inner classes

Open tronstone opened this issue 1 year ago • 0 comments

Describe the bug @Step annotation templating not supports this object reference in inner classes

Steps to Reproduce Java Example:

public class A {
   // Some code

   public abstract class B {
      private final SelenideElement switcher;
      private final String switcherName;

      protected B(By switcherContainer, String switcherName) {
            switcher = $(switcherContainer).$(byClassName("MuiSwitch-switchBase"));
            this.switcherName = switcherName;
      }

      @Step("Enabling '**this.switcherName**'")
        public B enable() {
            if (switcher.has(not(cssClass("Mui-checked")))) {
                switcher.click(usingDefaultMethod()).shouldHave(cssClass("Mui-checked"));
                log.debug("Clicked on '{}' switcher", switcherName);
                log.info("'{}' was enabled", switcherName);
            }

            return this;
       }   
   }
}

Expected behavior In this example the expected behavior will be correct naming for step with replaced value for this.switcherName

Actual behavior In ReportPortal log showing like: Enabling 'this.switcherName' without replacing

Dependency versions Report-Portal client version 5.1.20. I think the same for latest versions too.

tronstone avatar Jan 02 '24 15:01 tronstone