Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
441aa5d
Add:Implementing system an back-end from self-evaluation request
Daniel-Nas Nov 16, 2025
590df9a
Add:Adding Request Evaluation in enrollmentservice.ts
Daniel-Nas Nov 16, 2025
7452b37
add: Adding the tab (Self-Evaluation)
Daniel-Nas Nov 16, 2025
f7d04f9
ADD: adding every goal in self-evaluatin
Daniel-Nas Nov 17, 2025
c529792
Merge pull request #1 from Daniel-Nas/self-evaluation-Notification
Daniel-Nas Nov 29, 2025
6deb0d6
Feat:Adding EmailJS to the backend
Daniel-Nas Nov 30, 2025
e45417e
ADD:Adding pup-up when you request selfevaluation
Daniel-Nas Nov 30, 2025
bede0c5
FIX:Adding a different color when i hover the mouse over the student
Daniel-Nas Nov 30, 2025
a57a46a
ADD: adding tests
Daniel-Nas Dec 1, 2025
f95424b
Merge branch 'main' into self-evaluation-Notification
Daniel-Nas Dec 1, 2025
43d5c45
FIX: Adding new files
Daniel-Nas Dec 1, 2025
8fc3bde
Merge pull request #2 from Daniel-Nas/self-evaluation-Notification
Daniel-Nas Dec 1, 2025
f5373c1
FEAT:Fix scenarios on tests from request self-evaluation and hiding A…
Daniel-Nas Dec 9, 2025
26c015e
FEAT: Adding schedule self-evaluation on client
Daniel-Nas Dec 9, 2025
cd2bf74
FEAT:Putting request of self-evaluation into the evaluation.ts
Daniel-Nas Dec 9, 2025
1edb745
FEAT:adding scheduler in enrollmentService.ts (and) DEL:Useless funct…
Daniel-Nas Dec 10, 2025
4dfe7e8
REF: Restructure Gherkin scenarios and improve test in serv
Daniel-Nas Dec 10, 2025
68926c1
TEST:Adding unit tests
Daniel-Nas Dec 10, 2025
fad1938
TEST: Adding tests E2E(GUI)
Daniel-Nas Dec 10, 2025
84a6a1d
REFC: Deleting unnecessary functions
Daniel-Nas Dec 10, 2025
4daa047
REF: encapsulate email content and logic within send function
Daniel-Nas Dec 10, 2025
3ca02f4
Merge pull request #3 from Daniel-Nas/self-evaluation-Notification
Daniel-Nas Dec 10, 2025
362ebd7
DEL: Deleting GUI:test
Daniel-Nas Dec 10, 2025
da4aa6a
DEL: client/test-results directory
Daniel-Nas Dec 10, 2025
9026265
Merge pull request #4 from Daniel-Nas/self-evaluation-Notification
Daniel-Nas Dec 10, 2025
f51c257
MER: Trying to merge everything
Dec 12, 2025
f5f18df
PR:Ready to Pull Request
Dec 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 128 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# Pull Request - Teaching Assistant

## 📝 Descrição
<!-- Descreva de forma clara e objetiva as mudanças realizadas -->

**O que foi feito:**

**Por que foi feito:**

## 📌 Observações
<!-- Informações extras para os revisores, dúvidas, decisões técnicas, etc. -->

### Impacto:
- [ ] 🟢 Baixo - Mudança isolada, sem efeitos colaterais
- [ ] 🟡 Médio - Afeta algumas funcionalidades
- [ ] 🔴 Alto - Mudanças críticas ou estruturais

#### Riscos identificados:
-

## 📦 Área afetada
<!-- Marque com x as áreas do projeto afetadas -->

### Frontend (Client - React):
- [ ] 🖥️ Componentes React
- [ ] 🔌 Services/API
- [ ] 📝 Types/Interfaces TypeScript
- [ ] 🎨 Estilos e UI

### Backend (Server - Express/Node.js):
- [ ] 🔌 API Routes/Endpoints
- [ ] 📊 Models e lógica de negócio
- [ ] 💾 Persistência de dados

### Funcionalidades:
- [ ] 🎓 Gerenciamento de Estudantes
- [ ] 📋 Gerenciamento de Turmas
- [ ] 📝 Gerenciamento de Matrículas
- [ ] 📈 Gerenciamento de Avaliações
- [ ] 📄 Importação de dados
- [ ] Provas
- [ ] Flashcards
- [ ] Colocar aqui o nome da sua feature

### Infraestrutura:
- [ ] 🔧 Configurações (tsconfig, jest.config, cucumber.js)
- [ ] 📦 Dependências (package.json)
- [ ] 🚀 Scripts de build/deploy
- [ ] 📝 Documentação (README, guias)

