Skip to content

Bug 2022720 Test Version Refactor: Refactor how the expanded row's components are rendered#1016

Open
kala-moz wants to merge 4 commits intomozilla:mainfrom
kala-moz:test-version-refactor-expanded-rows
Open

Bug 2022720 Test Version Refactor: Refactor how the expanded row's components are rendered#1016
kala-moz wants to merge 4 commits intomozilla:mainfrom
kala-moz:test-version-refactor-expanded-rows

Conversation

@kala-moz
Copy link
Contributor

@kala-moz kala-moz commented Mar 18, 2026

For bug: https://bugzilla.mozilla.org/show_bug.cgi?id=2022720

This PR continues the test version refactor work by removing the conditionals in RevisionRowExpandable by extending the methods in TestVersionStrategy to include components rendered in the expanded rows: expanded left, expanded right, expanded bottom, and getComparisonResult.

//src/common/testVersions/index.ts

export interface TestVersionStrategy {
  getColumns(isSubtestTable: boolean): TableConfig;
  getAvgValues(result: CombinedResultsItemType): {
    baseAvg: number | null;
    newAvg: number | null;
  };
  renderColumns(result: CombinedResultsItemType): ReactNode;
  renderExpandedLeft(result: CombinedResultsItemType): ReactNode;
  getComparisonResult(result: CombinedResultsItemType): string;
  renderExpandedRight(result: CombinedResultsItemType): ReactNode;
  renderExpandedBottom(result: CombinedResultsItemType): ReactNode;
}

Next, the components specific to the test versions were moved from the RevisionRowExpanded to the appropriate test version files. For example:

//src/common/testVersions/mannWhitney.tsx
...
  renderExpandedBottom(result: CombinedResultsItemType) {
    const mwResult = result as MannWhitneyResultsItem;
    return (
      <div style={{ display: 'flex' }}>
        <MannWhitneyCompareMetrics result={mwResult} />
        <StatisticsWarnings result={mwResult} />
      </div>
    );
  },

Now, RevisionRowExpanded just calls the strategy interface to render the components based on the test version.

//RevisionRowExpandable.tsx

...
  const strategy = getStrategy(testVersion);
...
   {strategy.renderExpandedLeft(result)} etc...

Added new methods to the strategy interface: expanded left, expanded right, expanded bottom, and getComparisonreResult
@netlify
Copy link

netlify bot commented Mar 18, 2026

Deploy Preview for mozilla-perfcompare ready!

Name Link
🔨 Latest commit 20cd78b
🔍 Latest deploy log https://app.netlify.com/projects/mozilla-perfcompare/deploys/69bb32a37d58720008210b8d
😎 Deploy Preview https://deploy-preview-1016--mozilla-perfcompare.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@kala-moz kala-moz marked this pull request as draft March 18, 2026 01:17
@kala-moz kala-moz changed the title BUG: 2022720 Moved test version specific components to the specific test version files Bug: 2022720 Test Version Refactor: Refactor the expanded rows components Mar 18, 2026
@kala-moz kala-moz changed the title Bug: 2022720 Test Version Refactor: Refactor the expanded rows components Bug: 2022720 Test Version Refactor: Refactor how the expanded row's components are rendered Mar 18, 2026
@codecov
Copy link

codecov bot commented Mar 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.45%. Comparing base (cdca3ee) to head (20cd78b).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1016      +/-   ##
==========================================
- Coverage   96.46%   96.45%   -0.01%     
==========================================
  Files         109      109              
  Lines        3051     3050       -1     
  Branches      691      686       -5     
==========================================
- Hits         2943     2942       -1     
  Misses        107      107              
  Partials        1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kala-moz kala-moz marked this pull request as ready for review March 18, 2026 23:31
@kala-moz kala-moz changed the title Bug: 2022720 Test Version Refactor: Refactor how the expanded row's components are rendered Bug 2022720 Test Version Refactor: Refactor how the expanded row's components are rendered Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant