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

test: Adds tests to dnd controls #13650

Conversation

michael-s-molina
Copy link
Member

@michael-s-molina michael-s-molina commented Mar 16, 2021

SUMMARY

Adds tests to dnd controls.

@kgabryje We are auditing the codebase of Explore searching for components that don’t have sufficient test coverage (at least 80%). We are using Codecov reports to find the components. From what I understood this feature is still in POC mode, right? Anyway, I added some test files here to help with the test coverage and serve as a base for more complete tests. Can you please review it?

PS: DndMetricSelect.test.tsx has only one test. After we add typescript support to DndMetricSelect props we should complement this.

TEST PLAN

1 - Execute all drag and drop tests.
2 - All tests should pass.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Requires DB Migration.
  • Confirm DB Migration upgrade and downgrade tested.
  • Introduces new feature or API
  • Removes existing feature or API

@codecov
Copy link

codecov bot commented Mar 16, 2021

Codecov Report

Merging #13650 (fb3e759) into master (9156f08) will increase coverage by 0.31%.
The diff coverage is 100.00%.

❗ Current head fb3e759 differs from pull request most recent head d2526b7. Consider uploading reports for the commit d2526b7 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #13650      +/-   ##
==========================================
+ Coverage   77.83%   78.14%   +0.31%     
==========================================
  Files         934      934              
  Lines       47320    47320              
  Branches     5913     5929      +16     
==========================================
+ Hits        36831    36980     +149     
+ Misses      10346    10197     -149     
  Partials      143      143              
Flag Coverage Δ
cypress 56.03% <0.00%> (ø)
javascript 65.31% <100.00%> (+0.68%) ⬆️

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

Impacted Files Coverage Δ
...ponents/controls/DndColumnSelectControl/Option.tsx 100.00% <ø> (ø)
...ontrols/DndColumnSelectControl/DndColumnSelect.tsx 58.06% <100.00%> (+35.48%) ⬆️
...ontrols/DndColumnSelectControl/DndFilterSelect.tsx 45.38% <100.00%> (+36.15%) ⬆️
...ontrols/DndColumnSelectControl/DndMetricSelect.tsx 43.65% <100.00%> (+33.33%) ⬆️
.../controls/DndColumnSelectControl/OptionWrapper.tsx 84.84% <100.00%> (ø)
...set-frontend/src/dashboard/util/getDropPosition.js 90.90% <0.00%> (ø)
...ntrols/MetricControl/AdhocMetricPopoverTrigger.tsx 95.00% <0.00%> (+1.66%) ⬆️
...ntrols/FilterControl/AdhocFilterPopoverTrigger.tsx 72.00% <0.00%> (+4.00%) ⬆️
...ols/DndColumnSelectControl/utils/optionSelector.ts 34.48% <0.00%> (+31.03%) ⬆️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9156f08...d2526b7. Read the comment docs.

@junlincc
Copy link
Member

@michael-s-molina Thanks for adding test to dnd, this feature is completed for phase 1 poc and is still evolving rapidly. there's no harm adding test though. 🙏 @kgabryje please review with a grey check mark, hopefully it turns green in days. 😉

@junlincc junlincc added the explore:drag&drop Related to drag&drop in Explore label Mar 17, 2021
@kgabryje
Copy link
Member

1 nit, other than that LGTM!
In the future we can also try to test drag and drop functionality itself as react-dnd library provides tools for testing: https://react-dnd.github.io/react-dnd/docs/testing

Copy link
Member

@pkdotson pkdotson left a comment

Choose a reason for hiding this comment

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

LGTM!

<Option
index={index}
clickClose={clickClose}
onShiftOptions={onShiftOptions}
Copy link
Member

Choose a reason for hiding this comment

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

Not sure exactly sure what the implications/risks may be of removing this, if any.

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 checked when I removed it 😉. Nice observation though!

export const DragContainer = styled.div`
  margin-bottom: ${({ theme }) => theme.gridUnit}px;
  :last-child {
    margin-bottom: 0;
  }
`;

@michael-s-molina michael-s-molina force-pushed the tests-audit-dnd-column-select-control branch from 9397305 to d2526b7 Compare April 1, 2021 11:22
Copy link
Member

@rusackas rusackas left a comment

Choose a reason for hiding this comment

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

LGTM!

@rusackas rusackas merged commit 42c7e2c into apache:master Apr 1, 2021
amitmiran137 pushed a commit that referenced this pull request Apr 2, 2021
* master: (26 commits)
  chore: bump to new superset-ui version (#13932)
  fix: do not run containers as root by default in Helm chart (#13917)
  feat(explore): adhoc column formatting for Table chart (#13758)
  fix(sqla-query): order by aggregations in Presto and Hive (#13739)
  feat(alert/report): add ALERTS_ATTACH_REPORTS feature flags + feature (#13894)
  test: Fixes PropertiesModal_spec (#13548)
  fix: Pin Prophet dependency after breaking changes (#13852)
  test: Adds tests to dnd controls (#13650)
  test: Adds tests to the AnnotationLayer component (#13748)
  test: Refactor and enhance tests for the Explore DatasourcePanel Component (#13799)
  Add tests (#13778)
  test: DisplayQueryButton (#13750)
  Fixing condition around left margin for dashboard layout. Fixes #13863 (#13905)
  Revert "fix: select table overlay (#13694)" (#13901)
  test: Adds tests to the OptionControls component (#13729)
  test: DatasourceControl (#13605)
  tests for function handleScroll (#13896)
  test: Adds tests to the CustomFrame component (#13675)
  test: Adds tests to the AdvancedFrame component (#13664)
  test: DataTableControl (#13668)
  ...
lyndsiWilliams pushed a commit to preset-io/superset that referenced this pull request Apr 7, 2021
allanco91 pushed a commit to allanco91/superset that referenced this pull request May 21, 2021
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.2.0 labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels explore:drag&drop Related to drag&drop in Explore size/L test:component 🚢 1.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants