multiple-cucumber-html-reporter
multiple-cucumber-html-reporter copied to clipboard
How can i attach the Json API response in the report
I am using Playwright + Typescript + BDD framework where i need to attach the Json response from one of the method to the report. Not sure how i can attach the json.
When('User approves the Payment of amount {string} and validates the API response for Payment approval', async function (amount) { let apiResp = { apiURL: 'API URL', apiResponse: 'Response Body' } apiResp = await paymentsPage.userApprovesThePayment(paymentDescription, amount) const url: string = apiResp.apiURL const responseBdy: string = apiResp.apiResponse await this.log(btoa('The API response validated for URL: ' +url)) })
i am also facing the same issue, unable to attach API request and resposne
@praneshvgaikwad this. attach(JSON.stringfy(data), 'application/json)
include the above method in the step definition.