Adds dart_fix
support to integration_test
(#129579)
* Adds fix for `IntegrationTestWidgetsFlutterBinding.runTest(timeout)` to support first round of deprecations for `flutter_test` Resolves #124346
This commit is contained in:
parent
b359e9072f
commit
321abcbe4f
@ -971,6 +971,7 @@ Future<void> _runFrameworkTests() async {
|
|||||||
await runTracingTests();
|
await runTracingTests();
|
||||||
await runFixTests('flutter');
|
await runFixTests('flutter');
|
||||||
await runFixTests('flutter_test');
|
await runFixTests('flutter_test');
|
||||||
|
await runFixTests('integration_test');
|
||||||
await runPrivateTests();
|
await runPrivateTests();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -783,8 +783,6 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
|
|||||||
'This parameter has no effect. Use the `timeout` parameter on `testWidgets` instead. '
|
'This parameter has no effect. Use the `timeout` parameter on `testWidgets` instead. '
|
||||||
'This feature was deprecated after v2.6.0-1.0.pre.'
|
'This feature was deprecated after v2.6.0-1.0.pre.'
|
||||||
)
|
)
|
||||||
// TODO(pdblasi-google): Do not remove until https://github.com/flutter/flutter/issues/124346
|
|
||||||
// is complete, as this removal will cascade into `integration_test`
|
|
||||||
Duration? timeout,
|
Duration? timeout,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1458,8 +1456,6 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
|
|||||||
'This parameter has no effect. Use the `timeout` parameter on `testWidgets` instead. '
|
'This parameter has no effect. Use the `timeout` parameter on `testWidgets` instead. '
|
||||||
'This feature was deprecated after v2.6.0-1.0.pre.'
|
'This feature was deprecated after v2.6.0-1.0.pre.'
|
||||||
)
|
)
|
||||||
// TODO(pdblasi-google): Do not remove until https://github.com/flutter/flutter/issues/124346
|
|
||||||
// is complete, as this removal will cascade into `integration_test`
|
|
||||||
Duration? timeout,
|
Duration? timeout,
|
||||||
}) {
|
}) {
|
||||||
assert(!inTest);
|
assert(!inTest);
|
||||||
@ -2006,8 +2002,6 @@ class LiveTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
|
|||||||
'This parameter has no effect. Use the `timeout` parameter on `testWidgets` instead. '
|
'This parameter has no effect. Use the `timeout` parameter on `testWidgets` instead. '
|
||||||
'This feature was deprecated after v2.6.0-1.0.pre.'
|
'This feature was deprecated after v2.6.0-1.0.pre.'
|
||||||
)
|
)
|
||||||
// TODO(pdblasi-google): Do not remove until https://github.com/flutter/flutter/issues/124346
|
|
||||||
// is complete, as this removal will cascade into `integration_test`
|
|
||||||
Duration? timeout,
|
Duration? timeout,
|
||||||
}) {
|
}) {
|
||||||
assert(!inTest);
|
assert(!inTest);
|
||||||
|
5
packages/integration_test/analysis_options.yaml
Normal file
5
packages/integration_test/analysis_options.yaml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
include: ../analysis_options.yaml
|
||||||
|
|
||||||
|
analyzer:
|
||||||
|
exclude:
|
||||||
|
- "test_fixes/**"
|
45
packages/integration_test/lib/fix_data/README.md
Normal file
45
packages/integration_test/lib/fix_data/README.md
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
## Directory contents
|
||||||
|
|
||||||
|
The `.yaml` files in these directories are used to
|
||||||
|
define the [`dart fix` framework](https://dart.dev/tools/dart-fix) refactorings
|
||||||
|
used by `integration_test`.
|
||||||
|
|
||||||
|
The number of fix rules defined in a file should not exceed 50 for better
|
||||||
|
maintainability. Searching for `title:` in a given `.yaml` file will account
|
||||||
|
for the number of fixes. Splitting out fix rules should be done by class.
|
||||||
|
|
||||||
|
When adding a new `.yaml` file, make a copy of `template.yaml`. Each file should
|
||||||
|
be for a single class and named `fix_<class>.yaml`. To make sure each file is
|
||||||
|
grouped with related classes, a `fix_<filename>` folder will contain all of the
|
||||||
|
fix files for the individual classes.
|
||||||
|
|
||||||
|
See the flutter/packages/integration_test/test_fixes directory for the tests
|
||||||
|
that validate these fix rules.
|
||||||
|
|
||||||
|
To run these tests locally, execute this command in the
|
||||||
|
flutter/packages/integration_test/test_fixes directory.
|
||||||
|
```sh
|
||||||
|
dart fix --compare-to-golden
|
||||||
|
```
|
||||||
|
|
||||||
|
For more documentation about Data Driven Fixes, see
|
||||||
|
https://dart.dev/go/data-driven-fixes#test-folder.
|
||||||
|
|
||||||
|
To learn more about how fixes are authored in package:integration_test, see
|
||||||
|
https://github.com/flutter/flutter/wiki/Data-driven-Fixes
|
||||||
|
|
||||||
|
## When making structural changes to this directory
|
||||||
|
|
||||||
|
The tests in this directory are also invoked from external
|
||||||
|
repositories. Specifically, the CI system for the dart-lang/sdk repo
|
||||||
|
runs these tests in order to ensure that changes to the dart fix file
|
||||||
|
format do not break Flutter.
|
||||||
|
|
||||||
|
See [tools/bots/flutter/analyze_flutter_flutter.sh](https://github.com/dart-lang/sdk/blob/main/tools/bots/flutter/analyze_flutter_flutter.sh)
|
||||||
|
for where the flutter fix tests are invoked for the dart repo.
|
||||||
|
|
||||||
|
See [dev/bots/test.dart](https://github.com/flutter/flutter/blob/master/dev/bots/test.dart)
|
||||||
|
for where the flutter fix tests are invoked for the flutter/flutter repo.
|
||||||
|
|
||||||
|
When possible, please coordinate changes to this directory that might affect the
|
||||||
|
`analyze_flutter_flutter.sh` script.
|
@ -0,0 +1,33 @@
|
|||||||
|
# Copyright 2014 The Flutter Authors. All rights reserved.
|
||||||
|
# Use of this source code is governed by a BSD-style license that can be
|
||||||
|
# found in the LICENSE file.
|
||||||
|
|
||||||
|
# For details regarding the *Flutter Fix* feature, see
|
||||||
|
# https://flutter.dev/docs/development/tools/flutter-fix
|
||||||
|
|
||||||
|
# Please add new fixes to the top of the file, separated by one blank line
|
||||||
|
# from other fixes. In a comment, include a link to the PR where the change
|
||||||
|
# requiring the fix was made.
|
||||||
|
|
||||||
|
# Every fix must be tested. See the
|
||||||
|
# flutter/packages/integration_test/test_fixes/README.md file for instructions
|
||||||
|
# on testing these data driven fixes.
|
||||||
|
|
||||||
|
# For documentation about this file format, see
|
||||||
|
# https://dart.dev/go/data-driven-fixes.
|
||||||
|
|
||||||
|
# * Fixes in this file are for IntegrationTestWidgetsFlutterBinding from the
|
||||||
|
# integration_test/integration_test.dart file. *
|
||||||
|
|
||||||
|
version: 1
|
||||||
|
transforms:
|
||||||
|
# Changes made in https://github.com/flutter/flutter/pull/89952
|
||||||
|
- title: "Remove timeout"
|
||||||
|
date: 2023-06-26
|
||||||
|
element:
|
||||||
|
uris: [ 'integration_test.dart' ]
|
||||||
|
method: 'runTest'
|
||||||
|
inClass: 'IntegrationTestWidgetsFlutterBinding'
|
||||||
|
changes:
|
||||||
|
- kind: 'removeParameter'
|
||||||
|
name: 'timeout'
|
25
packages/integration_test/lib/fix_data/template.yaml
Normal file
25
packages/integration_test/lib/fix_data/template.yaml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# Copyright 2014 The Flutter Authors. All rights reserved.
|
||||||
|
# Use of this source code is governed by a BSD-style license that can be
|
||||||
|
# found in the LICENSE file.
|
||||||
|
|
||||||
|
# For details regarding the *Flutter Fix* feature, see
|
||||||
|
# https://flutter.dev/docs/development/tools/flutter-fix
|
||||||
|
|
||||||
|
# Please add new fixes to the top of the file, separated by one blank line
|
||||||
|
# from other fixes. In a comment, include a link to the PR where the change
|
||||||
|
# requiring the fix was made.
|
||||||
|
|
||||||
|
# Every fix must be tested. See the
|
||||||
|
# flutter/packages/integration_test/lib/fix_data/README.md file for instructions
|
||||||
|
# on testing these data driven fixes.
|
||||||
|
|
||||||
|
# For documentation about this file format, see
|
||||||
|
# https://dart.dev/go/data-driven-fixes.
|
||||||
|
|
||||||
|
# * Fixes in this file are [for CLASS] from the <XXX> file. *
|
||||||
|
|
||||||
|
# Uncomment version & transforms, and follow with fixes.
|
||||||
|
# version: 1
|
||||||
|
# transforms:
|
||||||
|
|
||||||
|
# Before adding a new fix: read instructions at the top of this file.
|
0
packages/integration_test/test_fixes/.dartignore
Normal file
0
packages/integration_test/test_fixes/.dartignore
Normal file
@ -0,0 +1 @@
|
|||||||
|
# This ensures that parent analysis options do not accidentally break the fix tests.
|
@ -0,0 +1,15 @@
|
|||||||
|
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
import 'package:integration_test/integration_test.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
final binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
||||||
|
binding.runTest(
|
||||||
|
() async { },
|
||||||
|
() { },
|
||||||
|
// Changes made in https://github.com/flutter/flutter/pull/89952
|
||||||
|
timeout: Duration(minutes: 30),
|
||||||
|
);
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
import 'package:integration_test/integration_test.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
final binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
||||||
|
binding.runTest(
|
||||||
|
() async { },
|
||||||
|
() { },
|
||||||
|
);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user