Skip to content

test: add comprehensive onboarding spotlight flow tests - #85

Closed
alichherawalla wants to merge 6 commits into
mainfrom
test/onboarding-spotlight-coverage
Closed

alichherawalla wants to merge 6 commits into
mainfrom
test/onboarding-spotlight-coverage

Conversation

@alichherawalla

Copy link
Copy Markdown
Collaborator

Summary

  • Adds 175 tests across 11 test suites covering all 6 onboarding spotlight flows
  • Tests span 3 layers: unit tests, integration tests, and RNTL render-based screen tests
  • Fixes cross-tab navigation timing (600ms → 800ms) in handleStepPress to allow sheet-close + tab-switch animation to complete before spotlight fires

Test Coverage

Layer Suites Tests What's tested
Unit 5 ~87 Tooltip content, handleStepPress logic, ChatScreen spotlight coordination, reactive spotlight conditions, step config validation
Integration 1 ~19 Full flow lifecycle, cross-flow interactions, reset behavior, step-to-flow mapping
RNTL Screen 5 ~69 HomeScreen (goTo + reactive effects), ChatsListScreen (reactive step 14), ChatScreen (pending consumption + chains + reactive 15/16), ModelSettingsScreen (step 6), ProjectEditScreen (step 8)

Files Changed

  • src/screens/HomeScreen/index.tsx — Timing fix (600ms → 800ms for cross-tab)
  • 6 new unit test files in __tests__/unit/onboarding/
  • 1 new integration test file in __tests__/integration/onboarding/
  • 5 new RNTL test files in __tests__/rntl/onboarding/
  • 1 existing test file lint fix

Test plan

  • All 175 onboarding tests pass
  • Full test suite (3716 tests) passes
  • TypeScript compiles clean
  • Lint passes (remaining errors are pre-existing from previous commit)

github-actions Bot and others added 6 commits February 26, 2026 09:26
…uide

- Remove completed items from TODO (document upload, PDF support, image
  gen fix, resolved test issues) — only future work remains
- Add Testing section to README with test commands and codecov badge
- Add scripts/test-count.sh to dynamically count tests across all
  platforms (Jest, Android JUnit, iOS XCTest, Maestro E2E)
- Add test:count npm script
- Update CODEBASE_GUIDE directory structure to reflect refactored
  components (ChatInput/, ChatMessage/, checklist/, onboarding/) and
  screens (HomeScreen/, ChatScreen/, ModelsScreen/) into subdirectories
- Add @react-native-documents/picker and viewer to platform services table

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Update CI workflow to count tests across all platforms (Jest, Android
  JUnit, iOS XCTest) and publish total via schneegans/dynamic-badges-action
- Add CI status badge and dynamic test count badge to README Testing section
- Remove hardcoded test count, replace with shields.io endpoint badge
  updated automatically on every push to main
- Badge requires GIST_SECRET and TEST_BADGE_GIST_ID to be configured
  in repo settings

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move all sub-screens (Chat, ProjectDetail, ProjectEdit, ModelSettings,
VoiceSettings, DeviceInfo, StorageSettings, SecuritySettings) from
nested tab stacks into the RootStack. Tabs now point directly to their
screen components instead of wrapping sub-stack navigators.

Key changes:
- Remove ChatsStack, ProjectsStack, ModelsStack, SettingsStack navigators
- Merge all screen params into RootStackParamList, simplify MainTabParamList
- Use CompositeNavigationProp for tab-hosted screens navigating to RootStack
- Fix SettingsScreen reset onboarding: getParent()?.dispatch() (Tab→RootStack)
- Add useFocusEffect to ModelsScreen to reset detail view on tab blur
- Collapse (not unmount) ModelsScreen chrome during detail to keep AttachSteps mounted
- Add back buttons to ChatScreen's NoModelScreen and LoadingScreen
- Move SpotlightTourProvider from MainTabs to RootStack level so all screens
  (including Chat, ProjectEdit, ModelSettings) can use useSpotlightTour()
- Update test mocks for flattened navigation structure

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add 6 new spotlight steps (indices 11-16) and reactive spotlight system:
- Flow 2: step 11 highlights first model in picker sheet (animated border)
- Flow 3: step 12 chains to voice input hint after ChatInput spotlight
- Flow 4: steps 13-16 guide through image gen (load model, new chat, draw, settings)

