Comments (6)
Authentication is a challenge.
Firebase Emulator does not require authentication. https://firebase.google.com/docs/rules/emulator-setup.
Using the emulator to develop cloud_firestore_mocks. The cloud_firestore_mocks users can benefit from easy Firestore unit tests (without setting up the emulator).
from fake_cloud_firestore.
Integration Test with contributor's dummy Firebase project (no security)
(Didn't work)
Test Structure
- test/cloud_firestore_mocks_test.dart defines
CloudFirestoreMockTests
class to run the existing widget tests. The main function calls the class, supplying MockFirestore. The widget tests cannot use "dart:ui" library ("dart:ui" is unavailable in driver test flutter/flutter#27826). - test_driver/app_test.dart calls the
CloudFirestoreMockTests
class, supplying real Firestore.
The driver app cannot touch firestore package either, because it depends on "dart:ui".
../../development/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.13.3/lib/cloud_firestore.dart:8:8: Error: Not found: 'dart:ui'
import 'dart:ui' show hashList;
^
Instruction
- Create a dummy Firebase project
- Set development rules (no security)
- Place GoogleService-Info.plist to Runners/Runners via Xcode.
- Run
flutter drive --target=test_driver/app.dart
My memo: https://gist.github.com/suztomo/eb37e00a0d0d8f364245e775d7af2861
from fake_cloud_firestore.
Integration test for test app that calls CloudFirestoreMockTests with a dummy (real) firebase project
Can test-driver/app.dart call CloudFirestoreMockTests from runApp?
from fake_cloud_firestore.
What about these integration tests? They seem to be doing what you are trying to do. Why do they not fail as well?
https://github.com/FirebaseExtended/flutterfire/tree/master/packages/cloud_firestore/cloud_firestore/example/test_driver
Did you get a chance to try with the Emulator that you mentioned? It would make it cleaner since we wouldn't need to create an actual account and a test database.
from fake_cloud_firestore.
Thank for the reference for the integration test. It should work as long ad test code is in app side, not driver code. I will give it a try.
Emulator with widget test didn’t work for me.
I followed https://firebase.google.com/docs/emulator-suite/connect_and_prototype
Firestore’s “setting” method (to specify localhost) never returned. Real Firestore client code needs a real device. Therefore it does not run in a widget test. Running it as a integration test may work.
from fake_cloud_firestore.
Found example directory.
[email protected] ~/Documents/cloud_firestore_mocks/example
~/Documents/cloud_firestore_mocks/example $ flutter drive --target=test_driver/cloud_firestore.dart
Using device iPhone 11 Pro Max.
Starting application: test_driver/cloud_firestore.dart
Warning: Missing build name (CFBundleShortVersionString).
Warning: Missing build number (CFBundleVersion).
Action Required: You must set a build name and number in the pubspec.yaml file version field before
submitting to the App Store.
Running pod install...
from fake_cloud_firestore.
Related Issues (20)
- mergeFields ignored in mock "set" method HOT 2
- Batch failure is different compared to real firestore
- Transaction does not revert if an error occurs HOT 1
- Cannot throw exception on DocumentReference.get() call (#get) HOT 1
- Please update dependancies HOT 3
- Throwing exceptions with Queries do not work when using different references
- Collection.get does not support throwing Exceptions
- StreamSubscription<QuerySnapshot<Map<String, dynamic>>> fails to capture data if the query is filtered using .where(field, arrayContains: Map<String, String>)
- type 'MethodChannelFieldValue' is not a subtype of type 'MockFieldValuePlatform' in type cast HOT 1
- add option to dump/load database to/from file HOT 1
- Add support for `cloud_firestore: ^4.14.0` HOT 5
- Support for Firestore OR queries HOT 2
- listeners not updating with #284 fix
- Error with type mismatch in Query.startAt
- throws null value with composite key query on null data document HOT 1
- Cannot use `whereIn` operator on map
- Stream is not updated when using map
- Add `pauseNetwork`, `unpauseNetwork`, `stopNetwork`
- Fix incompatibility with cloud_firestore 4.17.0 HOT 2
- Update cloud_firestore dependency HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fake_cloud_firestore.