fix(接口测试): xpath断言保存不生效

This commit is contained in:
chenjianxing 2020-11-04 11:16:58 +08:00
parent aea60b4827
commit b5fe5fad10
4 changed files with 9 additions and 9 deletions

View File

@ -9,6 +9,6 @@ public class Assertions {
private List<AssertionRegex> regex; private List<AssertionRegex> regex;
private List<AssertionJsonPath> jsonPath; private List<AssertionJsonPath> jsonPath;
private List<AssertionJSR223> jsr223; private List<AssertionJSR223> jsr223;
private List<AssertionXPath2> xPath2; private List<AssertionXPath2> xpath2;
private AssertionDuration duration; private AssertionDuration duration;
} }

View File

@ -17,7 +17,7 @@
<ms-api-assertion-text :is-read-only="isReadOnly" :list="assertions.regex" v-if="type === options.TEXT" :callback="after"/> <ms-api-assertion-text :is-read-only="isReadOnly" :list="assertions.regex" v-if="type === options.TEXT" :callback="after"/>
<ms-api-assertion-regex :is-read-only="isReadOnly" :list="assertions.regex" v-if="type === options.REGEX" :callback="after"/> <ms-api-assertion-regex :is-read-only="isReadOnly" :list="assertions.regex" v-if="type === options.REGEX" :callback="after"/>
<ms-api-assertion-json-path :is-read-only="isReadOnly" :list="assertions.jsonPath" v-if="type === options.JSON_PATH" :callback="after"/> <ms-api-assertion-json-path :is-read-only="isReadOnly" :list="assertions.jsonPath" v-if="type === options.JSON_PATH" :callback="after"/>
<ms-api-assertion-x-path2 :is-read-only="isReadOnly" :list="assertions.xPath2" v-if="type === options.XPATH2" :callback="after"/> <ms-api-assertion-x-path2 :is-read-only="isReadOnly" :list="assertions.xpath2" v-if="type === options.XPATH2" :callback="after"/>
<ms-api-assertion-duration :is-read-only="isReadOnly" v-model="time" :duration="assertions.duration" <ms-api-assertion-duration :is-read-only="isReadOnly" v-model="time" :duration="assertions.duration"
v-if="type === options.DURATION" :callback="after"/> v-if="type === options.DURATION" :callback="after"/>
<ms-api-assertion-jsr223 :is-read-only="isReadOnly" :list="assertions.jsr223" v-if="type === options.JSR223" :callback="after"/> <ms-api-assertion-jsr223 :is-read-only="isReadOnly" :list="assertions.jsr223" v-if="type === options.JSR223" :callback="after"/>

View File

@ -20,12 +20,12 @@
</div> </div>
</div> </div>
<div class="assertion-item-editing x_path" v-if="assertions.xPath2.length > 0"> <div class="assertion-item-editing x_path" v-if="assertions.xpath2.length > 0">
<div> <div>
{{ 'XPath' }} {{ 'XPath' }}
</div> </div>
<div class="regex-item" v-for="(xPath, index) in assertions.xPath2" :key="index"> <div class="regex-item" v-for="(xPath, index) in assertions.xpath2" :key="index">
<ms-api-assertion-x-path2 :is-read-only="isReadOnly" :list="assertions.xPath2" <ms-api-assertion-x-path2 :is-read-only="isReadOnly" :list="assertions.xpath2"
:x-path2="xPath" :edit="true" :index="index"/> :x-path2="xPath" :edit="true" :index="index"/>
</div> </div>
</div> </div>

View File

@ -742,11 +742,11 @@ export class Assertions extends BaseConfig {
this.regex = []; this.regex = [];
this.jsonPath = []; this.jsonPath = [];
this.jsr223 = []; this.jsr223 = [];
this.xPath2 = []; this.xpath2 = [];
this.duration = undefined; this.duration = undefined;
this.set(options); this.set(options);
this.sets({text: Text, regex: Regex, jsonPath: JSONPath, jsr223: AssertionJSR223, xPath2: XPath2}, options); this.sets({text: Text, regex: Regex, jsonPath: JSONPath, jsr223: AssertionJSR223, xpath2: XPath2}, options);
} }
initOptions(options) { initOptions(options) {
@ -1457,8 +1457,8 @@ class JMXGenerator {
}) })
} }
if (assertions.xPath2.length > 0) { if (assertions.xpath2.length > 0) {
assertions.xPath2.filter(this.filter).forEach(item => { assertions.xpath2.filter(this.filter).forEach(item => {
httpSamplerProxy.put(this.getXpathAssertion(item)); httpSamplerProxy.put(this.getXpathAssertion(item));
}) })
} }