Skip to content

Conversation

mxschmitt
Copy link
Member

@mxschmitt mxschmitt commented Aug 20, 2025

Fixes #1829

@mxschmitt mxschmitt requested a review from Copilot August 20, 2025 14:51
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR migrates Trace Viewer tests from a JSON-based approach to using the actual Trace Viewer web application for validation. The change improves test coverage by testing the real UI components instead of just parsing trace files.

  • Replaced JSON parsing and verification of trace events with actual Trace Viewer UI interactions
  • Added a new TraceViewerPage helper class to encapsulate Trace Viewer UI operations
  • Enhanced the test server to serve static files from the filesystem to support hosting the Trace Viewer

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
TestTracing.java Migrated all trace verification logic from JSON parsing to Trace Viewer UI testing, added TraceViewerPage helper class
Server.java Added static file serving capability to support hosting Trace Viewer from filesystem

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@@ -187,7 +193,19 @@ public void handle(HttpExchange exchange) throws IOException {
path = "/index.html";
}

// Resources from "src/test/resources/" are copied to "resources/" directory in the jar.
// If static files directory is set, serve from filesystem first
if (staticFilesDirectory != null) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

underneath we do something similar but via getResourceAsStream which got introduced here - do you remember why?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the standard way to read resources in a maven package (they move from the source into the test package artifact). I'd keep using it with the custom base dir too, can we do that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is no way of accessing the trace-viewer html source code via the tests/resource directory so I introduced another resourceLoader concept - are you fine with that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I'd pass the resource provide in server the constructor.

@@ -187,7 +193,19 @@ public void handle(HttpExchange exchange) throws IOException {
path = "/index.html";
}

// Resources from "src/test/resources/" are copied to "resources/" directory in the jar.
// If static files directory is set, serve from filesystem first
if (staticFilesDirectory != null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the standard way to read resources in a maven package (they move from the source into the test package artifact). I'd keep using it with the custom base dir too, can we do that?

Copy link
Member

@yury-s yury-s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but please revert changes in DriverJar.java

@mxschmitt mxschmitt merged commit 2a6cdff into main Aug 26, 2025
19 checks passed
@mxschmitt mxschmitt deleted the trace-viewer branch August 26, 2025 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[internal] Use Real Trace Viewer for tracing tests
3 participants