Skip to content

feat(Codecov): add test analytics table #91832

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

Merged
merged 5 commits into from
May 22, 2025

Conversation

adrianviquez
Copy link
Contributor

@adrianviquez adrianviquez commented May 16, 2025

This PR creates the base table layout for the Test Analytics Codecov page.

Screenshot 2025-05-16 at 2 08 08 PM

Notes

  • Adds Table component that implements GridEditable header with relevant parameters.
  • Uses Table component in Test pages with temporary mock data
  • Adds renderBody and renderHeader functions that render body and header components accordingly.
  • Adds SortableHeader component. This is a custom component that lets you specify sorting directions and tooltips when necessary - sorting itself isn't working since it's waiting on Codecov backend implementation.
  • Tests will come in a later PR to help w/ reviewing
  • There are some minor differences with the design that I've spoken to w/ the design team. We'll revaluate those in another PR after further discussion with the team.

@adrianviquez adrianviquez requested a review from a team as a code owner May 16, 2025 21:09
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 16, 2025
return (
<p>
Shows how often a flake occurs by tracking how many times a test goes from fail to
pass or pass to fail ona given branch and commit within the last {dateSelector}.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: ona

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrap in tct here

const location = useLocation();

// TODO: Sorting will only work once this is connected to the API
const fakeApiResponse = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this fake response is what we expect to be returned from the hook, right? So we'll do some transformation logic or something in there rather than on the Backend

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i.e. for broken test. So what would be a computed value in the GQL resolver ends up being a computed value in our hook. Could also do it on the BE too either in codecov or in the endpoint as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'll inevitably revise this as needed once we get a couple of routes sorted and better understand the pattern, so I'm okay leaving this as is for now and adjusting code in the backend or hook or whatever, does that make sense?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's chill with me

text-align: ${p => (p.alignment === 'left' ? 'left' : 'right')};
`;

const SortLink = styled(Link)`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we could rename this like what we discussed earlier so it reduces confusion with the other SortLink component

Comment on lines +17 to +25
export type Row = Pick<
TestAnalyticsTableResponse,
| 'testName'
| 'averageDurationMs'
| 'flakeRate'
| 'commitsFailed'
| 'lastRun'
| 'isBrokenTest'
>;
Copy link
Contributor

@calvin-codecov calvin-codecov May 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific reason why we're using Pick here and picking everything instead of using the TestAnalyticsTableResponse type directly or setting Row = TestAnalyticsTableResponse? Are we implying that new response fields may not automatically want to be added to Row?

Copy link
Contributor Author

@adrianviquez adrianviquez May 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My read here was that your row values don't need to necessarily follow the backend response. I think makes sense that an api response (or one after it's transformed from the hooks) exclusively contain the values you'll use in the table. We might fetch more data but we only care about the items relevant to the table.

I think this gives room for the api response to expand as needed without coupling it w/ the table/ui. There's an argument to how that shouldn't happen but yeah I think that'd lead to the API being more coupled to the design

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fair. Cool, I'd say just leave it then for the implication that it can be decoupled.


const COLUMNS_ORDER: Column[] = [
{key: 'testName', name: t('Test Name'), width: COL_WIDTH_UNDEFINED},
{key: 'averageDurationMs', name: t('Avg. Duration'), width: COL_WIDTH_UNDEFINED},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any idea if t() would know how to translate abbreviations like "Avg."? I'm guessing it wouldn't

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a strong feel for it, but it might worth bringing up in a design sync as a consideration when thinking on abbreviations. Seems to me like this could be some antipattern design wise?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll make a note to bring up

Copy link

codecov bot commented May 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #91832      +/-   ##
==========================================
- Coverage   87.64%   86.46%   -1.19%     
==========================================
  Files       10350    10348       -2     
  Lines      586586   586564      -22     
  Branches    22574    22574              
==========================================
- Hits       514115   507166    -6949     
- Misses      72026    78953    +6927     
  Partials      445      445              

@adrianviquez adrianviquez merged commit 4525724 into master May 22, 2025
41 checks passed
@adrianviquez adrianviquez deleted the adrian/add-test-analytics-table branch May 22, 2025 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants