Bug 1287019 - part1: make mozlog's HTML format support wptrunner screenshot. draft
authorJeremy Chen <jeremychen@mozilla.com>
Mon, 18 Jul 2016 13:53:58 +0800
changeset 388835 cd57a2b7e385b24367c88ee56e3a2f0fd0be345c
parent 388749 711963e8daa312ae06409f8ab5c06612cb0b8f7b
child 388836 f09dd0fe01c8d6b356cfcb87134eac58a1057184
push id23246
push userjichen@mozilla.com
push dateMon, 18 Jul 2016 05:54:31 +0000
bugs1287019
milestone50.0a1
Bug 1287019 - part1: 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"):