codecov / browser-extension

Codecov Browser Extension
http://codecov.io
Apache License 2.0
214 stars 60 forks source link

bbs extension #42

Closed naglalakk closed 6 years ago

naglalakk commented 7 years ago

Latest progress on the bitbucket_server extension. This might still need a bit of tidying up.

naglalakk commented 7 years ago

So just to comment briefly on this. Most views are now working properly. The biggest issue was with the pull-requests/diff view because there was no easy way to pull out the commit ids being compared for each diff without interacting with the Bitbucket Server UI. The commit list for each pull request within a diff view is stored in a drop down list and these ids are not fetched unless the user specifically clicks this dropdown. The first implementation included a click through jquery so the list could be fetched. However this is unacceptable for the user since he would see a dropdown opening and closing when looking at a diff. If I was using an extension that required this I would personally stop using it instantly. So to bypass this I discovered that I am able to call BBS API directly. The call to the API returns a list of all commits within a pull requests. Each commit object has a link to its parents. This way we can safely retrieve the list of commits within a pull request without having to fiddle with the UI.

Obstacles The hardest part is knowing when to update a view. All of the views use javascript heavily to update the views and multiple elements are being re-rendered all the time (e.g.: single file view is re-rendered on window resize). To handle this we pick specific DOM elements that we know will be updated with the next UI updates and bind them to a DOMSubtreeModified event. When the UI is updated the event is triggered and runs the update_view function after a fixed timeout (currently 1500 ms)

Testing This has not been tested thoroughly and currently all builds are failing. I suggest that we wait with merging this pr and bumping the version until we have a soldid testing method for this part of the code. One thing we could do is try to create a docker environment that runs both bbs and codecov enterprise in an environment with data already setup with repos and code coverage reports. My point here being that even if we can mock the current setup for bbs these tests would be counterproductive. The bbs pages cannot really be tested with static html pages because so much of the data comes through javascript. Another idea would be to just manually test this whenever a new version of bbs is out. Automation could be hard since a setup requires some interaction by the user unless we find a solid way of running both bbs and codecov enterprise with a fixed license and data.

This plugin has currently been tested manually on Chrome Version 56.0.2924.87 (64-bit).

naglalakk commented 7 years ago

@woot2531 any questions on this. It has not been merged into master so it should not be the cause of issue #43. We are still testing this with bbs so this pr is only for viewing the latest updates.