Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
c1710723
Unverified
Commit
c1710723
authored
3 years ago
by
Jenn Magder
Committed by
GitHub
3 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Take drive screenshot on test failure before app is stopped (#96973)
parent
6b95add2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
drive.dart
packages/flutter_tools/lib/src/commands/drive.dart
+9
-2
drive_test.dart
...lutter_tools/test/commands.shard/hermetic/drive_test.dart
+3
-1
No files found.
packages/flutter_tools/lib/src/commands/drive.dart
View file @
c1710723
...
@@ -237,6 +237,7 @@ class DriveCommand extends RunCommandBase {
...
@@ -237,6 +237,7 @@ class DriveCommand extends RunCommandBase {
?
null
?
null
:
_fileSystem
.
file
(
stringArg
(
'use-application-binary'
));
:
_fileSystem
.
file
(
stringArg
(
'use-application-binary'
));
bool
screenshotTaken
=
false
;
try
{
try
{
if
(
stringArg
(
'use-existing-app'
)
==
null
)
{
if
(
stringArg
(
'use-existing-app'
)
==
null
)
{
await
driverService
.
start
(
await
driverService
.
start
(
...
@@ -285,6 +286,11 @@ class DriveCommand extends RunCommandBase {
...
@@ -285,6 +286,11 @@ class DriveCommand extends RunCommandBase {
androidEmulator:
boolArg
(
'android-emulator'
),
androidEmulator:
boolArg
(
'android-emulator'
),
profileMemory:
stringArg
(
'profile-memory'
),
profileMemory:
stringArg
(
'profile-memory'
),
);
);
if
(
testResult
!=
0
&&
screenshot
!=
null
)
{
// Take a screenshot while the app is still running.
await
_takeScreenshot
(
device
);
screenshotTaken
=
true
;
}
if
(
boolArg
(
'keep-app-running'
)
??
(
argResults
[
'use-existing-app'
]
!=
null
))
{
if
(
boolArg
(
'keep-app-running'
)
??
(
argResults
[
'use-existing-app'
]
!=
null
))
{
_logger
.
printStatus
(
'Leaving the application running.'
);
_logger
.
printStatus
(
'Leaving the application running.'
);
...
@@ -298,8 +304,9 @@ class DriveCommand extends RunCommandBase {
...
@@ -298,8 +304,9 @@ class DriveCommand extends RunCommandBase {
throwToolExit
(
null
);
throwToolExit
(
null
);
}
}
}
on
Exception
catch
(
_
)
{
}
on
Exception
catch
(
_
)
{
// On exceptions, including ToolExit, take a screenshot on the device.
// On exceptions, including ToolExit, take a screenshot on the device
if
(
screenshot
!=
null
)
{
// unless a screenshot was already taken on test failure.
if
(!
screenshotTaken
&&
screenshot
!=
null
)
{
await
_takeScreenshot
(
device
);
await
_takeScreenshot
(
device
);
}
}
rethrow
;
rethrow
;
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/commands.shard/hermetic/drive_test.dart
View file @
c1710723
...
@@ -107,7 +107,9 @@ void main() {
...
@@ -107,7 +107,9 @@ void main() {
throwsToolExit
(),
throwsToolExit
(),
);
);
expect
(
logger
.
statusText
,
contains
(
'Screenshot written to drive_screenshots/drive_01.png'
));
// Takes the screenshot before the application would be killed (if --keep-app-running not passed).
expect
(
logger
.
statusText
,
contains
(
'Screenshot written to drive_screenshots/drive_01.png
\n
'
'Leaving the application running.'
));
expect
(
logger
.
statusText
,
isNot
(
contains
(
'drive_02.png'
)));
expect
(
logger
.
statusText
,
isNot
(
contains
(
'drive_02.png'
)));
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
FileSystem:
()
=>
fileSystem
,
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment