I'm encountering an issue with Pactum Cucumber where I'm getting an undefined error, despite receiving the expected output when testing the same request in the Postman application. Below, I've attached the error message for reference
Then('the API should respond with a 6-digit numeric OTP and a transaction key', () => {
console.log(spec.response.body);
otp = spec.response.body.otp;
TransactionId = spec.response.body.transaction_id;
Status = spec.response.body.status;
expect(otp).to.be.a('string').with.lengthOf(6); // Verify OTP format (6 digits)
expect(TransactionId).to.be.a('string'); // Verify transaction key is a string
});
I've attempted to troubleshoot this problem but haven't been successful so far. Here are some steps I've taken:
Review of the Pactum Cucumber Configuration: I've double-checked the configuration settings for Pactum Cucumber to ensure they match the setup used in the Postman application.
Debugging Steps: I've tried debugging the code to isolate the source of the undefined error, but haven't been able to pinpoint it accurately.
Comparative Analysis: I've compared the request and response details between Pactum Cucumber and Postman to identify any discrepancies, but everything seems to be in order.
Despite these efforts, the issue persists. I'm seeking guidance on potential solutions or additional steps I can take to resolve this problem. Any insights or suggestions would be greatly appreciated. #Pactum cucumber