Skip to content

Commit

Permalink
Testes
Browse files Browse the repository at this point in the history
  • Loading branch information
wjrcode committed Oct 23, 2022
1 parent 0a7b6f4 commit fb4bd58
Show file tree
Hide file tree
Showing 14 changed files with 1,098 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ Future<dynamic> criarAtividade(BuildContext context,
corAtual: atividade?.cor ?? '',
),
Botao(
key: Key("keySalvarButton"),
texto: 'Salvar',
cor: const Color(0xFF6385C3),
clicar: () async {
Expand Down
1 change: 1 addition & 0 deletions lib/components/dialogs/habitos/habitoCadastroDialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ Future<dynamic> criarHabito(BuildContext context,
corAtual: habito?.cor ?? ''),
Botao(
texto: 'Salvar',
key: Key("keySalvarButton"),
cor: const Color(0xFF6385C3),
clicar: () async {
bool succes = await habitoController.saveHabito();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ Future<dynamic> criarLembrete(BuildContext context,
cor: lembreteController.lembreteCor,
corAtual: lembrete?.cor ?? ''),
Botao(
key: Key("keySalvarButton"),
texto: 'Salvar',
cor: const Color(0xFF6385C3),
clicar: () async {
Expand Down
1 change: 1 addition & 0 deletions lib/components/dialogs/listas/listaCadastroDialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ Future<dynamic> criarLista(BuildContext context,
Padding(
padding: const EdgeInsets.only(bottom: 16),
child: Botao(
key: Key("keySalvarButton"),
texto: 'Salvar',
cor: const Color(0xFF6385C3),
clicar: () async {
Expand Down
1 change: 1 addition & 0 deletions lib/components/dialogs/login/usuarioCadastroDialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Future<dynamic> cadastrarUsuario(BuildContext context,
),
_buildNovaSenha(),
Botao(
key: Key("keySalvarButton"),
texto: 'salvar',
cor: const Color(0xFF6BC8E4),
clicar: () async {
Expand Down
1 change: 1 addition & 0 deletions lib/components/dialogs/projetos/projetoCadastroDialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ Future<dynamic> criarProjeto(
),
),
Botao(
key: Key("keySalvarButton"),
texto: 'Salvar',
cor: const Color(0xFF6385C3),
clicar: () async {
Expand Down
1 change: 1 addition & 0 deletions lib/components/dialogs/tarefas/tarefaCadastroDialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ Future<dynamic> criarTarefa(BuildContext context,
cor: tarefaController.tarefaCor,
corAtual: tarefa?.cor ?? ''),
Botao(
key: Key("keySalvarButton"),
texto: 'Salvar',
cor: const Color(0xFF6385C3),
clicar: () async {
Expand Down
193 changes: 193 additions & 0 deletions test/atividade_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:organizei/components/botao.dart';
import 'package:organizei/components/dialogs/login/entrarDialog.dart';
import 'package:organizei/components/dialogs/tarefas/tarefaCadastroDialog.dart';

void main() {
group('ATIVIDADE', () {
testWidgets('Todos os campos vazios', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: Material(
child: Builder(
builder: (BuildContext context) {
return Botao(
key: Key("keyTesteButton"),
texto: 'Salvar',
cor: const Color(0xFF74C198),
clicar: () {
criarTarefa(context);
});
},
),
),
),
);

await tester.tap(find.byKey(ValueKey("keyTesteButton")));
await tester.pump();
await tester.ensureVisible(find.byKey(Key("keySalvarButton")));
await tester.pumpAndSettle();
await tester.tap(find.byKey(ValueKey("keySalvarButton")));
});

testWidgets('Nome vazio', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(
home: Material(
child: Builder(
builder: (BuildContext context) {
return Botao(
key: Key("keyTesteButton"),
texto: 'clicar',
cor: const Color(0xFF74C198),
clicar: () {
criarTarefa(context);
});
},
),
),
));

await tester.tap(find.byKey(ValueKey("keyTesteButton")));
await tester.pump();

await tester.ensureVisible(find.byKey(Key("keySalvarButton")));
await tester.pumpAndSettle();

//await tester.enterText(find.byKey(ValueKey("keyTextSenha")), "senha");

await tester.tap(find.byKey(ValueKey("keySalvarButton")));
});

testWidgets('Data incial vazia', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(
home: Material(
child: Builder(
builder: (BuildContext context) {
return Botao(
key: Key("keyTesteButton"),
texto: 'clicar',
cor: const Color(0xFF74C198),
clicar: () {
criarTarefa(context);
});
},
),
),
));

await tester.tap(find.byKey(ValueKey("keyTesteButton")));
await tester.pump();

await tester.ensureVisible(find.byKey(Key("keySalvarButton")));
await tester.pumpAndSettle();

await tester.tap(find.byKey(ValueKey("keySalvarButton")));
});

testWidgets('Data final vazia', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(
home: Material(
child: Builder(
builder: (BuildContext context) {
return Botao(
key: Key("keyTesteButton"),
texto: 'clicar',
cor: const Color(0xFF74C198),
clicar: () {
criarTarefa(context);
});
},
),
),
));

await tester.tap(find.byKey(ValueKey("keyTesteButton")));
await tester.pump();

await tester.ensureVisible(find.byKey(Key("keySalvarButton")));
await tester.pumpAndSettle();

await tester.tap(find.byKey(ValueKey("keySalvarButton")));
});

testWidgets('Observação vazia', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(
home: Material(
child: Builder(
builder: (BuildContext context) {
return Botao(
key: Key("keyTesteButton"),
texto: 'clicar',
cor: const Color(0xFF74C198),
clicar: () {
criarTarefa(context);
});
},
),
),
));

await tester.tap(find.byKey(ValueKey("keyTesteButton")));
await tester.pump();

await tester.ensureVisible(find.byKey(Key("keySalvarButton")));
await tester.pumpAndSettle();

await tester.tap(find.byKey(ValueKey("keySalvarButton")));
});

testWidgets('Prioridade vazia', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(
home: Material(
child: Builder(
builder: (BuildContext context) {
return Botao(
key: Key("keyTesteButton"),
texto: 'clicar',
cor: const Color(0xFF74C198),
clicar: () {
criarTarefa(context);
});
},
),
),
));

await tester.tap(find.byKey(ValueKey("keyTesteButton")));
await tester.pump();

await tester.ensureVisible(find.byKey(Key("keySalvarButton")));
await tester.pumpAndSettle();

await tester.tap(find.byKey(ValueKey("keySalvarButton")));
});

testWidgets('Cor vazia', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(
home: Material(
child: Builder(
builder: (BuildContext context) {
return Botao(
key: Key("keyTesteButton"),
texto: 'clicar',
cor: const Color(0xFF74C198),
clicar: () {
criarTarefa(context);
});
},
),
),
));

await tester.tap(find.byKey(ValueKey("keyTesteButton")));
await tester.pump();

await tester.ensureVisible(find.byKey(Key("keySalvarButton")));
await tester.pumpAndSettle();

await tester.tap(find.byKey(ValueKey("keySalvarButton")));
});
});
}
Loading

0 comments on commit fb4bd58

Please sign in to comment.