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
e868a833
Unverified
Commit
e868a833
authored
Apr 02, 2021
by
Jia Hao
Committed by
GitHub
Apr 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove the warning about the Integration Test plugin (#79520)
parent
42c5f71c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
17 deletions
+66
-17
trivial_widget_expectation.txt
...ted_tests/integration_test/trivial_widget_expectation.txt
+0
-1
test.dart
packages/flutter_tools/lib/src/commands/test.dart
+4
-0
test_test.dart
...flutter_tools/test/commands.shard/hermetic/test_test.dart
+26
-0
integration_test.dart
packages/integration_test/lib/integration_test.dart
+36
-16
No files found.
dev/automated_tests/integration_test/trivial_widget_expectation.txt
View file @
e868a833
<<skip until matching line>>
[0-9]+:[0-9]+ [+]1: All tests passed!
[0-9]+:[0-9]+ [+]1: All tests passed!
packages/flutter_tools/lib/src/commands/test.dart
View file @
e868a833
...
@@ -401,6 +401,10 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
...
@@ -401,6 +401,10 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
if
(
_isIntegrationTest
)
{
if
(
_isIntegrationTest
)
{
integrationTestDevice
=
await
findTargetDevice
();
integrationTestDevice
=
await
findTargetDevice
();
// Disable reporting of test results to native test frameworks. This isn't
// needed as the Flutter Tool will be responsible for reporting results.
buildInfo
.
dartDefines
.
add
(
'INTEGRATION_TEST_SHOULD_REPORT_RESULTS_TO_NATIVE=false'
);
if
(
integrationTestDevice
==
null
)
{
if
(
integrationTestDevice
==
null
)
{
throwToolExit
(
throwToolExit
(
'No devices are connected. '
'No devices are connected. '
...
...
packages/flutter_tools/test/commands.shard/hermetic/test_test.dart
View file @
e868a833
...
@@ -582,6 +582,30 @@ dev_dependencies:
...
@@ -582,6 +582,30 @@ dev_dependencies:
FakeDevice
(
'ephemeral'
,
'ephemeral'
,
ephemeral:
true
,
isSupported:
true
,
type:
PlatformType
.
web
),
FakeDevice
(
'ephemeral'
,
'ephemeral'
,
ephemeral:
true
,
isSupported:
true
,
type:
PlatformType
.
web
),
]),
]),
});
});
testUsingContext
(
'Integration tests set the correct dart-defines'
,
()
async
{
final
FakeFlutterTestRunner
testRunner
=
FakeFlutterTestRunner
(
0
);
final
TestCommand
testCommand
=
TestCommand
(
testRunner:
testRunner
);
final
CommandRunner
<
void
>
commandRunner
=
createTestCommandRunner
(
testCommand
);
await
commandRunner
.
run
(
const
<
String
>[
'test'
,
'--no-pub'
,
'integration_test'
,
]);
expect
(
testRunner
.
lastDebuggingOptionsValue
.
buildInfo
.
dartDefines
,
contains
(
'INTEGRATION_TEST_SHOULD_REPORT_RESULTS_TO_NATIVE=false'
),
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fs
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
DeviceManager:
()
=>
_FakeDeviceManager
(<
Device
>[
FakeDevice
(
'ephemeral'
,
'ephemeral'
,
ephemeral:
true
,
isSupported:
true
,
type:
PlatformType
.
android
),
]),
});
}
}
class
FakeFlutterTestRunner
implements
FlutterTestRunner
{
class
FakeFlutterTestRunner
implements
FlutterTestRunner
{
...
@@ -589,6 +613,7 @@ class FakeFlutterTestRunner implements FlutterTestRunner {
...
@@ -589,6 +613,7 @@ class FakeFlutterTestRunner implements FlutterTestRunner {
int
exitCode
;
int
exitCode
;
bool
lastEnableObservatoryValue
;
bool
lastEnableObservatoryValue
;
DebuggingOptions
lastDebuggingOptionsValue
;
@override
@override
Future
<
int
>
runTests
(
Future
<
int
>
runTests
(
...
@@ -626,6 +651,7 @@ class FakeFlutterTestRunner implements FlutterTestRunner {
...
@@ -626,6 +651,7 @@ class FakeFlutterTestRunner implements FlutterTestRunner {
String
integrationTestUserIdentifier
,
String
integrationTestUserIdentifier
,
})
async
{
})
async
{
lastEnableObservatoryValue
=
enableObservatory
;
lastEnableObservatoryValue
=
enableObservatory
;
lastDebuggingOptionsValue
=
debuggingOptions
;
return
exitCode
;
return
exitCode
;
}
}
}
}
...
...
packages/integration_test/lib/integration_test.dart
View file @
e868a833
...
@@ -20,24 +20,37 @@ import 'common.dart';
...
@@ -20,24 +20,37 @@ import 'common.dart';
const
String
_success
=
'success'
;
const
String
_success
=
'success'
;
/// Whether results should be reported to the native side over the method
/// channel.
///
/// This is enabled by default for use by native test frameworks like Android
/// instrumentation or XCTest. When running with the Flutter Tool through
/// `flutter test integration_test` though, it will be disabled as the Flutter
/// tool will be responsible for collection of test results.
const
bool
_shouldReportResultsToNative
=
bool
.
fromEnvironment
(
'INTEGRATION_TEST_SHOULD_REPORT_RESULTS_TO_NATIVE'
,
defaultValue:
true
,
);
/// A subclass of [LiveTestWidgetsFlutterBinding] that reports tests results
/// A subclass of [LiveTestWidgetsFlutterBinding] that reports tests results
/// on a channel to adapt them to native instrumentation test format.
/// on a channel to adapt them to native instrumentation test format.
class
IntegrationTestWidgetsFlutterBinding
extends
LiveTestWidgetsFlutterBinding
implements
IntegrationTestResults
{
class
IntegrationTestWidgetsFlutterBinding
extends
LiveTestWidgetsFlutterBinding
implements
IntegrationTestResults
{
/// Sets up a listener to report that the tests are finished when everything is
/// Sets up a listener to report that the tests are finished when everything is
/// torn down.
/// torn down.
IntegrationTestWidgetsFlutterBinding
()
{
IntegrationTestWidgetsFlutterBinding
()
{
// TODO(jackson): Report test results as they arrive
tearDownAll
(()
async
{
tearDownAll
(()
async
{
if
(!
_allTestsPassed
.
isCompleted
)
{
_allTestsPassed
.
complete
(
true
);
}
callbackManager
.
cleanup
();
// TODO(jiahaog): Print the message directing users to run with
// `flutter test` when Web is supported.
if
(!
_shouldReportResultsToNative
||
kIsWeb
)
{
return
;
}
try
{
try
{
// For web integration tests we are not using the
// `plugins.flutter.io/integration_test`. Mark the tests as complete
// before invoking the channel.
if
(
kIsWeb
)
{
if
(!
_allTestsPassed
.
isCompleted
)
{
_allTestsPassed
.
complete
(
true
);
}
}
callbackManager
.
cleanup
();
await
_channel
.
invokeMethod
<
void
>(
await
_channel
.
invokeMethod
<
void
>(
'allTestsFinished'
,
'allTestsFinished'
,
<
String
,
dynamic
>{
<
String
,
dynamic
>{
...
@@ -50,15 +63,22 @@ class IntegrationTestWidgetsFlutterBinding extends LiveTestWidgetsFlutterBinding
...
@@ -50,15 +63,22 @@ class IntegrationTestWidgetsFlutterBinding extends LiveTestWidgetsFlutterBinding
},
},
);
);
}
on
MissingPluginException
{
}
on
MissingPluginException
{
print
(
'Warning: integration_test test plugin was not detected.'
);
print
(
r''
'
}
Warning: integration_test plugin was not detected.
if
(!
_allTestsPassed
.
isCompleted
)
{
_allTestsPassed
.
complete
(
true
);
If you'
re
running
the
tests
with
`
flutter
drive
`
,
please
make
sure
your
tests
are
in
the
`
integration_test
/
`
directory
of
your
package
and
use
`
flutter
test
$path_to_test
`
to
run
it
instead
.
If
you
're running the tests with Android instrumentation or XCTest, this means
that you are not capturing test results properly! See the following link for
how to set up the integration_test plugin:
https://flutter.dev/docs/testing/integration-tests#testing-on-firebase-test-lab
'''
);
}
}
});
});
// TODO(jackson): Report the results individually instead of all at once
// See https://github.com/flutter/flutter/issues/38985
final
TestExceptionReporter
oldTestExceptionReporter
=
reportTestException
;
final
TestExceptionReporter
oldTestExceptionReporter
=
reportTestException
;
reportTestException
=
reportTestException
=
(
FlutterErrorDetails
details
,
String
testDescription
)
{
(
FlutterErrorDetails
details
,
String
testDescription
)
{
...
...
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