Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
06cb930
update gitignore to ignore docs folder
vas2000-emu Sep 23, 2025
30944a7
Merge branch 'main' of https://github.com/COSC481W-2025Fall/Vybe into…
vas2000-emu Oct 1, 2025
a8fe713
Added Github Actions
vas2000-emu Oct 1, 2025
4b691ad
Merge pull request #48 from COSC481W-2025Fall/github-actions-vas
vas2000-emu Oct 1, 2025
935c0ee
fixed minor page bug.
vas2000-emu Oct 1, 2025
330962f
Merge pull request #49 from COSC481W-2025Fall/github-actions-vas
vas2000-emu Oct 1, 2025
9ef4b7d
Added a filler Home page and updated some tests.
vas2000-emu Oct 1, 2025
0589927
Merge pull request #50 from COSC481W-2025Fall/github-actions-vas
vas2000-emu Oct 1, 2025
7b02adf
feat(settings): Implement Task 1 Account Settings Interface
eabdelkh Oct 27, 2025
2d410a2
chore: Add documentation files to .gitignore
eabdelkh Oct 27, 2025
432c72f
feat: Add profile settings page with picture upload and update functi…
eabdelkh Oct 31, 2025
4fa24d3
feat: Implement Task 3 - Privacy Settings functionality
eabdelkh Nov 1, 2025
e1352a0
feat: Implement Task 4 - Notification Preferences functionality
eabdelkh Nov 1, 2025
dbcf12d
feat: Implement Task 5 - Account Deletion and Data Export functionality
eabdelkh Nov 1, 2025
f34f520
feat: Implement Task 6 - Settings Persistence and Sync functionality
eabdelkh Nov 2, 2025
e9b3512
feat: Implement Task 7 - Comprehensive validation and conflict resolu…
eabdelkh Nov 2, 2025
a99d24d
Potential fix for code scanning alert no. 5: Incomplete multi-charact…
vas2000-emu Nov 3, 2025
bf0383e
Potential fix for code scanning alert no. 4: Incomplete URL scheme check
vas2000-emu Nov 3, 2025
471fb8c
fix: Use correct Zod error property (issues instead of errors) in tests
eabdelkh Nov 3, 2025
062bcc0
Merge remote-tracking branch 'origin/feature/pbi-59-account-settings'
eabdelkh Nov 3, 2025
fd06a96
fix: Correct all Zod error property checks to use 'issues' instead of…
eabdelkh Nov 3, 2025
11fe7d0
fix: Fix sanitization functions and update schema test assertions for…
eabdelkh Nov 3, 2025
215c939
fix: Enhance sanitization utilities to properly remove XSS attack vec…
eabdelkh Nov 3, 2025
0bc2491
fix: Update schema validation test assertions to match Zod v4 error m…
eabdelkh Nov 3, 2025
0640094
fix: Correct sanitization and schema validation to match test expecta…
eabdelkh Nov 3, 2025
ea66d89
fix: Resolve Vitest ESM error and fix data: protocol sanitization test
eabdelkh Nov 3, 2025
0cc5d75
fix: Fix removeDangerousChars to remove script tags before angle brac…
eabdelkh Nov 3, 2025
b0a36ee
Potential fix for code scanning alert no. 22: Incomplete multi-charac…
eabdelkh Nov 3, 2025
48be682
fix(sanitization/profile-schema): remove script remnants and ensure d…
eabdelkh Nov 3, 2025
3a5e010
fix: Remove vitest.config.ts to use ESM-compatible .mjs config
eabdelkh Nov 3, 2025
f34ec48
fix(profile-schema): ensure correct error messages for missing/invali…
eabdelkh Nov 3, 2025
619703b
fix(vitest): resolve @ alias using path.resolve instead of URL pathname
eabdelkh Nov 3, 2025
b9585a4
Merge remote changes: resolve conflict in sanitization.js
eabdelkh Nov 3, 2025
3f50933
fix(security): harden sanitization to pass CodeQL security scans
eabdelkh Nov 3, 2025
16cc5b7
fix(security): refactor sanitization for CodeQL compliance
eabdelkh Nov 3, 2025
ec7e4e7
refactor(security): comprehensive CodeQL-compliant sanitization refactor
eabdelkh Nov 3, 2025
44c2fbd
fix(security): refactor removeDangerousChars with iterative replaceme…
eabdelkh Nov 3, 2025
dcc9dc1
Potential fix for code scanning alert no. 49: Incomplete multi-charac…
vas2000-emu Nov 3, 2025
9f6c27c
Potential fix for code scanning alert no. 58: Incomplete multi-charac…
vas2000-emu Nov 3, 2025
c2d6d1b
Potential fix for code scanning alert no. 59: Incomplete multi-charac…
vas2000-emu Nov 3, 2025
cddba58
Potential fix for code scanning alert no. 52: Incomplete multi-charac…
vas2000-emu Nov 3, 2025
af935e8
Potential fix for code scanning alert no. 55: Bad HTML filtering regexp
vas2000-emu Nov 3, 2025
9821653
Potential fix for code scanning alert no. 60: Incomplete multi-charac…
vas2000-emu Nov 3, 2025
5d07661
Potential fix for code scanning alert no. 61: Incomplete multi-charac…
vas2000-emu Nov 3, 2025
aa359c0
Delete PR_DESCRIPTION.md
eabdelkh Nov 3, 2025
925ff92
Fixing codeql errors
vas2000-emu Nov 3, 2025
1a8ed9a
Merge branch 'feature/pbi-59-account-settings' of https://github.com/…
vas2000-emu Nov 3, 2025
63d10fa
Fixing codeql errors
vas2000-emu Nov 3, 2025
d9cebef
Fixing codeql errors
vas2000-emu Nov 3, 2025
387d5c9
Fixing codeql errors
vas2000-emu Nov 3, 2025
577c254
Fixing codeql errors
vas2000-emu Nov 3, 2025
b6bd1db
Fixing codeql errors
vas2000-emu Nov 3, 2025
31ab4fb
Potential fix for code scanning alert no. 67: Incomplete multi-charac…
vas2000-emu Nov 3, 2025
85d6fce
fix: resolve CodeQL security alerts with safe sanitization
eabdelkh Nov 3, 2025
ada1e2f
fix: resolve CodeQL security alerts with safe sanitization
eabdelkh Nov 3, 2025
7af4a03
fix: resolve Vite JSX parsing error in sanitization tests
eabdelkh Nov 3, 2025
67942f0
fix: restore test suite compatibility with secure sanitization
eabdelkh Nov 3, 2025
af73fa2
Fix sanitization utilities to pass all tests
eabdelkh Nov 3, 2025
789b7bf
Fix CodeQL security alerts: ReDoS, script tag regex, and vbscript check
eabdelkh Nov 3, 2025
b5968bd
Fix script end tag regex to handle attributes in closing tags
eabdelkh Nov 3, 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
70 changes: 70 additions & 0 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: CI/CD Pipeline

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]

