Feat/integration test setup#622
Open
hildebrandttk wants to merge 2 commits into
Open
Conversation
Add an end-to-end integration harness that runs the webmail against a real Stalwart mail server in Docker and drives it with Playwright, focused on the mail/folder synchronisation behaviour (unread/total counters, folder-list sync, account-scoped Unified Mailbox) that the unified-mailbox work touches. - integration/ stack: Stalwart (declarative bootstrap: alice/bob/carol, submission + IMAP listeners, permissive CORS) + webmail (dev mode, so the browser's plaintext cross-origin JMAP calls aren't blocked by the prod CSP). - Helpers: dependency-free SMTP submit client, JMAP client for seeding / inspecting server state, and page helpers (login, add/switch account, locale-independent folder-counter reads). - Specs: login, single-account sync (receive/read/move/delete/folder-create/ burst) and multi-account (per-account isolation + cross-account Unified Inbox aggregation + background-account delivery). 12 tests, all green. - Add focused data-testid hooks to the mail UI (folder rows + counters, email list items, account switcher, composer) for stable selectors. - Exclude examples/ and integration/ from tsconfig/eslint/.dockerignore.
…arkmail#569) Provision a Stalwart group (team@example.org) with carol as a member before her first login, and assert the composer's From selector offers the group address. This confirms the group-membership scenario of bulwarkmail#569 already works out of the box: Stalwart returns the group's send-as identity on the member's own account, so the app's normal single-account identity load surfaces it (identities.length > 1 -> the From <select> renders with team@). - stalwart: create the `team` Group in plan-accounts and add carol via User.memberGroupIds in the entrypoint (id resolved after apply, like DOMAIN_ID). carol, not alice/bob, so the sync specs stay unshared. - helpers: GROUP config, openComposer/composerFromOptions, and JmapClient accounts + sharedAccountNames (Identity/get needs the submission capability). - composer: add data-testid="composer-from" to the From <select> and its single-identity <span> fallback. Ref: bulwarkmail#569
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a self-contained, dockerized end-to-end integration harness that drives the
Bulwark webmail against a real Stalwart mail server with Playwright, plus a first
regression test for issue #569 (the composer's From dropdown should offer shared/
group account identities).
This is the reusable base branch that the unified-mailbox feature builds on: it
carries only harness infrastructure and app test-hooks — no feature code — so it
sits directly on
mainand can be reviewed/merged on its own.Changes
Integration harness (integration/) — commit 17d1658
docker-compose.yml+stalwart/image with adeclarative two-phase bootstrap (
entrypoint.sh,plan-bootstrap.ndjson,plan-accounts.ndjson.tpl): default domain + admin, the alice/bob/carol testmailboxes, submission/IMAP listeners, permissive CORS, cleartext auth for the
dev lanes, inbound throttles disabled.
stalwart-cliis host-prefetched andCOPYed into the image (apt/CDN are unreachable at build time).
webmail.Dockerfilerunsnext dev— the production CSP pinsconnect-src 'self' https:and would block the browser's plaintext cross-origin JMAP calls — with the
unifiedCrossAccountEnabledpolicy gate mounted.playwright.integration.config.ts+global-setup/teardownbring the stack up (or reuse a running one via
IT_NO_DOCKER=1);run-tests.shruns the suite inside the official Playwright container (host browsers are
unsupported by the 1.59 bundles) over host networking.
seeding/inspecting server state, and page helpers (login, add/switch account,
locale-independent folder-counter reads via
data-testid).Unified Mailbox).
data-testids on the mail UI (folder rows +counters, email list items, account switcher, composer).
examples/andintegration/are excluded from tsconfig/eslint/.dockerignore.a delivery to a background account bumps the Unified Inbox counteristest.fixme'd on this branch only: the background-pushcounter fix it exercises lives in the unified-mailbox feature commits, not
here. It is re-enabled on
feat/unified-mailbox-account-scope.Issue #569 — composer From offers shared/group identities — commit 7fcff64
Groupteam@example.orgiscreated in
plan-accounts, andcarolis made a member viaUser.memberGroupIdsin the entrypoint (the group's server-assigned id isresolved after
apply, mirroring the existingDOMAIN_IDstep). carol — notalice/bob — so the single-/multi-account sync specs keep an unshared env.
04-shared-identity: logs in as the group member and asserts thecomposer's From selector offers
team@example.org; a JMAP server-side guardfirst confirms the group account and its
team@identity are reachable in themember's session.
data-testid="composer-from"on the From<select>and its single-identity
<span>fallback.GROUPconfig,openComposer/composerFromOptions, and JMAPclient
accounts/sharedAccountNames(Identity/get needs thesubmissioncapability, not
mail).Related Issues
Closes #569
The pre-login group-membership scenario already works with no app change:
when a user is provisioned into the group before first login, Stalwart returns
the group's
team@address as an identity on the member's own account, so theapp's normal single-account identity load yields
identities.length > 1and theFrom
<select>rendersteam@. The test is green. #569's remaining gap is theother shapes — an ACL-shared folder from another user, or a second connected
account — whose identities are not merged into the primary account and so still
need the multi-account identity loader to include shared accounts.
##+ Tests
counter case is
fixme'd here, see above). Run:integration/run-tests.sh(or
npm run test:integration). A stale Stalwart volume must be reset first(
cd integration && docker compose down -v) so the group is provisioned.tsc --noEmitclean.Type of Change
Checklist
npm run typecheck && npm run lintand there are no errorsnpm run build)locales/) if my changes affect user-facing textScreenshots / Demo
04-shared-identity.webm
Notes for Reviewers
Branches directly off
main(511f9e5). The feature branchfeat/unified-mailbox-account-scopeshares this branch's harness setup commit(17d1658) as its base, so merge this MR first.