{ "v": 2, "name": "secret-envs-coll", "folders": [], "requests": [ { "v": "2", "auth": { "authType": "none", "authActive": true }, "body": { "body": null, "contentType": null }, "name": "test-secret-headers", "method": "GET", "params": [], "headers": [ { "key": "Secret-Header-Key", "value": "<>", "active": true } ], "requestVariables": [], "endpoint": "<>/headers", "testScript": "pw.test(\"Successfully parses secret variable holding the header value\", () => {\n const secretHeaderValue = pw.env.get(\"secretHeaderValue\")\n pw.expect(secretHeaderValue).toBe(\"secret-header-value\")\n \n if (secretHeaderValue) {\n pw.expect(pw.response.body.headers[\"Secret-Header-Key\"]).toBe(secretHeaderValue)\n }\n\n pw.expect(pw.env.get(\"secretHeaderValueFromPreReqScript\")).toBe(\"secret-header-value\")\n})", "preRequestScript": "const secretHeaderValueFromPreReqScript = pw.env.get(\"secretHeaderValue\")\npw.env.set(\"secretHeaderValueFromPreReqScript\", secretHeaderValueFromPreReqScript)" }, { "v": "2", "auth": { "authType": "none", "authActive": true }, "body": { "body": "{\n \"secretBodyKey\": \"<>\"\n}", "contentType": "application/json" }, "name": "test-secret-body", "method": "POST", "params": [], "headers": [], "requestVariables": [], "endpoint": "<>/post", "testScript": "pw.test(\"Successfully parses secret variable holding the request body value\", () => {\n const secretBodyValue = pw.env.get(\"secretBodyValue\")\n pw.expect(secretBodyValue).toBe(\"secret-body-value\")\n \n if (secretBodyValue) {\n pw.expect(pw.response.body.json.secretBodyKey).toBe(secretBodyValue)\n }\n\n pw.expect(pw.env.get(\"secretBodyValueFromPreReqScript\")).toBe(\"secret-body-value\")\n})", "preRequestScript": "const secretBodyValueFromPreReqScript = pw.env.get(\"secretBodyValue\")\npw.env.set(\"secretBodyValueFromPreReqScript\", secretBodyValueFromPreReqScript)" }, { "v": "2", "auth": { "authType": "none", "authActive": true }, "body": { "body": null, "contentType": null }, "name": "test-secret-query-params", "method": "GET", "params": [ { "key": "secretQueryParamKey", "value": "<>", "active": true } ], "headers": [], "requestVariables": [], "endpoint": "<>/get", "testScript": "pw.test(\"Successfully parses secret variable holding the query param value\", () => {\n const secretQueryParamValue = pw.env.get(\"secretQueryParamValue\")\n pw.expect(secretQueryParamValue).toBe(\"secret-query-param-value\")\n \n if (secretQueryParamValue) {\n pw.expect(pw.response.body.args.secretQueryParamKey).toBe(secretQueryParamValue)\n }\n\n pw.expect(pw.env.get(\"secretQueryParamValueFromPreReqScript\")).toBe(\"secret-query-param-value\")\n})", "preRequestScript": "const secretQueryParamValueFromPreReqScript = pw.env.get(\"secretQueryParamValue\")\npw.env.set(\"secretQueryParamValueFromPreReqScript\", secretQueryParamValueFromPreReqScript)" }, { "v": "2", "auth": { "authType": "basic", "password": "<>", "username": "<>", "authActive": true }, "body": { "body": null, "contentType": null }, "name": "test-secret-basic-auth", "method": "GET", "params": [], "headers": [], "requestVariables": [], "endpoint": "<>/basic-auth/<>/<>", "testScript": "pw.test(\"Successfully parses secret variables holding basic auth credentials\", () => {\n\tconst secretBasicAuthUsername = pw.env.get(\"secretBasicAuthUsername\")\n \tconst secretBasicAuthPassword = pw.env.get(\"secretBasicAuthPassword\")\n\n pw.expect(secretBasicAuthUsername).toBe(\"test-user\")\n pw.expect(secretBasicAuthPassword).toBe(\"test-pass\")\n\n if (secretBasicAuthUsername && secretBasicAuthPassword) {\n const { authenticated, user } = pw.response.body\n pw.expect(authenticated).toBe(true)\n pw.expect(user).toBe(secretBasicAuthUsername)\n }\n});", "preRequestScript": "" }, { "v": "2", "auth": { "token": "<>", "authType": "bearer", "password": "testpassword", "username": "testuser", "authActive": true }, "body": { "body": null, "contentType": null }, "name": "test-secret-bearer-auth", "method": "GET", "params": [], "headers": [], "requestVariables": [], "endpoint": "<>/bearer", "testScript": "pw.test(\"Successfully parses secret variable holding the bearer token\", () => {\n const secretBearerToken = pw.env.get(\"secretBearerToken\")\n const preReqSecretBearerToken = pw.env.get(\"preReqSecretBearerToken\")\n\n pw.expect(secretBearerToken).toBe(\"test-token\")\n\n if (secretBearerToken) { \n pw.expect(pw.response.body.token).toBe(secretBearerToken)\n pw.expect(preReqSecretBearerToken).toBe(\"test-token\")\n }\n});", "preRequestScript": "const secretBearerToken = pw.env.get(\"secretBearerToken\")\npw.env.set(\"preReqSecretBearerToken\", secretBearerToken)" }, { "v": "2", "auth": { "authType": "none", "authActive": true }, "body": { "body": null, "contentType": null }, "name": "test-secret-fallback", "method": "GET", "params": [], "headers": [], "requestVariables": [], "endpoint": "<>", "testScript": "pw.test(\"Returns an empty string if the value for a secret environment variable is not found in the system environment\", () => {\n pw.expect(pw.env.get(\"nonExistentValueInSystemEnv\")).toBe(\"\")\n})", "preRequestScript": "" } ], "auth": { "authType": "inherit", "authActive": false }, "headers": [] }