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

Notebook jest updates #1307

Merged
merged 14 commits into from
Jan 9, 2024
Merged

Conversation

ps48
Copy link
Member

@ps48 ps48 commented Dec 19, 2023

Description

  1. Addresses notebook support issues with observability visualizations.
  2. Updates and enhances existing tests.
  3. Boosts test coverage for notebook components to reach 68%.
  4. Resolves lint errors in the notebook codebase.
public/components/notebooks/components                   |   68.53 |    56.66 |    61.7 |   68.54 |
  note_table.tsx                                          |   95.89 |    88.88 |   93.33 |   95.89 | 137-138,329
  notebook.tsx                                            |   61.92 |    48.61 |   53.15 |   61.87 | ...1054-1060,1104
 public/components/notebooks/components/helpers           |   82.81 |    77.19 |   91.66 |   82.72 |
  default_parser.tsx                                      |   95.34 |     87.5 |     100 |   95.34 | 23,75
  legacy_route_helpers.ts                                 |     100 |      100 |     100 |     100 |
  modal_containers.tsx                                    |     100 |      100 |     100 |     100 |
  reporting_context_menu_helper.tsx                       |   66.66 |    66.66 |   76.92 |   66.25 | ...3-48,78,80,100
  zeppelin_parser.tsx                                     |   91.83 |    83.33 |     100 |   91.83 | 87-91
 ...components/notebooks/components/helpers/custom_modals |     100 |      100 |     100 |     100 |
  custom_input_modal.tsx                                  |     100 |      100 |     100 |     100 |
  reporting_loading_modal.tsx                             |     100 |      100 |     100 |     100 |
 .../components/notebooks/components/paragraph_components |   71.19 |    69.81 |   54.28 |   71.79 |
  para_input.tsx                                          |   54.34 |    56.25 |   56.25 |   55.81 | ...44,173-199,220
  para_output.tsx                                         |   98.21 |    84.61 |   83.33 |   98.21 | 134
  para_query_grid.tsx                                     |   69.69 |    18.18 |   33.33 |   73.33 | ...4,68,71-72,108
  paragraphs.tsx                                          |   64.81 |    77.35 |   55.55 |    63.8 | ...48-376,411,456

Issues Resolved

#1338

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented.
    • New functionality has javadoc added
    • New functionality has user manual doc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Copy link

codecov bot commented Dec 19, 2023

Codecov Report

Attention: 12 lines in your changes are missing coverage. Please review.

Comparison is base (c241368) 51.31% compared to head (5ad0dbd) 52.92%.

Files Patch % Lines
...ublic/components/notebooks/components/notebook.tsx 36.84% 12 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1307      +/-   ##
==========================================
+ Coverage   51.31%   52.92%   +1.61%     
==========================================
  Files         303      302       -1     
  Lines       10586    10587       +1     
  Branches     2778     2777       -1     
==========================================
+ Hits         5432     5603     +171     
+ Misses       5108     4939     -169     
+ Partials       46       45       -1     
Flag Coverage Δ
dashboards-observability 52.92% <72.72%> (+1.61%) ⬆️

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

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

@ps48 ps48 marked this pull request as ready for review December 19, 2023 16:59
@ps48 ps48 marked this pull request as draft December 19, 2023 17:09
@ps48 ps48 force-pushed the notebook_jest_updates branch from c6a4be2 to cc09644 Compare December 21, 2023 22:11
@ps48 ps48 force-pushed the notebook_jest_updates branch 2 times, most recently from db13083 to 99bdc51 Compare January 3, 2024 21:30
@ps48 ps48 marked this pull request as ready for review January 5, 2024 00:15
Copy link
Collaborator

@Swiddis Swiddis left a comment

Choose a reason for hiding this comment

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

Non-blocking issues

return this.state.parsedPara
.map((para: ParaType, index: number) => () => reducer(para, index))
.map((para: ParaType, _index: number) => () => reducer(para, _index))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a reason we update _index to indicate it's unused, while using it in reducer?

Copy link
Member Author

Choose a reason for hiding this comment

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

The linter is not able to understand that index is used in reducer and leads to no-unused-vars error. So marked this one as an internal variable.

const { getByText, getByLabelText, queryByText } = renderNoteTable({ notebooks });

// Select a notebook
fireEvent.click(getByLabelText('Select this row'));
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's a lot of duplicated navigation logic here based on label text, that seems like something that's likely to break over time. Should there be a helper for this navigation, or a better selector?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll leave this one as is for now. I'm updating some of these with cypress.

test/sample_default_notebooks.tsx Outdated Show resolved Hide resolved
ps48 added 5 commits January 5, 2024 11:16
Signed-off-by: Shenoy Pratik <[email protected]>
Signed-off-by: Shenoy Pratik <[email protected]>
Signed-off-by: Shenoy Pratik <[email protected]>
@ps48 ps48 force-pushed the notebook_jest_updates branch from e78034e to a817e66 Compare January 5, 2024 19:21
ps48 added 4 commits January 8, 2024 14:22
Signed-off-by: Shenoy Pratik <[email protected]>
Signed-off-by: Shenoy Pratik <[email protected]>
Signed-off-by: Shenoy Pratik <[email protected]>
@ps48 ps48 force-pushed the notebook_jest_updates branch from 482806e to 5ad0dbd Compare January 8, 2024 23:01
@ps48 ps48 merged commit de90b01 into opensearch-project:main Jan 9, 2024
12 of 20 checks passed
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/dashboards-observability/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/dashboards-observability/backport-2.x
# Create a new branch
git switch --create backport/backport-1307-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 de90b01508a39117f6aa9115c073eff8229c0f56
# Push it to GitHub
git push --set-upstream origin backport/backport-1307-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/dashboards-observability/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-1307-to-2.x.

