Commit Graph

724 Commits

Author SHA1 Message Date
Johannes Klein
741f053716 Remove mock (#3287) 2025-12-12 21:02:54 +01:00
Abbey Campbell
2c6eb6622a Merge pull request #3271 from inaturalist/mob-963-change-slideover-menu-to-be-a-static-page
Mob 963 change slideover menu to be a static page
2025-12-12 10:27:37 -08:00
Corey Farwell
c36c94a5df Remove unneeded getImageDimensions helper function. (#3200)
* Remove unneeded `getImageDimensions` helper function.

The built-in React Native function has an `async` API that we can call directly.

* Legit test failure

* Import Image from React Native

* Prefer using styledComponents.Image.getSize

* Revert "Prefer using styledComponents.Image.getSize"

This reverts commit 103ca9b3ef.
2025-12-12 10:58:42 +01:00
Abbey Campbell
0c07017ac6 update testID 2025-12-11 14:17:39 -08:00
Abbey Campbell
f05d79be24 remove isTest flag, override bottom-tabs animation in jest setup, add comments to detox fix 2025-12-09 18:48:17 -08:00
Abbey Campbell
caca94fb48 update more tests and snapshots 2025-12-09 18:46:40 -08:00
Abbey Campbell
b8375e0254 update tests and snapshots 2025-12-09 18:46:40 -08:00
Seth Peterson
12db53e7d6 Merge pull request #3249 from inaturalist/mob-512-implement-saved-match-screen
MOB-512 saved match screen experience
2025-12-09 09:22:10 -06:00
sepeterson
7ea31b224e Merge branch 'mob-512-implement-saved-match-screen' of https://github.com/inaturalist/iNaturalistReactNative into mob-512-implement-saved-match-screen 2025-12-08 18:11:37 -06:00
sepeterson
0d42eab08a MOB-512 edit tests to rm unnecessary code, make consistent with greater test suite, and rm out of scope test 2025-12-08 18:10:32 -06:00
Johannes Klein
2a51f5ad9c Add a unit test for when taxon is undefined 2025-12-07 21:39:00 +01:00
sepeterson
dfcf12cc73 MOB-512 merge main 2025-12-04 21:31:43 -06:00
sepeterson
998f21a121 MOB-512 add map section tests 2025-12-04 21:23:13 -06:00
sepeterson
6c839f9036 MOB-512 rm silly import 2025-12-04 20:40:17 -06:00
sepeterson
ff4537dd62 MOB-512 first pass SavedMatch integraton 2025-12-04 20:33:04 -06:00
sepeterson
4d5bbfc584 Merge branch 'main' into mob-991-firebase-record-whether-or-not-the-user-has-given-location 2025-12-04 10:27:08 -06:00
sepeterson
57d5996736 MOB-512 add component test to check for correct savedMatch or obsDetail component 2025-12-03 18:02:28 -06:00
Abbey Campbell
2ee99d6c7b fix tests 2025-12-02 13:29:00 -08:00
Abbey Campbell
5a212adf6e update snapshots 2025-12-01 14:29:50 -08:00
sepeterson
ab96a0be89 Merge branch 'main' into mob-512-implement-saved-match-screen 2025-11-25 08:11:28 -06:00
sepeterson
403be86702 MOB-991 fix perf jest mock 2025-11-25 08:05:31 -06:00
Abbey Campbell
6ed6c2b31b comment tooltip tests back in 2025-11-21 12:33:04 -08:00
sepeterson
19cb7064a6 MOB-512 minimal unit test fix and prop spreading allowed for tests 2025-11-21 10:12:59 -06:00
Abbey Campbell
8b33319935 rename test files 2025-11-20 18:05:38 -08:00
Abbey Campbell
a23597f001 add back tooltip tests 2025-11-17 18:48:31 -08:00
Abbey Campbell
578f1d5ce4 fix tooltip implementation 2025-11-17 12:48:22 -08:00
Yaron Budowski
9c2facc680 MOB-925 - new designs for add-obs button sheet 2025-11-14 14:19:05 -08:00
sepeterson
fb4a994dd0 MOB-991 add jest mock for perf 2025-11-12 16:15:36 -06:00
Ryan Stelly
e4d3bd796c switch spy to mock 2025-11-07 11:55:09 -06:00
Ryan Stelly
7086d00d42 MOB-1000 mock user to fix unit test flake 2025-11-06 12:56:39 -06:00
Johannes Klein
6b21c914bf Remove expectation towards a no longer accessible prop 2025-10-28 21:53:01 +01:00
Corey Farwell
7a9fc4e647 Shutdown Realm after tests complete to avoid Jest open connections warning. (#3161) 2025-10-28 13:24:28 +01:00
Johannes Klein
bad9c5a4d8 Add firebase dependency, and basic logging (#3127)
* Update package.json

* Update AppDelegate.mm

* Update Podfile

* Update .gitignore

* Update link-inat-model-files.sh

* Add plist file to project

* Update project.pbxproj

* Add analytics package

* Update project.pbxproj

* Update PrivacyInfo.xcprivacy

* Basic screen tracking

* Basic button press logging to firebase

* Update package-lock.json

* Update Podfile.lock

* Add Android setup

* Update .gitignore

* Add analytics mock

* Ignore rubocop warning here

* Create GoogleService-Info.example.plist

* Create google-services.example.json

* Add instructions to set up Firebase configs

* Update e2e_ios.yml

* Update e2e_android.yml

* Better plural

* Use specific XCode version in e2e CI

* Update GoogleService-Info.example.plist

* Revert "Update GoogleService-Info.example.plist"

This reverts commit 0bc0ed4862.

* We need an actual real app id or we get a crash during app start

* My bad, we do need both files for building

* Also set API key

* Add comments

* Add comment

* Update Podfile.lock

* Revert "Use specific XCode version in e2e CI"

This reverts commit cbd63d1b5d.
2025-10-16 13:15:10 +02:00
Johannes Klein
b20a99adec Show offline profile picture in header (#3142)
* Rename file without changes

* Revert "Rename file without changes"

This reverts commit a3de5e100d.

* Rename file without changes

* Refactor InlineUserBase to TS

* Update component Props

* Import as type

* Check if the user displayed is the current user and if so

also display the user image while offline.

* Update src/components/SharedComponents/InlineUser/InlineUserBase.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update InlineUser.test.js

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-16 00:19:35 +02:00
Johannes Klein
6aa195ceaf Fix: Double border on user icon in Me tab (#3135)
* Use Image with nativewind styling instead of FasterImageView

* Update UserIcon.test.js.snap

* Update unit tests
2025-10-14 21:22:24 +02:00
Kirk van Gorkom
2e08467692 Prevent WebView iframe loads from updating source (#3107)
* Prevent WebView iframe loads from updating source

* Use request type directly from the library that provides this param

---------

Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>
2025-10-09 14:26:10 +02:00
Johannes Klein
9c90c2e45f Update react-native to 0.79 (#3051)
* Upgrade helper: package.json

* Upgrade helper: gems

* Upgrade helper: Android

* Update AppDelegate

* Fix error in compiling

* Update package-lock.json

* Update Podfile.lock

* Update package-lock.json

* Update Podfile.lock

* Remove no longer needed mock

* Comment out entire test and not only the expect call

* Most other unit tests use this render helper function that

wraps the component in the entire app.

* Mock react-native exports as esModule

* Update .flowconfig

* Update Gemfile

* Revert "Comment out entire test and not only the expect call"

This reverts commit 8785f81529.
2025-10-01 22:44:14 -05:00
Johannes Klein
3c04df39a3 Enable New Architecture (#3111)
* Update gradle.properties

* Update Podfile

* Update react-native-mmkv

* Update Podfile.lock

* Delete useObservationsUpdatesWhenFocused.test.js

* Update closeOnboarding.js

* Fix failing button tap in e2e tests

* Create react-native-sensitive-info+6.0.0-alpha.9.patch

* Update bottom-sheets

* Refactor e2e timeout to file-wide const

* Remove check that fails

* Check for entire list item instead of comments count

* Longer delay to wait for observation deletion to make UI disappear
2025-09-27 08:28:13 -06:00
Johannes Klein
a3aaa66ed5 Update react-native-share-menu to build with use_frameworks static (#3109)
* Update react-native-share-menu

* Update Podfile.lock

* Create react-native-share-menu+6.0.0.patch

This is required as long as we are not setting use_frameworks to static

* Breaking change: Android react-native-share-menu now also has same Share structure as iOS

* Remove Android specific test structure

Because Android and iOS now have the same return type from our fork of react-native-share-menu
2025-09-21 18:23:20 -06:00
Corey Farwell
8ad5036273 Limit Jest usage to test files; conslidate ESLint config. (#3086)
Prior to this commit, technically Jest could have been imported in production files and ESLint would have been okay with that since it was allowed across the codebase.

After this commit, ESLint will only allow Jest usage in test files. In addition, the 3-line test-specific ESLint config was consolidated into the main config.

Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>
2025-09-09 16:37:06 +02:00
Corey Farwell
a43446909c Remove the need to specify TypeScript file extensions in imports (#3094)
* Don't require TS extensions in imports

* Resolve all import extension errors

* Remove file extension from import paths used in mocks

* Remove .d of type definition file paths

* Remove .d of type definition file and import as type

---------

Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>
2025-09-07 23:41:42 +02:00
Johannes Klein
49091f8fc4 Enable React Compiler (#3082)
* Update package.json

* Update package-lock.json

* Enable plugin

* Update package.json

* Update package-lock.json

* Update .eslintrc.js

* Create a new object instead of mutating the existing one

* Update SoundRecorder.js

* Do not mutate prop directly

* Do not mutate store value directly

* Disable compiler for zoom hook

Because it uses reanimated logic, and previous work laid out we should specifically disregard a rule of react here, unsure what to do here for now.

* Move array for tracking results into component

* Disable compiler for StandardCamera

* Do not mutate store value directly

* Disable compiler for FullPageWebView

* Do not mutate route param

* Remove unnecessary check if state is true before setting it to false

* Fix: user might be undefined

* Update reanimated usage with new compiler compliant API

* Fix: taxon might be undefined

* Fix: taxon might be undefined

* Fix: common pitfall of trying to render text outside of Text component

* Update interface

* Add package override

* Update package-lock.json

* Refactor updating of user preferences into User model

* Remove no memo directive from zoom

* Update file imports

* Migrate safeRealmWrite to TS

* Update interface and import path

* Update interface

* Refactor useLocaalObservation hook to not mutate return value of a function that should not be mutated

* Update tests to new return structure

* Remove useSafeRoute hook

We get the same information from error contexts and surrounding documents, and this hook was violating the rules of react by conditionally calling another hook.

* Use optional chaining

* Update TaxonNamesSetting.test.js

* Fix: use optional chaining

* Extend on RNTLs renderHook instead of re-implementing

* Remove unnecessary mock

* Remove unnecessary mock

* Remove unecessary mock

* Remove trailing spaces
2025-09-01 17:06:51 +02:00
Johannes Klein
dc1e1ec3f1 Testing with mocked FadeInView component (#3064)
* Repair integration test

* Repair Explore.test.js

* Move no longer broken test

* Mock the fadeInView that does screen transitions in tests

* Mock another fade in view
2025-08-22 21:09:23 +02:00
Johannes Klein
a15e4c7076 Allow some time for camera initialization, add log if no device found (#3059)
* Start screen in a loading state for 700ms

One idea I have about the bug is that maybe it takes a few renders to initialize the device. As we are immediately backing out of the screen in case we have no device, maybe just adding a few ms to give the native side time helps.

* If no device is selected log the length of devices available

* Add missing mock
2025-08-13 19:20:36 +02:00
Johannes Klein
b4516b7b25 Update react native to v0.78.x (#3043)
* Update package.json

* Update package.json

* Updates for native files with upgrade-helpers

* Update .flowconfig

* Update package-lock.json

* Update Podfile.lock

* Add react-dom types

* Update package-lock.json

* Wrong install

* Use types-react-codemod

* Update TaxonSearch.tsx

* Remove react-native-accessibility-engine dependency

This is currently not maintained and not compatible with RN 0.78

* Comment out accessibility tests

* Disable broken snapshot test

* Move broken test

* Move broken test

* Move broken test

* Remove duplicate file

* Move broken tests

* Move broken tests

* Move broken tests

* Move broken tests

* Move broken tests

* Move broken test

* Remove duplicate file

* Move broken tests
2025-08-09 13:47:46 +02:00
Johannes Klein
a618b6e870 Update react-native-testing-library to latest (#3044)
* Update package.json

* Update package-lock.json

* Update

* Update to v13

* Update package-lock.json

* Breaking change: remove extend-expect

* Latest version

* Update package-lock.json

* Breaking change: Removed Accessibility matcher

* Update Suggestions.test.js

* Update DisplayTaxonName.test.js

* Testing the same but differently phrased

* Not really needed to test this

And since not.toHaveTextContent stopped working I just remove it.

* Update useTaxonSearch.test.js

* Move broken tests into folders that are not run

* Only move single tests that are failing

* This does work after all

* Remove only single tests that are broken

* Only move failed tests

* Only move failed tests

* Only move failed tests

* Does not pass on CI only
2025-08-05 13:44:49 +02:00
Johannes Klein
f10188250c Some Flow to Typescript migrations, in simple components (#3034)
* Update Attribution.tsx

* Update FollowButton.tsx

* Update LoginSheet.tsx

* Update UnfollowSheet.tsx

* Update UnfollowSheet.tsx

* Update EstablishmentMeans.tsx

* Update TaxonDetailsTitle.tsx

* Update Taxonomy.tsx

* Update TaxonMapPreview.tsx

* Update FullScreenActivityIndicator.tsx

* Update ActivityIndicator.tsx

* Update SpeciesSeenCheckmark.tsx

* Update Mortal.tsx

* Update HideView.tsx

* Update ConfidenceInterval.tsx

* Update ViewWrapper.tsx

* Update ScrollViewWrapper.tsx

* Update SimpleObservationLocation.tsx

* Update Divider.tsx

* Update DateTimePicker.tsx

* Update MediaNavButtons.tsx

* Update MediaNavButtons.tsx

* Update MediaNavButtons.tsx

* Update DisplayTaxon.tsx

* Update InputField.tsx

* Update InputField.tsx

* Update ObservationLocation.tsx

* Update WarningText.tsx

* Update LoadingIndicator.tsx

* Update CrosshairCircle.tsx

* Update CoordinatesCopiedNotification.tsx

* Update PhotoSharing.tsx

* Update TaxonDetailsMediaViewerHeader.tsx

* Update EvidenceButton.tsx

* Update TextSheet.tsx

* Update Wikipedia.tsx

* Update About.tsx

* Update About.tsx

* Update imports

* Code style
2025-08-01 12:25:46 +02:00
Johannes Klein
6e696cb524 Update to react-native 0.77 (#3026)
* Upgrade helper changes JS side

* Upgrade helper Android

* Upgrade helper iOS side

* Update project.pbxproj

* Create react-native-modal+14.0.0-rc.1.patch

* BackHandler.removeEventListener is deprecated

* Update react-native-modal

* Update .flowconfig

* Update package-lock.json

* Update Podfile.lock

* Update Podfile.lock from main

* Replace toBeVisible with toBeOnTheScreen

This is not recommended by react-navigation, because even though toBeOnTheScreen makes sure the components are in the tree it does not mean they are visible to the user. For example, in terms of navigation a previous screen is still i the tree but not visible to the user in the app.
I spent around a day trying to figure out why the isVisible check stopped working, and still have no clear answer.
Testing in the actual app shows that all of those flows are still working as expected, so it is a test-environment-only problem.
My suggestion would be to re-visit this problem after we have updated RN to latest, and testing related libraries to latest versions.
2025-08-01 12:11:13 +02:00
Johannes Klein
f17a346f23 Repair ObsWheel tooltip (#3022)
* Refactor Tooltip into AddObsModal

* Update AddObsModal.tsx

* Remove unintentionally hardcoded condition

* Disallow close modal while tooltip is visible

While the tooltip is visible the modal should not be dismissed

* Reinstate logged-in triggers

* Disable tooltip for users that just signed up

Because of a bug in showing the "Account creation" pivot card the trigger here is not always set to true and so the correct behaviour of showing the tooltip is currently not possible.

* Remove buggy check for button press

* Re-position modal

* Make sure we have numbers of observations by the user

We need it to make a decision on wether to show the tooltip. If we don't have it don't show it.

* Show the modal when tooltip should be shown

With a timeout because we have a lot of overlapping modals here.

* Remove react-native-walkthrough-tooltip dependency

* Add triangle under bubble

* Update snapshot tests
2025-07-31 10:15:53 +02:00
Johannes Klein
9c0fcf1d60 Recovery from observations not uploading (#3015)
* Log app version on start

This is helpful for log files sent in from users, to see what version of he code they were actually running while errors happened.

* Add some types

* Import as types

* Remove unused param

* Update types

* Add string

* Update strings.ftl

* Add explanatory text to login screen if logging in again

* Add TODO

* Define new error class

* Throw a RecoverableError if trying to upload without token

* Do not make a new Error if caught. Instead re-throw the one caught.

This preserves the RecoverableError type if thrown.

* Update string

* Add to return info of function that handles errors

* Recover from an error that login again might fix

By sending the user to the login screen. In case of a multi-observation upload we stop the current queue because subsequent observations will also error out (and send one navigation event each).

* Update errorHandling.test.js

* Revert "Add TODO"

This reverts commit 57437f1ece.

* Add unit tests for recovery options
2025-07-18 07:58:42 +02:00