forked from flutter/plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cloud_functions] add a driver test (flutter#1346)
- Loading branch information
1 parent
6aef375
commit e99d1aa
Showing
7 changed files
with
75 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
packages/cloud_functions/example/test/cloud_functions.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright 2019, the Chromium project authors. Please see the AUTHORS file | ||
// for details. 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:async'; | ||
import 'package:flutter_driver/driver_extension.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:cloud_functions/cloud_functions.dart'; | ||
|
||
void main() { | ||
final Completer<String> completer = Completer<String>(); | ||
enableFlutterDriverExtension(handler: (_) => completer.future); | ||
tearDownAll(() => completer.complete(null)); | ||
|
||
group('$CloudFunctions', () { | ||
test('call', () async { | ||
final dynamic response = await CloudFunctions.instance.call( | ||
functionName: 'repeat', | ||
parameters: <String, dynamic>{ | ||
'message': 'foo', | ||
'count': 1, | ||
}, | ||
); | ||
expect(response['repeat_message'], 'foo'); | ||
expect(response['repeat_count'], 2); | ||
final dynamic response2 = await CloudFunctions.instance.call( | ||
functionName: 'repeat', | ||
parameters: <String, dynamic>{ | ||
'message': 'bar', | ||
'count': 42, | ||
}, | ||
); | ||
expect(response2['repeat_message'], 'bar'); | ||
expect(response2['repeat_count'], 43); | ||
}); | ||
}); | ||
} |
15 changes: 15 additions & 0 deletions
15
packages/cloud_functions/example/test/cloud_functions_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright 2019, the Chromium project authors. Please see the AUTHORS file | ||
// for details. 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_test/flutter_test.dart'; | ||
|
||
import '../lib/main.dart'; | ||
|
||
void main() { | ||
testWidgets('CloudFunctions example widget test', | ||
(WidgetTester tester) async { | ||
await tester.pumpWidget(MyApp()); | ||
expect(find.text('Cloud Functions example app'), findsOneWidget); | ||
}); | ||
} |
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
packages/cloud_functions/example/test_driver/cloud_functions_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright 2019, the Chromium project authors. Please see the AUTHORS file | ||
// for details. 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_driver/flutter_driver.dart'; | ||
|
||
Future<void> main() async { | ||
final FlutterDriver driver = await FlutterDriver.connect(); | ||
await driver.requestData(null, timeout: const Duration(minutes: 1)); | ||
driver.close(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
name: cloud_functions | ||
description: Flutter plugin for Cloud Functions. | ||
version: 0.1.2 | ||
version: 0.1.2+1 | ||
author: Flutter Team <[email protected]> | ||
homepage: https://github.com/flutter/plugins/tree/master/packages/cloud_functions | ||
|
||
|
@@ -18,6 +18,9 @@ dependencies: | |
dev_dependencies: | ||
flutter_test: | ||
sdk: flutter | ||
flutter_driver: | ||
sdk: flutter | ||
test: any | ||
|
||
environment: | ||
sdk: ">=2.0.0-dev.28.0 <3.0.0" | ||
|