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