From f256f6883145a20dd06990f89129b810e87c9828 Mon Sep 17 00:00:00 2001 From: Yegor Date: Wed, 1 May 2024 14:12:01 -0700 Subject: [PATCH] [web] remove platform_messages_integration test (#147654) This functionality is already fully covered by https://github.com/flutter/engine/blob/main/lib/web_ui/test/engine/platform_views/message_handler_test.dart This might help with https://github.com/flutter/flutter/issues/146189 a little. --- dev/bots/suite_runners/run_web_tests.dart | 5 -- .../lib/platform_messages_main.dart | 63 ------------------- .../platform_messages_integration.dart | 54 ---------------- .../platform_messages_integration_test.dart | 7 --- 4 files changed, 129 deletions(-) delete mode 100644 dev/integration_tests/web_e2e_tests/lib/platform_messages_main.dart delete mode 100644 dev/integration_tests/web_e2e_tests/test_driver/platform_messages_integration.dart delete mode 100644 dev/integration_tests/web_e2e_tests/test_driver/platform_messages_integration_test.dart diff --git a/dev/bots/suite_runners/run_web_tests.dart b/dev/bots/suite_runners/run_web_tests.dart index d1ce7001d3d..38d9d1d134f 100644 --- a/dev/bots/suite_runners/run_web_tests.dart +++ b/dev/bots/suite_runners/run_web_tests.dart @@ -142,11 +142,6 @@ class WebTestsSuite { ), ], - // This test doesn't do anything interesting w.r.t. rendering, so we don't run the full build mode x renderer matrix. - () => _runWebE2eTest('platform_messages_integration', buildMode: 'debug', renderer: 'canvaskit'), - () => _runWebE2eTest('platform_messages_integration', buildMode: 'profile', renderer: 'html'), - () => _runWebE2eTest('platform_messages_integration', buildMode: 'release', renderer: 'html'), - // This test doesn't do anything interesting w.r.t. rendering, so we don't run the full build mode x renderer matrix. () => _runWebE2eTest('profile_diagnostics_integration', buildMode: 'debug', renderer: 'html'), () => _runWebE2eTest('profile_diagnostics_integration', buildMode: 'profile', renderer: 'canvaskit'), diff --git a/dev/integration_tests/web_e2e_tests/lib/platform_messages_main.dart b/dev/integration_tests/web_e2e_tests/lib/platform_messages_main.dart deleted file mode 100644 index 8f7dde57afa..00000000000 --- a/dev/integration_tests/web_e2e_tests/lib/platform_messages_main.dart +++ /dev/null @@ -1,63 +0,0 @@ -// 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:flutter/material.dart'; - -void main() => runApp(const MyApp()); - -class MyApp extends StatelessWidget { - const MyApp({super.key}); - - @override - Widget build(BuildContext context) { - return const MaterialApp( - key: Key('mainapp'), - title: 'Integration Test App For Platform Messages', - home: MyHomePage(title: 'Integration Test App For Platform Messages'), - ); - } -} - -class MyHomePage extends StatefulWidget { - const MyHomePage({super.key, required this.title}); - - final String title; - - @override - State createState() => _MyHomePageState(); -} - -class _MyHomePageState extends State { - final TextEditingController _controller = - TextEditingController(text: 'Text1'); - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: Text(widget.title), - ), - body: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Text('Hello World', - ), - // Create a text form field since we can't test clipboard unless - // html document has focus. - TextFormField( - key: const Key('input'), - enabled: true, - controller: _controller, - //initialValue: 'Text1', - decoration: const InputDecoration( - labelText: 'Text Input Field:', - ), - ), - ], - ), - ), - ); - } -} diff --git a/dev/integration_tests/web_e2e_tests/test_driver/platform_messages_integration.dart b/dev/integration_tests/web_e2e_tests/test_driver/platform_messages_integration.dart deleted file mode 100644 index de0afb59fd1..00000000000 --- a/dev/integration_tests/web_e2e_tests/test_driver/platform_messages_integration.dart +++ /dev/null @@ -1,54 +0,0 @@ -// 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 'dart:ui_web' as ui_web; - -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:integration_test/integration_test.dart'; -import 'package:web/web.dart' as web; -import 'package:web_e2e_tests/platform_messages_main.dart' as app; - -void main() { - IntegrationTestWidgetsFlutterBinding.ensureInitialized(); - - testWidgets('platform message for Clipboard.setData reply with future', - (WidgetTester tester) async { - app.main(); - await tester.pumpAndSettle(); - - // TODO(nurhan): https://github.com/flutter/flutter/issues/51885 - tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(SystemChannels.textInput, null); - // Focus on a TextFormField. - final Finder finder = find.byKey(const Key('input')); - expect(finder, findsOneWidget); - await tester.tap(find.byKey(const Key('input'))); - // Focus in input, otherwise clipboard will fail with - // 'document is not focused' platform exception. - (web.document.querySelector('input') as web.HTMLElement?)?.focus(); - await Clipboard.setData(const ClipboardData(text: 'sample text')); - }, skip: true); // https://github.com/flutter/flutter/issues/54296 - - testWidgets('Should create and dispose view embedder', - (WidgetTester tester) async { - int viewInstanceCount = 0; - - platformViewsRegistry.getNextPlatformViewId(); - ui_web.platformViewRegistry.registerViewFactory('MyView', (int viewId) { - viewInstanceCount += 1; - return web.HTMLDivElement(); - }); - - app.main(); - await tester.pumpAndSettle(); - final Map createArgs = { - 'id': 567, - 'viewType': 'MyView', - }; - await SystemChannels.platform_views.invokeMethod('create', createArgs); - await SystemChannels.platform_views.invokeMethod('dispose', 567); - expect(viewInstanceCount, 1); - }); -} diff --git a/dev/integration_tests/web_e2e_tests/test_driver/platform_messages_integration_test.dart b/dev/integration_tests/web_e2e_tests/test_driver/platform_messages_integration_test.dart deleted file mode 100644 index b2d2a1770b2..00000000000 --- a/dev/integration_tests/web_e2e_tests/test_driver/platform_messages_integration_test.dart +++ /dev/null @@ -1,7 +0,0 @@ -// 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_driver.dart' as test; - -Future main() async => test.integrationDriver();