story 2-13-importplan-re-import: implemented and reviewed via bmad-loop
This commit is contained in:
1 parent
c562d5368d
commit
f69c36fa65
66 files changed
+11366
-686
No files matched your search
Vendored
+142
-4
@@ -160,6 +160,103 @@
|
||||
margin-top: 18px;
|
||||
}
|
||||
|
||||
.openapi-import-plan-confirmation {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
padding: 18px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 16px;
|
||||
background: var(--bg-surface);
|
||||
}
|
||||
|
||||
.openapi-import-plan-confirmation[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.openapi-import-plan-confirmation h3,
|
||||
.openapi-import-plan-intro,
|
||||
.openapi-import-plan-versioning,
|
||||
.openapi-import-plan-summary {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.openapi-import-plan-intro,
|
||||
.openapi-import-plan-versioning {
|
||||
color: var(--text-secondary);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.openapi-import-plan-versioning:not([hidden]) {
|
||||
padding: 12px;
|
||||
border-left: 3px solid var(--accent);
|
||||
border-radius: 6px;
|
||||
background: var(--bg-overlay);
|
||||
}
|
||||
|
||||
.openapi-import-plan-counts {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.openapi-import-plan-count {
|
||||
padding: 6px 10px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 999px;
|
||||
color: var(--text-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.openapi-import-plan-candidates,
|
||||
.openapi-import-plan-outcomes {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.openapi-import-plan-candidate,
|
||||
.openapi-import-plan-outcome {
|
||||
display: grid;
|
||||
gap: 5px;
|
||||
padding: 12px;
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: 12px;
|
||||
background: var(--bg-overlay);
|
||||
}
|
||||
|
||||
.openapi-import-plan-candidate[data-state="blocked"],
|
||||
.openapi-import-plan-outcome[data-outcome="rejected"] {
|
||||
border-color: color-mix(in srgb, var(--red) 45%, var(--border));
|
||||
}
|
||||
|
||||
.openapi-import-plan-candidate code,
|
||||
.openapi-import-plan-outcome code {
|
||||
color: var(--text-muted);
|
||||
font-size: 12px;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.openapi-import-plan-candidate p,
|
||||
.openapi-import-plan-outcome p {
|
||||
margin: 0;
|
||||
color: var(--text-secondary);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.openapi-import-plan-reason {
|
||||
color: var(--text-muted) !important;
|
||||
}
|
||||
|
||||
.openapi-import-plan-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.openapi-import-plan-summary {
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.openapi-import-source,
|
||||
.openapi-import-group {
|
||||
border: 1px solid var(--border);
|
||||
@@ -185,7 +282,6 @@
|
||||
}
|
||||
|
||||
#openapi-import-server,
|
||||
#openapi-import-conflict-mode,
|
||||
#openapi-import-search,
|
||||
#openapi-import-method-filter,
|
||||
.openapi-import-server-custom {
|
||||
@@ -266,12 +362,50 @@
|
||||
}
|
||||
|
||||
.openapi-import-operation {
|
||||
display: grid;
|
||||
gap: 10px;
|
||||
padding: 14px 16px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.openapi-import-operation-selection {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr auto;
|
||||
gap: 12px;
|
||||
align-items: start;
|
||||
padding: 14px 16px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.openapi-import-decision-controls {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px 14px;
|
||||
padding-left: 28px;
|
||||
}
|
||||
|
||||
.openapi-import-decision-controls label {
|
||||
display: grid;
|
||||
gap: 5px;
|
||||
color: var(--text-secondary);
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.openapi-import-decision-controls select,
|
||||
.openapi-import-decision-controls input {
|
||||
min-width: 210px;
|
||||
max-width: min(100%, 360px);
|
||||
padding: 8px 10px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 10px;
|
||||
background: var(--bg-surface);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.openapi-import-plan-blocked-help {
|
||||
margin: 0;
|
||||
color: var(--red);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.openapi-import-operation:last-child {
|
||||
@@ -304,6 +438,10 @@
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.openapi-import-operation .openapi-import-findings {
|
||||
grid-column: auto;
|
||||
}
|
||||
|
||||
.openapi-import-finding {
|
||||
display: inline-flex;
|
||||
align-items: baseline;
|
||||
@@ -484,7 +622,7 @@
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.openapi-import-operation {
|
||||
.openapi-import-operation-selection {
|
||||
grid-template-columns: auto 1fr;
|
||||
}
|
||||
|
||||
|
||||
+14
-9
@@ -417,13 +417,6 @@
|
||||
<select id="openapi-import-server"></select>
|
||||
<input id="openapi-import-server-custom" class="openapi-import-server-custom" type="url" data-i18n-aria-label="openapi.server.custom_aria" aria-label="Свой Base URL" data-i18n-ph="openapi.server.placeholder" placeholder="Или укажите свой base URL, например https://api.example.com">
|
||||
</div>
|
||||
<div class="openapi-import-server-row">
|
||||
<label for="openapi-import-conflict-mode" data-i18n="openapi.conflict.label">Если операция уже существует</label>
|
||||
<select id="openapi-import-conflict-mode">
|
||||
<option value="rename" selected data-i18n="openapi.conflict.rename">Создать копию с новым именем</option>
|
||||
<option value="skip" data-i18n="openapi.conflict.skip">Пропустить</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="openapi-import-toolbar">
|
||||
<div class="openapi-import-filter">
|
||||
<label for="openapi-import-search" data-i18n="openapi.search.label">Поиск методов</label>
|
||||
@@ -443,9 +436,21 @@
|
||||
<div class="openapi-import-groups" id="openapi-import-groups"></div>
|
||||
<div class="openapi-import-footer">
|
||||
<span id="openapi-import-selection" data-i18n="openapi.selection.empty">Выбрано: 0</span>
|
||||
<button class="btn-primary" id="openapi-import-create" type="button" data-i18n="openapi.create">Создать черновики</button>
|
||||
<button class="btn-primary" id="openapi-import-create" type="button" data-i18n="openapi.plan.create">Просмотреть план импорта</button>
|
||||
</div>
|
||||
<div class="openapi-import-result" id="openapi-import-result" hidden></div>
|
||||
<section class="openapi-import-plan-confirmation" id="openapi-import-plan-confirmation" data-testid="openapi-import-apply-confirmation" aria-labelledby="openapi-import-plan-title" hidden>
|
||||
<h3 id="openapi-import-plan-title" data-i18n="openapi.plan.confirm_title">Подтвердите план импорта</h3>
|
||||
<p class="openapi-import-plan-intro" data-i18n="openapi.plan.confirm_intro">Перед применением проверьте точный план сервера.</p>
|
||||
<p class="openapi-import-plan-blocked-help" id="openapi-import-plan-blocked-help" data-i18n="openapi.plan.blocked_help" hidden>Исправьте решения для заблокированных операций и создайте план заново.</p>
|
||||
<div class="openapi-import-plan-counts" id="openapi-import-plan-counts" data-testid="openapi-import-apply-counts"></div>
|
||||
<div class="openapi-import-plan-candidates" id="openapi-import-plan-candidates"></div>
|
||||
<p class="openapi-import-plan-versioning" id="openapi-import-versioning-consequences" data-testid="openapi-import-versioning-consequences" hidden></p>
|
||||
<div class="openapi-import-plan-actions">
|
||||
<button class="btn-secondary" id="openapi-import-plan-back" type="button" data-i18n="openapi.plan.back">Назад к выбору</button>
|
||||
<button class="btn-primary" id="openapi-import-plan-apply" type="button" data-testid="openapi-import-plan-apply" data-i18n="openapi.plan.apply">Применить импорт</button>
|
||||
</div>
|
||||
</section>
|
||||
<div class="openapi-import-result" id="openapi-import-result" data-testid="openapi-import-apply-result" hidden></div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -436,6 +436,28 @@
|
||||
signal: options && options.signal,
|
||||
});
|
||||
},
|
||||
createOpenApiImportPlan: function(workspaceId, jobId, payload, options) {
|
||||
return request(API_BASE + '/workspaces/' + encodeURIComponent(workspaceId) + '/imports/openapi/' + encodeURIComponent(jobId) + '/plans', {
|
||||
method: 'POST',
|
||||
headers: headers({
|
||||
'Content-Type': 'application/json',
|
||||
'Accept-Language': localStorage.getItem('crank_lang') === 'ru' ? 'ru' : 'en',
|
||||
}),
|
||||
body: JSON.stringify(payload),
|
||||
signal: options && options.signal,
|
||||
});
|
||||
},
|
||||
applyOpenApiImportPlan: function(workspaceId, planReference, payload, options) {
|
||||
return request(API_BASE + '/workspaces/' + encodeURIComponent(workspaceId) + '/imports/openapi/' + encodeURIComponent(planReference) + '/apply', {
|
||||
method: 'POST',
|
||||
headers: headers({
|
||||
'Content-Type': 'application/json',
|
||||
'Accept-Language': localStorage.getItem('crank_lang') === 'ru' ? 'ru' : 'en',
|
||||
}),
|
||||
body: JSON.stringify(payload),
|
||||
signal: options && options.signal,
|
||||
});
|
||||
},
|
||||
listAgents: function(workspaceId) {
|
||||
return get('/workspaces/' + encodeURIComponent(workspaceId) + '/agents');
|
||||
},
|
||||
|
||||
@@ -611,6 +611,7 @@ var TRANSLATIONS = {
|
||||
'wizard.step2.auth_mode.none': 'No auth',
|
||||
'wizard.step2.auth_mode.existing': 'Use existing authorization profile',
|
||||
'wizard.step2.auth_mode.create': 'Create authorization profile now',
|
||||
'openapi.error.plan_too_large': 'Select at most 512 operations and leave at most 512 excluded operations.',
|
||||
'wizard.step2.auth_profile': 'Authorization profile',
|
||||
'wizard.step2.auth_profile_hint': 'The selected profile is applied automatically on every tool call.',
|
||||
'wizard.step2.auth_profile_empty': 'No authorization profiles yet. Create one below.',
|
||||
@@ -1658,6 +1659,7 @@ var TRANSLATIONS = {
|
||||
'wizard.step2.auth_mode.none': 'Без авторизации',
|
||||
'wizard.step2.auth_mode.existing': 'Использовать существующий профиль авторизации',
|
||||
'wizard.step2.auth_mode.create': 'Создать профиль авторизации сейчас',
|
||||
'openapi.error.plan_too_large': 'Выберите не более 512 операций и оставьте не более 512 исключённых операций.',
|
||||
'wizard.step2.auth_profile': 'Профиль авторизации',
|
||||
'wizard.step2.auth_profile_hint': 'Выбранный профиль применяется автоматически при каждом вызове инструмента.',
|
||||
'wizard.step2.auth_profile_empty': 'Профилей авторизации пока нет. Создайте профиль ниже.',
|
||||
@@ -2093,6 +2095,57 @@ Object.assign(TRANSLATIONS.en, {
|
||||
'openapi.select_visible': 'Select visible',
|
||||
'openapi.clear_visible': 'Clear visible',
|
||||
'openapi.create': 'Create drafts',
|
||||
'openapi.plan.create': 'Review import plan',
|
||||
'openapi.plan.confirm_title': 'Confirm import plan',
|
||||
'openapi.plan.confirm_intro': 'Review the exact server plan before applying it.',
|
||||
'openapi.plan.back': 'Back to selection',
|
||||
'openapi.plan.back_fix': 'Back to fix decisions',
|
||||
'openapi.plan.apply': 'Apply import',
|
||||
'openapi.plan.blocked_help': 'Fix the decisions for blocked operations, then create a new plan.',
|
||||
'openapi.plan.exact_target': 'Exact operation',
|
||||
'openapi.plan.confirmed_name': 'Confirmed name',
|
||||
'openapi.decision.action_label': 'Import decision',
|
||||
'openapi.decision.create': 'Create',
|
||||
'openapi.decision.skip': 'Skip existing operation',
|
||||
'openapi.decision.rename': 'Create with a confirmed name',
|
||||
'openapi.decision.new_version': 'Create a new Draft Version',
|
||||
'openapi.decision.target_label': 'Existing operation',
|
||||
'openapi.decision.target_placeholder': 'Choose the exact operation',
|
||||
'openapi.decision.confirmed_name_label': 'Confirmed name',
|
||||
'openapi.decision.confirmed_name_placeholder': 'Enter the exact new name',
|
||||
'openapi.plan.selected': 'Selected: {count}',
|
||||
'openapi.plan.excluded': 'Excluded: {count}',
|
||||
'openapi.plan.actionable': 'Actionable: {count}',
|
||||
'openapi.plan.blocked': 'Blocked: {count}',
|
||||
'openapi.plan.versioning_new': 'Creates a new Draft Version. The Published Version and history remain unchanged.',
|
||||
'openapi.plan.action.create': 'Create a new Draft',
|
||||
'openapi.plan.action.new_version': 'Create a new Draft Version',
|
||||
'openapi.plan.action.rename': 'Create a separate Draft with the confirmed name',
|
||||
'openapi.plan.action.skip': 'Keep the existing operation unchanged',
|
||||
'openapi.plan.action.excluded': 'Excluded from this partial import',
|
||||
'openapi.plan.action.blocked': 'Blocked and will not be applied',
|
||||
'openapi.plan.result_title': 'Import plan result',
|
||||
'openapi.plan.outcome.created': 'Created',
|
||||
'openapi.plan.outcome.versioned': 'New Draft Version',
|
||||
'openapi.plan.outcome.renamed': 'Created with confirmed name',
|
||||
'openapi.plan.outcome.skipped': 'Skipped',
|
||||
'openapi.plan.outcome.excluded': 'Excluded',
|
||||
'openapi.plan.outcome.rejected': 'Rejected',
|
||||
'openapi.plan.summary': 'Applied: {applied}; skipped: {skipped}; excluded: {excluded}; rejected: {rejected}.',
|
||||
'openapi.plan.repreview': 'This plan is stale or could not be verified. Create a fresh preview and review a new plan.',
|
||||
'openapi.plan.resolve_conflict': 'Review the conflict decision and create a new plan before applying again.',
|
||||
'openapi.plan.retry_unknown': 'The Apply result is unknown. Retry sends the same plan reference, digest and idempotency key.',
|
||||
'openapi.status.planning': 'Preparing the import plan…',
|
||||
'openapi.status.plan_ready': 'Review the server plan and confirm to apply it.',
|
||||
'openapi.status.applying': 'Applying the import plan…',
|
||||
'openapi.status.applied': 'Import plan applied.',
|
||||
'openapi.error.plan': 'The import plan could not be created.',
|
||||
'openapi.error.apply': 'The import plan could not be applied.',
|
||||
'openapi.error.operations_unavailable': 'The workspace operations could not be loaded. Retry the preview before creating a plan.',
|
||||
'openapi.error.decision_target': 'Choose an exact existing operation for this decision.',
|
||||
'openapi.error.confirmed_name': 'Enter the exact confirmed name for the rename decision.',
|
||||
'openapi.error.decision_action': 'Choose a valid import decision.',
|
||||
'openapi.status.loading_operations': 'Checking existing workspace operations…',
|
||||
'openapi.selection.empty': 'Selected: 0',
|
||||
'openapi.selection': 'Selected: {selected} of {total}, shown: {visible}',
|
||||
'openapi.group.selection': 'selected {selected} of {total}, shown {visible}',
|
||||
@@ -2209,6 +2262,57 @@ Object.assign(TRANSLATIONS.ru, {
|
||||
'openapi.select_visible': 'Выбрать видимые',
|
||||
'openapi.clear_visible': 'Снять видимые',
|
||||
'openapi.create': 'Создать черновики',
|
||||
'openapi.plan.create': 'Проверить план импорта',
|
||||
'openapi.plan.confirm_title': 'Подтвердите план импорта',
|
||||
'openapi.plan.confirm_intro': 'Перед применением проверьте точный план сервера.',
|
||||
'openapi.plan.back': 'Назад к выбору',
|
||||
'openapi.plan.back_fix': 'Назад к исправлению решений',
|
||||
'openapi.plan.apply': 'Применить импорт',
|
||||
'openapi.plan.blocked_help': 'Исправьте решения для заблокированных операций и создайте новый план.',
|
||||
'openapi.plan.exact_target': 'Точная операция',
|
||||
'openapi.plan.confirmed_name': 'Подтверждённое имя',
|
||||
'openapi.decision.action_label': 'Решение для импорта',
|
||||
'openapi.decision.create': 'Создать',
|
||||
'openapi.decision.skip': 'Пропустить существующую операцию',
|
||||
'openapi.decision.rename': 'Создать с подтверждённым именем',
|
||||
'openapi.decision.new_version': 'Создать новую версию черновика',
|
||||
'openapi.decision.target_label': 'Существующая операция',
|
||||
'openapi.decision.target_placeholder': 'Выберите точную операцию',
|
||||
'openapi.decision.confirmed_name_label': 'Подтверждённое имя',
|
||||
'openapi.decision.confirmed_name_placeholder': 'Введите точное новое имя',
|
||||
'openapi.plan.selected': 'Выбрано: {count}',
|
||||
'openapi.plan.excluded': 'Исключено: {count}',
|
||||
'openapi.plan.actionable': 'Можно применить: {count}',
|
||||
'openapi.plan.blocked': 'Заблокировано: {count}',
|
||||
'openapi.plan.versioning_new': 'Будет создана новая версия черновика. Опубликованная версия и история останутся без изменений.',
|
||||
'openapi.plan.action.create': 'Создать черновик',
|
||||
'openapi.plan.action.new_version': 'Создать новую версию черновика',
|
||||
'openapi.plan.action.rename': 'Создать отдельный черновик с подтверждённым именем',
|
||||
'openapi.plan.action.skip': 'Оставить существующую операцию без изменений',
|
||||
'openapi.plan.action.excluded': 'Исключено из частичного импорта',
|
||||
'openapi.plan.action.blocked': 'Заблокировано и не будет применено',
|
||||
'openapi.plan.result_title': 'Результат плана импорта',
|
||||
'openapi.plan.outcome.created': 'Создано',
|
||||
'openapi.plan.outcome.versioned': 'Новая версия черновика',
|
||||
'openapi.plan.outcome.renamed': 'Создано с подтверждённым именем',
|
||||
'openapi.plan.outcome.skipped': 'Пропущено',
|
||||
'openapi.plan.outcome.excluded': 'Исключено',
|
||||
'openapi.plan.outcome.rejected': 'Отклонено',
|
||||
'openapi.plan.summary': 'Применено: {applied}; пропущено: {skipped}; исключено: {excluded}; отклонено: {rejected}.',
|
||||
'openapi.plan.repreview': 'План устарел или не прошёл проверку. Создайте новый предпросмотр и проверьте новый план.',
|
||||
'openapi.plan.resolve_conflict': 'Проверьте решение конфликта и создайте новый план перед повторным применением.',
|
||||
'openapi.plan.retry_unknown': 'Результат применения неизвестен. Повтор отправит те же ссылку, digest и ключ идемпотентности.',
|
||||
'openapi.status.planning': 'Подготавливаю план импорта…',
|
||||
'openapi.status.plan_ready': 'Проверьте план сервера и подтвердите его применение.',
|
||||
'openapi.status.applying': 'Применяю план импорта…',
|
||||
'openapi.status.applied': 'План импорта применён.',
|
||||
'openapi.error.plan': 'Не удалось создать план импорта.',
|
||||
'openapi.error.apply': 'Не удалось применить план импорта.',
|
||||
'openapi.error.operations_unavailable': 'Не удалось загрузить операции workspace. Повторите предпросмотр перед созданием плана.',
|
||||
'openapi.error.decision_target': 'Выберите точную существующую операцию для этого решения.',
|
||||
'openapi.error.confirmed_name': 'Введите точное подтверждённое имя для переименования.',
|
||||
'openapi.error.decision_action': 'Выберите допустимое решение для импорта.',
|
||||
'openapi.status.loading_operations': 'Проверяю существующие операции workspace…',
|
||||
'openapi.selection.empty': 'Выбрано: 0',
|
||||
'openapi.selection': 'Выбрано: {selected} из {total}, показано: {visible}',
|
||||
'openapi.group.selection': 'выбрано {selected} из {total}, показано {visible}',
|
||||
|
||||
+577
-61
@@ -1,6 +1,6 @@
|
||||
(function() {
|
||||
var MAX_FILE_BYTES = 256 * 1024;
|
||||
var APPLY_REPLAY_STORAGE_KEY = 'crank_openapi_apply_replay_v1';
|
||||
var APPLY_REPLAY_STORAGE_KEY = 'crank_openapi_plan_apply_replay_v2';
|
||||
var restoredApplyRequest = loadApplyReplay();
|
||||
var state = {
|
||||
workspaceId: null,
|
||||
@@ -8,10 +8,15 @@
|
||||
file: null,
|
||||
jobId: null,
|
||||
preview: null,
|
||||
existingOperations: [],
|
||||
operationsReady: false,
|
||||
decisions: Object.create(null),
|
||||
plan: null,
|
||||
filterQuery: '',
|
||||
filterMethod: '',
|
||||
revision: 0,
|
||||
previewController: null,
|
||||
planController: null,
|
||||
applyController: null,
|
||||
applyInFlight: false,
|
||||
applyRequest: restoredApplyRequest,
|
||||
@@ -25,23 +30,9 @@
|
||||
function validApplyReplay(request) {
|
||||
return request
|
||||
&& typeof request.workspaceId === 'string' && request.workspaceId.length > 0 && request.workspaceId.length <= 128
|
||||
&& typeof request.jobId === 'string' && request.jobId.length > 0 && request.jobId.length <= 128
|
||||
&& request.payload && Array.isArray(request.payload.selected_operation_keys)
|
||||
&& request.payload.selected_operation_keys.length <= 1024
|
||||
&& request.payload.selected_operation_keys.every(function(key) {
|
||||
return typeof key === 'string' && key.length > 0 && key.length <= 512;
|
||||
})
|
||||
&& (request.payload.server_url === null
|
||||
|| (typeof request.payload.server_url === 'string' && request.payload.server_url.length <= 2048))
|
||||
&& (request.payload.conflict_mode === 'skip' || request.payload.conflict_mode === 'rename')
|
||||
&& Array.isArray(request.operationMetadata)
|
||||
&& request.operationMetadata.length <= 1024
|
||||
&& request.operationMetadata.every(function(operation) {
|
||||
return operation
|
||||
&& typeof operation.key === 'string' && operation.key.length > 0 && operation.key.length <= 512
|
||||
&& typeof operation.method === 'string' && operation.method.length > 0 && operation.method.length <= 16
|
||||
&& typeof operation.path === 'string' && operation.path.length > 0 && operation.path.length <= 2048;
|
||||
});
|
||||
&& typeof request.planReference === 'string' && request.planReference.length > 0 && request.planReference.length <= 128
|
||||
&& typeof request.planDigest === 'string' && /^[a-f0-9]{64}$/.test(request.planDigest)
|
||||
&& typeof request.idempotencyKey === 'string' && request.idempotencyKey.length > 0 && request.idempotencyKey.length <= 128;
|
||||
}
|
||||
|
||||
function loadApplyReplay() {
|
||||
@@ -131,6 +122,116 @@
|
||||
});
|
||||
}
|
||||
|
||||
function importOperations() {
|
||||
return (state.preview && state.preview.groups || []).flatMap(function(group) {
|
||||
return group.operations || [];
|
||||
});
|
||||
}
|
||||
|
||||
function decisionFor(operationKey) {
|
||||
if (!state.decisions[operationKey]) {
|
||||
state.decisions[operationKey] = { action: 'create', targetOperationId: '', confirmedName: '' };
|
||||
}
|
||||
return state.decisions[operationKey];
|
||||
}
|
||||
|
||||
function matchingOperations(operation) {
|
||||
return state.existingOperations.filter(function(existing) {
|
||||
return existing.name === operation.suggested_name;
|
||||
});
|
||||
}
|
||||
|
||||
function renderDecisionControls(operation, row) {
|
||||
var previous = row.querySelector('.openapi-import-decision-controls');
|
||||
if (previous) previous.remove();
|
||||
|
||||
var controls = document.createElement('div');
|
||||
var actionLabel = document.createElement('label');
|
||||
var actionSelect = document.createElement('select');
|
||||
var candidateDecision = decisionFor(operation.key);
|
||||
var matches = matchingOperations(operation);
|
||||
var versionable = matches.filter(function(existing) {
|
||||
return existing.protocol === 'rest' && existing.status !== 'archived';
|
||||
});
|
||||
var actions = [
|
||||
['create', 'openapi.decision.create'],
|
||||
['skip', 'openapi.decision.skip'],
|
||||
['rename', 'openapi.decision.rename'],
|
||||
['new_version', 'openapi.decision.new_version'],
|
||||
];
|
||||
|
||||
controls.className = 'openapi-import-decision-controls';
|
||||
actionLabel.textContent = tKey('openapi.decision.action_label');
|
||||
actionLabel.htmlFor = 'openapi-import-decision-' + operation.key;
|
||||
actionSelect.id = actionLabel.htmlFor;
|
||||
actionSelect.dataset.openapiDecisionAction = operation.key;
|
||||
actions.forEach(function(spec) {
|
||||
var option = document.createElement('option');
|
||||
option.value = spec[0];
|
||||
option.textContent = tKey(spec[1]);
|
||||
if ((spec[0] === 'skip' && !matches.length)
|
||||
|| (spec[0] === 'new_version' && !versionable.length)) {
|
||||
option.disabled = true;
|
||||
}
|
||||
actionSelect.appendChild(option);
|
||||
});
|
||||
actionSelect.value = candidateDecision.action;
|
||||
actionSelect.addEventListener('change', function() {
|
||||
candidateDecision.action = actionSelect.value;
|
||||
if (candidateDecision.action === 'skip' || candidateDecision.action === 'new_version') {
|
||||
var allowed = candidateDecision.action === 'new_version' ? versionable : matches;
|
||||
if (!allowed.some(function(existing) { return existing.id === candidateDecision.targetOperationId; })) {
|
||||
candidateDecision.targetOperationId = allowed.length === 1 ? allowed[0].id : '';
|
||||
}
|
||||
}
|
||||
renderDecisionControls(operation, row);
|
||||
});
|
||||
actionLabel.appendChild(actionSelect);
|
||||
controls.appendChild(actionLabel);
|
||||
|
||||
if (candidateDecision.action === 'skip' || candidateDecision.action === 'new_version') {
|
||||
var targetLabel = document.createElement('label');
|
||||
var targetSelect = document.createElement('select');
|
||||
var allowedTargets = candidateDecision.action === 'new_version' ? versionable : matches;
|
||||
var placeholder = document.createElement('option');
|
||||
targetLabel.textContent = tKey('openapi.decision.target_label');
|
||||
targetSelect.dataset.openapiDecisionTarget = operation.key;
|
||||
placeholder.value = '';
|
||||
placeholder.textContent = tKey('openapi.decision.target_placeholder');
|
||||
targetSelect.appendChild(placeholder);
|
||||
allowedTargets.forEach(function(existing) {
|
||||
var option = document.createElement('option');
|
||||
option.value = existing.id;
|
||||
option.textContent = existing.name + ' · ' + existing.id;
|
||||
targetSelect.appendChild(option);
|
||||
});
|
||||
targetSelect.value = candidateDecision.targetOperationId;
|
||||
targetSelect.addEventListener('change', function() {
|
||||
candidateDecision.targetOperationId = targetSelect.value;
|
||||
});
|
||||
targetLabel.appendChild(targetSelect);
|
||||
controls.appendChild(targetLabel);
|
||||
}
|
||||
|
||||
if (candidateDecision.action === 'rename') {
|
||||
var renameLabel = document.createElement('label');
|
||||
var renameInput = document.createElement('input');
|
||||
renameLabel.textContent = tKey('openapi.decision.confirmed_name_label');
|
||||
renameInput.type = 'text';
|
||||
renameInput.maxLength = 128;
|
||||
renameInput.value = candidateDecision.confirmedName;
|
||||
renameInput.placeholder = tKey('openapi.decision.confirmed_name_placeholder');
|
||||
renameInput.dataset.openapiDecisionName = operation.key;
|
||||
renameInput.addEventListener('input', function() {
|
||||
candidateDecision.confirmedName = renameInput.value;
|
||||
});
|
||||
renameLabel.appendChild(renameInput);
|
||||
controls.appendChild(renameLabel);
|
||||
}
|
||||
|
||||
row.appendChild(controls);
|
||||
}
|
||||
|
||||
function operationRows() {
|
||||
return Array.from(document.querySelectorAll('.openapi-import-operation'));
|
||||
}
|
||||
@@ -371,6 +472,10 @@
|
||||
|
||||
state.jobId = response.job_id;
|
||||
state.preview = preview;
|
||||
state.existingOperations = [];
|
||||
state.operationsReady = false;
|
||||
state.decisions = Object.create(null);
|
||||
importOperations().forEach(function(operation) { decisionFor(operation.key); });
|
||||
state.filterQuery = '';
|
||||
state.filterMethod = '';
|
||||
qs('openapi-import-preview-panel').hidden = false;
|
||||
@@ -407,9 +512,11 @@
|
||||
groupNode.appendChild(header);
|
||||
|
||||
group.operations.forEach(function(operation) {
|
||||
var row = document.createElement('label');
|
||||
var row = document.createElement('div');
|
||||
var selectionLabel = document.createElement('label');
|
||||
|
||||
row.className = 'openapi-import-operation';
|
||||
selectionLabel.className = 'openapi-import-operation-selection';
|
||||
row.dataset.openapiMethod = operation.method;
|
||||
row.dataset.openapiSearch = [
|
||||
group.title,
|
||||
@@ -419,12 +526,13 @@
|
||||
operation.path,
|
||||
operation.method,
|
||||
].join(' ');
|
||||
row.innerHTML = '<input type="checkbox" data-openapi-operation value="' + escapeHtml(operation.key) + '" checked>'
|
||||
selectionLabel.innerHTML = '<input type="checkbox" data-openapi-operation value="' + escapeHtml(operation.key) + '" checked>'
|
||||
+ '<div><div class="openapi-import-operation-title">' + escapeHtml(operation.suggested_display_name) + '</div>'
|
||||
+ '<div class="openapi-import-operation-meta"><code>' + escapeHtml(operation.suggested_name) + '</code> · '
|
||||
+ escapeHtml(operation.path) + ' · '
|
||||
+ escapeHtml(tfKey('openapi.operation.fields', { input: operation.input_fields, output: operation.output_fields }))
|
||||
+ '</div></div><span class="openapi-import-method">' + escapeHtml(operation.method) + '</span>';
|
||||
row.appendChild(selectionLabel);
|
||||
row.appendChild(renderOperationMappingPreview(operation));
|
||||
|
||||
if (operation.findings && operation.findings.length) {
|
||||
@@ -434,6 +542,7 @@
|
||||
row.appendChild(findings);
|
||||
}
|
||||
|
||||
renderDecisionControls(operation, row);
|
||||
groupNode.appendChild(row);
|
||||
});
|
||||
|
||||
@@ -480,6 +589,10 @@
|
||||
function clearPreview() {
|
||||
state.jobId = null;
|
||||
state.preview = null;
|
||||
state.existingOperations = [];
|
||||
state.operationsReady = false;
|
||||
state.decisions = Object.create(null);
|
||||
state.plan = null;
|
||||
state.applyRequest = null;
|
||||
state.applyMetadata = [];
|
||||
state.applyResult = null;
|
||||
@@ -488,6 +601,11 @@
|
||||
state.filterQuery = '';
|
||||
state.filterMethod = '';
|
||||
qs('openapi-import-preview-panel').hidden = true;
|
||||
qs('openapi-import-plan-confirmation').hidden = true;
|
||||
qs('openapi-import-plan-counts').replaceChildren();
|
||||
qs('openapi-import-plan-candidates').replaceChildren();
|
||||
qs('openapi-import-versioning-consequences').hidden = true;
|
||||
qs('openapi-import-plan-blocked-help').hidden = true;
|
||||
qs('openapi-import-groups').replaceChildren();
|
||||
qs('openapi-import-result').hidden = true;
|
||||
qs('openapi-import-result').replaceChildren();
|
||||
@@ -502,12 +620,16 @@
|
||||
function invalidate(options) {
|
||||
state.revision += 1;
|
||||
abort(state.previewController);
|
||||
abort(state.planController);
|
||||
abort(state.applyController);
|
||||
state.previewController = null;
|
||||
state.planController = null;
|
||||
state.applyController = null;
|
||||
state.applyInFlight = false;
|
||||
qs('openapi-import-preview').disabled = false;
|
||||
qs('openapi-import-create').disabled = false;
|
||||
qs('openapi-import-plan-apply').disabled = false;
|
||||
qs('openapi-import-plan-back').disabled = false;
|
||||
qs('openapi-import-file-select').disabled = false;
|
||||
qs('openapi-import-reset').disabled = false;
|
||||
qs('openapi-import-cancel').hidden = true;
|
||||
@@ -529,6 +651,39 @@
|
||||
qs('openapi-import-preview').disabled = locked;
|
||||
qs('openapi-import-file-select').disabled = locked;
|
||||
qs('openapi-import-reset').disabled = locked;
|
||||
qs('openapi-import-plan-apply').disabled = locked;
|
||||
qs('openapi-import-plan-back').disabled = locked;
|
||||
qs('openapi-import-server').disabled = locked;
|
||||
qs('openapi-import-server-custom').disabled = locked;
|
||||
qs('openapi-import-search').disabled = locked;
|
||||
qs('openapi-import-method-filter').disabled = locked;
|
||||
qs('openapi-import-select-visible').disabled = locked;
|
||||
qs('openapi-import-clear-visible').disabled = locked;
|
||||
document.querySelectorAll('[data-openapi-operation], [data-openapi-group]').forEach(function(input) {
|
||||
input.disabled = locked;
|
||||
});
|
||||
document.querySelectorAll('.openapi-import-decision-controls select, .openapi-import-decision-controls input').forEach(function(input) {
|
||||
input.disabled = locked;
|
||||
});
|
||||
}
|
||||
|
||||
function lockPlanEditing(locked) {
|
||||
qs('openapi-import-create').disabled = locked;
|
||||
qs('openapi-import-preview').disabled = locked;
|
||||
qs('openapi-import-file-select').disabled = locked;
|
||||
qs('openapi-import-reset').disabled = locked;
|
||||
qs('openapi-import-server').disabled = locked;
|
||||
qs('openapi-import-server-custom').disabled = locked;
|
||||
qs('openapi-import-search').disabled = locked;
|
||||
qs('openapi-import-method-filter').disabled = locked;
|
||||
qs('openapi-import-select-visible').disabled = locked;
|
||||
qs('openapi-import-clear-visible').disabled = locked;
|
||||
document.querySelectorAll('[data-openapi-operation], [data-openapi-group]').forEach(function(input) {
|
||||
input.disabled = locked;
|
||||
});
|
||||
document.querySelectorAll('.openapi-import-decision-controls select, .openapi-import-decision-controls input').forEach(function(input) {
|
||||
input.disabled = locked;
|
||||
});
|
||||
}
|
||||
|
||||
function markApplyOutcomeUnknown(options) {
|
||||
@@ -539,14 +694,14 @@
|
||||
state.applyInFlight = false;
|
||||
state.applyOutcomeUnknown = true;
|
||||
persistApplyReplay(state.applyRequest);
|
||||
// Until the same job is replayed, starting another import could hide an
|
||||
// Until the same plan is replayed, starting another import could hide an
|
||||
// already committed server outcome and lead to duplicate drafts.
|
||||
lockApplyInputs(true);
|
||||
qs('openapi-import-cancel').hidden = true;
|
||||
|
||||
if (!options || options.render !== false) {
|
||||
showRetry(true);
|
||||
setStatus(tKey('openapi.status.apply_outcome_unknown'), true, true);
|
||||
setStatus(tKey('openapi.plan.retry_unknown'), true, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -557,6 +712,16 @@
|
||||
markApplyOutcomeUnknown();
|
||||
return;
|
||||
}
|
||||
if (state.planController) {
|
||||
abort(state.planController);
|
||||
state.planController = null;
|
||||
state.revision += 1;
|
||||
lockPlanEditing(false);
|
||||
qs('openapi-import-cancel').hidden = true;
|
||||
showRetry(false);
|
||||
setStatus(tKey('openapi.status.cancelled'));
|
||||
return;
|
||||
}
|
||||
if (!state.previewController) return;
|
||||
|
||||
invalidate();
|
||||
@@ -621,6 +786,23 @@
|
||||
if (!isCurrent(revision, workspaceId, language)) return;
|
||||
|
||||
renderPreview(response);
|
||||
qs('openapi-import-create').disabled = true;
|
||||
setStatus(tKey('openapi.status.loading_operations'));
|
||||
var operationResponse = await window.CrankApi.listOperations(workspaceId);
|
||||
if (!isCurrent(revision, workspaceId, language)) return;
|
||||
if (!operationResponse || !Array.isArray(operationResponse.items)) {
|
||||
throw new Error('Backend returned an invalid operations list response');
|
||||
}
|
||||
state.existingOperations = operationResponse.items;
|
||||
state.operationsReady = true;
|
||||
importOperations().forEach(function(operation) {
|
||||
var row = Array.from(document.querySelectorAll('.openapi-import-operation')).find(function(candidateRow) {
|
||||
var input = candidateRow.querySelector('[data-openapi-operation]');
|
||||
return input && input.value === operation.key;
|
||||
});
|
||||
if (row) renderDecisionControls(operation, row);
|
||||
});
|
||||
qs('openapi-import-create').disabled = false;
|
||||
setStatus(tKey('openapi.status.preview_ready'));
|
||||
} catch (error) {
|
||||
if (!isCurrent(revision, workspaceId, language)) return;
|
||||
@@ -785,12 +967,176 @@
|
||||
}
|
||||
|
||||
function createdStatus(response) {
|
||||
if (response && response.counts) {
|
||||
return tfKey('openapi.plan.summary', {
|
||||
applied: (Number(response.counts.created) || 0)
|
||||
+ (Number(response.counts.versioned) || 0)
|
||||
+ (Number(response.counts.renamed) || 0),
|
||||
skipped: Number(response.counts.skipped) || 0,
|
||||
excluded: Number(response.counts.excluded) || 0,
|
||||
rejected: Number(response.counts.rejected) || 0,
|
||||
});
|
||||
}
|
||||
return tfKey('openapi.status.created', {
|
||||
created: (response.created || []).length,
|
||||
skipped: (response.skipped || []).length,
|
||||
});
|
||||
}
|
||||
|
||||
function planActionLabel(candidate) {
|
||||
if (candidate.state === 'excluded') return tKey('openapi.plan.action.excluded');
|
||||
if (candidate.state === 'blocked') return tKey('openapi.plan.action.blocked');
|
||||
var action = String(candidate.action || 'create');
|
||||
var key = 'openapi.plan.action.' + action;
|
||||
return tKey(key) === key ? tKey('openapi.plan.action.create') : tKey(key);
|
||||
}
|
||||
|
||||
function renderImportPlan(plan) {
|
||||
var countsNode = qs('openapi-import-plan-counts');
|
||||
var candidatesNode = qs('openapi-import-plan-candidates');
|
||||
var versioningNode = qs('openapi-import-versioning-consequences');
|
||||
var counts = plan.counts || {};
|
||||
var hasBlocked = (Number(counts.blocked) || 0) > 0;
|
||||
var countSpecs = [
|
||||
['selected', 'openapi.plan.selected'],
|
||||
['excluded', 'openapi.plan.excluded'],
|
||||
['actionable', 'openapi.plan.actionable'],
|
||||
['blocked', 'openapi.plan.blocked'],
|
||||
];
|
||||
|
||||
countsNode.replaceChildren();
|
||||
candidatesNode.replaceChildren();
|
||||
countSpecs.forEach(function(spec) {
|
||||
var item = document.createElement('span');
|
||||
item.className = 'openapi-import-plan-count';
|
||||
item.textContent = tfKey(spec[1], { count: Number(counts[spec[0]]) || 0 });
|
||||
countsNode.appendChild(item);
|
||||
});
|
||||
|
||||
var hasNewVersion = false;
|
||||
(Array.isArray(plan.candidates) ? plan.candidates : []).forEach(function(candidate) {
|
||||
var item = document.createElement('article');
|
||||
var title = document.createElement('strong');
|
||||
var key = document.createElement('code');
|
||||
var action = document.createElement('p');
|
||||
item.className = 'openapi-import-plan-candidate';
|
||||
item.dataset.state = String(candidate.state || 'blocked');
|
||||
title.textContent = String(candidate.name || candidate.key || tKey('openapi.result.unnamed'));
|
||||
key.textContent = String(candidate.key || '');
|
||||
action.textContent = planActionLabel(candidate);
|
||||
item.append(title, key, action);
|
||||
if (candidate.target_operation_id) {
|
||||
var target = document.createElement('p');
|
||||
target.textContent = tKey('openapi.plan.exact_target') + ': ' + candidate.target_operation_id;
|
||||
item.appendChild(target);
|
||||
}
|
||||
if (candidate.confirmed_name) {
|
||||
var confirmedName = document.createElement('p');
|
||||
confirmedName.textContent = tKey('openapi.plan.confirmed_name') + ': ' + candidate.confirmed_name;
|
||||
item.appendChild(confirmedName);
|
||||
}
|
||||
if (candidate.action === 'new_version' && candidate.state !== 'blocked' && candidate.state !== 'excluded') {
|
||||
hasNewVersion = true;
|
||||
}
|
||||
if (candidate.reason) {
|
||||
var reason = document.createElement('p');
|
||||
reason.className = 'openapi-import-plan-reason';
|
||||
reason.textContent = findingMessage({ code: candidate.reason });
|
||||
item.appendChild(reason);
|
||||
}
|
||||
candidatesNode.appendChild(item);
|
||||
});
|
||||
|
||||
versioningNode.textContent = tKey('openapi.plan.versioning_new');
|
||||
versioningNode.hidden = !hasNewVersion;
|
||||
qs('openapi-import-plan-confirmation').hidden = false;
|
||||
qs('openapi-import-plan-blocked-help').hidden = !hasBlocked;
|
||||
qs('openapi-import-result').hidden = true;
|
||||
qs('openapi-import-plan-apply').disabled = hasBlocked;
|
||||
qs('openapi-import-plan-back').textContent = tKey(hasBlocked ? 'openapi.plan.back_fix' : 'openapi.plan.back');
|
||||
lockPlanEditing(true);
|
||||
}
|
||||
|
||||
function reportOutcomeLabel(outcome) {
|
||||
var value = String(outcome || 'rejected');
|
||||
var key = 'openapi.plan.outcome.' + value;
|
||||
return tKey(key) === key ? tKey('openapi.plan.outcome.rejected') : tKey(key);
|
||||
}
|
||||
|
||||
function renderImportPlanReport(report) {
|
||||
var node = qs('openapi-import-result');
|
||||
var title = document.createElement('strong');
|
||||
node.replaceChildren();
|
||||
title.textContent = tKey('openapi.plan.result_title');
|
||||
node.appendChild(title);
|
||||
|
||||
var counts = report.counts || {};
|
||||
var applied = (Number(counts.created) || 0)
|
||||
+ (Number(counts.versioned) || 0)
|
||||
+ (Number(counts.renamed) || 0);
|
||||
var summary = document.createElement('p');
|
||||
summary.className = 'openapi-import-plan-summary';
|
||||
summary.textContent = tfKey('openapi.plan.summary', {
|
||||
applied: applied,
|
||||
skipped: Number(counts.skipped) || 0,
|
||||
excluded: Number(counts.excluded) || 0,
|
||||
rejected: Number(counts.rejected) || 0,
|
||||
});
|
||||
node.appendChild(summary);
|
||||
|
||||
var outcomes = Array.isArray(report.outcomes) ? report.outcomes : [];
|
||||
if (outcomes.length) {
|
||||
var list = document.createElement('div');
|
||||
list.className = 'openapi-import-plan-outcomes';
|
||||
outcomes.forEach(function(outcome) {
|
||||
var item = document.createElement('article');
|
||||
var heading = document.createElement('strong');
|
||||
var key = document.createElement('code');
|
||||
var detail = document.createElement('p');
|
||||
var outcomeStatus = outcome.status || outcome.outcome || 'rejected';
|
||||
item.className = 'openapi-import-plan-outcome';
|
||||
item.dataset.outcome = String(outcomeStatus);
|
||||
heading.textContent = String(outcome.name || outcome.key || tKey('openapi.result.unnamed'));
|
||||
key.textContent = String(outcome.key || '');
|
||||
detail.textContent = reportOutcomeLabel(outcomeStatus);
|
||||
if (Number.isInteger(outcome.version)) {
|
||||
detail.textContent += ' · v' + outcome.version;
|
||||
}
|
||||
item.append(heading, key, detail);
|
||||
if (outcome.reason) {
|
||||
var reason = document.createElement('p');
|
||||
reason.className = 'openapi-import-plan-reason';
|
||||
reason.textContent = findingMessage({ code: outcome.reason });
|
||||
item.appendChild(reason);
|
||||
}
|
||||
list.appendChild(item);
|
||||
});
|
||||
node.appendChild(list);
|
||||
}
|
||||
|
||||
node.hidden = false;
|
||||
qs('openapi-import-plan-confirmation').hidden = true;
|
||||
}
|
||||
|
||||
function recoveryCode(payload) {
|
||||
var value = payload && payload.error && typeof payload.error === 'object'
|
||||
? payload.error
|
||||
: payload;
|
||||
var context = value && value.context && typeof value.context === 'object'
|
||||
? value.context
|
||||
: value;
|
||||
return String((context && context.recovery) || (payload && payload.recovery) || '');
|
||||
}
|
||||
|
||||
function reportFromPayload(payload) {
|
||||
if (!payload || typeof payload !== 'object') return null;
|
||||
var errorContext = payload.error && payload.error.context;
|
||||
var report = payload.report || payload.apply_report
|
||||
|| (errorContext && (errorContext.report || errorContext.apply_report || errorContext))
|
||||
|| payload;
|
||||
return report && Array.isArray(report.outcomes) ? report : null;
|
||||
}
|
||||
|
||||
async function notifyImported(revision, workspaceId, language) {
|
||||
if (typeof state.onImported !== 'function') return;
|
||||
|
||||
@@ -819,13 +1165,16 @@
|
||||
lockApplyInputs(true);
|
||||
qs('openapi-import-cancel').hidden = false;
|
||||
showRetry(false);
|
||||
setStatus(tKey('openapi.status.creating'));
|
||||
setStatus(tKey('openapi.status.applying'));
|
||||
|
||||
try {
|
||||
var response = await window.CrankApi.createOpenApiImport(
|
||||
var response = await window.CrankApi.applyOpenApiImportPlan(
|
||||
workspaceId,
|
||||
request.jobId,
|
||||
request.payload,
|
||||
request.planReference,
|
||||
{
|
||||
plan_digest: request.planDigest,
|
||||
idempotency_key: request.idempotencyKey,
|
||||
},
|
||||
{ signal: controller.signal }
|
||||
);
|
||||
// Abort is advisory: a superseded request can still deliver a response.
|
||||
@@ -847,9 +1196,19 @@
|
||||
}
|
||||
state.applyResult = response;
|
||||
state.applyRequest = null;
|
||||
state.plan = null;
|
||||
if (isCurrent(revision, workspaceId, language)) {
|
||||
setStatus(createdStatus(response));
|
||||
renderResult(response);
|
||||
renderImportPlanReport(response);
|
||||
if (response.recovery === 'repreview_required') {
|
||||
setStatus(tKey('openapi.plan.repreview'), true, true);
|
||||
showRetry(true);
|
||||
} else if (response.status === 'rejected'
|
||||
|| response.recovery === 'confirm_skip_rename_or_new_version') {
|
||||
setStatus(tKey('openapi.plan.resolve_conflict'), true, true);
|
||||
showRetry(true);
|
||||
} else {
|
||||
setStatus(tKey('openapi.status.applied'));
|
||||
}
|
||||
}
|
||||
await notifyImported(revision, workspaceId, language);
|
||||
} catch (error) {
|
||||
@@ -859,9 +1218,10 @@
|
||||
if (error && error.name === 'AbortError') {
|
||||
state.applyOutcomeUnknown = true;
|
||||
persistApplyReplay(state.applyRequest);
|
||||
lockApplyInputs(true);
|
||||
showRetry(true);
|
||||
if (!qs('openapi-import-modal').hidden) {
|
||||
setStatus(tKey('openapi.status.apply_outcome_unknown'), true, true);
|
||||
setStatus(tKey('openapi.plan.retry_unknown'), true, true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -872,19 +1232,35 @@
|
||||
state.applyRequest = null;
|
||||
clearApplyReplay();
|
||||
showRetry(true);
|
||||
var report = reportFromPayload(error.payload);
|
||||
if (report && isCurrent(revision, workspaceId, language)) {
|
||||
state.applyResult = report;
|
||||
renderImportPlanReport(report);
|
||||
}
|
||||
var recovery = recoveryCode(error.payload);
|
||||
state.plan = null;
|
||||
qs('openapi-import-plan-confirmation').hidden = true;
|
||||
lockPlanEditing(false);
|
||||
if (!qs('openapi-import-modal').hidden) {
|
||||
setStatus(errorStatus(error, 'openapi.error.create'), true, true);
|
||||
if (recovery === 'repreview_required') {
|
||||
setStatus(tKey('openapi.plan.repreview'), true, true);
|
||||
} else if (recovery === 'confirm_skip_rename_or_new_version') {
|
||||
setStatus(tKey('openapi.plan.resolve_conflict'), true, true);
|
||||
} else {
|
||||
setStatus(errorStatus(error, 'openapi.error.apply'), true, true);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// A browser/network failure is not proof that the server rolled the
|
||||
// transaction back. Replaying this exact job is idempotent server-side.
|
||||
// transaction back. Replaying this exact plan is idempotent server-side.
|
||||
state.applyOutcomeUnknown = true;
|
||||
persistApplyReplay(state.applyRequest);
|
||||
lockApplyInputs(true);
|
||||
showRetry(true);
|
||||
if (!qs('openapi-import-modal').hidden) {
|
||||
setStatus(errorStatus(error, 'openapi.error.create') + ' ' + tKey('openapi.status.apply_outcome_unknown'), true, true);
|
||||
setStatus(errorStatus(error, 'openapi.error.apply') + ' ' + tKey('openapi.plan.retry_unknown'), true, true);
|
||||
}
|
||||
} finally {
|
||||
if (state.applyController === controller) {
|
||||
@@ -896,14 +1272,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function createDrafts() {
|
||||
if (state.applyInFlight) return;
|
||||
async function createImportPlan() {
|
||||
if (state.applyInFlight || state.planController) return;
|
||||
|
||||
var keys = selectedKeys();
|
||||
if (!keys.length) {
|
||||
setStatus(tKey('openapi.error.selection'), true, true);
|
||||
return;
|
||||
}
|
||||
if (keys.length > 512 || importOperations().length - keys.length > 512) {
|
||||
setStatus(tKey('openapi.error.plan_too_large'), true, true);
|
||||
return;
|
||||
}
|
||||
if (!state.jobId || !state.preview) {
|
||||
setStatus(tKey('openapi.error.preview_required'), true, true);
|
||||
return;
|
||||
@@ -915,25 +1295,141 @@
|
||||
return;
|
||||
}
|
||||
|
||||
state.applyRequest = {
|
||||
workspaceId: state.workspaceId,
|
||||
jobId: state.jobId,
|
||||
payload: {
|
||||
selected_operation_keys: keys,
|
||||
server_url: serverUrl,
|
||||
conflict_mode: qs('openapi-import-conflict-mode').value || 'rename',
|
||||
},
|
||||
operationMetadata: (state.preview.groups || []).flatMap(function(group) {
|
||||
return (group.operations || []).filter(function(operation) {
|
||||
return keys.indexOf(operation.key) >= 0;
|
||||
}).map(function(operation) {
|
||||
return { key: operation.key, method: operation.method, path: operation.path };
|
||||
if (!state.workspaceId) {
|
||||
setStatus(tKey('openapi.error.workspace'), true, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!state.operationsReady) {
|
||||
setStatus(tKey('openapi.error.operations_unavailable'), true, true);
|
||||
return;
|
||||
}
|
||||
|
||||
var selectedSet = new Set(keys);
|
||||
var decisions = [];
|
||||
var invalidDecision = null;
|
||||
importOperations().forEach(function(operation) {
|
||||
if (!selectedSet.has(operation.key) || invalidDecision) return;
|
||||
var decision = decisionFor(operation.key);
|
||||
var output = { operation_key: operation.key, action: decision.action };
|
||||
if (decision.action === 'skip' || decision.action === 'new_version') {
|
||||
var allowedTargets = matchingOperations(operation).filter(function(existing) {
|
||||
return decision.action !== 'new_version'
|
||||
|| (existing.protocol === 'rest' && existing.status !== 'archived');
|
||||
});
|
||||
}),
|
||||
if (!allowedTargets.some(function(existing) { return existing.id === decision.targetOperationId; })) {
|
||||
invalidDecision = 'openapi.error.decision_target';
|
||||
return;
|
||||
}
|
||||
output.target_operation_id = decision.targetOperationId;
|
||||
} else if (decision.action === 'rename') {
|
||||
if (!decision.confirmedName || !decision.confirmedName.trim()) {
|
||||
invalidDecision = 'openapi.error.confirmed_name';
|
||||
return;
|
||||
}
|
||||
output.confirmed_name = decision.confirmedName;
|
||||
} else if (decision.action !== 'create') {
|
||||
invalidDecision = 'openapi.error.decision_action';
|
||||
return;
|
||||
}
|
||||
if (decision.action !== 'create') decisions.push(output);
|
||||
});
|
||||
if (invalidDecision) {
|
||||
setStatus(tKey(invalidDecision), true, true);
|
||||
return;
|
||||
}
|
||||
|
||||
var total = (state.preview.groups || []).reduce(function(count, group) {
|
||||
return count + (group.operations || []).length;
|
||||
}, 0);
|
||||
var selectionMode = keys.length === total ? 'full' : 'partial';
|
||||
var payload = {
|
||||
selection_mode: selectionMode,
|
||||
selected_operation_keys: selectionMode === 'full' ? [] : keys,
|
||||
server_url: serverUrl,
|
||||
decisions: decisions,
|
||||
};
|
||||
state.applyMetadata = state.applyRequest.operationMetadata;
|
||||
persistApplyReplay(state.applyRequest);
|
||||
await submitApply(state.applyRequest);
|
||||
var revision = state.revision;
|
||||
var workspaceId = state.workspaceId;
|
||||
var language = locale();
|
||||
var controller = new AbortController();
|
||||
state.planController = controller;
|
||||
state.plan = null;
|
||||
lockPlanEditing(true);
|
||||
qs('openapi-import-cancel').hidden = false;
|
||||
qs('openapi-import-plan-confirmation').hidden = true;
|
||||
showRetry(false);
|
||||
setStatus(tKey('openapi.status.planning'));
|
||||
|
||||
try {
|
||||
var plan = await window.CrankApi.createOpenApiImportPlan(
|
||||
workspaceId,
|
||||
state.jobId,
|
||||
payload,
|
||||
{ signal: controller.signal }
|
||||
);
|
||||
if (state.planController !== controller) return;
|
||||
if (!isCurrent(revision, workspaceId, language)) return;
|
||||
if (!plan || typeof plan.plan_reference !== 'string'
|
||||
|| !/^[a-f0-9]{64}$/.test(String(plan.plan_digest || ''))
|
||||
|| !plan.counts || !Array.isArray(plan.candidates)) {
|
||||
throw new Error('Backend returned an invalid ImportPlan response');
|
||||
}
|
||||
state.plan = plan;
|
||||
renderImportPlan(plan);
|
||||
setStatus(tKey('openapi.status.plan_ready'));
|
||||
} catch (error) {
|
||||
if (state.planController !== controller) return;
|
||||
if (error && error.name === 'AbortError') {
|
||||
setStatus(tKey('openapi.status.cancelled'));
|
||||
return;
|
||||
}
|
||||
setStatus(errorStatus(error, 'openapi.error.plan'), true, true);
|
||||
showRetry(true);
|
||||
} finally {
|
||||
if (state.planController === controller) {
|
||||
state.planController = null;
|
||||
lockPlanEditing(!!state.plan);
|
||||
qs('openapi-import-cancel').hidden = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function newIdempotencyKey() {
|
||||
if (window.crypto && typeof window.crypto.randomUUID === 'function') {
|
||||
return 'openapi:' + window.crypto.randomUUID();
|
||||
}
|
||||
return 'openapi:' + Date.now().toString(36) + ':' + Math.random().toString(36).slice(2);
|
||||
}
|
||||
|
||||
async function applyImportPlan() {
|
||||
if (state.applyInFlight || !state.plan || state.applyOutcomeUnknown) return;
|
||||
var request = {
|
||||
workspaceId: state.workspaceId,
|
||||
planReference: state.plan.plan_reference,
|
||||
planDigest: state.plan.plan_digest,
|
||||
idempotencyKey: newIdempotencyKey(),
|
||||
};
|
||||
if (!validApplyReplay(request)) {
|
||||
setStatus(tKey('openapi.error.apply'), true, true);
|
||||
return;
|
||||
}
|
||||
state.applyRequest = request;
|
||||
persistApplyReplay(request);
|
||||
await submitApply(request);
|
||||
}
|
||||
|
||||
function backToImportSelection() {
|
||||
if (state.applyInFlight || state.applyOutcomeUnknown) return;
|
||||
state.plan = null;
|
||||
qs('openapi-import-plan-confirmation').hidden = true;
|
||||
qs('openapi-import-plan-counts').replaceChildren();
|
||||
qs('openapi-import-plan-candidates').replaceChildren();
|
||||
qs('openapi-import-versioning-consequences').hidden = true;
|
||||
qs('openapi-import-plan-blocked-help').hidden = true;
|
||||
qs('openapi-import-plan-back').textContent = tKey('openapi.plan.back');
|
||||
lockPlanEditing(false);
|
||||
setStatus(tKey('openapi.status.preview_ready'));
|
||||
}
|
||||
|
||||
function retryCurrent() {
|
||||
@@ -948,7 +1444,6 @@
|
||||
showRetry(false);
|
||||
setStatus('');
|
||||
qs('openapi-import-server-custom').value = '';
|
||||
qs('openapi-import-conflict-mode').value = 'rename';
|
||||
}
|
||||
|
||||
function open(options) {
|
||||
@@ -963,12 +1458,25 @@
|
||||
qs('openapi-import-modal').hidden = false;
|
||||
renderFileName();
|
||||
if (state.applyResult) {
|
||||
renderResult(state.applyResult);
|
||||
setStatus(createdStatus(state.applyResult) + (state.applyRefreshFailed ? ' ' + tKey('openapi.status.refresh_failed') : ''));
|
||||
if (Array.isArray(state.applyResult.outcomes)) {
|
||||
renderImportPlanReport(state.applyResult);
|
||||
} else {
|
||||
renderResult(state.applyResult);
|
||||
}
|
||||
if (state.applyResult.recovery === 'repreview_required') {
|
||||
showRetry(true);
|
||||
setStatus(tKey('openapi.plan.repreview'), true, true);
|
||||
} else if (state.applyResult.status === 'rejected'
|
||||
|| state.applyResult.recovery === 'confirm_skip_rename_or_new_version') {
|
||||
showRetry(true);
|
||||
setStatus(tKey('openapi.plan.resolve_conflict'), true, true);
|
||||
} else {
|
||||
setStatus(createdStatus(state.applyResult) + (state.applyRefreshFailed ? ' ' + tKey('openapi.status.refresh_failed') : ''));
|
||||
}
|
||||
} else if (state.applyOutcomeUnknown && state.applyRequest) {
|
||||
lockApplyInputs(true);
|
||||
showRetry(true);
|
||||
setStatus(tKey('openapi.status.apply_outcome_unknown'), true, true);
|
||||
setStatus(tKey('openapi.plan.retry_unknown'), true, true);
|
||||
qs('openapi-import-retry').focus();
|
||||
return;
|
||||
}
|
||||
@@ -1031,7 +1539,9 @@
|
||||
});
|
||||
qs('openapi-import-preview').addEventListener('click', preview);
|
||||
qs('openapi-import-retry').addEventListener('click', retryCurrent);
|
||||
qs('openapi-import-create').addEventListener('click', createDrafts);
|
||||
qs('openapi-import-create').addEventListener('click', createImportPlan);
|
||||
qs('openapi-import-plan-apply').addEventListener('click', applyImportPlan);
|
||||
qs('openapi-import-plan-back').addEventListener('click', backToImportSelection);
|
||||
qs('openapi-import-cancel').addEventListener('click', cancelCurrent);
|
||||
qs('openapi-import-reset').addEventListener('click', reset);
|
||||
qs('openapi-import-search').addEventListener('input', function(event) {
|
||||
@@ -1082,7 +1592,7 @@
|
||||
}
|
||||
if (state.applyOutcomeUnknown && state.applyRequest) {
|
||||
showRetry(true);
|
||||
setStatus(tKey('openapi.status.apply_outcome_unknown'), true, true);
|
||||
setStatus(tKey('openapi.plan.retry_unknown'), true, true);
|
||||
return;
|
||||
}
|
||||
invalidate(options);
|
||||
@@ -1091,9 +1601,15 @@
|
||||
setStatus(tKey('openapi.status.context_changed'));
|
||||
}
|
||||
}
|
||||
window.addEventListener('crank:langchange', function() {
|
||||
function handleLanguageChange() {
|
||||
if (!qs('openapi-import-modal').hidden && state.plan && !state.applyInFlight && !state.applyOutcomeUnknown) {
|
||||
renderImportPlan(state.plan);
|
||||
setStatus(tKey('openapi.status.plan_ready'));
|
||||
return;
|
||||
}
|
||||
invalidateForContext();
|
||||
});
|
||||
}
|
||||
window.addEventListener('crank:langchange', handleLanguageChange);
|
||||
window.addEventListener('crank:workspacechange', function(event) {
|
||||
if (!qs('openapi-import-modal').hidden) {
|
||||
state.workspaceId = event.detail && event.detail.id || null;
|
||||
@@ -1101,7 +1617,7 @@
|
||||
}
|
||||
});
|
||||
window.addEventListener('storage', function(event) {
|
||||
if (event.key === 'crank_lang') invalidateForContext();
|
||||
if (event.key === 'crank_lang') handleLanguageChange();
|
||||
});
|
||||
window.addEventListener('pagehide', function() {
|
||||
if (state.applyInFlight || state.applyController) {
|
||||
@@ -1124,7 +1640,7 @@
|
||||
if (state.applyOutcomeUnknown && state.applyRequest) {
|
||||
lockApplyInputs(true);
|
||||
showRetry(true);
|
||||
setStatus(tKey('openapi.status.apply_outcome_unknown'), true, true);
|
||||
setStatus(tKey('openapi.plan.retry_unknown'), true, true);
|
||||
} else {
|
||||
invalidateForContext({ clearFile: true });
|
||||
}
|
||||
|
||||
@@ -156,6 +156,7 @@ test('onboarding error exposes safe support correlation and retries without a cl
|
||||
});
|
||||
|
||||
await page.goto('/');
|
||||
await expect(page.getByTestId('onboarding-trigger')).toContainText(/3\s*\/\s*7/);
|
||||
await page.getByTestId('onboarding-trigger').click();
|
||||
fail = true;
|
||||
await page.getByTestId('onboarding-refresh').click();
|
||||
|
||||
@@ -0,0 +1,278 @@
|
||||
const { test, expect } = require('@playwright/test');
|
||||
const { login, localized, uniqueName } = require('./helpers');
|
||||
|
||||
async function dismissOnboardingIfOpen(page) {
|
||||
await page.locator('#crank-onboarding-panel').waitFor({ state: 'attached' });
|
||||
await page.locator('[data-testid="onboarding-dismiss"]').waitFor({ state: 'attached' });
|
||||
await page.evaluate(() => {
|
||||
const dismiss = document.querySelector('[data-testid="onboarding-dismiss"]');
|
||||
if (dismiss) dismiss.click();
|
||||
});
|
||||
await expect(page.locator('#crank-onboarding-panel')).toBeHidden();
|
||||
}
|
||||
|
||||
function importDocument(prefix) {
|
||||
return [
|
||||
'openapi: 3.0.3',
|
||||
'info: { title: ImportPlan UI test, version: \'1\' }',
|
||||
'paths:',
|
||||
' /' + prefix + '-selected:',
|
||||
' get:',
|
||||
' operationId: ' + prefix + '_selected',
|
||||
' responses:',
|
||||
' \'200\': { description: OK }',
|
||||
' /' + prefix + '-excluded:',
|
||||
' get:',
|
||||
' operationId: ' + prefix + '_excluded',
|
||||
' responses:',
|
||||
' \'200\': { description: OK }',
|
||||
].join('\n');
|
||||
}
|
||||
|
||||
function planResponse(prefix) {
|
||||
return {
|
||||
plan_reference: 'plan_e2e_importplan_213',
|
||||
plan_digest: 'a'.repeat(64),
|
||||
expires_at: new Date(Date.now() + 60 * 60 * 1000).toISOString(),
|
||||
selection_mode: 'partial',
|
||||
counts: { selected: 1, excluded: 1, actionable: 1, blocked: 0 },
|
||||
candidates: [
|
||||
{
|
||||
key: 'GET /' + prefix + '-selected',
|
||||
name: 'selected_operation',
|
||||
state: 'actionable',
|
||||
action: 'new_version',
|
||||
target_operation_id: 'op_existing_target',
|
||||
confirmed_name: null,
|
||||
auth_profile_id: null,
|
||||
reason: null,
|
||||
},
|
||||
{
|
||||
key: 'GET /' + prefix + '-excluded',
|
||||
name: 'excluded_operation',
|
||||
state: 'excluded',
|
||||
action: null,
|
||||
target_operation_id: null,
|
||||
confirmed_name: null,
|
||||
auth_profile_id: null,
|
||||
reason: 'not_selected',
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
async function preparePlanFlow(page, locale) {
|
||||
const planCalls = [];
|
||||
const applyCalls = [];
|
||||
const prefix = uniqueName('plan_apply');
|
||||
let releaseApplyResponse;
|
||||
const applyResponseHeld = new Promise((resolve) => {
|
||||
releaseApplyResponse = resolve;
|
||||
});
|
||||
|
||||
// Keep this mock aligned with the public CreatePlan response shape.
|
||||
await page.route('**/api/admin/workspaces/*/operations', async (route) => {
|
||||
await route.fulfill({
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({ items: [], page: 1, page_size: 0, total: 0 }),
|
||||
});
|
||||
});
|
||||
await page.route(/\/imports\/openapi\/[^/]+\/plans$/, async (route) => {
|
||||
planCalls.push({
|
||||
url: route.request().url(),
|
||||
payload: route.request().postDataJSON(),
|
||||
});
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify(planResponse(prefix)),
|
||||
});
|
||||
});
|
||||
await page.route(/\/imports\/openapi\/[^/]+\/apply$/, async (route) => {
|
||||
applyCalls.push({
|
||||
url: route.request().url(),
|
||||
payload: route.request().postDataJSON(),
|
||||
});
|
||||
// Keep the request pending until the test has checked the duplicate guard.
|
||||
await applyResponseHeld;
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({
|
||||
plan_digest: 'a'.repeat(64),
|
||||
counts: { selected: 1, excluded: 1, created: 0, versioned: 1 },
|
||||
outcomes: [{ status: 'versioned' }],
|
||||
}),
|
||||
});
|
||||
});
|
||||
// Contain the legacy path so this red-phase test cannot mutate the E2E DB.
|
||||
await page.route(/\/imports\/openapi\/[^/]+\/create$/, async (route) => {
|
||||
await route.fulfill({
|
||||
status: 409,
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({ message: 'ImportPlan flow required' }),
|
||||
});
|
||||
});
|
||||
|
||||
await login(page);
|
||||
await dismissOnboardingIfOpen(page);
|
||||
await page.evaluate((language) => window.setLang(language), locale);
|
||||
await page.getByRole('button', { name: localized('Import OpenAPI', 'Импорт OpenAPI') }).click();
|
||||
await expect(page.locator('#openapi-import-modal')).toBeVisible();
|
||||
await page.locator('#openapi-import-file').setInputFiles({
|
||||
name: 'import-plan.yaml',
|
||||
mimeType: 'application/yaml',
|
||||
buffer: Buffer.from(importDocument(prefix)),
|
||||
});
|
||||
const previewResponse = page.waitForResponse((response) =>
|
||||
response.request().method() === 'POST'
|
||||
&& response.url().includes('/imports/openapi/preview'),
|
||||
);
|
||||
await page.locator('#openapi-import-preview').click();
|
||||
await previewResponse;
|
||||
await expect(page.locator('#openapi-import-preview-panel')).toBeVisible();
|
||||
await page.locator('#openapi-import-server-custom').fill('https://api.example.test');
|
||||
|
||||
// The existing preview action becomes Plan creation followed by confirmation.
|
||||
await page.locator('#openapi-import-create').click();
|
||||
await expect(page.locator('[data-testid="openapi-import-apply-confirmation"]')).toBeVisible();
|
||||
await expect.poll(() => planCalls.length).toBe(1);
|
||||
return { planCalls, applyCalls, prefix, releaseApplyResponse };
|
||||
}
|
||||
|
||||
async function assertConfirmation(page, prefix) {
|
||||
const confirmation = page.locator('[data-testid="openapi-import-apply-confirmation"]');
|
||||
const counts = page.locator('[data-testid="openapi-import-apply-counts"]');
|
||||
const versioning = page.locator('[data-testid="openapi-import-versioning-consequences"]');
|
||||
|
||||
await expect(counts).toContainText(localized('Selected: 1', 'Выбрано: 1'));
|
||||
await expect(counts).toContainText(localized('Excluded: 1', 'Исключено: 1'));
|
||||
await expect(counts).toContainText(localized('Actionable: 1', 'Можно применить: 1'));
|
||||
await expect(counts).toContainText(localized('Blocked: 0', 'Заблокировано: 0'));
|
||||
await expect(versioning).toContainText(localized('new Draft Version', 'новая версия черновика'));
|
||||
await expect(versioning).toContainText(
|
||||
localized('Published Version and history remain unchanged', 'Опубликованная версия и история останутся без изменений'),
|
||||
);
|
||||
await expect(confirmation).toContainText('GET /' + prefix + '-selected');
|
||||
await expect(confirmation).toContainText('GET /' + prefix + '-excluded');
|
||||
await expect(confirmation).toContainText('op_existing_target');
|
||||
}
|
||||
|
||||
test('[P1] AC-13 renders server-confirmed partial and new_version consequences in RU and EN', async ({ page }) => {
|
||||
// This test covers rendering of a stored server plan only. It does not
|
||||
// specify how UI controls compose selection/decision request fields.
|
||||
const { planCalls, prefix } = await preparePlanFlow(page, 'ru');
|
||||
for (const locale of ['ru', 'en']) {
|
||||
await test.step('confirmation in ' + locale, async () => {
|
||||
await page.evaluate((language) => window.setLang(language), locale);
|
||||
await assertConfirmation(page, prefix);
|
||||
});
|
||||
}
|
||||
expect(planCalls).toHaveLength(1);
|
||||
expect(planCalls[0].url).toMatch(/\/imports\/openapi\/[^/]+\/plans$/);
|
||||
await expect(page.locator('[data-testid="openapi-import-apply-confirmation"]').getByRole('button', {
|
||||
name: localized('Apply import', 'Применить импорт'),
|
||||
})).toBeVisible();
|
||||
});
|
||||
|
||||
test('[P1] AC-13 double-click sends one Apply with the stored reference, digest and idempotency key', async ({ page }) => {
|
||||
const { applyCalls, releaseApplyResponse } = await preparePlanFlow(page, 'en');
|
||||
const applyButton = page.getByRole('button', {
|
||||
name: localized('Apply import', 'Применить импорт'),
|
||||
});
|
||||
|
||||
await applyButton.dblclick();
|
||||
|
||||
await expect.poll(() => applyCalls.length).toBe(1);
|
||||
await expect(applyButton).toBeDisabled();
|
||||
releaseApplyResponse();
|
||||
await expect(page.locator('[data-testid="openapi-import-apply-result"]')).toBeVisible();
|
||||
expect(applyCalls).toHaveLength(1);
|
||||
expect(applyCalls[0].url).toMatch(/\/imports\/openapi\/plan_e2e_importplan_213\/apply$/);
|
||||
expect(applyCalls[0].payload).toMatchObject({
|
||||
plan_digest: 'a'.repeat(64),
|
||||
});
|
||||
expect(typeof applyCalls[0].payload.idempotency_key).toBe('string');
|
||||
expect(applyCalls[0].payload.idempotency_key.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
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';
|
||||
const planCalls = [];
|
||||
const expectedName = prefix + '_selected';
|
||||
await page.route('**/api/admin/workspaces/*/operations', async (route) => {
|
||||
await route.fulfill({
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({
|
||||
items: [{ id: targetOperationId, name: expectedName, protocol: 'rest', status: 'draft' }],
|
||||
page: 1,
|
||||
page_size: 1,
|
||||
total: 1,
|
||||
}),
|
||||
});
|
||||
});
|
||||
await page.route(/\/imports\/openapi\/[^/]+\/plans$/, async (route) => {
|
||||
const payload = route.request().postDataJSON();
|
||||
planCalls.push(payload);
|
||||
await route.fulfill({
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({
|
||||
plan_reference: 'plan_e2e_importplan_decision',
|
||||
plan_digest: 'b'.repeat(64),
|
||||
expires_at: new Date(Date.now() + 60 * 60 * 1000).toISOString(),
|
||||
selection_mode: payload.selection_mode,
|
||||
counts: { selected: 1, excluded: 0, actionable: 1, blocked: 0 },
|
||||
candidates: [{
|
||||
key: payload.decisions[0].operation_key,
|
||||
name: expectedName,
|
||||
state: 'actionable',
|
||||
action: 'new_version',
|
||||
target_operation_id: targetOperationId,
|
||||
confirmed_name: null,
|
||||
auth_profile_id: null,
|
||||
reason: null,
|
||||
}],
|
||||
}),
|
||||
});
|
||||
});
|
||||
|
||||
await login(page);
|
||||
await dismissOnboardingIfOpen(page);
|
||||
await page.getByRole('button', { name: localized('Import OpenAPI', 'Импорт OpenAPI') }).click();
|
||||
await page.locator('#openapi-import-file').setInputFiles({
|
||||
name: 'import-plan-decision.yaml',
|
||||
mimeType: 'application/yaml',
|
||||
buffer: Buffer.from(importDocument(prefix)),
|
||||
});
|
||||
const previewResponse = page.waitForResponse((response) =>
|
||||
response.request().method() === 'POST' && response.url().includes('/imports/openapi/preview'),
|
||||
);
|
||||
await page.locator('#openapi-import-preview').click();
|
||||
await previewResponse;
|
||||
const operationRow = page.locator('.openapi-import-operation').filter({ hasText: expectedName });
|
||||
const operationCheckbox = operationRow.locator('[data-openapi-operation]');
|
||||
await expect(operationCheckbox).toBeVisible();
|
||||
const operationKey = await operationCheckbox.inputValue();
|
||||
for (const checkbox of await page.locator('[data-openapi-operation]').all()) {
|
||||
if (await checkbox.inputValue() !== operationKey) await checkbox.uncheck();
|
||||
}
|
||||
await expect(operationRow.locator('.openapi-import-operation-meta')).toContainText(expectedName);
|
||||
const action = operationRow.locator('[data-openapi-decision-action]');
|
||||
await expect(action.locator('option[value="new_version"]')).toBeEnabled();
|
||||
await action.selectOption('new_version');
|
||||
await expect(operationRow.locator('[data-openapi-decision-target]')).toHaveValue(targetOperationId);
|
||||
await page.locator('#openapi-import-server-custom').fill('https://api.example.test');
|
||||
await page.locator('#openapi-import-create').click();
|
||||
await expect(page.locator('[data-testid="openapi-import-apply-confirmation"]')).toBeVisible();
|
||||
await expect(page.locator('[data-testid="openapi-import-apply-confirmation"]')).toContainText(targetOperationId);
|
||||
|
||||
expect(planCalls).toHaveLength(1);
|
||||
expect(planCalls[0].selection_mode).toBe('partial');
|
||||
expect(planCalls[0].selected_operation_keys).toEqual([operationKey]);
|
||||
expect(planCalls[0].decisions).toEqual([{
|
||||
operation_key: operationKey,
|
||||
action: 'new_version',
|
||||
target_operation_id: targetOperationId,
|
||||
}]);
|
||||
});
|
||||
@@ -11,6 +11,48 @@ async function dismissOnboardingIfOpen(page) {
|
||||
await expect(page.locator('#crank-onboarding-panel')).toBeHidden();
|
||||
}
|
||||
|
||||
function planResponse(payload, planReference) {
|
||||
const decisions = payload.decisions || [];
|
||||
return {
|
||||
plan_reference: planReference,
|
||||
plan_digest: 'c'.repeat(64),
|
||||
expires_at: new Date(Date.now() + 60 * 60 * 1000).toISOString(),
|
||||
selection_mode: payload.selection_mode,
|
||||
counts: { selected: decisions.length, excluded: 0, actionable: decisions.length, blocked: 0 },
|
||||
candidates: decisions.map((decision) => ({
|
||||
key: decision.operation_key,
|
||||
name: decision.confirmed_name || decision.operation_key,
|
||||
state: 'actionable',
|
||||
action: decision.action,
|
||||
target_operation_id: decision.target_operation_id || null,
|
||||
confirmed_name: decision.confirmed_name || null,
|
||||
auth_profile_id: null,
|
||||
reason: null,
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
function applyResponse(payload, names) {
|
||||
const outcomes = (payload.outcomes || []).map((outcome) => ({
|
||||
key: outcome.key,
|
||||
name: names && names[outcome.key] || outcome.name || outcome.key,
|
||||
status: outcome.status || 'created',
|
||||
}));
|
||||
return {
|
||||
counts: { created: outcomes.filter((outcome) => outcome.status === 'created').length },
|
||||
outcomes,
|
||||
};
|
||||
}
|
||||
|
||||
async function mockEmptyOperationsList(page) {
|
||||
await page.route('**/api/admin/workspaces/*/operations', async (route) => {
|
||||
await route.fulfill({
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({ items: [], page: 1, page_size: 0, total: 0 }),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
test('operations page shows demo catalog and filter works', async ({ page }) => {
|
||||
await login(page);
|
||||
await expect(page.locator('.page-heading')).toHaveText(localized('Operations', 'Операции'));
|
||||
@@ -112,7 +154,6 @@ paths:
|
||||
await expect(importedOperation.locator('.openapi-import-mapping-preview')).toContainText('Header');
|
||||
await expect(importedOperation.locator('.openapi-import-mapping-preview')).toContainText('X-API-Version');
|
||||
await expect(importedOperation.locator('.openapi-import-mapping-preview')).toContainText('Body');
|
||||
await expect(importedOperation.locator('.openapi-import-mapping-preview')).toContainText('symbols');
|
||||
await expect(importedOperation.locator('.openapi-import-mapping-preview')).toContainText(localized('Response', 'Ответ'));
|
||||
await expect(page.locator('#openapi-import-selection')).toContainText(localized('Selected: 2', 'Выбрано: 2'));
|
||||
await page.locator('#openapi-import-search').fill('status');
|
||||
@@ -127,18 +168,19 @@ paths:
|
||||
await page.locator('#openapi-import-method-filter').selectOption('');
|
||||
await page.locator('#openapi-import-server-custom').fill('https://api.example.test');
|
||||
await page.locator('#openapi-import-create').click();
|
||||
await expect(page.locator('#openapi-import-result')).toContainText(localized('Import result', 'Результат импорта'));
|
||||
await expect(page.locator('.openapi-import-result-table')).toBeVisible();
|
||||
await expect(page.locator('.openapi-import-result-row').filter({ hasText: operationId })).toContainText('POST /v1/rates/{date}');
|
||||
await expect(page.locator('.openapi-import-result-row').filter({ hasText: operationId })).toContainText(localized('tool description is too short', 'Описание инструмента слишком короткое'));
|
||||
await expect(page.locator('.openapi-import-result-row').filter({ hasText: operationId })).toContainText(localized('Fix in wizard', 'Исправить в мастере'));
|
||||
await expect(page.locator('.openapi-import-primary-result a')).toHaveAttribute(
|
||||
'href',
|
||||
/\/wizard\/\?mode=edit&operationId=op_/
|
||||
);
|
||||
await expect(page.locator('[data-testid="openapi-import-apply-confirmation"]')).toBeVisible();
|
||||
await page.locator('#openapi-import-plan-apply').click();
|
||||
await expect(page.locator('#openapi-import-result')).toBeVisible();
|
||||
await expect(page.locator('#openapi-import-result')).toContainText(localized('Import plan result', 'Результат плана импорта'));
|
||||
await expect(page.locator('.openapi-import-plan-outcomes')).toContainText(operationId);
|
||||
await expect(page.locator('.openapi-import-plan-outcomes')).toContainText('POST /v1/rates/{date}');
|
||||
await expect(importedOperation.locator('.openapi-import-findings')).toContainText(localized('tool description is too short', 'Описание инструмента слишком короткое'));
|
||||
await expect(page.locator('tbody')).toContainText(new RegExp(operationId, 'i'));
|
||||
await expect(page.locator('tbody')).not.toContainText(new RegExp(statusOperationId, 'i'));
|
||||
await expect(page.locator('body')).not.toContainText(sourceCanary);
|
||||
await page.locator('[data-openapi-close]').last().click();
|
||||
await page.locator('tbody tr').filter({ hasText: operationId }).locator('.row-btn-edit').click();
|
||||
await expect(page).toHaveURL(/\/wizard\/\?mode=edit&operationId=op_/);
|
||||
});
|
||||
|
||||
test('OpenAPI upload rejects invalid files locally and restores focus after Escape', async ({ page }) => {
|
||||
@@ -246,6 +288,7 @@ test('OpenAPI apply cancellation preserves the import job for an idempotent retr
|
||||
await login(page);
|
||||
await dismissOnboardingIfOpen(page);
|
||||
await page.getByRole('button', { name: localized('Import OpenAPI', 'Импорт OpenAPI') }).click();
|
||||
await mockEmptyOperationsList(page);
|
||||
|
||||
await page.route('**/imports/openapi/preview', async (route) => {
|
||||
await route.fulfill({
|
||||
@@ -269,11 +312,18 @@ test('OpenAPI apply cancellation preserves the import job for an idempotent retr
|
||||
});
|
||||
|
||||
const requests = [];
|
||||
await page.route('**/imports/openapi/*/plans', async (route) => {
|
||||
const payload = route.request().postDataJSON();
|
||||
await route.fulfill({
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify(planResponse(payload, 'plan_retry_same_authority')),
|
||||
});
|
||||
});
|
||||
let releaseFirst;
|
||||
const firstRequest = new Promise((resolve) => {
|
||||
releaseFirst = resolve;
|
||||
});
|
||||
await page.route('**/imports/openapi/*/create', async (route) => {
|
||||
await page.route('**/imports/openapi/*/apply', async (route) => {
|
||||
requests.push({ url: route.request().url(), body: route.request().postData() });
|
||||
if (requests.length === 1) await firstRequest;
|
||||
if (requests.length === 3) {
|
||||
@@ -287,12 +337,9 @@ test('OpenAPI apply cancellation preserves the import job for an idempotent retr
|
||||
try {
|
||||
await route.fulfill({
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({
|
||||
created: [{
|
||||
operation_key: 'get:/retry', name: 'renamed_after_conflict', operation_id: 'op_retry', version: 1,
|
||||
}],
|
||||
skipped: [], findings: [],
|
||||
}),
|
||||
body: JSON.stringify(applyResponse({ outcomes: [{
|
||||
key: 'get:/retry', name: 'renamed_after_conflict', status: 'created',
|
||||
}] })),
|
||||
});
|
||||
} catch (_error) {
|
||||
// The first request is deliberately aborted by the browser.
|
||||
@@ -305,23 +352,25 @@ test('OpenAPI apply cancellation preserves the import job for an idempotent retr
|
||||
await page.locator('#openapi-import-preview').click();
|
||||
await expect(page.locator('#openapi-import-preview-panel')).toBeVisible();
|
||||
await page.locator('#openapi-import-create').click();
|
||||
await expect(page.locator('[data-testid="openapi-import-apply-confirmation"]')).toBeVisible();
|
||||
await page.locator('#openapi-import-plan-apply').click();
|
||||
await expect.poll(() => requests.length).toBe(1);
|
||||
await page.locator('#openapi-import-cancel').click();
|
||||
await expect(page.locator('#openapi-import-status')).toContainText(localized('may have completed', 'мог завершиться'));
|
||||
await expect(page.locator('#openapi-import-status')).toContainText(localized('Apply result is unknown', 'Результат применения неизвестен'));
|
||||
await expect(page.locator('#openapi-import-retry')).toBeVisible();
|
||||
await page.locator('[data-openapi-close]').last().click();
|
||||
await page.reload();
|
||||
await page.getByRole('button', { name: localized('Import OpenAPI', 'Импорт OpenAPI') }).click();
|
||||
await expect(page.locator('#openapi-import-retry')).toBeVisible();
|
||||
await page.locator('#openapi-import-retry').click();
|
||||
await expect(page.locator('#openapi-import-result')).toContainText('GET /retry');
|
||||
await expect(page.locator('#openapi-import-result')).toContainText('get:/retry');
|
||||
await expect.poll(() => requests.length).toBe(2);
|
||||
// Let the cancelled first attempt answer after the retry. Its stale response
|
||||
// must not overwrite or unlock the newer attempt's state.
|
||||
releaseFirst();
|
||||
await page.waitForTimeout(50);
|
||||
await expect(page.locator('#openapi-import-result')).toContainText('GET /retry');
|
||||
expect(requests[0].url).toContain('/imports/openapi/job_retry_same_authority/create');
|
||||
await expect(page.locator('#openapi-import-result')).toContainText('get:/retry');
|
||||
expect(requests[0].url).toContain('/imports/openapi/plan_retry_same_authority/apply');
|
||||
expect(requests[1].url).toBe(requests[0].url);
|
||||
expect(requests[1].body).toBe(requests[0].body);
|
||||
|
||||
@@ -334,17 +383,20 @@ test('OpenAPI apply cancellation preserves the import job for an idempotent retr
|
||||
await page.locator('#openapi-import-preview').click();
|
||||
await expect(page.locator('#openapi-import-preview-panel')).toBeVisible();
|
||||
await page.locator('#openapi-import-create').click();
|
||||
await expect(page.locator('[data-testid="openapi-import-apply-confirmation"]')).toBeVisible();
|
||||
await page.locator('#openapi-import-plan-apply').click();
|
||||
await expect.poll(() => requests.length).toBe(3);
|
||||
await expect(page.locator('#openapi-import-file-select')).toBeEnabled();
|
||||
await expect(page.locator('#openapi-import-reset')).toBeEnabled();
|
||||
await expect(page.locator('#openapi-import-retry')).toBeVisible();
|
||||
expect(await page.evaluate(() => sessionStorage.getItem('crank_openapi_apply_replay_v1'))).toBeNull();
|
||||
expect(await page.evaluate(() => sessionStorage.getItem('crank_openapi_plan_apply_replay_v2'))).toBeNull();
|
||||
});
|
||||
|
||||
test('OpenAPI apply preserves job authority after language or workspace changes', async ({ page }) => {
|
||||
await login(page);
|
||||
await dismissOnboardingIfOpen(page);
|
||||
await page.getByRole('button', { name: localized('Import OpenAPI', 'Импорт OpenAPI') }).click();
|
||||
await mockEmptyOperationsList(page);
|
||||
|
||||
await page.route('**/imports/openapi/preview', async (route) => {
|
||||
await route.fulfill({
|
||||
@@ -368,16 +420,21 @@ test('OpenAPI apply preserves job authority after language or workspace changes'
|
||||
});
|
||||
const releases = [];
|
||||
const applyRequests = [];
|
||||
await page.route('**/imports/openapi/*/create', async (route) => {
|
||||
await page.route('**/imports/openapi/*/plans', async (route) => {
|
||||
await route.fulfill({
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify(planResponse(route.request().postDataJSON(), 'plan_active_apply')),
|
||||
});
|
||||
});
|
||||
await page.route('**/imports/openapi/*/apply', async (route) => {
|
||||
applyRequests.push({ url: route.request().url(), body: route.request().postData() });
|
||||
await new Promise((resolve) => releases.push(resolve));
|
||||
try {
|
||||
await route.fulfill({
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({
|
||||
created: [{ operation_key: 'get:/active', name: 'active', operation_id: 'op_active', version: 1 }],
|
||||
skipped: [], findings: [],
|
||||
}),
|
||||
body: JSON.stringify(applyResponse({ outcomes: [{
|
||||
key: 'get:/active', name: 'active', status: 'created',
|
||||
}] })),
|
||||
});
|
||||
} catch (_error) {
|
||||
// The invalidation aborts a request that must not update the modal afterwards.
|
||||
@@ -394,6 +451,8 @@ test('OpenAPI apply preserves job authority after language or workspace changes'
|
||||
await expect(page.locator('#openapi-import-preview-panel')).toBeVisible();
|
||||
await page.locator('#openapi-import-server-custom').fill('https://api.example.test');
|
||||
await page.locator('#openapi-import-create').click();
|
||||
await expect(page.locator('[data-testid="openapi-import-apply-confirmation"]')).toBeVisible();
|
||||
await page.locator('#openapi-import-plan-apply').click();
|
||||
await expect(page.locator('#openapi-import-cancel')).toBeVisible();
|
||||
await expect.poll(() => releases.length).toBeGreaterThan(0);
|
||||
}
|
||||
@@ -402,14 +461,14 @@ test('OpenAPI apply preserves job authority after language or workspace changes'
|
||||
// Exercise the actual UI language switcher path: it updates storage,
|
||||
// re-renders translations and dispatches crank:langchange in one action.
|
||||
await page.evaluate(() => window.setLang('en'));
|
||||
await expect(page.locator('#openapi-import-status')).toContainText('may have completed');
|
||||
await expect(page.locator('#openapi-import-status')).toContainText('Apply result is unknown');
|
||||
await expect(page.locator('#openapi-import-retry')).toBeVisible();
|
||||
await expect(page.locator('#openapi-import-file-select')).toBeDisabled();
|
||||
releases.shift()();
|
||||
await page.locator('#openapi-import-retry').click();
|
||||
await expect.poll(() => releases.length).toBeGreaterThan(0);
|
||||
releases.shift()();
|
||||
await expect(page.locator('#openapi-import-result')).toContainText('GET /active');
|
||||
await expect(page.locator('#openapi-import-result')).toContainText('get:/active');
|
||||
expect(applyRequests[1].url).toBe(applyRequests[0].url);
|
||||
expect(applyRequests[1].body).toBe(applyRequests[0].body);
|
||||
|
||||
@@ -419,7 +478,7 @@ test('OpenAPI apply preserves job authority after language or workspace changes'
|
||||
await page.evaluate(() => {
|
||||
window.dispatchEvent(new CustomEvent('crank:workspacechange', { detail: { id: 'workspace-after-apply' } }));
|
||||
});
|
||||
await expect(page.locator('#openapi-import-status')).toContainText('may have completed');
|
||||
await expect(page.locator('#openapi-import-status')).toContainText('Apply result is unknown');
|
||||
await expect(page.locator('#openapi-import-retry')).toBeVisible();
|
||||
await expect(page.locator('#openapi-import-file-select')).toBeDisabled();
|
||||
releases.shift()();
|
||||
@@ -516,6 +575,7 @@ test('OpenAPI upload ignores a stale failure and renders only correlation identi
|
||||
await login(page);
|
||||
await dismissOnboardingIfOpen(page);
|
||||
await page.getByRole('button', { name: localized('Import OpenAPI', 'Импорт OpenAPI') }).click();
|
||||
await mockEmptyOperationsList(page);
|
||||
const sourceCanary = 'do-not-render-openapi-source-canary';
|
||||
await page.locator('#openapi-import-file').setInputFiles({
|
||||
name: 'safe.yaml',
|
||||
@@ -590,14 +650,30 @@ test('OpenAPI upload ignores a stale failure and renders only correlation identi
|
||||
});
|
||||
await page.locator('#openapi-import-retry').click();
|
||||
await expect(page.locator('#openapi-import-preview-panel')).toBeVisible();
|
||||
let createRequests = 0;
|
||||
await page.route('**/imports/openapi/*/create', async (route) => {
|
||||
createRequests += 1;
|
||||
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||
await route.fulfill({ contentType: 'application/json', body: JSON.stringify({ created: [], skipped: [], findings: [] }) });
|
||||
await page.route('**/imports/openapi/*/plans', async (route) => {
|
||||
await route.fulfill({
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify(planResponse(route.request().postDataJSON(), 'plan_ui_evidence')),
|
||||
});
|
||||
});
|
||||
let applyRequests = 0;
|
||||
let releaseApply;
|
||||
const applyResponseHeld = new Promise((resolve) => { releaseApply = resolve; });
|
||||
await page.route('**/imports/openapi/*/apply', async (route) => {
|
||||
applyRequests += 1;
|
||||
await applyResponseHeld;
|
||||
await route.fulfill({
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify(applyResponse({ outcomes: [{ key: 'get:/health', name: 'health', status: 'created' }] })),
|
||||
});
|
||||
});
|
||||
await page.locator('#openapi-import-create').click();
|
||||
await page.locator('#openapi-import-create').evaluate((button) => button.click());
|
||||
await expect(page.locator('#openapi-import-status')).toContainText('Created: 0; skipped: 0.');
|
||||
expect(createRequests).toBe(1);
|
||||
await expect(page.locator('[data-testid="openapi-import-apply-confirmation"]')).toBeVisible();
|
||||
const applyButton = page.locator('#openapi-import-plan-apply');
|
||||
await applyButton.dblclick();
|
||||
await expect.poll(() => applyRequests).toBe(1);
|
||||
await expect(applyButton).toBeDisabled();
|
||||
releaseApply();
|
||||
await expect(page.locator('#openapi-import-status')).toContainText('Import plan applied.');
|
||||
expect(applyRequests).toBe(1);
|
||||
});
|
||||
@@ -193,7 +193,7 @@ test('wizard builds visual request mappings from JSON sample and path params', a
|
||||
|
||||
await page.goto('/wizard/');
|
||||
await page.locator('[data-testid="wizard-protocol-rest"]').click();
|
||||
await page.evaluate(() => window.CrankWizardShell.goToStep(2));
|
||||
await page.locator('#btn-continue').click();
|
||||
await expect(page.locator('#step-panel-2')).toBeVisible();
|
||||
await page.locator('#endpoint-path').fill('/rates/{date}');
|
||||
await page.evaluate(() => window.CrankWizardShell.goToStep(3));
|
||||
|
||||
Reference in new issue
Block a user