From fc1d3c886788752d2b11dc562211949b06949411 Mon Sep 17 00:00:00 2001 From: github-ops Date: Fri, 19 Jun 2026 18:32:14 +0000 Subject: [PATCH] Fix community wizard e2e navigation --- apps/ui/js/wizard.js | 14 +++++++++++++- apps/ui/tests/e2e/wizard.spec.js | 30 ++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/apps/ui/js/wizard.js b/apps/ui/js/wizard.js index 90304b1..d746418 100644 --- a/apps/ui/js/wizard.js +++ b/apps/ui/js/wizard.js @@ -42,6 +42,7 @@ var selectedRpcMethod = window.selectedRpcMethod; async function initWizardPage() { renderSidebarBrand('create'); document.querySelector('.btn-continue').addEventListener('click', function() { + currentStep = window.currentStep || 1; if (currentStep < TOTAL_STEPS) { goToStep(currentStep + 1); } else { @@ -50,6 +51,7 @@ async function initWizardPage() { }); document.querySelector('.btn-back').addEventListener('click', function() { + currentStep = window.currentStep || 1; if (!this.disabled && currentStep > 1) goToStep(currentStep - 1); }); @@ -181,6 +183,16 @@ var METHOD_CALLOUTS = { PATCH: { icon: 'info', text: { en: { title: 'PATCH selected — partial update.', body: 'Only include the fields you want to modify in the body schema defined in step 4.' }, ru: { title: 'Выбран PATCH — частичное обновление.', body: 'В body schema на шаге 4 включайте только те поля, которые хотите изменить.' } } }, }; +function buildWizardIconSvg(href, width, height) { + var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); + svg.setAttribute('width', String(width)); + svg.setAttribute('height', String(height)); + var use = document.createElementNS('http://www.w3.org/2000/svg', 'use'); + use.setAttribute('href', href); + svg.appendChild(use); + return svg; +} + function renderSidebarBrand(mode) { var sidebarBrand = document.querySelector('.step-sidebar-brand'); if (!sidebarBrand) return; @@ -217,7 +229,7 @@ function selectMethod(btn) { var lang = localStorage.getItem('crank_lang') || 'en'; var text = typeof info.text === 'string' ? info.text : (info.text[lang] || info.text.en); callout.innerHTML = ''; - var icon = buildIconSvg( + var icon = buildWizardIconSvg( (window.APP_BASE || '') + 'icons/general/info-circle.svg#icon', 15, 15 diff --git a/apps/ui/tests/e2e/wizard.spec.js b/apps/ui/tests/e2e/wizard.spec.js index 3b5a854..5c7d3f7 100644 --- a/apps/ui/tests/e2e/wizard.spec.js +++ b/apps/ui/tests/e2e/wizard.spec.js @@ -46,11 +46,41 @@ test('community wizard hides premium protocols and explains edition scope', asyn test('REST method callout clears when switching to methods without request body', async ({ page }) => { await login(page); + const workspace = await getCurrentWorkspace(page); + + await page.route( + `/api/admin/workspaces/${encodeURIComponent(workspace.id)}/upstreams`, + async (route) => { + await route.fulfill({ + contentType: 'application/json', + body: JSON.stringify({ + items: [ + { + id: 'upstream_e2e_rest_methods', + workspace_id: workspace.id, + name: 'E2E REST target', + base_url: 'https://api.example.test', + static_headers: {}, + auth_profile_id: null, + created_at: '2026-06-19T00:00:00Z', + updated_at: '2026-06-19T00:00:00Z', + }, + ], + }), + }); + }, + ); + await page.goto('/wizard/'); + await expect(page.locator('[data-step-counter]').first()).toContainText(localized('Step', 'Шаг')); await page.locator('[data-testid="wizard-protocol-rest"]').click(); await page.locator('#btn-continue').click(); + await expect(page.locator('#step-panel-2')).toBeVisible(); + await page.locator('#upstream-combobox-trigger').click(); + await page.getByText('E2E REST target').click(); await page.locator('#btn-continue').click(); + await expect(page.locator('#step-panel-3-rest')).toBeVisible(); const callout = page.locator('#method-callout-rest'); await page.locator('.method-card[data-method="POST"]').click();