Skip to content

fix(security): Improve SQL parameterization for geodatasets + comprehensive tests #167

fix(security): Improve SQL parameterization for geodatasets + comprehensive tests

fix(security): Improve SQL parameterization for geodatasets + comprehensive tests #167

name: Playwright Tests
on:
push:
branches: [master, main, development]
pull_request:
branches: [master, main, development]
jobs:
test:
timeout-minutes: 30
runs-on: ubuntu-latest
strategy:
matrix:
auth_mode: [off, local]
services:
postgres:
image: postgis/postgis:13-3.1
env:
POSTGRES_DB: mmgis-test
POSTGRES_USER: test_user
POSTGRES_PASSWORD: test_password
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "18"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium
- name: Setup test environment
run: |
cp sample.env .env || touch .env
echo "NODE_ENV=test" >> .env
echo "PORT=18888" >> .env
echo "AUTH=${{ matrix.auth_mode }}" >> .env
echo "DB_HOST=localhost" >> .env
echo "DB_PORT=5432" >> .env
echo "DB_NAME=mmgis-test" >> .env
echo "DB_USER=test_user" >> .env
echo "DB_PASS=test_password" >> .env
echo "ENABLE_MMGIS_WEBSOCKETS=false" >> .env
echo "ENABLE_CONFIG_WEBSOCKETS=false" >> .env
echo "HIDE_CONFIG=false" >> .env
# DB creation, Reference Mission setup, and server lifecycle are all
# handled by tests/global-setup.js (runs before any test suite).
# No manual init-db / server start / curl steps needed.
- name: Run Unit Tests
run: npx playwright test tests/unit --project=chromium
env:
AUTH: ${{ matrix.auth_mode }}
PLAYWRIGHT_TEST_UNIT_ONLY: "true"
- name: Run E2E API Tests
run: npx playwright test tests/e2e/api tests/e2e/security tests/e2e/startup --project=chromium
env:
AUTH: ${{ matrix.auth_mode }}
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report-${{ matrix.auth_mode }}
path: playwright-report/
retention-days: 30
- name: Upload test artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.auth_mode }}
path: test-results/
retention-days: 7