Rewrites the mobile app from a native Twilio Voice SDK integration (Android Telecom/ConnectionService) to a thin WebView shell that loads a standalone browser phone page from WordPress. This eliminates the buggy Android phone account registration, fixes frequent logouts by using 7-day WP session cookies instead of JWT tokens, and maintains all existing call features (dialpad, queues, hold, transfer, requeue, recording, caller ID, agent status). Server-side: - Add class-twp-mobile-phone-page.php: standalone /twp-phone/ endpoint with mobile-optimized UI, dark mode, tab navigation, and Flutter WebView JS bridge - Extend auth cookie to 7 days for phone agents - Add WP AJAX handler for FCM token registration (cookie auth) Flutter app (v2.0.0): - Replace 18 native files with 5-file WebView shell - Login via wp-login.php in WebView (auto-detect redirect on success) - Full-screen WebView with auto microphone grant for WebRTC - FCM push notifications preserved for queue alerts - Remove: twilio_voice, dio, provider, JWT auth, SSE, native call UI Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
41 lines
1.3 KiB
Dart
41 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:twp_softphone/app.dart';
|
|
import 'package:twp_softphone/screens/login_screen.dart';
|
|
|
|
void main() {
|
|
group('TwpSoftphoneApp', () {
|
|
testWidgets('shows loading indicator on startup', (tester) async {
|
|
await tester.pumpWidget(const TwpSoftphoneApp());
|
|
expect(find.byType(TwpSoftphoneApp), findsOneWidget);
|
|
expect(find.bySubtype<CircularProgressIndicator>(), findsOneWidget);
|
|
});
|
|
});
|
|
|
|
group('LoginScreen', () {
|
|
testWidgets('renders server URL field and connect button', (tester) async {
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
home: LoginScreen(onLoginSuccess: (_) {}),
|
|
),
|
|
);
|
|
await tester.pump(const Duration(milliseconds: 100));
|
|
expect(find.text('Server URL'), findsOneWidget);
|
|
expect(find.text('Connect'), findsOneWidget);
|
|
expect(find.text('TWP Softphone'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('validates empty server URL on submit', (tester) async {
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
home: LoginScreen(onLoginSuccess: (_) {}),
|
|
),
|
|
);
|
|
await tester.pump(const Duration(milliseconds: 100));
|
|
await tester.tap(find.text('Connect'));
|
|
await tester.pump();
|
|
expect(find.text('Required'), findsOneWidget);
|
|
});
|
|
});
|
|
}
|