## 🔧 Tipo de mudança
<!-- Marque com x o que se aplica -->
- [ ] 🐛 Correção de bug (fix)
- [ ] ✨ Nova funcionalidade (feature)
- [ ] ♻️ Refatoração de código
- [ ] 📚 Atualização de documentação
- [ ] ✅ Adição/atualização de testes
- [ ] 🎨 Melhorias de UI/UX
- [ ] 🔒 Correção de segurança
- [ ] ⚡ Melhoria de performance

## 🧪 Testes
<!-- Descreva como as mudanças foram testadas -->

### Testes automatizados

#### Por nível de teste:
- [ ] 🔬 **Testes Unitários** (Jest) - Classes e funções isoladas
- _Dependências: versões antigas, stubs e drivers_
- [ ] 🔗 **Testes de Integração** - Interação entre componentes/serviços
- _Dependências: novas versões evoluídas por outros desenvolvedores_
- [ ] 🎯 **Testes End-to-End** (Cucumber) - Fluxos completos da aplicação
- _Dependências: todas as dependências envolvidas_
- [ ] 🌐 **Testes de Sistema** - Ambiente completo de produção
- _Dependências: ambiente de produção com dependências externas reais_

#### Por área testada:
- [ ] 🖥️ Testes de GUI (interface do usuário)
- [ ] 📊 Testes de Classes/Models (lógica de negócio)
- [ ] 🔌 Testes de Services/API (comunicação e endpoints)

#### Cobertura:
- [ ] Cobertura de testes mantida/aumentada
- [ ] Casos de erro e edge cases cobertos

### Como revisar e testar
<!-- Adicione etapas mais claras para se testar, se necessário -->

**Testes Unitários (Server):**
```bash
cd server
npm install
npm test # Executar testes
npm run test:watch # Modo watch
npm run test:coverage # Com cobertura
```

**Testes E2E (Client):**
```bash
cd client
npm install
npm start # Terminal 1: iniciar app
npm run test:cucumber # Terminal 2: executar testes
```

**Testar manualmente:**
- Servidor: `http://localhost:3000`
- Cliente: `http://localhost:3004`

## 📸 Screenshots/GIFs
<!-- Se aplicável, adicione capturas de tela ou GIFs das mudanças visuais -->


## ✅ Checklist
<!-- Marque com x tudo que foi feito -->
- [ ] Código segue os padrões do projeto
- [ ] Realizei self-review do código
- [ ] Comentei código em áreas complexas
- [ ] Atualizei a documentação (se necessário)
- [ ] Mudanças não geram warnings
- [ ] Adicionei testes que provam que a correção/feature funciona
- [ ] Testes novos e existentes passam localmente
- [ ] Mudanças dependentes foram merged e publicadas

## 🔗 Issues relacionadas
<!-- Referencie issues relacionadas -->
- Closes #
- Relacionado a #
19 changes: 16 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
node_modules
server/dist
client/build

server/coverage
client/node_modules
server/.env
server/data/app-data.json
node_modules/
server/dist/
client/build/
client/test-results
# Cucumber test reports
client/reports/
cucumber-report.*
# jest coverage directory
coverage/
# multer folder
tmp_data/
212 changes: 212 additions & 0 deletions client/CUCUMBER_TESTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
# Cucumber Testing Setup for Student Management System

This project uses Cucumber for behavior-driven development (BDD) testing with TypeScript and Puppeteer for browser automation.

## 📋 Prerequisites

1. **Backend Server**: The server must be running on `http://localhost:3005`
2. **Frontend Client**: The React app must be running on `http://localhost:3004`
3. **Node.js**: Version 16 or higher
4. **Chrome/Chromium**: For Puppeteer browser automation

## 🚀 Running Tests

### Method 1: Using the Test Runner Script (Recommended)

#### Headless Mode (default - no browser window)
```bash
# From the client directory
./run-cucumber-tests.sh
```

#### Headed Mode (watch tests execute in browser)
```bash
# Normal speed (10ms delay - recommended)
./run-cucumber-tests.sh --headed
# or
./run-cucumber-tests.sh -h

# Fast mode (no delay)
./run-cucumber-tests.sh --headed fast
# or
./run-cucumber-tests.sh --headed-fast
./run-cucumber-tests.sh -hf

# Slow mode (50ms delay - better for demos)
./run-cucumber-tests.sh --headed slow
# or
./run-cucumber-tests.sh --headed-slow
./run-cucumber-tests.sh -hs
```

This script will:
- Check if both server and client are running
- Run all Cucumber tests
- Generate HTML and JSON reports

### Method 2: Manual Execution

#### Headless Mode
```bash
# From the client directory
npm run test:cucumber
```

