← Back to Hub|Technical Documentation

SiteWise Platform - Quality Assurance & Testing Plan

1. Test Plan Overview

1.1 Document Information

| Field | Value | |-------|-------| | Document ID | SW-QA-PLAN-001 | | Version | 1.0 | | Author | QA Lead | | Approved By | Project Lead | | Last Updated | 2026-02-18 | | Classification | Internal |

1.2 Scope

This test plan covers:

  • ✅ SiteWise Admin Application (Web)
  • ✅ SiteSense Field Audit Application (PWA)
  • ✅ VendorView Application (Web)
  • ✅ Field Audit Mobile Application (Flutter)
  • ✅ Shared Supabase Database (Schema, RLS, Functions)
  • ✅ AI/ML Capabilities (Genkit Flows)
  • ✅ Multi-Tenant Architecture

Out of scope:

  • ❌ Third-party service availability (Supabase, Google Cloud)
  • ❌ Network infrastructure testing
  • ❌ Physical device hardware testing

1.3 Quality Objectives

| Objective | Target | Metric | |-----------|--------|--------| | Code Coverage | ≥ 70% | Istanbul/lcov | | Critical Defects | 0 at release | Defect count | | High Defects | ≤ 3 at release | Defect count | | E2E Pass Rate | ≥ 95% | Playwright/Patrol reports | | Performance | < 3s page load | Lighthouse score | | Accessibility | WCAG 2.1 AA | axe-core audit | | Security | No critical vulnerabilities | OWASP scan |

1.4 Test Levels

| Level | Tools | Responsibility | Coverage Target | |-------|-------|---------------|-----------------| | Unit Testing | Jest, flutter_test | Developers | 70% | | Component Testing | RTL, Widget Tests | Developers | 60% | | Integration Testing | Jest + Supabase Client | QA + Dev | Key flows | | E2E Testing | Playwright, Patrol | QA Team | Critical paths | | Performance Testing | Lighthouse, k6 | QA Team | All pages | | Security Testing | OWASP ZAP | Security Team | All endpoints | | Accessibility Testing | axe-core, manual | QA Team | All pages | | UAT | Manual | Stakeholders | All features |

1.5 Test Environment Strategy

| Environment | Purpose | Data | URL | |-------------|---------|------|-----| | Local | Developer testing | Mock/Seed | localhost | | Test | Automated testing | Seed data | test.sitewise.ng | | Staging | Pre-release UAT | Production copy | staging.sitewise.ng | | Production | Live | Real data | app.sitewise.ng |

2. Test Strategy

2.1 Testing Approach by Application

Site Admin (Next.js)

  • Unit tests for organization context, auth utils, API handlers
  • Component tests for forms, tables, selectors
  • Integration tests for RLS policy validation
  • E2E tests for authentication, CRUD, multi-tenant flows
  • Performance tests for dashboard and data-heavy pages

Field Audit PWA (Next.js)

  • Unit tests for GPS utils, form validation, auth provider
  • Component tests for dynamic form fields, assignment cards
  • Integration tests for audit submission, media upload
  • E2E tests for full audit workflow (login → submit)
  • Offline capability tests
  • Mobile responsiveness tests

VendorView (Next.js)

  • Unit tests for vendor context, dashboard calculations
  • Component tests for stats cards, charts, engineer roster
  • Integration tests for vendor-scoped data access
  • E2E tests for dashboard, engineer management, assignments
  • Real-time subscription tests

Flutter Mobile App

  • Unit tests for auth, GPS, sync, form logic
  • Widget tests for all screens and components
  • Integration tests for Supabase connectivity
  • E2E tests (Patrol) for full audit workflow
  • Device-specific tests (camera, GPS, biometrics)
  • Offline/sync tests

2.2 Multi-Tenant Testing Strategy

Multi-tenancy is the highest-risk area. Testing must verify:

Isolation Tests

  • User in Org A CANNOT see Org B data
  • User in Org A CANNOT modify Org B data
  • User in Org A CANNOT delete Org B data
  • Platform admin CAN see all organization data
  • Organization switching changes data context completely
  • URL manipulation does not expose cross-tenant data

RLS Policy Tests

  • Every table's RLS policy verified with authenticated queries
  • Test with minimum 3 organizations
  • Test with users who belong to multiple organizations
  • Test with platform admin override