env:
NODE_VERSION: '20'
PYTHON_VERSION: '3.11'

jobs:
# Run all tests
test:
name: Run Tests
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

# Frontend tests
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: 'apps/web/package-lock.json'

- name: Install frontend dependencies
working-directory: ./apps/web
run: npm ci

- name: Run frontend tests
working-directory: ./apps/web
run: npm test -- --run

# Backend tests
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install backend dependencies
working-directory: ./backend
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-dev.txt

- name: Run backend tests
working-directory: ./backend
run: pytest

# Deployment Protection - Block deployment if tests fail
# Note: CodeQL analysis runs separately and will block merging if security issues are found
deployment-protection:
name: Deployment Protection
runs-on: ubuntu-latest
needs: test
if: failure()

steps:
- name: Block deployment on test failure
run: |
echo "❌ Tests failed - deployment should be blocked"
echo "Please fix failing tests before deploying"
echo "CodeQL analysis runs separately and will also block merging if security issues are found"
exit 1
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,12 @@ docs/

.cursorignore
sprint-1-assignee-breakdown.txt
get-issues.ps1
get-issues.ps1

# Documentation
docs/
# Task Completion Reports
TASK-*.md
PBI-59-ACCOUNT-SETTINGS-BREAKDOWN.md
# Supabase Setup Guides
SUPABASE_*.md
202 changes: 103 additions & 99 deletions apps/web/TESTING.md
Original file line number Diff line number Diff line change
@@ -1,135 +1,139 @@
# Testing Setup
# Frontend Testing Guide

This project uses a comprehensive testing framework with both unit tests and end-to-end tests.
This document explains how to run and write tests for the Vybe frontend application.

## Testing Stack
## Test Structure

- **Vitest**: Fast unit testing framework with React Testing Library
- **Playwright**: End-to-end testing for browser automation
- **React Testing Library**: Component testing utilities
- **Jest DOM**: Custom matchers for DOM testing
The frontend uses two testing frameworks:
- **Vitest** - Unit and component tests
- **Playwright** - End-to-end (E2E) tests

## Running Tests

### Unit Tests

### Install Dependencies
```bash
# Run all unit tests
npm test

# Run tests in watch mode
npm run test

# Run tests once (CI mode)
npm run test:run
npm install
```

# Open Vitest UI
npm run test:ui
### All Tests
```bash
npm run test:all
```

### End-to-End Tests
### Unit Tests Only
```bash
npm test -- --run
```

### E2E Tests Only
```bash
# Run Playwright tests
npm run test:e2e

# Run Playwright tests in headed mode
npm run test:e2e:headed

# Run Playwright tests in debug mode
npm run test:e2e:debug
```

### All Tests

### Interactive Test UI
```bash
# Run both unit and E2E tests
npm run test:all
npm run test:ui
```

## Test Structure
### E2E Tests with Browser
```bash
npm run test:e2e:headed
```

