Skip to content

Conversation

@nilsreichardt
Copy link
Contributor

@nilsreichardt nilsreichardt commented Oct 1, 2022

Description

The integration_test package is the new way to write e2e tests. Therefore, this PR migrates the tests from driver tests to integration tests.

As side effect, we see that the Android CI e2e tests pipeline is way more stable.

Screen.Recording.2022-10-02.at.11.05.28.mov

ToDos:

  • Migrate cloud_firestore
  • Migrate cloud_functions
  • Migrate firebase_analytics
  • Migrate firebase_app_installations
  • Migrate firebase_auth
  • Migrate firebase_core
  • Migrate firebase_crashlytics
  • Migrate firebase_database
  • Migrate firebase_dynamic_links
  • Migrate firebase_in_app_messaging
  • Migrate firebase_ml_model_downloader
  • Migrate firebase_remote_config
  • Migrate firebase_messaging
  • Migrate firebase_storage
  • Migrate cloud_firestore_odm
  • Migrate firebase_performance
  • Migrate flutterfire_ui
  • Delete driver tests (test_driver/ folder)
  • Delete unused cloud_functions Flutter driver tests (in packages/cloud_functions/cloud_functions/example)
  • Delete unused firebase_analytics Flutter driver tests (in packages/firebase_analytics/firebase_analytics/example)
  • Delete unused firebase_auth Flutter driver tests (in packages/firebase_auth/firebase_auth/example)
  • Delete unused firebase_core Flutter driver tests (in packages/firebase_core/firebase_core/example)
  • Remove unused dev dependencies
  • Remove drive as dependency
  • Mark drive dependency on pub.dev as discontinued?
  • Check if CI is flaky (run CI 50 times)
  • Update documentation about running integration tests
  • Update Melos commands

Related Issues

Closes #8909

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]).
This will ensure a smooth and quick review process. Updating the pubspec.yaml and changelogs is not required.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (melos run analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • I signed the CLA.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

flutter_test:
sdk: flutter
plugin_platform_interface: ^2.0.0
test: any
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the test dependencies in all packages (except _flutterfire_internals) because the packages already have flutter_test as a dependency. Or is there a reason why we have two test dependencies?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me I think.

Comment on lines +1 to +3
import 'package:integration_test/integration_test_driver.dart';

Future<void> main() => integrationDriver();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the tests of flutterfire used? They are not in the CI, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have integration tests for flutterfire_ui if that is your question 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But there are some tests in example folder of the flutterfire_ui 🤔 https://github.com/firebase/flutterfire/tree/master/packages/flutterfire_ui/example/test_driver

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, they aren't part of our CI e2e tests. I think you can leave them for now and we'll integrate them at some other point. Unless @lesnitsky thinks otherwise?

Copy link
Contributor Author

@nilsreichardt nilsreichardt Oct 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add them as well? If yes, I can make a new issue and integrate them in a separate PR into our CI 👍

@@ -1,898 +0,0 @@
// ignore_for_file: require_trailing_commas
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the tests from the firebase_auth from packages/firebase_auth/firebase_auth/example/ because the source of truth should be in tests, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me. Double check with @Salakar as he set it up and might have a reason why e2e tests remain in example app.

},
// Android skip because it's flaky. See:
// https://github.com/firebase/flutterfire/issues/9652
skip: defaultTargetPlatform == TargetPlatform.android,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skipping this test because it's flaky. See: #9652

// Android skipped because it times out with a likelihood of 98%. See: https://github.com/firebase/flutterfire/issues/9651
skip: kIsWeb ||
defaultTargetPlatform == TargetPlatform.macOS ||
defaultTargetPlatform == TargetPlatform.android,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Android skipped because it times out with a likelihood of 98%. See: #9651

// Android skipped because it times out with a likelihood of 98%. See: https://github.com/firebase/flutterfire/issues/9650
skip: kIsWeb ||
defaultTargetPlatform == TargetPlatform.macOS ||
defaultTargetPlatform == TargetPlatform.android,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Android skipped because it times out with a likelihood of 98%. See: #9650

@nilsreichardt nilsreichardt marked this pull request as ready for review October 2, 2022 09:08
Copy link
Member

@russellwheatley russellwheatley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM provided a couple of questions I'm not sure on are answered by the rest of the core team. Good work, @nilsreichardt 🎉

flutter_test:
sdk: flutter
plugin_platform_interface: ^2.0.0
test: any
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me I think.

Comment on lines +1 to +3
import 'package:integration_test/integration_test_driver.dart';

Future<void> main() => integrationDriver();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have integration tests for flutterfire_ui if that is your question 😄

@@ -1,898 +0,0 @@
// ignore_for_file: require_trailing_commas
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me. Double check with @Salakar as he set it up and might have a reason why e2e tests remain in example app.

@rrousselGit

This comment was marked as outdated.

@nilsreichardt
Copy link
Contributor Author

Would it be possible to break this PR down into a few smaller ones?

Reviewing changes on 123 files is not reasonably doable.

Half of the migration has already been reviewed in #9230 (see #8910, #8946, #8938, #8972, #8975, #8974, #8978, #8973, #8977). However, cherry-picking the commits in separate branches should be relatively easy because I committed in very small steps.

Is still preferred? Yes, I can do this 👍

import 'query_reference_test.dart' as query_reference_test;

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

afaik this isn't required, because the flutter tool creates a temporary file where the call to IntegrationTestWidgetsFlutterBinding.ensureInitialized() is automatically inserted. See flutter/flutter#92254 for more details :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Lyokone
Copy link
Contributor

Lyokone commented Oct 31, 2022

Reviewed carefully and everything seems fine. Some files are deleted because they were duplicates not being used anymore. LGTM

Comment on lines +122 to +123
cd .github/workflows/scripts
firebase emulators:start --only auth,firestore,functions,storage,database --project flutterfire-e2e-tests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have the melos run firebase:emulator than can be used

@Lyokone Lyokone merged commit 1f061a8 into firebase:master Oct 31, 2022
@firebase firebase locked and limited conversation to collaborators Dec 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate e2e tests from Flutter Driver to integration_test package

6 participants