advanced_analytics.test.ts 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. import { interceptV1ChartData } from './utils';
  20. describe('Advanced analytics', () => {
  21. beforeEach(() => {
  22. interceptV1ChartData();
  23. cy.intercept('PUT', '**/api/v1/explore/**').as('putExplore');
  24. cy.intercept('GET', '**/explore/**').as('getExplore');
  25. });
  26. it('Create custom time compare', () => {
  27. cy.visitChartByName('Num Births Trend');
  28. cy.verifySliceSuccess({ waitAlias: '@v1Data' });
  29. cy.get('.ant-collapse-header')
  30. .contains('Advanced analytics')
  31. .click({ force: true });
  32. cy.get('[data-test=time_compare]').find('.ant-select').click();
  33. cy.get('[data-test=time_compare]')
  34. .find('input[type=search]')
  35. .type('28 days{enter}');
  36. cy.get('[data-test=time_compare]').find('input[type=search]').clear();
  37. cy.get('[data-test=time_compare]')
  38. .find('input[type=search]')
  39. .type('1 year{enter}');
  40. cy.get('button[data-test="run-query-button"]').click();
  41. cy.wait('@v1Data');
  42. cy.wait('@putExplore');
  43. cy.reload();
  44. cy.verifySliceSuccess({
  45. waitAlias: '@v1Data',
  46. });
  47. cy.wait('@getExplore');
  48. cy.get('.ant-collapse-header')
  49. .contains('Advanced analytics')
  50. .click({ force: true });
  51. cy.get('[data-test=time_compare]')
  52. .find('.ant-select-selector')
  53. .contains('28 days');
  54. cy.get('[data-test=time_compare]')
  55. .find('.ant-select-selector')
  56. .contains('1 year');
  57. });
  58. });