Fix community wizard e2e navigation
This commit is contained in:
+13
-1
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user