Skip to content

Commit 0396782

Browse files
tyler-daneCopilot
andauthored
feat: simplify onboarding (#1404)
* feat(web): add tests for onboarding improvements - Add tests for task-seeding.util - Add tests for CmdPaletteTutorial component - Add tests for OnboardingOverlay component - Add tests for AuthPrompt component - Add tests for useOnboardingOverlays hook * fix(web): skip task seeding in test environment - Only seed tasks when not in test environment - Prevents seeded tasks from interfering with existing tests * fix(web): fix test for cmd+k keyboard event handling - Fix keyboard event simulation in CmdPaletteTutorial test - Dispatch event to window instead of document - Properly set modifier key properties for cross-platform support * fix(backend): prevent duplicate instance when COUNT is specified in rrule - Check if COUNT is specified before adding extra dtstart instance - Improve timezone comparison to handle precision issues - Fixes test failure where 707 instances were generated instead of 706 * refactor(web): extract onboarding useEffects into separate custom hooks - Extract useOnboardingOverlay hook with tests - Extract useCmdPaletteTutorial hook with tests - Extract useAuthPrompt hook with tests - Refactor useOnboardingOverlays to compose the three hooks - Add comprehensive tests for each hook - Fix timing issues in tests with fake timers and act * fix(web): fix failing onboarding tests - Fix useOnboardingOverlay test by resetting mock before test - Fix useCmdPaletteTutorial test by using proper waitFor with real timers - Fix OnboardingOverlay component tests to match actual component text - All tests now passing * feat(web): implement command palette guide for onboarding - Add CmdPaletteGuide component to provide step-by-step instructions for using the command palette. - Integrate guide into DayViewContent and NowView components, displaying it conditionally based on the current view. - Create custom hooks for managing guide state and detecting completion of each step. - Update storage constants to track completion status of the command palette guide. - Refactor OnboardingFlow to redirect to the day view upon completion, enhancing user experience. * feat(web): enhance onboarding with command palette guide tests - Add tests for CmdPaletteGuide component to validate rendering and functionality across different steps. - Implement tests for useCmdPaletteGuide, useStep1Detection, useStep2Detection, and useStep3Detection hooks to ensure correct behavior during onboarding. - Include checks for task creation, navigation detection, and description editing to enhance user experience during onboarding. - Ensure all new tests are passing and cover various scenarios for the command palette guide. * refactor(web): remove OnboardingOverlay component and integrate CmdPaletteGuide - Deleted the OnboardingOverlay component and its associated tests to streamline onboarding functionality. - Updated the useOnboardingOverlay hook to manage visibility based on the CmdPaletteGuide's state. - Refactored DayViewContent and NowView components to utilize CmdPaletteGuide for onboarding instructions. - Adjusted local storage handling to track completion status of the command palette guide instead of the onboarding overlay. - Enhanced tests for onboarding overlays to reflect the new structure and ensure correct behavior across different user scenarios. * feat(web): enhance onboarding guide with step completion tracking - Introduced new utility functions for managing completed steps in localStorage, including marking steps as completed, loading completed steps, and clearing them. - Updated the CmdPaletteGuide component and associated hooks to utilize the new step completion tracking, improving the onboarding experience. - Refactored step detection hooks to skip detection if a step is already completed, optimizing performance and user experience. - Added comprehensive tests for the new onboarding storage utilities to ensure correct functionality and data integrity. - Migrated existing completion flags to the new storage structure, ensuring backward compatibility. * feat(web): refactor onboarding storage management and enhance progress tracking - Introduced a new schema for onboarding progress using Zod, consolidating storage management into a single structure. - Updated utility functions to handle onboarding progress, including getting and updating progress, ensuring data integrity. - Refactored components and hooks to utilize the new onboarding progress structure, replacing localStorage interactions with centralized updates. - Enhanced tests to validate the new onboarding progress functionality and ensure correct behavior across various scenarios. - Removed deprecated localStorage keys and migration logic, streamlining the onboarding experience. * feat(web): update CmdPaletteGuide to display contextual welcome messages - Refactored CmdPaletteGuide component to show dynamic welcome messages based on the current view (Day View or Now View). - Updated tests to validate the correct rendering of welcome messages and ensure that the previous default message ("Welcome to Compass") is no longer displayed. - Enhanced test coverage for different views to confirm the onboarding experience aligns with user expectations. * feat(web): extend CmdPaletteGuide with step 4 and enhance onboarding experience - Added support for a new step (Step 4) in the CmdPaletteGuide component, providing users with additional instructions for editing reminders. - Updated the onboarding logic to accommodate the new step, including modifications to hooks and utility functions for step completion tracking. - Enhanced tests to validate the correct functionality of the new step and ensure comprehensive coverage of the onboarding process. - Adjusted progress indicators and messages to reflect the addition of the fourth step, improving user guidance throughout the onboarding experience. * feat(web): refactor onboarding steps to use constants for improved clarity - Updated onboarding logic to utilize ONBOARDING_STEPS constants for step tracking, enhancing code readability and maintainability. - Refactored related hooks and components to replace numeric step identifiers with descriptive constants, ensuring consistency across the onboarding experience. - Enhanced tests to validate the new constant-based approach, confirming correct functionality and step completion tracking. - Adjusted utility functions for onboarding progress to align with the new structure, improving data integrity and clarity in step management. * feat(web): enhance onboarding experience with new steps and improved detection - Introduced new onboarding steps for CmdPaletteGuide, including steps 5 and 6, to guide users through using the command palette and navigating to the week view. - Updated related hooks and components to manage the new steps, ensuring a cohesive onboarding experience. - Enhanced utility functions for onboarding progress tracking, incorporating new steps into the existing structure. - Added comprehensive tests for the new steps and detection logic, validating correct functionality and user guidance throughout the onboarding process. - Refactored existing tests to accommodate the changes and ensure robust coverage of the onboarding experience. * refactor(web): standardize onboarding storage utilities and improve step detection - Renamed onboarding storage utility functions for clarity and consistency, transitioning from `onboardingStorage.util` to `onboarding.storage.util`. - Consolidated step detection logic into a unified hook, enhancing maintainability and reducing redundancy across onboarding steps. - Updated related components and tests to reflect the new utility structure, ensuring comprehensive coverage and functionality. - Removed deprecated step detection hooks, streamlining the onboarding process and improving performance. - Enhanced tests for onboarding storage utilities to validate the new structure and ensure correct behavior across various scenarios. * fix(web): update CmdPaletteGuide step counts and remove deprecated step - Adjusted step counts in CmdPaletteGuide tests and component to reflect the correct total of 5 steps instead of 6. - Removed the deprecated CMD_PALETTE_INFO step from onboarding constants and related logic, streamlining the onboarding process. - Updated tests to ensure accurate step completion tracking and validate the new structure. * feat(web): integrate CmdPaletteGuide into CalendarView and enhance success message handling - Added CmdPaletteGuide component to CalendarView for improved onboarding experience. - Updated CmdPaletteGuide to manage success message visibility based on user interaction, allowing users to dismiss the message. - Enhanced step detection logic to prevent duplicate completions, ensuring accurate onboarding progress tracking. * feat(web): integrate CmdPaletteGuide into AuthenticatedLayout and enhance onboarding interactions - Added CmdPaletteGuide component to AuthenticatedLayout to improve user onboarding experience across authenticated routes. - Updated CmdPalette interactions in Calendar, Day, and Now views to reset onboarding progress and dispatch a restart event when "Re-do onboarding" is clicked. - Refactored related components and tests to ensure consistent onboarding behavior and validate the new functionality. - Enhanced onboarding storage utilities to support resetting progress, ensuring a seamless user experience during onboarding. * Update packages/web/src/auth/UserProvider.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix(web): address PR review comments for onboarding flow - Refine auth prompt trigger to wait for command palette close - Improve date navigation tracking in DayView - Update SocketProvider to react to auth state changes using useUser - Fix UserProvider loading logic and export useUser hook - Add tests for GuestLayout and fix existing test issues - Clean up redundant comments and improve env checks in loaders * refactor(web): improve useAuthPrompt and extract useUser hook - Refactor `useAuthPrompt` to use a single useEffect for tracking palette state and visibility logic - Extract `useUser` hook and `UserContext` into separate files - Update `UserProvider` and consumers to use the new `useUser` hook location - Add tests for `useUser` hook * chore: revert `gcal.event.rrule.ts` * chore: add dexie and dexie-react-hooks dependencies to package.json * chore: add baseline-browser-mapping and fake-indexeddb dependencies to package.json * feat(web): enhance event creation saga for unauthenticated users - Implement logic to save events to IndexedDB when users are not authenticated. - Update saga to check session existence before making API calls. - Add tests to verify event saving and state management for unauthenticated scenarios. * feat(web): add unit tests for getUserId function in auth.util - Implement tests for getUserId to handle session existence checks. - Verify behavior for unauthenticated users and session check errors. - Ensure correct userId retrieval when session is active. * feat(web): implement IndexedDB storage for events and enhance saga for unauthenticated users - Add CompassLocalDB for managing events in IndexedDB. - Implement utility functions for saving, loading, deleting, and clearing events in IndexedDB. - Update getSomedayEvents saga to load events from IndexedDB for unauthenticated users. - Add comprehensive unit tests for event storage utilities and sagas. - Introduce a new constant for unauthenticated user handling. * test(web): enhance tests for Sidebar interactions and session handling - Update Sidebar interactions test to include EUROPE_TRIP event. - Mock session existence check in web.test.start.ts to ensure consistent test behavior. - Refactor preloaded state for event updates in Sidebar tests. - Improve server mock responses for event fetching based on query parameters. * feat(web): implement EventRepository with local and remote storage handling - Add EventRepository interface for managing event operations including create, get, edit, delete, and reorder. - Implement LocalEventRepository and RemoteEventRepository with corresponding methods for IndexedDB and API interactions. - Introduce comprehensive unit tests for both repositories to ensure functionality and data integrity. * feat(web): add event repository utilities for local and remote storage - Introduce LocalEventRepository and RemoteEventRepository classes implementing the EventRepository interface for managing event data. - Implement utility functions for creating, retrieving, editing, deleting, and reordering events in both local IndexedDB and remote API contexts. - Add comprehensive unit tests to validate functionality and ensure data integrity across both repository implementations. - Create utility functions for session-based repository selection and React hooks for easy access in components. * refactor(tests): remove Calendar.render.test.tsx file - Delete the Calendar.render.test.tsx test file as it is no longer needed. - This cleanup helps streamline the test suite and maintain focus on relevant tests. * feat(tests): add unit tests for LocalEventRepository and LocalTaskRepository - Introduce comprehensive unit tests for LocalEventRepository, covering create, get, edit, delete, and reorder functionalities. - Implement unit tests for LocalTaskRepository, validating task retrieval, saving, deletion, and reordering operations. - Utilize factory functions to create test events and tasks with sensible defaults, ensuring robust test coverage. - Mock storage utilities to isolate tests and verify interactions with the local storage layer. * Update packages/web/src/routers/loaders.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix(tests): remove showCmdPaletteTutorial from useAuthPrompt test - Eliminate the showCmdPaletteTutorial property from the test setup in useAuthPrompt.test.tsx to streamline the test configuration. - This change helps maintain focus on relevant test scenarios and improves clarity in the test structure. * Update packages/web/src/common/repositories/event/event.repository.interface.test.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * feat(tests): refactor Jest configuration to support multiple projects - Introduced a modular Jest configuration that dynamically selects projects (core, web, backend, scripts) based on command-line arguments. - Consolidated project-specific settings into individual project configurations for improved maintainability and clarity. - Enhanced module name mapping and setup files for each project to streamline testing processes. * feat(onboarding): implement DayOnboardingOverlays component and related tests - Introduced the DayOnboardingOverlays component to manage onboarding prompts based on user tasks and onboarding progress. - Added unit tests for DayOnboardingOverlays to verify rendering behavior based on onboarding state. - Refactored useOnboardingOverlays hook to utilize useOnboardingProgress for tracking navigation state. - Updated DayView and DayViewContent components to integrate the new onboarding overlays functionality. - Created useOnboardingProgress hook to track date navigation for onboarding purposes. * feat(onboarding): integrate onboarding overlays and related components - Added OnboardingOverlayHost and OnboardingNoticeCard components to manage and display onboarding notices. - Removed the DayOnboardingOverlays component and its associated tests to streamline onboarding logic. - Updated AuthenticatedLayout to include the new OnboardingOverlayHost for improved user onboarding experience. - Implemented useAuthPrompt and useOnboardingNotices hooks to manage the visibility of onboarding prompts based on user interactions. - Added unit tests for the new onboarding components and hooks to ensure functionality and correctness. * feat(onboarding): enhance CmdPaletteGuide with dynamic instructions and view handling - Refactored CmdPaletteGuide to utilize a new structure for onboarding instructions based on the current view. - Introduced utility functions to determine the guide view from the pathname and generate contextual welcome messages. - Updated onboarding step configurations to include visibility rules and instructions tailored for different views (day, now, week). - Added new tests to ensure the CmdPaletteGuide renders the correct instructions based on the onboarding state and view. - Removed deprecated code related to step instructions to streamline the component. * feat(onboarding): introduce NAVIGATE_TO_DAY step and update onboarding flow - Added NAVIGATE_TO_DAY step to the onboarding process, enhancing user guidance for navigating to the Day view. - Updated CmdPaletteGuide to reflect changes in step progression and instructions based on the new onboarding structure. - Refactored onboarding step configurations to accommodate the new step and ensure correct visibility and instructions. - Adjusted tests to validate the new onboarding flow, ensuring that the guide correctly reflects the current step and user progress. - Streamlined onboarding logic by removing deprecated instructions and enhancing the overall user experience. * refactor(onboarding): streamline CmdPaletteGuide and onboarding step configurations - Removed deprecated visibility rules and unnecessary tests from CmdPaletteGuide to simplify the onboarding logic. - Updated onboarding step configurations to include route prefixes for better route detection. - Enhanced the CmdPaletteGuide component to conditionally render based on the onboarding state and user progress. - Adjusted tests to reflect changes in the onboarding flow and ensure accurate rendering of instructions based on the current view. * refactor(event): remove isOptimistic flag from event handling - Eliminated the isOptimistic property from the addId function and related tests to simplify event structure. - Updated sagas to reflect the removal of the isOptimistic flag, ensuring consistent event handling across the application. - Adjusted tests to align with the new event structure, maintaining clarity and focus on essential properties. * refactor(event): simplify event saga by removing unauthenticated user handling - Removed the check for session existence in the getEvents saga, which returned empty data for unauthenticated users. - This change streamlines the event retrieval process and focuses on authenticated user scenarios. * feat(auth): add AUTH_PROMPT_DISMISSED key to local storage management - Introduced AUTH_PROMPT_DISMISSED constant to storage.constants.ts for better management of the auth prompt dismissal state. - Updated AuthPrompt component to set the dismissal state in local storage instead of using the previous onboarding progress utility. - Refactored related tests to validate the new local storage approach for managing the auth prompt dismissal. - Enhanced useAuthPrompt hook to check local storage for the dismissal state, streamlining the onboarding experience. * feat(auth): refactor local storage management for authentication states - Introduced utility functions for managing authentication-related states in local storage, consolidating the logic for hasCompletedSignup, skipOnboarding, and authPromptDismissed. - Updated hooks and components to utilize the new storage utility functions, enhancing code clarity and maintainability. - Refactored tests to validate the new approach to local storage management, ensuring accurate state handling across the application. * feat(auth): implement useIsSignupComplete hook and refactor onboarding storage - Introduced the useIsSignupComplete hook to manage and check the signup completion state using local storage. - Refactored local storage management for onboarding progress, consolidating related states into a single structure. - Removed the deprecated useHasCompletedSignup hook and its associated tests to streamline the codebase. - Updated components and tests to utilize the new onboarding storage utilities, ensuring accurate state handling across the application. - Enhanced the onboarding experience by integrating the new hook into relevant components and updating local storage interactions. * feat(auth): update authentication flow to redirect to Day view - Refactored authentication handling to redirect users to the Day view instead of the Login page upon sign-out and when encountering authentication errors. - Removed references to the Login route in various components and tests, streamlining the onboarding and authentication process. - Updated tests to reflect changes in the authentication flow, ensuring accurate behavior when users are not authenticated. - Enhanced the AuthPrompt component to initiate Google login directly, improving user experience during sign-in. * feat(event): refactor event editing to utilize session and repository - Updated the _editEvent saga to check for session existence before editing events, enhancing security and data integrity. - Integrated the event repository for handling event edits, streamlining the process and improving code maintainability. - Removed direct API calls in favor of repository methods, aligning with best practices for data management. * refactor(event): update event repository methods and remove unused React hook - Refactored the LocalEventRepository to accept Schema_Event and optional parameters for editing and deleting events, improving flexibility. - Removed the useEventRepository React hook, simplifying the repository interface and reducing unnecessary complexity in the codebase. - Updated tests to reflect changes in the event editing process, ensuring consistency with the new method signatures. * feat(sync): implement event syncing and enhance session management - Added isSyncing state to SessionContext and related hooks to manage event synchronization status. - Introduced SyncEventsOverlay component to provide user feedback during event syncing. - Implemented syncLocalEventsToCloud utility to synchronize local events with the cloud and clear IndexedDB. - Updated useGoogleAuth hook to handle syncing events upon successful authentication. - Enhanced useKeyboardEvent to prevent actions when the app is locked during syncing. - Added tests for new syncing functionality and updated existing tests to accommodate changes in session management. * feat(database): initialize database before application startup and enhance event repository logic - Added database initialization in the application startup process to ensure IndexedDB is ready for operations. - Updated event repository selection logic to prioritize remote repository usage based on user authentication status, preventing event loss after login. - Enhanced LocalEventRepository methods with error handling and logging for better debugging and reliability. - Updated sagas to include detailed logging for event creation and retrieval processes, improving traceability. - Introduced new constants for managing authentication states in local storage, streamlining user session handling. * fix(web): ensure events display and can be edited * refactor(auth): update AuthPrompt text and onboarding notices - Changed the AuthPrompt header from "Sign in to sync across devices" to "Connect your Google Calendar" for clarity. - Updated the accompanying body text to better reflect the functionality of syncing tasks and events with Google Calendar. - Adjusted onboarding notices to align with the new AuthPrompt messaging, ensuring consistency across the application. * refactor(event): enhance event fetching logic with detailed logging and error handling - Improved the get method in RemoteEventRepository to include comprehensive logging for request parameters and API responses, aiding in debugging and traceability. - Implemented error handling to catch and log failures during event fetching, ensuring robustness in the event retrieval process. - Updated the response handling to accommodate both direct array responses and pagination objects, enhancing flexibility in data processing. * feat(onboarding): introduce onboarding progress schema and default state - Added a new constants file for onboarding progress, defining the OnboardingProgressSchema using Zod for validation. - Established a default onboarding progress state to streamline onboarding state management. - Updated onboarding storage utility to utilize the new constants, improving code organization and maintainability. * feat(auth): enhance authentication state management with Zod validation - Introduced a new AuthStateSchema using Zod for validation of authentication state. - Added utility functions to get and update authentication state in localStorage, ensuring robust handling of state retrieval and updates. - Updated existing tests to cover new authentication state functionalities, improving reliability and maintainability of the authentication logic. - Refactored related constants and storage keys for better organization and clarity. * test(e2e): add passing CRUD tests, part I * test(e2e): adding failing e2e tests (skipped) * chore: update playwright config with TEST_PORT * chore: update playwright and webpack configs for e2e tests * fix(a11y): update web for expected behavior * fix(test): add isMobile skip * chore(config): update web server command for development environment - Changed the web server command to use webpack for serving the application in development mode, ensuring compatibility with the test environment. * chore(config): change default port for web server to 9080 - Updated the default PORT in the webpack configuration from 3000 to 9080, aligning with the new development environment setup. * feat(auth): integrate Google Calendar login in command palettes - Added Google Calendar login functionality to CmdPalette, DayCmdPalette, and NowCmdPalette components. - Implemented authentication state management using useSession hook and updated UI to reflect login status. - Enhanced error handling during authentication and ensured command palette closes upon login attempts. - Introduced a new "Connect Google Calendar" option in settings for user convenience. * refactor(auth): streamline Google Calendar sync process and update UI messaging - Removed manual setting of syncing state in useGoogleAuth, now handled by SocketProvider upon import completion. - Updated SyncEventsOverlay text to clarify the event import process and user expectations during syncing. - Enhanced SocketProvider to display success messages and reload the page after successful event synchronization. * feat(auth): implement session management and enhance authentication context - Introduced a new SessionProvider component to manage authentication state and session lifecycle using SuperTokens. - Created a CompassSession interface to define session properties and methods for state management. - Updated imports to reflect new file structure for session-related components. - Added tests for Google authentication and session management to ensure reliability and proper functionality. * refactor(event): remove console logs from event repository and authentication state utilities - Eliminated console log statements from the event repository utility to reduce noise in the console output. - Removed logging from authentication state functions to streamline the code and enhance performance. - Updated tests to utilize a new CompassSession interface for improved session management consistency across components. * fix(api): enhance error handling for /user/profile 404 responses - Updated createAxiosError to accept an optional URL parameter for better error context. - Modified triggerErrorResponse to handle the URL parameter, allowing for more specific error handling. - Adjusted CompassApi response interceptor to gracefully handle 404 errors for /user/profile without triggering a sign-out or redirect, enabling UserProvider to manage the response appropriately. - Added a test case to verify that a 404 response for /user/profile does not invoke sign-out or redirection. * test(tasks): add regression test to prevent localStorage overwrite on mount - Introduced a new test case to ensure that localStorage is not overwritten with an empty array when the TaskProvider mounts, addressing a regression issue. - Updated the useTaskEffects hook to manage loading state more effectively, ensuring tasks are loaded correctly from localStorage without losing existing data. - Enhanced the logic to synchronize loaded state and prevent unnecessary overwrites during component re-renders. * refactor(storage): remove logging functions and streamline database error handling - Eliminated the logDatabaseOperation function from db-errors.util.ts to reduce console noise and improve performance. - Updated handleDatabaseError to remove console error logging, focusing on error handling without unnecessary output. - Adjusted event storage utility functions to remove calls to logDatabaseOperation, ensuring cleaner code and better management of database operations. * feat(calendar): enhance Google Calendar import functionality and UI - Updated the startGoogleCalendarSync method to return the count of imported events and calendars. - Introduced CalendarImportCompleteModal to display import results and a dismiss option. - Added CalendarImportOverlay to indicate ongoing import processes. - Enhanced SocketProvider to handle import completion and trigger state updates without page reloads. - Updated Redux slice to manage importing state and results effectively. - Integrated new UI components into AuthenticatedLayout for improved user feedback during calendar imports. * feat(app): enhance database initialization and error handling - Integrated toast notifications to inform users when offline storage is unavailable during app initialization. - Updated the database initialization process to handle specific errors more gracefully, allowing the app to function in remote-only mode if local storage fails. - Removed unnecessary console logging from various storage and event repository functions to reduce console noise and improve performance. - Added null handling for import results in the Redux state to ensure consistency across the application. * feat(app): improve database initialization and error handling - Refactored database initialization to use a new method that handles errors more effectively, allowing the app to continue functioning in remote-only mode if local storage fails. - Integrated a toast notification system to inform users of offline storage issues after app initialization. - Added unit tests for the new error handling and toast notification functions to ensure reliability and proper user feedback. * test(sync): enhance SyncController tests to validate import result structure - Updated tests in SyncController to check that the import result is a JSON string containing properties for eventsCount and calendarsCount. - Refactored assertions to ensure proper handling of import results and improved test clarity. * fix(config): update port configuration for web server - Renamed PORT to WEB_PORT in playwright.config.ts for clarity. - Modified webpack.config.mjs to use WEB_PORT from environment variables, defaulting to "9080" if not set, ensuring consistent port usage across configurations. * feat(tests): enhance event test utilities with retry logic and timeout management - Introduced a shared timeout constant for form operations to standardize wait times across tests. - Added a `retryUntil` function to consolidate retry patterns for actions until a specified condition is met, improving test reliability. - Refactored existing functions to utilize the new retry logic and ensure form elements are visible before interactions. - Enhanced keyboard shortcut dispatching with additional event properties for better simulation of user actions. * feat(auth): implement UserContext and UserProvider for user state management - Introduced UserContext to manage user-related state and loading status. - Created UserProvider to fetch user profile data and integrate with PostHog for user identification. - Added tests for UserProvider to ensure correct behavior during user data loading and PostHog integration. - Implemented hooks for checking signup completion and skipping onboarding, enhancing user experience. * feat(auth): introduce useSession hook for session management - Added useSession hook to provide easy access to session context within the application. - Updated various components and tests to utilize the new useSession hook, ensuring consistent session management across the codebase. - Refactored imports to replace previous useSession references with the new hook from the auth module. * feat(modal): add CalendarImportCompleteModal component and associated tests - Introduced CalendarImportCompleteModal to display import results for events and calendars, with customizable messages based on counts. - Implemented accessibility features and auto-dismiss functionality after 8 seconds. - Added comprehensive tests to ensure correct rendering and behavior of the modal, including dismiss actions and event handling. - Refactored event handling in the modal to improve user interaction experience. * refactor(checkbox): remove CheckBox component and associated files - Deleted CheckBox component implementation, index, and styled files to streamline the codebase. - This change simplifies the component structure and removes unused code. * fix(sagas): improve error handling in event sagas and update imports - Enhanced error handling in the createEvent and getSomedayEvents sagas to log errors when the database does not exist, providing better visibility during testing. - Updated import statements in saga utilities to use the correct redux-saga core effects module, ensuring compatibility and clarity in the codebase. - Refactored the editEvent saga to improve type safety and maintainability. * refactor(sagas): enhance type safety and simplify action handling - Updated sagas in someday.sagas.ts to improve type safety by explicitly defining return types for generator functions. - Simplified action handling in sync.sagas.ts by creating no-argument action creators for success and error actions, enhancing code clarity. - Refactored sync.slice.ts to replace 'never' with 'undefined' in the async slice definition, improving type accuracy. * fix(loaders): integrate task seeding for initial date setup - Added import for seedInitialTasks utility to ensure initial tasks are seeded for specific dates when not in a test environment. - Removed redundant import statement to streamline the code and improve clarity in the loaders.ts file. * refactor(login): remove Login component and styles; update Logout view - Deleted Login component and associated styled file to streamline the codebase. - Updated Logout view to use a new styled container for layout, enhancing code clarity and structure. - Added order property to task test cases for consistency in task management tests. * refactor(NotFound): remove unused React import; update task tests to include order property - Removed the unused React import from NotFound.tsx to clean up the code. - Added order property to task test cases in AvailableTasks and FocusedTask components for consistency in task management tests. * refactor(AuthenticatedLayout): remove CalendarImportOverlay and streamline imports - Deleted the CalendarImportOverlay component to simplify the layout structure. - Updated AuthenticatedLayout to remove references to the deleted overlay and unnecessary imports. - Enhanced SyncEventsOverlay to handle both syncing and importing states more effectively. - Updated tests for SyncEventsOverlay to cover new importing logic and ensure correct rendering behavior. * feat(date): add isDateRangeOverlapping utility function and corresponding tests - Implemented isDateRangeOverlapping function to check if two date ranges overlap, supporting both day-level and exact time comparisons. - Added comprehensive unit tests for isDateRangeOverlapping to cover various scenarios, ensuring accurate functionality. - Updated event storage utility to utilize isDateRangeOverlapping for filtering events based on date ranges. - Refactored event loading logic in storage utilities to improve clarity and maintainability. * refactor(saga.util): simplify event filtering logic in EventDateUtils - Removed unnecessary array check for events in EventDateUtils, directly filtering the events array. - This change enhances code clarity and reduces redundancy in the event filtering process. * refactor(storage): remove task seeding utility and related tests - Deleted task-seeding utility and its corresponding test file to streamline the storage utilities. - Removed references to task seeding in loaders to prevent unnecessary initial task creation. - Updated task management logic to handle task loading directly from storage without seeding initial tasks. * test(useTasksToday): update task loading and storage mock behavior - Modified the test for useTasksToday to mock storage utilities while preserving actual helper functions. - Adjusted expectations in tests to reflect changes in task loading behavior, ensuring accurate assertions on task counts and storage interactions. - Enhanced clarity in task management tests by updating task length checks and ensuring proper handling of task addition limits. * fix(webpack): change host from 127.0.0.1 to localhost for better compatibility - Updated the webpack configuration to use 'localhost' instead of '127.0.0.1' as the host address. - This change improves compatibility with various development environments and tools. * refactor(SyncEventsOverlay): update sync message for clarity and remove AuthPrompt component - Changed the sync message in SyncEventsOverlay from "Please wait while we sync your calendar. You won't be able to create events until this is complete." to "Please hang tight while we sync your calendar" for improved clarity. - Deleted the AuthPrompt component and its associated tests to streamline the onboarding process and reduce code complexity. - Updated related tests to reflect the changes in messaging and component structure. * feat(DayCmdPalette): implement Google Calendar authentication status and update UI accordingly - Added tests to verify Google Calendar connection status in DayCmdPalette, ensuring the correct display of authentication messages based on user state. - Updated DayCmdPalette component to show "Connect Google Calendar" when not authenticated and "Google Calendar Connected" when authenticated. - Integrated local event synchronization feedback via toast notifications upon successful authentication. - Enhanced user experience by preventing login attempts when already authenticated. * refactor(DayViewContent): remove StorageInfoModal and related context - Deleted the StorageInfoModal component and its context usage from DayViewContent to simplify the component structure. - Updated the rendering logic to remove references to the modal, enhancing clarity and maintainability of the code. * refactor(Onboarding): remove CmdPaletteTutorial and OnboardingOverlay components - Deleted CmdPaletteTutorial and OnboardingOverlayHost components along with their associated tests to simplify the onboarding process. - Updated AuthenticatedLayout to remove references to the deleted components, enhancing clarity and maintainability of the layout structure. * feat(Onboarding): enhance CmdPaletteGuide with new components and logic - Introduced GuideInstructionContent, GuideSuccessMessage, GuideProgressIndicator, and GuideSkipButton components to improve the onboarding experience. - Refactored CmdPaletteGuide to utilize the new components, streamlining the display of instructions and success messages. - Implemented useGuideOverlayState hook to manage overlay state and logic, enhancing code clarity and maintainability. - Added tests for new components and hooks to ensure functionality and reliability. * feat(Onboarding): add "Connect Google Calendar" step to onboarding process - Introduced a new onboarding step for connecting Google Calendar, enhancing the onboarding experience. - Updated related constants, schemas, and hooks to accommodate the new step. - Adjusted tests to reflect the addition of the new step and ensure proper functionality across components. - Updated progress indicators and success messages to account for the new total of seven steps. * feat(Onboarding): enhance GuideInstructionContent with meta-key support - Added support for displaying meta-key instructions in GuideInstructionContent, improving the clarity of keyboard shortcuts. - Updated onboarding constants to include a new "Bring Your GCal events (optional)" title and adjusted instruction formatting. - Modified useGuideOverlayState to dynamically display the guide title based on the current step configuration. * feat(GoogleAuth): refactor authentication logic and add utility functions - Replaced direct API calls in useGoogleAuth with utility functions for authentication, onboarding status fetching, and local event synchronization. - Enhanced error handling and success feedback during the authentication process. - Introduced tests for new utility functions to ensure reliability and correctness of authentication and event synchronization logic. - Updated useGoogleAuth to manage loading states and handle popup closure scenarios effectively. * feat(CmdPalette): integrate useGoogleAuth for improved authentication handling - Refactored CmdPalette to utilize the useGoogleAuth hook for managing Google login functionality. - Updated mock setup for useGoogleLogin to return a structured response, enhancing test reliability. - Added immediate clearing of loginStartedRef in useGoogleAuth to prevent overlay hiding issues during authentication. - Removed direct API calls from CmdPalette, streamlining the authentication process and improving code maintainability. * feat(SyncEventsOverlay): enhance OAuth phase messaging and logic - Updated SyncEventsOverlay to differentiate between OAuth and importing phases, improving user feedback during Google sign-in. - Modified displayed messages to reflect the current phase, providing clearer instructions to users. - Refactored related logic to streamline the handling of syncing and importing states. - Adjusted tests to ensure accurate rendering of messages based on the new phase distinctions. * feat(CalendarImport): enhance import completion messaging and introduce OverlayPanel - Updated CalendarImportCompleteModal to display local events synced messages, improving user feedback on synchronization status. - Refactored message formatting logic to streamline the display of imported events and calendars. - Introduced OverlayPanel component for consistent modal presentation across the application. - Updated SyncEventsOverlay to utilize OverlayPanel for improved user experience during syncing phases. - Enhanced tests for CalendarImportCompleteModal to cover new local events synced scenarios and ensure accurate rendering of messages. * refactor(CalendarImportCompleteModal, OverlayPanel): streamline button styles and class management - Updated button class in CalendarImportCompleteModal for consistency in styling. - Refactored title and message class management in OverlayPanel to simplify logic and enhance readability. * feat(GoogleLogin): implement useGoogleLoginWithSyncOverlay for enhanced authentication flow - Introduced useGoogleLoginWithSyncOverlay hook to manage Google login with a syncing overlay, improving user experience during authentication. - Refactored useGoogleAuth to utilize the new hook, streamlining the login process and retaining syncing state on success. - Updated DayCmdPalette and NowCmdPalette components to leverage useGoogleLoginWithSyncOverlay for consistent authentication handling. - Added tests for useGoogleLoginWithSyncOverlay to ensure correct behavior during login, success, and error scenarios. * fix(useGoogleAuth): improve authentication failure handling and syncing state - Updated useGoogleAuth to clear syncing state when authentication fails, enhancing user experience during error scenarios. - Modified tests to verify that syncing is correctly stopped on authentication failure. - Adjusted the onboarding constant title for clarity in user instructions. * refactor(useGoogleAuth, SocketProvider, DayCmdPalette): streamline authentication and syncing logic - Refactored useGoogleAuth to improve type handling and remove unnecessary comments, enhancing clarity. - Updated SocketProvider to manage import start and end events more effectively, utilizing a ref to track import state. - Modified DayCmdPalette to leverage useGoogleAuth for Google login, simplifying the authentication flow and removing direct API calls. - Enhanced tests for SocketProvider to ensure correct handling of import events and state management. * feat(storage): introduce CompassTasksSavedEvent for task synchronization - Added a new type definition for CompassTasksSavedEvent to facilitate same-tab synchronization of tasks saved to localStorage. - Removed the StorageInfoModalContext and related components to streamline the task management process. - Updated TaskListHeader and TaskContext to eliminate references to the removed modal, enhancing code clarity. - Adjusted task action hooks to remove unnecessary modal handling, simplifying task creation logic. * refactor(onboarding): remove isStorageWarningSeen from onboarding constants - Eliminated the isStorageWarningSeen property from onboarding constants and related files to simplify the onboarding state management. - Updated UserProvider to conditionally fetch user profiles based on authentication status, enhancing the authentication gating logic. - Enhanced tests for UserProvider to verify behavior based on user authentication state. * fix(onboarding): update onboarding steps and remove EDIT_DESCRIPTION - Adjusted the total number of onboarding steps from 7 to 6 across various components and tests to reflect the removal of the EDIT_DESCRIPTION step. - Updated related tests to ensure they accurately reflect the new step count and instructions. - Enhanced the onboarding constants and types to remove references to the deleted step, streamlining the onboarding process. * fix(onboarding): update onboarding steps to reflect removal of EDIT_REMINDER - Adjusted the total number of onboarding steps from 6 to 5 across various components and tests, ensuring consistency in step counts and instructions. - Removed references to the EDIT_REMINDER step in onboarding constants, types, and related tests to streamline the onboarding process. - Updated tests to verify the correct display of step numbers and progress indicators, aligning with the new step structure. * fix(onboarding): update CmdPaletteGuide instructions for clarity - Revised text in CmdPaletteGuide and related tests to replace "/now view" with "Now view" for improved clarity in user instructions. - Removed unnecessary timeout logic in handleStepComplete to streamline onboarding step completion. - Cleaned up imports in CmdPaletteGuide for better code organization. * feat(tests): add end-to-end tests for OAuth overlay functionality - Introduced comprehensive end-to-end tests for the OAuth sync overlay, validating its behavior during the Google OAuth flow. - Implemented tests to ensure correct rendering of overlay phases, body locking, and accessibility attributes. - Added utility functions for setting up test states and verifying overlay visibility, enhancing test reliability. - Included edge case tests to handle rapid state changes and ensure consistent overlay behavior. * feat(tests): enhance SocketProvider tests for import event handling - Added tests to verify the behavior of the SocketProvider when receiving IMPORT_GCAL_END events, ensuring correct state management during import processes. - Implemented scenarios to check immediate dismissal of the import overlay, handling of payloads as objects, and triggering of event refetches upon import completion. - Enhanced test coverage for various import states, including cases where imports are not started and ensuring previous results are cleared when new imports begin. * refactor(tests): replace direct body lock checks with utility functions - Updated OAuth overlay tests to utilize new utility functions `expectBodyLocked` and `expectOverlayPhase` for better readability and maintainability. - Removed direct calls to `isBodyLocked` and `getOverlayPhase`, enhancing the clarity of test assertions related to body lock state and overlay phases. - Improved consistency in checking overlay visibility and body lock status across various test scenarios. * refactor(onboarding): remove isSeen property from onboarding state - Eliminated the isSeen property from various onboarding state definitions and constants to simplify the onboarding logic. - Updated related components and tests to reflect the removal, ensuring consistency in onboarding progress tracking. - Enhanced the onboarding guide to utilize the new structure without the isSeen property, streamlining the user experience. * feat(socket): implement SocketProvider and related hooks for event synchronization - Introduced SocketProvider to manage socket connections and event synchronization across the application. - Added hooks for handling Google Calendar sync events, including `useGcalSync` and `useEventSync`, to streamline event management. - Implemented tests for socket connection behavior, ensuring correct handling of user authentication states and event emissions. - Updated imports and file structures for better organization and clarity in socket-related functionalities. * refactor(google-auth): clean up useGoogleAuth hook and remove unused options - Removed commented-out code and unnecessary options from the useGoogleAuth hook to improve clarity and maintainability. - Updated database initialization utility to import DatabaseInitError from the appropriate module, enhancing error handling. - Streamlined test setup for database initialization by mocking DatabaseInitError, ensuring consistent error management in tests. * feat(google-auth): enhance useGoogleLoginWithSyncOverlay for better state management - Added tests to ensure isSyncing is cleared when the component unmounts during login and when remounting after OAuth completion. - Updated useGoogleLoginWithSyncOverlay to handle cleanup of isSyncing state more effectively, preventing stuck overlays. - Improved the import structure in app-init utility for better error handling. * feat(state): add pendingLocalEventsSynced to importGCal state - Introduced a new property `pendingLocalEventsSynced` in the preloaded state for importGCal to track synchronization status of local events. - Cleaned up test imports in useCmdPaletteTutorial test file for improved clarity and maintainability. * feat(session): mark user as authenticated on session existence and refresh - Added functionality to mark users as authenticated when a session exists, ensuring proper state management for users who authenticated before the flag was introduced. - Updated session initialization to also mark users as authenticated during session creation or refresh, improving consistency in user authentication state handling. * refactor(oauth): remove unused body lock and overlay phase utility functions - Deleted the `isBodyLocked` and `getOverlayPhase` functions from oauth-test-utils as they were no longer utilized in the codebase. - Cleaned up the file to enhance maintainability and clarity by removing redundant code related to overlay state checks. * refactor(tests): rename test for overlay phase verification - Updated the test name from `getOverlayPhase` to `expectOverlayPhase` for improved clarity and consistency in naming conventions. - This change enhances the readability of the test suite related to the OAuth overlay functionality. * refactor(tests): centralize onboarding state in test-constants - Moved the ONBOARDING_STATE definition to a new file, test-constants.ts, to promote reusability across test utilities. - Updated event-test-utils and oauth-test-utils to import ONBOARDING_STATE from the new constants file, enhancing code organization and maintainability. * feat(google-auth): improve error handling in useGoogleAuth and useGoogleLoginWithSyncOverlay - Enhanced the useGoogleAuth hook to ensure syncing state is cleared when authentication or subsequent operations fail, preventing stuck overlays. - Updated useGoogleLoginWithSyncOverlay to handle errors in the onSuccess callback, ensuring isSyncing is cleared and onError is called appropriately. - Added tests to verify that syncing state is correctly managed during error scenarios, improving overall reliability of the authentication flow. * feat(google-auth): retain isSyncing state on remount when configured - Updated useGoogleLoginWithSyncOverlay to retain the isSyncing state when isSyncingRetainedOnSuccess is true, preventing unintended clearing of the syncing state during component remounts. - Added a new test to verify that isSyncing is not cleared on remount under the specified condition, enhancing the reliability of the authentication flow. * refactor(routers): update loaders and routes for onboarding status - Replaced the loadLoggedInData function with loadOnboardingStatus to streamline onboarding state management. - Removed unused onboarding data loading functions to enhance code clarity and maintainability. - Updated the router configuration to utilize the new onboarding status loader, ensuring proper handling of user onboarding states. * refactor(onboarding): remove onboarding flow and related routes - Deleted the OnboardingFlow component and its associated test file to streamline the codebase. - Removed references to the onboarding route from the routing configuration and constants, enhancing clarity and maintainability. - Updated the useGoogleAuth hook to eliminate navigation to the onboarding route, reflecting the removal of onboarding functionality. * feat(google-auth): streamline useGoogleAuth and useGoogleLoginWithSyncOverlay for improved state management - Refactored the useGoogleAuth and useGoogleLoginWithSyncOverlay hooks to simplify the handling of the isSyncing state during login processes, ensuring it is set correctly on login start and cleared appropriately on errors. - Updated tests to reflect these changes, enhancing the reliability of the authentication flow and ensuring proper state management during various scenarios. - Removed unnecessary callbacks and improved the overall structure for better maintainability. * feat(google-auth): implement useConnectGoogle hook for Google Calendar integration - Introduced the useConnectGoogle hook to manage Google Calendar connection state and login functionality. - Created unit tests for useConnectGoogle to verify its behavior when connected and disconnected from Google Calendar. - Updated CmdPalette and DayCmdPalette components to utilize the new hook, enhancing the user experience for connecting Google Calendar. - Refactored existing components to remove direct dependencies on useSession and useGoogleAuth, promoting better separation of concerns. * feat(auth): introduce Google authentication hooks and related tests - Added useConnectGoogle and useGoogleAuth hooks to manage Google Calendar connection and authentication flow. - Implemented unit tests for both hooks to ensure correct behavior during various authentication states. - Refactored components to utilize the new hooks, improving code organization and separation of concerns. - Updated existing tests to reflect changes in hook usage, enhancing overall test coverage and reliability. * feat(google-auth): refactor Google authentication hooks and add tests - Renamed useGoogleLoginWithSyncOverlay to useGoogleAuthWithOverlay for clarity and consistency. - Introduced useGoogleAuthWithOverlay hook to manage Google authentication with improved state handling. - Added comprehensive unit tests for useGoogleAuthWithOverlay to ensure correct behavior during various authentication scenarios. - Updated useGoogleAuth to utilize the new hook, enhancing code organization and maintainability. * feat(auth): implement authentication state management with Redux - Introduced auth slice to manage user authentication state, including status and error handling. - Updated useGoogleAuth hook to dispatch authentication actions (startAuthenticating, authSuccess, authError) during the authentication flow. - Enhanced initial state setup in tests to include authentication state, ensuring comprehensive testing coverage. - Refactored related components to utilize the new authentication state management, improving code organization and maintainability. * feat(sync): enhance SyncEventsOverlay to include authentication state - Updated SyncEventsOverlay to show overlay during authentication, syncing, and importing states. - Introduced selectIsAuthenticating selector to manage authentication status. - Refactored logic to determine active overlay state, improving user experience during authentication flows. * feat(visibility): implement useBufferedVisibility hook to prevent UI flashing - Introduced useBufferedVisibility hook to buffer visibility state changes, enhancing user experience during rapid state transitions. - Updated SyncEventsOverlay to utilize the new hook, ensuring consistent visibility during authentication and importing phases. - Added comprehensive tests for useBufferedVisibility to validate its behavior under various scenarios, preventing UI flashes during state changes. * feat(sync): enhance Google Calendar import flow with new state management - Introduced `awaitingImportResults` and `importError` states in the importGCal slice to better manage the Google Calendar import process. - Updated the `useGoogleAuth` and `useGcalSync` hooks to dispatch actions related to the new states, improving error handling and user feedback during the import process. - Refactored `SyncEventsOverlay` to display appropriate messages based on the new states, enhancing user experience during authentication and importing phases. - Added tests to ensure correct behavior of the new state management and its integration with existing hooks and components. * feat(onboarding): update GuideProgressIndicator to conditionally render step text - Made `stepText` prop optional in `GuideProgressIndicator` to allow for cases where step text should not be displayed. - Added a test to verify that step text is not rendered when omitted. - Updated related hooks and components to handle the absence of step text appropriately, enhancing the onboarding experience. * refactor(tests): remove unused createTestEvents function from repository test factory - Deleted the createTestEvents factory function, which was previously used to generate multiple test events. - This change simplifies the test factory file by removing unnecessary code, improving maintainability. * refactor(tests): remove useTaskRepository hook and its associated tests - Deleted the useTaskRepository hook and its corresponding test file, as they were no longer needed. - This cleanup improves code maintainability by removing unused code and tests related to the task repository functionality. * refactor(tests): remove LocalTaskRepository test file - Deleted the LocalTaskRepository test file as part of a cleanup effort, improving code maintainability by removing unnecessary tests related to task management functionality. * refactor(tests): update OAuth overlay tests and utility functions - Renamed and updated the test for the OAuth overlay to reflect the correct phase during authentication. - Refactored utility functions to manage authentication state via Redux, replacing the previous test hooks approach. - Introduced a new function to set the awaiting import results state, enhancing the management of overlay phases during testing. * refactor(tests): remove LocalEventRepository test file - Deleted the LocalEventRepository test file as part of a cleanup effort, improving code maintainability by removing unnecessary tests related to event management functionality. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent e27eb1e commit 0396782

210 files changed

Lines changed: 14218 additions & 3925 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { test } from "@playwright/test";
2+
import {
3+
createEventTitle,
4+
expectAllDayEventVisible,
5+
fillTitleAndSaveWithKeyboard,
6+
openAllDayEventFormWithKeyboard,
7+
prepareCalendarPage,
8+
} from "../utils/event-test-utils";
9+
10+
test.skip("should create an all-day event using keyboard interaction", async ({
11+
page,
12+
}) => {
13+
await prepareCalendarPage(page);
14+
15+
const title = createEventTitle("All-Day Event");
16+
await openAllDayEventFormWithKeyboard(page);
17+
await fillTitleAndSaveWithKeyboard(page, title);
18+
19+
await expectAllDayEventVisible(page, title);
20+
});
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { test } from "@playwright/test";
2+
import {
3+
createEventTitle,
4+
expectAllDayEventVisible,
5+
fillTitleAndSaveWithMouse,
6+
openAllDayEventFormWithMouse,
7+
prepareCalendarPage,
8+
} from "../utils/event-test-utils";
9+
10+
test.skip("should create an all-day event using mouse interaction", async ({
11+
page,
12+
}) => {
13+
await prepareCalendarPage(page);
14+
15+
const title = createEventTitle("All-Day Event");
16+
await openAllDayEventFormWithMouse(page);
17+
await fillTitleAndSaveWithMouse(page, title);
18+
19+
await expectAllDayEventVisible(page, title);
20+
});
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { test } from "@playwright/test";
2+
import {
3+
createEventTitle,
4+
deleteEventWithKeyboard,
5+
expectAllDayEventMissing,
6+
expectAllDayEventVisible,
7+
fillTitleAndSaveWithKeyboard,
8+
openAllDayEventFormWithKeyboard,
9+
openEventForEditingWithKeyboard,
10+
prepareCalendarPage,
11+
} from "../utils/event-test-utils";
12+
13+
test.skip("should delete an all-day event using keyboard interaction", async ({
14+
page,
15+
}) => {
16+
await prepareCalendarPage(page);
17+
18+
const title = createEventTitle("All-Day Event");
19+
await openAllDayEventFormWithKeyboard(page);
20+
await fillTitleAndSaveWithKeyboard(page, title);
21+
await expectAllDayEventVisible(page, title);
22+
await page.waitForTimeout(1000);
23+
24+
await openEventForEditingWithKeyboard(page, title);
25+
await deleteEventWithKeyboard(page);
26+
27+
await expectAllDayEventMissing(page, title);
28+
});
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { test } from "@playwright/test";
2+
import {
3+
createEventTitle,
4+
deleteEventWithMouse,
5+
expectAllDayEventMissing,
6+
expectAllDayEventVisible,
7+
fillTitleAndSaveWithMouse,
8+
openAllDayEventFormWithMouse,
9+
prepareCalendarPage,
10+
} from "../utils/event-test-utils";
11+
12+
test.skip("should delete an all-day event using mouse interaction", async ({
13+
page,
14+
}) => {
15+
await prepareCalendarPage(page);
16+
17+
const title = createEventTitle("All-Day Event");
18+
await openAllDayEventFormWithMouse(page);
19+
await fillTitleAndSaveWithMouse(page, title);
20+
await expectAllDayEventVisible(page, title);
21+
22+
await page.locator("#allDayRow").getByRole("button", { name: title }).click();
23+
await deleteEventWithMouse(page);
24+
25+
await expectAllDayEventMissing(page, title);
26+
});
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { test } from "@playwright/test";
2+
import {
3+
createEventTitle,
4+
expectAllDayEventMissing,
5+
expectAllDayEventVisible,
6+
fillTitleAndSaveWithKeyboard,
7+
openAllDayEventFormWithKeyboard,
8+
openEventForEditingWithKeyboard,
9+
prepareCalendarPage,
10+
updateEventTitle,
11+
} from "../utils/event-test-utils";
12+
13+
test.skip("should update an all-day event using keyboard interaction", async ({
14+
page,
15+
}) => {
16+
await prepareCalendarPage(page);
17+
18+
const title = createEventTitle("All-Day Event");
19+
await openAllDayEventFormWithKeyboard(page);
20+
await fillTitleAndSaveWithKeyboard(page, title);
21+
await expectAllDayEventVisible(page, title);
22+
await page.waitForTimeout(1000);
23+
24+
await openEventForEditingWithKeyboard(page, title);
25+
26+
const updatedTitle = updateEventTitle("All-Day Event");
27+
await fillTitleAndSaveWithKeyboard(page, updatedTitle);
28+
29+
await expectAllDayEventVisible(page, updatedTitle);
30+
await expectAllDayEventMissing(page, title);
31+
});
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { test } from "@playwright/test";
2+
import {
3+
createEventTitle,
4+
expectAllDayEventMissing,
5+
expectAllDayEventVisible,
6+
fillTitleAndSaveWithMouse,
7+
openAllDayEventFormWithMouse,
8+
prepareCalendarPage,
9+
updateEventTitle,
10+
} from "../utils/event-test-utils";
11+
12+
test.skip(
13+
({ isMobile }) => isMobile,
14+
"Mouse flows are desktop-only in week view.",
15+
);
16+
17+
test.skip("should update an all-day event using mouse interaction", async ({
18+
page,
19+
}) => {
20+
await prepareCalendarPage(page);
21+
22+
const title = createEventTitle("All-Day Event");
23+
await openAllDayEventFormWithMouse(page);
24+
await fillTitleAndSaveWithMouse(page, title);
25+
await expectAllDayEventVisible(page, title);
26+
27+
await page.locator("#allDayRow").getByRole("button", { name: title }).click();
28+
29+
const updatedTitle = updateEventTitle("All-Day Event");
30+
await fillTitleAndSaveWithMouse(page, updatedTitle);
31+
32+
await expectAllDayEventVisible(page, updatedTitle);
33+
await expectAllDayEventMissing(page, title);
34+
});

e2e/oauth/oauth-overlay.spec.ts

Lines changed: 234 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
1+
import { expect, test } from "@playwright/test";
2+
import {
3+
OVERLAY_SELECTORS,
4+
OVERLAY_TEXT,
5+
expectBodyLocked,
6+
expectImportOverlayVisible,
7+
expectNoOverlay,
8+
expectOAuthOverlayVisible,
9+
expectOverlayPhase,
10+
prepareOAuthTestPage,
11+
setImporting,
12+
setIsSyncing,
13+
waitForAppReady,
14+
} from "../utils/oauth-test-utils";
15+
16+
/**
17+
* E2E tests for the OAuth sync overlay.
18+
*
19+
* These tests validate the SyncEventsOverlay component behavior during
20+
* the Google OAuth flow by using test hooks to control session state.
21+
*
22+
* The overlay shows two phases:
23+
* 1. OAuth phase: "Complete Google sign-in..." - when isSyncing=true, importing=false
24+
* 2. Import phase: "Importing your Google Calendar..." - when importing=true
25+
*/
26+
test.describe("OAuth Overlay", () => {
27+
test.beforeEach(async ({ page }) => {
28+
await prepareOAuthTestPage(page);
29+
await page.goto("/");
30+
await waitForAppReady(page);
31+
});
32+
33+
test("renders overlay with OAuth phase message while user is authenticating", async ({
34+
page,
35+
}) => {
36+
// Initially no overlay should be visible
37+
await expectNoOverlay(page);
38+
39+
// Trigger OAuth phase (isSyncing=true, importing=false)
40+
await setIsSyncing(page, true);
41+
42+
// Verify OAuth overlay appears with correct content
43+
await expectOAuthOverlayVisible(page);
44+
45+
// Verify the specific text content
46+
await expect(page.getByText(OVERLAY_TEXT.oauthTitle)).toBeVisible();
47+
await expect(page.getByText(OVERLAY_TEXT.oauthMessage)).toBeVisible();
48+
});
49+
50+
test("shows import phase message after user accepts OAuth prompt", async ({
51+
page,
52+
}) => {
53+
// Start OAuth phase
54+
await setIsSyncing(page, true);
55+
await expectOAuthOverlayVisible(page);
56+
57+
// Simulate OAuth completion - user accepted, now importing
58+
// When importing starts, isSyncing should be cleared and importing should be true
59+
await setIsSyncing(page, false);
60+
await setImporting(page, true);
61+
62+
// Verify overlay updates to import phase
63+
await expectImportOverlayVisible(page);
64+
65+
// Verify the specific text content changed
66+
await expect(page.getByText(OVERLAY_TEXT.importTitle)).toBeVisible();
67+
await expect(page.getByText(OVERLAY_TEXT.importMessage)).toBeVisible();
68+
69+
// OAuth text should no longer be visible
70+
await expect(page.getByText(OVERLAY_TEXT.oauthTitle)).not.toBeVisible();
71+
});
72+
73+
test("locks the app (body data-app-locked) when overlay is active", async ({
74+
page,
75+
}) => {
76+
// Initially not locked
77+
await expectBodyLocked(page, false);
78+
79+
// Activate overlay
80+
await setIsSyncing(page, true);
81+
82+
// Body should be locked
83+
await expectBodyLocked(page, true);
84+
85+
// Deactivate overlay
86+
await setIsSyncing(page, false);
87+
88+
// Body should be unlocked
89+
await expectBodyLocked(page, false);
90+
});
91+
92+
test("blurs active element when overlay activates", async ({
93+
page,
94+
isMobile,
95+
}) => {
96+
// On mobile, the main grid might not be visible - use a different focusable element
97+
// or skip for mobile as the blur behavior is the same regardless of viewport
98+
if (isMobile) {
99+
// On mobile, find any focusable element that's visible
100+
const focusable = page
101+
.locator("button:visible, [tabindex]:visible")
102+
.first();
103+
await focusable.waitFor({ state: "visible", timeout: 10000 });
104+
await focusable.focus();
105+
} else {
106+
// Wait for main grid to be visible and focusable on desktop
107+
const mainGrid = page.locator("#mainGrid");
108+
await mainGrid.waitFor({ state: "visible", timeout: 10000 });
109+
await mainGrid.focus();
110+
}
111+
112+
await page.waitForTimeout(100); // Give time for focus to settle
113+
114+
// Verify something is focused (not body)
115+
const activeBeforeOverlay = await page.evaluate(
116+
() => document.activeElement?.tagName,
117+
);
118+
expect(activeBeforeOverlay).not.toBe("BODY");
119+
120+
// Activate overlay
121+
await setIsSyncing(page, true);
122+
await page.waitForTimeout(100); // Give time for blur effect
123+
124+
// Active element should be blurred (now body)
125+
const activeAfterOverlay = await page.evaluate(
126+
() => document.activeElement?.tagName,
127+
);
128+
expect(activeAfterOverlay).toBe("BODY");
129+
});
130+
131+
test("overlay cleans up data-app-locked attribute when dismissed", async ({
132+
page,
133+
}) => {
134+
// Activate overlay
135+
await setIsSyncing(page, true);
136+
await expectBodyLocked(page, true);
137+
138+
// Complete import phase
139+
await setImporting(page, true);
140+
await expectBodyLocked(page, true);
141+
142+
// Clear all states (simulating completion)
143+
await setIsSyncing(page, false);
144+
await setImporting(page, false);
145+
146+
// Overlay should be gone and body unlocked
147+
await expectNoOverlay(page);
148+
await expectBodyLocked(page, false);
149+
});
150+
151+
test("expectOverlayPhase returns correct phase", async ({ page }) => {
152+
// Initially no phase
153+
await expectOverlayPhase(page, "none");
154+
155+
// OAuth phase
156+
await setIsSyncing(page, true);
157+
await expectOverlayPhase(page, "oauth");
158+
159+
// Import phase
160+
await setIsSyncing(page, false);
161+
await setImporting(page, true);
162+
await expectOverlayPhase(page, "import");
163+
164+
// Back to none
165+
await setImporting(page, false);
166+
await expectOverlayPhase(page, "none");
167+
});
168+
169+
test("overlay has correct ARIA attributes for accessibility", async ({
170+
page,
171+
}) => {
172+
await setIsSyncing(page, true);
173+
174+
// Check for status role panel (use more specific selector to avoid DndLiveRegion)
175+
const statusPanel = page.locator(OVERLAY_SELECTORS.statusPanel);
176+
await expect(statusPanel).toBeVisible();
177+
178+
// Should have aria-busy for screen readers
179+
await expect(statusPanel).toHaveAttribute("aria-busy", "true");
180+
181+
// Should have aria-live for announcements
182+
await expect(statusPanel).toHaveAttribute("aria-live", "polite");
183+
});
184+
185+
test("displays spinner during both phases", async ({ page }) => {
186+
const spinner = page.locator(OVERLAY_SELECTORS.spinner);
187+
188+
// OAuth phase
189+
await setIsSyncing(page, true);
190+
await expect(spinner).toBeVisible();
191+
192+
// Import phase
193+
await setIsSyncing(page, false);
194+
await setImporting(page, true);
195+
await expect(spinner).toBeVisible();
196+
197+
// No overlay
198+
await setImporting(page, false);
199+
await expect(spinner).not.toBeVisible();
200+
});
201+
});
202+
203+
test.describe("OAuth Overlay - Edge Cases", () => {
204+
test.beforeEach(async ({ page }) => {
205+
await prepareOAuthTestPage(page);
206+
await page.goto("/");
207+
await waitForAppReady(page);
208+
});
209+
210+
test("handles rapid state changes without visual glitches", async ({
211+
page,
212+
}) => {
213+
// Rapidly toggle states
214+
await setIsSyncing(page, true);
215+
await setIsSyncing(page, false);
216+
await setIsSyncing(page, true);
217+
await setImporting(page, true);
218+
await setImporting(page, false);
219+
await setIsSyncing(page, false);
220+
221+
// Should settle to no overlay
222+
await expectNoOverlay(page);
223+
});
224+
225+
test("shows OAuth phase when authenticating even if importing is true", async ({
226+
page,
227+
}) => {
228+
// When authenticating is true, OAuth messaging takes precedence.
229+
await setIsSyncing(page, true);
230+
await setImporting(page, true);
231+
232+
await expect(page.getByText(OVERLAY_TEXT.oauthTitle)).toBeVisible();
233+
});
234+
});

0 commit comments

Comments
 (0)