taras42 / karma-jasmine-html-reporter

A Karma plugin. Dynamically displays tests results at debug.html page
MIT License
44 stars 17 forks source link

Would it be possible to scroll the first running spec into view? #3

Open Wizek opened 9 years ago

Wizek commented 9 years ago

When only a few is running with ?spec=DescribeName. Or is that something that could/should be a feature in jasmine itself?

taras42 commented 9 years ago

I don't quite understand. Do you mean if spec is somewhere at the bottom of a page, and you write in URL ?spec=DescribeName, it should scroll to that spec, is that correct?

Thanks.

Wizek commented 9 years ago

Yeah, something like that. I have been trying your reporter on a project with 1000+ specs and the resulting tree was quite very long. So when i was trying to focus with ?spec=DescribeName on something that was not at the very top and refresh, the relevant describes were no longer in view.

Is it clearer like this?

Wizek commented 9 years ago

I am still not quite sure if this could/should be a feature of your reporter or it should be part of jasmine. What do you think?

taras42 commented 9 years ago

That could be done from my side.

taras42 commented 9 years ago

I have started to implementing this.

taras42 commented 9 years ago

Hello. You may update. I published changes to npm. Say if it's ok, so I could close the issue.

Wizek commented 9 years ago

Nice! I am trying it right now.

Wizek commented 9 years ago

I've tried, and it works.

There are two things I noticed that I am not yet sure I like. Given we have something like

/* ... lots of describes before */
describe('description', function () {
  it('assertion', function () {
    expect(1).toBe(1)
  })
})
/* lots of describes after ... */

and we say ?spec=description then the first thing visible at the top of the screen is

  assertion

instead of

description
  assertion

Which means we lose some context. Maybe this could be solved by scrolling the first assertion into the middle of the window instead of to the top? Then more context would be visible.

The other thing is if there is a failing assert when I refresh, it always switches back to the stack traces from the tree view. Which I see how it can be helpful, but I think sometimes I would want to stay in tree view, because just having an overview of what fails might help more than knowing the stack traces of a few failures.

Wizek commented 9 years ago

The things I outlined in my above comment may be more suitable to have their own issues. If you agree I am okay if you close this issue, because the feature does work in a basic way.

I am also having some other focus nowadays, so maybe I will come back at a later time opening more issues and/or continuing the discussion about the subject.

taras42 commented 9 years ago

Hi, probably I will fix this in the way you described, so it would work how it must. I'm also busy a bit right now, so i just let you know when it's ready.

Wizek commented 9 years ago

Okay.

On Thu, 26 Mar 2015 at 22:09 taras42 notifications@github.com wrote:

Hi, probably I will fix this in the way you described, so it would work how it must. I'm also busy a bit right now, so i just let you know when it's ready.

— Reply to this email directly or view it on GitHub https://github.com/taras42/karma-jasmine-html-reporter/issues/3#issuecomment-86718971 .

taras42 commented 9 years ago

Hi, I changed the way of scrolling a bit. You can update and check if it's ok. About the fail tests in tree view, I'm going to changes that, maybe tree view + stack trace. But a bit later.