Skip to content

Commit 7f0de4d

Browse files
nturgutchaselatta
authored andcommitted
Upgrades to felt (running on multiple modes, multiple backends, single test target option) (flutter#22260)
* testing running the tests on all build modes * don't run debug mode on other browsers * fix platform message test failures * some cleanup. change dispose platform channel message * adding flags to control the integration tests better with felt * running tests by target name, selecting web rendering backend * fix conditions * carrying some conditions to helper methods. Adding comments * create a blocked list for failing canvaskit test * parse parameters before all integration tests * Give better warning to developers for tests that are blocked for CI * address some reviwer comments (more remains) * remove named parameters * also run with auto mode * add verbose option * reduce the number of tests running. skip url_test for now
1 parent 386b364 commit 7f0de4d

File tree

8 files changed

+315
-64
lines changed

8 files changed

+315
-64
lines changed

e2etests/web/regular_integration_tests/lib/profile_diagnostics_main.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// found in the LICENSE file.
44

55
import 'package:flutter/material.dart';
6-
import 'package:flutter/services.dart';
76

87
void main() {
98
runApp(MyApp());

e2etests/web/regular_integration_tests/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: regular_integration_tests
22
publish_to: none
33

44
environment:
5-
sdk: ">=2.2.2 <3.0.0"
5+
sdk: ">=2.11.0-0 <3.0.0"
66

77
dependencies:
88
flutter:

e2etests/web/regular_integration_tests/test_driver/platform_messages_integration.dart

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ void main() async {
2828
await tester.tap(find.byKey(const Key('input')));
2929
// Focus in input, otherwise clipboard will fail with
3030
// 'document is not focused' platform exception.
31-
html.document.querySelector('input').focus();
31+
html.document.querySelector('input')?.focus();
3232
await Clipboard.setData(const ClipboardData(text: 'sample text'));
3333
}, skip: true); // https://github.com/flutter/flutter/issues/54296
3434

3535
testWidgets('Should create and dispose view embedder',
3636
(WidgetTester tester) async {
3737
int viewInstanceCount = 0;
3838

39-
final int currentViewId = platformViewsRegistry.getNextPlatformViewId();
39+
platformViewsRegistry.getNextPlatformViewId();
4040
// ignore: undefined_prefixed_name
4141
ui.platformViewRegistry.registerViewFactory('MyView', (int viewId) {
4242
++viewInstanceCount;
@@ -46,14 +46,11 @@ void main() async {
4646
app.main();
4747
await tester.pumpAndSettle();
4848
final Map<String, dynamic> createArgs = <String, dynamic>{
49-
'id': '567',
49+
'id': 567,
5050
'viewType': 'MyView',
5151
};
5252
await SystemChannels.platform_views.invokeMethod<void>('create', createArgs);
53-
final Map<String, dynamic> disposeArgs = <String, dynamic>{
54-
'id': '567',
55-
};
56-
await SystemChannels.platform_views.invokeMethod<void>('dispose', disposeArgs);
53+
await SystemChannels.platform_views.invokeMethod<void>('dispose', 567);
5754
expect(viewInstanceCount, 1);
5855
});
5956
}

e2etests/web/regular_integration_tests/test_driver/text_editing_integration.dart

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ import 'package:flutter/material.dart';
1313
import 'package:integration_test/integration_test.dart';
1414

1515
void main() {
16-
final IntegrationTestWidgetsFlutterBinding binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized() as IntegrationTestWidgetsFlutterBinding;
16+
final IntegrationTestWidgetsFlutterBinding binding =
17+
IntegrationTestWidgetsFlutterBinding.ensureInitialized()
18+
as IntegrationTestWidgetsFlutterBinding;
1719

1820
testWidgets('Focused text field creates a native input element',
1921
(WidgetTester tester) async {
@@ -38,7 +40,7 @@ void main() {
3840

3941
// Change the value of the TextFormField.
4042
final TextFormField textFormField = tester.widget(finder);
41-
textFormField.controller.text = 'New Value';
43+
textFormField.controller?.text = 'New Value';
4244
// DOM element's value also changes.
4345
expect(input.value, 'New Value');
4446

@@ -68,7 +70,7 @@ void main() {
6870

6971
// Change the value of the TextFormField.
7072
final TextFormField textFormField = tester.widget(finder);
71-
textFormField.controller.text = 'New Value';
73+
textFormField.controller?.text = 'New Value';
7274
// DOM element's value also changes.
7375
expect(input.value, 'New Value');
7476
});
@@ -145,9 +147,9 @@ void main() {
145147
expect(input2.value, 'Text2');
146148
});
147149

148-
testWidgets('Jump between TextFormFields with tab key after CapsLock is'
149-
'activated',
150-
(WidgetTester tester) async {
150+
testWidgets(
151+
'Jump between TextFormFields with tab key after CapsLock is'
152+
'activated', (WidgetTester tester) async {
151153
app.main();
152154
await tester.pumpAndSettle();
153155

@@ -163,7 +165,7 @@ void main() {
163165
final List<Node> nodeList = document.getElementsByTagName('input');
164166
expect(nodeList.length, equals(1));
165167
final InputElement input =
166-
document.getElementsByTagName('input')[0] as InputElement;
168+
document.getElementsByTagName('input')[0] as InputElement;
167169

168170
// Press and release CapsLock.
169171
dispatchKeyboardEvent(input, 'keydown', <String, dynamic>{
@@ -207,7 +209,7 @@ void main() {
207209
// A native input element for the next TextField should be attached to the
208210
// DOM.
209211
final InputElement input2 =
210-
document.getElementsByTagName('input')[0] as InputElement;
212+
document.getElementsByTagName('input')[0] as InputElement;
211213
expect(input2.value, 'Text2');
212214
});
213215

@@ -243,8 +245,8 @@ void main() {
243245
expect(input.hasAttribute('readonly'), isTrue);
244246

245247
// Make sure the entire text is selected.
246-
TextRange range =
247-
TextRange(start: input.selectionStart, end: input.selectionEnd);
248+
TextRange range = TextRange(
249+
start: input.selectionStart ?? 0, end: input.selectionEnd ?? 0);
248250
expect(range.textInside(text), text);
249251

250252
// Double tap to select the first word.
@@ -257,7 +259,8 @@ void main() {
257259
await gesture.up();
258260
await gesture.down(firstWordOffset);
259261
await gesture.up();
260-
range = TextRange(start: input.selectionStart, end: input.selectionEnd);
262+
range = TextRange(
263+
start: input.selectionStart ?? 0, end: input.selectionEnd ?? 0);
261264
expect(range.textInside(text), 'Lorem');
262265

263266
// Double tap to select the last word.
@@ -270,7 +273,8 @@ void main() {
270273
await gesture.up();
271274
await gesture.down(lastWordOffset);
272275
await gesture.up();
273-
range = TextRange(start: input.selectionStart, end: input.selectionEnd);
276+
range = TextRange(
277+
start: input.selectionStart ?? 0, end: input.selectionEnd ?? 0);
274278
expect(range.textInside(text), 'amet');
275279
});
276280
}

0 commit comments

Comments
 (0)