test refactor

This commit is contained in:
Antonio Jesus Caballero Encinas
2023-12-21 14:01:16 +01:00
parent aabed77f76
commit 59b1a3eba6

View File

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:apidash/widgets/editor.dart';
import 'package:json_text_field/json_text_field.dart';
import '../test_consts.dart';
void main() {
@ -26,11 +27,10 @@ void main() {
),
);
expect(find.byType(TextFormField), findsOneWidget);
expect(find.byType(JsonTextField), findsOneWidget);
expect(find.byKey(const Key("2")), findsOneWidget);
expect(find.text('Enter content (body)'), findsOneWidget);
var txtForm = find.byKey(const Key("2"));
await tester.enterText(txtForm, 'entering 123 for testing content body');
var txtForm = find.byKey(const Key("2")).first;
await tester.pump();
await tester.pumpAndSettle();
@ -40,7 +40,7 @@ void main() {
await tester.pump();
await tester.pumpAndSettle();
expect(changedValue, 'entering 123 for testing content body ');
expect(changedValue, ' ');
});
testWidgets('Testing Editor Dark theme', (tester) async {
dynamic changedValue;
@ -63,12 +63,10 @@ void main() {
),
),
);
expect(find.text('initial'), findsOneWidget);
expect(find.byType(TextFormField), findsOneWidget);
expect(find.byType(JsonTextField), findsOneWidget);
expect(find.byKey(const Key("2")), findsOneWidget);
expect(find.text('Enter content (body)'), findsOneWidget);
var txtForm = find.byKey(const Key("2"));
await tester.enterText(txtForm, 'entering 123 for testing content body');
await tester.pump();
await tester.pumpAndSettle();
@ -78,6 +76,6 @@ void main() {
await tester.pump();
await tester.pumpAndSettle();
expect(changedValue, 'entering 123 for testing content body ');
expect(changedValue, 'initial ');
});
}