Skip to content

Commit

Permalink
Merge branch 'firebase:main' into feature/ios_authorization_options
Browse files Browse the repository at this point in the history
  • Loading branch information
StanleyCocos authored Nov 20, 2024
2 parents 6f35729 + 1ef2044 commit 301186d
Show file tree
Hide file tree
Showing 27 changed files with 607 additions and 554 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/ios.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
- 'docs/**'
- 'website/**'
- '**/example/**'
- '!**/example/integration_test/**'
- '**/flutterfire_ui/**'
- '**.md'
push:
Expand All @@ -19,6 +20,7 @@ on:
- 'docs/**'
- 'website/**'
- '**/example/**'
- '!**/example/integration_test/**'
- '**/flutterfire_ui/**'
- '**.md'

Expand Down Expand Up @@ -101,16 +103,16 @@ jobs:
ccache -s
- name: Start Firebase Emulator
run: sudo chown -R 501:20 "/Users/runner/.npm" && cd ./.github/workflows/scripts && ./start-firebase-emulator.sh
- uses: futureware-tech/simulator-action@48e51da14445b3eedca643bba4b78d9d8332ff31
id: simulator
with:
# List of available simulators: https://github.com/actions/runner-images/blob/main/images/macos/macos-14-Readme.md#installed-simulators
model: "iPhone 15"
- name: 'E2E Tests'
working-directory: ${{ matrix.working_directory }}
env:
SIMULATOR: ${{ steps.simulator.outputs.udid }}
run: |
# Boot simulator and wait for System app to be ready.
# List of available simulators: https://github.com/actions/runner-images/blob/main/images/macos/macos-14-Readme.md#installed-simulators
SIMULATOR="iPhone 15"
xcrun simctl bootstatus "$SIMULATOR" -b
xcrun simctl logverbose "$SIMULATOR" enable
# Sleep to allow simulator to settle.
sleep 15
# 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
2 changes: 1 addition & 1 deletion melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ scripts:
test:e2e:web:
run: |
melos exec -c 1 --fail-fast -- \
"flutter drive --target=./integration_test/e2e_test.dart --driver=./test_driver/integration_test.dart -d chrome --dart-define=APP_CHECK_E2E=true"
"flutter drive --target=./integration_test/e2e_test.dart --driver=./test_driver/integration_test.dart -d chrome --dart-define=LOCAL_WEB_E2E=true"
description: |
Run all e2e tests on web platform. Please ensure you have "chromedriver" installed and running.
packageFilters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,13 @@ protected static void setCachedFirebaseFirestoreInstanceForKey(

protected static FirebaseFirestore getFirestoreInstanceByNameAndDatabaseUrl(
String appName, String databaseURL) {
for (Map.Entry<FirebaseFirestore, FlutterFirebaseFirestoreExtension> entry :
firestoreInstanceCache.entrySet()) {
if (entry.getValue().getInstance().getApp().getName().equals(appName)
&& entry.getValue().getDatabaseURL().equals(databaseURL)) {
return entry.getKey();
synchronized (firestoreInstanceCache) {
for (Map.Entry<FirebaseFirestore, FlutterFirebaseFirestoreExtension> entry :
firestoreInstanceCache.entrySet()) {
if (entry.getValue().getInstance().getApp().getName().equals(appName)
&& entry.getValue().getDatabaseURL().equals(databaseURL)) {
return entry.getKey();
}
}
}
return null;
Expand Down Expand Up @@ -200,12 +202,14 @@ public Task<Void> didReinitializeFirebaseCore() {
() -> {
try {
// Context is ignored by API so we don't send it over even though annotated non-null.
for (Map.Entry<FirebaseFirestore, FlutterFirebaseFirestoreExtension> entry :
firestoreInstanceCache.entrySet()) {
FirebaseFirestore firestore = entry.getKey();
Tasks.await(firestore.terminate());
FlutterFirebaseFirestorePlugin.destroyCachedFirebaseFirestoreInstanceForKey(
firestore);
synchronized (firestoreInstanceCache) {
for (Map.Entry<FirebaseFirestore, FlutterFirebaseFirestoreExtension> entry :
firestoreInstanceCache.entrySet()) {
FirebaseFirestore firestore = entry.getKey();
Tasks.await(firestore.terminate());
FlutterFirebaseFirestorePlugin.destroyCachedFirebaseFirestoreInstanceForKey(
firestore);
}
}
removeEventListeners();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void runCollectionReferenceTests() {
return collection;
}

testWidgets('add() adds a document', (_) async {
test('add() adds a document', () async {
CollectionReference<Map<String, dynamic>> collection =
await initializeTest('collection-reference-add');
var rand = Random();
Expand All @@ -42,9 +42,9 @@ void runCollectionReferenceTests() {
expect(randNum, equals(snapshot.data()!['value']));
});

testWidgets(
test(
'snapshots() can be reused',
(_) async {
() async {
final foo = await initializeTest('foo');

final snapshot = foo.snapshots();
Expand Down Expand Up @@ -86,9 +86,9 @@ void runCollectionReferenceTests() {
group(
'withConverter',
() {
testWidgets(
test(
'add/snapshot',
(_) async {
() async {
final foo = await initializeTest('foo');
final fooConverter = foo.withConverter<int>(
fromFirestore: (snapshots, _) =>
Expand Down Expand Up @@ -179,9 +179,9 @@ void runCollectionReferenceTests() {
timeout: const Timeout.factor(3),
);

testWidgets(
test(
'returning null from `fromFirestore` should not throw a null check error',
(_) async {
() async {
final foo = await initializeTest('foo');
await foo.add({'value': 42});
final fooConverter = foo.withConverter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ void runDocumentChangeTests() {
return collection;
}

testWidgets(
test(
'can add/update values to null in the document',
(_) async {
() async {
CollectionReference<Map<String, dynamic>> collection =
await initializeTest('null-test');
DocumentReference<Map<String, dynamic>> doc1 = collection.doc('doc1');
Expand Down Expand Up @@ -84,9 +84,9 @@ void runDocumentChangeTests() {
skip: defaultTargetPlatform == TargetPlatform.windows,
);

testWidgets(
test(
'returns the correct metadata when adding and removing',
(_) async {
() async {
CollectionReference<Map<String, dynamic>> collection =
await initializeTest('add-remove-document');
DocumentReference<Map<String, dynamic>> doc1 = collection.doc('doc1');
Expand Down Expand Up @@ -141,9 +141,9 @@ void runDocumentChangeTests() {
skip: defaultTargetPlatform == TargetPlatform.windows,
);

testWidgets(
test(
'returns the correct metadata when modifying',
(_) async {
() async {
CollectionReference<Map<String, dynamic>> collection =
await initializeTest('add-modify-document');
DocumentReference<Map<String, dynamic>> doc1 = collection.doc('doc1');
Expand Down
Loading

0 comments on commit 301186d

Please sign in to comment.