diff --git a/lib/components/dialogs/atividades/atividadeCadastroDialog.dart b/lib/components/dialogs/atividades/atividadeCadastroDialog.dart index 9725f95..a7a81f6 100644 --- a/lib/components/dialogs/atividades/atividadeCadastroDialog.dart +++ b/lib/components/dialogs/atividades/atividadeCadastroDialog.dart @@ -92,6 +92,7 @@ Future criarAtividade(BuildContext context, corAtual: atividade?.cor ?? '', ), Botao( + key: Key("keySalvarButton"), texto: 'Salvar', cor: const Color(0xFF6385C3), clicar: () async { diff --git a/lib/components/dialogs/habitos/habitoCadastroDialog.dart b/lib/components/dialogs/habitos/habitoCadastroDialog.dart index f624375..908ff9d 100644 --- a/lib/components/dialogs/habitos/habitoCadastroDialog.dart +++ b/lib/components/dialogs/habitos/habitoCadastroDialog.dart @@ -78,6 +78,7 @@ Future criarHabito(BuildContext context, corAtual: habito?.cor ?? ''), Botao( texto: 'Salvar', + key: Key("keySalvarButton"), cor: const Color(0xFF6385C3), clicar: () async { bool succes = await habitoController.saveHabito(); diff --git a/lib/components/dialogs/lembretes/lembreteCadastroDialog.dart b/lib/components/dialogs/lembretes/lembreteCadastroDialog.dart index a822fef..23c36bb 100644 --- a/lib/components/dialogs/lembretes/lembreteCadastroDialog.dart +++ b/lib/components/dialogs/lembretes/lembreteCadastroDialog.dart @@ -90,6 +90,7 @@ Future criarLembrete(BuildContext context, cor: lembreteController.lembreteCor, corAtual: lembrete?.cor ?? ''), Botao( + key: Key("keySalvarButton"), texto: 'Salvar', cor: const Color(0xFF6385C3), clicar: () async { diff --git a/lib/components/dialogs/listas/listaCadastroDialog.dart b/lib/components/dialogs/listas/listaCadastroDialog.dart index b8e9509..aafd6ad 100644 --- a/lib/components/dialogs/listas/listaCadastroDialog.dart +++ b/lib/components/dialogs/listas/listaCadastroDialog.dart @@ -116,6 +116,7 @@ Future criarLista(BuildContext context, Padding( padding: const EdgeInsets.only(bottom: 16), child: Botao( + key: Key("keySalvarButton"), texto: 'Salvar', cor: const Color(0xFF6385C3), clicar: () async { diff --git a/lib/components/dialogs/login/usuarioCadastroDialog.dart b/lib/components/dialogs/login/usuarioCadastroDialog.dart index d19b72a..293615d 100644 --- a/lib/components/dialogs/login/usuarioCadastroDialog.dart +++ b/lib/components/dialogs/login/usuarioCadastroDialog.dart @@ -95,6 +95,7 @@ Future cadastrarUsuario(BuildContext context, ), _buildNovaSenha(), Botao( + key: Key("keySalvarButton"), texto: 'salvar', cor: const Color(0xFF6BC8E4), clicar: () async { diff --git a/lib/components/dialogs/projetos/projetoCadastroDialog.dart b/lib/components/dialogs/projetos/projetoCadastroDialog.dart index 8d276fb..6d185e4 100644 --- a/lib/components/dialogs/projetos/projetoCadastroDialog.dart +++ b/lib/components/dialogs/projetos/projetoCadastroDialog.dart @@ -145,6 +145,7 @@ Future criarProjeto( ), ), Botao( + key: Key("keySalvarButton"), texto: 'Salvar', cor: const Color(0xFF6385C3), clicar: () async { diff --git a/lib/components/dialogs/tarefas/tarefaCadastroDialog.dart b/lib/components/dialogs/tarefas/tarefaCadastroDialog.dart index dbb3543..17bfa62 100644 --- a/lib/components/dialogs/tarefas/tarefaCadastroDialog.dart +++ b/lib/components/dialogs/tarefas/tarefaCadastroDialog.dart @@ -77,6 +77,7 @@ Future criarTarefa(BuildContext context, cor: tarefaController.tarefaCor, corAtual: tarefa?.cor ?? ''), Botao( + key: Key("keySalvarButton"), texto: 'Salvar', cor: const Color(0xFF6385C3), clicar: () async { diff --git a/test/atividade_test.dart b/test/atividade_test.dart new file mode 100644 index 0000000..f1b0fb5 --- /dev/null +++ b/test/atividade_test.dart @@ -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"))); + }); + }); +} diff --git a/test/habito_test.dart b/test/habito_test.dart new file mode 100644 index 0000000..4d18e59 --- /dev/null +++ b/test/habito_test.dart @@ -0,0 +1,167 @@ +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('HÁBITO', () { + 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('Repetir 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.tap(find.byKey(ValueKey("keySalvarButton"))); + }); + + testWidgets('Hora 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('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"))); + }); + }); +} diff --git a/test/lembrete_test.dart b/test/lembrete_test.dart new file mode 100644 index 0000000..5dae27a --- /dev/null +++ b/test/lembrete_test.dart @@ -0,0 +1,141 @@ +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('LEMBRETE', () { + 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 e hora 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('É aniversário 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.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"))); + }); + }); +} diff --git a/test/lista_test.dart b/test/lista_test.dart new file mode 100644 index 0000000..8b1cc76 --- /dev/null +++ b/test/lista_test.dart @@ -0,0 +1,115 @@ +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('LISTA', () { + 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('Sem Itens', (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"))); + }); + }); +} diff --git a/test/projeto_test.dart b/test/projeto_test.dart new file mode 100644 index 0000000..e16be57 --- /dev/null +++ b/test/projeto_test.dart @@ -0,0 +1,167 @@ +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('PROJETO', () { + 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 inicial 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('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"))); + }); + }); +} diff --git a/test/tarefa_test.dart b/test/tarefa_test.dart new file mode 100644 index 0000000..b2c9290 --- /dev/null +++ b/test/tarefa_test.dart @@ -0,0 +1,167 @@ +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('TAREFA', () { + 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 e hora 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('Prioriade 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"))); + }); + }); +} diff --git a/test/usuario_test.dart b/test/usuario_test.dart new file mode 100644 index 0000000..04bab64 --- /dev/null +++ b/test/usuario_test.dart @@ -0,0 +1,141 @@ +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('USUÁRIO', () { + 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('Apelido 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.tap(find.byKey(ValueKey("keySalvarButton"))); + }); + + testWidgets('E-mail 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.tap(find.byKey(ValueKey("keySalvarButton"))); + }); + + testWidgets('Senha 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"))); + }); + }); +}