-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Address issue #1495 by adding cypress spec name to mocha suite #3960
Conversation
I was able to see this worked for the Test Runner (in open), but i tried to verify this works in Run and It does not appear to be the case :( Will keep digging |
I cant figure this out after 2 hours of going around the code, i guess i wont be splitting my tests in CircleCI by spec name / timings after all |
I wish i could just get it to be one level higher, hm.. |
@brian-mann i dont want to be much of a bother, but could anyone take a look at this PR / leave feedback / assist or provide guidance in updating these snapshot tests? |
@egucciar It may be best to start by writing tests for the behavior your want - at least in this way, we can know what your end result should be and can offer more guidance. I'm also seeing the standard out printing this 'has file:' text in every single standard out now (captured in the failing snapshot tests), regardless of the use of a reporter. This is definitely not something we want printed in this way and I'm not sure where this text is coming from. |
@jennifer-shehane thanks for the quick response. The I shall comment it out. I'm trying to run But, I can't get the test to run locally when doing this: This is happening for me also on the develop branch, after having built all the packages, and reinstalling the . node modules Unfortunately without a baseline of passing unit tests I feel uncomfortable updating the existing test with the new assertion just yet. |
@jennifer-shehane thanks so much for the tip with the log, because that fixed all the tests!!! YAY! But, I agree with your update that this is still a WIP because i believe the But I'll have to look into it after our next quick launch, a few days. Basically, digging deeper into this LOC i added here to ensure it is added in the "right place" since i believe the reporter is just a pass-through and this only adds it on the one place where i added it: |
@egucciar any update on this PR? |
I don't have an update. I would really like this feature to be incorporated but i was more or less taking stabs in the dark and couldn't get it over the finish line. I don't recall what specifically blocked me. |
@egucciar I am willing to finish this PR as I want to have the filename to be included in the test results. We use jenkins and a custom reporter and without the filename we have to to a full-text-search through all files to find the spec file that contains a failed test. To do this it would be nice if you can tell me, what is currently missing and what is the current state? Reading through the comments does not help me unfortunatelly :-( |
@gabbersepp Take a look at a mocha suite with timestamps generally used by CircleCI...the time stamp has to be present on the same tag that has the name of the file I think for CircleCI to correlate the time to the file name. I think my change may have propogated the file name to the output, but as can be seen in the screenshots not on the same tag as the timing. |
@gabbersepp if you just need a filename i recommend taking my work, rebasing and seeing if it fits your needs. I needed the filename and timestamp to be in the same tag and couldn't figure out how to write test cases or get the code to do what I want because doing this very simple 2 line change took me hours. |
also, i do remember what blocked me. couldn't get the tests to run, did not receive any help or support on being able to run them. The comment where i showed the issue with the running test is where i left off. I was able to get the log as pointed out by jennifer to disappear from the circle output, but the tests still would not run locally. Never did get a response to that comment and couldn't proceed. |
thanks for your feedback @egucciar . Should be enough information for me :-) |
@egucciar I cherry-picked your commits into a new branch: https://github.com/gabbersepp/cypress/tree/issue-1495 To fully understand your problem: You want the filename not only to be on the first |
Right, exactly, where the timing and test info are |
I made some research but did not found any documentation that declares Maybe the solution is to to use the filename as testsuite |
It seems as though it was once supported in an old version of mocha junit. michaelleeallen/mocha-junit-reporter@673aef9 Honestly, this whole thing is confusing. Basically, the filename is the only was in which we can pass to Cypress what specs to run. Thus, split by filename would be the only split type we could leverage. Seems as though the expected behavior from circle would be similar to classname. Not sure where the mocha junit spec is documented or enforced. |
making this change in the So this change had to be made in the reporter project (https://github.com/michaelleeallen/mocha-junit-reporter) or you @egucciar write an own reporter that can do this. |
Please have a look at my comment. It was to the same time as yours so maybe you missed it. :-) |
Okay. I think I will also close this PR. I don't really have the capacity or need to work on this right now, but timings data would be interesting to me in the future. If it requires work elsewhere then it certainly doesn't need a PR here. My only question is if that change works by itself without any changes to Cypress ? Or alongside the change I made here ? |
Thanks! I assume that the remaining build chain stopped because of the WIP tag. But let's wait until the builds have finished. |
All builds are gree. Looks good! |
@egucciar Can you resolve conflicts and address this comment please? #3960 (review) If you are unable to work on this PR anymore, please close the PR. |
Hi @jennifer-shehane , I don't know if you saw but I responded to your comment. Please let me know if removing the commented lines of code makes sense given my answer to your question. |
@jennifer-shehane resolved conflicts and removed the commented out lines of code assuming that's the right thing to do here. |
# Conflicts: # packages/driver/src/cypress/mocha.coffee
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
Thanks @chrisbreiding for pushing this over the finish line 🙌 |
There was some conversation around making this compatible with CircleCI. It seems like the test results are now getting properly populated with filenames, and I can see it in the test reports. However in CircleCI I am still getting an error:
Just wondering if anyone had any luck with setting up parallelization in CircleCI with this test metadata? |
@rtymchyk, I've tried it on my own, using their cli for test splitting, and the problem seems to be, at least in my case, that the timings data file ( |
We are also still having trouble getting CircleCI to map the filenames properly |
For any still interested, i have an interest in trying this again by forking the reporter as @gabbersepp suggested and kindly demonstrated what file changes i could make to accomplish the goal. |
Following @gabbersepp 's advice, one can modify the default mocha-junit-reporter to match CircleCI's expectations for XML. I have done this in the local project and may extrapolate this further to a forked repo and PR for mocha-junit-reporter, but will need to determine if that is a course of action I'll be taking. To assist others who are willing to do a similar fork process, this is what I ended up changing: I am able to see partial CircleCI data come through. I am absolutely getting SOME timing data with SOME files now, at least, and pretty sure the rest may have to do with circle. Circle requires green build for timing data so still working through why missing data for some of the specs...not sure if its related to the fact that with parallel jobs, it seems to only pick the result from "one" container. Hence I will work with CircleCI if this doesnt do the trick 100%, but im confident this does solve the issues on the XML reporting side.
|
User facing changelog
Additional details
How has the user experience changed?
PR Tasks
cypress-documentation
?type definitions
?cypress.schema.json
?