sitespeedio / chrome-har

Create HAR files from Chrome Debugging Protocol data
MIT License
149 stars 50 forks source link

SPA without Page navigation events? #52

Open kohlerm opened 5 years ago

kohlerm commented 5 years ago

I'm trying to automate a test with puppeteer where I generate a har file after each interaction step. Since it is an SPA I do not get Page navigation events. Because of that I do not get any results except for the intial page where I do have a page event. During debugging I could see that the events are captured but the nr. of pages is 0. It also does not seem to be related to puppeteer because I checked the events when manually navigating the page.

Any hints what I can do? I can maybe clone the code and throw out all page event handling, because effectively I do not need those events. Any better option?

soulgalore commented 5 years ago

Hi @kohlerm in Browsertime we inject a navigation event in the trace, I think you should do that in the trace from Puppeteer too.

Best Peter

nathdebashish commented 4 years ago

I'm trying to automate a test with puppeteer where I generate a har file after each interaction step. Since it is an SPA I do not get Page navigation events. Because of that I do not get any results except for the intial page where I do have a page event. During debugging I could see that the events are captured but the nr. of pages is 0. It also does not seem to be related to puppeteer because I checked the events when manually navigating the page.

Any hints what I can do? I can maybe clone the code and throw out all page event handling, because effectively I do not need those events. Any better option?

interested to know how to resolve for SPA..

Thanks Debashish

kohlerm commented 4 years ago

Hi @nathdebashish sorry for the late reply, missed your comment. I forked chrome-har https://github.com/kohlerm/chrome-har made some changes to inject a fake navigation event. I also had to add some sanity checks to avoid exception in case some data was missing. This might have been be caused by the fact that my test does not always wait long enough after each interaction. for the one test I'm currently running it is working fine. I would not call it production ready ;-)

soulgalore commented 4 years ago

The problem is that the trace log events aren't sorted and can come in different order. For example if you test two pages, clear the log after each URL but keep Chrome open, it can happen that you get an event for the first URL when you test the second one, that breaks Tracium for example, and I think we haven't had the best handling for that either. @kohlerm if you have some better error handling than today it would be super if you could PR it back :)

kohlerm commented 4 years ago

I ran into https://github.com/sitespeedio/sitespeed.io/issues/2645 and fixed it in similiar way. got a few merge conflicts need to sort those out. I had for example sometimes the problem that there was no response, which resulted in an exception.