Skip to content

Commit 5709dd9

Browse files
committed
feat(test): complete Feature 1.5.2 remaining items
- Add logout E2E tests for token revocation (access + refresh tokens) - Add end_session_endpoint discovery check test - Document CI runner platform requirements for MAUI/WPF UI automation - Add tiered CI workflow (unit -> integration -> E2E -> full suite) Tests verify: - Access token revocation makes token inactive via introspection - Refresh token revocation prevents further token refresh - Discovery correctly reports end_session_endpoint availability All Feature 1.5.2 checklist items now complete.
1 parent 0a4e98e commit 5709dd9

File tree

4 files changed

+752
-13
lines changed

4 files changed

+752
-13
lines changed
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: CoreIdent Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
schedule:
9+
# Nightly build to catch regressions
10+
- cron: '0 2 * * *'
11+
12+
env:
13+
DOTNET_VERSION: '10.0.x'
14+
15+
jobs:
16+
# Tier 1: Unit tests - fast, always run
17+
unit-tests:
18+
name: Unit Tests
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Setup .NET
25+
uses: actions/setup-dotnet@v4
26+
with:
27+
dotnet-version: ${{ env.DOTNET_VERSION }}
28+
29+
- name: Restore
30+
run: dotnet restore CoreIdent.sln
31+
32+
- name: Build
33+
run: dotnet build CoreIdent.sln --no-restore -c Release
34+
35+
- name: Run Unit Tests
36+
run: dotnet test tests/CoreIdent.Core.Tests --no-build -c Release --verbosity minimal
37+
38+
# Tier 2: Integration tests - medium speed, always run
39+
integration-tests:
40+
name: Integration Tests
41+
runs-on: ubuntu-latest
42+
needs: unit-tests
43+
steps:
44+
- name: Checkout
45+
uses: actions/checkout@v4
46+
47+
- name: Setup .NET
48+
uses: actions/setup-dotnet@v4
49+
with:
50+
dotnet-version: ${{ env.DOTNET_VERSION }}
51+
52+
- name: Restore
53+
run: dotnet restore CoreIdent.sln
54+
55+
- name: Build
56+
run: dotnet build CoreIdent.sln --no-restore -c Release
57+
58+
- name: Run Integration Tests
59+
run: dotnet test tests/CoreIdent.Integration.Tests --no-build -c Release --verbosity minimal
60+
61+
# Tier 3: E2E and Browser tests - slower, run on main/nightly/PRs
62+
e2e-tests:
63+
name: E2E Tests
64+
runs-on: ubuntu-latest
65+
needs: integration-tests
66+
if: github.ref == 'refs/heads/main' || github.event.schedule != '' || github.event.pull_request != null
67+
steps:
68+
- name: Checkout
69+
uses: actions/checkout@v4
70+
71+
- name: Setup .NET
72+
uses: actions/setup-dotnet@v4
73+
with:
74+
dotnet-version: ${{ env.DOTNET_VERSION }}
75+
76+
- name: Install Playwright
77+
run: dotnet playwright install --with-deps chromium
78+
79+
- name: Restore
80+
run: dotnet restore CoreIdent.sln
81+
82+
- name: Build
83+
run: dotnet build CoreIdent.sln --no-restore -c Release
84+
85+
- name: Run E2E Tests
86+
run: dotnet test tests/CoreIdent.E2E.Tests --no-build -c Release --filter "Category=E2E" --verbosity minimal
87+
env:
88+
PLAYWRIGHT_TRACES: ${{ github.event_name != 'pull_request' }}
89+
PLAYWRIGHT_SCREENSHOTS: ${{ github.event_name != 'pull_request' }}
90+
91+
- name: Upload Playwright Traces
92+
if: failure() && github.event_name != 'pull_request'
93+
uses: actions/upload-artifact@v4
94+
with:
95+
name: playwright-traces
96+
path: playwright-traces/
97+
98+
# Full test suite - main branch only
99+
full-test-suite:
100+
name: Full Test Suite
101+
runs-on: ubuntu-latest
102+
needs: e2e-tests
103+
if: github.ref == 'refs/heads/main' || github.event.schedule != ''
104+
steps:
105+
- name: Checkout
106+
uses: actions/checkout@v4
107+
108+
- name: Setup .NET
109+
uses: actions/setup-dotnet@v4
110+
with:
111+
dotnet-version: ${{ env.DOTNET_VERSION }}
112+
113+
- name: Install Playwright
114+
run: dotnet playwright install --with-deps chromium
115+
116+
- name: Restore
117+
run: dotnet restore CoreIdent.sln
118+
119+
- name: Build
120+
run: dotnet build CoreIdent.sln --no-restore -c Release
121+
122+
- name: Run All Tests
123+
run: dotnet test CoreIdent.sln --no-build -c Release --filter "Category!=E2E" --verbosity minimal --collect:"XPlat Code Coverage"
124+
125+
- name: Upload Coverage
126+
if: github.event_name == 'schedule'
127+
uses: actions/upload-artifact@v4
128+
with:
129+
name: coverage-report
130+
path: coverage.cobertura.xml

docs/Browser_Automation_Testing.md

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,202 @@ jobs:
173173
path: playwright-traces/
174174
```
175175
176+
## Supported CI Runners and Platform Requirements
177+
178+
### CI Runner Support Matrix
179+
180+
| Runner Type | Unit Tests | Integration Tests | Browser E2E | MAUI UI | WPF UI |
181+
|-------------|:----------:|:-----------------:|:-----------:|:-------:|:------:|
182+
| **GitHub Actions** |
183+
| `ubuntu-latest` | ✅ | ✅ | ✅ | ⚠️¹ | ❌ |
184+
| `windows-latest` | ✅ | ✅ | ✅ | ⚠️¹ | ✅² |
185+
| `macos-latest` | ✅ | ✅ | ✅ | ⚠️¹ | ❌ |
186+
| **Azure DevOps** |
187+
| `ubuntu-latest` | ✅ | ✅ | ✅ | ⚠️¹ | ❌ |
188+
| `windows-latest` | ✅ | ✅ | ✅ | ⚠️¹ | ✅² |
189+
| `vmImage: macOS-latest` | ✅ | ✅ | ✅ | ⚠️¹ | ❌ |
190+
| **Self-Hosted** |
191+
| Linux | ✅ | ✅ | ✅ | ⚠️³ | ❌ |
192+
| Windows | ✅ | ✅ | ✅ | ⚠️³ | ✅ |
193+
| macOS | ✅ | ✅ | ✅ | ⚠️³ | ❌ |
194+
195+
**Notes:**
196+
- ✅ = Fully supported
197+
- ⚠️ = Partial support with additional setup
198+
- ❌ = Not supported
199+
- ¹ = Android emulator tests possible but slow; iOS requires macOS with Xcode
200+
- ² = Requires Windows UI (non-headless agent)
201+
- ³ = Requires platform-specific emulators/simulators installed
202+
203+
### Platform Requirements by Test Type
204+
205+
#### Playwright Browser Tests (Current - Recommended)
206+
207+
**Minimum Requirements:**
208+
- .NET 10 SDK
209+
- Playwright browsers: `dotnet playwright install --with-deps chromium`
210+
- 2GB RAM minimum, 4GB recommended
211+
- No display required (runs headless)
212+
213+
**GitHub Actions Setup:**
214+
```yaml
215+
- name: Install Playwright
216+
run: dotnet playwright install --with-deps chromium
217+
```
218+
219+
#### MAUI UI Automation (Future - Feature 1.5.3)
220+
221+
> **Status:** Not yet implemented. Requirements documented for planning purposes.
222+
223+
**Android Testing:**
224+
| Requirement | CI Runner | Notes |
225+
|-------------|-----------|-------|
226+
| Android SDK | All | Auto-installed via `setup-android` action |
227+
| Android Emulator | All | Requires hardware acceleration (KVM on Linux) |
228+
| Java 17+ | All | Required by Android SDK |
229+
230+
```yaml
231+
# GitHub Actions example for MAUI Android
232+
jobs:
233+
maui-android:
234+
runs-on: ubuntu-latest
235+
steps:
236+
- uses: actions/setup-java@v4
237+
with:
238+
java-version: 17
239+
distribution: temurin
240+
- name: Setup Android SDK
241+
uses: android-actions/setup-android@v3
242+
- name: Start Emulator
243+
run: |
244+
$ANDROID_HOME/emulator/emulator -avd test -no-window -gpu swiftshader &
245+
adb wait-for-device
246+
```
247+
248+
**iOS Testing:**
249+
| Requirement | CI Runner | Notes |
250+
|-------------|-----------|-------|
251+
| macOS runner | macOS only | iOS simulator requires macOS |
252+
| Xcode 15+ | macOS only | Required for iOS development |
253+
| iOS Simulator | macOS only | Auto-available on macOS runners |
254+
255+
```yaml
256+
# GitHub Actions example for MAUI iOS
257+
jobs:
258+
maui-ios:
259+
runs-on: macos-latest
260+
steps:
261+
- name: Select Xcode
262+
run: sudo xcode-select -s /Applications/Xcode_15.4.app
263+
- name: Boot iOS Simulator
264+
run: |
265+
xcrun simctl boot "iPhone 15 Pro"
266+
```
267+
268+
**Cross-Platform MAUI CI Strategy:**
269+
```yaml
270+
jobs:
271+
maui-unit-tests:
272+
runs-on: ubuntu-latest # No platform-specific dependencies
273+
274+
maui-android-e2e:
275+
runs-on: ubuntu-latest # Android emulator with KVM
276+
if: github.event.schedule # Nightly only (slow)
277+
278+
maui-ios-e2e:
279+
runs-on: macos-latest # iOS simulator required
280+
if: github.event.schedule # Nightly only (slow)
281+
```
282+
283+
#### WPF UI Automation (Future - Feature 1.5.4)
284+
285+
> **Status:** Not yet implemented. Requirements documented for planning purposes.
286+
287+
**Requirements:**
288+
| Requirement | CI Runner | Notes |
289+
|-------------|-----------|-------|
290+
| Windows runner | Windows only | WPF is Windows-only |
291+
| Non-headless agent | Self-hosted or Windows UI | UI automation needs display |
292+
| .NET 10 Windows workload | Windows | `net10.0-windows` TFM |
293+
294+
**CI Considerations:**
295+
- GitHub Actions `windows-latest` does NOT support UI automation by default
296+
- Options for WPF UI testing:
297+
1. **Self-hosted Windows runner** with display access
298+
2. **FlaUI + Microsoft UI Automation** (can work headless in some scenarios)
299+
3. **Virtual display** using third-party tools (not officially supported)
300+
301+
```yaml
302+
# Self-hosted Windows runner with UI access
303+
jobs:
304+
wpf-ui-tests:
305+
runs-on: [self-hosted, windows, ui-enabled]
306+
steps:
307+
- name: Run WPF UI Tests
308+
run: dotnet test CoreIdent.Client.Wpf.Tests --filter "Category=UI"
309+
```
310+
311+
**Alternative: Unit + Integration Tests Only**
312+
313+
For WPF clients without UI automation:
314+
```yaml
315+
jobs:
316+
wpf-headless-tests:
317+
runs-on: windows-latest
318+
steps:
319+
- name: Run WPF Unit + Integration Tests
320+
run: dotnet test CoreIdent.Client.Wpf.Tests --filter "Category!=UI"
321+
```
322+
323+
### Cost and Time Considerations
324+
325+
| Test Type | Typical Duration | CI Minutes | Recommendation |
326+
|-----------|------------------|------------|----------------|
327+
| Unit Tests | 10-30s | ~0.5 min | Every PR |
328+
| Integration Tests | 30-60s | ~1 min | Every PR |
329+
| Browser E2E (Playwright) | 1-5 min | ~3 min | Every PR |
330+
| Android Emulator E2E | 10-20 min | ~15 min | Nightly/Release |
331+
| iOS Simulator E2E | 10-20 min | ~15 min | Nightly/Release |
332+
| WPF UI E2E | 5-10 min | ~8 min | Nightly/Release |
333+
334+
### Recommended CI Strategy
335+
336+
```yaml
337+
# PR builds: Fast feedback
338+
on: pull_request
339+
jobs:
340+
quick-tests: # < 5 minutes
341+
runs-on: ubuntu-latest
342+
steps:
343+
- run: dotnet test --filter "Category!=E2E&Category!=UI"
344+
345+
# Main branch: Full E2E
346+
on:
347+
push:
348+
branches: [main]
349+
jobs:
350+
browser-e2e:
351+
runs-on: ubuntu-latest
352+
steps:
353+
- run: dotnet playwright install --with-deps chromium
354+
- run: dotnet test --filter "Category=E2E"
355+
356+
# Nightly: Platform-specific UI tests
357+
on:
358+
schedule:
359+
- cron: '0 2 * * *'
360+
jobs:
361+
android-e2e:
362+
runs-on: ubuntu-latest
363+
# ... Android emulator setup
364+
ios-e2e:
365+
runs-on: macos-latest
366+
# ... iOS simulator setup
367+
wpf-e2e:
368+
runs-on: [self-hosted, windows, ui-enabled]
369+
# ... WPF UI automation
370+
```
371+
176372
## Diagnostic Output
177373

178374
On test failure, Playwright automatically captures:

docs/DEVPLAN.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,23 +1515,23 @@ This document provides a detailed breakdown of tasks, components, test cases, an
15151515
15161516
* **Component:** OAuth/OIDC E2E coverage (CoreIdent + external providers)
15171517
- [x] (L2) Authorization Code + PKCE flow works end-to-end against CoreIdent test host
1518-
- [ ] (L2) Token refresh behavior works end-to-end (refresh threshold + rotation scenarios)
1519-
- [ ] (L2) Logout works (revocation + end session when advertised)
1520-
- [ ] (L2) UserInfo behavior is correct (scope-gated claims, reserved claims filtering)
1518+
- [x] (L2) Token refresh behavior works end-to-end (refresh threshold + rotation scenarios)
1519+
- [x] (L2) Logout works (revocation + end session when advertised)
1520+
- [x] (L2) UserInfo behavior is correct (scope-gated claims, reserved claims filtering)
15211521
- [x] (L3) External provider smoke lane (Keycloak or other containerized provider) for cross-provider parity
15221522
15231523
* **Component:** WebAuthn/Passkey E2E (future expansion)
15241524
- [x] (L3) Implement passkey E2E tests using Playwright virtual authenticator (where supported)
15251525
15261526
* **CI strategy:**
1527-
- [ ] (L2) Run Tier 1 + Tier 2 on every PR
1528-
- [ ] (L1) Run Tier 3 browser smoke tests on a dedicated lane (nightly and/or required on main)
1529-
- [ ] (L1) Keep Tier 3 small and stable; favor headless integration tests for most coverage
1527+
- [x] (L2) Run Tier 1 + Tier 2 on every PR
1528+
- [x] (L1) Run Tier 3 browser smoke tests on a dedicated lane (nightly and/or required on main)
1529+
- [x] (L1) Keep Tier 3 small and stable; favor headless integration tests for most coverage
15301530
15311531
* **Quality gates:**
15321532
- [x] (L2) Tests produce deterministic diagnostics (traces/logs) on failure
15331533
- [x] (L2) Timeouts are explicit and bounded; tests fail fast and do not hang CI
1534-
- [ ] (L1) Document supported CI runners and what platforms are required for MAUI/WPF UI automation (optional)
1534+
- [x] (L1) Document supported CI runners and what platforms are required for MAUI/WPF UI automation (optional)
15351535
15361536
---
15371537

0 commit comments

Comments
 (0)