diff --git a/packages/hoppscotch-common/locales/en.json b/packages/hoppscotch-common/locales/en.json index 3a38f57eb..1b6383642 100644 --- a/packages/hoppscotch-common/locales/en.json +++ b/packages/hoppscotch-common/locales/en.json @@ -1215,6 +1215,7 @@ "include_active_environment": "Include active environment:", "cli": "CLI", "delay": "Delay", + "negative_delay": "Delay cannot be negative", "ui": "Runner", "running_collection": "Running collection", "run_config": "Run Configuration", @@ -1228,7 +1229,9 @@ "cli_command_generation_description_cloud": "Copy the below command and run it from the CLI. Please specify a personal access token.", "cli_command_generation_description_sh": "Copy the below command and run it from the CLI. Please specify a personal access token and verify the generated SH instance server URL.", "cli_command_generation_description_sh_with_server_url_placeholder": "Copy the below command and run it from the CLI. Please specify a personal access token and the SH instance server URL.", - "run_collection": "Run collection" + "run_collection": "Run collection", + "no_passed_tests": "No tests passed", + "no_failed_tests": "No tests failed" }, "ai_experiments": { "generate_request_name": "Generate Request Name Using AI", diff --git a/packages/hoppscotch-common/src/components.d.ts b/packages/hoppscotch-common/src/components.d.ts index 8f59d99ce..2b1ed9970 100644 --- a/packages/hoppscotch-common/src/components.d.ts +++ b/packages/hoppscotch-common/src/components.d.ts @@ -150,6 +150,7 @@ declare module 'vue' { HttpAuthorizationNTLM: typeof import('./components/http/authorization/NTLM.vue')['default'] HttpAuthorizationOAuth2: typeof import('./components/http/authorization/OAuth2.vue')['default'] HttpBody: typeof import('./components/http/Body.vue')['default'] + HttpBodyBinary: typeof import('./components/http/BodyBinary.vue')['default'] HttpBodyParameters: typeof import('./components/http/BodyParameters.vue')['default'] HttpCodegen: typeof import('./components/http/Codegen.vue')['default'] HttpCodegenModal: typeof import('./components/http/CodegenModal.vue')['default'] @@ -225,6 +226,7 @@ declare module 'vue' { ImportExportImportExportSourcesList: typeof import('./components/importExport/ImportExportSourcesList.vue')['default'] ImportExportImportExportStepsAllCollectionImport: typeof import('./components/importExport/ImportExportSteps/AllCollectionImport.vue')['default'] ImportExportImportExportStepsFileImport: typeof import('./components/importExport/ImportExportSteps/FileImport.vue')['default'] + ImportExportImportExportStepsImportSummary: typeof import('./components/importExport/ImportExportSteps/ImportSummary.vue')['default'] ImportExportImportExportStepsMyCollectionImport: typeof import('./components/importExport/ImportExportSteps/MyCollectionImport.vue')['default'] ImportExportImportExportStepsUrlImport: typeof import('./components/importExport/ImportExportSteps/UrlImport.vue')['default'] InterceptorsAgentModalNativeCACertificates: typeof import('./components/interceptors/agent/ModalNativeCACertificates.vue')['default'] diff --git a/packages/hoppscotch-common/src/components/http/test/ResultRequest.vue b/packages/hoppscotch-common/src/components/http/test/ResultRequest.vue index 7c8573611..e09bd278e 100644 --- a/packages/hoppscotch-common/src/components/http/test/ResultRequest.vue +++ b/packages/hoppscotch-common/src/components/http/test/ResultRequest.vue @@ -4,7 +4,7 @@ class="w-full rounded px-4 py-3 transition cursor-pointer focus:outline-none hover:active hover:bg-primaryLight hover:text-secondaryDark" @click="selectRequest()" > -
+
{{ `${request.response?.statusCode}` }} diff --git a/packages/hoppscotch-common/src/components/http/test/Runner.vue b/packages/hoppscotch-common/src/components/http/test/Runner.vue index 1499ca3da..0960e08c5 100644 --- a/packages/hoppscotch-common/src/components/http/test/Runner.vue +++ b/packages/hoppscotch-common/src/components/http/test/Runner.vue @@ -31,13 +31,11 @@ @@ -127,7 +126,8 @@ import { useVModel } from "@vueuse/core" import { useService } from "dioc/vue" import { pipe } from "fp-ts/lib/function" import * as TE from "fp-ts/TaskEither" -import { computed, nextTick, onMounted, ref } from "vue" +import { computed, nextTick, onMounted, ref, watch } from "vue" +import { useReadonlyStream } from "~/composables/stream" import { useColorMode } from "~/composables/theming" import { useToast } from "~/composables/toast" import { GQLError } from "~/helpers/backend/GQLClient" @@ -141,7 +141,12 @@ import { TestRunnerCollectionsAdapter, } from "~/helpers/runner/adapter" import { getErrorMessage } from "~/helpers/runner/collection-tree" -import { getRESTCollectionByRefId } from "~/newstore/collections" +import TeamCollectionAdapter from "~/helpers/teams/TeamCollectionAdapter" +import { + getRESTCollectionByRefId, + getRESTCollectionInheritedProps, + restCollectionStore, +} from "~/newstore/collections" import { HoppTab } from "~/services/tab" import { RESTTabService } from "~/services/tab/rest" import { @@ -154,6 +159,12 @@ const t = useI18n() const toast = useToast() const colorMode = useColorMode() +const teamCollectionAdapter = new TeamCollectionAdapter(null) +const teamCollectionList = useReadonlyStream( + teamCollectionAdapter.collections$, + [] +) + const props = defineProps<{ modelValue: HoppTab }>() const emit = defineEmits<{ @@ -218,8 +229,33 @@ const showResult = computed(() => { }) const runTests = async () => { + const { collectionID, collectionType } = tab.value.document + + const isPersonalWorkspace = collectionType === "my-collections" + + const collections = isPersonalWorkspace + ? restCollectionStore.value.state + : teamCollectionList.value.map(teamCollToHoppRESTColl) + + const collectionInheritedProps = getRESTCollectionInheritedProps( + collectionID, + collections, + collectionType + ) + + const { auth, headers } = collectionInheritedProps ?? { + auth: { authActive: true, authType: "none" }, + headers: [], + } + + // Accommodate collection properties for personal workspace + // TODO: Resolve the collection properties computation for team workspaces + const resolvedCollection = isPersonalWorkspace + ? { ...collection.value, auth, headers } + : collection.value + testRunnerStopRef.value = false // when testRunnerStopRef is false, the test runner will start running - testRunnerService.runTests(tab, collection.value, { + testRunnerService.runTests(tab, resolvedCollection, { ...testRunnerConfig.value, stopRef: testRunnerStopRef, }) diff --git a/packages/hoppscotch-common/src/components/http/test/RunnerModal.vue b/packages/hoppscotch-common/src/components/http/test/RunnerModal.vue index a1f37a394..5e8fbb0a8 100644 --- a/packages/hoppscotch-common/src/components/http/test/RunnerModal.vue +++ b/packages/hoppscotch-common/src/components/http/test/RunnerModal.vue @@ -21,6 +21,7 @@ type="number" :label="t('collection_runner.delay')" class="!rounded-r-none !border-r-0" + :class="{ 'border-red-500': config.delay < 0 }" input-styles="floating-input !rounded-r-none !border-r-0" > +

+ {{ t("collection_runner.negative_delay") }} +

@@ -133,6 +137,7 @@ import { refAutoReset } from "@vueuse/core" -import { computed, ref } from "vue" +import { computed, onMounted, ref } from "vue" import { useI18n } from "~/composables/i18n" import { HoppCollection } from "@hoppscotch/data" @@ -203,6 +208,7 @@ export type CollectionRunnerData = const props = defineProps<{ sameTab?: boolean collectionRunnerData: CollectionRunnerData + prevConfig?: Partial }>() const emit = defineEmits<{ @@ -230,6 +236,12 @@ const config = ref({ keepVariableValues: false, }) +onMounted(() => { + if (props.prevConfig) { + config.value = { ...config.value, ...props.prevConfig } + } +}) + const runTests = async () => { const collectionTree = await getCollectionTree( props.collectionRunnerData.type, diff --git a/packages/hoppscotch-common/src/components/http/test/RunnerResult.vue b/packages/hoppscotch-common/src/components/http/test/RunnerResult.vue index 9bbc8e39e..e0415438a 100644 --- a/packages/hoppscotch-common/src/components/http/test/RunnerResult.vue +++ b/packages/hoppscotch-common/src/components/http/test/RunnerResult.vue @@ -27,7 +27,16 @@
-
+