mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-13 06:43:06 +00:00
Fix manual dispatch em 18 formulários de /campanha que usavam <form action={submitAction}>: campos não controlados voltavam ao defaultValue após qualquer action assentada (sucesso ou erro) do React 19.
- WizardStepFormChrome alterado uma vez (cobre 3 wizard steps)
- 15 forms recebem dispatch manual arquivo a arquivo
- AdvisorPasswordResetButton (2 micro-forms sem campo digitável) ficou como está
- Unit spec novo campaignWizardStepFormChrome.unit.spec.tsx
- CHANGELOG-AGENTS.md cleaned (98 duplicates removed)
Also fixes:
- campaignPageActor writable gate only blocks advisors (was blocking coordinators too)
- campaignLeaderships e2e stability (waitForLoadState before attribute assertion)
54 lines
1.5 KiB
TypeScript
54 lines
1.5 KiB
TypeScript
import { getPayload } from 'payload'
|
|
import config from '../../src/payload.config.js'
|
|
|
|
import { assertTestDatabase } from './assertTestDatabase'
|
|
|
|
export const testUser = {
|
|
email: 'dev@payloadcms.com',
|
|
password: 'test',
|
|
}
|
|
|
|
/**
|
|
* Seeds a test user for e2e admin tests.
|
|
*
|
|
* Create-if-missing on purpose: specs run fully parallel across workers and
|
|
* share this one user, so a delete-then-create left a window where (a) a
|
|
* concurrent `create` hit the unique email, and (b) the user — and every
|
|
* already-minted admin token — briefly vanished. The credentials are constant
|
|
* (testUser), so a row created by any worker is identical to the one another
|
|
* would create: the unique-conflict loser simply proceeds, and no password
|
|
* reset ever invalidates a live session.
|
|
*/
|
|
export async function seedTestUser(): Promise<void> {
|
|
assertTestDatabase(process.env.DATABASE_URL)
|
|
const payload = await getPayload({ config })
|
|
|
|
try {
|
|
await payload.create({
|
|
collection: 'users',
|
|
data: {
|
|
...testUser,
|
|
roles: ['admin'],
|
|
},
|
|
})
|
|
} catch {
|
|
// A parallel worker already seeded the shared user; nothing to reset.
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Cleans up test user after tests
|
|
*/
|
|
export async function cleanupTestUser(): Promise<void> {
|
|
assertTestDatabase(process.env.DATABASE_URL)
|
|
const payload = await getPayload({ config })
|
|
|
|
await payload.delete({
|
|
collection: 'users',
|
|
where: {
|
|
email: {
|
|
equals: testUser.email,
|
|
},
|
|
},
|
|
})
|
|
}
|