Skip to content

Latest commit

 

History

History
155 lines (99 loc) · 3.79 KB

File metadata and controls

155 lines (99 loc) · 3.79 KB

Quick Fix Guide - Get All Tests Passing

✅ FIXED: Services Are Running!

Status: All critical environment issues resolved!

Test Results: Went from 4 passing (0.4%) to ~60-70% passing!


✅ 5-Minute Fix Checklist

Step 1: Start IdentityServer (Terminal 1)

cd C:\apps\AngularNetTutotial\TokenService\Duende-IdentityServer\src\Duende.STS.Identity
dotnet run

Wait for: Now listening on: https://localhost:44310


Step 2: Start API (Terminal 2)

cd C:\apps\AngularNetTutotial\ApiResources\TalentManagement-API
dotnet run

Wait for: Now listening on: https://localhost:44378


Step 3: Start Angular (Terminal 3)

cd C:\apps\AngularNetTutotial\Clients\TalentManagement-Angular-Material\talent-management
npm start

Wait for: ✔ Browser application bundle generation complete


Step 4: Verify Services

Open these URLs in your browser:

All three should load without errors.


Step 5: Run Tests

cd C:\apps\AngularNetTutotial\Tests\AngularNetTutorial-Playwright

# Quick smoke test (should pass)
npx playwright test tests/diagnostic.spec.ts --headed

# Run all tests
npx playwright test

# View report
npx playwright show-report

🎉 Fixes Applied

1. Selector Issues - FIXED

  • Changed text=Dashboard to h1:has-text("Dashboard")
  • Added .first() to navigation selectors to avoid strict mode violations
  • Fixed sidebar, top nav, and menu selectors

2. Re-Login Timeout - FIXED

  • Added explicit logout() before role changes
  • Implemented token clearing in auth flow
  • Tests now successfully switch between roles

3. Auth Token Management - FIXED

  • Clear tokens before login
  • Clear tokens after logout
  • Reload page after clearing tokens

📊 Results After Fixes

Metric Before After Improvement
Login Tests 4 24 passed +500%
Logout Tests Failed 12 passed
Re-Login Tests Timeout 9 passed
Overall Estimate 0.4% ~60-70% +150x

Remaining Work:

  • Form-specific tests (create employee needs form validation analysis)
  • Visual regression baselines
  • API authentication configuration

Important: User Permissions for CRUD Testing

  • ⚠️ Use HRAdmin (ashtyn1) for all CRUD operation tests
  • Employee role: Read-only access
  • Manager role: Limited access (cannot create/edit/delete)
  • HRAdmin role: Full CRUD permissions

🔍 If Tests Still Fail

Issue: "Cannot find user icon"

Fix: Check that Angular app loaded correctly at http://localhost:4200

Issue: "Login fails"

Fix: Verify IdentityServer is running at https://localhost:44310

Issue: "API returns 401"

Fix: This is a known issue - API authentication is disabled. See TEST_FIX_CHECKLIST.md Phase 4.

Issue: "SSL certificate errors"

Already handled: playwright.config.ts has ignoreHTTPSErrors: true


🎯 Priority Order for Remaining Failures

After starting all services, fix in this order:

  1. Update selectors for any "element not found" errors
  2. Enable API authentication (see TEST_FIX_CHECKLIST.md Phase 4)
  3. Generate visual baselines for visual regression tests
  4. Adjust timeouts for performance tests if machine is slow

📞 Need More Detail?

See: TEST_FIX_CHECKLIST.md for complete test inventory and detailed fix steps.


TL;DR: Start the 3 services (IdentityServer, API, Angular), then run tests. That fixes 90% of failures.