Skip to content

Improve jmix-testing skill: add Masquerade E2E, test type comparison, and fix gaps #6

@edurbs

Description

@edurbs

Summary

The current jmix-testing skill covers Unit, Integration, and @UiTest testing well, but has several gaps that would make it more complete and actionable for AI agents.

Proposed Changes

1. Add Test Type Comparison Table

Add a quick-reference table at the top so agents can immediately pick the right approach:

Unit Integration UI Integration (@UiTest) End-to-End (Masquerade)
Spring context No Yes Yes No (runs against live app)
Browser No No No Yes (Selenide/Selenium)
Speed Fastest Fast Medium Slowest
What it tests Pure logic Service layer + DB Server-side Vaadin component tree Real user-facing UI
Best for Calculators, validators Service methods, data access View logic, navigation, data binding Critical user flows, login, CRUD

2. Add End-to-End UI Tests (Masquerade) Section

Completely missing from the current skill. Should cover:

  • Setup: testImplementation 'io.jmix.masquerade:jmix-masquerade' and jmix.ui.ui-test-mode=true
  • Project structure: ui_autotest/ package for tests, test_support/view/ for wrappers
  • View wrappers: @TestView, extending io.jmix.masquerade.sys.View<T>
  • Component wiring: @TestComponent (preferred, uses j-test-id) vs @FindBy (Selenium, for raw HTML)
  • Writing tests: Selenide.open(), Masquerade.$j(), Selenide assertions
  • Imports: All key packages (io.jmix.masquerade.Masquerade, io.jmix.masquerade.TestView, io.jmix.masquerade.component.*)
  • Selenide configuration: baseUrl, timeout, headless setup in @BeforeAll
  • Fragments: Accessing composites via $j(FragmentWrapper.class)

3. Clarify @TestComponent vs @FindBy

This is the most confusing part for agents. The skill should explain:

  • @TestComponent (io.jmix.masquerade.TestComponent) is Masquerade's annotation — field name matches j-test-id by default. Use path attribute for nested/renamed elements.
  • @FindBy (org.openqa.selenium.support.FindBy) is a Selenium annotation, NOT Masquerade. Use only for elements without j-test-id (e.g., native Vaadin login form).
  • The j-test-id HTML attribute is generated when jmix.ui.ui-test-mode=true.

4. Add Key Packages Table

Class Package Purpose
Masquerade io.jmix.masquerade Entry point — $j() methods
@TestView io.jmix.masquerade View wrapper annotation
@TestComponent io.jmix.masquerade Component field wiring by j-test-id
View<T> io.jmix.masquerade.sys Base class for view wrappers
Button, TextField, etc. io.jmix.masquerade.component Component wrappers
@FindBy org.openqa.selenium.support Selenium locator (not Masquerade)

5. Minor Fixes

  • Add @ExtendWith(AuthenticatedAsAdmin.class) to the integration test examples (currently missing — agents copy these examples and miss the auth annotation)
  • Expand "When to Use" to include Masquerade triggers
  • Add doc reference links: https://docs.jmix.io/jmix/testing/ui-integration-tests.html and https://docs.jmix.io/jmix/testing/masquerade.html
  • Clarify @UiTest behavior: explain it starts Vaadin + configures views + sets up auth (currently just shows code)
  • Add jmix.ui.ui-test-mode=true to checklist when using Masquerade

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions