Commit c00e849
committed
fix: seed the e2e OAuth2 test client without depending on TestSeeder
CI was red: tests/e2e/tests/oauth2/auth-code-flow.spec.ts authorizes
against a client_id that only exists as a side effect of
database/seeds/TestSeeder.php, which is wired ONLY into PHPUnit's
BrowserKitTestCase ($this->seed('TestSeeder')) - never into
`php artisan db:seed`, which is all the CI workflow runs. On a
genuinely fresh database the client_id never resolves, so
InteractiveGrantType::handle() throws InvalidClientException before
ever reaching the "redirect to login" branch, and the very first
oauth2 test ("unauthenticated request redirects to login") gets a 400
error page instead of a redirect - exactly what the failing CI run
showed. Local testing never caught this because the long-lived
docker-compose dev database already had TestSeeder's fixtures from
past PHPUnit runs.
TestSeeder itself is not a safe fix for CI: its run() truncates
users/groups/oauth2_client (and otp/consent/session-adjacent tables)
before reseeding its own fixed set - correct for PHPUnit's isolated
test lifecycle, destructive against the same shared database this
workflow also seeds idp:create-super-admin/idp:create-raw-user users
into.
- app/Console/Commands/CreateOAuth2TestClient.php
(idp:create-oauth2-test-client): idempotent, additive-only - creates
just the one confidential client (same client_id/secret/redirect_uri
the e2e suite already uses) plus a dedicated owner user (the consent
screen's getDeveloperEmail() dereferences the owner unconditionally -
an ownerless client 500s as soon as a real login reaches
/accounts/user/consent) and grants it the 'profile' scope. Registered
in app/Console/Kernel.php.
- .github/workflows/{pull_request,push}_frontend_tests.yml: run the new
command alongside the existing user fixtures.
Verified: 16/17 e2e via `docker compose --profile e2e run --rm
playwright npx playwright test` (the 17th, trusted-device, is the
pre-existing environment-only miss - Secure cookies don't persist over
http://nginx), 40/40 PHP, 23/23 Jest.1 parent 052220a commit c00e849
4 files changed
Lines changed: 109 additions & 0 deletions
File tree
- .github/workflows
- app/Console
- Commands
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| 111 | + | |
111 | 112 | | |
112 | 113 | | |
113 | 114 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
112 | 113 | | |
113 | 114 | | |
114 | 115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
0 commit comments