Marco Papula
Committed by David PHAM-VAN

Add integration tests for wrapWidget

@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 ## 3.3.0 3 ## 3.3.0
4 4
5 - Add wrapWidget helper 5 - Add wrapWidget helper
  6 +- Add integration tests for wrapWidget
6 7
7 ## 3.2.1 8 ## 3.2.1
8 9
@@ -252,6 +252,7 @@ class MyAppState extends State<MyApp> { @@ -252,6 +252,7 @@ class MyAppState extends State<MyApp> {
252 onPressed: printingInfo?.canShare ?? false ? _sharePdf : null, 252 onPressed: printingInfo?.canShare ?? false ? _sharePdf : null,
253 ), 253 ),
254 RaisedButton( 254 RaisedButton(
  255 + key: const Key('screenshot'),
255 child: const Text('Print Screenshot'), 256 child: const Text('Print Screenshot'),
256 onPressed: (printingInfo?.canPrint ?? false) && !kIsWeb 257 onPressed: (printingInfo?.canPrint ?? false) && !kIsWeb
257 ? _printScreen 258 ? _printScreen
@@ -17,6 +17,9 @@ dependencies: @@ -17,6 +17,9 @@ dependencies:
17 dev_dependencies: 17 dev_dependencies:
18 flutter_test: 18 flutter_test:
19 sdk: flutter 19 sdk: flutter
  20 + flutter_driver:
  21 + sdk: flutter
  22 + test:
20 23
21 dependency_overrides: 24 dependency_overrides:
22 printing: 25 printing:
  1 +/*
  2 + * Copyright (C) 2017, David PHAM-VAN <dev.nfet.net@gmail.com>
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
  16 +
  17 +import 'package:flutter_driver/driver_extension.dart';
  18 +import 'package:printing_example/main.dart' as app;
  19 +
  20 +void main() {
  21 + // Enables flutter_driver extension
  22 + enableFlutterDriverExtension();
  23 +
  24 + // Call the `main()` function of the app
  25 + app.main();
  26 +}
  1 +/*
  2 + * Copyright (C) 2017, David PHAM-VAN <dev.nfet.net@gmail.com>
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
  16 +
  17 +import 'package:flutter_driver/flutter_driver.dart';
  18 +import 'package:test/test.dart';
  19 +
  20 +void main() {
  21 + group('wrapWidget integration tests', () {
  22 + FlutterDriver driver;
  23 +
  24 + final SerializableFinder screenshotFinder = find.byValueKey('screenshot');
  25 +
  26 + setUpAll(() async {
  27 + driver = await FlutterDriver.connect();
  28 + });
  29 +
  30 + tearDownAll(() {
  31 + if (driver != null) {
  32 + driver.close();
  33 + }
  34 + });
  35 +
  36 + test('renders Widget as Image', () async {
  37 + await driver.tap(screenshotFinder);
  38 + });
  39 + });
  40 +}