Files
eatvio_app/test/features/chat/presentation/pages/payment_screen_test.dart

79 lines
2.1 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'package:eatvio_app/features/chat/presentation/pages/payment_screen.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:go_router/go_router.dart';
import '../../../../helpers/webview_test_helper.dart';
void main() {
setUp(() {
WebViewTestHelper.setUpWebViewPlatform();
});
tearDown(() {
WebViewTestHelper.tearDownWebViewPlatform();
});
group('PaymentScreen', () {
testWidgets('отображает PaymentScreen с WebView и AppBar', (WidgetTester tester) async {
const url = 'https://example.com/payment';
const planId = 1;
final router = GoRouter(
initialLocation: '/',
routes: [
GoRoute(
path: '/',
builder: (context, state) => const PaymentScreen(url: url, planId: planId),
),
],
);
await tester.pumpWidget(
MaterialApp.router(
routerConfig: router,
),
);
await tester.pump();
// Проверяем, что экран отображается
expect(find.byType(PaymentScreen), findsOneWidget);
expect(find.byType(Scaffold), findsOneWidget);
expect(find.byType(AppBar), findsOneWidget);
});
testWidgets('PaymentScreen создается с правильными параметрами', (WidgetTester tester) async {
const url = 'https://example.com/payment/test';
const planId = 42;
final router = GoRouter(
initialLocation: '/',
routes: [
GoRoute(
path: '/',
builder: (context, state) => const PaymentScreen(url: url, planId: planId),
),
],
);
await tester.pumpWidget(
MaterialApp.router(
routerConfig: router,
),
);
await tester.pump();
expect(find.byType(PaymentScreen), findsOneWidget);
});
test('PaymentScreen имеет правильные статические константы', () {
expect(PaymentScreen.name, 'paymentScreen');
expect(PaymentScreen.path, '/payment-screen');
});
});
}