fix(import): подтвердить обязательные гарантии второго эпика
This commit is contained in:
1 parent
31f6f00d3b
commit
ad23cd9a46
33 files changed
+3328
-18
No files matched your search
@@ -61,7 +61,7 @@ function planResponse(prefix) {
|
||||
};
|
||||
}
|
||||
|
||||
async function preparePlanFlow(page, locale) {
|
||||
async function preparePlanFlow(page, locale, reportFixture) {
|
||||
const planCalls = [];
|
||||
const applyCalls = [];
|
||||
const prefix = uniqueName('plan_apply');
|
||||
@@ -98,7 +98,7 @@ async function preparePlanFlow(page, locale) {
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({
|
||||
body: JSON.stringify(reportFixture || {
|
||||
plan_digest: 'a'.repeat(64),
|
||||
counts: { selected: 1, excluded: 1, created: 0, versioned: 1 },
|
||||
outcomes: [{ status: 'versioned' }],
|
||||
@@ -196,6 +196,63 @@ test('[P1] AC-13 double-click sends one Apply with the stored reference, digest
|
||||
expect(applyCalls[0].payload.idempotency_key.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
for (const locale of ['en', 'ru']) {
|
||||
test(`[P1] AC-2.13-13 renders every immutable Apply outcome in ${locale}`, async ({ page }) => {
|
||||
const reportFixture = {
|
||||
plan_digest: 'd'.repeat(64),
|
||||
idempotency_key: 'apply-report-full-outcomes',
|
||||
status: 'applied',
|
||||
counts: { selected: 5, excluded: 0, created: 1, versioned: 1, renamed: 1, skipped: 1, rejected: 1 },
|
||||
outcomes: [
|
||||
{ key: 'GET /created', name: 'created_operation', status: 'created', version: 1 },
|
||||
{ key: 'GET /versioned', name: 'versioned_operation', status: 'versioned', version: 2 },
|
||||
{ key: 'GET /renamed', name: 'renamed_operation', status: 'renamed', version: 1 },
|
||||
{ key: 'GET /skipped', name: 'skipped_operation', status: 'skipped', reason: 'not_selected' },
|
||||
{
|
||||
key: 'GET /rejected',
|
||||
name: 'rejected_operation',
|
||||
status: 'rejected',
|
||||
reason: 'unsupported_schema',
|
||||
message: 'raw-report-canary https://report-secret.example.test/internal',
|
||||
},
|
||||
],
|
||||
};
|
||||
const { releaseApplyResponse } = await preparePlanFlow(page, locale, reportFixture);
|
||||
await page.locator('[data-testid="openapi-import-apply-confirmation"]').getByRole('button', {
|
||||
name: localized('Apply import', 'Применить импорт'),
|
||||
}).click();
|
||||
releaseApplyResponse();
|
||||
|
||||
const report = page.locator('[data-testid="openapi-import-apply-result"]');
|
||||
await expect(report).toBeVisible();
|
||||
await expect(report.locator('.openapi-import-plan-summary')).toContainText(
|
||||
localized('Applied: 3; skipped: 1; excluded: 0; rejected: 1.', 'Применено: 3; пропущено: 1; исключено: 0; отклонено: 1.'),
|
||||
);
|
||||
for (const outcome of reportFixture.outcomes) {
|
||||
const row = report.locator(`[data-outcome="${outcome.status}"]`);
|
||||
await expect(row).toHaveCount(1);
|
||||
await expect(row).toContainText(outcome.name);
|
||||
await expect(row).toContainText(outcome.key);
|
||||
if (outcome.version) await expect(row).toContainText(`v${outcome.version}`);
|
||||
if (outcome.reason) {
|
||||
const reason = row.locator('.openapi-import-plan-reason');
|
||||
await expect(reason).toBeVisible();
|
||||
await expect(reason).toContainText(localized(
|
||||
'This imported item needs review in the wizard.',
|
||||
'Этот импортированный элемент нужно проверить в мастере.',
|
||||
));
|
||||
}
|
||||
}
|
||||
await expect(report.locator('[data-outcome="created"]')).toContainText(localized('Created', 'Создано'));
|
||||
await expect(report.locator('[data-outcome="versioned"]')).toContainText(localized('New Draft Version', 'Новая версия черновика'));
|
||||
await expect(report.locator('[data-outcome="renamed"]')).toContainText(localized('Created with confirmed name', 'Создано с подтверждённым именем'));
|
||||
await expect(report.locator('[data-outcome="skipped"]')).toContainText(localized('Skipped', 'Пропущено'));
|
||||
await expect(report.locator('[data-outcome="rejected"]')).toContainText(localized('Rejected', 'Отклонено'));
|
||||
await expect(report).not.toContainText('raw-report-canary');
|
||||
await expect(report).not.toContainText('https://report-secret.example.test/internal');
|
||||
});
|
||||
}
|
||||
|
||||
test('[P1] AC-13 submits the confirmed new_version decision for the exact existing operation', async ({ page }) => {
|
||||
const prefix = uniqueName('plan_version');
|
||||
const targetOperationId = 'op_exact_importplan_target';
|
||||
|
||||
Reference in new issue
Block a user