diff --git a/README.md b/README.md index bf54ded..77b567a 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,8 @@ An example on how to do this: `((RemoteWebDriver) driver).getSessionId().toStrin A full example that you can use is available on our GitHub [Jenkins-Demo](https://github.com/testingbot/Jenkins-Demo) page. +On the build page, each JUnit test that used TestingBot is shown with a preview thumbnail of its session (the first one, if a test records several) and expands in place to the full session media (video screencast, screenshots and logs) — no need to leave Jenkins. The embedded media loads lazily, so collapsed sessions stay lightweight. + ## Embedded TestingBot Build report Whenever the plugin injects credentials — through the freestyle **Build Environment** option or the `testingbot { }` / `testingbotTunnel { }` pipeline steps — it exposes a `TESTINGBOT_BUILD` environment variable and adds a **TestingBot Build** page to the build. diff --git a/src/main/java/testingbot/TestingBotBuildObject.java b/src/main/java/testingbot/TestingBotBuildObject.java index 100c02f..d23ce6c 100644 --- a/src/main/java/testingbot/TestingBotBuildObject.java +++ b/src/main/java/testingbot/TestingBotBuildObject.java @@ -3,6 +3,7 @@ import com.testingbot.models.TestingbotTest; import java.io.Serializable; +import java.util.List; public class TestingBotBuildObject implements Serializable { private static final long serialVersionUID = 1L; @@ -12,6 +13,7 @@ public class TestingBotBuildObject implements Serializable { private final boolean isPassed; private String authHash; private String environmentName; + private String thumbUrl; public TestingBotBuildObject(String sessionId, String className, String testName, boolean isPassed, String authHash, TestingbotTest test) { this.sessionId = sessionId; @@ -19,9 +21,25 @@ public TestingBotBuildObject(String sessionId, String className, String testName this.testName = testName; this.isPassed = isPassed; this.authHash = authHash; - // TestingbotTest is only used here to derive the environment label; it is not stored (it is not - // marshalable under the JEP-200 class filter, and nothing reads it afterwards). - this.environmentName = test == null ? "" : test.getBrowser() + " | " + test.getOs(); + // TestingbotTest is only used here to derive display fields; it is not stored (it is not + // marshalable under the JEP-200 class filter, and nothing reads it afterwards). Only the derived + // Strings are kept, which marshal cleanly. + if (test == null) { + this.environmentName = ""; + this.thumbUrl = ""; + } else { + this.environmentName = test.getBrowser() + " | " + test.getOs(); + List thumbs = test.getThumbs(); + this.thumbUrl = (test.isAssetsAvailable() && thumbs != null && !thumbs.isEmpty()) ? thumbs.get(0) : ""; + } + } + + /** + * @return a preview thumbnail URL for the session, or an empty string when no assets are available. + */ + public String getThumbUrl() { + // Null-safe for build.xml records persisted before this field existed (deserialized as null). + return thumbUrl == null ? "" : thumbUrl; } /** diff --git a/src/main/resources/testingbot/TestingBotBuildSummary/summary.jelly b/src/main/resources/testingbot/TestingBotBuildSummary/summary.jelly index c0acd47..d250db3 100644 --- a/src/main/resources/testingbot/TestingBotBuildSummary/summary.jelly +++ b/src/main/resources/testingbot/TestingBotBuildSummary/summary.jelly @@ -1,43 +1,40 @@ + - TestingBot results -
- - - - - - - - - - - - - - - - - -
TestNameEnvironmentPassed?
- ${cs.testName} - - ${cs.environmentName} - - - - - - + TestingBot results +
+ +
+ + + + + ${cs.testName} + ${cs.environmentName} + + + + - - - - - - - - -
-
-
\ No newline at end of file + + + + + + + + +
+ View on TestingBot +
+ + +
+
+ + + + diff --git a/src/main/resources/testingbot/TestingBotTestEmbed/index.jelly b/src/main/resources/testingbot/TestingBotTestEmbed/index.jelly index 233bd9c..4ae9ebc 100644 --- a/src/main/resources/testingbot/TestingBotTestEmbed/index.jelly +++ b/src/main/resources/testingbot/TestingBotTestEmbed/index.jelly @@ -1,49 +1,42 @@ - +

TestingBot results

- - - - - - - - - - - - - - - - - -
TestNameEnvironmentPassed?
- ${cs.testName} - - ${cs.environmentName} - - - - - - - - - - - - - - - -
- + +
+ + + + + ${cs.testName} + ${cs.environmentName} + + + + + + + + + + + + + +
+ View on TestingBot +
+ +
+
+
+
-
\ No newline at end of file +