cURL analyzer and YAML generator
+Check whether the environment and endpoint already exist in the loaded suite, then generate the YAML you still need.
+Paste cURL command
+Paste the request first. The main action below will analyze it and use the optional response body for assertion-driven endpoint YAML.
+No response body parsed yet.
- +Paste response body
+Optional. Paste a JSON response body and the app will parse it automatically when you leave the field or run the generator.
+No response body parsed yet.
+Assertion builder
-Once the response JSON has been parsed, pick a field, choose how it should be asserted, then run the generator below to append those assertions into the endpoint YAML preview.
-Assertion builder
+Choose a response field, define the rule, and then generate the endpoint YAML preview with those assertions included.
+No assertion rules added yet.
+No assertion rules added yet.
-${escapeHtml(title)}
${escapeHtml(summary)}
`; - return card; + const card = document.createElement("details"); + card.className = "preview-card collapsible-preview-card"; + card.open = true; + + const header = document.createElement("summary"); + header.className = "preview-card-summary"; + header.innerHTML = `${escapeHtml(title)}
${escapeHtml(summary)}
`; + + const body = document.createElement("div"); + body.className = "preview-card-body"; + + card.appendChild(header); + card.appendChild(body); + + return { card, body }; } function createBadgeRow(isPassing, text) { @@ -579,20 +590,20 @@ function renderVariablesCard(variables) { ? "Suggested variables detected from the cURL request. They are already included in the generated environment YAML below." : "Suggested variables detected from the cURL request. Paste this block into an existing environment YAML file."; - const card = createCard("Variable suggestions", summary); - card.appendChild(createBadgeRow(true, `${variables.variableNames.length} variables suggested`)); + const { card, body } = createCard("Variable suggestions", summary); + body.appendChild(createBadgeRow(true, `${variables.variableNames.length} variables suggested`)); const details = document.createElement("dl"); details.className = "detail-list"; details.appendChild(createDetail("Variable names", variables.variableNames.join(", "))); - card.appendChild(details); + body.appendChild(details); if (variables.suggestedYaml) { - card.appendChild(createCopyAction(variables.suggestedYaml, "Copy variables YAML")); + body.appendChild(createCopyAction(variables.suggestedYaml, "Copy variables YAML")); const preview = document.createElement("pre"); preview.className = "code-block"; preview.textContent = variables.suggestedYaml; - card.appendChild(preview); + body.appendChild(preview); } return card; @@ -606,7 +617,9 @@ function renderResponseStatus(message, isError) { function setBusy(isBusy) { analyzeButton.disabled = isBusy; addAssertionButton.disabled = isBusy || parsedResponseFields.length === 0; - analyzeButton.textContent = isBusy ? "Analyzing..." : "Analyze and Generate"; + analyzeButton.innerHTML = isBusy + ? "Analyzing..." + : "Analyze and Generate"; } async function buildErrorMessage(response, fallbackMessage) { diff --git a/src/ApiTestRunner.App/wwwroot/index.html b/src/ApiTestRunner.App/wwwroot/index.html index 9225c92..4c34dc5 100644 --- a/src/ApiTestRunner.App/wwwroot/index.html +++ b/src/ApiTestRunner.App/wwwroot/index.html @@ -4,91 +4,200 @@Embedded dashboard
-YAML-driven API test runner
-Runs the configured suite, evaluates JSON assertions, and keeps the latest pass/fail snapshot local.
- -Test selection
-Loading test manifest...
+