Skip to content

Commit 97c45d9

Browse files
committed
fix(test): integrate each test
Signed-off-by: Hosung Kim [email protected]
1 parent abf4129 commit 97c45d9

35 files changed

+468
-21
lines changed

.github/recipe.yaml

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
11
plugins:
2-
firebase_core: ["tv-7.0"]
3-
firebase_database: ["tv-7.0"]
4-
firebase_storage: ["tv-7.0"]
5-
cloud_functions: ["tv-7.0"]
2+
tests: ["tv-7.0"]

packages/firebase_database/example/test_driver/integration_test.dart

-7
This file was deleted.

packages/tests/example/.gitignore

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Miscellaneous
2+
*.class
3+
*.log
4+
*.pyc
5+
*.swp
6+
.DS_Store
7+
.atom/
8+
.buildlog/
9+
.history
10+
.svn/
11+
migrate_working_dir/
12+
13+
# IntelliJ related
14+
*.iml
15+
*.ipr
16+
*.iws
17+
.idea/
18+
19+
# VS Code related
20+
.vscode/
21+
22+
# Flutter/Dart/Pub related
23+
**/doc/api/
24+
**/ios/Flutter/.last_build_id
25+
.dart_tool/
26+
.flutter-plugins
27+
.flutter-plugins-dependencies
28+
.packages
29+
.pub-cache/
30+
.pub/
31+
/build/
32+
33+
# Symbolication related
34+
app.*.symbols
35+
36+
# Obfuscation related
37+
app.*.map.json
38+

packages/tests/example/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Flutterfire test
2+
3+
All package e2e tests belong in this application.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This file configures the analyzer, which statically analyzes Dart code to
2+
# check for errors, warnings, and lints.
3+
#
4+
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5+
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6+
# invoked from the command line by running `flutter analyze`.
7+
8+
# The following line activates a set of recommended lints for Flutter apps,
9+
# packages, and plugins designed to encourage good coding practices.
10+
include: package:flutter_lints/flutter.yaml
11+
12+
linter:
13+
# The lint rules applied to this project can be customized in the
14+
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
15+
# included above or to enable additional rules. A list of all available lints
16+
# and their documentation is published at https://dart.dev/lints.
17+
#
18+
# Instead of disabling a lint rule for the entire project in the
19+
# section below, it can also be suppressed for a single line of code
20+
# or a specific dart file by using the `// ignore: name_of_lint` and
21+
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
22+
# producing the lint.
23+
rules:
24+
# avoid_print: false # Uncomment to disable the `avoid_print` rule
25+
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
26+
27+
# Additional information about this file can be found at
28+
# https://dart.dev/guides/language/analysis-options

packages/cloud_functions/example/integration_test/cloud_functions/cloud_functions_e2e_test.dart packages/tests/example/integration_test/cloud_functions/cloud_functions_e2e_test.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import 'package:firebase_core/firebase_core.dart';
77
import 'package:flutter/foundation.dart';
88
import 'package:flutter_test/flutter_test.dart';
99
import 'package:integration_test/integration_test.dart';
10-
import 'package:cloud_functions_example/firebase_options.dart';
10+
import 'package:tests/firebase_options.dart';
1111

1212
import 'sample_data.dart' as data;
1313

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import 'package:flutter_test/flutter_test.dart';
6+
import 'package:integration_test/integration_test.dart';
7+
8+
import 'cloud_functions/cloud_functions_e2e_test.dart' as cloud_functions;
9+
import 'firebase_core/firebase_core_e2e_test.dart' as firebase_core;
10+
import 'firebase_database/firebase_database_e2e_test.dart' as firebase_database;
11+
import 'firebase_storage/firebase_storage_e2e_test.dart' as firebase_storage;
12+
13+
void main() {
14+
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
15+
16+
group('FlutterFire', () {
17+
firebase_core.main();
18+
firebase_database.main();
19+
cloud_functions.main();
20+
firebase_storage.main();
21+
});
22+
}

packages/firebase_core/example/integration_test/firebase_core_test.dart packages/tests/example/integration_test/firebase_core/firebase_core_e2e_test.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import 'package:firebase_core_platform_interface/firebase_core_platform_interfac
88
import 'package:flutter/foundation.dart';
99
import 'package:flutter_test/flutter_test.dart';
1010
import 'package:integration_test/integration_test.dart';
11-
import '../lib/firebase_options.dart';
11+
import 'package:tests/firebase_options.dart';
1212

