feat: test results indicator in response section's tests tab
This commit is contained in:
@@ -17,7 +17,16 @@
|
||||
>
|
||||
<LensesHeadersRenderer :headers="response.headers" />
|
||||
</SmartTab>
|
||||
<SmartTab id="results" :label="$t('test.results')">
|
||||
<SmartTab
|
||||
id="results"
|
||||
:label="$t('test.results')"
|
||||
:indicator="
|
||||
testResults &&
|
||||
(testResults.expectResults.length || testResults.tests.length)
|
||||
? true
|
||||
: false
|
||||
"
|
||||
>
|
||||
<HttpTestResult />
|
||||
</SmartTab>
|
||||
</SmartTabs>
|
||||
@@ -26,6 +35,8 @@
|
||||
<script>
|
||||
import { defineComponent } from "@nuxtjs/composition-api"
|
||||
import { getSuitableLenses, getLensRenderers } from "~/helpers/lenses/lenses"
|
||||
import { useReadonlyStream } from "~/helpers/utils/composables"
|
||||
import { restTestResults$ } from "~/newstore/RESTSession"
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
@@ -35,6 +46,12 @@ export default defineComponent({
|
||||
props: {
|
||||
response: { type: Object, default: () => {} },
|
||||
},
|
||||
setup() {
|
||||
const testResults = useReadonlyStream(restTestResults$, null)
|
||||
return {
|
||||
testResults,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
headerLength() {
|
||||
if (!this.response || !this.response.headers) return 0
|
||||
|
||||
@@ -12,6 +12,7 @@ export default defineComponent({
|
||||
props: {
|
||||
label: { type: String, default: null },
|
||||
info: { type: String, default: null },
|
||||
indicator: { type: Boolean, default: false },
|
||||
icon: { type: String, default: null },
|
||||
id: { type: String, default: null, required: true },
|
||||
selected: {
|
||||
|
||||
@@ -34,6 +34,10 @@
|
||||
<span v-if="tab.info && tab.info !== 'null'" class="tab-info">
|
||||
{{ tab.info }}
|
||||
</span>
|
||||
<span
|
||||
v-if="tab.indicator"
|
||||
class="bg-accentLight h-1 w-1 ml-2 rounded-full"
|
||||
></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="flex justify-center items-center">
|
||||
|
||||
@@ -10,7 +10,7 @@ pw.test("Status code is 200", ()=> {
|
||||
name: "Response: Assert property from body",
|
||||
script: `\n\n// Check JSON response property
|
||||
pw.test("Check JSON response property", ()=> {
|
||||
pw.expect(pw.response.method).toBe("GET");
|
||||
pw.expect(pw.response.body.method).toBe("GET");
|
||||
});`,
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user