diff --git a/frontend/src/business/components/api/test/components/ApiScenarioConfig.vue b/frontend/src/business/components/api/test/components/ApiScenarioConfig.vue index ada1e09293..749d4bfe36 100644 --- a/frontend/src/business/components/api/test/components/ApiScenarioConfig.vue +++ b/frontend/src/business/components/api/test/components/ApiScenarioConfig.vue @@ -115,6 +115,9 @@ export default { watch: { test() { this.initScenarioEnvironment(); + }, + projectId() { + this.initScenarioEnvironment(); } }, methods: { @@ -208,9 +211,13 @@ export default { let env = environmentMap.get(scenario.environmentId); if (!env) { scenario.environmentId = undefined; + scenario.environment = undefined; } else { scenario.environment = env; } + } else { + scenario.environmentId = undefined; + scenario.environment = undefined; } }); }); diff --git a/frontend/src/business/components/api/test/components/request/ApiHttpRequestForm.vue b/frontend/src/business/components/api/test/components/request/ApiHttpRequestForm.vue index 6f90c3c308..4f0c388b78 100644 --- a/frontend/src/business/components/api/test/components/request/ApiHttpRequestForm.vue +++ b/frontend/src/business/components/api/test/components/request/ApiHttpRequestForm.vue @@ -26,7 +26,7 @@ - {{ request.environment ? request.environment.name + ': ' : '' }} + {{ scenario.environment ? scenario.environment.name + ': ' : '' }} {{ displayUrl }} {{ $t('api_test.request.please_configure_socket_in_environment') }} @@ -49,7 +49,7 @@ @@ -62,7 +62,7 @@ :body="request.body" :scenario="scenario" :extract="request.extract" - :environment="request.environment"/> + :environment="scenario.environment"/> @@ -148,7 +148,7 @@ export default { if (!this.request.path) return; let url = this.getURL(this.displayUrl); let urlStr = url.origin + url.pathname; - let envUrl = this.request.environment.config.httpConfig.protocol + '://' + this.request.environment.config.httpConfig.socket; + let envUrl = this.scenario.environment.config.httpConfig.protocol + '://' + this.scenario.environment.config.httpConfig.socket; this.request.path = decodeURIComponent(urlStr.substring(envUrl.length, urlStr.length)); }, getURL(urlStr) { @@ -170,7 +170,7 @@ export default { } }, useEnvironmentChange(value) { - if (value && !this.request.environment) { + if (value && !this.scenario.environment) { this.$error(this.$t('api_test.request.please_add_environment_to_scenario'), 2000); this.request.useEnvironment = false; } @@ -191,8 +191,8 @@ export default { computed: { displayUrl() { - return (this.request.environment && this.request.environment.config.httpConfig.socket) ? - this.request.environment.config.httpConfig.protocol + '://' + this.request.environment.config.httpConfig.socket + (this.request.path ? this.request.path : '') + return (this.scenario.environment && this.scenario.environment.config.httpConfig.socket) ? + this.scenario.environment.config.httpConfig.protocol + '://' + this.scenario.environment.config.httpConfig.socket + (this.request.path ? this.request.path : '') : ''; } }