1313
void main() {
1414
IntegrationTestWidgetsFlutterBinding.ensureInitialized();

packages/firebase_storage/example/integration_test/firebase_storage_e2e_test.dart packages/tests/example/integration_test/firebase_storage/firebase_storage_e2e_test.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import 'package:firebase_core/firebase_core.dart';
66
import 'package:firebase_storage/firebase_storage.dart';
77
import 'package:flutter_test/flutter_test.dart';
88
import 'package:integration_test/integration_test.dart';
9+
import 'package:tests/firebase_options.dart';
910

10-
import '../lib/firebase_options.dart';
1111
import 'instance_e2e.dart';
1212
import 'list_result_e2e.dart';
1313
import 'reference_e2e.dart';

packages/firebase_storage/example/integration_test/instance_e2e.dart packages/tests/example/integration_test/firebase_storage/instance_e2e.dart

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
import 'package:firebase_core/firebase_core.dart';
66
import 'package:firebase_storage/firebase_storage.dart';
77
import 'package:flutter_test/flutter_test.dart';
8+
import 'package:tests/firebase_options.dart';
89

9-
import '../lib/firebase_options.dart';
1010
import 'test_utils.dart';
1111

1212
void setupInstanceTests() {
@@ -241,9 +241,10 @@ void setupInstanceTests() {
241241
});
242242

243243
test('toString', () {
244+
// flutterfire-e2e-tests.appspot.com -> mytest-16eac.appspot.com
244245
expect(
245246
storage.toString(),
246-
'FirebaseStorage(app: [DEFAULT], bucket: flutterfire-e2e-tests.appspot.com)',
247+
'FirebaseStorage(app: [DEFAULT], bucket: mytest-16eac.appspot.com)',
247248
);
248249
});
249250
});

packages/firebase_storage/example/integration_test/reference_e2e.dart packages/tests/example/integration_test/firebase_storage/reference_e2e.dart

+11-3
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,25 @@
55
import 'dart:convert';
66
import 'dart:io';
77

8+
import 'package:firebase_core/firebase_core.dart';
89
import 'package:firebase_storage/firebase_storage.dart';
910
import 'package:flutter/foundation.dart';
1011
import 'package:flutter_test/flutter_test.dart';
11-
12+
import 'package:tests/firebase_options.dart';
1213
import './test_utils.dart';
1314

1415
void setupReferenceTests() {
1516
group('$Reference', () {
1617
late FirebaseStorage storage;
1718

1819
setUpAll(() async {
19-
storage = FirebaseStorage.instance;
20+
// Create a new app due to options initialization conflict
21+
// with the default app in another package.
22+
FirebaseApp app = await Firebase.initializeApp(
23+
name: "storage",
24+
options: DefaultFirebaseOptions.baseOptions,
25+
);
26+
storage = FirebaseStorage.instanceFor(app: app);
2027
});
2128

2229
group('bucket', () {
@@ -460,7 +467,8 @@ void setupReferenceTests() {
460467
test('toString', () async {
461468
expect(
462469
storage.ref('/uploadNope.jpeg').toString(),
463-
equals('Reference(app: [DEFAULT], fullPath: uploadNope.jpeg)'),
470+
equals(
471+
'Reference(app: storage, fullPath: uploadNope.jpeg)'), // [DEFAULT] -> storage
464472
);
465473
});
466474
});

packages/firebase_storage/example/integration_test/test_utils.dart packages/tests/example/integration_test/firebase_storage/test_utils.dart

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import 'dart:math';
77

88
import 'package:firebase_core/firebase_core.dart';
99
import 'package:flutter/foundation.dart';
10-
11-
import '../lib/firebase_options.dart';
10+
import 'package:tests/firebase_options.dart';
1211

1312
final String kTestString =
1413
([]..length = int.parse('${pow(2, 12)}')).join(_getRandomString(8)) * 100;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
// File generated by FlutterFire CLI.
6+
// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members
7+
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
8+
import 'package:flutter/foundation.dart'
9+
show defaultTargetPlatform, TargetPlatform;
10+
11+
/// Default [FirebaseOptions] for use with your Firebase apps.
12+
///
13+
/// Example:
14+
/// ```dart
15+
/// import 'firebase_options.dart';
16+
/// // ...
17+
/// await Firebase.initializeApp(
18+
/// options: DefaultFirebaseOptions.currentPlatform,
19+
/// );
20+
/// ```
21+
class DefaultFirebaseOptions {
22+
static FirebaseOptions get currentPlatform {
23+
switch (defaultTargetPlatform) {
24+
case TargetPlatform.linux:
25+
// Note: To find out if you are using the Tizen platform, refer to the link below.
26+
// https://github.com/flutter-tizen/flutter-tizen/issues/482#issuecomment-1441139704
27+
return tizen;
28+
default:
29+
throw UnsupportedError(
30+
'DefaultFirebaseOptions are not supported for this platform.',
31+
);
32+
}
33+
}
34+
35+
// For firebase_storage test
36+
static FirebaseOptions get baseOptions {
37+
return FirebaseOptions(
38+
apiKey: 'PLACEHOLDER',
39+
appId: 'PLACEHOLDER',
40+
messagingSenderId: 'PLACEHOLDER',
41+
projectId: 'PLACEHOLDER',
42+
databaseURL: 'PLACEHOLDER',
43+
storageBucket: 'PLACEHOLDER',
44+
);
45+
}
46+
47+
static const FirebaseOptions tizen = FirebaseOptions(
48+
apiKey: 'PLACEHOLDER',
49+
appId: 'PLACEHOLDER',
50+
messagingSenderId: 'PLACEHOLDER',
51+
projectId: 'PLACEHOLDER',
52+
databaseURL: 'PLACEHOLDER',
53+
storageBucket: 'PLACEHOLDER',
54+
);
55+
56+
static String get emulatorHost {
57+
return 'PLACEHOLDER';
58+
}
59+
}

0 commit comments

Comments
 (0)