-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test(fdc): add e2e and unit tests to fdc #13224
Conversation
This reverts commit 6a643f1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor feedback but it's looking good to me 👍
.github/workflows/e2e_tests_fdc.yaml
Outdated
- 'docs/**' | ||
- 'website/**' | ||
- '**/example/**' | ||
- '**/flutterfire_ui/**' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- '**/flutterfire_ui/**' |
.github/workflows/e2e_tests_fdc.yaml
Outdated
path: | | ||
~/.android/avd/* | ||
~/.android/adb* | ||
key: avd-ubuntu |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
key: avd-ubuntu | |
key: avd-${{ runner.os }} |
.github/workflows/e2e_tests_fdc.yaml
Outdated
- uses: hendrikmuhs/ccache-action@c92f40bee50034e84c763e33b317c77adaa81c92 | ||
name: Xcode Compile Cache | ||
with: | ||
key: ${{ runner.os }}-ios-fdc-v3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
key: ${{ runner.os }}-ios-fdc-v3 | |
key: xcode-cache-${{ runner.os }} |
final listener = MoviesConnector.instance.listMovies | ||
.ref() | ||
.subscribe() | ||
.listen((value) { | ||
final movies = value.data.movies; | ||
|
||
if (count == 0) { | ||
expect(movies.length, 0, | ||
reason: 'First emission should contain an empty list'); | ||
} else { | ||
expect(movies.length, 1, | ||
reason: 'Second emission should contain one movie'); | ||
expect(movies[0].title, 'The Matrix', | ||
reason: 'The movie should be The Matrix'); | ||
hasBeenListened = true; | ||
} | ||
count++; | ||
}); | ||
|
||
await Future.delayed(const Duration(seconds: 1)); | ||
|
||
await MoviesConnector.instance.createMovie | ||
.ref( | ||
genre: 'Action', | ||
title: 'The Matrix', | ||
releaseYear: 1999, | ||
rating: 4.5, | ||
) | ||
.execute(); | ||
|
||
await MoviesConnector.instance.listMovies.ref().execute(); | ||
|
||
await Future.delayed(const Duration(seconds: 1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth using Completers for this type of test: https://github.com/firebase/flutterfire/blob/spm-core-2/tests/integration_test/firebase_storage/task_e2e.dart#L136-L163
It means you don't have to use Future.delayed which could be flakey
group( | ||
'$FirebaseDataConnect.instance listen', | ||
() { | ||
// ignore: unused_local_variable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is still needed if it is used?
group( | ||
'$FirebaseDataConnect.instance query', | ||
() { | ||
// ignore: unused_local_variable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same question
# The following line prevents the package from being accidentally published to | ||
# pub.dev using `flutter pub publish`. This is preferred for private packages. | ||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev | ||
description: 'A new Flutter project.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
description: 'A new Flutter project.' | |
description: 'Firebase Data Connect example app' |
late MockFirebaseAuth mockAuth; | ||
late MockFirebaseAppCheck mockAppCheck; | ||
late MockConnectorConfig mockConnectorConfig; | ||
// ignore: unused_local_variable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// ignore: unused_local_variable |
I guess this can also be removed
DeleteMovieMovieDelete.fromJson(Map<String, dynamic> json) | ||
: id = json['id'] {} | ||
|
||
// TODO(mtewani): Fix up to create a map on the fly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these todos relevant btw?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These todos are generated when using the VSCode extension, so nothing we can directly do in this repository.
Description
Replace this paragraph with a description of what this PR is doing. If you're modifying existing behavior, describe the existing behavior, how this PR is changing it, and what motivated the change.
Related Issues
#13063
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.///
).melos run analyze
) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?