Skip to content
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

chore: tests for Searches component (ET-198) #9576

Merged
merged 8 commits into from
Jul 3, 2024
Merged

chore: tests for Searches component (ET-198) #9576

merged 8 commits into from
Jul 3, 2024

Conversation

johnkim-det
Copy link
Contributor

@johnkim-det johnkim-det commented Jun 26, 2024

Ticket

ET-198

Description

Add tests to Searches component

Test Plan

No additional testing required, automated tests should pass.

Checklist

  • Changes have been manually QA'd
  • New features have been approved by the corresponding PM
  • User-facing API changes have the "User-facing API Change" label
  • Release notes have been added as a separate file under docs/release-notes/
    See Release Note for details.
  • Licenses have been included for new code which was copied and/or modified from any external code

@johnkim-det johnkim-det requested a review from a team as a code owner June 26, 2024 16:40
@johnkim-det johnkim-det requested a review from gt2345 June 26, 2024 16:40
@cla-bot cla-bot bot added the cla-signed label Jun 26, 2024
@johnkim-det johnkim-det requested review from keita-determined and removed request for gt2345 June 26, 2024 16:40
Copy link

netlify bot commented Jun 26, 2024

Deploy Preview for determined-ui ready!

Name Link
🔨 Latest commit 7f0ada4
🔍 Latest deploy log https://app.netlify.com/sites/determined-ui/deploys/66845b809ab1910008877d2e
😎 Deploy Preview https://deploy-preview-9576--determined-ui.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 site configuration.

Copy link

codecov bot commented Jun 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 47.43%. Comparing base (84072f6) to head (7f0ada4).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9576      +/-   ##
==========================================
- Coverage   51.36%   47.43%   -3.93%     
==========================================
  Files        1252      929     -323     
  Lines      152174   123056   -29118     
  Branches     3024     3130     +106     
==========================================
- Hits        78158    58369   -19789     
+ Misses      73858    64534    -9324     
+ Partials      158      153       -5     
Flag Coverage Δ
harness ?
web 49.98% <100.00%> (+1.99%) ⬆️

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

Files Coverage Δ
webui/react/src/components/ColumnPickerMenu.tsx 95.87% <100.00%> (ø)
webui/react/src/components/Searches/Searches.tsx 56.49% <100.00%> (+56.49%) ⬆️

... and 334 files with indirect coverage changes

MikhailKardash added a commit that referenced this pull request Jun 26, 2024
* rerun bumpenvs after cherry-pick of #9576
@johnkim-det
Copy link
Contributor Author

Saw that some tests were failing in CI so I've reverted the dependency update, which still makes the act warnings appear.

I do think these warnings are not unique to this PR and are appearing throughout our test suite.

It looks like this is something that's an issue in @testing-library/react which was fixed in version 14 (https://github.com/testing-library/react-testing-library/releases/tag/v14.0.0). However, upgrading to that version breaks other tests. My thinking here is that we should just create a separate task for updating this library version: https://hpe-aiatscale.atlassian.net/browse/ET-608

Copy link
Contributor

@keita-determined keita-determined left a comment

Choose a reason for hiding this comment

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

do we also need to get 80% coverage for this kind of tests? right now, the cov is 47.43%

for the warnings, i think we can come back when upgrading the testing libraries

Comment on lines +107 to +109
await waitFor(() => {
expect(screen.getByText('2 searches')).toBeInTheDocument();
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
await waitFor(() => {
expect(screen.getByText('2 searches')).toBeInTheDocument();
});
expect(await screen.findByText('2 searches')).toBeInTheDocument();

Comment on lines +116 to +119
await waitFor(() => {
expect(screen.getByText('0 searches')).toBeInTheDocument();
expect(screen.getByText('No Searches')).toBeInTheDocument();
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
await waitFor(() => {
expect(screen.getByText('0 searches')).toBeInTheDocument();
expect(screen.getByText('No Searches')).toBeInTheDocument();
});
expect(await screen.findByText('0 searches')).toBeInTheDocument();
expect(await screen.findByText('No Searches')).toBeInTheDocument();

webui/react/src/components/Searches/Searches.test.tsx Outdated Show resolved Hide resolved
webui/react/src/components/Searches/Searches.test.tsx Outdated Show resolved Hide resolved
@@ -873,7 +875,16 @@ const Searches: React.FC<Props> = ({ project }) => {
<div className={css.content} ref={contentRef}>
{!isLoading && experiments.length === 0 ? (
numFilters === 0 ? (
<NoExperiments />
<Message
Copy link
Contributor

Choose a reason for hiding this comment

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

qq: what is the reason to replace <NoExperiments />?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Want it to say "Searches" instead of "Experiments"

webui/react/src/components/Searches/Searches.test.tsx Outdated Show resolved Hide resolved
@johnkim-det
Copy link
Contributor Author

I think code cov report is saying there's full coverage, the 47.43% is project-level coverage?

Also I think a couple of the waitFors are necessary but removing the unnecessary ones and the unnecessary Providers.

@keita-determined
Copy link
Contributor

I think code cov report is saying there's full coverage, the 47.43% is project-level coverage?

oh yes i always get confused

Also I think a couple of the waitFors are necessary but removing the unnecessary ones and the unnecessary Providers.

i tested them without waitFor and it worked well on my local though. not sure

Copy link
Contributor

@keita-determined keita-determined left a comment

Choose a reason for hiding this comment

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

\o/

@johnkim-det johnkim-det merged commit d159f14 into main Jul 3, 2024
81 of 94 checks passed
@johnkim-det johnkim-det deleted the ET-198 branch July 3, 2024 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants