Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

very basic testing implementation

Nicholas Palenchar708043dd6b73
diff --git a/functions/postwomanTesting.js b/functions/postwomanTesting.js
index f0b1ed688..69804cedc 100644
--- a/functions/postwomanTesting.js
+++ b/functions/postwomanTesting.js
@@ -32,15 +32,15 @@ export default function runTestScriptWitVariables(script, variables) {
let errors = null;
new Function("pw", script)(pw);
//
- const report = pw._report.map(item => {
- if (item.status) {
- item.styles = styles[status];
+ const testReports = pw._testReports.map(item => {
+ if (item.result) {
+ item.styles = styles[item.result];
} else {
item.styles = styles.none;
}
return item;
});
- return {report, errors: pw._errors, testResults: pw._testReports};
+ return {report: pw._report, errors: pw._errors, testResults: testReports};
}
function test(descriptor, func, _testReports) {
diff --git a/pages/index.vue b/pages/index.vue
index 1e3d1a123..01e00c13c 100644
--- a/pages/index.vue
+++ b/pages/index.vue
@@ -283,7 +283,7 @@
>
</button>
<button
- :class="'icon' + (showPreRequestScript ? ' info-response' : '')"
+ :class="'icon' + (testsEnabled ? ' info-response' : '')"
id="preRequestScriptButto"
v-tooltip.bottom="{
content: !testsEnabled
@@ -296,7 +296,7 @@
class="material-icons"
:class="testsEnabled"
v-if="!testsEnabled"
- >code</i
+ >assignment_turned_in</i
>
<i class="material-icons" :class="testsEnabled" v-else
>close</i
@@ -371,9 +371,9 @@
/>
<label>Test Reports<span v-if="testReports"></span></label>
<div v-if="testReports">
- <div v-for="testReport in testReports.testReports">
- <div v-if="testReport.status">
- <i class="material-icons" :class="testReport.styles.class">{{testReport.styles.icon}}</i> {{testReport.result}}
+ <div v-for="testReport in testReports">
+ <div v-if="testReport.result">
+ <span :class="testReport.styles.class"><i class="material-icons">{{testReport.styles.icon}}</i> {{testReport.result}}</span>
<ul v-if="testReport.message">
<li>{{testReport.message}}</li>
</ul>