Status

()

defect
RESOLVED FIXED
7 years ago
7 years ago

People

(Reporter: gbrown, Assigned: gbrown)

Tracking

unspecified
Firefox 22
x86
Android
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(4 attachments)

In some of our intermittent robocop failures, a screenshot from the time of failure would be a great aid to debugging.
Taking the screenshot on assertion failure or exception is easy. Unfortunately, this doesn't work for content (the jpg is all black where content would be), but at least it gives us something. (Will attach examples...)
Assignee: nobody → gbrown
Attachment #729160 - Flags: review?(jmaher)
This pulls the jpg off the device, base64 encodes it and dumps the result. You can see this in action here:

https://tbpl.mozilla.org/?tree=Try&rev=6fd6e65589df

(search the logs for "SCREENSHOT"). It's fairly straight-forward, but a little awkward, to copy the screenshot data, decode it and display the resulting jpg.

As an alternative, we could copy the jpg somewhere and have a link to the jpg in the log...I just don't know where to store it.
Attachment #729161 - Flags: review?(jmaher)
Attachment #729160 - Flags: review?(jmaher) → review+
Comment on attachment 729161 [details] [diff] [review]
base64 encode screenshot jpg and dump to log output; cleanup screenshot files

Review of attachment 729161 [details] [diff] [review]:
-----------------------------------------------------------------

::: testing/mochitest/runtestsremote.py
@@ +435,5 @@
> +    def printScreenshot(self):
> +        try:
> +            image = self._dm.pullFile("/mnt/sdcard/Robotium-Screenshots/robocop-screenshot.jpg")
> +            encoded = base64.b64encode(image)
> +            print "SCREENSHOT: data:image/jpg;base64,%s" % encoded

This is assuming there is a screenshot.  I know there is a try/except around it.   Is that what you are using if image is '' ?
Attachment #729161 - Flags: review?(jmaher) → review+
(In reply to Joel Maher (:jmaher) from comment #5) 
> This is assuming there is a screenshot.  I know there is a try/except around
> it.   Is that what you are using if image is '' ?

Right. If a test passes, no screenshot is generated and pullFile() throws; we catch that and continue silently. The obvious alternative is to call fileExists(), but that ends up generating more sut traffic (check that the directory exists, then pulls down a directory listing).

I will add a comment before landing to explain this.
https://hg.mozilla.org/mozilla-central/rev/11fba5efef16
https://hg.mozilla.org/mozilla-central/rev/1567285fca98
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 22
You need to log in before you can comment on or make changes to this bug.