Skip to content

Commit

Permalink
fix(test): integrate each test
Browse files Browse the repository at this point in the history
Signed-off-by: Hosung Kim [email protected]
  • Loading branch information
hs0225 committed Nov 3, 2023
1 parent 557c0b0 commit f62523e
Show file tree
Hide file tree
Showing 35 changed files with 528 additions and 23 deletions.
5 changes: 1 addition & 4 deletions .github/recipe.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
plugins:
firebase_core: ["tv-7.0"]
firebase_database: ["tv-7.0"]
firebase_storage: ["tv-7.0"]
cloud_functions: ["tv-7.0"]
tests: ["tv-7.0"]

This file was deleted.

42 changes: 42 additions & 0 deletions packages/tests/example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# VS Code related
.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
45 changes: 45 additions & 0 deletions packages/tests/example/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: "e1e47221e86272429674bec4f1bd36acc4fc7b77"
channel: "[user-branch]"

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77
base_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77
- platform: android
create_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77
base_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77
- platform: ios
create_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77
base_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77
- platform: linux
create_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77
base_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77
- platform: macos
create_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77
base_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77
- platform: web
create_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77
base_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77
- platform: windows
create_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77
base_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
3 changes: 3 additions & 0 deletions packages/tests/example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Flutterfire test

All package e2e tests belong in this application.
28 changes: 28 additions & 0 deletions packages/tests/example/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at https://dart.dev/lints.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:cloud_functions_example/firebase_options.dart';
import 'package:tests/firebase_options.dart';

import 'sample_data.dart' as data;

Expand Down
48 changes: 48 additions & 0 deletions packages/tests/example/integration_test/e2e_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Copyright 2022, 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 'package:integration_test/integration_test.dart';

import 'cloud_functions/cloud_functions_e2e_test.dart' as cloud_functions;
// import 'firebase_analytics/firebase_analytics_e2e_test.dart'
// as firebase_analytics;
// import 'firebase_app_check/firebase_app_check_e2e_test.dart'
// as firebase_app_check;
// import 'firebase_app_installations/firebase_app_installations_e2e_test.dart'
// as firebase_app_installations;
// import 'firebase_auth/firebase_auth_e2e_test.dart' as firebase_auth;
import 'firebase_core/firebase_core_e2e_test.dart' as firebase_core;
// import 'firebase_crashlytics/firebase_crashlytics_e2e_test.dart'
// as firebase_crashlytics;
import 'firebase_database/firebase_database_e2e_test.dart' as firebase_database;
// import 'firebase_dynamic_links/firebase_dynamic_links_e2e_test.dart'
// as firebase_dynamic_links;
// import 'firebase_messaging/firebase_messaging_e2e_test.dart'
// as firebase_messaging;
// import 'firebase_ml_model_downloader/firebase_ml_model_downloader_e2e_test.dart'
// as firebase_ml_model_downloader;
// import 'firebase_remote_config/firebase_remote_config_e2e_test.dart'
// as firebase_remote_config;
import 'firebase_storage/firebase_storage_e2e_test.dart' as firebase_storage;

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();

group('FlutterFire', () {
// firebase_core.main();
// firebase_database.main();
// firebase_crashlytics.main();
// firebase_auth.main();
// firebase_analytics.main();
cloud_functions.main();
// firebase_app_check.main();
// firebase_app_installations.main();
// firebase_dynamic_links.main();
// firebase_messaging.main();
// firebase_ml_model_downloader.main();
// firebase_remote_config.main();
// firebase_storage.main();
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:firebase_core_platform_interface/firebase_core_platform_interfac
import 'package:flutter/foundation.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import '../lib/firebase_options.dart';
import 'package:tests/firebase_options.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_storage/firebase_storage.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:tests/firebase_options.dart';

import '../lib/firebase_options.dart';
import 'instance_e2e.dart';
import 'list_result_e2e.dart';
import 'reference_e2e.dart';
Expand All @@ -20,7 +20,7 @@ void main() {
group('firebase_storage', () {
setUpAll(() async {
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
options: DefaultFirebaseOptions.baseOptions,
);

// Add a write only file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_storage/firebase_storage.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:tests/firebase_options.dart';

import '../lib/firebase_options.dart';
import 'test_utils.dart';

void setupInstanceTests() {
Expand All @@ -17,7 +17,7 @@ void setupInstanceTests() {

setUpAll(() async {
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
options: DefaultFirebaseOptions.baseOptions,
);
storage = FirebaseStorage.instance;
secondaryApp = await testInitializeSecondaryApp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import 'dart:math';

import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/foundation.dart';

import '../lib/firebase_options.dart';
import 'package:tests/firebase_options.dart';

final String kTestString =
([]..length = int.parse('${pow(2, 12)}')).join(_getRandomString(8)) * 100;
Expand Down Expand Up @@ -62,11 +61,11 @@ Future<FirebaseApp> testInitializeSecondaryApp({
);
} else {
testAppOptions = FirebaseOptions(
appId: DefaultFirebaseOptions.currentPlatform.appId,
apiKey: DefaultFirebaseOptions.currentPlatform.apiKey,
projectId: DefaultFirebaseOptions.currentPlatform.projectId,
appId: DefaultFirebaseOptions.baseOptions.appId,
apiKey: DefaultFirebaseOptions.baseOptions.apiKey,
projectId: DefaultFirebaseOptions.baseOptions.projectId,
messagingSenderId:
DefaultFirebaseOptions.currentPlatform.messagingSenderId,
DefaultFirebaseOptions.baseOptions.messagingSenderId,
storageBucket: withDefaultBucket ? kTestStorageBucket : null,
);
}
Expand Down
59 changes: 59 additions & 0 deletions packages/tests/example/lib/firebase_options.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Copyright 2022, 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.

// File generated by FlutterFire CLI.
// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
import 'package:flutter/foundation.dart'
show defaultTargetPlatform, TargetPlatform;

/// Default [FirebaseOptions] for use with your Firebase apps.
///
/// Example:
/// ```dart
/// import 'firebase_options.dart';
/// // ...
/// await Firebase.initializeApp(
/// options: DefaultFirebaseOptions.currentPlatform,
/// );
/// ```
class DefaultFirebaseOptions {
static FirebaseOptions get currentPlatform {
switch (defaultTargetPlatform) {
case TargetPlatform.linux:
// Note: To find out if you are using the Tizen platform, refer to the link below.
// https://github.com/flutter-tizen/flutter-tizen/issues/482#issuecomment-1441139704
return tizen;
default:
throw UnsupportedError(
'DefaultFirebaseOptions are not supported for this platform.',
);
}
}

// For firebase_storage test
static FirebaseOptions get baseOptions {
return FirebaseOptions(
apiKey: 'PLACEHOLDER',
appId: 'PLACEHOLDER',
messagingSenderId: 'PLACEHOLDER',
projectId: 'PLACEHOLDER',
databaseURL: 'PLACEHOLDER',
storageBucket: 'PLACEHOLDER',
);
}

static const FirebaseOptions tizen = FirebaseOptions(
apiKey: 'PLACEHOLDER',
appId: 'PLACEHOLDER',
messagingSenderId: 'PLACEHOLDER',
projectId: 'PLACEHOLDER',
databaseURL: 'PLACEHOLDER',
storageBucket: 'PLACEHOLDER',
);

static String get emulatorHost {
return 'PLACEHOLDER';
}
}
Loading

0 comments on commit f62523e

Please sign in to comment.