1- import { persesDashboardsAcceleratorsCommonMetricsPanels , persesDashboardsDashboardDropdownCOO , persesDashboardsDashboardDropdownPersesDev } from '../../fixtures/perses/constants' ;
1+ import { persesDashboardsAcceleratorsCommonMetricsPanels , persesDashboardsDashboardDropdownCOO , persesDashboardsDashboardDropdownPersesDev , persesDashboardsEmptyDashboard } from '../../fixtures/perses/constants' ;
22import { persesDashboardsPage } from '../../views/perses-dashboards' ;
33import { persesMUIDataTestIDs } from '../../../src/components/data-test' ;
4- import { listPersesDashboardsPage } from '../../views/list-perses-dashboards' ;
4+ import { listPersesDashboardsPage } from '../../views/perses-dashboards-list-dashboards' ;
5+ import { persesDashboardsPanelGroup } from '../../views/perses-dashboards-panelgroup' ;
6+ import { persesDashboardsPanel } from '../../views/perses-dashboards-panel' ;
7+ import { persesDashboardsEditVariables } from '../../views/perses-dashboards-edit-variables' ;
8+ import { persesCreateDashboardsPage } from '../../views/perses-dashboards-create-dashboard' ;
9+ import { persesDashboardsAddListVariableSource } from '../../fixtures/perses/constants' ;
10+ import { persesDashboardSampleQueries } from '../../fixtures/perses/constants' ;
11+ import { persesDashboardsAddListPanelType } from '../../fixtures/perses/constants' ;
12+ import { commonPages } from '../../views/common' ;
513
614export interface PerspectiveConfig {
715 name : string ;
@@ -17,14 +25,14 @@ export function testBVTCOOPerses1(perspective: PerspectiveConfig) {
1725 it ( `1.${ perspective . name } perspective - Dashboards (Perses) page` , ( ) => {
1826 cy . log ( `1.1. use sidebar nav to go to Observe > Dashboards (Perses)` ) ;
1927 listPersesDashboardsPage . shouldBeLoaded ( ) ;
20- listPersesDashboardsPage . clickDashboard ( persesDashboardsDashboardDropdownCOO . ACCELERATORS_COMMON_METRICS [ 2 ] ) ;
28+ listPersesDashboardsPage . clickDashboard ( persesDashboardsDashboardDropdownCOO . ACCELERATORS_COMMON_METRICS [ 0 ] ) ;
2129 persesDashboardsPage . shouldBeLoaded1 ( ) ;
2230 } ) ;
2331
2432 it ( `2.${ perspective . name } perspective - Accelerators common metrics dashboard ` , ( ) => {
2533 cy . log ( `2.1. use sidebar nav to go to Observe > Dashboards (Perses) > Accelerators common metrics dashboard` ) ;
2634 cy . changeNamespace ( 'openshift-cluster-observability-operator' ) ;
27- listPersesDashboardsPage . clickDashboard ( persesDashboardsDashboardDropdownCOO . ACCELERATORS_COMMON_METRICS [ 2 ] ) ;
35+ listPersesDashboardsPage . clickDashboard ( persesDashboardsDashboardDropdownCOO . ACCELERATORS_COMMON_METRICS [ 0 ] ) ;
2836 cy . wait ( 2000 ) ;
2937
3038 cy . log ( `2.2. Select dashboard` ) ;
@@ -39,7 +47,7 @@ export function testBVTCOOPerses1(perspective: PerspectiveConfig) {
3947 it ( `3.${ perspective . name } perspective - Perses Dashboard Sample dashboard` , ( ) => {
4048 cy . log ( `3.1. use sidebar nav to go to Observe > Dashboards (Perses) > Perses Dashboard Sample dashboard` ) ;
4149 cy . changeNamespace ( 'perses-dev' ) ;
42- listPersesDashboardsPage . clickDashboard ( persesDashboardsDashboardDropdownPersesDev . PERSES_DASHBOARD_SAMPLE [ 2 ] ) ;
50+ listPersesDashboardsPage . clickDashboard ( persesDashboardsDashboardDropdownPersesDev . PERSES_DASHBOARD_SAMPLE [ 0 ] ) ;
4351 cy . wait ( 2000 ) ;
4452 persesDashboardsPage . clickDashboardDropdown ( persesDashboardsDashboardDropdownPersesDev . PERSES_DASHBOARD_SAMPLE [ 0 ] as keyof typeof persesDashboardsDashboardDropdownPersesDev ) ;
4553 cy . byDataTestID ( persesMUIDataTestIDs . variableDropdown + '-job' ) . should ( 'be.visible' ) ;
@@ -56,12 +64,172 @@ export function testBVTCOOPerses1(perspective: PerspectiveConfig) {
5664
5765 it ( `4.${ perspective . name } perspective - Download and View JSON` , ( ) => {
5866 cy . log ( `4.1. use sidebar nav to go to Observe > Dashboards (Perses) > Download and View JSON` ) ;
59- listPersesDashboardsPage . clickDashboard ( persesDashboardsDashboardDropdownCOO . ACCELERATORS_COMMON_METRICS [ 2 ] ) ;
67+ listPersesDashboardsPage . clickDashboard ( persesDashboardsDashboardDropdownCOO . ACCELERATORS_COMMON_METRICS [ 0 ] ) ;
6068 persesDashboardsPage . downloadDashboard ( true , persesDashboardsDashboardDropdownCOO . ACCELERATORS_COMMON_METRICS [ 2 ] , 'JSON' ) ;
6169 persesDashboardsPage . downloadDashboard ( true , persesDashboardsDashboardDropdownCOO . ACCELERATORS_COMMON_METRICS [ 2 ] , 'YAML' ) ;
6270 persesDashboardsPage . downloadDashboard ( true , persesDashboardsDashboardDropdownCOO . ACCELERATORS_COMMON_METRICS [ 2 ] , 'YAML (CR)' ) ;
6371 persesDashboardsPage . viewJSON ( persesDashboardsDashboardDropdownCOO . ACCELERATORS_COMMON_METRICS [ 2 ] , 'openshift-cluster-observability-operator' ) ;
6472
6573 } ) ;
6674
75+ it ( `5.${ perspective . name } perspective - Duplicate from a project to another, Rename and Delete` , ( ) => {
76+ cy . log ( `5.1. use sidebar nav to go to Observe > Dashboards (Perses)` ) ;
77+ commonPages . titleShouldHaveText ( 'Dashboards' ) ;
78+ listPersesDashboardsPage . shouldBeLoaded ( ) ;
79+
80+ cy . log ( `5.2. Change namespace to perses-dev` ) ;
81+ cy . changeNamespace ( 'perses-dev' ) ;
82+ listPersesDashboardsPage . countDashboards ( '3' ) ;
83+ listPersesDashboardsPage . filter . byName ( persesDashboardsDashboardDropdownPersesDev . PERSES_DASHBOARD_SAMPLE [ 0 ] ) ;
84+ listPersesDashboardsPage . countDashboards ( '1' ) ;
85+
86+ cy . log ( `5.3. Click on the Kebab icon - Duplicate to another project` ) ;
87+ listPersesDashboardsPage . clickKebabIcon ( ) ;
88+ listPersesDashboardsPage . clickDuplicateOption ( ) ;
89+ listPersesDashboardsPage . duplicateDashboardEnterName ( persesDashboardsDashboardDropdownPersesDev . PERSES_DASHBOARD_SAMPLE [ 0 ] ) ;
90+ listPersesDashboardsPage . duplicateDashboardSelectProjectDropdown ( 'openshift-cluster-observability-operator' ) ;
91+ listPersesDashboardsPage . duplicateDashboardDuplicateButton ( ) ;
92+ persesDashboardsPage . shouldBeLoadedEditionMode ( persesDashboardsDashboardDropdownPersesDev . PERSES_DASHBOARD_SAMPLE [ 0 ] ) ;
93+ persesDashboardsPage . shouldBeLoadedAfterDuplicate ( persesDashboardsDashboardDropdownPersesDev . PERSES_DASHBOARD_SAMPLE [ 0 ] ) ;
94+ persesDashboardsPage . backToListPersesDashboardsPage ( ) ;
95+
96+ cy . log ( `5.4. Click on the Kebab icon - Rename` ) ;
97+ cy . changeNamespace ( 'openshift-cluster-observability-operator' ) ;
98+ listPersesDashboardsPage . filter . byName ( persesDashboardsDashboardDropdownPersesDev . PERSES_DASHBOARD_SAMPLE [ 0 ] ) ;
99+ listPersesDashboardsPage . countDashboards ( '1' ) ;
100+ listPersesDashboardsPage . clickKebabIcon ( ) ;
101+ listPersesDashboardsPage . clickRenameDashboardOption ( ) ;
102+ listPersesDashboardsPage . renameDashboardEnterName ( persesDashboardsDashboardDropdownPersesDev . PERSES_DASHBOARD_SAMPLE [ 0 ] + ' - Renamed' ) ;
103+ listPersesDashboardsPage . renameDashboardRenameButton ( ) ;
104+
105+ cy . log ( `5.5. Click on the Kebab icon - Delete` ) ;
106+ listPersesDashboardsPage . clearAllFilters ( ) ;
107+ listPersesDashboardsPage . filter . byName ( persesDashboardsDashboardDropdownPersesDev . PERSES_DASHBOARD_SAMPLE [ 0 ] + ' - Renamed' ) ;
108+ listPersesDashboardsPage . countDashboards ( '1' ) ;
109+
110+ cy . log ( `5.6. Click on the Kebab icon - Delete` ) ;
111+ listPersesDashboardsPage . clickKebabIcon ( ) ;
112+ listPersesDashboardsPage . clickDeleteOption ( ) ;
113+ listPersesDashboardsPage . deleteDashboardDeleteButton ( ) ;
114+ listPersesDashboardsPage . emptyState ( ) ;
115+ listPersesDashboardsPage . countDashboards ( '0' ) ;
116+
117+ cy . log ( `5.7. Search for the renamed dashboard` ) ;
118+ listPersesDashboardsPage . clearAllFilters ( ) ;
119+ cy . changeNamespace ( 'All Projects' ) ;
120+ listPersesDashboardsPage . filter . byName ( persesDashboardsDashboardDropdownPersesDev . PERSES_DASHBOARD_SAMPLE [ 0 ] + ' - Renamed' ) ;
121+ listPersesDashboardsPage . countDashboards ( '0' ) ;
122+ listPersesDashboardsPage . clearAllFilters ( ) ;
123+
124+ } ) ;
125+
126+ it ( `6.${ perspective . name } perspective - Create Dashboard with panel groups, panels and variables` , ( ) => {
127+ let dashboardName = 'Testing Dashboard - UP ' ;
128+ let randomSuffix = Math . random ( ) . toString ( 5 ) ;
129+ dashboardName += randomSuffix ;
130+ cy . log ( `6.1. use sidebar nav to go to Observe > Dashboards (Perses)` ) ;
131+ listPersesDashboardsPage . shouldBeLoaded ( ) ;
132+
133+ cy . log ( `6.2. Click on Create button` ) ;
134+ listPersesDashboardsPage . clickCreateButton ( ) ;
135+ persesCreateDashboardsPage . createDashboardShouldBeLoaded ( ) ;
136+
137+ cy . log ( `6.3. Create Dashboard` ) ;
138+ persesCreateDashboardsPage . selectProject ( 'perses-dev' ) ;
139+ persesCreateDashboardsPage . enterDashboardName ( dashboardName ) ;
140+ persesCreateDashboardsPage . createDashboardDialogCreateButton ( ) ;
141+ persesDashboardsPage . shouldBeLoadedEditionMode ( dashboardName ) ;
142+ persesDashboardsPage . shouldBeLoadedEditionModeFromCreateDashboard ( ) ;
143+
144+ cy . log ( `6.4. Add Variable` ) ;
145+ persesDashboardsPage . clickEditActionButton ( 'EditVariables' ) ;
146+ persesDashboardsEditVariables . clickButton ( 'Add Variable' ) ;
147+ persesDashboardsEditVariables . addListVariable ( 'interval' , false , false , '' , '' , '' , undefined , undefined ) ;
148+ persesDashboardsEditVariables . addListVariable_staticListVariable_enterValue ( '1m' ) ;
149+ persesDashboardsEditVariables . addListVariable_staticListVariable_enterValue ( '5m' ) ;
150+ persesDashboardsEditVariables . clickButton ( 'Add' ) ;
151+
152+ persesDashboardsEditVariables . clickButton ( 'Add Variable' ) ;
153+ persesDashboardsEditVariables . addListVariable ( 'job' , false , false , '' , '' , '' , persesDashboardsAddListVariableSource . PROMETHEUS_LABEL_VARIABLE , undefined ) ;
154+ persesDashboardsEditVariables . addListVariable_promLabelValuesVariable_enterLabelName ( 'job' ) ;
155+ persesDashboardsEditVariables . clickButton ( 'Add' ) ;
156+
157+ persesDashboardsEditVariables . clickButton ( 'Add Variable' ) ;
158+ persesDashboardsEditVariables . addListVariable ( 'instance' , false , false , '' , '' , '' , persesDashboardsAddListVariableSource . PROMETHEUS_LABEL_VARIABLE , undefined ) ;
159+ persesDashboardsEditVariables . addListVariable_promLabelValuesVariable_enterLabelName ( 'instance' ) ;
160+ persesDashboardsEditVariables . addListVariable_promLabelValuesVariable_addSeriesSelector ( persesDashboardSampleQueries . CPU_LINE_MULTI_SERIES_SERIES_SELECTOR ) ;
161+ persesDashboardsEditVariables . clickButton ( 'Add' ) ;
162+
163+ persesDashboardsEditVariables . clickButton ( 'Apply' ) ;
164+ persesDashboardsPage . clickEditActionButton ( 'Save' ) ;
165+
166+ cy . log ( `6.5. Add Panel Group` ) ;
167+ persesDashboardsPage . clickEditButton ( ) ;
168+ persesDashboardsPage . clickEditActionButton ( 'AddGroup' ) ;
169+ persesDashboardsPanelGroup . addPanelGroup ( 'Panel Group Up' , 'Open' , '' ) ;
170+
171+ cy . log ( `6.6. Add Panel` ) ;
172+ persesDashboardsPage . clickEditActionButton ( 'AddPanel' ) ;
173+ persesDashboardsPanel . addPanelShouldBeLoaded ( ) ;
174+ persesDashboardsPanel . addPanel ( 'Up' , 'Panel Group Up' , persesDashboardsAddListPanelType . TIME_SERIES_CHART , 'This is a line chart test' , 'up' ) ;
175+ persesDashboardsPage . clickEditActionButton ( 'Save' ) ;
176+
177+ cy . log ( `6.7. Back and check panel` ) ;
178+ persesDashboardsPage . backToListPersesDashboardsPage ( ) ;
179+ listPersesDashboardsPage . filter . byName ( dashboardName ) ;
180+ listPersesDashboardsPage . clickDashboard ( dashboardName ) ;
181+ persesDashboardsPage . panelGroupHeaderAssertion ( 'Panel Group Up' , 'Open' ) ;
182+ persesDashboardsPage . assertPanel ( 'Up' , 'Panel Group Up' , 'Open' ) ;
183+ persesDashboardsPage . assertVariableBeVisible ( 'interval' ) ;
184+ persesDashboardsPage . assertVariableBeVisible ( 'job' ) ;
185+ persesDashboardsPage . assertVariableBeVisible ( 'instance' ) ;
186+
187+ cy . log ( `6.8. Click on Edit button` ) ;
188+ persesDashboardsPage . clickEditButton ( ) ;
189+
190+ cy . log ( `6.9. Click on Edit Variables button and Delete all variables` ) ;
191+ persesDashboardsPage . clickEditActionButton ( 'EditVariables' ) ;
192+ persesDashboardsEditVariables . clickDeleteVariableButton ( 0 ) ;
193+ persesDashboardsEditVariables . clickDeleteVariableButton ( 0 ) ;
194+ persesDashboardsEditVariables . clickDeleteVariableButton ( 0 ) ;
195+ persesDashboardsEditVariables . clickButton ( 'Apply' ) ;
196+
197+ cy . log ( `6.10. Assert variables not exist` ) ;
198+ persesDashboardsPage . assertVariableNotExist ( 'interval' ) ;
199+ persesDashboardsPage . assertVariableNotExist ( 'job' ) ;
200+ persesDashboardsPage . assertVariableNotExist ( 'instance' ) ;
201+
202+ cy . log ( `6.11. Delete Panel` ) ;
203+ persesDashboardsPanel . deletePanel ( 'Up' ) ;
204+ persesDashboardsPanel . clickDeletePanelButton ( ) ;
205+
206+ cy . log ( `6.12. Delete Panel Group` ) ;
207+ persesDashboardsPanelGroup . clickPanelGroupAction ( 'Panel Group Up' , 'delete' ) ;
208+ persesDashboardsPanelGroup . clickDeletePanelGroupButton ( ) ;
209+ persesDashboardsPage . clickEditActionButton ( 'Save' ) ;
210+
211+ cy . get ( 'h2' ) . contains ( persesDashboardsEmptyDashboard . TITLE ) . scrollIntoView ( ) . should ( 'be.visible' ) ;
212+ cy . get ( 'p' ) . contains ( persesDashboardsEmptyDashboard . DESCRIPTION ) . scrollIntoView ( ) . should ( 'be.visible' ) ;
213+
214+ persesDashboardsPage . backToListPersesDashboardsPage ( ) ;
215+
216+ cy . log ( `6.13. Filter by Name` ) ;
217+ listPersesDashboardsPage . filter . byName ( dashboardName ) ;
218+ listPersesDashboardsPage . countDashboards ( '1' ) ;
219+
220+ cy . log ( `6.14. Click on the Kebab icon - Delete` ) ;
221+ listPersesDashboardsPage . clickKebabIcon ( ) ;
222+ listPersesDashboardsPage . clickDeleteOption ( ) ;
223+ listPersesDashboardsPage . deleteDashboardDeleteButton ( ) ;
224+ listPersesDashboardsPage . emptyState ( ) ;
225+ listPersesDashboardsPage . countDashboards ( '0' ) ;
226+ listPersesDashboardsPage . clearAllFilters ( ) ;
227+
228+ cy . log ( `6.15. Filter by Name` ) ;
229+ listPersesDashboardsPage . filter . byName ( dashboardName ) ;
230+ listPersesDashboardsPage . countDashboards ( '0' ) ;
231+ listPersesDashboardsPage . clearAllFilters ( ) ;
232+
233+ } ) ;
234+
67235}
0 commit comments