Skip to content

Commit 60544d0

Browse files
committed
fix: fix the remaining problem
1 parent 272baee commit 60544d0

File tree

5 files changed

+14
-42
lines changed

5 files changed

+14
-42
lines changed

console/atest-ui/src/views/TestCase.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,7 @@ Magic.Keys(() => {
835835
placeholder="Method"
836836
size="default"
837837
test-id="case-editor-method"
838+
:disabled="isHistoryTestCase"
838839
>
839840
<el-option
840841
v-for="item in options"
@@ -1106,7 +1107,7 @@ Magic.Keys(() => {
11061107
</template>
11071108
</el-drawer>
11081109

1109-
<el-dialog v-model="historyDialogOpened" :title="t('button.viewHistory')" width="50%" draggable>
1110+
<el-dialog v-model="historyDialogOpened" :title="t('button.viewHistory')" width="60%" draggable>
11101111
<el-form
11111112
ref="viewHistoryRef"
11121113
:model="historyForm"
@@ -1134,7 +1135,7 @@ Magic.Keys(() => {
11341135
</el-select>
11351136
</el-col>
11361137
<el-col :span="4">
1137-
<div style="display: flex">
1138+
<div style="display: flex;flex-wrap: nowrap;justify-content: flex-end;">
11381139
<el-button
11391140
type="primary"
11401141
@click="submitForm(viewHistoryRef)"

pkg/server/convert.go

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -239,45 +239,15 @@ func ToNormalTestCaseResult(testCaseResult *TestCaseResult) (result testing.Test
239239
}
240240

241241
func ToGRPCHistoryTestCaseResult(historyTestResult testing.HistoryTestResult) (result *HistoryTestResult) {
242-
res := historyTestResult.Data.Data.Request
243-
resp := historyTestResult.Data.Data.Expect
244-
242+
convertedHistoryTestCase := ConvertToGRPCHistoryTestCase(historyTestResult.Data)
243+
245244
result = &HistoryTestResult{
246245
Message: historyTestResult.Message,
247246
Error: historyTestResult.Error,
248247
CreateTime: timestamppb.New(historyTestResult.CreateTime),
249-
250-
Data: &HistoryTestCase{
251-
HistorySuiteName: historyTestResult.Data.HistorySuiteName,
252-
CaseName: historyTestResult.Data.CaseName,
253-
CreateTime: timestamppb.New(historyTestResult.CreateTime),
254-
SuiteName: historyTestResult.Data.SuiteName,
255-
SuiteApi: historyTestResult.Data.SuiteAPI,
256-
SuiteParam: mapToPair(historyTestResult.Data.SuiteParam),
257-
258-
Request: &Request{
259-
Api: res.API,
260-
Method: res.Method,
261-
Body: res.Body.String(),
262-
Header: mapToPair(res.Header),
263-
Cookie: mapToPair(res.Cookie),
264-
Query: mapInterToPair(res.Query),
265-
Form: mapToPair(res.Form),
266-
},
267-
268-
Response: &Response{
269-
StatusCode: int32(resp.StatusCode),
270-
Body: resp.Body,
271-
Schema: resp.Schema,
272-
Verify: resp.Verify,
273-
BodyFieldsExpect: mapInterToPair(resp.BodyFieldsExpect),
274-
Header: mapToPair(resp.Header),
275-
},
276-
},
248+
Data: convertedHistoryTestCase,
277249
}
278250

279-
result.Data.SuiteSpec = ToGRPCTestSuiteSpec(historyTestResult.Data.SuiteSpec)
280-
281251
for _, testCaseResult := range historyTestResult.TestCaseResult {
282252
result.TestCaseResult = append(result.TestCaseResult, &TestCaseResult{
283253
StatusCode: int32(testCaseResult.StatusCode),
@@ -288,7 +258,8 @@ func ToGRPCHistoryTestCaseResult(historyTestResult testing.HistoryTestResult) (r
288258
Id: testCaseResult.Id,
289259
})
290260
}
291-
return
261+
262+
return result
292263
}
293264

294265
func ToGRPCTestSuiteSpec(spec testing.APISpec) (result *APISpec) {

pkg/testing/case.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ type HistoryTestCase struct {
5050
CaseName string `yaml:"caseName,omitempty" json:"name,omitempty"`
5151
SuiteName string `yaml:"suiteName,omitempty" json:"suiteName,omitempty"`
5252
HistorySuiteName string `yaml:"historySuiteName,omitempty" json:"historySuiteName,omitempty"`
53-
CreateTime time.Time `yaml:"createTime,omitempty" json:"createTime,omitempty"`
53+
CreateTime time.Time `yaml:"createTime,omitempty" json:"createTime,omitempty"`
5454
SuiteAPI string `yaml:"api,omitempty" json:"api,omitempty"`
5555
SuiteSpec APISpec `yaml:"spec,omitempty" json:"spec,omitempty"`
5656
SuiteParam map[string]string `yaml:"param,omitempty" json:"param,omitempty"`
@@ -62,7 +62,7 @@ type HistoryTestResult struct {
6262
Error string `yaml:"error,omitempty" json:"error,omitempty"`
6363
TestCaseResult []TestCaseResult `yaml:"testCaseResult,omitempty" json:"testCaseResult,omitempty"`
6464
Data HistoryTestCase `yaml:"data,omitempty" json:"data,omitempty"`
65-
CreateTime time.Time `yaml:"createTime,omitempty" json:"createTime,omitempty"`
65+
CreateTime time.Time `yaml:"createTime,omitempty" json:"createTime,omitempty"`
6666
}
6767

6868
type RPCDesc struct {

pkg/testing/remote/converter.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ func pairToInterMap(pairs []*server.Pair) (data map[string]interface{}) {
300300
return
301301
}
302302

303-
func ConvertToGRPCTestCaseResult(testCaseResult testing.TestCaseResult, testSuite *testing.TestSuite) (result *server.HistoryTestResult) {
303+
func ConvertToGRPCHistoryTestCaseResult(testCaseResult testing.TestCaseResult, testSuite *testing.TestSuite) (result *server.HistoryTestResult) {
304304
result = &server.HistoryTestResult{
305305
Error: testCaseResult.Error,
306306
CreateTime: timestamppb.New(time.Now()),
@@ -340,15 +340,15 @@ func ConvertToNormalTestCaseResult(testResult *server.HistoryTestResult) (result
340340
}
341341

342342
for _, testCaseResult := range testResult.TestCaseResult {
343-
testCaseResult := testing.TestCaseResult{
343+
testcaseResult := testing.TestCaseResult{
344344
StatusCode: int(testCaseResult.StatusCode),
345345
Body: testCaseResult.Body,
346346
Header: pairToMap(testCaseResult.Header),
347347
Error: testCaseResult.Error,
348348
Id: testCaseResult.Id,
349349
Output: testCaseResult.Output,
350350
}
351-
result.TestCaseResult = append(result.TestCaseResult, testCaseResult)
351+
result.TestCaseResult = append(result.TestCaseResult, testcaseResult)
352352
}
353353
result.Data = ConvertToNormalHistoryTestCase(testResult.Data)
354354

pkg/testing/remote/grpc_store.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func (g *gRPCLoader) DeleteTestCase(suite, testcase string) (err error) {
164164
}
165165

166166
func (g *gRPCLoader) CreateHistoryTestCase(testcaseResult testing.TestCaseResult, testSuite *testing.TestSuite) (err error) {
167-
payload := ConvertToGRPCTestCaseResult(testcaseResult, testSuite)
167+
payload := ConvertToGRPCHistoryTestCaseResult(testcaseResult, testSuite)
168168
_, err = g.client.CreateTestCaseHistory(g.ctx, payload)
169169
return
170170
}

0 commit comments

Comments
 (0)