Implement comprehensive frontend integration testing with Playwright
- Add Playwright E2E testing framework with cross-browser support (Chrome, Firefox) - Create authentication helpers for CalDAV server integration - Implement calendar interaction helpers with event creation, drag-and-drop, and view switching - Add comprehensive drag-and-drop test suite with event cleanup - Configure CI/CD integration with Gitea Actions for headless testing - Support both local development and CI environments with proper dependency management - Include video recording, screenshots, and HTML reporting for test debugging - Handle Firefox-specific timing and interaction challenges with force clicks and timeouts 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
		
							
								
								
									
										96
									
								
								frontend/src/components/tests/calendar_tests.rs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										96
									
								
								frontend/src/components/tests/calendar_tests.rs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,96 @@ | ||||
| use wasm_bindgen_test::*; | ||||
| use chrono::{DateTime, Utc, TimeZone}; | ||||
| use crate::components::{MonthView, WeekView}; | ||||
| use crate::models::ical::VEvent; | ||||
| use yew::prelude::*; | ||||
|  | ||||
| #[wasm_bindgen_test] | ||||
| fn month_view_renders_without_events() { | ||||
|     let props = yew::props!( | ||||
|         current_date: Utc.with_ymd_and_hms(2023, 12, 15, 0, 0, 0).unwrap(), | ||||
|         events: vec![], | ||||
|         on_event_click: Callback::noop(), | ||||
|         on_date_click: Callback::noop(), | ||||
|         on_event_drag: Callback::noop(), | ||||
|         visible_calendar_paths: vec![], | ||||
|     ); | ||||
|  | ||||
|     let _month_view = html! { <MonthView ..props /> }; | ||||
|      | ||||
|     // Test passes if no panic occurs during rendering | ||||
| } | ||||
|  | ||||
| #[wasm_bindgen_test] | ||||
| fn week_view_renders_without_events() { | ||||
|     let props = yew::props!( | ||||
|         current_date: Utc.with_ymd_and_hms(2023, 12, 15, 0, 0, 0).unwrap(), | ||||
|         events: vec![], | ||||
|         on_event_click: Callback::noop(), | ||||
|         on_event_drag: Callback::noop(), | ||||
|         visible_calendar_paths: vec![], | ||||
|     ); | ||||
|  | ||||
|     let _week_view = html! { <WeekView ..props /> }; | ||||
|      | ||||
|     // Test passes if no panic occurs during rendering | ||||
| } | ||||
|  | ||||
| #[wasm_bindgen_test] | ||||
| fn month_view_handles_events() { | ||||
|     // Create a test event | ||||
|     let mut test_event = VEvent::new("test-event-123".to_string()); | ||||
|     test_event.summary = Some("Test Event".to_string()); | ||||
|     test_event.dtstart = Some(Utc.with_ymd_and_hms(2023, 12, 15, 14, 0, 0).unwrap()); | ||||
|     test_event.dtend = Some(Utc.with_ymd_and_hms(2023, 12, 15, 15, 0, 0).unwrap()); | ||||
|  | ||||
|     let props = yew::props!( | ||||
|         current_date: Utc.with_ymd_and_hms(2023, 12, 15, 0, 0, 0).unwrap(), | ||||
|         events: vec![test_event], | ||||
|         on_event_click: Callback::noop(), | ||||
|         on_date_click: Callback::noop(), | ||||
|         on_event_drag: Callback::noop(), | ||||
|         visible_calendar_paths: vec!["test-calendar".to_string()], | ||||
|     ); | ||||
|  | ||||
|     let _month_view = html! { <MonthView ..props /> }; | ||||
|      | ||||
|     // Test passes if no panic occurs during rendering with events | ||||
| } | ||||
|  | ||||
| #[wasm_bindgen_test] | ||||
| fn week_view_handles_events() { | ||||
|     // Create a test event | ||||
|     let mut test_event = VEvent::new("test-event-456".to_string()); | ||||
|     test_event.summary = Some("Weekly Test Event".to_string()); | ||||
|     test_event.dtstart = Some(Utc.with_ymd_and_hms(2023, 12, 15, 10, 0, 0).unwrap()); | ||||
|     test_event.dtend = Some(Utc.with_ymd_and_hms(2023, 12, 15, 11, 30, 0).unwrap()); | ||||
|  | ||||
|     let props = yew::props!( | ||||
|         current_date: Utc.with_ymd_and_hms(2023, 12, 15, 0, 0, 0).unwrap(), | ||||
|         events: vec![test_event], | ||||
|         on_event_click: Callback::noop(), | ||||
|         on_event_drag: Callback::noop(), | ||||
|         visible_calendar_paths: vec!["test-calendar".to_string()], | ||||
|     ); | ||||
|  | ||||
|     let _week_view = html! { <WeekView ..props /> }; | ||||
|      | ||||
|     // Test passes if no panic occurs during rendering with events | ||||
| } | ||||
|  | ||||
| #[wasm_bindgen_test] | ||||
| fn event_time_calculations() { | ||||
|     // Test event duration calculation | ||||
|     let start_time = Utc.with_ymd_and_hms(2023, 12, 15, 10, 0, 0).unwrap(); | ||||
|     let end_time = Utc.with_ymd_and_hms(2023, 12, 15, 11, 30, 0).unwrap(); | ||||
|      | ||||
|     let duration = end_time - start_time; | ||||
|     assert_eq!(duration.num_minutes(), 90); | ||||
|      | ||||
|     // Test same-day event | ||||
|     assert_eq!(start_time.date_naive(), end_time.date_naive()); | ||||
|      | ||||
|     // Test hour extraction | ||||
|     assert_eq!(start_time.hour(), 10); | ||||
|     assert_eq!(end_time.hour(), 11); | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Connor Johnstone
					Connor Johnstone