#### Headed Mode (visible browser)
```bash
# Normal speed (10ms delay)
npm run test:cucumber:headed

# Fast mode (no delay)
npm run test:cucumber:headed:fast

# Slow mode (50ms delay - for demos)
npm run test:cucumber:headed:slow
```

### Method 3: Watch Mode (for development)

```bash
# From the client directory
npm run test:cucumber:watch
```

## 🧪 Test Structure

### Feature Files
- Location: `src/features/*.feature`
- Written in Gherkin syntax
- Define test scenarios in natural language

### Step Definitions
- Location: `src/step-definitions/*.ts`
- TypeScript files that implement the test steps
- Handle browser automation and assertions

### Test Reports
- Location: `reports/`
- HTML report: `cucumber_report.html`
- JSON report: `cucumber_report.json`

## 📝 Current Test Scenarios

### Student Management Feature
- **File**: `src/features/student-management.feature`
- **Scenario**: Add a new student without class association
- **Test Steps**:
1. Verify system is running
2. Clean up any existing test data
3. Navigate to Students tab
4. Fill in student form (name, CPF, email)
5. Submit the form
6. Verify student appears in the list
7. Verify student data is correct
8. Clean up test data

## 🔧 Configuration

### Cucumber Configuration
- **File**: `cucumber.js`
- Defines feature file locations and step definition requirements
- Configures report formats and output locations

### TypeScript Configuration
- **File**: `tsconfig.test.json`
- Specific TypeScript configuration for test files
- Includes test directories and enables necessary features

## 🛠️ Test Data Management

The tests follow the **AAA pattern** (Arrange, Act, Assert) with proper cleanup:

1. **Setup**: Removes any existing test data before starting
2. **Execution**: Performs the test actions
3. **Verification**: Asserts expected results
4. **Cleanup**: Removes test data after completion

### Test Student Data
- **CPF**: `12345678901`
- **Name**: `Test Student`
- **Email**: `test.student@email.com`

## 🎯 Browser Automation

The tests use Puppeteer for browser automation:
- **Headless**: Set to `false` for development (visible browser)
- **Viewport**: 1280x720 for consistent testing
- **Slow Motion**: 50ms delays for visibility during development

## 🔍 Debugging Tests

### View Browser Actions
Set `headless: false` in the step definitions to see the browser in action.

### Check Server Logs
Monitor server console for API calls during tests.

### Inspect Test Reports
Open `reports/cucumber_report.html` in a browser for detailed test results.

## 📦 Dependencies

### Core Testing
- `@cucumber/cucumber`: BDD testing framework
- `puppeteer`: Browser automation
- `@testing-library/react`: React testing utilities
- `@testing-library/jest-dom`: Custom Jest matchers

### TypeScript Support
- `ts-node`: TypeScript execution
- `@types/puppeteer`: TypeScript definitions
- `@types/jest`: Jest type definitions

## 🚨 Troubleshooting

### Server Not Running
```
Error: Server is not available
```
**Solution**: Start the backend server: `npm run dev` (from server directory)

### Client Not Running
```
Error: Navigation timeout
```
**Solution**: Start the frontend: `npm start` (from client directory)

### TypeScript Compilation Issues
```
Error: TS2307: Cannot find module '@jest/globals'
```
**Solution**: The setup uses custom assertion functions instead of Jest. No additional Jest installation needed.

### Cucumber Configuration Issues
```
Error: You're calling functions on an instance of Cucumber that isn't running
```
**Solution**: Ensure setDefaultTimeout is called within step definition files, not in config.

### Port Conflicts
**Solution**: Ensure ports 3004 and 3005 are available

### Browser Issues
**Solution**: Install latest Chrome/Chromium or run headless mode

### Module Resolution Issues
**Solution**: Use direct imports instead of relative imports for better compatibility

## 📈 Adding New Tests

1. **Create Feature File**: Add `.feature` file in `src/features/`
2. **Write Scenarios**: Use Gherkin syntax (Given, When, Then)
3. **Implement Steps**: Add step definitions in `src/step-definitions/`
4. **Follow Patterns**: Use existing test structure for consistency
5. **Include Cleanup**: Always clean up test data

Example new scenario:
```gherkin
Scenario: Delete a student
Given there is a student with CPF "98765432100" in the system
When I delete the student from the list
Then the student should not appear in the list
```
18 changes: 18 additions & 0 deletions client/cucumber.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
default: {
require: [
'ts-node/register',
'src/step-definitions/**/*.ts'
],
format: [
'progress-bar',
'json:reports/cucumber_report.json',
'html:reports/cucumber_report.html'
],
formatOptions: {
snippetInterface: 'async-await'
},
paths: ['src/features/selfEvaluation.feature'],
requireModule: ['ts-node/register']
}
};
Loading