InvenTree icon indicating copy to clipboard operation
InvenTree copied to clipboard

Added test statistics

Open martonmiklos opened this issue 1 year ago • 4 comments

Fixed #5995

This PR adds test statistics views to the part and build pages which provides overview about the accumulated count of the passed/failed tests.

martonmiklos avatar May 05 '24 19:05 martonmiklos

Deploy Preview for inventree-web-pui-preview ready!

Name Link
Latest commit 375ad66fa7c1d84629169b937c9986a554900a44
Latest deploy log https://app.netlify.com/sites/inventree-web-pui-preview/deploys/66a9d0ad3daad60008d3872c
Deploy Preview https://deploy-preview-7164--inventree-web-pui-preview.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

Lighthouse
1 paths audited
Performance: 100 (no change from production)
Accessibility: 86 (no change from production)
Best Practices: 92 (no change from production)
SEO: 70 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar May 05 '24 19:05 netlify[bot]

Codecov Report

Attention: Patch coverage is 28.09917% with 87 lines in your changes missing coverage. Please review.

Project coverage is 83.46%. Comparing base (fdd9b7c) to head (375ad66). Report is 319 commits behind head on master.

Files with missing lines Patch % Lines
src/backend/InvenTree/stock/models.py 11.62% 38 Missing :warning:
.../frontend/src/tables/stock/TestStatisticsTable.tsx 5.55% 34 Missing :warning:
src/backend/InvenTree/stock/api.py 61.53% 10 Missing :warning:
src/backend/InvenTree/stock/serializers.py 54.54% 5 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7164      +/-   ##
==========================================
- Coverage   83.51%   83.46%   -0.05%     
==========================================
  Files        1114     1119       +5     
  Lines       49376    49741     +365     
  Branches     1568     1629      +61     
==========================================
+ Hits        41234    41517     +283     
- Misses       7746     7797      +51     
- Partials      396      427      +31     
Flag Coverage Δ
backend 85.24% <35.36%> (-0.10%) :arrow_down:
pui 64.36% <12.82%> (+1.13%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar May 05 '24 20:05 codecov[bot]

@martonmiklos can you please merge in the latest changes from master, and then I can review :)

SchrodingersGat avatar May 08 '24 01:05 SchrodingersGat

@martonmiklos can you please merge in the latest changes from master, and then I can review :)

@SchrodingersGat Done. There are two things what might need to be looked into:

  • As far as I saw filtering for datetime fields is not implemented in the PUI yet, so the date filtering is only available in the old UI.

  • I have not managed to hide the pagination (it does not makes any sense as we will always have 3 rows). I saw the enablePagination property, but it does not hide the pagination bar. Maybe I will report it to upstream if there is no trick to do that.

martonmiklos avatar May 08 '24 20:05 martonmiklos

@martonmiklos where are you at with this one? :)

SchrodingersGat avatar May 22 '24 09:05 SchrodingersGat

@martonmiklos where are you at with this one? :)

@SchrodingersGat could you please help how to properly specify links with two parameters here: https://github.com/martonmiklos/InvenTree/blob/a7cafc792e46c0e09441431126b4d3200328c983/src/backend/InvenTree/build/templates/build/build_base.html#L304 It works, but tests are failing, and I have not found any examples in the existing code.

martonmiklos avatar May 24 '24 19:05 martonmiklos

I would suggest that you make a "generic" test statistics endpoint, and rather than pinning it against specific database instances, pass those as query parameters you can filter by.

Then you can have a single API endpoint and you can filter by:

  • Stock Item
  • Part
  • Build Order
  • etc

SchrodingersGat avatar May 26 '24 23:05 SchrodingersGat

Hi there @martonmiklos!

  1. Is this done / ready for final review?
  2. Please stop force pushing/rebasing, this makes reviewing useless

matmair avatar Jul 03 '24 21:07 matmair

Hi there @martonmiklos!

1. Is this done / ready for final review?

2. Please stop force pushing/rebasing, this makes reviewing useless

Hi @matmair I tried to get the CI passing, but now I have no idea why (or is it related to my changes) the SQlite failed.

martonmiklos avatar Jul 03 '24 21:07 martonmiklos

@martonmiklos the sqlite test is currently broken for python 3.12, we are still struggling to understand this one. Are you happy with the PR otherwise?

SchrodingersGat avatar Jul 03 '24 22:07 SchrodingersGat

Please fix the conflicts here and if you're satisfied with this I'm happy to merge it in

SchrodingersGat avatar Jul 08 '24 23:07 SchrodingersGat

@martonmiklos apologies but it looks like there are still some conflicts. If you can address this in the next couple of days, I'll hold off merging anything else so that we can get this one done :)

SchrodingersGat avatar Jul 27 '24 10:07 SchrodingersGat

@martonmiklos apologies but it looks like there are still some conflicts. If you can address this in the next couple of days, I'll hold off merging anything else so that we can get this one done :)

Done!

martonmiklos avatar Jul 27 '24 18:07 martonmiklos

@martonmiklos a number of the frontend tests (playwright) are failing here - are they OK locally for you?

SchrodingersGat avatar Jul 29 '24 05:07 SchrodingersGat

@martonmiklos a number of the frontend tests (playwright) are failing here - are they OK locally for you?

I managed to get the PUI locally and discovered (together with an another issue in the old UI) that I messed up the API urls for PUI. Now it works locally.

martonmiklos avatar Jul 29 '24 06:07 martonmiklos

Ok, something is going on with the PUI tests, other PRs are failing too, when they should not be. I will have to look into this tomorrow

SchrodingersGat avatar Jul 30 '24 11:07 SchrodingersGat

@martonmiklos thanks for the hard work here :) I Have fixed the other PUI tests so this is good to go now. Thanks for the ongoing contributions!

SchrodingersGat avatar Jul 31 '24 06:07 SchrodingersGat

@martonmiklos when testing this on the "build order" page (for a part with only a small number of tests / results), there are a large number of queries running:

image

image

I'll open a new issue to address this, I would appreciate it if you could look into optimizing the API / database queries.

SchrodingersGat avatar Jul 31 '24 10:07 SchrodingersGat