filiphric / cypress-plugin-api

Cypress plugin to show your API information in the Cypress UI runner
ISC License
264 stars 35 forks source link

TypeError Cannot read properties of undefined (reading 'toString') in node_modules/cypress-plugin-api/dist/support.js:11:828 #71

Closed adamlemisch closed 2 years ago

adamlemisch commented 2 years ago

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. UsePrism.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(

11 | );return de(t)&&(p=p.replaceAll('<span class="token punctuation">{</span>','<details class="contents" open><summary class="inline-block brace"><span class="token punctuation">{</span></summary>').replaceAll('<span class="token punctuation">[</span>','<details class="contents" open><summary class="inline-block bracket"><span class="token punctuation">[</span></summary>').replaceAll('<span class="token punctuation">}</span>','</details><span class="token punctuation inline-block">}</span>').replaceAll('<span class="token punctuation">]</span>','</details><span class="token punctuation inline-block">]</span>')),${p}}return""};function rt(e){const d=e==0?0:Math.floor(Math.log(e)/Math.log(1024));return(e/Math.pow(1024,d)).toFixed(2)*1+"\xA0"+["B","kB","MB","GB","TB"][d]}const ot=e=>{const t=e.toString().replace(/\r\n/g, | ^ 12 | ),c=de(t)?t.replace(/\s/g,""):t;return new Blob([c]).size},nt=e=>{try{return new URL(e)}catch{return null}},W=()=>cy.state("document"),it=,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto},:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.invisible{visibility:hidden}.col-span-1{grid-column:span 1 / span 1}.m-4{margin:1rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mt-6{margin-top:1.5rem}.mt-2{margin-top:.5rem}.mb-2{margin-bottom:.5rem}.inline-block{display:inline-block}.flex{display:flex}.table{display:table}.grid{display:grid}.contents{display:contents}.hidden{display:none}.w-2\/12{width:16.666667%}.w-24{width:6rem}.w-10\/12{width:83.333333%}.w-full{width:100%}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.gap-4{gap:1rem}.overflow-auto{overflow:auto}.overflow-scroll{overflow:scroll}.break-words{overflow-wrap:break-word}.rounded-sm{border-radius:.125rem}.border{border-width:1px}.border-r{border-right-width:1px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-t{border-top-width:1px}.border-slate-800{--tw-border-opacity: 1;border-color:rgb(30 41 59 / var(--tw-border-opacity))}.bg-cy-blue-darker{--tw-bg-opacity: 1;background-color:rgb(27 30 46 / var(--tw-bg-opacity))}.bg-cy-blue-darkest{--tw-bg-opacity: 1;background-color:rgb(23 25 38 / var(--tw-bg-opacity))}.p-4{padding:1rem}.px-2{padding-left:.5rem;padding-right:.5rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.px-1{padding-left:.25rem;padding-right:.25rem}.pl-4{padding-left:1rem}.pb-2{padding-bottom:.5rem}.pr-3{padding-right:.75rem}.pl-1{padding-left:.25rem}.pr-4{padding-right:1rem}.text-left{text-align:left}.align-top{vertical-align:top}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-xs{font-size:.75rem;line-height:1rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-cy-gray{--tw-text-opacity: 1;color:rgb(144 149 173 / var(--tw-text-opacity))}.text-cy-gray-light{--tw-text-opacity: 1;color:rgb(208 210 224 / var(--tw-text-opacity))}.text-cy-green{--tw-text-opacity: 1;color:rgb(31 169 113 / var(--tw-text-opacity))}.text-cy-orange{--tw-text-opacity: 1;color:rgb(219 121 5 / var(--tw-text-opacity))}.text-cy-red{--tw-text-opacity: 1;color:rgb(255 87 112 / var(--tw-text-opacity))}.text-cy-blue{--tw-text-opacity: 1;color:rgb(100 112 243 / var(--tw-text-opacity))}.text-cy-yellow{--tw-text-opacity: 1;color:rgb(237 187 74 / var(--tw-text-opacity))}.text-slate-700{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity))}.outline-0{outline-width:0px}#api-view{position:fixed;top:0px;left:0px;right:0px;bottom:0px;margin-bottom:2.5rem;height:100vh;overflow:scroll;--tw-bg-opacity: 1;background-color:rgb(27 30 46 / var(--tw-bg-opacity));z-index:9999999}@keyframes fade-out{0%{opacity:1}to{opacity:0}}._cypress-highlight{opacity:.2!important}[data-layer=Padding],[data-layer=Border],[data-layer=Content]{opacity:0!important}[data-layer=Margin]{--tw-bg-opacity: 1 !important;background-color:rgb(254 249 195 / var(--tw-bg-opacity))!important;opacity:0;animation:fade-out 2s ease-in-out}[data-cy=showAuth]:checked+label,[data-cy=showQuery]:checked+label,[data-cy=showRequestHeaders]:checked+label,[data-cy=showRequestBody]:checked+label,[data-cy=showResponseBody]:checked+label,[data-cy=showResponseHeaders]:checked+label,[data-cy=showCookies]:checked+label{--tw-text-opacity: 1;color:rgb(208 210 224 / var(--tw-text-opacity))}[data-cy=showAuth]:checked~[data-cy=auth],[data-cy=showQuery]:checked~[data-cy=query],[data-cy=showRequestHeaders]:checked~[data-cy=requestHeaders],[data-cy=showRequestBody]:checked~[data-cy=requestBody],[data-cy=showResponseBody]:checked~[data-cy=responseBody],[data-cy=showResponseHeaders]:checked~[data-cy=responseHeaders],[data-cy=showCookies]:checked~[data-cy=cookies]{display:block}[data-cy=showAuth]:not(:checked)~[data-cy=auth],[data-cy=showQuery]:not(:checked)~[data-cy=query],[data-cy=showRequestHeaders]:not(:checked)~[data-cy=requestHeaders],[data-cy=showRequestBody]:not(:checked)~[data-cy=requestBody],[data-cy=showResponseBody]:not(:checked)~[data-cy=responseBody],[data-cy=showResponseHeaders]:not(:checked)~[data-cy=responseHeaders],[data-cy=showCookies]:not(:checked)~[data-cy=cookies]{display:none}pre{padding:.75rem;font-size:.75rem;line-height:1rem;--tw-text-opacity: 1;color:rgb(208 210 224 / var(--tw-text-opacity))}pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{margin-top:.5rem;border-width:1px;--tw-border-opacity: 1;border-color:rgb(30 41 59 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(23 25 38 / var(--tw-bg-opacity));padding-top:1rem;padding-bottom:1rem;padding-left:0;padding-right:1rem}.hljs ::-moz-selection,.hljs::-moz-selection{--tw-bg-opacity: 1;background-color:rgb(46 50 71 / var(--tw-bg-opacity))}.hljs ::selection,.hljs::selection{--tw-bg-opacity: 1;background-color:rgb(46 50 71 / var(--tw-bg-opacity))}.comment{--tw-text-opacity: 1;color:rgb(144 149 173 / var(--tw-text-opacity))}.tag{--tw-text-opacity: 1;color:rgb(100 112 243 / var(--tw-text-opacity))}.operator,.punctuation,.subst{--tw-text-opacity: 1;color:rgb(144 149 173 / var(--tw-text-opacity))}.operator{opacity:.7}.bullet,.deletion,.name,.selector-tag,.template-variable,.variable{--tw-text-opacity: 1;color:rgb(255 87 112 / var(--tw-text-opacity))}.attr,.link,.literal,.number,.symbol,.variable.constant{--tw-text-opacity: 1;color:rgb(208 210 224 / var(--tw-text-opacity))}.number,.attr-name{--tw-text-opacity: 1;color:rgb(31 169 113 / var(--tw-text-opacity))}.attr-value{--tw-text-opacity: 1;color:rgb(208 210 224 / var(--tw-text-opacity))}.addition,.builtin,.code,.doctag,.keyword.atrule,.quote,.regexp,.string,.title.class.inherited__{--tw-text-opacity: 1;color:rgb(100 112 243 / var(--tw-text-opacity))}.diff .meta,.keyword,.template-tag,.type{--tw-text-opacity: 1;color:rgb(127 67 201 / var(--tw-text-opacity))}.meta,.meta .keyword,.meta .string{--tw-text-opacity: 1;color:rgb(144 149 173 / var(--tw-text-opacity))}.no-scrollbar::-webkit-scrollbar{display:none}.no-scrollbar{scrollbar-width:none}.line-number{display:inline-block;padding-right:.5rem}details summary{cursor:pointer;--tw-text-opacity: 1;color:rgb(144 149 173 / var(--tw-text-opacity))}code>details:first-of-type>summary{margin-left:-1rem}details[open] summary.brace:before{content:" \25bc ";margin-left:-.5rem;--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity))}details[open] summary.bracket:before{content:" \25bc ";margin-left:-.5rem;--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity))}details:not([open]) summary.brace:before{content:" \25b6\fe0e ";margin-left:-.5rem;--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity))}details:not([open]) summary.bracket:before{content:" \25b6\fe0e ";margin-left:-.5rem;--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity))}details:not([open]) summary.brace:after{content:"\2026";display:inline-block;width:100%}details:not([open]) summary.bracket:after{content:"\2026";display:inline-block;width:100%}details:not([open]){display:inline-block} 13 | ,st=,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto},:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.invisible{visibility:hidden}.col-span-1{grid-column:span 1 / span 1}.m-4{margin:1rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mt-6{margin-top:1.5rem}.mt-2{margin-top:.5rem}.mb-2{margin-bottom:.5rem}.inline-block{display:inline-block}.flex{display:flex}.table{display:table}.grid{display:grid}.contents{display:contents}.hidden{display:none}.w-2\/12{width:16.666667%}.w-24{width:6rem}.w-10\/12{width:83.333333%}.w-full{width:100%}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.gap-4{gap:1rem}.overflow-auto{overflow:auto}.overflow-scroll{overflow:scroll}.break-words{overflow-wrap:break-word}.rounded-sm{border-radius:.125rem}.border{border-width:1px}.border-r{border-right-width:1px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-t{border-top-width:1px}.border-slate-800{--tw-border-opacity: 1;border-color:rgb(30 41 59 / var(--tw-border-opacity))}.bg-cy-blue-darker{--tw-bg-opacity: 1;background-color:rgb(27 30 46 / var(--tw-bg-opacity))}.bg-cy-blue-darkest{--tw-bg-opacity: 1;background-color:rgb(23 25 38 / var(--tw-bg-opacity))}.p-4{padding:1rem}.px-2{padding-left:.5rem;padding-right:.5rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.px-1{padding-left:.25rem;padding-right:.25rem}.pl-4{padding-left:1rem}.pb-2{padding-bottom:.5rem}.pr-3{padding-right:.75rem}.pl-1{padding-left:.25rem}.pr-4{padding-right:1rem}.text-left{text-align:left}.align-top{vertical-align:top}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-xs{font-size:.75rem;line-height:1rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-cy-gray{--tw-text-opacity: 1;color:rgb(144 149 173 / var(--tw-text-opacity))}.text-cy-gray-light{--tw-text-opacity: 1;color:rgb(208 210 224 / var(--tw-text-opacity))}.text-cy-green{--tw-text-opacity: 1;color:rgb(31 169 113 / var(--tw-text-opacity))}.text-cy-orange{--tw-text-opacity: 1;color:rgb(219 121 5 / var(--tw-text-opacity))}.text-cy-red{--tw-text-opacity: 1;color:rgb(255 87 112 / var(--tw-text-opacity))}.text-cy-blue{--tw-text-opacity: 1;color:rgb(100 112 243 / var(--tw-text-opacity))}.text-cy-yellow{--tw-text-opacity: 1;color:rgb(237 187 74 / var(--tw-text-opacity))}.text-slate-700{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity))}.outline-0{outline-width:0px}.command.command-name-GET span.command-method{border-radius:.125rem;--tw-bg-opacity: 1;background-color:rgb(100 112 243 / var(--tw-bg-opacity));padding-left:.375rem;padding-right:.375rem;color:#fff!important;min-width:10px;margin-right:6px}.command.command-name-DELETE span.command-method{border-radius:.125rem;--tw-bg-opacity: 1;background-color:rgb(255 87 112 / var(--tw-bg-opacity));padding-left:.375rem;padding-right:.375rem;color:#fff!important;min-width:10px;margin-right:6px}.command.command-name-PATCH span.command-method{border-radius:.125rem;--tw-bg-opacity: 1;background-color:rgb(219 121 5 / var(--tw-bg-opacity));padding-left:.375rem;padding-right:.375rem;color:#fff!important;min-width:10px;margin-right:6px}.command.command-name-HEAD span.command-method{border-radius:.125rem;--tw-bg-opacity: 1;background-color:rgb(237 187 74 / var(--tw-bg-opacity));padding-left:.375rem;padding-right:.375rem;color:#fff!important;min-width:10px;margin-right:6px}.command.command-name-PUT span.command-method,.command.command-name-POST span.command-method{border-radius:.125rem;--tw-bg-opacity: 1;background-color:rgb(31 169 113 / var(--tw-bg-opacity));padding-left:.375rem;padding-right:.375rem;color:#fff!important;min-width:10px;margin-right:6px} 14 | ,lt=()=>{const e=W(),d=e.head||e.getElementsByTagName("head")[0],t=e.createElement("style");d.appendChild(t),t.appendChild(e.createTextNode(it));const c=(top==null?void 0:top.document.querySelector("#unified-reporter"))||(top==null?void 0:top.document.querySelector("#app")),p=document.createElement("style");c==null||c.appendChild(p),p.appendChild(e.createTextNode(st))},dt=e=>{const d=W();lt();const t=d.createElement("div");t.setAttribute("id","api-plugin-root"),d.body.appendChild(t);const c=d.getElementById("api-plugin-root");e.mount(c)},ct=()=>{W().getElementsByTagName("style")[0].remove()};var L={exports:{}},P={decodeValues:!0,map:!1,silent:!1};function te(e){return typeof e=="string"&&!!e.trim()}function ae(e,d){var t=e.split(";").filter(te),c=t.shift(),p=ut(c),b=p.name,f=p.value;d=d?Object.assign({},P,d):P;try{f=d.decodeValues?decodeURIComponent(f):f}catch(u){console.error("set-cookie-parser encountered an error while decoding a cookie with value '"+f+"'. Set options.decodeValues to false to disable this feature.",u)}var i={name:b,value:f};return t.forEach(function(u){var x=u.split("="),v=x.shift().trimLeft().toLowerCase(),h=x.join("=");v==="expires"?i.expires=new Date(h):v==="max-age"?i.maxAge=parseInt(h,10):v==="secure"?i.secure=!0:v==="httponly"?i.httpOnly=!0:v==="samesite"?i.sameSite=h:i[v]=h}),i}function ut(e){var d="",t="",c=e.split("=");return c.length>1?(d=c.shift(),t=c.join("=")):t=e,{name:d,value:t}}function ce(e,d){if(d=d?Object.assign({},P,d):P,!e)return d.map?{}:[];if(e.headers&&e.headers["set-cookie"])e=e.headers["set-cookie"];else if(e.headers){var t=e.headers[Object.keys(e.headers).find(function(p){return p.toLowerCase()==="set-cookie"})];!t&&e.headers.cookie&&!d.silent&&console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."),e=t}if(Array.isArray(e)||(e=[e]),d=d?Object.assign({},P,d):P,d.map){var c={};return e.filter(te).reduce(function(p,b){var f=ae(b,d);return p[f.name]=f,p},c)}else return e.filter(te).map(function(p){return ae(p,d)})}function pt(e){if(Array.isArray(e))return e;if(typeof e!="string")return[];var d=[],t=0,c,p,b,f,i;function u(){for(;t<e.length&&/\s/.test(e.charAt(t));)t+=1;return t<e.length}function x(){return p=e.charAt(t),p!=="="&&p!==";"&&p!==","}for(;t<e.length;){for(c=t,i=!1;u();)if(p=e.charAt(t),p===","){for(b=t,t+=1,u(),f=t;t<e.length&&x();)t+=1;t<e.length&&e.charAt(t)==="="?(i=!0,t=f,d.push(e.substring(c,b)),c=t):t=b+1}else t+=1;(!i||t>=e.length)&&d.push(e.substring(c,e.length))}return d}L.exports=ce;L.exports.parse=ce;L.exports.parseString=ae;L.exports.splitCookiesString=pt;const{_:R}=Cypress;before(()=>{window.props={}});const le=(e,...d)=>{var A;const t=Cypress.currentTest.titlePath.join("."),p=cy.state("runnable")._currentRetry!==0,b=!!((A=window.props[t])!=null&&A.length),f=b&&!p?window.props[t]:[],i=W(),u=r.reactive(f),x=r.createApp(Xe,{props:u});(!b||p||Cypress.env("snapshotOnly"))&&dt(x);const v=X(...d),h=u.length,C={id:R.uniqueId(),method:"GET",status:"",time:0,size:"",url:"",auth:{body:{},formatted:""},query:{body:{},formatted:""},requestHeaders:{body:{},formatted:""},requestBody:{body:{},formatted:""},responseBody:{body:{},formatted:""},responseHeaders:{body:{},formatted:""},cookies:{body:{}}};u.push(C),u[h].method=R.cloneDeep(v.method)||"GET",u[h].url=nt(v.url)?v.url:Cypress.config("baseUrl")+v.url,u[h].query.body=R.cloneDeep(v.qs),u[h].auth.body=R.cloneDeep(v.auth),u[h].requestHeaders.body=R.cloneDeep(v.headers),u[h].requestBody.body=R.cloneDeep(v.body),Cypress.env("hideCredentials")&&(u[h]=at(u[h])),u[h].requestBody.formatted=j(u[h].requestBody.body),u[h].requestHeaders.formatted=j(u[h].requestHeaders.body),u[h].query.formatted=j(u[h].query.body),u[h].auth.formatted=j(u[h].auth.body);let N;const q=Cypress.log({name:v.method||"GET",autoEnd:!1,message:${v.url}});return cy.wrap(e({...v,log:!1},v),{log:!1,timeout:v.timeout||Cypress.config("responseTimeout")}).then(w=>{const{body:k,status:o,headers:a,statusText:n,duration:s}=w,l=${o}\xA0(${n});u[h].status=l||"",u[h].time=s;const g=a["content-type"],y=a["content-length"],m=a["set-cookie"],F=typeof k==="object"?JSON.stringify(k,null,2):k;if(g){const H=g.split(";")[0],Z={"text/xml":"xml","application/json":"json","text/html":"html","text/plain":"plaintext"}[H];u[h].responseBody.formatted=j(k,Z),u[h].responseBody.body=F}const $=L.exports.parse(m,{decodeValues:!0});u[h].cookies.body=$,u[h].requestBody.formatted.length||(u[h].requestBody.formatted='<div class="pl-4 text-cy-gray text-xs font-mono">(No content)</div>'),u[h].responseBody.formatted.length||(u[h].responseBody.formatted='<div class="pl-4 text-cy-gray text-xs font-mono">(No content)</div>'),u[h].responseHeaders.body=a,u[h].responseHeaders.formatted=j(a);const M=y?parseInt(y):ot(u[h].responseBody.body);u[h].size=rt(M),w.size=M,N=w,cy.get(#${u[h].id},{log:!1}).then(H=>{var D;return q.set({consoleProps(){return{yielded:N}}}),window.props[t]=u,q.set({$el:H}),q.snapshot("snapshot").end(),(D=i.getElementById("api-view-bottom"))==null||D.scrollIntoView(),Cypress.env("snapshotOnly")&&(x.unmount(),ct()),w})})};Cypress.env("requestMode")?(Cypress.Commands.overwrite("request",le),Cypress.Commands.add("api",(...e)=>{const d=X(...e);return cy.request({...d,log:!1})})):Cypress.Commands.add("api",(...e)=>{Cypress.Commands.overwrite("request",le);const d=X(...e);return cy.request({...d,log:!1})});const gt=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));module.exports=gt;

filiphric commented 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 🙁

adamlemisch commented 2 years ago

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.

filiphric commented 2 years ago

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. Screenshot 2022-11-23 at 17 40 03

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 👍

adamlemisch commented 2 years ago

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.

filiphric commented 2 years ago

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: Screenshot 2022-11-23 at 19 50 50

adamlemisch commented 2 years ago

Thanks for the guidance!

Here is s screenshot:

Screen Shot 2022-11-23 at 12 37 58 PM

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?

filiphric commented 2 years ago

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.

adamlemisch commented 2 years ago

Thank you for giving this attention. Please let me know if I can be of any assistance at any time.

filiphric commented 2 years ago

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.

adamlemisch commented 2 years ago

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!!!