Code Monkey home page Code Monkey logo

Comments (10)

sergeyKhristenko avatar sergeyKhristenko commented on June 1, 2024 1

@archfz sorry, missed your message. If I understand correctly it would be something like

specname.js
  before: commands from before

  test1: commands from test1
  test2...

  after: commands from after

or whatever the order will be.
that would be great!

from cypress-terminal-report.

archfz avatar archfz commented on June 1, 2024

I've checked all the way back till 1.1.0. This seems like after and before command registrations never worked. So I will marked this as an enhancement.

The question here is infact that how should we treat these? Because these are not per tests but per spec file, but we are logging per test (as we have also the feature to log only failed tests). Should we add what's from before and after hooks to each tests logs from that spec file? Maybe treat somehow all logs from before and after as special cases of tests and log them as such (in case of log only on fail, log them only if any of the tests fail on spec).

from cypress-terminal-report.

archfz avatar archfz commented on June 1, 2024

@sergeyKhristenko What do you say about the proposed way to treat after and before logs?

from cypress-terminal-report.

flevi29 avatar flevi29 commented on June 1, 2024

Can try to do it.

from cypress-terminal-report.

sergeyKhristenko avatar sergeyKhristenko commented on June 1, 2024

@FLevent29 any updates on this?

from cypress-terminal-report.

flevi29 avatar flevi29 commented on June 1, 2024

Sorry, I haven't worked on it for a little more than a while now. I'm going to try and do it in the following days.

from cypress-terminal-report.

flevi29 avatar flevi29 commented on June 1, 2024

Sorry I sat on this issue for so long. Even so, I cannot do it, I mean there's probably a way to do it, but you'd have to dig deep into Cypress code to find your answers. Or so I believe. Either way I don't have enough experience for this.

What I found for Cypress.mocha.getRunner().on(/*constant here*/, function() { ... }):

  • listening to EVENT_TEST_BEGIN (test) for before() hooks only occur when before() is successful thus defeating the purpose
  • EVENT_TEST_END (test end) for after() doesn't seem viable, it's an afterEach() more or less
  • EVENT_SUITE_BEGIN (suite) for before() didn't work correctly, and couldn't figure out how it put the whole thing into an infinite loop during my final tests
  • EVENT_SUITE_END (suite end) only goes through at the very last cy.task() for some reason, otherwise would be almost ideal
  • EVENT_TEST_FAIL (fail) doesn't go through with cy.task() at all

The rest don't really seem useful, maybe someone could try and have a second opinion on this.

from cypress-terminal-report.

archfz avatar archfz commented on June 1, 2024

@FLevent29 if you have a branch you have worked on please provide the link for it, even if it's only draft changes.

from cypress-terminal-report.

archfz avatar archfz commented on June 1, 2024

As I see either we are missing something or we will need support from cypress to be able to implement this. Anyone else welcome to attempt implementing this. A fresh eye might notice some backdoor to the implementation.

from cypress-terminal-report.

archfz avatar archfz commented on June 1, 2024

This was real hard, but I've dived deep in cypress and mocha to hack in a solution. Unfortunately the number of twisted logic and prototype pollution required makes this feature probably unstable. The feature can be enabled in 3.0.0 with the flag https://github.com/archfz/cypress-terminal-report#optionsenableextendedcollector

from cypress-terminal-report.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.