Take screenshot when drive fails to start app or test#96828
Take screenshot when drive fails to start app or test#96828fluttergithubbot merged 2 commits intoflutter:masterfrom
Conversation
0c7c5d0 to
c77271d
Compare
There was a problem hiding this comment.
Most of this patch is whitespace changes.
There was a problem hiding this comment.
This catch is the new part.
There was a problem hiding this comment.
Create a DriveCommand to test instead of calling directly from tests.
c77271d to
e21477a
Compare
| ); | ||
| if (testResult != 0 && screenshot != null) { | ||
| await takeScreenshot(device, screenshot, _fileSystem, _logger, _fsUtils); | ||
| if (boolArg('keep-app-running') ?? (argResults['use-existing-app'] != null)) { |
There was a problem hiding this comment.
If the code here between 292 and 302 throws, you could get two screenshots, one from the call on 289 and another from the one in the catch. Is that intentional?
There was a problem hiding this comment.
You're right. Worse, if testResult fails which would happen often enough, it will take two screenshots, one from line 289, then another on catching the toolExit. Let me fix that up.
There was a problem hiding this comment.
Fixed. Also added a test.
There was a problem hiding this comment.
Oh right, the screenshot should be taken after the drive test failure but before the app is stopped. Created #96973 to reinstate this behavior.
Help debugging issues like #96401 by taking a screenshot of the device during
drivewhen the app fails to start, or testing otherwise fails.drive --screenshotintroduced in #78822.Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.