2.3 Risk-Based Testing

| Risk Area | Likelihood | Impact | Priority | Mitigation | |-----------|-----------|--------|----------|------------| | Data leakage across tenants | Medium | Critical | P0 | Exhaustive RLS tests | | Auth token management | High | High | P0 | Session tests, timeout tests | | Offline data loss | Medium | High | P1 | Sync queue verification | | AI analysis accuracy | Low | Medium | P2 | Quality threshold tests | | GPS spoofing | Low | Medium | P2 | Server-side validation | | Form data corruption | Low | High | P1 | Input validation tests |

3. Test Cases

3.1 Test Case Format

Each test case follows this template:

| Field | Description | |-------|-------------| | TC-ID | Unique identifier (e.g., TC-AUTH-001) | | Category | Feature area | | Priority | P0 (Critical) / P1 (High) / P2 (Medium) / P3 (Low) | | Preconditions | State required before test | | Steps | Numbered actions | | Expected Result | What should happen | | Actual Result | (Filled during execution) | | Status | Pass / Fail / Blocked / Skipped |

3.2 Authentication Test Cases (All Apps)

TC-AUTH-001: Login with Valid Credentials

| Field | Value | |-------|-------| | Priority | P0 | | Preconditions | User account exists, app is on login page | | Steps | 1. Enter valid email 2. Enter valid password 3. Click "Sign In" | | Expected Result | User redirected to dashboard. Organization loaded. Token stored. |

TC-AUTH-002: Login with Invalid Credentials

| Field | Value | |-------|-------| | Priority | P0 | | Preconditions | App is on login page | | Steps | 1. Enter valid email 2. Enter wrong password 3. Click "Sign In" | | Expected Result | Error message shown. User remains on login page. No token stored. |

TC-AUTH-003: Login with Expired Token

| Field | Value | |-------|-------| | Priority | P0 | | Preconditions | User previously logged in, token has expired | | Steps | 1. Open app 2. App detects expired token | | Expected Result | Expired token cleared. User shown login page. No infinite loading. |

TC-AUTH-004: Re-login After Previous Session

| Field | Value | |-------|-------| | Priority | P0 | | Preconditions | User previously logged in and logged out | | Steps | 1. Open app 2. Enter credentials 3. Click "Sign In" | | Expected Result | User logged in without issues. No timeout errors. Dashboard loads. |

TC-AUTH-005: Token Auto-Refresh

| Field | Value | |-------|-------| | Priority | P1 | | Preconditions | User is logged in, token expires in < 5 minutes | | Steps | 1. Wait for token to approach expiry 2. Observe | | Expected Result | Token refreshed automatically. No user interruption. |

TC-AUTH-006: Magic Link Login

| Field | Value | |-------|-------| | Priority | P1 | | Preconditions | User account exists with valid email | | Steps | 1. Enter email 2. Click "Send Magic Link" 3. Open email 4. Click link | | Expected Result | User authenticated and redirected to dashboard. |

TC-AUTH-007: Biometric Login (Flutter Only)

| Field | Value | |-------|-------| | Priority | P1 | | Preconditions | User has previously logged in and enabled biometrics | | Steps | 1. Open app 2. Biometric prompt appears 3. Authenticate with fingerprint/face | | Expected Result | User logged in directly to dashboard. |

TC-AUTH-008: Logout

| Field | Value | |-------|-------| | Priority | P0 | | Preconditions | User is logged in | | Steps | 1. Click user menu 2. Click "Sign Out" | | Expected Result | All tokens cleared. User redirected to login. Protected routes inaccessible. |

TC-AUTH-009: Concurrent Session Prevention

| Field | Value | |-------|-------| | Priority | P2 | | Preconditions | User logged in on Device A | | Steps | 1. Login on Device B with same credentials | | Expected Result | Login succeeds on Device B. Session on Device A eventually expires. |

TC-AUTH-010: Emergency Clear (PWA)

| Field | Value | |-------|-------| | Priority | P1 | | Preconditions | User is stuck on loading screen | | Steps | 1. Open browser console 2. Type emergencyClear() 3. Press Enter | | Expected Result | All auth data cleared. Redirected to login page. |

