From 0167e9eafaec1a5f4ceebc34eacd41bfcef3fd6f Mon Sep 17 00:00:00 2001 From: Erik Booij Date: Fri, 20 Jun 2025 13:18:23 +0200 Subject: [PATCH] Add toggle to run test without downloading embedded resources --- .../console/src/Components/Create/Create.js | 37 ++++++++++++++----- .../src/Components/Create/Create.spec.js | 1 + .../src/Components/Details/DetailsTable.js | 5 +++ 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/source/console/src/Components/Create/Create.js b/source/console/src/Components/Create/Create.js index 5f03df0..f4712dc 100644 --- a/source/console/src/Components/Create/Create.js +++ b/source/console/src/Components/Create/Create.js @@ -228,6 +228,7 @@ class Create extends React.Component { endpoint, method, onSchedule, + retrieveEmbeddedResources, } = this.state.formValues; if (!this.form.current.reportValidity()) { @@ -261,7 +262,17 @@ class Create extends React.Component { console.log("Payload", payload); if (!!parseInt(onSchedule)) payload = this.onSchedulePayloadUpdate(payload); - await this.setPayloadTestScenario({ testType, testName, endpoint, method, headers, body, payload, testId }); + await this.setPayloadTestScenario({ + testType, + testName, + endpoint, + method, + headers, + body, + payload, + retrieveEmbeddedResources, + testId, + }); this.alertsForBadCronInputs(); this.setState({ isLoading: true }); @@ -284,7 +295,7 @@ class Create extends React.Component { }; async setPayloadTestScenario(props) { - let { testType, testName, endpoint, method, headers, body, payload, testId } = props; + let { testType, testName, endpoint, method, headers, body, payload, retrieveEmbeddedResources, testId } = props; if (testType === "simple") { headers = headers || "{}"; body = body || "{}"; @@ -297,6 +308,7 @@ class Create extends React.Component { } payload.testScenario.scenarios[testName] = { + "retrieve-resources": retrieveEmbeddedResources ?? true, requests: [ { url: endpoint, @@ -361,7 +373,9 @@ class Create extends React.Component { handleInputChange(event) { this.setState({ submitFailure: false }); - const value = event.target.name === "showLive" ? event.target.checked : event.target.value; + const value = ["showLive", "retrieveEmbeddedResources"].includes(event.target.name) + ? event.target.checked + : event.target.value; const name = event.target.name; const id = event.target.id; @@ -1331,13 +1345,6 @@ class Create extends React.Component { {this.state.activeTab === "3" && this.schedulingErrors()} - diff --git a/source/console/src/Components/Create/Create.spec.js b/source/console/src/Components/Create/Create.spec.js index 6a13aa8..80878cd 100644 --- a/source/console/src/Components/Create/Create.spec.js +++ b/source/console/src/Components/Create/Create.spec.js @@ -101,6 +101,7 @@ describe("Functions Testing", () => { testScenario: { scenarios: { testName: { + "retrieve-resources": true, requests: [ { url: "endpoint", diff --git a/source/console/src/Components/Details/DetailsTable.js b/source/console/src/Components/Details/DetailsTable.js index 46f353a..0180c5e 100644 --- a/source/console/src/Components/Details/DetailsTable.js +++ b/source/console/src/Components/Details/DetailsTable.js @@ -64,6 +64,11 @@ class DetailsTable extends React.Component { {data.endpoint} +
+ {Object.values(data.testScenario.scenarios)[0]["retrieve-resources"] === false + ? "Without retrieving embedded resources" + : "Including embedded resources"} +