Form attachments: reference smoke test with a mail sink, Turnstile reset fix, docs
Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
387debc88c
commit
fdb6140c09
@@ -911,6 +911,11 @@ export const formClasses: BuilderFormClassNames = {
|
||||
fields: 'grid grid-cols-12 gap-4',
|
||||
form: 'grid gap-6',
|
||||
formError: 'rounded-control bg-danger-surface p-3 text-danger',
|
||||
file: 'block w-full text-fg file:mr-3 file:rounded-control file:border-0 file:bg-surface-muted file:px-3 file:py-2 file:text-fg-strong',
|
||||
fileItem: 'flex flex-wrap items-center gap-2',
|
||||
fileList: 'mt-2 grid gap-1 text-sm',
|
||||
fileRemove: 'underline underline-offset-2',
|
||||
help: 'mt-1 text-sm text-fg-muted',
|
||||
input: control,
|
||||
label: 'mb-1 block font-medium text-fg-strong',
|
||||
legend: 'mb-1 font-medium text-fg-strong',
|
||||
@@ -1154,6 +1159,7 @@ Rules: AGENT.md §8a.
|
||||
|---|---|
|
||||
| `e2e/create-test-admin.ts` | a test admin with a known TOTP secret (local / CI database only) (below) |
|
||||
| `e2e/smoke.spec.ts` | the smoke tests every release must pass: pages, showcase, forms, sitemap, SEO/GEO, headers, consent, 2FA |
|
||||
| `e2e/smtp-sink.ts` | — |
|
||||
| `e2e/totp.ts` | RFC 6238 code generator for the 2FA sign-in in the smoke test (below) |
|
||||
|
||||
### `e2e/create-test-admin.ts`
|
||||
@@ -1164,7 +1170,8 @@ Rules: AGENT.md §8a.
|
||||
* the real 2FA screen instead of skipping it. LOCAL / CI database only:
|
||||
* pnpm payload run e2e/create-test-admin.ts
|
||||
* Values come from E2E_ADMIN_EMAIL / E2E_ADMIN_PASSWORD / E2E_TOTP_SECRET (.env.example). Not a seed: seeds
|
||||
* never create users (docs/seeding.md).
|
||||
* never create users (docs/seeding.md). It also points e-mail sending at the tests' local mail sink
|
||||
* (E2E_SMTP_PORT, default 2526).
|
||||
*/
|
||||
import config from '@payload-config'
|
||||
import { isLocalDatabase } from '@intecion/ipal-kit/seed'
|
||||
@@ -1184,6 +1191,16 @@ if (found.docs[0]) {
|
||||
await payload.create({ collection: 'users', data: data as never, overrideAccess: true })
|
||||
}
|
||||
console.log(`[e2e] test admin ready: ${email}`)
|
||||
|
||||
// E-mail for the smoke tests goes to a local sink the test itself starts (e2e/smtp-sink.ts), so the test can
|
||||
// read what the site sent — the form file as an attachment. Without the sink running, sends simply fail.
|
||||
const smtpPort = Number(process.env.E2E_SMTP_PORT ?? 2526)
|
||||
await payload.updateGlobal({
|
||||
slug: 'site-integrations',
|
||||
data: { emailTransport: 'smtp', smtpFromAddress: '[email protected]', smtpHost: '127.0.0.1', smtpPassword: 'e2e-sink', smtpPort, smtpUser: 'e2e' } as never,
|
||||
overrideAccess: true,
|
||||
})
|
||||
console.log(`[e2e] e-mail sending points at the local sink 127.0.0.1:${smtpPort}`)
|
||||
process.exit(0)
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user