karatelabs / karate

Test Automation Made Simple
https://karatelabs.github.io/karate
MIT License
8.27k stars 1.95k forks source link

java.lang.RuntimeException: cannot run jsonpath on type: [type: STRING, value: #893

Closed sateeshcsse closed 5 years ago

sateeshcsse commented 5 years ago

Getting an error while fetching data from JSON response

Feature File:

Feature: Create travel policy

Background:

Scenario: Test1 Given url 'https://dev.mobile-api.woolworths.com.au/insurance/v1/travel/create/quote' And request { "ages": [ 63 ], "destinations": [ "BALI","THA" ], "start": "2019-09-16", "finish": "2019-10-13", "rewardCardDetails": {"isRewardCardValidated": true,"rewardCardNumber": "9399660190444"} } When method POST Then status 200

Error:

java.lang.RuntimeException: cannot run jsonpath on type: [type: STRING, value: {"accessToken":"8m28AK6YflAh1AU0fM0C8RGkIVqz","refreshToken":"mBBXiGZ4EA7BB4CkbQNr1gUlaYuGU6Sf","requestData":{"destinations":["BALI","THA"],"ages":[63],"start":"2019-09-16","finish":"2019-10-13","rewardCardDetails":{"isRewardCardValidated":true,"rewardCardNumber":"9399660190444"}},"pricingDetails":{"region":"UK & Asia","duration":27,"quotes":[{"productId":"B","productType":"Basic","price":"83.35","priceIncTax":"83.75","url":"https://uat-insurance.woolworths.com.au/travel-insurance/travel-quote.html/generate-quote?ages%5B%5D=63&client=WTI-Staging&destinations%5B%5D=BALI&destinations%5B%5D=THA&finish=2019-10-13&product_type=Basic&promo=&start=2019-09-16","insured":[{"type":"Traveller","age":63,"price":"83.35","undiscountedPrice":"83.35"}],"optionalExtras":[{"code":"EXC","variant":"0","loading":"20.84","loadingIncTax":"20.94","policyGstNoSki":0.16,"policyStampDutyNoSki":0.33,"policyAmountNoSki":"104.68","policyGstYesSki":0.28,"policyStampDutyYesSki":0.6,"policyAmountYesSki":"188.42"},{"code":"EXC","variant":"100","loading":"0.00","loadingIncTax":"0.00","policyGstNoSki":0.13,"policyStampDutyNoSki":0.27,"policyAmountNoSki":"83.75","policyGstYesSki":0.25,"policyStampDutyYesSki":0.53,"policyAmountYesSki":"167.48"},{"code":"EXC","variant":"200","loading":"-8.34","loadingIncTax":"-8.38","policyGstNoSki":0.11,"policyStampDutyNoSki":0.24,"policyAmountNoSki":"75.36","policyGstYesSki":0.24,"policyStampDutyYesSki":0.51,"policyAmountYesSki":"159.11"},{"code":"SKI","loading":"83.35","loadingIncTax":"83.75"}],"benefits":[{"code":"01-OVMEANHOEX","description":"Cover for overseas hospital, medical, surgical, nursing, ambulance and emergency dental expenses for up to $500.","excess":"100.00","name":"Overseas Medical and Hospital Expenses ","value":"20000000.00","valueText":"Unlimited"},{"code":"02-CAANAMFE","description":"Cover if your journey has to be re-arranged or cancelled due to circumstances outside Your control.","excess":"100.00","name":"Cancellation or Amendment Costs ","value":"5000.00","valueText":"$5,000 "},{"code":"04-LUANPEEF","description":"We will pay the repair costs or value for lost, stolen or damaged luggage/personal effects.","excess":"100.00","name":"Luggage and Personal Effects ","value":"5000.00","valueText":"$5,000 "},{"code":"16-PELI","description":"Cover for personal legal liability if your negligent act or omission during the journey causes bodily injury or damage to property of other persons. This benefit is combined for all people covered on the policy.","excess":"100.00","name":"Personal Liability","value":"1000000.00","valueText":"$1,000,000 "}]},{"productId":"C","productType":"Comprehensive","price":"126.29","priceIncTax":"126.88","url":"https://uat-insurance.woolworths.com.au/travel-insurance/travel-quote.html/generate-quote?ages%5B%5D=63&client=WTI-Staging&destinations%5B%5D=BALI&destinations%5B%5D=THA&finish=2019-10-13&product_type=Comprehensive&promo=&start=2019-09-16","insured":[{"type":"Traveller","age":63,"price":"126.29","undiscountedPrice":"126.29"}],"optionalExtras":[{"code":"EXC","variant":"0","loading":"31.57","loadingIncTax":"31.72","policyGstNoSki":0.24,"policyStampDutyNoSki":0.51,"policyAmountNoSki":"158.61","policyGstYesSki":0.43,"policyStampDutyYesSki":0.91,"policyAmountYesSki":"285.49"},{"code":"EXC","variant":"100","loading":"0.00","loadingIncTax":"0.00","policyGstNoSki":0.19,"policyStampDutyNoSki":0.4,"policyAmountNoSki":"126.88","policyGstYesSki":0.38,"policyStampDutyYesSki":0.81,"policyAmountYesSki":"253.77"},{"code":"EXC","variant":"200","loading":"-12.63","loadingIncTax":"-12.69","policyGstNoSki":0.17,"policyStampDutyNoSki":0.36,"policyAmountNoSki":"114.19","policyGstYesSki":0.36,"policyStampDutyYesSki":0.77,"policyAmountYesSki":"241.08"},{"code":"SKI","loading":"126.29","loadingIncTax":"126.88"}],"benefits":[{"code":"01-OVMEANHOEX","description":"Cover for overseas hospital, medical, surgical, nursing, ambulance and emergency dental expenses for up to $500.","excess":"100.00","name":"Overseas Medical and Hospital Expenses ","value":"20000000.00","valueText":"Unlimited"},{"code":"02-CAANAMFE","description":"Cover if your journey has to be re-arranged or cancelled due to circumstances outside Your control.","excess":"100.00","name":"Cancellation or Amendment Costs ","value":"20000.00","valueText":"$20,000 "},{"code":"03-ADEX","description":"Cover for additional accommodation and transportation expenses as a result of certain events including sickness, natural disasters, loss of travel documents and strikes.","excess":"100.00","name":"Additional Expenses ","value":"12000.00","valueText":"$12,000 "},{"code":"04-LUANPEEF","description":"We will pay the repair costs or value for lost, stolen or damaged luggage/personal effects.","excess":"100.00","name":"Luggage and Personal Effects ","value":"15000.00","valueText":"$15,000 "},{"code":"05-TRDOCRCA&TRCH","description":"We will pay You for the cost of replacing travel documents, credit cards and travellers cheques lost or stolen on the Journey. We will cover any losses resulting from the fraudulent use of the credit cards. You must however comply with all the conditions of the issue of the document prior to and after the loss or theft.","excess":"100.00","name":"Travel Documents, Credit Card & Travellers Cheque","value":"5000.00","valueText":"$5,000 "},{"code":"06-DELUAL","description":"If all Your luggage is delayed by a Transport Provider during the Journey for more than 12 hours We will pay You up to $375 for essential emergency items of clothing and toiletries You purchase whilst on Your Journey. These limits will be doubled if You still have not received Your luggage after 72 hours.","excess":"100.00","name":"Delayed Luggage and Personal Effects","value":"750.00","valueText":"$750 "},{"code":"07-THOFCA","description":"We will reimburse You for cash, bank or currency notes, postal or money orders stolen from Your person.","excess":"100.00","name":"Theft of Cash","value":"250.00","valueText":"$250 "},{"code":"08-RECAINEX","description":"We will pay You for any Rental Vehicle excess You become liable to pay as a result of damage to, or theft of, a Rental Car, whilst in Your control during the Journey.","excess":"100.00","name":"Rental Vehicle Excess ","value":"5000.00","valueText":"$5,000 "},{"code":"09-TRDEEX","description":"$200 cover per day for additional accommodation expenses if your scheduled transport is delayed over 6 hours.","excess":"100.00","name":"Travel Delay Expenses","value":"2000.00","valueText":"$2,000 "},{"code":"10-ALTREX","description":"We will pay for the Reasonable additional cost of using alternative transport to arrive at Your Special event on time.","excess":"100.00","name":"Special Events","value":"5000.00","valueText":"$5,000 "},{"code":"12-HOCAAL","description":"Covers up to $50 per day to cover the cost of miscellaneous expenses after you are hospitalised overseas for at least 48 hours.","excess":"100.00","name":"Hospital Cash Allowance","value":"5000.00","valueText":"$5,000 "},{"code":"13-LOOFIN","description":"Benefit payable if, due to an injury sustained during your journey, you are unable to work on your return to Australia. (Up to 26 weeks of disablement after the first 30 days of your return).","excess":"100.00","name":"Loss of Income","value":"10400.00","valueText":"Max 26 weeks up to $10,400"},{"code":"14-PEDI","description":"Benefit payable if, due to an injury sustained during your journey, you suffer total loss of sight in one or both eyes or total loss of the use of a limb.","excess":"100.00","name":"Permanent Disability","value":"25000.00","valueText":"$25,000 "},{"code":"15-ACDE","description":"Benefit payable (to your estate) if you die due to an injury sustained during your journey.","excess":"100.00","name":"Accidental Death","value":"20000.00","valueText":"$20,000 "},{"code":"16-PELI","description":"Cover for personal legal liability if your negligent act or omission during the journey causes bodily injury or damage to property of other persons. This benefit is combined for all people covered on the policy.","excess":"100.00","name":"Personal Liability","value":"3000000.00","valueText":"$3,000,000 "}]},{"productId":"S","productType":"Saver","price":"77.10","priceIncTax":"77.47","url":"https://uat-insurance.woolworths.com.au/travel-insurance/travel-quote.html/generate-quote?ages%5B%5D=63&client=WTI-Staging&destinations%5B%5D=BALI&destinations%5B%5D=THA&finish=2019-10-13&product_type=Saver&promo=&start=2019-09-16","insured":[{"type":"Traveller","age":63,"price":"77.10","undiscountedPrice":"77.10"}],"optionalExtras":[{"code":"EXC","variant":"0","loading":"19.28","loadingIncTax":"19.37","policyGstNoSki":0.14,"policyStampDutyNoSki":0.31,"policyAmountNoSki":"96.83","policyGstYesSki":0.26,"policyStampDutyYesSki":0.56,"policyAmountYesSki":"174.30"},{"code":"EXC","variant":"100","loading":"0.00","loadingIncTax":"0.00","policyGstNoSki":0.12,"policyStampDutyNoSki":0.25,"policyAmountNoSki":"77.47","policyGstYesSki":0.23,"policyStampDutyYesSki":0.49,"policyAmountYesSki":"154.92"},{"code":"EXC","variant":"200","loading":"-7.71","loadingIncTax":"-7.74","policyGstNoSki":0.1,"policyStampDutyNoSki":0.22,"policyAmountNoSki":"69.71","policyGstYesSki":0.22,"policyStampDutyYesSki":0.47,"policyAmountYesSki":"147.18"},{"code":"SKI","loading":"77.10","loadingIncTax":"77.47"}],"benefits":[{"code":"01-OVMEANHOEX","description":"Cover for overseas hospital, medical, surgical, nursing, ambulance and emergency dental expenses for up to $500.","excess":"100.00","name":"Overseas Medical and Hospital Expenses ","value":"20000000.00","valueText":"Unlimited"},{"code":"04-LUANPEEF","description":"We will pay the repair costs or value for lost, stolen or damaged luggage/personal effects.","excess":"100.00","name":"Luggage and Personal Effects ","value":"2000.00","valueText":"$2,000 "},{"code":"16-PELI","description":"Cover for personal legal liability if your negligent act or omission during the journey causes bodily injury or damage to property of other persons. This benefit is combined for all people covered on the policy.","excess":"100.00","name":"Personal Liability","value":"1000000.00","valueText":"$1,000,000 "}]},{"productId":"A","productType":"Annual multi-trip","price":"300.00","priceIncTax":"301.41","url":"https://uat-insurance.woolworths.com.au/travel-insurance/travel-quote.html/generate-quote?ages%5B%5D=63&client=WTI-Staging&destinations%5B%5D=BALI&destinations%5B%5D=THA&finish=2019-10-13&product_type=Annual+multi-trip&promo=&start=2019-09-16","insured":[{"type":"Traveller","age":63,"price":"300.00","undiscountedPrice":"300.00"}],"optionalExtras":[{"code":"EXC","variant":"0","loading":"75.00","loadingIncTax":"75.35","policyGstNoSki":0.56,"policyStampDutyNoSki":1.2,"policyAmountNoSki":"376.76","policyGstYesSki":1.01,"policyStampDutyYesSki":2.16,"policyAmountYesSki":"678.17"},{"code":"EXC","variant":"100","loading":"0.00","loadingIncTax":"0.00","policyGstNoSki":0.45,"policyStampDutyNoSki":0.96,"policyAmountNoSki":"301.41","policyGstYesSki":0.9,"policyStampDutyYesSki":1.92,"policyAmountYesSki":"602.82"},{"code":"EXC","variant":"200","loading":"-30.00","loadingIncTax":"-30.15","policyGstNoSki":0.41,"policyStampDutyNoSki":0.87,"policyAmountNoSki":"271.28","policyGstYesSki":0.86,"policyStampDutyYesSki":1.83,"policyAmountYesSki":"572.69"},{"code":"SKI","loading":"300.00","loadingIncTax":"301.41"}],"benefits":[{"code":"01-OVMEANHOEX","description":"Cover for overseas hospital, medical, surgical, nursing, ambulance and emergency dental expenses for up to $500.","excess":"100.00","name":"Overseas Medical and Hospital Expenses ","value":"20000000.00","valueText":"Unlimited"},{"code":"02-CAANAMFE","description":"Cover if your journey has to be re-arranged or cancelled due to circumstances outside Your control.","excess":"100.00","name":"Cancellation or Amendment Costs ","value":"20000.00","valueText":"$20,000 "},{"code":"03-ADEX","description":"Cover for additional accommodation and transportation expenses as a result of certain events including sickness, natural disasters, loss of travel documents and strikes.","excess":"100.00","name":"Additional Expenses ","value":"12000.00","valueText":"$12,000 "},{"code":"04-LUANPEEF","description":"We will pay the repair costs or value for lost, stolen or damaged luggage/personal effects.","excess":"100.00","name":"Luggage and Personal Effects ","value":"15000.00","valueText":"$15,000 "},{"code":"05-TRDOCRCA&TRCH","description":"We will pay You for the cost of replacing travel documents, credit cards and travellers cheques lost or stolen on the Journey. We will cover any losses resulting from the fraudulent use of the credit cards. You must however comply with all the conditions of the issue of the document prior to and after the loss or theft.","excess":"100.00","name":"Travel Documents, Credit Card & Travellers Cheque","value":"5000.00","valueText":"$5,000 "},{"code":"06-DELUAL","description":"If all Your luggage is delayed by a Transport Provider during the Journey for more than 12 hours We will pay You up to $375 for essential emergency items of clothing and toiletries You purchase whilst on Your Journey. These limits will be doubled if You still have not received Your luggage after 72 hours.","excess":"100.00","name":"Delayed Luggage and Personal Effects","value":"750.00","valueText":"$750 "},{"code":"07-THOFCA","description":"We will reimburse You for cash, bank or currency notes, postal or money orders stolen from Your person.","excess":"100.00","name":"Theft of Cash","value":"250.00","valueText":"$250 "},{"code":"08-RECAINEX","description":"We will pay You for any Rental Vehicle excess You become liable to pay as a result of damage to, or theft of, a Rental Car, whilst in Your control during the Journey.","excess":"100.00","name":"Rental Vehicle Excess *","value":"5000.00","valueText":"$5,000 "},{"code":"09-TRDEEX","description":"$200 cover per day for additional accommodation expenses if your scheduled transport is delayed over 6 hours.","excess":"100.00","name":"Travel Delay Expenses","value":"2000.00","valueText":"$2,000 "},{"code":"10-ALTREX","description":"We will pay for the Reasonable additional cost of using alternative transport to arrive at Your Special event on time.","excess":"100.00","name":"Special Events","value":"5000.00","valueText":"$5,000 "},{"code":"12-HOCAAL","description":"Covers up to $50 per day to cover the cost of miscellaneous expenses after you are hospitalised overseas for at least 48 hours.","excess":"100.00","name":"Hospital Cash Allowance","value":"5000.00","valueText":"$5,000 "},{"code":"13-LOOFIN","description":"Benefit payable if, due to an injury sustained during your journey, you are unable to work on your return to Australia. (Up to 26 weeks of disablement after the first 30 days of your return).","excess":"100.00","name":"Loss of Income","value":"10400.00","valueText":"Max 26 weeks up to $10,400"},{"code":"14-PEDI","description":"Benefit payable if, due to an injury sustained during your journey, you suffer total loss of sight in one or both eyes or total loss of the use of a limb.","excess":"100.00","name":"Permanent Disability","value":"25000.00","valueText":"$25,000 "},{"code":"15-ACDE","description":"Benefit payable (to your estate) if you die due to an injury sustained during your journey.","excess":"100.00","name":"Accidental Death","value":"20000.00","valueText":"$20,000 "},{"code":"16-PELI","description":"Cover for personal legal liability if your negligent act or omission during the journey causes bodily injury or damage to property of other persons. This benefit is combined for all people covered on the policy.","excess":"100.00","name":"Personal Liability","value":"3000000.00","valueText":"$3,000,000 "}]}],"taxRates":{"gst":"0.0015","stampDuty":{"ACT":"0.0","NSW":"0.009","NT":"0.01","QLD":"0.009","SA":"0.011","TAS":"0.01","VIC":"0.01","WA":"0.01"}},"membershipTiers":[{"name":"Membership","discount":"0.0"}],"pds":"https://insurance.woolworths.com.au/content/dam/Woolworths/Insurance/Travel/UsefulDocumentsTravel/Woolworths_Travel_Insurance_PDS.pdf","provider":{"name":"WTI","about":"Janeway Development"}}}

    ]
at com.intuit.karate.Script.evalJsonPathOnVarByName(Script.java:252)
at com.intuit.karate.Script.eval(Script.java:201)
at com.intuit.karate.Script.assign(Script.java:403)
at com.intuit.karate.StepDefs.def(StepDefs.java:202)
at ?.* def resp = response.accessToken(venkat/travelPolicyCreation.feature:11)
ptrthomas commented 5 years ago

sorry no one has the time to dig through this response. one hint is the response may not be valid JSON. to re-open, please follow these instructions or try stack overflow: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue