Class VisualVerificationTest
java.lang.Object
org.vaadin.addons.dramafinder.agent.VisualVerificationTest
- All Implemented Interfaces:
AgentReportProvider
@ExtendWith(AgentReporting.class)
public abstract class VisualVerificationTest
extends Object
implements AgentReportProvider
Base class for temporary, agent-driven visual verification tests that run
against an already running application.
Unlike the Spring-based integration test base, this class does not boot the
application — keeping the app out of the test run is what makes iterations
cheap. It launches a Playwright browser, opens a fresh Page per test
at a 1920×1080 viewport, and wires in AgentReporting so a failure
automatically produces a screenshot, semantic snapshot, and stack trace.
Typical use (a throwaway AgentVerifyIT):
class AgentVerifyIT extends VisualVerificationTest {
@Test
void verifyOrders() {
open("orders");
shot("01-order-list");
GridElement.get(page).assertRowCount(12);
}
}
The base URL defaults to http://localhost:8080 and can be overridden
with the dramafinder.agent.baseUrl system property or the
DRAMAFINDER_BASE_URL environment variable. Headless mode follows the
same headless / HEADLESS convention as the rest of the
library.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.microsoft.playwright.PageThe active page for the current test.protected AgentReportThe report writer for the current test. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.microsoft.playwright.PageThe page the extension should screenshot and inspect on failure.The report the extension should write the failure bundle into.protected StringbaseUrl()The base URL the test connects to.protected voidNavigate to a path relative to the configured base URL and wait for Vaadin to finish loading.protected voidCapture a numbered screenshot into the report directory.
-
Field Details
-
page
protected com.microsoft.playwright.Page pageThe active page for the current test. -
report
The report writer for the current test.
-
-
Constructor Details
-
VisualVerificationTest
public VisualVerificationTest()
-
-
Method Details
-
open
Navigate to a path relative to the configured base URL and wait for Vaadin to finish loading.- Parameters:
path- the route path (with or without a leading slash)
-
shot
Capture a numbered screenshot into the report directory.- Parameters:
name- a short descriptive name for the interaction point
-
baseUrl
The base URL the test connects to.- Returns:
- the configured base URL (default
http://localhost:8080)
-
agentPage
public com.microsoft.playwright.Page agentPage()Description copied from interface:AgentReportProviderThe page the extension should screenshot and inspect on failure.- Specified by:
agentPagein interfaceAgentReportProvider- Returns:
- the active Playwright page, or
nullif none is available
-
agentReport
Description copied from interface:AgentReportProviderThe report the extension should write the failure bundle into.- Specified by:
agentReportin interfaceAgentReportProvider- Returns:
- the report instance, or
nullto let the extension create one fromAgentReportProvider.agentPage()
-