Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
46 changes: 46 additions & 0 deletions .github/branch-protection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Branch Protection Setup

To require passing tests before merging pull requests, configure branch protection rules:

## GitHub Repository Settings

1. Go to **Settings** → **Branches**
2. Click **Add rule** or edit existing rule for `main` branch
3. Configure the following settings:

### Required Settings
- ✅ **Require a pull request before merging**
- ✅ **Require status checks to pass before merging**
- ✅ **Require branches to be up to date before merging**

### Required Status Checks
Add these status checks:
- `test` (from CI workflow)
- `tests-required` (from CI workflow)

### Recommended Settings
- ✅ **Restrict pushes that create files larger than 100 MB**
- ✅ **Require conversation resolution before merging**
- ✅ **Do not allow bypassing the above settings**

## Alternative: Using GitHub CLI

```bash
# Enable branch protection with required tests
gh api repos/:owner/:repo/branches/main/protection \
--method PUT \
--field required_status_checks='{"strict":true,"checks":[{"context":"test"},{"context":"tests-required"}]}' \
--field enforce_admins=true \
--field required_pull_request_reviews='{"required_approving_review_count":1}' \
--field restrictions=null
```

## Verification

Once configured:
1. All pull requests will require passing tests
2. Direct pushes to main branch will be blocked
3. Tests must pass before merging is allowed
4. The "tests-required" job ensures test completion

This ensures code quality and prevents breaking changes from being merged into the main branch.
58 changes: 58 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CI

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

jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium

- name: Build application
run: npm run build

- name: Run linting
run: npm run lint

- name: Run Playwright tests
run: npm run test
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1

- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30

# This job will be required for merging PRs
tests-required:
runs-on: ubuntu-latest
needs: test
if: always()
steps:
- name: Check test results
run: |
if [ "${{ needs.test.result }}" != "success" ]; then
echo "Tests failed or were cancelled"
exit 1
fi
echo "All tests passed!"
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,51 @@ The script requires these data files to be present:

Both files are included in the repository.

## Testing

Nextlog includes comprehensive end-to-end tests using Playwright to ensure application stability and feature reliability.

### Running Tests

```bash
# Run all tests
npm test

# Run tests for specific browser
npm run test:chromium

# Run tests in headed mode (visible browser)
npm run test:headed

# Run tests in UI mode for debugging
npm run test:ui

# View test report
npm run test:report
```

### Test Coverage

The test suite covers:
- **Authentication**: Login and registration flows
- **Navigation**: Page routing and redirects
- **Forms**: Input validation and submission
- **Responsive Design**: Mobile and desktop layouts
- **Error Handling**: Database connection failures
- **Core Features**: Contact management, awards, ADIF import/export
- **Build Quality**: JavaScript errors, CSS loading, performance
- **Security**: Protected routes and authentication redirects

### Continuous Integration

Tests run automatically on:
- Pull requests to main/develop branches
- Pushes to main/develop branches

The CI workflow requires all tests to pass before merging. See `/.github/workflows/ci.yml` and `/.github/branch-protection.md` for setup details.

See `/tests/README.md` for detailed testing documentation.

## Usage

1. **Register**: Create a new account with your amateur radio callsign
Expand Down
65 changes: 65 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@
"dev": "next dev --turbopack",
"build": "next build",
"start": "next start",
"lint": "next lint"
"lint": "next lint",
"test": "playwright test",
"test:ui": "playwright test --ui",
"test:debug": "playwright test --debug",
"test:headed": "playwright test --headed",
"test:chromium": "playwright test --project=chromium",
"test:report": "playwright show-report",
"test:install": "playwright install"
},
"dependencies": {
"@azure/storage-blob": "^12.27.0",
Expand Down Expand Up @@ -40,6 +47,7 @@
},
"devDependencies": {
"@eslint/eslintrc": "^3",
"@playwright/test": "^1.54.2",
"@tailwindcss/postcss": "^4",
"@types/bcryptjs": "^2.4.6",
"@types/jsonwebtoken": "^9.0.10",
Expand All @@ -49,6 +57,7 @@
"@types/react-dom": "^19",
"eslint": "^9",
"eslint-config-next": "15.3.5",
"playwright": "^1.54.2",
"tailwindcss": "^4",
"typescript": "5.8.3"
}
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Page snapshot

```yaml
- paragraph: Checking system status...
```
77 changes: 77 additions & 0 deletions playwright-report/index.html

Large diffs are not rendered by default.

Loading