box_plot.test.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. describe('Visualization > Box Plot', () => {
  20. beforeEach(() => {
  21. cy.intercept('POST', '**/api/v1/chart/data*').as('getJson');
  22. });
  23. const BOX_PLOT_FORM_DATA = {
  24. datasource: '2__table',
  25. viz_type: 'box_plot',
  26. slice_id: 49,
  27. granularity_sqla: 'year',
  28. time_grain_sqla: 'P1D',
  29. time_range: '1960-01-01 : now',
  30. metrics: ['sum__SP_POP_TOTL'],
  31. adhoc_filters: [],
  32. groupby: ['region'],
  33. limit: '25',
  34. color_scheme: 'bnbColors',
  35. whisker_options: 'Min/max (no outliers)',
  36. };
  37. function verify(formData) {
  38. cy.visitChartByParams(formData);
  39. cy.verifySliceSuccess({ waitAlias: '@getJson' });
  40. }
  41. it('should work', () => {
  42. verify(BOX_PLOT_FORM_DATA);
  43. cy.get('.chart-container .box_plot canvas').should('have.length', 1);
  44. });
  45. it('should allow type to search color schemes', () => {
  46. verify(BOX_PLOT_FORM_DATA);
  47. cy.get('#controlSections-tab-CUSTOMIZE').click();
  48. cy.get('.Control[data-test="color_scheme"]').scrollIntoView();
  49. cy.get('.Control[data-test="color_scheme"] input[type="search"]').focus();
  50. cy.focused().type('supersetColors{enter}');
  51. cy.get(
  52. '.Control[data-test="color_scheme"] .ant-select-selection-item [data-test="supersetColors"]',
  53. ).should('exist');
  54. });
  55. });