Key changes:
- Add shownSpotlights store for one-shot reactive spotlight tracking
- Conditional AttachStep mounting (one at a time) to prevent waypoint dots/lines
- MaybeAttachStep wrapper avoids ChatInput remounting during step chains
- Pulsating border in ModelPickerSheet (AttachStep can't work inside Modal)
- triedImageGen completion now requires actual image generation, not just download
- 32 new unit tests covering all flows, reactive conditions, and reset behavior

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds 11 test suites covering all 6 onboarding flows across 3 testing layers:

Unit tests:
- spotlightTooltips: tooltip content matches spec for all 17 steps
- handleStepPress: pending spotlight queuing, navigation, timing delays
- chatScreenSpotlight: step 3→12 chaining, chainingRef guard, AttachStep mapping
- reactiveSpotlightConditions: boolean guards for reactive steps 13-16
- onboardingFlows: step count, shape, render function validation

Integration tests:
- spotlightFlowIntegration: full lifecycle of all 6 flows, cross-flow
  interactions, reset behavior, step-to-flow mapping

RNTL render-based integration tests:
- HomeScreenSpotlight: handleStepPress renders with correct goTo calls,
  reactive imageLoad spotlight (step 13), 800ms/600ms timing
- ChatsListScreenSpotlight: reactive imageNewChat spotlight (step 14)
- ChatScreenSpotlight: pending step consumption, step 3→12 chain,
  reactive imageDraw (step 15) and imageSettings (step 16)
- ModelSettingsScreenSpotlight: pending step 6 consumption on mount
- ProjectEditScreenSpotlight: pending step 8 consumption on mount

Also fixes cross-tab navigation timing (600ms → 800ms) in handleStepPress
to allow sheet-close + tab-switch animation to complete before spotlight.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@alichherawalla
alichherawalla deleted the test/onboarding-spotlight-coverage branch March 1, 2026 03:55
@sonarqubecloud

sonarqubecloud Bot commented Mar 1, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
6.4% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the stability and reliability of the application's onboarding spotlight flows by introducing a comprehensive suite of tests. It also includes crucial timing adjustments for navigation, ensuring a smoother user experience during onboarding. The changes streamline the navigation architecture and update documentation to reflect the new testing capabilities.

Highlights

  • Comprehensive Onboarding Spotlight Tests: Added 175 new tests across 11 test suites, covering all 6 onboarding spotlight flows. These tests span unit, integration, and React Native Testing Library (RNTL) render-based screen tests, ensuring the robustness of the onboarding experience.
  • Onboarding Flow Logic Refinements: Implemented detailed logic for multi-step spotlight sequencing, reactive triggers based on app state, and proper coordination between screens. This includes handling pending spotlights, chaining steps, and tracking shown spotlights to prevent repeats.
  • Navigation Timing Fix: Adjusted the cross-tab navigation timing in handleStepPress from 600ms to 800ms. This ensures that the sheet-close and tab-switch animations complete before the next spotlight fires, improving the user experience.
  • Documentation and Tooling Updates: Updated README.md with a new 'Testing' section and added a test-count.sh script to summarize test coverage across platforms. The TODO.md was also cleaned up to reflect completed tasks.
  • Navigation Structure Simplification: Refactored the app's navigation by flattening nested stack navigators into the root stack, simplifying navigation calls and making the overall structure more streamlined.
Changelog
  • README.md
    • Added a new 'Testing' section with CI/codecov badges and test commands.
  • TODO.md
    • Removed outdated tasks related to document upload, image generation, and testing improvements.
  • tests/integration/onboarding/spotlightFlowIntegration.test.ts
    • Added a new integration test file for onboarding spotlight flow coordination, covering all 6 flows and cross-flow interactions.
  • tests/rntl/onboarding/ChatScreenSpotlight.test.tsx
    • Added a new RNTL test file for ChatScreen spotlight integration, covering pending step consumption and reactive spotlights.
  • tests/rntl/onboarding/ChatsListScreenSpotlight.test.tsx
    • Added a new RNTL test file for ChatsListScreen spotlight integration, focusing on reactive spotlights.
  • tests/rntl/onboarding/HomeScreenSpotlight.test.tsx
    • Added a new RNTL test file for HomeScreen spotlight integration, covering handleStepPress logic and reactive spotlights.
  • tests/rntl/onboarding/ModelSettingsScreenSpotlight.test.tsx
    • Added a new RNTL test file for ModelSettingsScreen spotlight integration, focusing on pending spotlight consumption.
  • tests/rntl/onboarding/ProjectEditScreenSpotlight.test.tsx
    • Added a new RNTL test file for ProjectEditScreen spotlight integration, focusing on pending spotlight consumption.
  • tests/rntl/screens/HomeScreen.test.tsx
    • Updated navigation calls to directly navigate to the 'Chat' screen.
    • Adjusted image count display logic to show 'image' or 'images' without the count.
  • tests/rntl/screens/ProjectDetailScreen.test.tsx
    • Updated navigation calls to directly navigate to the 'Chat' screen.
    • Removed getParent() calls for navigation.
  • tests/rntl/screens/SettingsScreen.test.tsx
    • Updated useAppStore mock to include onboarding checklist functions.
    • Simplified navigation dispatch by removing an extra getParent() call.
  • tests/unit/onboarding/chatScreenSpotlight.test.ts
    • Added a new unit test file for ChatScreen spotlight coordination logic.
  • tests/unit/onboarding/handleStepPress.test.ts
    • Added a new unit test file for handleStepPress logic.
  • tests/unit/onboarding/onboardingFlows.test.ts
    • Added a new unit test file for overall onboarding flow logic, including step configuration, pending state, and completion criteria.
  • tests/unit/onboarding/reactiveSpotlightConditions.test.ts
    • Added a new unit test file for reactive spotlight conditions.
  • tests/unit/onboarding/spotlightTooltips.test.ts
    • Added a new unit test file for spotlight tooltip content.
  • tests/utils/testHelpers.ts
    • Added new fields to appStore reset for onboarding state (shownSpotlights, onboardingChecklist, checklistDismissed).
  • docs/onboarding/ONBOARDING_FLOWS.md
    • Added a new documentation file detailing onboarding checklist flows, sequences, completion criteria, and system mechanics.
  • docs/standards/CODEBASE_GUIDE.md
    • Updated dependencies to include document picker/viewer.
    • Reorganized screen component structure in the codebase guide.
  • ios/Podfile.lock
    • Updated to include RNSVG dependency.
  • jest.setup.ts
    • Added mocks for react-native-gesture-handler and react-native-spotlight-tour.
  • package-lock.json
    • Updated dependencies for react-native-onboarding-checklist, react-native-spotlight-tour, react-native-svg, and related packages.
  • package.json
    • Added test:count script.
    • Added new dependencies: react-native-onboarding-checklist, react-native-spotlight-tour, react-native-svg.
  • scripts/test-count.sh
    • Added a new shell script to count tests across platforms.
  • src/components/ChatInput/index.tsx
    • Modified to accept activeSpotlight prop.
    • Conditionally wrapped action buttons with AttachStep for spotlight integration.
  • src/components/checklist/ProgressBar.tsx
    • Added a new component for the onboarding checklist progress bar.
  • src/components/checklist/animations.ts
    • Added new animation hooks (useStaggeredEntrance, useCheckmark, useStrikethrough, useProgressAnimation) for checklist items.
  • src/components/checklist/index.ts
    • Exported new checklist components and hooks.
  • src/components/checklist/types.ts
    • Defined types for onboarding steps and checklist theme.
  • src/components/checklist/useOnboardingSteps.ts
    • Added new hooks (useOnboardingSteps, useChecklistTheme, useAutoDismiss) for managing onboarding steps and theme.
  • src/components/index.ts
    • Exported new onboarding components (OnboardingSheet, PulsatingIcon, useOnboardingSheet) and spotlight utilities.
  • src/components/onboarding/OnboardingSheet.tsx
    • Added a new component for the onboarding bottom sheet.
  • src/components/onboarding/PulsatingIcon.tsx
    • Added a new component for a pulsating icon.
  • src/components/onboarding/index.ts
    • Exported new onboarding components and spotlight utilities.
  • src/components/onboarding/spotlightConfig.tsx
    • Added a new file defining all 17 spotlight steps and their tooltips.
  • src/components/onboarding/spotlightState.ts
    • Added a new file for module-level state to coordinate multi-step spotlights.
  • src/components/onboarding/useOnboardingSheet.ts
    • Added a new hook for managing the onboarding sheet visibility and auto-opening behavior.
  • src/navigation/AppNavigator.tsx
    • Refactored navigation to use a single stack for all screens, simplifying the structure.
    • Wrapped the entire app in SpotlightTourProvider to enable global spotlight access.
    • Simplified tab navigators by directly using screen components instead of nested stacks.
  • src/navigation/types.ts
    • Simplified navigation types by flattening stack navigators into the root stack.
  • src/screens/ChatScreen/ChatScreenComponents.tsx
    • Updated NoModelScreen and LoadingScreen to receive navigation prop for back button functionality.
  • src/screens/ChatScreen/index.tsx
    • Implemented onboarding spotlight logic, including pending step consumption, chaining to subsequent steps, and reactive spotlights for image generation.
    • Integrated AttachStep components for various spotlight targets.
  • src/screens/ChatScreen/useChatScreen.ts
    • Updated navigation type to RootStackParamList.
  • src/screens/ChatsListScreen.tsx
    • Implemented reactive spotlight for the 'New Chat' button (step 14) when an image model is loaded.
    • Wrapped the 'New' button with AttachStep for spotlight integration.
  • src/screens/HomeScreen/components/ActiveModelsSection.tsx
    • Wrapped TextModelCard and ImageModelCard with AttachStep for spotlights (steps 1 and 13).
  • src/screens/HomeScreen/components/ModelPickerSheet.tsx
    • Implemented a pulsating border for the first model picker item (step 11) as a visual hint for onboarding, replacing AttachStep due to modal limitations.
  • src/screens/HomeScreen/hooks/useHomeScreen.ts
    • Updated navigation type to CompositeNavigationProp for better type safety.
    • Simplified navigation calls to directly navigate to the 'Chat' screen.
  • src/screens/HomeScreen/index.tsx
    • Implemented handleStepPress logic for onboarding checklist items, including navigation and spotlight delays.
    • Integrated reactive spotlight for image load (step 13).
    • Integrated OnboardingSheet and PulsatingIcon for the onboarding checklist UI.
    • Adjusted image gallery text to show 'image' or 'images' without the count.
  • src/screens/HomeScreen/styles.ts
    • Updated header styles to accommodate the pulsating onboarding icon.
  • src/screens/ModelSettingsScreen/index.tsx
    • Implemented pending spotlight consumption for the model settings accordion (step 6).
    • Wrapped the 'Default System Prompt' accordion with AttachStep.
  • src/screens/ModelsScreen/TextModelsTab.tsx
    • Implemented pending spotlight consumption for model detail (step 9) and download manager (step 10).
    • Wrapped model cards with AttachStep for spotlight integration.
  • src/screens/ModelsScreen/index.tsx
    • Integrated AttachStep for the 'Image Models' tab (step 4) and 'Download Manager' icon (step 10).
    • Added useFocusEffect to reset model selection when the tab loses focus.
  • src/screens/ModelsScreen/types.ts
    • Updated navigation type to CompositeNavigationProp.
  • src/screens/ProjectDetailScreen.tsx
    • Simplified navigation calls to directly navigate to the 'Chat' screen.
  • src/screens/ProjectEditScreen.tsx
    • Implemented pending spotlight consumption for the project name input (step 8).
    • Wrapped the project name TextInput with AttachStep.
  • src/screens/ProjectsScreen.tsx
    • Wrapped the 'New' project button with AttachStep (step 7).
  • src/screens/SettingsScreen.tsx
    • Implemented completeChecklistStep for 'exploredSettings' on mount.
    • Simplified navigation dispatch to the root stack.
    • Wrapped the navigation section with AttachStep (step 5).
    • Added a 'Reset Onboarding Checklist' button for development purposes.
  • src/services/imageGenerationService.ts
    • Added completeChecklistStep('triedImageGen') call after successful image generation.
  • src/stores/appStore.ts
    • Added new state for onboardingChecklist, checklistDismissed, and shownSpotlights.
    • Added new actions: completeChecklistStep, dismissChecklist, resetChecklist, markSpotlightShown, resetShownSpotlights.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/ci.yml
Activity
  • The pull request adds 175 new tests, bringing the total test count to 3716, all of which are passing.
  • TypeScript compiles cleanly, and linting checks are passing for the new code.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a comprehensive onboarding spotlight tour to guide new users through the app's core features. It includes a significant and beneficial refactoring of the navigation structure, flattening nested stacks into a single root stack, which simplifies navigation logic. The implementation of the onboarding flows, including multi-step and reactive spotlights, is well-architected. A vast suite of 175 new tests (unit, integration, and RNTL) has been added, providing excellent coverage for the new functionality. My review found one minor issue in a test case that was missing an assertion, which I've commented on. Overall, this is an excellent and high-quality contribution.

Comment on lines +319 to +321
// Step 12 should be called (chained)
// Note: This depends on `current` being reactive in the mock
// If the mock's `current` getter is called during re-render, it works

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This test case is missing an assertion to verify that the chained spotlight step is actually triggered. The comment // Step 12 should be called (chained) suggests this is the intent, but there's no expect call to confirm it. Please add an assertion to complete the test and ensure it correctly validates the chaining behavior.

Suggested change
// Step 12 should be called (chained)
// Note: This depends on `current` being reactive in the mock
// If the mock's `current` getter is called during re-render, it works
// Step 12 should be called (chained)
expect(mockGoTo).toHaveBeenCalledWith(12);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant