Coder Social home page Coder Social logo

Comments (6)

suztomo avatar suztomo commented on July 23, 2024

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.

suztomo avatar suztomo commented on July 23, 2024

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.

suztomo avatar suztomo commented on July 23, 2024

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.

atn832 avatar atn832 commented on July 23, 2024

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.

suztomo avatar suztomo commented on July 23, 2024

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.

suztomo avatar suztomo commented on July 23, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.