@@ -738,6 +738,16 @@ function handleSelectChange() {
738738 }
739739}
740740
741+ const filepathChange = () => {
742+ const items = testCaseWithSuite .value .data .request .filepath .split (" =" )
743+ if (items && items .length > 1 ) {
744+ testCaseWithSuite .value .data .request .form = [{
745+ key: items [0 ],
746+ value: items [1 ]
747+ } as Pair ]
748+ }
749+ }
750+
741751const bodyType = ref (1 )
742752function bodyTypeChange(e : number ) {
743753 let contentType = " "
@@ -750,14 +760,7 @@ function bodyTypeChange(e: number) {
750760 break ;
751761 case 6 :
752762 contentType = ' multipart/form-data'
753-
754- const items = testCaseWithSuite .value .data .request .filepath .split (" =" )
755- if (items && items .length > 1 ) {
756- testCaseWithSuite .value .data .request .form = [{
757- key: items [0 ],
758- value: items [1 ]
759- } as Pair ]
760- }
763+ filepathChange ()
761764 break ;
762765 case 7 :
763766 // 获取localStorage中的数据
@@ -898,44 +901,53 @@ Magic.Keys(() => {
898901 <el-button type =" primary" v-if =" !isHistoryTestCase && Cache.GetCurrentStore().kind.name == 'atest-store-orm'" @click =" openHistoryDialog" >{{ t('button.viewHistory') }}</el-button >
899902 <span v-if =" isHistoryTestCase" style =" margin-left : 15px ;" >{{ t('tip.runningAt') }}{{ HistoryTestCaseCreateTime }}</span >
900903 </div >
901- <div style =" display : flex ;" >
902- <el-select
903- v-if =" props.kindName !== 'tRPC' && props.kindName !== 'gRPC'"
904- v-model =" testCaseWithSuite.data.request.method"
905- class =" m-2"
906- placeholder =" Method"
907- size =" default"
908- test-id =" case-editor-method"
909- :disabled =" isHistoryTestCase"
910- >
911- <el-option
912- v-for =" item in options"
913- :key =" item.value"
914- :label =" item.key"
915- :value =" item.value"
916- />
917- </el-select >
918- <el-autocomplete
919- v-model =" testCaseWithSuite.data.request.api"
920- :fetch-suggestions =" querySuggestedAPIs"
921- placeholder =" API Address"
922- style =" width : 50% ; margin-left : 5px ; margin-right : 5px ; flex-grow : 1 ;"
923- :readonly =" isHistoryTestCase"
924- >
925- <template #default =" { item } " >
926- <div class =" value" >{{ item.request.method }}</div >
927- <span class =" link" >{{ item.request.api }}</span >
928- </template >
929- </el-autocomplete >
930-
931- <el-dropdown split-button type =" primary" @click =" sendRequest" v-loading =" requestLoading" v-if =" !isHistoryTestCase" >
932- {{ t('button.send') }}
933- <template #dropdown >
934- <el-dropdown-menu >
935- <el-dropdown-item @click =" openParameterDialog" >{{ t('button.sendWithParam') }}</el-dropdown-item >
936- </el-dropdown-menu >
937- </template >
938- </el-dropdown >
904+ <div >
905+ <el-row >
906+ <el-col :span =" 3" >
907+ <el-select
908+ v-if =" props.kindName !== 'tRPC' && props.kindName !== 'gRPC'"
909+ v-model =" testCaseWithSuite.data.request.method"
910+ class =" m-2"
911+ placeholder =" Method"
912+ size =" default"
913+ test-id =" case-editor-method"
914+ :disabled =" isHistoryTestCase"
915+ >
916+ <el-option
917+ v-for =" item in options"
918+ :key =" item.value"
919+ :label =" item.key"
920+ :value =" item.value"
921+ />
922+ </el-select >
923+ </el-col >
924+ <el-col :span =" 18" >
925+ <el-autocomplete
926+ v-model =" testCaseWithSuite.data.request.api"
927+ style =" width : 100% "
928+ :fetch-suggestions =" querySuggestedAPIs"
929+ placeholder =" API Address"
930+ :readonly =" isHistoryTestCase" >
931+ <template #default =" { item } " >
932+ <div class =" value" >{{ item.request.method }}</div >
933+ <span class =" link" >{{ item.request.api }}</span >
934+ </template >
935+ </el-autocomplete >
936+ </el-col >
937+ <el-col :span =" 3" >
938+ <el-dropdown split-button type =" primary"
939+ @click =" sendRequest"
940+ v-loading =" requestLoading"
941+ v-if =" !isHistoryTestCase" >
942+ {{ t('button.send') }}
943+ <template #dropdown >
944+ <el-dropdown-menu >
945+ <el-dropdown-item @click =" openParameterDialog" >{{ t('button.sendWithParam') }}</el-dropdown-item >
946+ </el-dropdown-menu >
947+ </template >
948+ </el-dropdown >
949+ </el-col >
950+ </el-row >
939951 </div >
940952 </el-header >
941953
@@ -1058,7 +1070,12 @@ Magic.Keys(() => {
10581070 />
10591071 </el-select >
10601072 <div v-if =" bodyType === 6" >
1061- Filename: <el-input v-model =" testCaseWithSuite.data.request.filepath" placeholder =" file=sample.txt" />
1073+ <el-row >
1074+ <el-col :span =" 4" >Filename:</el-col >
1075+ <el-col :span =" 20" >
1076+ <el-input v-model =" testCaseWithSuite.data.request.filepath" placeholder =" file=sample.txt" @change =" filepathChange" />
1077+ </el-col >
1078+ </el-row >
10621079 </div >
10631080 <Codemirror v-if =" bodyType === 3 || bodyType === 5 || bodyType === 6"
10641081 @blur =" jsonFormat(-1)"
@@ -1085,27 +1102,34 @@ Magic.Keys(() => {
10851102 </el-tab-pane >
10861103
10871104 <el-tab-pane label =" Expected" name =" expected" v-if =" props.kindName !== 'tRPC' && props.kindName !== 'gRPC'" >
1088- <el-row :gutter =" 20" >
1089- <span
1090- class =" ml-3 w-50 text-gray-600 inline-flex items-center"
1091- style =" margin-left : 15px ; margin-right : 15px "
1092- >Status Code:</span
1093- >
1094- <el-input
1095- v-model =" testCaseWithSuite.data.response.statusCode"
1096- class =" w-50 m-2"
1097- placeholder =" Please input"
1098- style =" width : 200px "
1099- :readonly =" isHistoryTestCase"
1100- />
1105+ <el-row >
1106+ <el-col :span =" 4" >
1107+ Status Code:
1108+ </el-col >
1109+ <el-col :span =" 20" >
1110+ <el-input
1111+ v-model =" testCaseWithSuite.data.response.statusCode"
1112+ class =" w-50 m-2"
1113+ placeholder =" Please input"
1114+ :readonly =" isHistoryTestCase" >
1115+ <template #append >
1116+ {{ t('httpCode.' + testCaseWithSuite.data.response.statusCode) }}
1117+ </template >
1118+ </el-input >
1119+ </el-col >
1120+ </el-row >
1121+ <el-row >
1122+ <el-col :span =" 4" >Body:</el-col >
1123+ <el-col :span =" 20" >
1124+ <el-input
1125+ v-model =" testCaseWithSuite.data.response.body"
1126+ :autosize =" { minRows: 4, maxRows: 8 }"
1127+ type =" textarea"
1128+ placeholder =" Expected Body"
1129+ :readonly =" isHistoryTestCase"
1130+ />
1131+ </el-col >
11011132 </el-row >
1102- <el-input
1103- v-model =" testCaseWithSuite.data.response.body"
1104- :autosize =" { minRows: 4, maxRows: 8 }"
1105- type =" textarea"
1106- placeholder =" Expected Body"
1107- :readonly =" isHistoryTestCase"
1108- />
11091133 </el-tab-pane >
11101134
11111135 <el-tab-pane label =" Expected Headers" name =" expected-headers" v-if =" props.kindName !== 'tRPC' && props.kindName !== 'gRPC'" >
0 commit comments