ps48 added a commit to ps48/dashboards-observability that referenced this pull request Jan 9, 2024
* fix support for observability visualizations

Signed-off-by: Shenoy Pratik <[email protected]>

* update note_table tests

Signed-off-by: Shenoy Pratik <[email protected]>

* notebook.tsx test first update

Signed-off-by: Shenoy Pratik <[email protected]>

* update paragraph/notebook action tests

Signed-off-by: Shenoy Pratik <[email protected]>

* lint fixes

Signed-off-by: Shenoy Pratik <[email protected]>

* updating paragraph components

Signed-off-by: Shenoy Pratik <[email protected]>

* add test for rendering error in query

Signed-off-by: Shenoy Pratik <[email protected]>

* snapshot updates and adding missing tests

Signed-off-by: Shenoy Pratik <[email protected]>

* remove unnecessary jest mock import

Signed-off-by: Shenoy Pratik <[email protected]>

* history.push jest function added

Signed-off-by: Shenoy Pratik <[email protected]>

* merge notebooks tests contants file

Signed-off-by: Shenoy Pratik <[email protected]>

* make tests more atomic

Signed-off-by: Shenoy Pratik <[email protected]>

* updated snapshot

Signed-off-by: Shenoy Pratik <[email protected]>

* atomicized code block checks

Signed-off-by: Shenoy Pratik <[email protected]>

---------

Signed-off-by: Shenoy Pratik <[email protected]>
(cherry picked from commit de90b01)
ps48 added a commit that referenced this pull request Jan 9, 2024
* Notebook jest updates  (#1307)

* fix support for observability visualizations

Signed-off-by: Shenoy Pratik <[email protected]>

* update note_table tests

Signed-off-by: Shenoy Pratik <[email protected]>

* notebook.tsx test first update

Signed-off-by: Shenoy Pratik <[email protected]>

* update paragraph/notebook action tests

Signed-off-by: Shenoy Pratik <[email protected]>

* lint fixes

Signed-off-by: Shenoy Pratik <[email protected]>

* updating paragraph components

Signed-off-by: Shenoy Pratik <[email protected]>

* add test for rendering error in query

Signed-off-by: Shenoy Pratik <[email protected]>

* snapshot updates and adding missing tests

Signed-off-by: Shenoy Pratik <[email protected]>

* remove unnecessary jest mock import

Signed-off-by: Shenoy Pratik <[email protected]>

* history.push jest function added

Signed-off-by: Shenoy Pratik <[email protected]>

* merge notebooks tests contants file

Signed-off-by: Shenoy Pratik <[email protected]>

* make tests more atomic

Signed-off-by: Shenoy Pratik <[email protected]>

* updated snapshot

Signed-off-by: Shenoy Pratik <[email protected]>

* atomicized code block checks

Signed-off-by: Shenoy Pratik <[email protected]>

---------

Signed-off-by: Shenoy Pratik <[email protected]>
(cherry picked from commit de90b01)

* update para_query_grid

Signed-off-by: Shenoy Pratik <[email protected]>

---------

Signed-off-by: Shenoy Pratik <[email protected]>
amsiglan pushed a commit to amsiglan/dashboards-observability that referenced this pull request Jun 7, 2024
…earch-project#1346)

* Notebook jest updates  (opensearch-project#1307)

* fix support for observability visualizations

Signed-off-by: Shenoy Pratik <[email protected]>

* update note_table tests

Signed-off-by: Shenoy Pratik <[email protected]>

* notebook.tsx test first update

Signed-off-by: Shenoy Pratik <[email protected]>

* update paragraph/notebook action tests

Signed-off-by: Shenoy Pratik <[email protected]>

* lint fixes

Signed-off-by: Shenoy Pratik <[email protected]>

* updating paragraph components

Signed-off-by: Shenoy Pratik <[email protected]>

* add test for rendering error in query

Signed-off-by: Shenoy Pratik <[email protected]>

* snapshot updates and adding missing tests

Signed-off-by: Shenoy Pratik <[email protected]>

* remove unnecessary jest mock import

Signed-off-by: Shenoy Pratik <[email protected]>

* history.push jest function added

Signed-off-by: Shenoy Pratik <[email protected]>

* merge notebooks tests contants file

Signed-off-by: Shenoy Pratik <[email protected]>

* make tests more atomic

Signed-off-by: Shenoy Pratik <[email protected]>

* updated snapshot

Signed-off-by: Shenoy Pratik <[email protected]>

* atomicized code block checks

Signed-off-by: Shenoy Pratik <[email protected]>

---------

Signed-off-by: Shenoy Pratik <[email protected]>
(cherry picked from commit de90b01)

* update para_query_grid

Signed-off-by: Shenoy Pratik <[email protected]>

---------

Signed-off-by: Shenoy Pratik <[email protected]>
(cherry picked from commit 5454b17)
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.

3 participants