fix(ios): improve test script reliability and pending notification detection
Fixed multiple issues in iOS test script and added logging for test compatibility: Test Script Fixes: - Fixed get_simulator_id() to correctly extract UUID from booted devices - Fixed get_app_logs() to use log show (historical) instead of log stream (live) to avoid hanging - Improved check_plugin_configured() with multiple detection methods (app container, app listing, data directory) - Added ensure_plugin_configured() function matching Android pattern for consistent user interaction flow - Fixed integer comparison error in booted device check (removed newlines from count) - Removed 'local' keyword from variables in main script body (local can only be used in functions) - Fixed APP_BUNDLE_ID to match actual bundle identifier Pending Notification Detection: - Improved get_pending_notifications() to parse pendingCount from plugin logs - Added direct log query without restrictive predicate to catch plugin logs - Added multiple fallback methods for detecting pending count Plugin Logging Enhancement: - Added explicit pendingCount logging in DailyNotificationScheduler after scheduling - Uses both NSLog() and print() to ensure logs appear in system logs and Xcode console - Matches Android's alarm count logging pattern for test script compatibility This resolves script crashes and enables reliable detection of pending notifications for automated testing.
This commit is contained in:
@@ -188,7 +188,11 @@ class DailyNotificationScheduler {
|
||||
self.scheduledNotifications.insert(content.id)
|
||||
}
|
||||
|
||||
print("\(Self.TAG): Notification scheduled successfully for \(scheduledDate)")
|
||||
// Log pending count for test scripts (matches Android's alarm count logging)
|
||||
// Use NSLog to ensure it appears in system logs (print() may not always be captured)
|
||||
let pendingCount = await getPendingNotificationCount()
|
||||
NSLog("\(Self.TAG): Notification scheduled successfully for \(scheduledDate), id=\(content.id), pendingCount=\(pendingCount)")
|
||||
print("\(Self.TAG): Notification scheduled successfully for \(scheduledDate), id=\(content.id), pendingCount=\(pendingCount)")
|
||||
return true
|
||||
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user