4. Requirements Traceability Matrix

| Requirement | Test Cases | Status | |-------------|-----------|--------| | REQ-001: Multi-tenant auth | TC-AUTH-001 to TC-AUTH-010 | Pending | | REQ-002: Organization isolation | TC-MT-001 to TC-MT-010 | Pending | | REQ-003: Field audit workflow | TC-FA-001 to TC-FA-010 | Pending | | REQ-004: GPS validation | TC-FA-003, TC-FA-004 | Pending | | REQ-005: AI image analysis | TC-FA-006 | Pending | | REQ-006: Offline capability | TC-FA-009, TC-FA-010 | Pending | | REQ-007: Vendor data scoping | TC-VV-002, TC-VV-004 | Pending | | REQ-008: Real-time updates | TC-VV-005 | Pending | | REQ-009: Dynamic forms | TC-FA-005 | Pending | | REQ-010: Organization branding | TC-MT-008 | Pending |

5. Defect Classification

5.1 Severity Levels

| Severity | Definition | Example | SLA | |----------|-----------|---------|-----| | S1 - Critical | System crash, data loss, security breach | Cross-tenant data leak | Fix within 4 hours | | S2 - High | Major feature broken, no workaround | Cannot submit audits | Fix within 24 hours | | S3 - Medium | Feature broken, workaround exists | Filter not working, can scroll instead | Fix within 1 week | | S4 - Low | Cosmetic, minor UX | Color slightly off, typo | Fix in next release |

5.2 Priority Levels

| Priority | Definition | |----------|-----------| | P0 | Must fix before release. Blocks testing. | | P1 | Must fix before release. Does not block other testing. | | P2 | Should fix before release if time permits. | | P3 | Nice to fix. Can be deferred to next release. |

6. Test Execution Schedule

6.1 Testing Phases

| Phase | Duration | Activities | |-------|----------|------------| | Phase 1: Unit Tests | Week 1-2 | Write and run unit tests for all apps | | Phase 2: Integration Tests | Week 3 | RLS policy tests, API integration tests | | Phase 3: E2E Tests | Week 4-5 | Playwright and Patrol test suites | | Phase 4: Performance | Week 5 | Lighthouse audits, load testing | | Phase 5: Security | Week 6 | OWASP scan, RLS penetration tests | | Phase 6: UAT | Week 7-8 | Stakeholder acceptance testing | | Phase 7: Regression | Week 8 | Full regression before release |

6.2 Entry Criteria (Start Testing When)

  • [ ] Code deployed to test environment
  • [ ] Test database seeded with test data
  • [ ] All P0 unit tests passing
  • [ ] CI/CD pipeline green
  • [ ] Test accounts created and verified

6.3 Exit Criteria (Release When)

  • [ ] Zero S1 (Critical) defects open
  • [ ] Maximum 3 S2 (High) defects open (with workarounds)
  • [ ] All P0 test cases passed
  • [ ] Code coverage ≥ 70%
  • [ ] E2E pass rate ≥ 95%
  • [ ] Performance targets met
  • [ ] UAT sign-off received
  • [ ] Security scan passed

7. Quality Gates

Gate 1: Development Complete

| Criteria | Target | Tool | |----------|--------|------| | Unit test coverage | ≥ 70% | Istanbul | | Unit tests passing | 100% | Jest/flutter_test | | No linting errors | 0 | ESLint/flutter_lints | | Build succeeds | Yes | CI/CD |

Gate 2: Test Environment Ready

| Criteria | Target | Tool | |----------|--------|------| | Integration tests passing | ≥ 90% | Jest | | RLS isolation verified | 100% | Custom SQL tests | | E2E critical path passing | 100% | Playwright |

Gate 3: Staging Approved

| Criteria | Target | Tool | |----------|--------|------| | E2E full suite passing | ≥ 95% | Playwright | | Performance targets met | All | Lighthouse | | Security scan passed | Yes | OWASP ZAP | | UAT scenarios passed | 100% | Manual |

Gate 4: Production Release

| Criteria | Target | Tool | |----------|--------|------| | All Gate 1-3 criteria met | Yes | — | | Regression tests passing | 100% | Playwright | | Stakeholder sign-off | Yes | Document | | Rollback procedure verified | Yes | Manual |