index.d.ts 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. // eslint-disable-next-line spaced-comment
  20. /// <reference types="cypress" />
  21. type JSONPrimitive = string | number | boolean | null;
  22. type JSONValue = JSONPrimitive | JSONObject | JSONArray;
  23. type JSONObject = { [member: string]: JSONValue };
  24. type JSONArray = JSONValue[];
  25. declare namespace Cypress {
  26. interface Chainable {
  27. /**
  28. * Login test user.
  29. */
  30. login(): void;
  31. /**
  32. *
  33. * Utils
  34. */
  35. getBySel(selector: string): cy;
  36. getBySelLike(selector: string): cy;
  37. cleanCharts(): cy;
  38. cleanDashboards(): cy;
  39. loadChartFixtures(): cy;
  40. loadDashboardFixtures(): cy;
  41. allowConsoleErrors(consoleMessages: (string | RegExp)[]): cy;
  42. visitChartByParams(params: string | Record<string, unknown>): cy;
  43. visitChartByName(name: string): cy;
  44. visitChartById(id: number): cy;
  45. /**
  46. * Verify slice container renders.
  47. */
  48. verifySliceContainer(chartSelector: JQuery.Selector): cy;
  49. /**
  50. * Verify slice successfully loaded.
  51. */
  52. verifySliceSuccess(options: {
  53. waitAlias: string;
  54. querySubstring?: string | RegExp;
  55. chartSelector?: JQuery.Selector;
  56. }): cy;
  57. /**
  58. * Get
  59. */
  60. getDashboards(): cy;
  61. getDashboard(dashboardId: string | number): Record<string, any>;
  62. getCharts(): cy;
  63. /**
  64. * Create
  65. */
  66. createSampleDashboards(indexes?: number[]): void;
  67. createSampleCharts(indexes?: number[]): void;
  68. /**
  69. * Delete
  70. */
  71. deleteDashboard(id: number, failOnStatusCode: boolean): cy;
  72. deleteDashboardByName(dashboardName: string, failOnStatusCode: boolean): cy;
  73. deleteChartByName(name: string, failOnStatusCode: boolean): cy;
  74. deleteChart(id: number, failOnStatusCode: boolean): cy;
  75. /**
  76. * Update
  77. */
  78. updateDashboard(dashboardId: number, body: Record<string, any>): cy;
  79. }
  80. }
  81. declare module '@cypress/code-coverage/task';