From 3ceca5a06d166ab3f1d102ff059232595af6b597 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Fri, 20 Jun 2025 08:56:41 +0100 Subject: [PATCH 1/9] ci(ios): fix e2e test runner suite that passes but returns as failure --- .github/workflows/ios.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ios.yaml b/.github/workflows/ios.yaml index 1c7d80a8c6bb..91ebe0320383 100644 --- a/.github/workflows/ios.yaml +++ b/.github/workflows/ios.yaml @@ -115,4 +115,4 @@ jobs: run: | # Uncomment following line to have simulator logs printed out for debugging purposes. # xcrun simctl spawn booted log stream --predicate 'eventMessage contains "flutter"' & - flutter test integration_test/e2e_test.dart -d "$SIMULATOR" --dart-define=CI=true + flutter test integration_test/e2e_test.dart -d "$SIMULATOR" --dart-define=CI=true --ignore-timeouts From 797839abd8039f746792f62d56b24fcb545cbc46 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Fri, 20 Jun 2025 09:23:59 +0100 Subject: [PATCH 2/9] ci: verbose logs for tests --- .github/workflows/ios.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ios.yaml b/.github/workflows/ios.yaml index 91ebe0320383..5ce6d41fa74d 100644 --- a/.github/workflows/ios.yaml +++ b/.github/workflows/ios.yaml @@ -115,4 +115,4 @@ jobs: run: | # Uncomment following line to have simulator logs printed out for debugging purposes. # xcrun simctl spawn booted log stream --predicate 'eventMessage contains "flutter"' & - flutter test integration_test/e2e_test.dart -d "$SIMULATOR" --dart-define=CI=true --ignore-timeouts + flutter test integration_test/e2e_test.dart -d "$SIMULATOR" --dart-define=CI=true --verbose From 112ffd3243516950550c98a01fe456bcd9c90089 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Fri, 20 Jun 2025 09:55:33 +0100 Subject: [PATCH 3/9] check if it is auth suite --- .../firebase_auth/firebase_auth_instance_e2e_test.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/integration_test/firebase_auth/firebase_auth_instance_e2e_test.dart b/tests/integration_test/firebase_auth/firebase_auth_instance_e2e_test.dart index feef347f78e3..e1e171e2d4cc 100644 --- a/tests/integration_test/firebase_auth/firebase_auth_instance_e2e_test.dart +++ b/tests/integration_test/firebase_auth/firebase_auth_instance_e2e_test.dart @@ -1064,6 +1064,7 @@ void main() { ); }, // macOS skipped because it needs keychain sharing entitlement. See: https://github.com/firebase/flutterfire/issues/9538 - skip: defaultTargetPlatform == TargetPlatform.macOS, + skip: defaultTargetPlatform == TargetPlatform.macOS || + defaultTargetPlatform == TargetPlatform.iOS, ); } From ef2d1b7dd86fe416471d06bde12f54999f097ceb Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Thu, 24 Jul 2025 12:50:07 +0100 Subject: [PATCH 4/9] test: comment out tests to check if cause of test failure --- .../firebase_core/firebase_core_e2e_test.dart | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/tests/integration_test/firebase_core/firebase_core_e2e_test.dart b/tests/integration_test/firebase_core/firebase_core_e2e_test.dart index 8f31a8ddbd65..dc3b45dc0a4d 100644 --- a/tests/integration_test/firebase_core/firebase_core_e2e_test.dart +++ b/tests/integration_test/firebase_core/firebase_core_e2e_test.dart @@ -42,36 +42,36 @@ void main() { ); }); - test( - 'FirebaseApp.delete()', - () async { - await Firebase.initializeApp( - name: 'SecondaryApp', - options: DefaultFirebaseOptions.currentPlatform, - ); + // test( + // 'FirebaseApp.delete()', + // () async { + // await Firebase.initializeApp( + // name: 'SecondaryApp', + // options: DefaultFirebaseOptions.currentPlatform, + // ); - expect(Firebase.apps.length, 2); + // expect(Firebase.apps.length, 2); - FirebaseApp app = Firebase.app('SecondaryApp'); + // FirebaseApp app = Firebase.app('SecondaryApp'); - await app.delete(); + // await app.delete(); - expect(Firebase.apps.length, 1); - // TODO(russellwheatley): test randomly causes an auth sign-in failure due to duplicate accounts. - }, - skip: TargetPlatform.android == defaultTargetPlatform, - ); + // expect(Firebase.apps.length, 1); + // // TODO(russellwheatley): test randomly causes an auth sign-in failure due to duplicate accounts. + // }, + // skip: TargetPlatform.android == defaultTargetPlatform, + // ); - test('FirebaseApp.setAutomaticDataCollectionEnabled()', () async { - FirebaseApp app = Firebase.app(testAppName); - await app.setAutomaticDataCollectionEnabled(false); + // test('FirebaseApp.setAutomaticDataCollectionEnabled()', () async { + // FirebaseApp app = Firebase.app(testAppName); + // await app.setAutomaticDataCollectionEnabled(false); - expect(app.isAutomaticDataCollectionEnabled, false); + // expect(app.isAutomaticDataCollectionEnabled, false); - await app.setAutomaticDataCollectionEnabled(true); + // await app.setAutomaticDataCollectionEnabled(true); - expect(app.isAutomaticDataCollectionEnabled, true); - }); + // expect(app.isAutomaticDataCollectionEnabled, true); + // }); test('FirebaseApp.setAutomaticResourceManagementEnabled()', () async { FirebaseApp app = Firebase.app(testAppName); From b83a6d72eb27bbebe0a8cdfb8c34e3e53f6f31b9 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Thu, 24 Jul 2025 13:15:22 +0100 Subject: [PATCH 5/9] test: core causing silent app crash --- tests/integration_test/e2e_test.dart | 2 +- .../firebase_core/firebase_core_e2e_test.dart | 44 +++++++++---------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/tests/integration_test/e2e_test.dart b/tests/integration_test/e2e_test.dart index 0adbcd1de9cb..8ef9a466fbe1 100644 --- a/tests/integration_test/e2e_test.dart +++ b/tests/integration_test/e2e_test.dart @@ -88,7 +88,7 @@ void main() { } void runAllTests() { - firebase_core.main(); + // firebase_core.main(); firebase_auth.main(); firebase_database.main(); firebase_crashlytics.main(); diff --git a/tests/integration_test/firebase_core/firebase_core_e2e_test.dart b/tests/integration_test/firebase_core/firebase_core_e2e_test.dart index dc3b45dc0a4d..8f31a8ddbd65 100644 --- a/tests/integration_test/firebase_core/firebase_core_e2e_test.dart +++ b/tests/integration_test/firebase_core/firebase_core_e2e_test.dart @@ -42,36 +42,36 @@ void main() { ); }); - // test( - // 'FirebaseApp.delete()', - // () async { - // await Firebase.initializeApp( - // name: 'SecondaryApp', - // options: DefaultFirebaseOptions.currentPlatform, - // ); + test( + 'FirebaseApp.delete()', + () async { + await Firebase.initializeApp( + name: 'SecondaryApp', + options: DefaultFirebaseOptions.currentPlatform, + ); - // expect(Firebase.apps.length, 2); + expect(Firebase.apps.length, 2); - // FirebaseApp app = Firebase.app('SecondaryApp'); + FirebaseApp app = Firebase.app('SecondaryApp'); - // await app.delete(); + await app.delete(); - // expect(Firebase.apps.length, 1); - // // TODO(russellwheatley): test randomly causes an auth sign-in failure due to duplicate accounts. - // }, - // skip: TargetPlatform.android == defaultTargetPlatform, - // ); + expect(Firebase.apps.length, 1); + // TODO(russellwheatley): test randomly causes an auth sign-in failure due to duplicate accounts. + }, + skip: TargetPlatform.android == defaultTargetPlatform, + ); - // test('FirebaseApp.setAutomaticDataCollectionEnabled()', () async { - // FirebaseApp app = Firebase.app(testAppName); - // await app.setAutomaticDataCollectionEnabled(false); + test('FirebaseApp.setAutomaticDataCollectionEnabled()', () async { + FirebaseApp app = Firebase.app(testAppName); + await app.setAutomaticDataCollectionEnabled(false); - // expect(app.isAutomaticDataCollectionEnabled, false); + expect(app.isAutomaticDataCollectionEnabled, false); - // await app.setAutomaticDataCollectionEnabled(true); + await app.setAutomaticDataCollectionEnabled(true); - // expect(app.isAutomaticDataCollectionEnabled, true); - // }); + expect(app.isAutomaticDataCollectionEnabled, true); + }); test('FirebaseApp.setAutomaticResourceManagementEnabled()', () async { FirebaseApp app = Firebase.app(testAppName); From 524d92474ddcaa829fc7a87b7fdfbc4c202aa10d Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Thu, 24 Jul 2025 14:21:38 +0100 Subject: [PATCH 6/9] test: stop test from causing tests to fail --- .github/workflows/ios.yaml | 2 +- tests/integration_test/e2e_test.dart | 2 +- .../firebase_core/firebase_core_e2e_test.dart | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ios.yaml b/.github/workflows/ios.yaml index 5ce6d41fa74d..1c7d80a8c6bb 100644 --- a/.github/workflows/ios.yaml +++ b/.github/workflows/ios.yaml @@ -115,4 +115,4 @@ jobs: run: | # Uncomment following line to have simulator logs printed out for debugging purposes. # xcrun simctl spawn booted log stream --predicate 'eventMessage contains "flutter"' & - flutter test integration_test/e2e_test.dart -d "$SIMULATOR" --dart-define=CI=true --verbose + flutter test integration_test/e2e_test.dart -d "$SIMULATOR" --dart-define=CI=true diff --git a/tests/integration_test/e2e_test.dart b/tests/integration_test/e2e_test.dart index 8ef9a466fbe1..0adbcd1de9cb 100644 --- a/tests/integration_test/e2e_test.dart +++ b/tests/integration_test/e2e_test.dart @@ -88,7 +88,7 @@ void main() { } void runAllTests() { - // firebase_core.main(); + firebase_core.main(); firebase_auth.main(); firebase_database.main(); firebase_crashlytics.main(); diff --git a/tests/integration_test/firebase_core/firebase_core_e2e_test.dart b/tests/integration_test/firebase_core/firebase_core_e2e_test.dart index 8f31a8ddbd65..8445f13ca340 100644 --- a/tests/integration_test/firebase_core/firebase_core_e2e_test.dart +++ b/tests/integration_test/firebase_core/firebase_core_e2e_test.dart @@ -72,11 +72,11 @@ void main() { expect(app.isAutomaticDataCollectionEnabled, true); }); + // TODO(russellwheatley): this test is crashing iOS app. + // test('FirebaseApp.setAutomaticResourceManagementEnabled()', () async { + // FirebaseApp app = Firebase.app(testAppName); - test('FirebaseApp.setAutomaticResourceManagementEnabled()', () async { - FirebaseApp app = Firebase.app(testAppName); - - await app.setAutomaticResourceManagementEnabled(true); - }); + // await app.setAutomaticResourceManagementEnabled(true); + // }); }); } From 160a5da34bf8bc3656bd2945988673f446716afd Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Thu, 24 Jul 2025 14:36:50 +0100 Subject: [PATCH 7/9] fix(core): incorrect bool arg crashing core app --- .../firebase_core/Sources/firebase_core/FLTFirebaseCorePlugin.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/firebase_core/firebase_core/ios/firebase_core/Sources/firebase_core/FLTFirebaseCorePlugin.m b/packages/firebase_core/firebase_core/ios/firebase_core/Sources/firebase_core/FLTFirebaseCorePlugin.m index d20dcc1294b5..0fc0ed546eb2 100644 --- a/packages/firebase_core/firebase_core/ios/firebase_core/Sources/firebase_core/FLTFirebaseCorePlugin.m +++ b/packages/firebase_core/firebase_core/ios/firebase_core/Sources/firebase_core/FLTFirebaseCorePlugin.m @@ -252,7 +252,7 @@ - (void)setAutomaticDataCollectionEnabledAppName:(nonnull NSString *)appName } - (void)setAutomaticResourceManagementEnabledAppName:(nonnull NSString *)appName - enabled:(nonnull NSNumber *)enabled + enabled:(BOOL)enabled completion:(nonnull void (^)(FlutterError *_Nullable)) completion { // Unsupported on iOS/MacOS. From 6fe0eb45427ac7c2a7e8118b04f9beec652d491f Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Thu, 24 Jul 2025 14:42:23 +0100 Subject: [PATCH 8/9] test: reinstate tests --- .../firebase_auth/firebase_auth_instance_e2e_test.dart | 3 +-- .../firebase_core/firebase_core_e2e_test.dart | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/integration_test/firebase_auth/firebase_auth_instance_e2e_test.dart b/tests/integration_test/firebase_auth/firebase_auth_instance_e2e_test.dart index e8b7b3031196..30910de78a3d 100644 --- a/tests/integration_test/firebase_auth/firebase_auth_instance_e2e_test.dart +++ b/tests/integration_test/firebase_auth/firebase_auth_instance_e2e_test.dart @@ -1150,7 +1150,6 @@ void main() { }); }, // macOS skipped because it needs keychain sharing entitlement. See: https://github.com/firebase/flutterfire/issues/9538 - skip: defaultTargetPlatform == TargetPlatform.macOS || - defaultTargetPlatform == TargetPlatform.iOS, + skip: defaultTargetPlatform == TargetPlatform.macOS, ); } diff --git a/tests/integration_test/firebase_core/firebase_core_e2e_test.dart b/tests/integration_test/firebase_core/firebase_core_e2e_test.dart index 8445f13ca340..8f31a8ddbd65 100644 --- a/tests/integration_test/firebase_core/firebase_core_e2e_test.dart +++ b/tests/integration_test/firebase_core/firebase_core_e2e_test.dart @@ -72,11 +72,11 @@ void main() { expect(app.isAutomaticDataCollectionEnabled, true); }); - // TODO(russellwheatley): this test is crashing iOS app. - // test('FirebaseApp.setAutomaticResourceManagementEnabled()', () async { - // FirebaseApp app = Firebase.app(testAppName); - // await app.setAutomaticResourceManagementEnabled(true); - // }); + test('FirebaseApp.setAutomaticResourceManagementEnabled()', () async { + FirebaseApp app = Firebase.app(testAppName); + + await app.setAutomaticResourceManagementEnabled(true); + }); }); } From cdbc7a891702bf37f2f7f251cca40d600827d38e Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Fri, 25 Jul 2025 08:48:31 +0100 Subject: [PATCH 9/9] test(auth): skip test crashing app --- .../firebase_auth_instance_e2e_test.dart | 88 +++++++++++-------- 1 file changed, 49 insertions(+), 39 deletions(-) diff --git a/tests/integration_test/firebase_auth/firebase_auth_instance_e2e_test.dart b/tests/integration_test/firebase_auth/firebase_auth_instance_e2e_test.dart index 30910de78a3d..9b8a869434f0 100644 --- a/tests/integration_test/firebase_auth/firebase_auth_instance_e2e_test.dart +++ b/tests/integration_test/firebase_auth/firebase_auth_instance_e2e_test.dart @@ -841,42 +841,44 @@ void main() { } }); test( - 'should not throw error when app is deleted and reinit with same app name', - () async { - try { - const appName = 'SecondaryApp'; + 'should not throw error when app is deleted and reinit with same app name', + () async { + try { + const appName = 'SecondaryApp'; - final app = await Firebase.initializeApp( - name: appName, - options: DefaultFirebaseOptions.currentPlatform, - ); + final app = await Firebase.initializeApp( + name: appName, + options: DefaultFirebaseOptions.currentPlatform, + ); - var auth1 = FirebaseAuth.instanceFor(app: app); + var auth1 = FirebaseAuth.instanceFor(app: app); - await auth1.signInWithEmailAndPassword( - email: testEmail, - password: testPassword, - ); + await auth1.signInWithEmailAndPassword( + email: testEmail, + password: testPassword, + ); - await app.delete(); + await app.delete(); - final app2 = await Firebase.initializeApp( - name: appName, - options: DefaultFirebaseOptions.currentPlatform, - ); + final app2 = await Firebase.initializeApp( + name: appName, + options: DefaultFirebaseOptions.currentPlatform, + ); - final auth2 = FirebaseAuth.instanceFor(app: app2); + final auth2 = FirebaseAuth.instanceFor(app: app2); - await auth2.signInWithEmailAndPassword( - email: testEmail, - password: testPassword, - ); - } on FirebaseException catch (e) { - fail('Failed with error: $e'); - } catch (e) { - fail(e.toString()); - } - }); + await auth2.signInWithEmailAndPassword( + email: testEmail, + password: testPassword, + ); + } catch (e) { + fail(e.toString()); + } + }, + // TODO(russellwheatley): this is crashing iOS/macOS app (reinit app), but does not when running as app. + skip: defaultTargetPlatform == TargetPlatform.iOS || + defaultTargetPlatform == TargetPlatform.macOS, + ); }); group('signOut()', () { @@ -1064,8 +1066,8 @@ void main() { ); group('validatePassword()', () { - - const String validPassword = 'Password123!'; // For password policy impl testing + const String validPassword = + 'Password123!'; // For password policy impl testing const String invalidPassword = 'Pa1!'; const String invalidPassword2 = 'password123!'; const String invalidPassword3 = 'PASSWORD123!'; @@ -1073,7 +1075,8 @@ void main() { const String invalidPassword5 = 'Password123'; test('should validate password that is correct', () async { - final PasswordValidationStatus status = await FirebaseAuth.instance.validatePassword(FirebaseAuth.instance, validPassword); + final PasswordValidationStatus status = await FirebaseAuth.instance + .validatePassword(FirebaseAuth.instance, validPassword); expect(status.isValid, isTrue); expect(status.meetsMinPasswordLength, isTrue); expect(status.meetsMaxPasswordLength, isTrue); @@ -1084,30 +1087,37 @@ void main() { }); test('should not validate a password that is too short', () async { - final PasswordValidationStatus status = await FirebaseAuth.instance.validatePassword(FirebaseAuth.instance, invalidPassword); + final PasswordValidationStatus status = await FirebaseAuth.instance + .validatePassword(FirebaseAuth.instance, invalidPassword); expect(status.isValid, isFalse); expect(status.meetsMinPasswordLength, isFalse); }); - test('should not validate a password that has no uppercase characters', () async { - final PasswordValidationStatus status = await FirebaseAuth.instance.validatePassword(FirebaseAuth.instance, invalidPassword2); + test('should not validate a password that has no uppercase characters', + () async { + final PasswordValidationStatus status = await FirebaseAuth.instance + .validatePassword(FirebaseAuth.instance, invalidPassword2); expect(status.isValid, isFalse); expect(status.meetsUppercaseRequirement, isFalse); }); - test('should not validate a password that has no lowercase characters', () async { - final PasswordValidationStatus status = await FirebaseAuth.instance.validatePassword(FirebaseAuth.instance, invalidPassword3); + test('should not validate a password that has no lowercase characters', + () async { + final PasswordValidationStatus status = await FirebaseAuth.instance + .validatePassword(FirebaseAuth.instance, invalidPassword3); expect(status.isValid, isFalse); }); test('should not validate a password that has no digits', () async { - final PasswordValidationStatus status = await FirebaseAuth.instance.validatePassword(FirebaseAuth.instance, invalidPassword4); + final PasswordValidationStatus status = await FirebaseAuth.instance + .validatePassword(FirebaseAuth.instance, invalidPassword4); expect(status.isValid, isFalse); expect(status.meetsDigitsRequirement, isFalse); }); test('should not validate a password that has no symbols', () async { - final PasswordValidationStatus status = await FirebaseAuth.instance.validatePassword(FirebaseAuth.instance, invalidPassword5); + final PasswordValidationStatus status = await FirebaseAuth.instance + .validatePassword(FirebaseAuth.instance, invalidPassword5); expect(status.isValid, isFalse); expect(status.meetsSymbolsRequirement, isFalse); });