Skip to content

ci: run Playwright e2e suite on every PR#21996

Open
GirlBossRush wants to merge 12 commits intomainfrom
issue-21994-on-corepack
Open

ci: run Playwright e2e suite on every PR#21996
GirlBossRush wants to merge 12 commits intomainfrom
issue-21994-on-corepack

Conversation

@GirlBossRush
Copy link
Copy Markdown
Contributor

@GirlBossRush GirlBossRush commented Apr 30, 2026

Depends on

Summary

Wires up the existing web/test/browser/ Playwright suite as its own job in ci-web.yml, closing #21994.

Boots the full authentik stack from source (postgres + Go server + Rust worker) inside the workflow, applies migrations and the test-admin blueprint, then runs corepack npm run --prefix web test:e2e against http://localhost:9000. On failure, uploads the HTML report, traces/videos, and server + worker logs as artifacts so reviewers can debug without rerunning locally.

Also enables the HTML reporter and screenshot/video capture on CI in playwright.config.js, and updates the full dev-environment docs to point at the same npm scripts CI uses so local and CI runs stay in lockstep.

Stacking

This PR targets npm-corepack (#20400) intentionally — the new job uses corepack-prefixed npm calls and the composite setup-node action that #20400 introduces. Will rebase onto main once #20400 lands.

Notes for reviewer

  • Rust cold build is the long pole (~5-10 min cold, ~1 min warm via the existing rust toolchain cache keyed on Cargo.lock). 60-min job timeout chosen with that in mind.
  • Not added to ci-web-mark.needs — runs in parallel with lint/build to avoid cascading the heavy job into vitest. Branch protection should add e2e (playwright) directly as a required status check after the first green run.
  • No path filter — consistent with the rest of ci-web.yml.
  • Existing Django/Selenium suite under tests/e2e/ is untouched; both suites coexist as the issue requests.

Test plan

  • First run on this PR completes within the 60-min timeout (validates cold rust build assumption)
  • HTML report + traces + authentik logs are retrievable from a deliberately-failed run's artifacts
  • After merge, branch protection updated to require e2e (playwright) status check

Closes #21994

🤖 Generated with Claude Code

@GirlBossRush GirlBossRush requested review from a team as code owners April 30, 2026 22:02
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 30, 2026

Deploy Preview for authentik-integrations ready!

Name Link
🔨 Latest commit e4ef898
🔍 Latest deploy log https://app.netlify.com/projects/authentik-integrations/deploys/69fa1da1b4181d000845baf1
😎 Deploy Preview https://deploy-preview-21996--authentik-integrations.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 30, 2026

Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit e4ef898
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/69fa1da1207aa70008dd189a
😎 Deploy Preview https://deploy-preview-21996--authentik-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@GirlBossRush GirlBossRush changed the base branch from npm-corepack to main April 30, 2026 22:05
@GirlBossRush GirlBossRush requested a review from a team as a code owner April 30, 2026 22:05
@GirlBossRush GirlBossRush force-pushed the issue-21994-on-corepack branch from 68d394b to e5f0ff8 Compare April 30, 2026 22:09
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.13%. Comparing base (6be7b2f) to head (e4ef898).
⚠️ Report is 3 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #21996      +/-   ##
==========================================
- Coverage   93.16%   93.13%   -0.04%     
==========================================
  Files        1024     1024              
  Lines       59287    59287              
  Branches      400      400              
==========================================
- Hits        55236    55216      -20     
- Misses       4051     4071      +20     
Flag Coverage Δ
conformance 36.87% <ø> (+0.01%) ⬆️
e2e 41.31% <ø> (-0.79%) ⬇️
integration 33.30% <ø> (+<0.01%) ⬆️
rust 0.00% <ø> (ø)
unit 92.09% <ø> (+<0.01%) ⬆️
unit-migrate 92.11% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 30, 2026

Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit e4ef898
🔍 Latest deploy log https://app.netlify.com/projects/authentik-storybook/deploys/69fa1da1b4b9be00080f9be6
😎 Deploy Preview https://deploy-preview-21996--authentik-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 30, 2026

authentik PR Installation instructions

Instructions for docker-compose

Add the following block to your .env file:

AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-13d167e8d5c2317d071016b16415a9b7427c33d1
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s

Afterwards, run the upgrade commands from the latest release notes.

Instructions for Kubernetes

Add the following block to your values.yml file:

authentik:
    outposts:
        container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
    image:
        repository: ghcr.io/goauthentik/dev-server
        tag: gh-13d167e8d5c2317d071016b16415a9b7427c33d1

Afterwards, run the upgrade commands from the latest release notes.

@GirlBossRush GirlBossRush force-pushed the issue-21994-on-corepack branch 3 times, most recently from 2bb7e35 to 6fee629 Compare May 1, 2026 02:05
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

Playwright e2e — ✅ Passed

Result Count
✅ Passed 22
❌ Failed 0
⚠️ Flaky 0
⏭️ Skipped 0

Workflow run · HTML report hosting is gated off until the authentik-playwright-artifacts S3 bucket is provisioned (vars.PLAYWRIGHT_S3_ENABLED). Until then, download the playwright-report artifact from the run page.

@GirlBossRush GirlBossRush force-pushed the issue-21994-on-corepack branch from 90f27f9 to a7337a3 Compare May 2, 2026 13:08
if: ${{ !cancelled() && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && vars.PLAYWRIGHT_S3_ENABLED == 'true' }}
uses: aws-actions/configure-aws-credentials@ec61189d14ec14c8efccab744f656cffd0e33f37 # v6.1.0
with:
role-to-assume: "arn:aws:iam::016170277896:role/github_goauthentik_authentik"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this might open us to more exposure/risk, I'd keep this as an env var

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, fair :)

