mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2025-12-23 22:18:36 -05:00
Merge branch 'main' into mob-991-firebase-record-whether-or-not-the-user-has-given-location
This commit is contained in:
@@ -244,7 +244,7 @@ describe( "Suggestions", ( ) => {
|
||||
await actor.press( observationGridItem );
|
||||
const editButton = await screen.findByLabelText( "Edit" );
|
||||
await act( async ( ) => actor.press( editButton ) );
|
||||
const addIdButton = await screen.findByText( "ID WITH AI" );
|
||||
const addIdButton = await screen.findByText( "IDENTIFY" );
|
||||
await actor.press( addIdButton );
|
||||
};
|
||||
|
||||
|
||||
@@ -189,7 +189,7 @@ const navigateToSuggestionsForObservationViaObsEdit = async observation => {
|
||||
`MyObservations.obsGridItem.${observation.uuid}`
|
||||
);
|
||||
await actor.press( observationGridItem );
|
||||
const addIdButton = await screen.findByText( "ID WITH AI" );
|
||||
const addIdButton = await screen.findByText( "IDENTIFY" );
|
||||
await actor.press( addIdButton );
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { screen, userEvent } from "@testing-library/react-native";
|
||||
import AddObsButton from "components/AddObsModal/AddObsButton";
|
||||
import AddObsButton from "components/AddObsBottomSheet/AddObsButton";
|
||||
import i18next from "i18next";
|
||||
import React from "react";
|
||||
import { renderComponent } from "tests/helpers/render";
|
||||
@@ -48,8 +48,8 @@ const longPress = async ( ) => {
|
||||
};
|
||||
|
||||
const showNoEvidenceOption = ( ) => {
|
||||
const noEvidenceButton = screen.getByLabelText(
|
||||
i18next.t( "Observation-with-no-evidence" )
|
||||
const noEvidenceButton = screen.getByTestId(
|
||||
i18next.t( "observe-without-evidence-button" )
|
||||
);
|
||||
expect( noEvidenceButton ).toBeTruthy( );
|
||||
return noEvidenceButton;
|
||||
@@ -87,7 +87,7 @@ describe( "with advanced user layout", ( ) => {
|
||||
} );
|
||||
} );
|
||||
|
||||
it( "opens AddObsModal", async ( ) => {
|
||||
it( "opens AddObsBottomSheet", async ( ) => {
|
||||
renderComponent( <AddObsButton /> );
|
||||
await regularPress( );
|
||||
showNoEvidenceOption( );
|
||||
|
||||
@@ -134,7 +134,7 @@ describe( "Suggestions", ( ) => {
|
||||
} else {
|
||||
const addIdButton = observation.taxon
|
||||
? await screen.findByLabelText( "Edit identification" )
|
||||
: await screen.findByText( "ID WITH AI" );
|
||||
: await screen.findByText( "IDENTIFY" );
|
||||
await actor.press( addIdButton );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { render, screen } from "@testing-library/react-native";
|
||||
import AddObsModal from "components/AddObsModal/AddObsModal";
|
||||
import i18next from "i18next";
|
||||
import AddObsBottomSheet from "components/AddObsBottomSheet/AddObsBottomSheet";
|
||||
import React from "react";
|
||||
|
||||
// Make sure the mock is using a recent-ish version
|
||||
@@ -13,11 +12,11 @@ jest.mock( "react-native/Libraries/Utilities/Platform", ( ) => ( {
|
||||
}
|
||||
} ) );
|
||||
|
||||
describe( "AddObsModal", ( ) => {
|
||||
describe( "AddObsBottomSheet", ( ) => {
|
||||
it( "shows the AI camera button", async ( ) => {
|
||||
render( <AddObsModal closeModal={jest.fn( )} /> );
|
||||
const aiCameraButton = screen.getByLabelText(
|
||||
i18next.t( "AI-Camera" )
|
||||
render( <AddObsBottomSheet closeModal={jest.fn( )} /> );
|
||||
const aiCameraButton = screen.getByTestId(
|
||||
"aicamera-button"
|
||||
);
|
||||
expect( aiCameraButton ).toBeOnTheScreen();
|
||||
} );
|
||||
@@ -1,8 +1,8 @@
|
||||
// Separate tests for iOS 9. AddObsModal sets some OS-specific constants at
|
||||
// Separate tests for iOS 9. AddObsBottomSheet sets some OS-specific constants at
|
||||
// load time that can't be altered at runtime, so we're using a separate test
|
||||
// with a separate mock to control those load time values.
|
||||
import { render, screen } from "@testing-library/react-native";
|
||||
import AddObsModal from "components/AddObsModal/AddObsModal";
|
||||
import AddObsBottomSheet from "components/AddObsBottomSheet/AddObsBottomSheet";
|
||||
import i18next from "i18next";
|
||||
import React from "react";
|
||||
|
||||
@@ -16,9 +16,9 @@ jest.mock( "react-native/Libraries/Utilities/Platform", () => ( {
|
||||
}
|
||||
} ) );
|
||||
|
||||
describe( "AddObsModal in iOS 9", ( ) => {
|
||||
describe( "AddObsBottomSheet in iOS 9", ( ) => {
|
||||
it( "hides AI camera button on older devices", async ( ) => {
|
||||
render( <AddObsModal closeModal={jest.fn( )} /> );
|
||||
render( <AddObsBottomSheet closeModal={jest.fn( )} /> );
|
||||
const arCameraButton = screen.queryByLabelText(
|
||||
i18next.t( "AI-Camera" )
|
||||
);
|
||||
@@ -1,5 +1,6 @@
|
||||
import { screen } from "@testing-library/react-native";
|
||||
import AddObsButton from "components/AddObsModal/AddObsButton";
|
||||
import AddObsButton from "components/AddObsBottomSheet/AddObsButton";
|
||||
import { navigationRef } from "navigation/navigationUtils";
|
||||
import React from "react";
|
||||
import * as useCurrentUser from "sharedHooks/useCurrentUser";
|
||||
import { zustandStorage } from "stores/useStore";
|
||||
@@ -7,12 +8,10 @@ import factory from "tests/factory";
|
||||
import { renderComponent } from "tests/helpers/render";
|
||||
import setStoreStateLayout from "tests/helpers/setStoreStateLayout";
|
||||
|
||||
// Mock getCurrentRoute to return ObsList
|
||||
jest.mock( "navigation/navigationUtils", () => ( {
|
||||
getCurrentRoute: () => ( {
|
||||
name: "ObsList"
|
||||
} )
|
||||
} ) );
|
||||
// Mock methods needed to get the current route
|
||||
navigationRef.isReady = jest.fn( () => true );
|
||||
navigationRef.getCurrentRoute = jest.fn( () => ( { name: "ObsList" } ) );
|
||||
navigationRef.addListener = jest.fn( () => jest.fn() );
|
||||
|
||||
const mockUser = factory( "LocalUser" );
|
||||
|
||||
@@ -34,7 +33,6 @@ describe( "AddObsButton", () => {
|
||||
// Snapshot test
|
||||
expect( screen ).toMatchSnapshot();
|
||||
} );
|
||||
|
||||
it( "does not render tooltip in default state", () => {
|
||||
renderComponent( <AddObsButton /> );
|
||||
|
||||
@@ -63,11 +61,10 @@ describe( "shows tooltip", () => {
|
||||
|
||||
renderComponent( <AddObsButton /> );
|
||||
|
||||
// Temporarily disabled the tooltip for new users, as it is freezing the app in some cases.
|
||||
// const tooltipText = await screen.findByText(
|
||||
// "Press and hold to view more options"
|
||||
// );
|
||||
// expect( tooltipText ).toBeTruthy();
|
||||
const tooltipText = await screen.findByText(
|
||||
"Press and hold to view more options"
|
||||
);
|
||||
expect( tooltipText ).toBeTruthy();
|
||||
} );
|
||||
|
||||
it( "to new users only after they dismissed the account creation card", async () => {
|
||||
@@ -89,11 +86,10 @@ describe( "shows tooltip", () => {
|
||||
}
|
||||
} );
|
||||
|
||||
// Temporarily disabled the tooltip for new users, as it is freezing the app in some cases.
|
||||
// const tooltipTextAfter = await screen.findByText(
|
||||
// "Press and hold to view more options"
|
||||
// );
|
||||
// expect( tooltipTextAfter ).toBeTruthy();
|
||||
const tooltipTextAfter = await screen.findByText(
|
||||
"Press and hold to view more options"
|
||||
);
|
||||
expect( tooltipTextAfter ).toBeTruthy();
|
||||
} );
|
||||
|
||||
it( "to logged in users with more than 50 observations after card dismissal", async () => {
|
||||
@@ -112,10 +108,9 @@ describe( "shows tooltip", () => {
|
||||
}
|
||||
} );
|
||||
|
||||
// Temporarily disabled the tooltip for new users, as it is freezing the app in some cases.
|
||||
// const tooltipTextAfter = await screen.findByText(
|
||||
// "Press and hold to view more options"
|
||||
// );
|
||||
// expect( tooltipTextAfter ).toBeTruthy();
|
||||
const tooltipTextAfter = await screen.findByText(
|
||||
"Press and hold to view more options"
|
||||
);
|
||||
expect( tooltipTextAfter ).toBeTruthy();
|
||||
} );
|
||||
} );
|
||||
@@ -152,7 +152,7 @@ exports[`AddObsButton renders correctly 1`] = `
|
||||
]
|
||||
}
|
||||
>
|
||||
|
||||
|
||||
</Text>
|
||||
</View>
|
||||
</BVLinearGradient>
|
||||
@@ -160,7 +160,7 @@ exports[`CustomTabBar with advanced user layout should render correctly 1`] = `
|
||||
]
|
||||
}
|
||||
>
|
||||
|
||||
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -40,14 +40,14 @@ const renderIdentificationSection = ( obs, index = 0, resetState = false ) => re
|
||||
);
|
||||
|
||||
describe( "IdentificationSection", () => {
|
||||
it( "should show ID WITH AI button when observation has photos", ( ) => {
|
||||
it( "should show IDENTIFY button when observation has photos", ( ) => {
|
||||
renderIdentificationSection( [observationWithPhotos] );
|
||||
expect( screen.getByText( "ID WITH AI" ) ).toBeTruthy();
|
||||
expect( screen.getByText( "IDENTIFY" ) ).toBeTruthy();
|
||||
} );
|
||||
|
||||
it( "should not show ID WITH AI button when observation has no photos", ( ) => {
|
||||
it( "should not show IDENTIFY button when observation has no photos", ( ) => {
|
||||
renderIdentificationSection( [observationWithoutPhotos] );
|
||||
expect( screen.queryByText( "ID WITH AI" ) ).toBeNull();
|
||||
expect( screen.queryByText( "IDENTIFY" ) ).toBeNull();
|
||||
} );
|
||||
|
||||
it( "should show correct iconic taxon selection when navigating multiple observations", ( ) => {
|
||||
|
||||
@@ -36,7 +36,7 @@ exports[`ActivityCount renders reliably 1`] = `
|
||||
]
|
||||
}
|
||||
>
|
||||
|
||||
|
||||
</Text>
|
||||
<Text
|
||||
maxFontSizeMultiplier={2}
|
||||
|
||||
@@ -36,7 +36,7 @@ exports[`CommentsCount renders default reliably 1`] = `
|
||||
]
|
||||
}
|
||||
>
|
||||
|
||||
|
||||
</Text>
|
||||
<Text
|
||||
maxFontSizeMultiplier={2}
|
||||
@@ -111,7 +111,7 @@ exports[`CommentsCount renders filled reliably 1`] = `
|
||||
]
|
||||
}
|
||||
>
|
||||
|
||||
|
||||
</Text>
|
||||
<Text
|
||||
maxFontSizeMultiplier={2}
|
||||
@@ -186,7 +186,7 @@ exports[`CommentsCount renders white reliably 1`] = `
|
||||
]
|
||||
}
|
||||
>
|
||||
|
||||
|
||||
</Text>
|
||||
<Text
|
||||
maxFontSizeMultiplier={2}
|
||||
|
||||
@@ -36,7 +36,7 @@ exports[`IdentificationsCount renders default reliably 1`] = `
|
||||
]
|
||||
}
|
||||
>
|
||||
|
||||
|
||||
</Text>
|
||||
<Text
|
||||
maxFontSizeMultiplier={2}
|
||||
@@ -111,7 +111,7 @@ exports[`IdentificationsCount renders filled reliably 1`] = `
|
||||
]
|
||||
}
|
||||
>
|
||||
|
||||
|
||||
</Text>
|
||||
<Text
|
||||
maxFontSizeMultiplier={2}
|
||||
@@ -186,7 +186,7 @@ exports[`IdentificationsCount renders white reliably 1`] = `
|
||||
]
|
||||
}
|
||||
>
|
||||
|
||||
|
||||
</Text>
|
||||
<Text
|
||||
maxFontSizeMultiplier={2}
|
||||
|
||||
@@ -87,7 +87,7 @@ exports[`INatIconButton renders correctly 1`] = `
|
||||
]
|
||||
}
|
||||
>
|
||||
|
||||
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -117,7 +117,7 @@ exports[`ObsGridItem for an observation with a photo should render 1`] = `
|
||||
]
|
||||
}
|
||||
>
|
||||
|
||||
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
@@ -361,7 +361,7 @@ exports[`ObsGridItem for an observation without a photo should render 1`] = `
|
||||
]
|
||||
}
|
||||
>
|
||||
|
||||
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -101,7 +101,7 @@ exports[`UploadStatus displays complete icon when progress is 1 1`] = `
|
||||
]
|
||||
}
|
||||
>
|
||||
|
||||
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
@@ -195,7 +195,7 @@ exports[`UploadStatus displays progress bar when progress is greater than 5% 1`]
|
||||
]
|
||||
}
|
||||
>
|
||||
|
||||
|
||||
</Text>
|
||||
</View>
|
||||
<CircularProgress
|
||||
@@ -285,7 +285,7 @@ exports[`UploadStatus displays rotating circle progress when upload is queued bu
|
||||
]
|
||||
}
|
||||
>
|
||||
|
||||
|
||||
</Text>
|
||||
</View>
|
||||
<View
|
||||
@@ -341,7 +341,7 @@ exports[`UploadStatus displays rotating circle progress when upload is queued bu
|
||||
]
|
||||
}
|
||||
>
|
||||
|
||||
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
@@ -489,7 +489,7 @@ exports[`UploadStatus displays start icon when upload is unsynced and not queued
|
||||
]
|
||||
}
|
||||
>
|
||||
|
||||
|
||||
</Text>
|
||||
</View>
|
||||
<View
|
||||
@@ -545,7 +545,7 @@ exports[`UploadStatus displays start icon when upload is unsynced and not queued
|
||||
]
|
||||
}
|
||||
>
|
||||
|
||||
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -255,7 +255,7 @@ exports[`TaxonResult should render correctly 1`] = `
|
||||
]
|
||||
}
|
||||
>
|
||||
|
||||
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
@@ -511,7 +511,7 @@ exports[`TaxonResult should render correctly 1`] = `
|
||||
]
|
||||
}
|
||||
>
|
||||
|
||||
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
@@ -606,7 +606,7 @@ exports[`TaxonResult should render correctly 1`] = `
|
||||
]
|
||||
}
|
||||
>
|
||||
|
||||
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -20,6 +20,6 @@ exports[`INatIcon renders correctly 1`] = `
|
||||
]
|
||||
}
|
||||
>
|
||||
|
||||
|
||||
</Text>
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user