```text
apps/web/
├── components/
│ └── __tests__/ # Component unit tests
│ ├── Navbar.test.jsx
│ └── LibraryView.test.jsx
├── test/
│ ├── setup.ts # Test setup configuration
│ ├── helpers.js # Test helper utilities
│ └── utils.test.js # Utility function tests
├── tests/
│ └── e2e/ # End-to-end tests
│ └── app.spec.ts
├── vitest.config.ts # Vitest configuration
└── playwright.config.ts # Playwright configuration
### Debug E2E Tests
```bash
npm run test:e2e:debug
```

## Writing Tests
## Test Files

### Unit Test Guidelines
### Unit Tests
- `components/__tests__/` - Component tests
- `test/` - Utility and helper tests

- Use `describe` and `it` blocks for test organization
- Import testing utilities from `@testing-library/react`
- Mock external dependencies using `vi.mock()`
- Test component rendering, user interactions, and state changes
### E2E Tests
- `tests/e2e/` - End-to-end test scenarios

### End-to-End Test Guidelines
## Writing Tests

- Use Playwright's `test` and `expect` functions
- Test complete user workflows
- Verify page navigation and interactions
- Test responsive design across different viewports
### Component Tests
```javascript
import { render, screen } from '@testing-library/react'
import { expect, test } from 'vitest'
import MyComponent from '../MyComponent'

## Configuration
test('renders component', () => {
render(<MyComponent />)
expect(screen.getByText('Hello')).toBeInTheDocument()
})
```

### Vitest Configuration
### E2E Tests
```javascript
import { test, expect } from '@playwright/test'

- Configured with React plugin and jsdom environment
- Includes path aliases for `@/` imports
- Setup file includes Jest DOM matchers and act warning suppression
- Enhanced ESM compatibility with esbuild configuration
- CSS processing enabled for component testing
test('user can sign in', async ({ page }) => {
await page.goto('/sign-in')
await page.fill('[data-testid="email"]', 'test@example.com')
await page.click('[data-testid="sign-in-button"]')
await expect(page).toHaveURL('/dashboard')
})
```

### Playwright Configuration
## Test Configuration

- Configured for Chrome, Firefox, and Safari
- Automatically starts dev server before tests with 2-minute timeout
- Includes trace collection for debugging
- Robust error handling with stdout/stderr piping
### Vitest
- Configuration: `vitest.config.ts`
- Test utilities: `test/test-utils.jsx`
- Setup file: `test/setup.ts`

## Demo Tests Included
### Playwright
- Configuration: `playwright.config.ts`
- Test helpers: `test/helpers.js`

1. **Navbar Component**: Tests brand rendering, navigation links, and active states
2. **LibraryView Component**: Tests Spotify integration, tab switching, and data loading
3. **Utility Functions**: Tests time formatting helper functions
4. **E2E App Flow**: Tests homepage, navigation, and responsive design
## Best Practices

## Test Results & Performance
### Component Testing
- Use `data-testid` attributes for reliable element selection
- Test user interactions, not implementation details
- Mock external dependencies
- Test accessibility with `jest-axe`

- **Unit Tests**: 20 tests passing (comprehensive component and utility coverage)
- **E2E Tests**: 4 comprehensive tests covering navigation and responsive design
- **Performance**: Tests run efficiently with proper mocking and act warning suppression
- **Maintainability**: Centralized test helpers and parameterized test cases
### E2E Testing
- Test critical user journeys
- Use page object pattern for complex flows
- Keep tests independent and isolated
- Use meaningful test descriptions

## Best Practices
## Debugging Tests

- Write tests that focus on user behavior rather than implementation details
- Use meaningful test descriptions
- Mock external API calls and dependencies
- Test both happy paths and error scenarios
- Keep tests isolated and independent
- Use data-testid attributes for reliable element selection when needed
- Leverage test helpers for consistent mock data and selectors
- Use parameterized tests for comprehensive coverage of utility functions

## Recent Improvements

- ✅ Fixed all markdown linting issues (15 → 0)
- ✅ Enhanced test configuration with better ESM compatibility
- ✅ Added act warning suppression for cleaner test output
- ✅ Improved E2E tests with proper wait states and network idle checks
- ✅ Created centralized test helpers for better maintainability
- ✅ Added comprehensive test scripts for different scenarios
- ✅ Enhanced utility tests with parameterized test cases
### Unit Tests
- Use `console.log()` for debugging
- Run specific tests with `test.only()`
- Use `test.skip()` to temporarily skip tests

### E2E Tests
- Use `npm run test:e2e:debug` for step-by-step debugging
- Take screenshots with `await page.screenshot()`
- Use `await page.pause()` to pause execution

## CI/CD Integration

Tests run automatically in GitHub Actions:
- Unit tests run on every push and PR
- E2E tests run on every push and PR
- All tests must pass before deployment

## Troubleshooting

### Common Issues
- **Tests failing**: Check console output for error messages
- **E2E timeouts**: Increase timeout in `playwright.config.ts`
- **Component not found**: Verify `data-testid` attributes
- **Async issues**: Use `await` for async operations

### Getting Help
- Check test output in terminal
- Review test configuration files
- Look at existing test examples
- Check GitHub Actions logs for CI failures
Loading