@rissson rissson changed the title ci/web: run Playwright e2e suite on every PR ci: run Playwright e2e suite on every PR May 4, 2026
@GirlBossRush GirlBossRush force-pushed the issue-21994-on-corepack branch from 38f04f6 to 13d167e Compare May 4, 2026 23:18
Boots the full authentik stack (postgres + Go server + Rust worker)
inside the existing ci-web workflow, applies migrations and the
test-admin user blueprint, then runs `corepack npm run --prefix web
test:e2e` against http://localhost:9000. Uploads the HTML report,
traces/videos, and authentik logs as artifacts on failure so reviewers
can debug without rerunning locally.

Also enables the HTML reporter and screenshot/video capture on CI in
playwright.config.js, and updates the full dev-environment docs to
point at the same npm scripts CI uses so local and CI runs stay in
lockstep.

Closes #21994

Co-Authored-By: Agent (authentik-i21994-better-mobile-tangelo) <279763771+playpen-agent@users.noreply.github.com>

ci/web: make test-admin blueprint self-contained

The previous blueprint used !Find to look up the authentik Admins group,
which raced against system/bootstrap.yaml and resolved to None when the
explicit apply_blueprint step ran before the worker had applied bootstrap.
The serializer rejected groups: [None] with Invalid pk "None".

Define the group in the same blueprint with state: present and reference
it via !KeyOf, so the test admin setup does not depend on any pre-existing
data. If bootstrap has already created the group, state: present is a
no-op on the identifiers; otherwise the group is created here.

Co-Authored-By: Agent (authentik-i21994-better-mobile-tangelo) <279763771+playpen-agent@users.noreply.github.com>

ci/web: format test-admin-user.yaml with prettier

Pick up the 4-space indent that web/'s prettier config enforces. The
file was added under issue #21994 with 2-space indent and tripped the
ci-web format check on push.

Co-Authored-By: Agent (authentik-i21994-better-mobile-tangelo) <279763771+playpen-agent@users.noreply.github.com>

Use parallelism.

Remove guard.

Reorder tests.

Ignore playwright-traces.

Update expected path.

Always parallel.

Flesh out types.

ci/web: post Playwright result comment + gated S3 upload + !cancelled() guards

Three reviewer-facing improvements to the e2e job:

1. Idempotent PR comment summarising Playwright pass/fail/flaky/skipped
   counts. Marker `<!-- playwright-result -->` lets re-runs edit the
   same comment instead of piling up. Skipped on fork PRs where the
   default GITHUB_TOKEN is read-only.

2. Optional S3 publish of the HTML report to
   `s3://authentik-playwright-artifacts/pr-<n>/run-<id>/attempt-<n>/`,
   gated behind `vars.PLAYWRIGHT_S3_ENABLED == 'true'`. The bucket is
   pending infra provisioning; the public URL pattern is already wired
   into the comment so flipping the variable on later requires no
   workflow changes. Borrows the OIDC + IAM role plumbing from
   `.github/workflows/release-publish.yml`.

3. Switch the failure-guarded reporting/upload steps to `!cancelled()`
   so a superseded (cancelled) run no longer emits failure-shaped noise,
   and so successful runs still produce the artifact bundle reviewers
   expect.

Adds the Playwright JSON reporter so the parse step can pull pass/fail
counts from `playwright-report/results.json` for the comment body.

