Closed adamlemisch closed 2 years ago
Hey @adamlemisch thanks for the report! From the error that you sent it seems that plugin has trouble parsing something. Could be the request, response, some headers or something else. I am not able tell what exactly from the code you sent as it’s basically just saying - hey, there’s an error. To find out what causes it, it would really help if you could send me some information about the request, specifically:
to get the response, you can use a tool like postman or something else,
if you have that API endpoint open for testing, I could replicate that myself, though not sure if that’s the case 🙁
Hi Filip,
Unfortunately, the API is locked down to company personnel. I am also unable to share details with regard to the request and response data per my manager. However, I have noticed that the plugin handles all other API calls just fine. The only one it has an issue with is the 204 No Content response. Do you think that since this is a 200 range response you are trying to parse it and since a 204 has no content you are trying to parse an empty response causing the TypeError Cannot read properties of undefined since again, there is nothing in the response? I am hoping this is the case and an easy fix (as in If responseCode == 204, do not parse body).
Please let me know if I can assist in any way. I apologize for not being able to share data.
hey @adamlemisch I tried to test your hypothesis (which reminded me of missing test in the plugin), but it seems there’s no problem in handling empty response.
I just released 2.6.0 that includes sourcemaps. This might help us better identify where the issue might be. my guess is that it actually might be a function that calculates the response size. it seems that it is behaving weirdly, so I’ll make sure to do some debugging around that. in the meantime, if you could update to the latest version and send me an error report from there, that might help 👍
Hi @filiphric,
I apologize but I am unfamiliar with sourcemaps and I am not sure if this is a utility that would allow me to extract an error report and send to you but that is how I am interpreting "if you could update to the latest version and send me an error report from there...". I have updated to 2.6.0 and executed the test with the same TypeError being the result. Would it be possible for you to give me some explicit guidance on what you would like me to provide you with and how to get it with regard to an error report and if sourcemaps is a resource I should use to provide this info? I did some googling and I do see that sourcemaps is enabled in Chrome which I what I execute tests in.
Hey @adamlemisch no worries. Try to run the problematic test and send me a screenshot from the error frame shown on cypress timeline. it might look something like this:
Thanks for the guidance!
Here is s screenshot:
And here is a copy of the entire output since it scrolls to the right quite far: https://github.com/adamlemisch/filip/blob/main/FilipHric
Out of curiosity, is it the const set at the end of line 11?
Out of curiosity, is it the const set at the end of line 11?
Yup, that’s what the error seems to be pointing to. I’ll investigate a little more to see what might be causing the problem here, but it seems it is the function that is calculating the size of the response. I believe there may be some merit to what you mentioned about the empty response, just need to dig a little deeper into it.
Thank you for giving this attention. Please let me know if I can be of any assistance at any time.
hey @adamlemisch thanks for all the help, I was able to narrow down the problem and released a fix with version 2.6.1. let me know it helped out.
Verified fixed in 2.6.1 - thank you so much for taking the time to look into this and fix it! I am so excited to be able to use this package!!!
This is a wonderful plugin but I am experiencing an issue and I am not 100% sure how to report it. I thought starting a conversation here would be a good way to start. I apologize if this is the wrong way to inform you of a possible issue as well.
The following is the output from the cypress runner. I realize it's obnoxiously long but I wanted you to have everything incase it's helpful. I am running cypress 9.7.0 (yes, I know it's old - I am waiting to upgrade for various reasons). I added the
import 'cypress-plugin-api'
statement to cypress > support > index.js. I can't determine why the plugin is behaving this way for this specific test. It works for other tests so I not sure if it is something that I have done that is causing this issue or not.Please let me know if I can be of any assistance. This is a great package and your work is much appreciated!
4 then function(){} TypeError Cannot read properties of undefined (reading 'toString') [node_modules/cypress-plugin-api/dist/support.js:11:828](https://tinappsb.qa.paylocity.com/__/#) 9 | ),w.hasAttribute("data-start")||w.setAttribute("data-start",String(m+1))}k.textContent=l,t.highlightElement(k)},function(l){w.setAttribute(i,v),k.textContent=l})}}),t.plugins.fileHighlight={highlight:function(w){for(var k=(w||document).querySelectorAll(h),o=0,a;a=k[o++];)t.highlightElement(a)}};var q=!1;t.fileHighlight=function(){q||(console.warn("Prism.fileHighlight is deprecated. Use
Prism.plugins.fileHighlight.highlightinstead."),q=!0),t.plugins.fileHighlight.highlight.apply(this,arguments)}}()})(ee);Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}};Prism.languages.webmanifest=Prism.languages.json;const de=e=>{try{JSON.parse(e)}catch{return!1}return!0},j=(e,d="json")=>{const t=d==="json"?JSON.stringify(e,null,2):e;if(e){let p=ee.exports.highlight(t,ee.exports.languages[d],d).split(
10 |).map((b,f)=>
${(f+1).toString().padStart(4," ")} ${b}).join(