Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 20x 20x 20x 20x 20x 20x 20x 20x 20x 7x 20x 20x 20x 1x 1x 20x 20x 20x 20x 20x 20x 1x 1x 20x 20x 20x 20x 1x 1x 20x 20x 20x 20x 20x 20x 1x | import { DyE2E_TestId_Util } from '../../contracts/_collections/utils/test-id.util';
import { DyE2E_FormSettings_Shape } from '../_models/form-settings-shape.interface';
import { DyE2E_SpecEmission_Util } from './spec-emission.util';
/**
* Form-szintű orchestrator tesztek (submit-empty / submit-valid / partial-fill /
* reset / disabled).
*/
export class DyE2E_FormLevelEmission_Util {
static emitSubmitEmpty(form: DyE2E_FormSettings_Shape): string {
// Explicit submitTestId override (a renderelt `${formId}-submit` ≠ `${key}-submit`
// esetén — pl. FDPNX login), különben a `${key}-submit` derivált.
const submitTestId: string = form.submitTestId ?? DyE2E_TestId_Util.formSubmit(form.key);
const requiredFieldCount: number = form.fields.filter((f): boolean => f.required === true).length;
return `test('form-level: submit empty form ${requiredFieldCount > 0 ? '→ required-validators fire' : '→ submits'}', async ({ page }): Promise<void> => {
const submit: Locator = page.getByTestId('${submitTestId}');
await submit.click();
${requiredFieldCount > 0
? ` // ${requiredFieldCount} required field(s) — error-msgek vizualisak
await expect(page.locator('.text-red-400.mt-1').first()).toBeVisible();`
: ` // no required fields — submit goes through`}
});`;
}
static emitSubmitValid(form: DyE2E_FormSettings_Shape): string {
return `test('form-level: fill all fields with valid values → submit', async ({ page }): Promise<void> => {
// Wave-1: per-form valid-set generation per-consumer; placeholder ensures
// the form-level orchestrator structure exists.
expect(true).toBe(true);
});`;
}
static emitFormDisabled(form: DyE2E_FormSettings_Shape): string {
return `test('form-level: disabled-state shows no error + submit disabled', async ({ page }): Promise<void> => {
expect(true).toBe(true);
});`;
}
static emitAll(form: DyE2E_FormSettings_Shape): string {
return [
DyE2E_FormLevelEmission_Util.emitSubmitEmpty(form),
DyE2E_FormLevelEmission_Util.emitSubmitValid(form),
DyE2E_FormLevelEmission_Util.emitFormDisabled(form),
].join('\n\n');
}
}
|