Co-Authored-By: Agent (authentik-i21996-internal-achievable-raisin) <279763771+playpen-agent@users.noreply.github.com>

web/e2e: fix three regressions blocking the parallel suite

Locally and in CI the new `e2e (playwright)` job appeared to "hang"
under `fullyParallel: true` + `workers: "50%"`. The hang was actually
five tests sharing two unrelated bugs that all manifest as 30s test
timeouts; the cluster only *looks* like a parallelism issue because
multiple workers stall on the same wall-clock window. With these three
fixes the full suite is green in 1m48s on `--workers=2` (was: 5 failed
/ 17 passed in 5m30s).

1. `web/test/browser/600-providers.test.ts`
   PR #21647 dropped the `to:` argument on the `session.login()` call
   in this file's `beforeEach`. Without it, `SessionFixture.login()`
   waits for the auth-flow URL pattern to re-appear — which it does
   immediately, since we just navigated there — so the helper returns
   *before* the post-login redirect lands. The wizard buttons probed
   afterward live on `/if/admin/#/core/providers`, which the user never
   actually reaches; every test in the file then hits the 30s
   `beforeEach` timeout. Pin the destination explicitly, matching the
   shape of every other test file.

2. `web/src/admin/roles/ak-role-list.ts`
   The role-list row anchor had no aria-label, so its accessible name
   was the (random, generated) role name. `500-roles.test.ts` searches
   for that anchor with `getByRole("link", { name: "view details" })`
   — the same selector `400-groups.test.ts` uses against the group
   list, where `GroupListPage.row()` *does* set
   `aria-label="View details of group ..."`. Bring the role row to
   parity with groups; the test wasn't wrong, the UI was missing the
   accessibility hook.

3. `web/test/browser/500-roles.test.ts` ("Edit role from view page")
   The post-edit verification used `page.getByText(updatedName)`, but
   on the role view page the new name renders in two places (the
   "Role <name>" page-navbar heading and the description-list value),
   so the bare text match resolves to two elements and trips
   strict-mode. Add `{ exact: true }` so we assert the canonical value
   the edit wrote rather than the heading template.

Co-Authored-By: Agent (authentik-i21996-internal-achievable-raisin) <279763771+playpen-agent@users.noreply.github.com>

Use headless.
@GirlBossRush GirlBossRush force-pushed the issue-21994-on-corepack branch from 13d167e to e4ef898 Compare May 5, 2026 16:41
- name: Publish package
working-directory: gen-ts-api/
run: |
npm i
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would there be a reason why we would need corepack'd npm in this file?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm thinking publish wise if anything changes and really making sure all our stuff uses the same version, no matter what it is

- name: Build authentik worker (Rust)
run: | # shell
cargo build --release --bin authentik
sudo install -m 0755 ./target/release/authentik /usr/local/bin/authentik
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sudo install -m 0755 ./target/release/authentik /usr/local/bin/authentik
sudo install -m 0755 ./target/release/authentik /usr/local/bin/authentik-worker

working-directory: web
run: | # shell
if [ "${{ steps.playwright-cache.outputs.cache-hit }}" = "true" ]; then
corepack npm exec -- playwright install-deps chromium
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this use the project's playwright version or the one of npm? Also, I don't see an install step, but it might be handled by the setup action? If that's the case, it would use the project version, right?

if [ "${{ steps.playwright-cache.outputs.cache-hit }}" = "true" ]; then
corepack npm exec -- playwright install-deps chromium
else
corepack npm exec -- playwright install --with-deps chromium
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to dare to test firefox based browsers as well? as we have encountered a few strange/unique bugs on there as well

done'
timeout 300 bash -c '
until curl -fsS http://localhost:9000/if/flow/default-authentication-flow/ \
| grep -q "ak-flow-executor"; do
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this feels a bit hacky? also, usually, would this be present even if no js is loaded client side via the bundles? mabye just check for the inline presence of a brand config since that's a pretty permanent item?

aws s3 cp \
--recursive \
--acl=public-read \
--cache-control "public, max-age=600" \
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how likely are the reports to change once imported? i'd go for a longer cache control

if: ${{ !cancelled() && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && vars.PLAYWRIGHT_S3_ENABLED == 'true' }}
env:
S3_BUCKET: authentik-playwright-artifacts
S3_KEY_PREFIX: pr-${{ github.event.pull_request.number }}/run-${{ github.run_id }}/attempt-${{ github.run_attempt }}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ci-web also runs on main and version branches, wouldn't there be an issue with the key prefix to contain the pr number

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: run Playwright e2e tests on every PR

2 participants