Class BrowserlessTargetResolver

java.lang.Object
com.vaadin.copilot.testrecordergenerator.browserless.BrowserlessTargetResolver

public class BrowserlessTargetResolver extends Object
Resolves a live server-side component to a BrowserlessTargetDescriptor that a generated Browserless test can use to find the same component.

Candidate locators are tried in priority order against the live UI tree and the first one that matches exactly one component is used. The matching rules mirror the ones used by Browserless ComponentQuery so that the generated find(...).single() calls succeed:

  • the tree is walked depth-first from the UI using Component.getChildren()
  • the type matches with instanceof
  • withTestId uses Component.getTestId()
  • withLabel uses the label element property
  • withText uses Element.getText()
Component modules are not on the Copilot classpath, so component types are compared by class name.
  • Constructor Details

    • BrowserlessTargetResolver

      public BrowserlessTargetResolver()
  • Method Details

    • resolve

      public BrowserlessTargetDescriptor resolve(com.vaadin.flow.component.UI ui, com.vaadin.flow.component.Component target)
      Resolves the given component.
      Parameters:
      ui - the UI that contains the component
      target - the component to resolve
      Returns:
      the descriptor, never null