API v4 계약 반영하고 보고서·입출고 화면 실연동 강화
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:shadcn_ui/shadcn_ui.dart';
|
||||
|
||||
@@ -8,6 +9,9 @@ import 'package:superport_v2/core/permissions/permission_manager.dart';
|
||||
import 'package:superport_v2/core/theme/superport_shad_theme.dart';
|
||||
import 'package:superport_v2/features/inventory/inbound/presentation/pages/inbound_page.dart';
|
||||
import 'package:superport_v2/features/inventory/shared/widgets/product_autocomplete_field.dart';
|
||||
import 'package:superport_v2/widgets/components/form_field.dart';
|
||||
|
||||
import '../../helpers/inventory_test_stubs.dart';
|
||||
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
@@ -16,6 +20,14 @@ void main() {
|
||||
await Environment.initialize();
|
||||
});
|
||||
|
||||
setUp(() {
|
||||
registerInventoryTestStubs();
|
||||
});
|
||||
|
||||
tearDown(() async {
|
||||
await GetIt.I.reset();
|
||||
});
|
||||
|
||||
testWidgets('입고 필터 적용 및 초기화가 목록을 갱신한다', (tester) async {
|
||||
final view = tester.view;
|
||||
view.physicalSize = const Size(1280, 800);
|
||||
@@ -95,6 +107,27 @@ void main() {
|
||||
await tester.tap(find.widgetWithText(ShadButton, '입고 등록'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
final transactionField = find.byWidgetPredicate(
|
||||
(widget) => widget is SuperportFormField && widget.label == '트랜잭션번호',
|
||||
);
|
||||
final approvalField = find.byWidgetPredicate(
|
||||
(widget) => widget is SuperportFormField && widget.label == '결재번호',
|
||||
);
|
||||
expect(transactionField, findsOneWidget);
|
||||
expect(approvalField, findsOneWidget);
|
||||
|
||||
final transactionInput = find.descendant(
|
||||
of: transactionField,
|
||||
matching: find.byType(EditableText),
|
||||
);
|
||||
final approvalInput = find.descendant(
|
||||
of: approvalField,
|
||||
matching: find.byType(EditableText),
|
||||
);
|
||||
await tester.enterText(transactionInput.first, 'IN-TEST-001');
|
||||
await tester.enterText(approvalInput.first, 'APP-TEST-001');
|
||||
await tester.pump();
|
||||
|
||||
final productFields = find.byType(InventoryProductAutocompleteField);
|
||||
expect(productFields, findsWidgets);
|
||||
|
||||
@@ -105,7 +138,9 @@ void main() {
|
||||
await tester.enterText(firstProductInput, 'XR-5000');
|
||||
await tester.pump();
|
||||
|
||||
await tester.tap(find.widgetWithText(ShadButton, '품목 추가'));
|
||||
final addLineButton = find.widgetWithText(ShadButton, '품목 추가');
|
||||
await tester.ensureVisible(addLineButton);
|
||||
await tester.tap(addLineButton);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
final updatedProductFields = find.byType(InventoryProductAutocompleteField);
|
||||
@@ -118,9 +153,47 @@ void main() {
|
||||
await tester.enterText(secondProductInput, 'XR-5000');
|
||||
await tester.pump();
|
||||
|
||||
await tester.tap(find.widgetWithText(ShadButton, '저장'));
|
||||
final saveButton = find.widgetWithText(ShadButton, '저장');
|
||||
await tester.ensureVisible(saveButton);
|
||||
await tester.tap(saveButton);
|
||||
await tester.pump();
|
||||
|
||||
expect(find.text('동일 제품이 중복되었습니다.'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('입고 등록 모달은 거래번호와 결재번호를 필수로 요구한다', (tester) async {
|
||||
final view = tester.view;
|
||||
view.physicalSize = const Size(1280, 900);
|
||||
view.devicePixelRatio = 1.0;
|
||||
addTearDown(() {
|
||||
view.resetPhysicalSize();
|
||||
view.resetDevicePixelRatio();
|
||||
});
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: ScaffoldMessenger(
|
||||
child: PermissionScope(
|
||||
manager: PermissionManager(),
|
||||
child: ShadTheme(
|
||||
data: SuperportShadTheme.light(),
|
||||
child: Scaffold(
|
||||
body: InboundPage(routeUri: Uri.parse('/inventory/inbound')),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
await tester.tap(find.widgetWithText(ShadButton, '입고 등록'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
await tester.tap(find.widgetWithText(ShadButton, '저장'));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.text('거래번호를 입력하세요.'), findsOneWidget);
|
||||
expect(find.text('결재번호를 입력하세요.'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user