|
| 1 | +import { persesDashboardsDashboardDropdownCOO, persesDashboardsDashboardDropdownPersesDev } from '../../fixtures/perses/constants'; |
| 2 | +import { commonPages } from '../../views/common'; |
| 3 | +import { listPersesDashboardsPage } from "../../views/list-perses-dashboards"; |
| 4 | +import { persesDashboardsPage } from '../../views/perses-dashboards'; |
| 5 | + |
| 6 | +export interface PerspectiveConfig { |
| 7 | + name: string; |
| 8 | + beforeEach?: () => void; |
| 9 | +} |
| 10 | + |
| 11 | +export function runCOOListPersesTests(perspective: PerspectiveConfig) { |
| 12 | + testCOOListPerses(perspective); |
| 13 | +} |
| 14 | + |
| 15 | +export function testCOOListPerses(perspective: PerspectiveConfig) { |
| 16 | + |
| 17 | + it(`1.${perspective.name} perspective - List Dashboards (Perses) page`, () => { |
| 18 | + cy.log(`1.1. use sidebar nav to go to Observe > Dashboards (Perses)`); |
| 19 | + commonPages.titleShouldHaveText('Dashboards'); |
| 20 | + listPersesDashboardsPage.shouldBeLoaded(); |
| 21 | + |
| 22 | + cy.log(`1.2. Filter by Name`); |
| 23 | + listPersesDashboardsPage.filter.byName(persesDashboardsDashboardDropdownCOO.ACCELERATORS_COMMON_METRICS[2]); |
| 24 | + listPersesDashboardsPage.countDashboards('1'); |
| 25 | + |
| 26 | + cy.log(`1.3. Clear all filters`); |
| 27 | + listPersesDashboardsPage.clearAllFilters(); |
| 28 | + |
| 29 | + cy.log(`1.4. Filter by Project and Name`); |
| 30 | + listPersesDashboardsPage.filter.byProject('perses-dev'); |
| 31 | + listPersesDashboardsPage.countDashboards('3'); |
| 32 | + listPersesDashboardsPage.filter.byName(persesDashboardsDashboardDropdownPersesDev.PROMETHEUS_OVERVIEW[2]); |
| 33 | + listPersesDashboardsPage.countDashboards('1'); |
| 34 | + |
| 35 | + cy.log(`1.5. Clear all filters`); |
| 36 | + listPersesDashboardsPage.clearAllFilters(); |
| 37 | + |
| 38 | + cy.log(`1.6. Filter by Project`); |
| 39 | + listPersesDashboardsPage.filter.byProject('perses-dev'); |
| 40 | + |
| 41 | + cy.log(`1.7. Clear all filters`); |
| 42 | + listPersesDashboardsPage.clearAllFilters(); |
| 43 | + |
| 44 | + cy.log(`1.8. Sort by Dashboard - Ascending`); |
| 45 | + listPersesDashboardsPage.sortBy('Dashboard'); |
| 46 | + listPersesDashboardsPage.assertDashboardName(persesDashboardsDashboardDropdownCOO.ACCELERATORS_COMMON_METRICS[2], 0); |
| 47 | + listPersesDashboardsPage.assertDashboardName(persesDashboardsDashboardDropdownCOO.APM_DASHBOARD[2], 1); |
| 48 | + listPersesDashboardsPage.assertDashboardName(persesDashboardsDashboardDropdownCOO.K8S_COMPUTE_RESOURCES_CLUSTER[2], 2); |
| 49 | + listPersesDashboardsPage.assertDashboardName(persesDashboardsDashboardDropdownPersesDev.PERSES_DASHBOARD_SAMPLE[2], 3); |
| 50 | + listPersesDashboardsPage.assertDashboardName(persesDashboardsDashboardDropdownPersesDev.PROMETHEUS_OVERVIEW[2], 4); |
| 51 | + listPersesDashboardsPage.assertDashboardName(persesDashboardsDashboardDropdownPersesDev.THANOS_COMPACT_OVERVIEW[2], 5); |
| 52 | + |
| 53 | + cy.log(`1.9. Sort by Dashboard - Descending`); |
| 54 | + listPersesDashboardsPage.sortBy('Dashboard'); |
| 55 | + listPersesDashboardsPage.assertDashboardName(persesDashboardsDashboardDropdownPersesDev.THANOS_COMPACT_OVERVIEW[2], 0); |
| 56 | + listPersesDashboardsPage.assertDashboardName(persesDashboardsDashboardDropdownPersesDev.PROMETHEUS_OVERVIEW[2], 1); |
| 57 | + listPersesDashboardsPage.assertDashboardName(persesDashboardsDashboardDropdownPersesDev.PERSES_DASHBOARD_SAMPLE[2], 2); |
| 58 | + listPersesDashboardsPage.assertDashboardName(persesDashboardsDashboardDropdownCOO.K8S_COMPUTE_RESOURCES_CLUSTER[2], 3); |
| 59 | + listPersesDashboardsPage.assertDashboardName(persesDashboardsDashboardDropdownCOO.APM_DASHBOARD[2], 4); |
| 60 | + listPersesDashboardsPage.assertDashboardName(persesDashboardsDashboardDropdownCOO.ACCELERATORS_COMMON_METRICS[2], 5); |
| 61 | + |
| 62 | + cy.log(`1.10. Filter by Name - Empty state`); |
| 63 | + listPersesDashboardsPage.filter.byName(persesDashboardsDashboardDropdownCOO.ACCELERATORS_COMMON_METRICS[0]); |
| 64 | + listPersesDashboardsPage.emptyState(); |
| 65 | + listPersesDashboardsPage.countDashboards('0'); |
| 66 | + |
| 67 | + cy.log(`1.11. Clear all filters`); |
| 68 | + listPersesDashboardsPage.clearAllFilters(); |
| 69 | + |
| 70 | + cy.log(`1.12. Click on a dashboard`); |
| 71 | + listPersesDashboardsPage.clickDashboard(persesDashboardsDashboardDropdownPersesDev.THANOS_COMPACT_OVERVIEW[2]); |
| 72 | + //TODO: change back to shouldBeLoaded when customizable-dashboards gets merged |
| 73 | + // persesDashboardsPage.shouldBeLoaded1(); |
| 74 | + }); |
| 75 | + |
| 76 | +} |
0 commit comments