11<script setup lang="ts">
22import { ref , watch , reactive } from ' vue'
33import { ElMessage } from ' element-plus'
4- import { Edit , Delete , Search , CopyDocument } from ' @element-plus/icons-vue'
4+ import { Edit , Delete , Search , CopyDocument , Help } from ' @element-plus/icons-vue'
55import JsonViewer from ' vue-json-viewer'
66import type { Pair , TestResult , TestCaseWithSuite , TestCase } from ' ./types'
77import { NewSuggestedAPIsQuery , CreateFilter , GetHTTPMethods , FlattenObject } from ' ./types'
8+ import Button from ' ../components/Button.vue'
89import { Cache } from ' ./cache'
910import { API } from ' ./net'
1011import EditButton from ' ../components/EditButton.vue'
@@ -125,6 +126,7 @@ const handleTestResult = (e: any) => {
125126 testResult .value .bodyLength = e .body .length
126127 testResult .value .bodyObject = JSON .parse (e .body );
127128 testResult .value .originBodyObject = JSON .parse (e .body );
129+ responseBodyFilter ()
128130 }
129131
130132 Cache .SetTestCaseResponseCache (suite + ' -' + name , {
@@ -162,7 +164,7 @@ function responseBodyFilter() {
162164 json: testResult .value .originBodyObject ,
163165 resultType: ' value'
164166 })
165- testResult .value .bodyObject = query [ 0 ]
167+ testResult .value .bodyObject = query
166168 }
167169}
168170
@@ -905,16 +907,16 @@ const renameTestCase = (name: string) => {
905907 <el-container style =" height : 100% ;" >
906908 <el-header style =" padding-left : 5px ;" >
907909 <div style =" margin-bottom : 5px " >
908- <el-button type =" primary" @click =" saveTestCase" :icon =" Edit" v-loading =" saveLoading"
910+ <Button type =" primary" @click =" saveTestCase" :icon =" Edit" v-loading =" saveLoading"
909911 disabled v-if =" Cache.GetCurrentStore().readOnly || isHistoryTestCase"
910- >{{ t('button.save') }}</el-button >
911- <el-button type =" primary" @click =" saveTestCase" :icon =" Edit" v-loading =" saveLoading"
912+ >{{ t('button.save') }}</Button >
913+ <Button type =" primary" @click =" saveTestCase" :icon =" Edit" v-loading =" saveLoading"
912914 v-if =" !Cache.GetCurrentStore().readOnly && !isHistoryTestCase"
913- >{{ t('button.save') }}</el-button >
914- <el-button type =" danger" @click =" deleteCase" :icon =" Delete" >{{ t('button.delete') }}</el-button >
915- <el-button type =" primary" @click =" openDuplicateTestCaseDialog" :icon =" CopyDocument" v-if =" !isHistoryTestCase" >{{ t('button.duplicate') }}</el-button >
916- <el-button type =" primary" @click =" openCodeDialog" >{{ t('button.generateCode') }}</el-button >
917- <el-button type =" primary" v-if =" !isHistoryTestCase && Cache.GetCurrentStore().kind.name == 'atest-store-orm'" @click =" openHistoryDialog" >{{ t('button.viewHistory') }}</el-button >
915+ >{{ t('button.save') }}</Button >
916+ <Button type =" danger" @click =" deleteCase" :icon =" Delete" >{{ t('button.delete') }}</Button >
917+ <Button type =" primary" @click =" openDuplicateTestCaseDialog" :icon =" CopyDocument" v-if =" !isHistoryTestCase" >{{ t('button.duplicate') }}</Button >
918+ <Button type =" primary" @click =" openCodeDialog" >{{ t('button.generateCode') }}</Button >
919+ <Button type =" primary" v-if =" !isHistoryTestCase && Cache.GetCurrentStore().kind.name == 'atest-store-orm'" @click =" openHistoryDialog" >{{ t('button.viewHistory') }}</Button >
918920 <span v-if =" isHistoryTestCase" style =" margin-left : 15px ;" >{{ t('tip.runningAt') }}{{ HistoryTestCaseCreateTime }}</span >
919921 <EditButton :value =" props.name" @changed =" renameTestCase" />
920922 </div >
@@ -1060,8 +1062,8 @@ const renameTestCase = (name: string) => {
10601062
10611063 <el-tab-pane name =" body" >
10621064 <span style =" margin-right : 10px ; padding-right : 5px ;" >
1063- <el-button type =" primary" @click =" jsonFormat(4)" >Beautify</el-button >
1064- <el-button type =" primary" @click =" jsonFormat(0)" >Minify</el-button >
1065+ <Button type =" primary" @click =" jsonFormat(4)" >Beautify</Button >
1066+ <Button type =" primary" @click =" jsonFormat(0)" >Minify</Button >
10651067 <el-text class =" mx-1" >Choose the body format</el-text >
10661068 </span >
10671069 <template #label >
@@ -1221,8 +1223,8 @@ const renameTestCase = (name: string) => {
12211223 :value =" item.key"
12221224 />
12231225 </el-select >
1224- <el-button type =" primary" @click =" generateCode" >{{ t('button.refresh') }}</el-button >
1225- <el-button type =" primary" @click =" copyCode" >{{ t('button.copy') }}</el-button >
1226+ <Button type =" primary" @click =" generateCode" >{{ t('button.refresh') }}</Button >
1227+ <Button type =" primary" @click =" copyCode" >{{ t('button.copy') }}</Button >
12261228 </div >
12271229 <Codemirror v-model =" currentCodeContent" />
12281230 </template >
@@ -1257,24 +1259,24 @@ const renameTestCase = (name: string) => {
12571259 </el-col >
12581260 <el-col :span =" 4" >
12591261 <div style =" display : flex ;flex-wrap : nowrap ;justify-content : flex-end ;" >
1260- <el-button
1262+ <Button
12611263 type =" primary"
12621264 @click =" submitForm(viewHistoryRef)"
12631265 :loading =" caseRevertLoading"
12641266 >{{ t('button.revert') }}
1265- </el-button >
1266- <el-button
1267+ </Button >
1268+ <Button
12671269 type =" primary"
12681270 @click =" goToHistory(viewHistoryRef)"
12691271 :loading =" caseRevertLoading"
12701272 >{{ t('button.goToHistory') }}
1271- </el-button >
1272- <el-button
1273+ </Button >
1274+ <Button
12731275 type =" primary"
12741276 @click =" deleteAllHistory(viewHistoryRef)"
12751277 :loading =" caseRevertLoading"
12761278 >{{ t('button.deleteAllHistory') }}
1277- </el-button >
1279+ </Button >
12781280 </div >
12791281 </el-col >
12801282 </el-row >
@@ -1322,7 +1324,7 @@ const renameTestCase = (name: string) => {
13221324 </el-table-column >
13231325 </el-table >
13241326
1325- <el-button type =" primary" @click =" sendRequestWithParameter" >{{ t('button.send') }}</el-button >
1327+ <Button type =" primary" @click =" sendRequestWithParameter" >{{ t('button.send') }}</Button >
13261328 </template >
13271329 </el-drawer >
13281330 </el-main >
@@ -1341,8 +1343,11 @@ const renameTestCase = (name: string) => {
13411343 <el-tab-pane label =" Body" name =" body" >
13421344 <div v-if =" testResult.bodyObject" >
13431345 <el-input :prefix-icon =" Search" @change =" responseBodyFilter" v-model =" responseBodyFilterText"
1344- clearable placeholder =" $.key " >
1346+ clearable placeholder =" $.data[?(@.status==='SUCCEED')] " >
13451347 <template #prepend v-if =" testResult .bodyLength > 0 " >Body Size: {{testResult.bodyLength}}</template >
1348+ <template #suffix >
1349+ <a href =" https://www.npmjs.com/package/jsonpath-plus" target =" _blank" ><el-icon ><Help /></el-icon ></a >
1350+ </template >
13461351 </el-input >
13471352 <JsonViewer :value =" testResult.bodyObject" :expand-depth =" 5" copyable boxed sort />
13481353 </div >
@@ -1354,7 +1359,7 @@ const renameTestCase = (name: string) => {
13541359 <div >Response body is too large, please download to view.</div >
13551360 </el-col >
13561361 <el-col :span =" 2" >
1357- <el-button type =" primary" @click =" downloadResponseFile" >Download</el-button >
1362+ <Button type =" primary" @click =" downloadResponseFile" >Download</Button >
13581363 </el-col >
13591364 </el-row >
13601365 </div >
@@ -1389,7 +1394,7 @@ const renameTestCase = (name: string) => {
13891394 New Test Case Name:<el-input v-model =" targetTestCaseName" />
13901395 </template >
13911396 <template #footer >
1392- <el-button type =" primary" @click =" duplicateTestCase" >{{ t('button.ok') }}</el-button >
1397+ <Button type =" primary" @click =" duplicateTestCase" >{{ t('button.ok') }}</Button >
13931398 </template >
13941399 </el-drawer >
13951400</template >
0 commit comments