Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-7030

Add Convenience Methods in BaseWicketTester

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 10.0.0-M1
    • wicket-core
    • None

    Description

      Since BasewicketTester does not have methods to conveniently search for components by wicket ID only, ignoring the path from last last rendered page, we could add them.

      For example we could add

      Optional<Component> getFirstComponentByWicketId(String id)
      List<Component> getAllComponentsByWicketId(String id)
      

      to enable the Tester to do the following without the manual use of IVisitor

      tester.startComponentInPage(myComponent);
      
      var nestedComponent = tester.getFirstComponentByWicketId("myNestedComponent");
      
      assertThat(nestedComponent).isPresent(). ...
      
      // Other Example
      tester.startComponentInPage(myComponentWithListView);
      
      var result = tester.getAllComponentsByWicketId("repeterNestedItem");
      
      assertThat(result).hasSize(4)
      .extracting(c -> c.isVisible())
      .containsExactly(true, false, true, true);
      

      Attachments

        Activity

          People

            mgrigorov Martin Tzvetanov Grigorov
            renoth Johannes Renoth
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: