Bug 1287019 - make mozlog's HTML format support wptrunner screenshot. draft
authorJeremy Chen <jeremychen@mozilla.com>
Sat, 16 Jul 2016 21:06:21 +0800
changeset 388628 50de98273de828617c8f2d2d9c4ea829cb1c4c54
parent 388620 4c05938a64a7fde3ac2d7f4493aee1c5f2ad8a0a
child 525583 e3ed0efaea4ea61af775e06c702ffce0cbe0bb60
push id23213
push userjichen@mozilla.com
push dateSat, 16 Jul 2016 13:06:48 +0000
bugs1287019
milestone50.0a1
Bug 1287019 - make mozlog's HTML format support wptrunner screenshot. Current mozlog (v3.2) doesn't support screenshot logs exported from wptrunner. Add this support so we could run css test with --log-html to see more detail information, such as screenshots of test/reference pages. DONTBUILD (NPOTB) MozReview-Commit-ID: AUJwYfvNfda
testing/mozbase/mozlog/mozlog/formatters/html/html.py
--- a/testing/mozbase/mozlog/mozlog/formatters/html/html.py
+++ b/testing/mozbase/mozlog/mozlog/formatters/html/html.py
@@ -92,16 +92,26 @@ class HTMLFormatter(base.BaseFormatter):
 
     def test_end(self, data):
         self.make_result_html(data)
 
     def make_result_html(self, data):
         tc_time = (data["time"] - self.start_times.pop(data["test"])) / 1000.
         additional_html = []
         debug = data.get("extra", {})
+        # Add support for log exported from wptrunner. The structure of
+        # reftest_screenshots is listed in wptrunner/executors/base.py.
+        if debug.get('reftest_screenshots'):
+            log_data = debug.get("reftest_screenshots", {})
+            debug = {
+                'image1':'data:image/png;base64,' + log_data[0].get("screenshot", {}),
+                'image2':'data:image/png;base64,' + log_data[2].get("screenshot", {}),
+                'differences': "Not Implemented",
+            }
+
         links_html = []
 
         status = status_name = data["status"]
         expected = data.get("expected", status)
 
         if status != expected:
             status_name = "UNEXPECTED_" + status
         elif status not in ("PASS", "SKIP"):