diff --git a/functions/postwomanTesting.js b/functions/postwomanTesting.js index aad694ec8..e657b0136 100644 --- a/functions/postwomanTesting.js +++ b/functions/postwomanTesting.js @@ -1,4 +1,3 @@ -import {parse} from "graphql"; const PASS = 'PASS', FAIL = 'FAIL', ERROR = 'ERROR'; diff --git a/pages/index.vue b/pages/index.vue index 12845ead1..99ad78041 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -282,6 +282,26 @@ >close + + + + + + + + +
@@ -1152,6 +1209,7 @@ import querystring from "querystring"; import textareaAutoHeight from "../directives/textareaAutoHeight"; import parseCurlCommand from "../assets/js/curlparser.js"; import getEnvironmentVariablesFromScript from "../functions/preRequest"; +import runTestScriptWitVariables from '../functions/postWomanTesting' import parseTemplateString from "../functions/templating"; import AceEditor from "../components/ace-editor"; import { tokenRequest, oauthRedirect } from "../assets/js/oauth"; @@ -1229,6 +1287,8 @@ export default { return { showModal: false, showPreRequestScript: false, + testsEnabled: false, + testScript: "// pw.expect('variable').toBe('value');", preRequestScript: "// pw.env.set('variable', 'value');", copyButton: 'file_copy', downloadButton: 'get_app', @@ -2135,6 +2195,16 @@ export default { } } })(); + + // tests + const syntheticResponse = { + status: this.response.status, + body: this.response.body, + headers: this.response.headers + }; + const testResults = runTestScriptWitVariables(this.testScript, {response: syntheticResponse}); + console.log('test results!! ', testResults) + } catch (error) { console.error(error); if (error.response) {