Skip to content

Commit

Permalink
qa(#59): teste de registro da conta
Browse files Browse the repository at this point in the history
  • Loading branch information
EngDann committed Dec 28, 2024
1 parent fc4872f commit 631e9d0
Showing 1 changed file with 77 additions and 0 deletions.
77 changes: 77 additions & 0 deletions test/ui/register_account/RegisterAccount_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import 'package:aranduapp/ui/shared/TextEmail.dart';
import 'package:aranduapp/ui/shared/TextName.dart';
import 'package:aranduapp/ui/shared/TextPassword.dart';
import 'package:aranduapp/ui/shared/TitleSlogan.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:aranduapp/ui/register_account/view/RegisterAccount.dart';

void main() {
group('RegisterAccount Widget Tests', () {
testWidgets('Verifica se os widgets básicos estão presentes',
(WidgetTester tester) async {
await tester.pumpWidget(
const MaterialApp(
home: RegisterAccount(),
),
);
// Verifica a presença dos itens.
expect(find.byType(TitleSlogan), findsOneWidget);
expect(find.byType(TextName), findsNWidgets(2));
expect(find.byType(TextEmail), findsOneWidget);
expect(find.byType(TextPassWord), findsOneWidget);
expect(find.byType(ElevatedButton), findsOneWidget);
});

testWidgets('Interação com o formulário de registro',
(WidgetTester tester) async {
await tester.pumpWidget(
const MaterialApp(
home: RegisterAccount(),
),
);

// Interações com os campos de texto
await tester.enterText(
find.widgetWithText(TextName, 'Nome'), 'Teste Nome');
expect(find.text('Teste Nome'), findsOneWidget);

await tester.enterText(
find.widgetWithText(TextName, 'Nome de Usuário'), 'TesteUsuario');
expect(find.text('TesteUsuario'), findsOneWidget);

await tester.enterText(find.byType(TextEmail), '[email protected]');
expect(find.text('[email protected]'), findsOneWidget);

await tester.enterText(find.byType(TextPassWord), '123456');
expect(find.text('123456'), findsOneWidget);

// Interação com o checkbox
await tester.tap(find.byType(Checkbox));
await tester.pump();
expect(tester.widget<Checkbox>(find.byType(Checkbox)).value, isTrue);

// Interações com o botão
await tester.tap(find.byType(ElevatedButton));
await tester.pump();

expect(find.byType(CircularProgressIndicator), findsOneWidget);
});

testWidgets('Teste do botão de login com o Google',
(WidgetTester tester) async {
await tester.pumpWidget(
const MaterialApp(
home: RegisterAccount(),
),
);

// Interações com o botão do google
final googleButton = find.byType(GestureDetector);
expect(googleButton, findsOneWidget);

await tester.tap(googleButton);
await tester.pump();
});
});
}

0 comments on commit 631e9d0

Please sign in to comment.