You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pretty similar to #165 I guess, but this is a request for advice.
I am using nasty functions in order to store and reuse data between requests.
In order to compensate with the fact that the logs give only the content of the it(), I added a conditional screenshot upon failure of the test. (see code and screenshot below and maybe this helps @kivysyar with his own problem)
I made it conditional because otherwise it requires more disk space and time to execute, but the downside is, I only have the content of the failing request, not that of the couple of previous requests.
I would love to replace the content of the it() with the actual request and the actual response, just like it shows in the html.
My question is: should I look into modifying my code, cy-api or the mochasome reporter instead?
// in the test fileafterEach(()=>{cy.takeScreenshotIfAutomatedTests();});
// my custom commandimportaddContextfrom"mochawesome/addContext";Cypress.Commands.add("takeScreenshotIfAutomatedTests",(capture)=>{letscreenshot;if(Cypress.env("CI")&&Cypress.state().ctx.currentTest.state==="failed"){cy.screenshot("screenshot",{capture: capture,// Captures "fullpage" if undefinedoverwrite: true,onAfterScreenshot($el,props){screenshot=props.path;},}).then(()=>{cy.once("test:after:run",(test)=>{addContext({ test },screenshot);});});}});
The text was updated successfully, but these errors were encountered:
Pretty similar to #165 I guess, but this is a request for advice.
I am using nasty functions in order to store and reuse data between requests.
In order to compensate with the fact that the logs give only the content of the
it()
, I added a conditional screenshot upon failure of the test. (see code and screenshot below and maybe this helps @kivysyar with his own problem)I made it conditional because otherwise it requires more disk space and time to execute, but the downside is, I only have the content of the failing request, not that of the couple of previous requests.
I would love to replace the content of the
it()
with the actual request and the actual response, just like it shows in the html.My question is: should I look into modifying my code, cy-api or the mochasome reporter instead?
The text was updated successfully, but these errors were encountered: