I am facing an issue with a span tag that contains JSON text, which I need to convert into an object in Protractor for testing purposes.
{"type":"msax-cc-error","value":[{"Code":22104,"Message":"Card holder is required"},{"Code":22058,"Message":"Card number is required"},{"Code":22109,"Message":"Card type is not supported"},{"Code":22103,"Message":"Expiration year is required"}]}
Is there a way to successfully convert this text into an object in Protractor? I have tried the following code snippet but it does not seem to be working as expected.
it('Submitting should be ignored and prompt appropriate error code', function() {
//assign the element text to a variable
var response = element(by.css('.message-box .message-in')).getText();
expect(response.type).toBe('msax-cc-error');
});