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 8, 2023
1 parent abf4129 commit ef533aa
Show file tree
Hide file tree
Showing 36 changed files with 469 additions and 22 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"]
2 changes: 1 addition & 1 deletion .github/workflows/integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
integration_test:
runs-on: [self-hosted]
timeout-minutes: 30
timeout-minutes: 60
if: ${{ github.repository_owner == 'flutter-tizen' }}
steps:
- uses: actions/checkout@v3
Expand Down

This file was deleted.

38 changes: 38 additions & 0 deletions packages/tests/example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 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

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
22 changes: 22 additions & 0 deletions packages/tests/example/integration_test/e2e_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// 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_core/firebase_core_e2e_test.dart' as firebase_core;
import 'firebase_database/firebase_database_e2e_test.dart' as firebase_database;
import 'firebase_storage/firebase_storage_e2e_test.dart' as firebase_storage;

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();

group('FlutterFire', () {
firebase_core.main();
firebase_database.main();
cloud_functions.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 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 Down Expand Up @@ -241,9 +241,10 @@ void setupInstanceTests() {
});

test('toString', () {
// flutterfire-e2e-tests.appspot.com -> mytest-16eac.appspot.com
expect(
storage.toString(),
'FirebaseStorage(app: [DEFAULT], bucket: flutterfire-e2e-tests.appspot.com)',
'FirebaseStorage(app: [DEFAULT], bucket: mytest-16eac.appspot.com)',
);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,25 @@
import 'dart:convert';
import 'dart:io';

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

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

void setupReferenceTests() {
group('$Reference', () {
late FirebaseStorage storage;

setUpAll(() async {
storage = FirebaseStorage.instance;
// Create a new app due to options initialization conflict
// with the default app in another package.
FirebaseApp app = await Firebase.initializeApp(
name: "storage",
options: DefaultFirebaseOptions.baseOptions,
);
storage = FirebaseStorage.instanceFor(app: app);
});

group('bucket', () {
Expand Down Expand Up @@ -460,7 +467,8 @@ void setupReferenceTests() {
test('toString', () async {
expect(
storage.ref('/uploadNope.jpeg').toString(),
equals('Reference(app: [DEFAULT], fullPath: uploadNope.jpeg)'),
equals(
'Reference(app: storage, fullPath: uploadNope.jpeg)'), // [DEFAULT] -> storage
);
});
});
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
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 ef533aa

Please sign in to comment.